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,720 @@
1
+ ---
2
+ layout: default
3
+ title: Configuration Options
4
+ parent: Reference
5
+ nav_order: 2
6
+ ---
7
+
8
+ == Configuration Options
9
+
10
+ This page documents all configuration options available in Ukiryu, including environment variables, Ruby API settings, and CLI options.
11
+
12
+ // Overview
13
+ == Overview
14
+
15
+ Ukiryu provides multiple ways to configure behavior:
16
+
17
+ * **CLI options** (highest priority) - Passed at runtime
18
+ * **Environment variables** (medium priority) - Set before running
19
+ * **Ruby API** (medium priority) - Set programmatically
20
+ * **Default values** (lowest priority) - Built-in defaults
21
+
22
+ // Configuration Precedence
23
+ == Configuration Precedence
24
+
25
+ Configuration is resolved in the following order (highest to lowest):
26
+
27
+ .Precedence example for `timeout`
28
+ [source,ruby]
29
+ ----
30
+ # 1. CLI option (highest) - wins!
31
+ ukiryu exec TOOL command --timeout 120
32
+
33
+ # 2. Environment variable
34
+ export UKIRYU_TIMEOUT=60
35
+ ukiryu exec TOOL command
36
+
37
+ # 3. Ruby API configuration
38
+ Ukiryu::Config.configure do |config|
39
+ config.timeout = 45
40
+ end
41
+ tool.execute(:command, params)
42
+
43
+ # 4. Default value
44
+ # timeout: nil (no timeout)
45
+ ----
46
+
47
+ // Environment Variables
48
+ == Environment Variables
49
+
50
+ All environment variables use the `UKIRYU_` prefix:
51
+
52
+ === Execution Options
53
+
54
+ ==== UKIRYU_TIMEOUT
55
+
56
+ *Execution timeout in seconds.*
57
+
58
+ * **Type**: Integer
59
+ * **Default**: `nil` (no timeout)
60
+ * **Example**: `export UKIRYU_TIMEOUT=120`
61
+
62
+ [source,shell]
63
+ ----
64
+ # Set 2-minute timeout
65
+ export UKIRYU_TIMEOUT=120
66
+ ukiryu exec imagemagick convert input.jpg output.png
67
+ ----
68
+
69
+ ==== UKIRYU_DEBUG
70
+
71
+ *Enable debug mode.*
72
+
73
+ * **Type**: Boolean
74
+ * **Default**: `false`
75
+ * **Values**: `1`, `true`, `yes`, `on` (enabled); `0`, `false`, `no`, `off` (disabled)
76
+ * **Example**: `export UKIRYU_DEBUG=1`
77
+
78
+ [source,shell]
79
+ ----
80
+ # Enable debug output
81
+ export UKIRYU_DEBUG=1
82
+ ukiryu exec imagemagick convert input.jpg output.png
83
+ ----
84
+
85
+ ==== UKIRYU_DRY_RUN
86
+
87
+ *Enable dry run mode (show commands without executing).*
88
+
89
+ * **Type**: Boolean
90
+ * **Default**: `false`
91
+ * **Values**: `1`, `true`, `yes`, `on` (enabled); `0`, `false`, `no`, `off` (disabled)
92
+ * **Example**: `export UKIRYU_DRY_RUN=1`
93
+
94
+ [source,shell]
95
+ ----
96
+ # Show what would be executed
97
+ export UKIRYU_DRY_RUN=1
98
+ ukiryu exec imagemagick convert input.jpg output.png
99
+ ----
100
+
101
+ ==== UKIRYU_METRICS
102
+
103
+ *Enable metrics collection.*
104
+
105
+ * **Type**: Boolean
106
+ * **Default**: `false`
107
+ * **Values**: `1`, `true`, `yes`, `on` (enabled); `0`, `false`, `no`, `off` (disabled)
108
+ * **Example**: `export UKIRYU_METRICS=1`
109
+
110
+ [source,shell]
111
+ ----
112
+ # Collect execution metrics
113
+ export UKIRYU_METRICS=1
114
+ ukiryu exec imagemagick convert input.jpg output.png
115
+ ----
116
+
117
+ ==== UKIRYU_SHELL
118
+
119
+ *Specify shell for command execution.*
120
+
121
+ * **Type**: Symbol
122
+ * **Default**: `nil` (auto-detect)
123
+ * **Values**: `bash`, `zsh`, `fish`, `sh`, `powershell`, `cmd`
124
+ * **Example**: `export UKIRYU_SHELL=zsh`
125
+
126
+ [source,shell]
127
+ ----
128
+ # Use zsh instead of auto-detected shell
129
+ export UKIRYU_SHELL=zsh
130
+ ukiryu exec imagemagick convert input.jpg output.png
131
+ ----
132
+
133
+ === Output Options
134
+
135
+ ==== UKIRYU_FORMAT
136
+
137
+ *Output format for results.*
138
+
139
+ * **Type**: Symbol
140
+ * **Default**: `yaml`
141
+ * **Values**: `yaml`, `json`, `table`, `raw`
142
+ * **Example**: `export UKIRYU_FORMAT=json`
143
+
144
+ [source,shell]
145
+ ----
146
+ # Output as JSON
147
+ export UKIRYU_FORMAT=json
148
+ ukiryu exec imagemagick convert input.jpg output.png
149
+ ----
150
+
151
+ ==== UKIRYU_OUTPUT
152
+
153
+ *Output file path (stdout if not set).*
154
+
155
+ * **Type**: String
156
+ * **Default**: `nil` (stdout)
157
+ * **Example**: `export UKIRYU_OUTPUT=/tmp/result.yaml`
158
+
159
+ [source,shell]
160
+ ----
161
+ # Write output to file
162
+ export UKIRYU_OUTPUT=/tmp/result.yaml
163
+ ukiryu exec imagemagick convert input.jpg output.png
164
+ ----
165
+
166
+ ==== UKIRYU_USE_COLOR
167
+
168
+ *Enable or disable colored output.*
169
+
170
+ * **Type**: Boolean
171
+ * **Default**: `nil` (auto-detect based on TTY)
172
+ * **Values**: `1`, `true`, `yes`, `on` (enabled); `0`, `false`, `no`, `off` (disabled)
173
+ * **Example**: `export UKIRYU_USE_COLOR=0`
174
+
175
+ [source,shell]
176
+ ----
177
+ # Disable colors
178
+ export UKIRYU_USE_COLOR=0
179
+ ukiryu list
180
+ ----
181
+
182
+ *Note*: Setting `NO_COLOR=1` (any value) will also disable colors per the https://no-color.io/[NO_COLOR] standard.
183
+
184
+ === Register Options
185
+
186
+ ==== UKIRYU_REGISTER
187
+
188
+ *Path to tool register.*
189
+
190
+ * **Type**: String
191
+ * **Default**: `~/.ukiryu/register` (auto-cloned on first use)
192
+ * **Example**: `export UKIRYU_REGISTER=/opt/ukiryu/register`
193
+
194
+ [source,shell]
195
+ ----
196
+ # Use custom register
197
+ export UKIRYU_REGISTER=/opt/ukiryu/register
198
+ ukiryu list
199
+ ----
200
+
201
+ ==== UKIRYU_SCHEMA_PATH
202
+
203
+ *Path to JSON Schema for validation.*
204
+
205
+ * **Type**: String
206
+ * **Default**: Remote URL (fetched automatically)
207
+ * **Example**: `export UKIRYU_SCHEMA_PATH=/path/to/schema.yaml`
208
+
209
+ [source,shell]
210
+ ----
211
+ # Use local schema for validation
212
+ export UKIRYU_SCHEMA_PATH=/path/to/tool.schema.yaml
213
+ ukiryu validate file tool.yaml
214
+ ----
215
+
216
+ If not set, the schema is automatically fetched from:
217
+ `https://raw.githubusercontent.com/ukiryu/schemas/refs/heads/main/v1/tool.schema.yaml`
218
+
219
+ === Tool Discovery Options
220
+
221
+ ==== UKIRYU_SEARCH_PATHS
222
+
223
+ *Additional search paths for tool executables (comma-separated).*
224
+
225
+ * **Type**: String (comma-separated paths)
226
+ * **Default**: `nil`
227
+ * **Example**: `export UKIRYU_SEARCH_PATHS=/usr/local/bin:/opt/bin`
228
+
229
+ [source,shell]
230
+ ----
231
+ # Add custom search paths
232
+ export UKIRYU_SEARCH_PATHS=/usr/local/bin:/opt/bin
233
+ ukiryu which imagemagick
234
+ ----
235
+
236
+ // Ruby API Configuration
237
+ == Ruby API Configuration
238
+
239
+ === Config.configure Block
240
+
241
+ Configure Ukiryu programmatically:
242
+
243
+ [source,ruby]
244
+ ----
245
+ require 'ukiryu'
246
+
247
+ # Configure with block
248
+ Ukiryu::Config.configure do |config|
249
+ config.timeout = 120
250
+ config.debug = true
251
+ config.format = :json
252
+ config.register = '/path/to/register'
253
+ config.search_paths = '/usr/local/bin,/opt/bin'
254
+ config.use_color = false
255
+ config.metrics = true
256
+ config.shell = :bash
257
+ end
258
+
259
+ # Use configuration
260
+ tool = Ukiryu::Tool.get(:imagemagick)
261
+ result = tool.execute(:convert, params)
262
+ ----
263
+
264
+ === Config Attributes
265
+
266
+ ==== timeout
267
+
268
+ *Execution timeout in seconds.*
269
+
270
+ [source,ruby]
271
+ ----
272
+ Ukiryu::Config.timeout = 120
273
+ puts Ukiryu::Config.timeout # => 120
274
+ ----
275
+
276
+ ==== debug
277
+
278
+ *Debug mode flag.*
279
+
280
+ [source,ruby]
281
+ ----
282
+ Ukiryu::Config.debug = true
283
+ puts Ukiryu::Config.debug # => true
284
+ ----
285
+
286
+ ==== dry_run
287
+
288
+ *Dry run mode flag.*
289
+
290
+ [source,ruby]
291
+ ----
292
+ Ukiryu::Config.dry_run = true
293
+ puts Ukiryu::Config.dry_run # => true
294
+ ----
295
+
296
+ ==== format
297
+
298
+ *Output format.*
299
+
300
+ [source,ruby]
301
+ ----
302
+ Ukiryu::Config.format = :json
303
+ puts Ukiryu::Config.format # => :json
304
+ ----
305
+
306
+ ==== output
307
+
308
+ *Output file path.*
309
+
310
+ [source,ruby]
311
+ ----
312
+ Ukiryu::Config.output = '/tmp/result.yaml'
313
+ puts Ukiryu::Config.output # => "/tmp/result.yaml"
314
+ ----
315
+
316
+ ==== register
317
+
318
+ *Register path.*
319
+
320
+ [source,ruby]
321
+ ----
322
+ Ukiryu::Config.register = '/opt/ukiryu/register'
323
+ puts Ukiryu::Config.register # => "/opt/ukiryu/register"
324
+ ----
325
+
326
+ ==== search_paths
327
+
328
+ *Search paths (comma-separated).*
329
+
330
+ [source,ruby]
331
+ ----
332
+ Ukiryu::Config.search_paths = '/usr/local/bin,/opt/bin'
333
+ puts Ukiryu::Config.search_paths # => "/usr/local/bin,/opt/bin"
334
+ ----
335
+
336
+ ==== use_color
337
+
338
+ *Color output flag.*
339
+
340
+ [source,ruby]
341
+ ----
342
+ Ukiryu::Config.use_color = false
343
+ puts Ukiryu::Config.use_color # => false
344
+
345
+ # Check if colors are disabled
346
+ puts Ukiryu::Config.colors_disabled? # => true
347
+ ----
348
+
349
+ ==== metrics
350
+
351
+ *Metrics collection flag.*
352
+
353
+ [source,ruby]
354
+ ----
355
+ Ukiryu::Config.metrics = true
356
+ puts Ukiryu::Config.metrics # => true
357
+ ----
358
+
359
+ ==== shell
360
+
361
+ *Shell for command execution.*
362
+
363
+ [source,ruby]
364
+ ----
365
+ Ukiryu::Config.shell = :zsh
366
+ puts Ukiryu::Config.shell # => :zsh
367
+ ----
368
+
369
+ === Configuration Hash
370
+
371
+ Get all configuration as a hash:
372
+
373
+ [source,ruby]
374
+ ----
375
+ config = Ukiryu::Config.to_h
376
+ # => {
377
+ # timeout: 120,
378
+ # debug: true,
379
+ # dry_run: false,
380
+ # metrics: false,
381
+ # shell: :zsh,
382
+ # format: :yaml,
383
+ # output: nil,
384
+ # register: "/path/to/register",
385
+ # search_paths: "/usr/local/bin,/opt/bin",
386
+ # use_color: false
387
+ # }
388
+ ----
389
+
390
+ === Reset Configuration
391
+
392
+ Reset to defaults:
393
+
394
+ [source,ruby]
395
+ ----
396
+ # Reset global configuration
397
+ Ukiryu::Config.reset!
398
+
399
+ # Or reset instance
400
+ config = Ukiryu::Config.instance
401
+ config.reset!
402
+ ----
403
+
404
+ // CLI Options
405
+ == CLI Options
406
+
407
+ CLI options take the highest priority and override environment variables and Ruby API configuration.
408
+
409
+ === Global Options
410
+
411
+ ==== --register, -r
412
+
413
+ *Path to tool register.*
414
+
415
+ [source,shell]
416
+ ----
417
+ ukiryu --register /opt/ukiryu/register list
418
+ ukiryu -r /opt/ukiryu/register list
419
+ ----
420
+
421
+ ==== --timeout
422
+
423
+ *Execution timeout in seconds.*
424
+
425
+ [source,shell]
426
+ ----
427
+ ukiryu exec imagemagick convert input.jpg output.png --timeout 120
428
+ ----
429
+
430
+ ==== --debug
431
+
432
+ *Enable debug mode.*
433
+
434
+ [source,shell]
435
+ ----
436
+ ukiryu --debug exec imagemagick convert input.jpg output.png
437
+ ----
438
+
439
+ ==== --dry-run, -d
440
+
441
+ *Show commands without executing.*
442
+
443
+ [source,shell]
444
+ ----
445
+ ukiryu --dry-run exec imagemagick convert input.jpg output.png
446
+ ukiryu -d exec imagemagick convert input.jpg output.png
447
+ ----
448
+
449
+ ==== --format, -f
450
+
451
+ *Output format.*
452
+
453
+ [source,shell]
454
+ ----
455
+ ukiryu exec imagemagick convert input.jpg output.png --format json
456
+ ukiryu exec imagemagick convert input.jpg output.png -f json
457
+ ----
458
+
459
+ ==== --output, -o
460
+
461
+ *Output file path.*
462
+
463
+ [source,shell]
464
+ ----
465
+ ukiryu exec imagemagick convert input.jpg output.png --output result.yaml
466
+ ukiryu exec imagemagick convert input.jpg output.png -o result.yaml
467
+ ----
468
+
469
+ ==== --shell, -s
470
+
471
+ *Shell for command execution.*
472
+
473
+ [source,shell]
474
+ ----
475
+ ukiryu exec imagemagick convert input.jpg output.png --shell zsh
476
+ ukiryu exec imagemagick convert input.jpg output.png -s zsh
477
+ ----
478
+
479
+ === Command-Specific Options
480
+
481
+ ==== --definition, -d (validate, exec commands)
482
+
483
+ *Path to tool definition file.*
484
+
485
+ [source,shell]
486
+ ----
487
+ # Validate a definition file
488
+ ukiryu validate --definition /path/to/tool.yaml
489
+ ukiryu validate -d /path/to/tool.yaml
490
+
491
+ # Execute using a definition file
492
+ ukiryu exec --definition /path/to/tool.yaml mytool command
493
+ ----
494
+
495
+ ==== --executable (validate command)
496
+
497
+ *Test executable against actual tool.*
498
+
499
+ [source,shell]
500
+ ----
501
+ ukiryu validate --definition /path/to/tool.yaml --executable
502
+ ----
503
+
504
+ ==== --strict (validate command)
505
+
506
+ *Treat warnings as errors.*
507
+
508
+ [source,shell]
509
+ ----
510
+ ukiryu validate --definition /path/to/tool.yaml --strict
511
+ ----
512
+
513
+ ==== --schema (validate command)
514
+
515
+ *Path to JSON Schema file.*
516
+
517
+ [source,shell]
518
+ ----
519
+ ukiryu validate --definition /path/to/tool.yaml --schema /path/to/schema.json
520
+ ----
521
+
522
+ ==== --stdin (exec command)
523
+
524
+ *Read input from stdin pipe.*
525
+
526
+ [source,shell]
527
+ ----
528
+ # Read from stdin
529
+ cat input.json | ukiryu exec jq process --stdin
530
+
531
+ # Pass stdin explicitly
532
+ echo '{"key": "value"}' | ukiryu exec jq process --stdin
533
+ ----
534
+
535
+ ==== --raw (exec command)
536
+
537
+ *Output raw stdout/stderr without wrapping.*
538
+
539
+ [source,shell]
540
+ ----
541
+ ukiryu exec imagemagick convert input.jpg - --raw > output.jpg
542
+ ----
543
+
544
+ // Definition Path Configuration
545
+ == Definition Path Configuration
546
+
547
+ ### UKIRYU_DEFINITION_PATH
548
+
549
+ *Colon-separated list of paths to search for tool definitions.*
550
+
551
+ [source,shell]
552
+ ----
553
+ # Unix/Linux/macOS
554
+ export UKIRYU_DEFINITION_PATH="/usr/share/ukiryu:~/.local/share/ukiryu:./definitions"
555
+
556
+ # Windows
557
+ set UKIRYU_DEFINITION_PATH="C:\Ukiryu\Definitions;D:\MyDefinitions"
558
+ ----
559
+
560
+ [source,ruby]
561
+ ----
562
+ # Can also be set via Ruby API
563
+ Ukiryu::Config.definition_path = '/path/to/definitions:/another/path'
564
+ ----
565
+
566
+ ### Definition Search Order
567
+
568
+ Definitions are searched in the following order:
569
+
570
+ . File specified via `--definition` flag
571
+ . Paths in `UKIRYU_DEFINITION_PATH` (left to right)
572
+ . XDG data directories: `~/.local/share/ukiryu/`
573
+ . System directories: `/usr/share/ukiryu/`, `/usr/local/share/ukiryu/`
574
+ . Bundled definitions (tool installation directory)
575
+ . Register (default location)
576
+
577
+ // Platform-Specific Configuration
578
+ == Platform-Specific Configuration
579
+
580
+ === Shell-Specific Values
581
+
582
+ Some values need different formats for different shells:
583
+
584
+ [source,ruby]
585
+ ----
586
+ # Boolean values
587
+ # bash/zsh/sh: true, false
588
+ export UKIRYU_DEBUG=true
589
+
590
+ # fish: true, false
591
+ set -x UKIRYU_DEBUG true
592
+
593
+ # PowerShell: $true, $false
594
+ $env:UKIRYU_DEBUG = "true"
595
+
596
+ # cmd: 1, 0
597
+ set UKIRYU_DEBUG=1
598
+
599
+ # Path separators
600
+ # Unix/Linux/macOS: colon (:)
601
+ export UKIRYU_SEARCH_PATHS=/usr/local/bin:/opt/bin
602
+
603
+ # Windows: semicolon (;)
604
+ set UKIRYU_SEARCH_PATHS=C:\bin;D:\Tools
605
+ ----
606
+
607
+ === Default Paths by Platform
608
+
609
+ .Default tool locations by platform
610
+ [cols="1,2"]
611
+ |===
612
+ |Platform |Default Search Paths
613
+
614
+ |macOS
615
+ |`/opt/homebrew/bin`, `/usr/local/bin`, `/usr/bin`
616
+
617
+ |Linux
618
+ |`/usr/local/bin`, `/usr/bin`, `/bin`
619
+
620
+ |Windows
621
+ |`C:\Program Files\Git\cmd`, `C:\Windows\System32`
622
+ |===
623
+
624
+ // Examples
625
+ == Examples
626
+
627
+ === Example 1: Custom Register
628
+
629
+ [source,shell]
630
+ ----
631
+ # Set custom register
632
+ export UKIRYU_REGISTER=/opt/my-register
633
+
634
+ # List tools from custom register
635
+ ukiryu list
636
+ ----
637
+
638
+ === Example 2: Debug Mode
639
+
640
+ [source,shell]
641
+ ----
642
+ # Enable debug for troubleshooting
643
+ export UKIRYU_DEBUG=1
644
+
645
+ # Execute with debug output
646
+ ukiryu exec imagemagick convert input.jpg output.png
647
+ ----
648
+
649
+ [source,ruby]
650
+ ----
651
+ # Or enable in Ruby
652
+ Ukiryu::Config.debug = true
653
+ tool = Ukiryu::Tool.get(:imagemagick)
654
+ result = tool.execute(:convert, params)
655
+ ----
656
+
657
+ === Example 3: Output Format
658
+
659
+ [source,shell]
660
+ ----
661
+ # Output as JSON
662
+ export UKIRYU_FORMAT=json
663
+ ukiryu exec imagemagick convert input.jpg output.png
664
+
665
+ # Or use CLI option
666
+ ukiryu exec imagemagick convert input.jpg output.png --format json
667
+ ----
668
+
669
+ [source,ruby]
670
+ ----
671
+ # Or configure in Ruby
672
+ Ukiryu::Config.format = :json
673
+ tool = Ukiryu::Tool.get(:imagemagick)
674
+ result = tool.execute(:convert, params)
675
+ ----
676
+
677
+ === Example 4: Timeout Configuration
678
+
679
+ [source,shell]
680
+ ----
681
+ # Set 5-minute timeout globally
682
+ export UKIRYU_TIMEOUT=300
683
+
684
+ # Override for specific command
685
+ ukiryu exec ghostscript convert input.pdf output.pdf --timeout 600
686
+ ----
687
+
688
+ [source,ruby]
689
+ ----
690
+ # Or configure in Ruby
691
+ Ukiryu::Config.timeout = 300
692
+ tool = Ukiryu::Tool.get(:ghostscript)
693
+ result = tool.execute(:convert, params, timeout: 600)
694
+ ----
695
+
696
+ === Example 5: Multiple Search Paths
697
+
698
+ [source,shell]
699
+ ----
700
+ # Add multiple search paths (Unix)
701
+ export UKIRYU_SEARCH_PATHS=/usr/local/bin:/opt/bin:~/bin
702
+
703
+ # Add multiple search paths (Windows)
704
+ set UKIRYU_SEARCH_PATHS=C:\Tools;D:\MyTools
705
+ ----
706
+
707
+ [source,ruby]
708
+ ----
709
+ # Or configure in Ruby
710
+ Ukiryu::Config.search_paths = '/usr/local/bin,/opt/bin,~/bin'
711
+ tool = Ukiryu::Tool.get(:imagemagick)
712
+ ----
713
+
714
+ // See Also
715
+ == See Also
716
+
717
+ * link:/features/configuration[Configuration Guide] - Configuration overview
718
+ * link:/interfaces/cli[CLI Reference] - All CLI options
719
+ * link:/interfaces/ruby-api[Ruby API] - Ruby configuration methods
720
+ * link:/reference/error-codes[Error Codes] - Error handling