ukiryu 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/release.yml +58 -14
  3. data/.gitignore +3 -0
  4. data/.rubocop_todo.yml +170 -79
  5. data/Gemfile +1 -1
  6. data/README.adoc +1603 -576
  7. data/docs/.gitignore +1 -0
  8. data/docs/Gemfile +10 -0
  9. data/docs/INDEX.adoc +261 -0
  10. data/docs/_config.yml +180 -0
  11. data/docs/advanced/custom-tool-classes.adoc +581 -0
  12. data/docs/advanced/index.adoc +20 -0
  13. data/docs/features/configuration.adoc +657 -0
  14. data/docs/features/index.adoc +31 -0
  15. data/docs/features/platform-support.adoc +488 -0
  16. data/docs/getting-started/core-concepts.adoc +666 -0
  17. data/docs/getting-started/index.adoc +36 -0
  18. data/docs/getting-started/installation.adoc +216 -0
  19. data/docs/getting-started/quick-start.adoc +258 -0
  20. data/docs/guides/env-var-sets.adoc +388 -0
  21. data/docs/guides/index.adoc +20 -0
  22. data/docs/interfaces/cli.adoc +609 -0
  23. data/docs/interfaces/index.adoc +153 -0
  24. data/docs/interfaces/ruby-api.adoc +538 -0
  25. data/docs/lychee.toml +49 -0
  26. data/docs/reference/configuration-options.adoc +720 -0
  27. data/docs/reference/error-codes.adoc +634 -0
  28. data/docs/reference/index.adoc +20 -0
  29. data/docs/reference/ruby-api.adoc +1217 -0
  30. data/docs/understanding/index.adoc +20 -0
  31. data/lib/ukiryu/cli.rb +43 -58
  32. data/lib/ukiryu/cli_commands/base_command.rb +16 -27
  33. data/lib/ukiryu/cli_commands/cache_command.rb +100 -0
  34. data/lib/ukiryu/cli_commands/commands_command.rb +8 -8
  35. data/lib/ukiryu/cli_commands/commands_command.rb.fixed +1 -1
  36. data/lib/ukiryu/cli_commands/config_command.rb +49 -7
  37. data/lib/ukiryu/cli_commands/definitions_command.rb +254 -0
  38. data/lib/ukiryu/cli_commands/describe_command.rb +13 -7
  39. data/lib/ukiryu/cli_commands/describe_command.rb.fixed +1 -1
  40. data/lib/ukiryu/cli_commands/docs_command.rb +148 -0
  41. data/lib/ukiryu/cli_commands/exec_inline_command.rb.fixed +1 -1
  42. data/lib/ukiryu/cli_commands/extract_command.rb +2 -2
  43. data/lib/ukiryu/cli_commands/info_command.rb +7 -7
  44. data/lib/ukiryu/cli_commands/lint_command.rb +167 -0
  45. data/lib/ukiryu/cli_commands/list_command.rb +6 -6
  46. data/lib/ukiryu/cli_commands/opts_command.rb +2 -2
  47. data/lib/ukiryu/cli_commands/opts_command.rb.fixed +1 -1
  48. data/lib/ukiryu/cli_commands/register_command.rb +144 -0
  49. data/lib/ukiryu/cli_commands/resolve_command.rb +124 -0
  50. data/lib/ukiryu/cli_commands/run_command.rb +38 -14
  51. data/lib/ukiryu/cli_commands/run_file_command.rb +2 -2
  52. data/lib/ukiryu/cli_commands/system_command.rb +50 -32
  53. data/lib/ukiryu/cli_commands/validate_command.rb +452 -51
  54. data/lib/ukiryu/cli_commands/which_command.rb +5 -5
  55. data/lib/ukiryu/command_builder.rb +81 -23
  56. data/lib/ukiryu/config/env_provider.rb +3 -3
  57. data/lib/ukiryu/config/env_schema.rb +6 -6
  58. data/lib/ukiryu/config.rb +11 -11
  59. data/lib/ukiryu/definition/definition_cache.rb +238 -0
  60. data/lib/ukiryu/definition/definition_composer.rb +257 -0
  61. data/lib/ukiryu/definition/definition_linter.rb +460 -0
  62. data/lib/ukiryu/definition/definition_validator.rb +320 -0
  63. data/lib/ukiryu/definition/discovery.rb +239 -0
  64. data/lib/ukiryu/definition/documentation_generator.rb +429 -0
  65. data/lib/ukiryu/definition/lint_issue.rb +168 -0
  66. data/lib/ukiryu/definition/loader.rb +139 -0
  67. data/lib/ukiryu/definition/metadata.rb +159 -0
  68. data/lib/ukiryu/definition/source.rb +87 -0
  69. data/lib/ukiryu/definition/sources/file.rb +138 -0
  70. data/lib/ukiryu/definition/sources/string.rb +88 -0
  71. data/lib/ukiryu/definition/validation_result.rb +158 -0
  72. data/lib/ukiryu/definition/version_resolver.rb +194 -0
  73. data/lib/ukiryu/definition.rb +40 -0
  74. data/lib/ukiryu/errors.rb +6 -0
  75. data/lib/ukiryu/execution_context.rb +11 -11
  76. data/lib/ukiryu/executor.rb +6 -0
  77. data/lib/ukiryu/extractors/extractor.rb +6 -5
  78. data/lib/ukiryu/extractors/help_parser.rb +13 -19
  79. data/lib/ukiryu/logger.rb +3 -1
  80. data/lib/ukiryu/models/command_definition.rb +3 -3
  81. data/lib/ukiryu/models/command_info.rb +1 -1
  82. data/lib/ukiryu/models/components.rb +1 -3
  83. data/lib/ukiryu/models/env_var_definition.rb +11 -3
  84. data/lib/ukiryu/models/flag_definition.rb +15 -0
  85. data/lib/ukiryu/models/option_definition.rb +7 -7
  86. data/lib/ukiryu/models/platform_profile.rb +6 -3
  87. data/lib/ukiryu/models/routing.rb +1 -1
  88. data/lib/ukiryu/models/tool_definition.rb +2 -4
  89. data/lib/ukiryu/models/tool_metadata.rb +6 -6
  90. data/lib/ukiryu/models/validation_result.rb +1 -1
  91. data/lib/ukiryu/models/version_compatibility.rb +6 -3
  92. data/lib/ukiryu/models/version_detection.rb +10 -1
  93. data/lib/ukiryu/{registry.rb → register.rb} +54 -38
  94. data/lib/ukiryu/register_auto_manager.rb +268 -0
  95. data/lib/ukiryu/schema_validator.rb +31 -10
  96. data/lib/ukiryu/shell/base.rb +18 -0
  97. data/lib/ukiryu/shell/bash.rb +19 -1
  98. data/lib/ukiryu/shell/cmd.rb +11 -1
  99. data/lib/ukiryu/shell/powershell.rb +11 -1
  100. data/lib/ukiryu/shell.rb +1 -1
  101. data/lib/ukiryu/tool.rb +107 -95
  102. data/lib/ukiryu/tool_index.rb +22 -22
  103. data/lib/ukiryu/tools/base.rb +12 -25
  104. data/lib/ukiryu/tools/generator.rb +7 -7
  105. data/lib/ukiryu/tools.rb +3 -3
  106. data/lib/ukiryu/type.rb +20 -5
  107. data/lib/ukiryu/version.rb +1 -1
  108. data/lib/ukiryu/version_detector.rb +21 -2
  109. data/lib/ukiryu.rb +6 -3
  110. data/ukiryu-proposal.md +41 -41
  111. data/ukiryu.gemspec +1 -0
  112. metadata +64 -8
  113. data/.gitmodules +0 -3
