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
data/docs/.gitignore ADDED
@@ -0,0 +1 @@
1
+ .sass-cache/
data/docs/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gem 'jekyll', '~> 3.10'
6
+ gem 'jekyll-asciidoc', '~> 3.0'
7
+ gem 'jekyll-seo-tag', '~> 2.8'
8
+ gem 'jekyll-sitemap', '~> 1.4'
9
+ gem 'just-the-docs', '~> 0.7.0'
10
+ gem 'kramdown-parser-gfm', '~> 1.1'
data/docs/INDEX.adoc ADDED
@@ -0,0 +1,261 @@
1
+ ---
2
+ layout: default
3
+ title: "Ukiryu: Open Definitions For CLI Tools"
4
+ nav_order: 1
5
+ ---
6
+
7
+ == Ukiryu: Open Definitions For CLI Tools
8
+
9
+ The "OpenAPI" for Command Line Interfaces.
10
+
11
+ // Purpose
12
+ == Purpose
13
+
14
+ Ukiryu is a framework for defining command-line interfaces as declarative APIs.
15
+
16
+ It makes the following possible:
17
+
18
+ * Declarative definition of command-line interfaces, options, parameters and
19
+ typed arguments
20
+ * Harmonized definitions across platforms and shell environments
21
+ * Unified action interface across versioned and variant command interfaces
22
+ * Structured input and output handling, with type safety and validation
23
+
24
+
25
+ The Ukiryu framework has the following components:
26
+
27
+ * **Register**: A collection of tool profiles encoded in YAML, organized by tool
28
+ name and version
29
+
30
+ * **Schema**: A formal definition of the structure and types used in tool
31
+ profiles
32
+
33
+ * **Runtime**: A platform-adaptive Ruby library that provides a harmonized API
34
+ interface for CLI commands.
35
+
36
+
37
+ == Origin
38
+
39
+ The name 浮流 "ukiryu" (lit. "Floating Flow") is inspired by 天浮橋
40
+ "ame-no-ukihashi" (lit. "Floating Bridge of Heaven"), the mythical bridge that
41
+ connects heaven and earth.
42
+
43
+ The ame-no-ukihashi is described in Japanese mythology as the place where the
44
+ God Izanagi and Goddess Izanami stood at creating the Japanese archipelago.
45
+
46
+ The pronunciation of "ukiryu" ("yoo-kee-rhoo") is the English transliteration of
47
+ the Kanji characters 「浮流」, read in Hiragana as 「うきりゅう」.
48
+
49
+ In the view that a command line tool is a vessel for performing tasks, Ukiryu
50
+ serves as the flexible flow that guides its path through different environments.
51
+
52
+
53
+ == Why Ukiryu?
54
+
55
+ * **Platform-adaptive**: Commands work seamlessly across macOS, Linux, and Windows
56
+ * **Shell-aware**: Proper quoting and escaping for bash, zsh, fish, PowerShell, and cmd
57
+ * **Versioned**: Support multiple tool versions with distinct interfaces
58
+ * **Interface-capable**: Different implementations of the same command interface
59
+ * **Declarative**: Tool behavior defined in YAML profiles, not code
60
+ * **Type-safe**: Parameter validation with automatic type coercion
61
+
62
+
63
+ == Quick Start
64
+
65
+ Use the command-line interface:
66
+
67
+ [source,bash]
68
+ ----
69
+ # List available tools
70
+ ukiryu list
71
+
72
+ # Show tool information
73
+ ukiryu info inkscape
74
+
75
+ # Describe a command
76
+ ukiryu describe inkscape export
77
+
78
+ # Convert SVG to PNG
79
+ ukiryu exec inkscape export inputs=input.svg output=output.png format=png
80
+ ----
81
+
82
+ Or use the Ruby API:
83
+
84
+ [source,ruby]
85
+ ----
86
+ # Install
87
+ gem install ukiryu
88
+
89
+ # Use in Ruby
90
+ require 'ukiryu'
91
+
92
+ tool = Ukiryu::Tool.get(:inkscape)
93
+ result = tool.execute(:export, {
94
+ inputs: ['input.svg'],
95
+ output: 'output.png',
96
+ format: :png
97
+ })
98
+
99
+ puts result.success? ? "Success!" : "Failed: #{result.stderr}"
100
+ ----
101
+
102
+
103
+ == What Can You Do With Ukiryu?
104
+
105
+ === By Role
106
+
107
+ [source]
108
+ ==== Developer
109
+ * Integrate command-line tools into Ruby applications
110
+ * Write cross-platform scripts that work everywhere
111
+ * Build tools with consistent interfaces across platforms
112
+
113
+ ==== QA Engineer
114
+ * Automate testing with tools like ImageMagick, Ghostscript
115
+ * Run tests on CI/CD across different platforms
116
+ * Validate tool outputs programmatically
117
+
118
+ ==== DevOps Engineer
119
+ * Create deployment scripts that work on any platform
120
+ * Manage tool versions and compatibility
121
+ * Debug tool execution issues
122
+
123
+ ==== Tool Maintainer
124
+ * Publish tool profiles for community use
125
+ * Support multiple tool versions simultaneously
126
+ * Handle platform-specific differences declaratively
127
+
128
+ === By Task
129
+
130
+ [source]
131
+ ==== Execute Commands
132
+ * Run tools with type-safe parameters
133
+ * Get structured results with success/failure info
134
+ * Handle timeouts and errors gracefully
135
+
136
+ ==== Format Conversion
137
+ * Convert between image formats (ImageMagick, Inkscape)
138
+ * Process PDF/PostScript (Ghostscript)
139
+ * Transform data formats (jq, yq)
140
+
141
+ ==== Testing & Validation
142
+ * Compare outputs with diff tools
143
+ * Validate file formats and metadata
144
+ * Test CLI behavior programmatically
145
+
146
+ ==== Platform Adaptation
147
+ * Handle path differences (/ vs \)
148
+ * Manage shell quoting and escaping
149
+ * Adapt to platform-specific tool locations
150
+
151
+ // How Ukiryu Works
152
+ == How Ukiryu Works
153
+
154
+ Ukiryu uses a three-layer architecture:
155
+
156
+ [source]
157
+ ----
158
+ ┌─────────────────────────────────────────────┐
159
+ │ Ruby API / CLI │
160
+ │ Tool.get(:imagemagick).execute(...) │
161
+ └─────────────────┬───────────────────────────┘
162
+
163
+ ┌─────────────────▼───────────────────────────┐
164
+ │ Register & Profiles │
165
+ │ tools/inkscape/1.0.yaml (declarative) │
166
+ └─────────────────┬───────────────────────────┐
167
+
168
+ ┌─────────────────▼───────────────────────────┐
169
+ │ Platform & Shell Adaptation │
170
+ │ Bash / Zsh / Fish / PowerShell / Cmd │
171
+ └─────────────────────────────────────────────┘
172
+ ----
173
+
174
+ * **Register**: Loads tool profiles from YAML files
175
+ * **Profiles**: Define tool behavior, versions, and platform support
176
+ * **Shell Layer**: Handles quoting, escaping, and command formatting
177
+
178
+ // Learning Paths
179
+ == Learning Paths
180
+
181
+ === Beginner
182
+
183
+ 1. link:/getting-started/installation[Installation]
184
+ 2. link:/getting-started/quick-start[Quick Start Guide]
185
+ 3. link:/getting-started/core-concepts[Core Concepts]
186
+
187
+ === Intermediate
188
+
189
+ 1. link:/interfaces/ruby-api[Ruby API]
190
+ 2. link:/interfaces/cli[Command Line Interface]
191
+ 3. link:/features/configuration[Configuration Layers]
192
+
193
+ === Advanced
194
+
195
+ 1. link:/understanding/architecture[Architecture & Internals]
196
+ 2. link:/advanced/writing-profiles[Writing Tool Profiles]
197
+ 3. link:/advanced/platform-handling[Platform-Specific Handling]
198
+
199
+ === Reference
200
+
201
+ 1. link:/reference/tool-profile-schema[Tool Profile Schema]
202
+ 2. link:/reference/configuration-options[All Configuration Options]
203
+ 3. link:/reference/error-codes[Error Codes & Messages]
204
+
205
+ // Configuration Methods
206
+ == Configuration Methods
207
+
208
+ Ukiryu supports three ways to configure tool execution, with clear precedence:
209
+
210
+ [NOTE]
211
+ Configuration precedence (highest to lowest):
212
+ 1. Environment variables
213
+ 2. Command-line parameters
214
+ 3. Ruby API parameters
215
+ 4. Profile defaults
216
+
217
+ === Ruby API
218
+
219
+ [source,ruby]
220
+ ----
221
+ tool = Ukiryu::Tool.get(:inkscape)
222
+ result = tool.execute(:export, {
223
+ inputs: ['drawing.svg'],
224
+ output: 'drawing.png',
225
+ format: :png,
226
+ dpi: 300
227
+ })
228
+ ----
229
+
230
+ === Command Line
231
+
232
+ [source,bash]
233
+ ----
234
+ ukiryu exec inkscape export \
235
+ inputs=drawing.svg \
236
+ output=drawing.png \
237
+ format=png \
238
+ dpi=300
239
+ ----
240
+
241
+ === Environment Variables
242
+
243
+ [source,bash]
244
+ ----
245
+ # Set register location
246
+ export UKIRYU_REGISTER=/path/to/register
247
+
248
+ # Set default timeout
249
+ export UKIRYU_TIMEOUT=120
250
+
251
+ # Enable debug output
252
+ export UKIRYU_DEBUG=true
253
+ ----
254
+
255
+ // Next Steps
256
+ == Next Steps
257
+
258
+ * link:/getting-started/installation[Install Ukiryu] and get started
259
+ * link:/getting-started/quick-start[Try the quick start guide]
260
+ * link:/features/configuration[Explore configuration options]
261
+ * link:/reference/tool-profile-schema[Learn the profile schema]
data/docs/_config.yml ADDED
@@ -0,0 +1,180 @@
1
+ # Site settings
2
+ title: Ukiryu
3
+ description: >-
4
+ Platform-adaptive command execution framework for Ruby tools
5
+ baseurl: "/ukiryu"
6
+ url: "https://ukiryu.com"
7
+ logo: "/assets/logo.svg"
8
+
9
+ # Theme
10
+ theme: just-the-docs
11
+ remote_theme: just-the-docs/just-the-docs@v0.7.0
12
+ color_scheme: light
13
+
14
+ # Search
15
+ search_enabled: true
16
+ search:
17
+ heading_level: 2
18
+ previews: 3
19
+ preview_words_before: 5
20
+ preview_words_after: 10
21
+ tokenizer_separator: /[\s/]+/
22
+ rel_url: true
23
+ button: true
24
+
25
+ # Navigation
26
+ nav_sort: case_insensitive
27
+ nav_fold: true
28
+
29
+ # External links
30
+ aux_links:
31
+ "GitHub":
32
+ - "https://github.com/ukiryu/ukiryu"
33
+ "RubyGems":
34
+ - "https://rubygems.org/gems/ukiryu"
35
+
36
+ aux_links_new_tab: true
37
+
38
+ # Back to top
39
+ back_to_top: true
40
+ back_to_top_text: "Back to top"
41
+
42
+ # Heading anchors
43
+ heading_anchors: true
44
+
45
+ # Footer
46
+ footer_content: 'Copyright &copy; 2025 Ribose. Distributed under the <a href="https://github.com/ukiryu/ukiryu/blob/main/LICENSE">MIT license</a>.'
47
+
48
+ # Footer last edit timestamp
49
+ last_edit_timestamp: true
50
+ last_edit_time_format: "%b %e %Y at %I:%M %p"
51
+
52
+ # Enable code copy button
53
+ enable_copy_code_button: true
54
+
55
+ # Callouts
56
+ callouts_level: quiet
57
+ callouts:
58
+ highlight:
59
+ color: yellow
60
+ important:
61
+ title: Important
62
+ color: blue
63
+ new:
64
+ title: New
65
+ color: green
66
+ note:
67
+ title: Note
68
+ color: purple
69
+ warning:
70
+ title: Warning
71
+ color: red
72
+
73
+ # Plugins
74
+ plugins:
75
+ - jekyll-asciidoc
76
+ - jekyll-seo-tag
77
+ - jekyll-sitemap
78
+
79
+ # AsciiDoc support
80
+ asciidoc: {}
81
+ asciidoctor:
82
+ attributes:
83
+ idprefix: ''
84
+ idseparator: '-'
85
+ source-highlighter: rouge
86
+ icons: font
87
+ experimental: true
88
+ sectanchors: true
89
+ linkattrs: true
90
+ sectnums: true
91
+
92
+ # Markdown settings
93
+ markdown: kramdown
94
+ kramdown:
95
+ input: GFM
96
+ hard_wrap: false
97
+ syntax_highlighter: rouge
98
+
99
+ # Collections for organizing content
100
+ collections:
101
+ pages:
102
+ permalink: "/:path/"
103
+ output: true
104
+ getting-started:
105
+ permalink: "/:collection/:path/"
106
+ output: true
107
+ interfaces:
108
+ permalink: "/:collection/:path/"
109
+ output: true
110
+ understanding:
111
+ permalink: "/:collection/:path/"
112
+ output: true
113
+ features:
114
+ permalink: "/:collection/:path/"
115
+ output: true
116
+ guides:
117
+ permalink: "/:collection/:path/"
118
+ output: true
119
+ advanced:
120
+ permalink: "/:collection/:path/"
121
+ output: true
122
+ reference:
123
+ permalink: "/:collection/:path/"
124
+ output: true
125
+
126
+ # Just the Docs collection configuration
127
+ just_the_docs:
128
+ collections:
129
+ pages:
130
+ name: Pages
131
+ nav_fold: false
132
+ getting-started:
133
+ name: Getting Started
134
+ nav_fold: false
135
+ interfaces:
136
+ name: Interfaces
137
+ nav_fold: false
138
+ understanding:
139
+ name: Understanding
140
+ nav_fold: true
141
+ features:
142
+ name: Features
143
+ nav_fold: true
144
+ guides:
145
+ name: Guides
146
+ nav_fold: true
147
+ advanced:
148
+ name: Advanced
149
+ nav_fold: true
150
+ reference:
151
+ name: Reference
152
+ nav_fold: true
153
+
154
+ # Defaults
155
+ defaults:
156
+ - scope:
157
+ path: ""
158
+ type: pages
159
+ values:
160
+ layout: default
161
+
162
+ # Include additional files
163
+ include:
164
+ - "*.adoc"
165
+
166
+ # Exclude from processing
167
+ exclude:
168
+ - Gemfile
169
+ - Gemfile.lock
170
+ - node_modules
171
+ - vendor
172
+ - .sass-cache
173
+ - .jekyll-cache
174
+ - .bundle
175
+ - README.md
176
+ - LICENSE
177
+ - .git
178
+ - .gitignore
179
+
180
+ permalink: pretty