@@ -0,0 +1,216 @@
1
+ ---
2
+ layout: default
3
+ title: Installation
4
+ parent: Getting Started
5
+ nav_order: 1
6
+ ---
7
+
8
+ == Installation
9
+
10
+ Install Ukiryu using your preferred method.
11
+
12
+ // Purpose
13
+ == Purpose
14
+
15
+ This page describes how to install Ukiryu on your system using different methods.
16
+
17
+ // References
18
+ == References
19
+
20
+ * link:https://rubygems.org/gems/ukiryu[Ukiryu on RubyGems]
21
+ * link:https://github.com/ukiryu/ukiryu[Ukiryu GitHub Repository]
22
+
23
+ // Concepts
24
+ == Concepts
25
+
26
+ * **Gem installation**: Installing via RubyGems for system-wide use
27
+ * **Bundler installation**: Installing via Bundler for project dependencies
28
+ * **Development installation**: Installing from source for contribution
29
+
30
+ // Installation Methods
31
+ == Installation Methods
32
+
33
+ === Via RubyGems
34
+
35
+ The simplest way to install Ukiryu:
36
+
37
+ [source,bash]
38
+ ----
39
+ gem install ukiryu
40
+ ----
41
+
42
+ Verify installation:
43
+
44
+ [source,bash]
45
+ ----
46
+ ukiryu version
47
+ ----
48
+
49
+ Expected output:
50
+ [source]
51
+ ----
52
+ Ukiryu VERSION
53
+ ----
54
+
55
+ === Via Bundler
56
+
57
+ Add to your `Gemfile`:
58
+
59
+ [source,ruby]
60
+ ----
61
+ gem 'ukiryu'
62
+ ----
63
+
64
+ Then install:
65
+
66
+ [source,bash]
67
+ ----
68
+ bundle install
69
+ ----
70
+
71
+ === From Source
72
+
73
+ For development or to get the latest features:
74
+
75
+ [source,bash]
76
+ ----
77
+ # Clone the repository
78
+ git clone https://github.com/ukiryu/ukiryu.git
79
+ cd ukiryu
80
+
81
+ # Install dependencies
82
+ bundle install
83
+
84
+ # Build the gem
85
+ gem build ukiryu.gemspec
86
+
87
+ # Install the gem
88
+ gem install ukiryu-*.gem
89
+ ----
90
+
91
+ // Register Setup
92
+ == Register Setup
93
+
94
+ Ukiryu requires a register of tool profiles. The register location is automatically discovered in the following order:
95
+
96
+ === Automatic Discovery
97
+
98
+ Ukiryu will automatically clone the tool register to `~/.ukiryu/register` on first use.
99
+
100
+ [source,bash]
101
+ ----
102
+ # The register is auto-cloned to this location:
103
+ ~/.ukiryu/register/
104
+ ----
105
+
106
+ === Environment Variable
107
+
108
+ Set the `UKIRYU_REGISTER` environment variable to use a custom register location:
109
+
110
+ [source,bash]
111
+ ----
112
+ # Unix/Linux/macOS
113
+ export UKIRYU_REGISTER=/path/to/register
114
+
115
+ # Windows (Command Prompt)
116
+ set UKIRYU_REGISTER=C:\path\to\register
117
+
118
+ # Windows (PowerShell)
119
+ $env:UKIRYU_REGISTER="C:\path\to\register"
120
+ ----
121
+
122
+ === Programmatic Configuration
123
+
124
+ Set the register path in your Ruby code:
125
+
126
+ [source,ruby]
127
+ ----
128
+ Ukiryu::Register.default_register_path = '/path/to/register'
129
+ ----
130
+
131
+ // Verifying Installation
132
+ == Verifying Installation
133
+
134
+ Check that Ukiryu is properly installed:
135
+
136
+ [source,bash]
137
+ ----
138
+ # Check version
139
+ ukiryu version
140
+
141
+ # List available tools
142
+ ukiryu list
143
+
144
+ # Get tool information
145
+ ukiryu info inkscape
146
+ ----
147
+
148
+ Expected output shows available tools and their status:
149
+
150
+ [source]
151
+ ----
152
+ ============================================================
153
+ Tool: inkscape
154
+ ============================================================
155
+
156
+ Display Name: Inkscape Vector Graphics Editor
157
+ Version: 1.0
158
+ Homepage: https://inkscape.org/
159
+ ...
160
+ ----
161
+
162
+ // Troubleshooting
163
+ == Troubleshooting
164
+
165
+ === Command Not Found
166
+
167
+ If `ukiryu` command is not found:
168
+
169
+ [source,bash]
170
+ ----
171
+ # Check Rubygems bin directory
172
+ ruby -e 'puts Gem.user_dir'/bin
173
+
174
+ # Add to PATH (Unix/Linux/macOS)
175
+ export PATH="$(ruby -e 'puts Gem.user_dir')/bin:$PATH"
176
+
177
+ # Add to PATH (Windows - add to System Environment Variables)
178
+ # C:\Ruby\{VERSION}\bin
179
+ ----
180
+
181
+ === Register Not Found
182
+
183
+ If tools aren't found:
184
+
185
+ [source,bash]
186
+ ----
187
+ # Verify register location
188
+ ls $UKIRYU_REGISTER/tools/
189
+
190
+ # Or check default location
191
+ ls ~/.ukiryu/register/tools/
192
+ ----
193
+
194
+ === Tool Not Installed
195
+
196
+ If a tool shows "NOT FOUND":
197
+
198
+ [source,bash]
199
+ ----
200
+ # Install the tool using your system package manager
201
+ # macOS
202
+ brew install inkscape imagemagick ghostscript
203
+
204
+ # Ubuntu/Debian
205
+ sudo apt-get install inkscape imagemagick ghostscript
206
+
207
+ # Windows
208
+ # Download installers from tool websites
209
+ ----
210
+
211
+ // Next Steps
212
+ == Next Steps
213
+
214
+ * link:/getting-started/quick-start[Quick Start Guide] - Learn basic usage
215
+ * link:/getting-started/core-concepts[Core Concepts] - Understand how Ukiryu works
216
+ * link:/interfaces/ruby-api[Ruby API] - Explore the programming interface
@@ -0,0 +1,258 @@
1
+ ---
2
+ layout: default
3
+ title: Quick Start
4
+ parent: Getting Started
5
+ nav_order: 2
6
+ ---
7
+
8
+ == Quick Start
9
+
10
+ Learn the basics of using Ukiryu through practical examples.
11
+
12
+ // Purpose
13
+ == Purpose
14
+
15
+ This page provides a quick introduction to Ukiryu's three configuration methods: Ruby API, CLI, and environment variables.
16
+
17
+ // References
18
+ == References
19
+
20
+ * link:/interfaces/ruby-api[Ruby API Documentation]
21
+ * link:/interfaces/cli[CLI Documentation]
22
+ * link:/features/configuration[Configuration Options]
23
+
24
+ // Concepts
25
+ == Concepts
26
+
27
+ * **Tool profiles**: YAML files that define tool behavior
28
+ * **Platform adaptation**: Automatic handling of platform differences
29
+ * **Shell awareness**: Proper quoting and escaping for different shells
30
+ * **Configuration precedence**: ENV > CLI parameters > Ruby API > defaults
31
+
32
+ // Basic Example
33
+ == Basic Example
34
+
35
+ Let's start with a simple example: converting an SVG file to PNG using Inkscape.
36
+
37
+ === Ruby API
38
+
39
+ [source,ruby]
40
+ ----
41
+ require 'ukiryu'
42
+
43
+ tool = Ukiryu::Tool.get(:inkscape)
44
+ result = tool.execute(:export, {
45
+ inputs: ['drawing.svg'],
46
+ output: 'drawing.png',
47
+ format: :png
48
+ })
49
+
50
+ if result.success?
51
+ puts "Conversion successful!"
52
+ puts "Output file: #{result.command_info.full_command}"
53
+ else
54
+ puts "Conversion failed!"
55
+ puts "Error: #{result.stderr}"
56
+ end
57
+ ----
58
+
59
+ === CLI
60
+
61
+ [source,bash]
62
+ ----
63
+ ukiryu exec inkscape export \
64
+ inputs=drawing.svg \
65
+ output=drawing.png \
66
+ format=png
67
+ ----
68
+
69
+ === Environment Variables
70
+
71
+ [source,bash]
72
+ ----
73
+ # Set default register
74
+ export UKIRYU_REGISTER=/path/to/register
75
+
76
+ # Set default timeout for all commands
77
+ export UKIRYU_TIMEOUT=120
78
+
79
+ # Enable debug output
80
+ export UKIRYU_DEBUG=true
81
+
82
+ # Now run the command
83
+ ukiryu exec inkscape export inputs=drawing.svg output=drawing.png format=png
84
+ ----
85
+
86
+ // Configuration Precedence
87
+ == Configuration Precedence
88
+
89
+ Understanding how different configuration methods interact:
90
+
91
+ [NOTE]
92
+ .Configuration Precedence (Highest to Lowest)
93
+ 1. Environment variables
94
+ 2. Command-line parameters
95
+ 3. Ruby API parameters
96
+ 4. Profile defaults
97
+
98
+ === Example: Setting Timeout
99
+
100
+ All three methods can set the timeout, but ENV takes precedence:
101
+
102
+ [source,ruby]
103
+ ----
104
+ # Profile default: 90 seconds
105
+ # CLI parameter: 60 seconds
106
+ # ENV variable: 120 seconds (wins!)
107
+ tool = Ukiryu::Tool.get(:inkscape)
108
+ result = tool.execute(:export, {
109
+ inputs: ['drawing.svg'],
110
+ output: 'drawing.png',
111
+ format: :png
112
+ }, timeout: 60)
113
+ ----
114
+
115
+ [source,bash]
116
+ ----
117
+ # Environment variable overrides everything
118
+ export UKIRYU_TIMEOUT=120
119
+ ukiryu exec inkscape export inputs=drawing.svg output=drawing.png format=png
120
+ ----
121
+
122
+ // Common Operations
123
+ == Common Operations
124
+
125
+ === Listing Available Tools
126
+
127
+ [source,bash]
128
+ ----
129
+ ukiryu list
130
+ ----
131
+
132
+ Shows all available tools with their installation status.
133
+
134
+ === Getting Tool Information
135
+
136
+ [source,bash]
137
+ ----
138
+ ukiryu info imagemagick
139
+ ----
140
+
141
+ Displays detailed information including search paths, version detection, and profiles.
142
+
143
+ === Describing Commands
144
+
145
+ [source,bash]
146
+ ----
147
+ ukiryu describe imagemagick convert
148
+ ----
149
+
150
+ Shows command usage, arguments, options, and flags.
151
+
152
+ === Running Commands
153
+
154
+ [source,bash]
155
+ ----
156
+ # Basic usage
157
+ ukiryu exec imagemagick convert inputs=input.jpg output=output.png
158
+
159
+ # With multiple options
160
+ ukiryu exec imagemagick convert \
161
+ inputs=input.jpg \
162
+ output=output.png \
163
+ resize=50% \
164
+ quality=85 \
165
+ strip=true
166
+ ----
167
+
168
+ // Platform Adaptation
169
+ == Platform Adaptation
170
+
171
+ Ukiryu automatically handles platform differences:
172
+
173
+ === Paths
174
+
175
+ [source,ruby]
176
+ ----
177
+ # Same code works on all platforms
178
+ tool = Ukiryu::Tool.get(:inkscape)
179
+ result = tool.execute(:export, {
180
+ inputs: ['/path/to/drawing.svg'], # Unix-style
181
+ output: '/path/to/drawing.png'
182
+ })
183
+ ----
184
+
185
+ On Windows, paths are automatically converted:
186
+ [source]
187
+ ----
188
+ C:\path\to\drawing.svg
189
+ ----
190
+
191
+ === Shell Quoting
192
+
193
+ [source,ruby]
194
+ ----
195
+ # Arguments with spaces are handled correctly
196
+ result = tool.execute(:export, {
197
+ inputs: ['My Document.svg'], # Spaces in filename
198
+ output: 'output.png'
199
+ })
200
+ ----
201
+
202
+ On different shells, proper quoting is applied:
203
+ * bash/zsh: `'My Document.svg'`
204
+ * PowerShell: `'My Document.svg'`
205
+ * cmd: `"My Document.svg"`
206
+
207
+ // Error Handling
208
+ == Error Handling
209
+
210
+ === Ruby API
211
+
212
+ [source,ruby]
213
+ ----
214
+ require 'ukiryu'
215
+
216
+ begin
217
+ tool = Ukiryu::Tool.get(:inkscape)
218
+ result = tool.execute(:export, {
219
+ inputs: ['drawing.svg'],
220
+ output: 'drawing.png',
221
+ format: :png
222
+ })
223
+ rescue Ukiryu::ToolNotFoundError => e
224
+ puts "Tool not found!"
225
+ puts "Available tools: #{Ukiryu::Register.tools.join(', ')}"
226
+ rescue Ukiryu::ExecutionError => e
227
+ puts "Command failed!"
228
+ puts "Exit code: #{e.result.exit_status}"
229
+ puts "Stderr: #{e.result.stderr}"
230
+ rescue Ukiryu::TimeoutError => e
231
+ puts "Command timed out!"
232
+ end
233
+ ----
234
+
235
+ === CLI
236
+
237
+ The CLI returns exit codes:
238
+ * `0` - Success
239
+ * `1` - Command execution failed
240
+ * Other - Internal error
241
+
242
+ [source,bash]
243
+ ----
244
+ ukiryu exec inkscape export inputs=drawing.svg output=drawing.png format=png
245
+ if [ $? -eq 0 ]; then
246
+ echo "Success!"
247
+ else
248
+ echo "Failed with exit code $?"
249
+ fi
250
+ ----
251
+
252
+ // Next Steps
253
+ == Next Steps
254
+
255
+ * link:/getting-started/core-concepts[Core Concepts] - Understanding profiles, platforms, and shells
256
+ * link:/interfaces/ruby-api[Ruby API] - Complete API reference
257
+ * link:/features/configuration[Configuration Options] - All configuration methods
258
+ * link:/guides/[Guides] - Task-oriented tutorials