ukiryu 0.1.4 → 0.1.6
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.
- checksums.yaml +4 -4
- data/lib/ukiryu/action/base.rb +3 -2
- data/lib/ukiryu/cli.rb +24 -37
- data/lib/ukiryu/cli_commands/base_command.rb +2 -6
- data/lib/ukiryu/cli_commands/cache_command.rb +0 -1
- data/lib/ukiryu/cli_commands/commands_command.rb +3 -6
- data/lib/ukiryu/cli_commands/config_command.rb +2 -9
- data/lib/ukiryu/cli_commands/definitions_command.rb +4 -6
- data/lib/ukiryu/cli_commands/describe_command.rb +2 -5
- data/lib/ukiryu/cli_commands/docs_command.rb +0 -1
- data/lib/ukiryu/cli_commands/extract_command.rb +1 -4
- data/lib/ukiryu/cli_commands/info_command.rb +7 -28
- data/lib/ukiryu/cli_commands/lint_command.rb +0 -1
- data/lib/ukiryu/cli_commands/list_command.rb +7 -11
- data/lib/ukiryu/cli_commands/opts_command.rb +2 -5
- data/lib/ukiryu/cli_commands/register_command.rb +5 -8
- data/lib/ukiryu/cli_commands/resolve_command.rb +0 -4
- data/lib/ukiryu/cli_commands/response_formatter.rb +5 -3
- data/lib/ukiryu/cli_commands/run_command.rb +24 -33
- data/lib/ukiryu/cli_commands/run_file_command.rb +16 -20
- data/lib/ukiryu/cli_commands/system_command.rb +7 -14
- data/lib/ukiryu/cli_commands/validate_command.rb +120 -34
- data/lib/ukiryu/cli_commands/version_command.rb +1 -3
- data/lib/ukiryu/cli_commands/which_command.rb +12 -21
- data/lib/ukiryu/cli_commands.rb +36 -0
- data/lib/ukiryu/command_builder.rb +57 -21
- data/lib/ukiryu/config/env_provider.rb +8 -11
- data/lib/ukiryu/config/env_schema.rb +2 -5
- data/lib/ukiryu/config.rb +6 -17
- data/lib/ukiryu/debug.rb +43 -0
- data/lib/ukiryu/definition/definition_cache.rb +0 -1
- data/lib/ukiryu/definition/definition_composer.rb +0 -2
- data/lib/ukiryu/definition/definition_linter.rb +4 -6
- data/lib/ukiryu/definition/definition_validator.rb +9 -11
- data/lib/ukiryu/definition/discovery.rb +1 -4
- data/lib/ukiryu/definition/loader.rb +9 -9
- data/lib/ukiryu/definition/metadata.rb +0 -2
- data/lib/ukiryu/definition/sources/file.rb +13 -15
- data/lib/ukiryu/definition/sources/string.rb +1 -3
- data/lib/ukiryu/definition.rb +26 -22
- data/lib/ukiryu/environment.rb +218 -0
- data/lib/ukiryu/errors.rb +153 -26
- data/lib/ukiryu/executable_locator.rb +290 -67
- data/lib/ukiryu/execution/output.rb +2 -2
- data/lib/ukiryu/execution.rb +5 -5
- data/lib/ukiryu/execution_context.rb +6 -9
- data/lib/ukiryu/executor.rb +224 -90
- data/lib/ukiryu/extractors/base_extractor.rb +23 -7
- data/lib/ukiryu/extractors/extractor.rb +2 -6
- data/lib/ukiryu/extractors/help_parser.rb +59 -4
- data/lib/ukiryu/extractors/native_extractor.rb +0 -2
- data/lib/ukiryu/extractors.rb +16 -0
- data/lib/ukiryu/logger.rb +0 -2
- data/lib/ukiryu/man_page_parser.rb +6 -10
- data/lib/ukiryu/models/argument.rb +1 -9
- data/lib/ukiryu/models/argument_definition.rb +15 -17
- data/lib/ukiryu/models/arguments.rb +2 -11
- data/lib/ukiryu/models/command_definition.rb +30 -24
- data/lib/ukiryu/models/command_info.rb +3 -13
- data/lib/ukiryu/models/components.rb +6 -12
- data/lib/ukiryu/models/env_var_definition.rb +7 -9
- data/lib/ukiryu/models/error_response.rb +1 -9
- data/lib/ukiryu/models/executable_info.rb +80 -0
- data/lib/ukiryu/models/execution_metadata.rb +1 -10
- data/lib/ukiryu/models/execution_report.rb +1 -180
- data/lib/ukiryu/models/exit_codes.rb +3 -5
- data/lib/ukiryu/models/flag_definition.rb +12 -14
- data/lib/ukiryu/models/implementation_index.rb +111 -0
- data/lib/ukiryu/models/implementation_version.rb +202 -0
- data/lib/ukiryu/models/interface.rb +118 -0
- data/lib/ukiryu/models/invocation.rb +74 -0
- data/lib/ukiryu/models/option_definition.rb +13 -15
- data/lib/ukiryu/models/output_info.rb +1 -8
- data/lib/ukiryu/models/platform_profile.rb +34 -24
- data/lib/ukiryu/models/run_environment.rb +112 -0
- data/lib/ukiryu/models/stage_metrics.rb +64 -0
- data/lib/ukiryu/models/success_response.rb +1 -18
- data/lib/ukiryu/models/tool_definition.rb +43 -31
- data/lib/ukiryu/models/tool_metadata.rb +103 -29
- data/lib/ukiryu/models/version_detection.rb +13 -15
- data/lib/ukiryu/models/version_info.rb +10 -1
- data/lib/ukiryu/models.rb +31 -13
- data/lib/ukiryu/options/base.rb +2 -2
- data/lib/ukiryu/options_builder/formatter.rb +0 -2
- data/lib/ukiryu/options_builder/validator.rb +2 -4
- data/lib/ukiryu/options_builder.rb +21 -23
- data/lib/ukiryu/platform.rb +1 -1
- data/lib/ukiryu/register.rb +144 -32
- data/lib/ukiryu/register_auto_manager.rb +80 -6
- data/lib/ukiryu/response/base.rb +1 -2
- data/lib/ukiryu/runtime.rb +5 -9
- data/lib/ukiryu/schema_validator.rb +5 -1
- data/lib/ukiryu/schemas/v1/implementation_index.schema.yaml +184 -0
- data/lib/ukiryu/schemas/v1/implementation_version.schema.yaml +171 -0
- data/lib/ukiryu/schemas/v1/interface.schema.yaml +267 -0
- data/lib/ukiryu/schemas/v1/tool.schema.yaml +440 -0
- data/lib/ukiryu/shell/base.rb +112 -6
- data/lib/ukiryu/shell/bash.rb +47 -7
- data/lib/ukiryu/shell/cmd.rb +162 -11
- data/lib/ukiryu/shell/dash.rb +86 -0
- data/lib/ukiryu/shell/fish.rb +57 -3
- data/lib/ukiryu/shell/instance_cache.rb +53 -0
- data/lib/ukiryu/shell/powershell.rb +225 -6
- data/lib/ukiryu/shell/registry.rb +151 -0
- data/lib/ukiryu/shell/sh.rb +53 -3
- data/lib/ukiryu/shell/tcsh.rb +239 -0
- data/lib/ukiryu/shell/unix_base.rb +150 -0
- data/lib/ukiryu/shell/zsh.rb +49 -3
- data/lib/ukiryu/shell.rb +240 -59
- data/lib/ukiryu/tool/command_resolution.rb +156 -0
- data/lib/ukiryu/tool/executable_discovery.rb +77 -0
- data/lib/ukiryu/tool/version_detection.rb +212 -0
- data/lib/ukiryu/tool.rb +730 -522
- data/lib/ukiryu/tool_cache.rb +75 -0
- data/lib/ukiryu/tool_finder.rb +267 -0
- data/lib/ukiryu/tool_index.rb +173 -25
- data/lib/ukiryu/tools/base.rb +109 -24
- data/lib/ukiryu/tools/class_generator.rb +0 -7
- data/lib/ukiryu/tools/executable_finder.rb +2 -5
- data/lib/ukiryu/tools/generator.rb +7 -12
- data/lib/ukiryu/tools.rb +10 -7
- data/lib/ukiryu/type.rb +37 -23
- data/lib/ukiryu/utils.rb +215 -0
- data/lib/ukiryu/validation/constraints.rb +1 -1
- data/lib/ukiryu/validation/validator.rb +2 -4
- data/lib/ukiryu/validation.rb +0 -3
- data/lib/ukiryu/version.rb +1 -1
- data/lib/ukiryu/version_detector.rb +27 -20
- data/lib/ukiryu/version_scheme_resolver.rb +72 -0
- data/lib/ukiryu.rb +49 -34
- data/spec/fixtures/images/test_blue.png +0 -0
- data/spec/fixtures/images/test_red.png +0 -0
- data/spec/fixtures/profiles/ghostscript_10.0.yaml +69 -0
- data/spec/fixtures/profiles/inkscape_1.0.yaml +74 -0
- data/spec/fixtures/register/interfaces/bzip2.yaml +59 -0
- data/spec/fixtures/register/interfaces/exiftool.yaml +82 -0
- data/spec/fixtures/register/interfaces/ffmpeg.yaml +104 -0
- data/spec/fixtures/register/interfaces/gs.yaml +45 -0
- data/spec/fixtures/register/interfaces/gzip.yaml +35 -0
- data/spec/fixtures/register/interfaces/imagemagick.yaml +76 -0
- data/spec/fixtures/register/interfaces/inkscape.yaml +50 -0
- data/spec/fixtures/register/interfaces/jq.yaml +97 -0
- data/spec/fixtures/register/interfaces/pdf2ps.yaml +32 -0
- data/spec/fixtures/register/interfaces/ping.yaml +52 -0
- data/spec/fixtures/register/interfaces/sort.yaml +45 -0
- data/spec/fixtures/register/interfaces/tar.yaml +82 -0
- data/spec/fixtures/register/interfaces/unzip.yaml +48 -0
- data/spec/fixtures/register/interfaces/yq.yaml +94 -0
- data/spec/fixtures/register/tools/bzip2/default/1.0.yaml +55 -0
- data/spec/fixtures/register/tools/bzip2/index.yaml +15 -0
- data/spec/fixtures/register/tools/bzip2_busybox/default/1.0.yaml +55 -0
- data/spec/fixtures/register/tools/bzip2_busybox/index.yaml +16 -0
- data/spec/fixtures/register/tools/bzip2_gnu/default/1.0.yaml +61 -0
- data/spec/fixtures/register/tools/bzip2_gnu/index.yaml +16 -0
- data/spec/fixtures/register/tools/exiftool/default/1.0.yaml +38 -0
- data/spec/fixtures/register/tools/exiftool/index.yaml +14 -0
- data/spec/fixtures/register/tools/ffmpeg/default/1.0.yaml +60 -0
- data/spec/fixtures/register/tools/ffmpeg/index.yaml +14 -0
- data/spec/fixtures/register/tools/ghostscript/default/10.0.yaml +180 -0
- data/spec/fixtures/register/tools/ghostscript/index.yaml +14 -0
- data/spec/fixtures/register/tools/gzip/default/1.0.yaml +54 -0
- data/spec/fixtures/register/tools/gzip/index.yaml +15 -0
- data/spec/fixtures/register/tools/gzip_busybox/default/1.0.yaml +55 -0
- data/spec/fixtures/register/tools/gzip_busybox/index.yaml +16 -0
- data/spec/fixtures/register/tools/gzip_gnu/default/1.0.yaml +62 -0
- data/spec/fixtures/register/tools/gzip_gnu/index.yaml +16 -0
- data/spec/fixtures/register/tools/imagemagick/default/6.0.yaml +77 -0
- data/spec/fixtures/register/tools/imagemagick/default/6.9.yaml +189 -0
- data/spec/fixtures/register/tools/imagemagick/default/7.1.yaml +401 -0
- data/spec/fixtures/register/tools/imagemagick/index.yaml +18 -0
- data/spec/fixtures/register/tools/inkscape/default/0.92.yaml +164 -0
- data/spec/fixtures/register/tools/inkscape/default/1.0.yaml +230 -0
- data/spec/fixtures/register/tools/inkscape/index.yaml +16 -0
- data/spec/fixtures/register/tools/jq/default/1.0.yaml +45 -0
- data/spec/fixtures/register/tools/jq/index.yaml +14 -0
- data/spec/fixtures/register/tools/pdf2ps/default/1.0.yaml +46 -0
- data/spec/fixtures/register/tools/pdf2ps/index.yaml +14 -0
- data/spec/fixtures/register/tools/ping/bsd/1.0.yaml +67 -0
- data/spec/fixtures/register/tools/ping/gnu/2024.01.17.yaml +49 -0
- data/spec/fixtures/register/tools/ping/index.yaml +53 -0
- data/spec/fixtures/register/tools/ping/windows/1.0.yaml +69 -0
- data/spec/fixtures/register/tools/ping_bsd/default/1.0.yaml +42 -0
- data/spec/fixtures/register/tools/ping_bsd/index.yaml +16 -0
- data/spec/fixtures/register/tools/ping_gnu/default/1.0.yaml +42 -0
- data/spec/fixtures/register/tools/ping_gnu/index.yaml +16 -0
- data/spec/fixtures/register/tools/ping_windows/default/1.0.yaml +66 -0
- data/spec/fixtures/register/tools/ping_windows/index.yaml +16 -0
- data/spec/fixtures/register/tools/sort/default/1.0.yaml +53 -0
- data/spec/fixtures/register/tools/sort/index.yaml +14 -0
- data/spec/fixtures/register/tools/tar/default/1.0.yaml +67 -0
- data/spec/fixtures/register/tools/tar/index.yaml +16 -0
- data/spec/fixtures/register/tools/unzip/default/1.0.yaml +46 -0
- data/spec/fixtures/register/tools/unzip/default/6.0.yaml +189 -0
- data/spec/fixtures/register/tools/unzip/index.yaml +16 -0
- data/spec/fixtures/register/tools/yq/default/1.0.yaml +59 -0
- data/spec/fixtures/register/tools/yq/index.yaml +14 -0
- data/spec/fixtures/tool.schema.yaml +539 -0
- data/spec/spec_helper.rb +76 -0
- data/spec/support/tool_helper.rb +109 -0
- data/spec/ukiryu/cli_commands/commands_command_spec.rb +44 -0
- data/spec/ukiryu/cli_commands/config_command_spec.rb +186 -0
- data/spec/ukiryu/cli_commands/describe_command_spec.rb +52 -0
- data/spec/ukiryu/cli_commands/extract_command_spec.rb +73 -0
- data/spec/ukiryu/cli_commands/info_command_spec.rb +58 -0
- data/spec/ukiryu/cli_commands/list_command_spec.rb +45 -0
- data/spec/ukiryu/cli_commands/opts_command_spec.rb +52 -0
- data/spec/ukiryu/cli_commands/run_command_spec.rb +130 -0
- data/spec/ukiryu/cli_commands/run_file_command_spec.rb +135 -0
- data/spec/ukiryu/cli_commands/system_command_spec.rb +120 -0
- data/spec/ukiryu/cli_commands/version_command_spec.rb +29 -0
- data/spec/ukiryu/cli_commands/which_command_spec.rb +123 -0
- data/spec/ukiryu/cli_stdin_spec.rb +263 -0
- data/spec/ukiryu/config_spec.rb +118 -0
- data/spec/ukiryu/definition/definition_linter_spec.rb +298 -0
- data/spec/ukiryu/definition/definition_validator_spec.rb +230 -0
- data/spec/ukiryu/definition/discovery_spec.rb +258 -0
- data/spec/ukiryu/definition/documentation_generator_spec.rb +142 -0
- data/spec/ukiryu/definition/lint_issue_spec.rb +119 -0
- data/spec/ukiryu/definition/loader_spec.rb +289 -0
- data/spec/ukiryu/definition/metadata_spec.rb +303 -0
- data/spec/ukiryu/definition/source_spec.rb +137 -0
- data/spec/ukiryu/definition/sources/file_spec.rb +286 -0
- data/spec/ukiryu/definition/sources/string_spec.rb +263 -0
- data/spec/ukiryu/definition/validation_result_spec.rb +175 -0
- data/spec/ukiryu/definition/version_resolver_spec.rb +153 -0
- data/spec/ukiryu/environment_spec.rb +390 -0
- data/spec/ukiryu/execution_context_spec.rb +294 -0
- data/spec/ukiryu/executor_spec.rb +440 -0
- data/spec/ukiryu/executor_stdin_spec.rb +97 -0
- data/spec/ukiryu/extractors/extractor_spec.rb +62 -0
- data/spec/ukiryu/extractors/help_parser_spec.rb +45 -0
- data/spec/ukiryu/extractors/native_extractor_spec.rb +35 -0
- data/spec/ukiryu/logger_spec.rb +372 -0
- data/spec/ukiryu/models/command_definition_spec.rb +191 -0
- data/spec/ukiryu/models/components_spec.rb +152 -0
- data/spec/ukiryu/models/execution_report_spec.rb +238 -0
- data/spec/ukiryu/models/exit_codes_spec.rb +141 -0
- data/spec/ukiryu/models/routing_spec.rb +242 -0
- data/spec/ukiryu/models/version_compatibility_spec.rb +177 -0
- data/spec/ukiryu/profiles_smoke_spec.rb +556 -0
- data/spec/ukiryu/schema_validator_spec.rb +154 -0
- data/spec/ukiryu/shell/bash_spec.rb +46 -0
- data/spec/ukiryu/shell/cmd_spec.rb +225 -0
- data/spec/ukiryu/shell/dash_spec.rb +46 -0
- data/spec/ukiryu/shell/fish_spec.rb +29 -0
- data/spec/ukiryu/shell/powershell_spec.rb +231 -0
- data/spec/ukiryu/shell/sh_spec.rb +29 -0
- data/spec/ukiryu/shell/tcsh_spec.rb +199 -0
- data/spec/ukiryu/shell/unix_base_shared_examples.rb +224 -0
- data/spec/ukiryu/shell/zsh_spec.rb +37 -0
- data/spec/ukiryu/shell_spec.rb +115 -0
- data/spec/ukiryu/tool/from_definition_spec.rb +290 -0
- data/spec/ukiryu/tool/from_file_spec.rb +202 -0
- data/spec/ukiryu/tool_direct_loading_spec.rb +336 -0
- data/spec/ukiryu/tool_index_spec.rb +168 -0
- data/spec/ukiryu/tool_metadata_spec.rb +269 -0
- data/spec/ukiryu/tool_stdin_spec.rb +73 -0
- data/spec/ukiryu/tools/imagemagick_spec.rb +186 -0
- data/spec/ukiryu/tools/inkscape_spec.rb +82 -0
- data/spec/ukiryu/version_scheme_resolver_spec.rb +132 -0
- metadata +352 -59
- data/.github/workflows/docs.yml +0 -63
- data/.github/workflows/links.yml +0 -99
- data/.github/workflows/rake.yml +0 -19
- data/.github/workflows/release.yml +0 -71
- data/.gitignore +0 -25
- data/.rubocop.yml +0 -1
- data/.rubocop_todo.yml +0 -304
- data/Gemfile +0 -21
- data/README.adoc +0 -1937
- data/Rakefile +0 -8
- data/docs/.gitignore +0 -1
- data/docs/Gemfile +0 -10
- data/docs/INDEX.adoc +0 -261
- data/docs/_config.yml +0 -180
- data/docs/advanced/custom-tool-classes.adoc +0 -581
- data/docs/advanced/index.adoc +0 -20
- data/docs/assets/logo.svg +0 -1
- data/docs/features/configuration.adoc +0 -657
- data/docs/features/index.adoc +0 -31
- data/docs/features/platform-support.adoc +0 -488
- data/docs/getting-started/core-concepts.adoc +0 -666
- data/docs/getting-started/index.adoc +0 -36
- data/docs/getting-started/installation.adoc +0 -216
- data/docs/getting-started/quick-start.adoc +0 -258
- data/docs/guides/env-var-sets.adoc +0 -388
- data/docs/guides/index.adoc +0 -20
- data/docs/interfaces/cli.adoc +0 -609
- data/docs/interfaces/index.adoc +0 -153
- data/docs/interfaces/ruby-api.adoc +0 -538
- data/docs/lychee.toml +0 -49
- data/docs/reference/configuration-options.adoc +0 -720
- data/docs/reference/error-codes.adoc +0 -634
- data/docs/reference/index.adoc +0 -20
- data/docs/reference/ruby-api.adoc +0 -1217
- data/docs/understanding/index.adoc +0 -20
- data/lib/ukiryu/cli_commands/commands_command.rb.fixed +0 -40
- data/lib/ukiryu/cli_commands/describe_command.rb.fixed +0 -254
- data/lib/ukiryu/cli_commands/exec_inline_command.rb.fixed +0 -180
- data/lib/ukiryu/cli_commands/opts_command.rb.fixed +0 -105
- data/lib/ukiryu/models/search_paths.rb +0 -39
- data/ukiryu-proposal.md +0 -2952
- data/ukiryu.gemspec +0 -38
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3881776473c97e5296fbc0d0d62f88352dec64d5350490a1d0c413f32ace414f
|
|
4
|
+
data.tar.gz: 79130e5976a4a024ec19073d3e85e43137d02bf11bfd3cdf21ea77923b24f609
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c26728d9bf22917688e549deee2462d332d272d136ca4ecdceb705d618341acd65a94d35a1617bc11636fc1831f7f913775a26ab924f5fc01090be201b61fca9
|
|
7
|
+
data.tar.gz: 9c513b6900ee5d349a4d442175c8713d8f1845b5af579e43f27323dc1c8483d98153cc1581dc9a8de5a3f686f144ec4d823846febf19d9b020f12f76be2a5394
|
data/lib/ukiryu/action/base.rb
CHANGED
|
@@ -38,8 +38,9 @@ module Ukiryu
|
|
|
38
38
|
# Execute this action with options
|
|
39
39
|
#
|
|
40
40
|
# @param options [Hash, Options::Base] the options to use
|
|
41
|
+
# @param timeout [Integer] timeout in seconds (required)
|
|
41
42
|
# @return [Response::Base] the execution response
|
|
42
|
-
def run(options = {})
|
|
43
|
+
def run(options = {}, timeout:)
|
|
43
44
|
# If options is a hash, create an options object
|
|
44
45
|
if options.is_a?(Hash)
|
|
45
46
|
options_class = @tool.options_class_for(self.class.command_name)
|
|
@@ -49,7 +50,7 @@ module Ukiryu
|
|
|
49
50
|
end
|
|
50
51
|
|
|
51
52
|
# Execute with the tool
|
|
52
|
-
@tool.execute(self.class.command_name, options)
|
|
53
|
+
@tool.execute(self.class.command_name, options, timeout: timeout)
|
|
53
54
|
end
|
|
54
55
|
|
|
55
56
|
# Create an options object for this action
|
data/lib/ukiryu/cli.rb
CHANGED
|
@@ -1,31 +1,13 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require 'thor'
|
|
4
|
-
|
|
5
|
-
require_relative 'cli_commands/run_file_command'
|
|
6
|
-
require_relative 'cli_commands/run_command'
|
|
7
|
-
require_relative 'cli_commands/list_command'
|
|
8
|
-
require_relative 'cli_commands/info_command'
|
|
9
|
-
require_relative 'cli_commands/commands_command'
|
|
10
|
-
require_relative 'cli_commands/opts_command'
|
|
11
|
-
require_relative 'cli_commands/describe_command'
|
|
12
|
-
require_relative 'cli_commands/which_command'
|
|
13
|
-
require_relative 'cli_commands/config_command'
|
|
14
|
-
require_relative 'cli_commands/version_command'
|
|
15
|
-
require_relative 'cli_commands/system_command'
|
|
16
|
-
require_relative 'cli_commands/validate_command'
|
|
17
|
-
require_relative 'cli_commands/extract_command'
|
|
18
|
-
require_relative 'cli_commands/definitions_command'
|
|
19
|
-
require_relative 'cli_commands/cache_command'
|
|
20
|
-
require_relative 'cli_commands/resolve_command'
|
|
21
|
-
require_relative 'cli_commands/register_command'
|
|
4
|
+
# thor_ext must be eagerly loaded (used at class definition time for extend)
|
|
22
5
|
require_relative 'thor_ext'
|
|
23
|
-
require_relative 'version'
|
|
24
6
|
|
|
25
7
|
module Ukiryu
|
|
26
8
|
# CLI for exploring and interacting with Ukiryu tool profiles
|
|
27
9
|
#
|
|
28
|
-
# Each command is implemented as a separate class in the CliCommands
|
|
10
|
+
# Each command is implemented as a separate class in the CliCommands namespace.
|
|
29
11
|
# This file just delegates to those command classes, keeping each file under 200 lines.
|
|
30
12
|
class Cli < Thor
|
|
31
13
|
package_name 'ukiryu'
|
|
@@ -38,6 +20,11 @@ module Ukiryu
|
|
|
38
20
|
false
|
|
39
21
|
end
|
|
40
22
|
|
|
23
|
+
# Autoload CLI command classes (lazy load on first use)
|
|
24
|
+
autoload :ValidateCommand, 'ukiryu/cli_commands/validate_command'
|
|
25
|
+
autoload :DefinitionsCommand, 'ukiryu/cli_commands/definitions_command'
|
|
26
|
+
autoload :CacheCommand, 'ukiryu/cli_commands/cache_command'
|
|
27
|
+
|
|
41
28
|
desc 'run-file REQUEST_FILE', 'Execute a Ukiryu Structured Execution Request from a YAML file'
|
|
42
29
|
method_option :register, aliases: :r, desc: 'Path to tool register', type: :string
|
|
43
30
|
method_option :output, aliases: :o, desc: 'Output file for response (default: stdout)', type: :string
|
|
@@ -47,7 +34,7 @@ module Ukiryu
|
|
|
47
34
|
method_option :shell, desc: 'Shell to use for command execution (bash, zsh, fish, sh, powershell, cmd)',
|
|
48
35
|
type: :string
|
|
49
36
|
def run_file(request_file)
|
|
50
|
-
CliCommands::RunFileCommand.new(options).run(request_file)
|
|
37
|
+
Ukiryu::CliCommands::RunFileCommand.new(options).run(request_file)
|
|
51
38
|
end
|
|
52
39
|
|
|
53
40
|
desc 'exec TOOL [COMMAND] [KEY=VALUE ...]', 'Execute a tool command inline'
|
|
@@ -62,13 +49,13 @@ module Ukiryu
|
|
|
62
49
|
method_option :stdin, desc: 'Read input from stdin (pass to command)', type: :boolean, default: false
|
|
63
50
|
method_option :raw, desc: 'Output raw stdout/stderr (for pipe composition)', type: :boolean, default: false
|
|
64
51
|
def exec(tool_name, command_name = nil, *params)
|
|
65
|
-
CliCommands::RunCommand.new(options).run(tool_name, command_name, *params)
|
|
52
|
+
Ukiryu::CliCommands::RunCommand.new(options).run(tool_name, command_name, *params)
|
|
66
53
|
end
|
|
67
54
|
|
|
68
55
|
desc 'list', 'List all available tools in the register'
|
|
69
56
|
method_option :register, aliases: :r, desc: 'Path to tool register', type: :string
|
|
70
57
|
def list
|
|
71
|
-
CliCommands::ListCommand.new(options).run
|
|
58
|
+
Ukiryu::CliCommands::ListCommand.new(options).run
|
|
72
59
|
end
|
|
73
60
|
|
|
74
61
|
desc 'info [TOOL]', 'Show detailed information about a tool'
|
|
@@ -79,38 +66,38 @@ module Ukiryu
|
|
|
79
66
|
# No tool specified - show help
|
|
80
67
|
help
|
|
81
68
|
else
|
|
82
|
-
CliCommands::InfoCommand.new(options).run(tool_name)
|
|
69
|
+
Ukiryu::CliCommands::InfoCommand.new(options).run(tool_name)
|
|
83
70
|
end
|
|
84
71
|
end
|
|
85
72
|
|
|
86
73
|
desc 'commands TOOL', 'List all commands available for a tool'
|
|
87
74
|
method_option :register, aliases: :r, desc: 'Path to tool register', type: :string
|
|
88
75
|
def commands(tool_name)
|
|
89
|
-
CliCommands::CommandsCommand.new(options).run(tool_name)
|
|
76
|
+
Ukiryu::CliCommands::CommandsCommand.new(options).run(tool_name)
|
|
90
77
|
end
|
|
91
78
|
|
|
92
79
|
desc 'opts TOOL [COMMAND]', 'Show options for a tool or specific command'
|
|
93
80
|
method_option :register, aliases: :r, desc: 'Path to tool register', type: :string
|
|
94
81
|
def opts(tool_name, command_name = nil)
|
|
95
|
-
CliCommands::OptsCommand.new(options).run(tool_name, command_name)
|
|
82
|
+
Ukiryu::CliCommands::OptsCommand.new(options).run(tool_name, command_name)
|
|
96
83
|
end
|
|
97
84
|
|
|
98
85
|
desc 'describe TOOL [COMMAND]', 'Show comprehensive documentation for a tool or specific command'
|
|
99
86
|
method_option :register, aliases: :r, desc: 'Path to tool register', type: :string
|
|
100
87
|
method_option :format, aliases: :f, desc: 'Output format (text, yaml, json)', type: :string, default: 'text'
|
|
101
88
|
def describe(tool_name, command_name = nil)
|
|
102
|
-
CliCommands::DescribeCommand.new(options).run(tool_name, command_name)
|
|
89
|
+
Ukiryu::CliCommands::DescribeCommand.new(options).run(tool_name, command_name)
|
|
103
90
|
end
|
|
104
91
|
|
|
105
92
|
desc 'system [SUBCOMMAND]', 'Show system information (shells, etc.)'
|
|
106
93
|
method_option :register, aliases: :r, desc: 'Path to tool register', type: :string
|
|
107
94
|
def system(subcommand = nil)
|
|
108
|
-
CliCommands::SystemCommand.new(options).run(subcommand)
|
|
95
|
+
Ukiryu::CliCommands::SystemCommand.new(options).run(subcommand)
|
|
109
96
|
end
|
|
110
97
|
|
|
111
98
|
desc 'version', 'Show Ukiryu version'
|
|
112
99
|
def version
|
|
113
|
-
CliCommands::VersionCommand.new(options).run
|
|
100
|
+
Ukiryu::CliCommands::VersionCommand.new(options).run
|
|
114
101
|
end
|
|
115
102
|
|
|
116
103
|
desc 'which IDENTIFIER', 'Show which tool implementation would be selected'
|
|
@@ -118,42 +105,42 @@ module Ukiryu
|
|
|
118
105
|
method_option :platform, desc: 'Platform to check (macos, linux, windows)', type: :string
|
|
119
106
|
method_option :shell, desc: 'Shell to check (bash, zsh, fish, sh, powershell, cmd)', type: :string
|
|
120
107
|
def which(identifier)
|
|
121
|
-
CliCommands::WhichCommand.new(options).run(identifier)
|
|
108
|
+
Ukiryu::CliCommands::WhichCommand.new(options).run(identifier)
|
|
122
109
|
end
|
|
123
110
|
|
|
124
111
|
desc 'config [ACTION] [KEY] [VALUE]', 'Manage configuration (list, get, set, unset)'
|
|
125
112
|
method_option :register, aliases: :r, desc: 'Path to tool register', type: :string
|
|
126
113
|
def config(action = 'list', key = nil, value = nil)
|
|
127
|
-
CliCommands::ConfigCommand.new(options).run(action, key, value)
|
|
114
|
+
Ukiryu::CliCommands::ConfigCommand.new(options).run(action, key, value)
|
|
128
115
|
end
|
|
129
116
|
|
|
130
117
|
desc 'validate [COMMAND]', 'Validate tool definitions'
|
|
131
|
-
subcommand 'validate', CliCommands::ValidateCommand
|
|
118
|
+
subcommand 'validate', Ukiryu::CliCommands::ValidateCommand
|
|
132
119
|
|
|
133
120
|
desc 'extract TOOL', 'Extract tool definition from an installed CLI tool'
|
|
134
121
|
method_option :output, aliases: :o, desc: 'Output file for extracted definition', type: :string
|
|
135
122
|
method_option :method, aliases: :m, desc: 'Extraction method (auto, native, help)', type: :string, default: 'auto'
|
|
136
123
|
method_option :verbose, aliases: :v, desc: 'Enable verbose output', type: :boolean, default: false
|
|
137
124
|
def extract(tool_name)
|
|
138
|
-
CliCommands::ExtractCommand.new(options).run(tool_name)
|
|
125
|
+
Ukiryu::CliCommands::ExtractCommand.new(options).run(tool_name)
|
|
139
126
|
end
|
|
140
127
|
|
|
141
128
|
desc 'definitions [COMMAND]', 'Manage tool definitions'
|
|
142
|
-
subcommand 'definitions', CliCommands::DefinitionsCommand
|
|
129
|
+
subcommand 'definitions', Ukiryu::CliCommands::DefinitionsCommand
|
|
143
130
|
|
|
144
131
|
desc 'cache [ACTION]', 'Manage definition cache'
|
|
145
|
-
subcommand 'cache', CliCommands::CacheCommand
|
|
132
|
+
subcommand 'cache', Ukiryu::CliCommands::CacheCommand
|
|
146
133
|
|
|
147
134
|
desc 'resolve TOOL [VERSION]', 'Resolve which definition would be used for a tool'
|
|
148
135
|
def resolve(tool_name, version_constraint = nil)
|
|
149
|
-
CliCommands::ResolveCommand.new(options).run(tool_name, version_constraint)
|
|
136
|
+
Ukiryu::CliCommands::ResolveCommand.new(options).run(tool_name, version_constraint)
|
|
150
137
|
end
|
|
151
138
|
|
|
152
139
|
desc 'register [SUBCOMMAND]', 'Manage the tool register'
|
|
153
140
|
method_option :force, aliases: :f, desc: 'Force re-clone the register', type: :boolean, default: false
|
|
154
141
|
method_option :verbose, aliases: :v, desc: 'Show verbose output', type: :boolean, default: false
|
|
155
142
|
def register(subcommand = nil)
|
|
156
|
-
CliCommands::RegisterCommand.new(options).run(subcommand, options)
|
|
143
|
+
Ukiryu::CliCommands::RegisterCommand.new(options).run(subcommand, options)
|
|
157
144
|
end
|
|
158
145
|
end
|
|
159
146
|
end
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative '../config'
|
|
4
|
-
require_relative '../register'
|
|
5
|
-
|
|
6
3
|
module Ukiryu
|
|
7
4
|
module CliCommands
|
|
8
5
|
# Base class for CLI commands
|
|
@@ -39,7 +36,7 @@ module Ukiryu
|
|
|
39
36
|
register_path = custom_path || config.register || default_register_path
|
|
40
37
|
return unless register_path && Dir.exist?(register_path)
|
|
41
38
|
|
|
42
|
-
Register.default_register_path = register_path
|
|
39
|
+
Ukiryu::Register.default_register_path = register_path
|
|
43
40
|
end
|
|
44
41
|
|
|
45
42
|
# Apply CLI options to the Config instance
|
|
@@ -86,8 +83,7 @@ module Ukiryu
|
|
|
86
83
|
# @return [String, nil] the default register path from RegisterAutoManager
|
|
87
84
|
def default_register_path
|
|
88
85
|
# Use RegisterAutoManager to find or create the register
|
|
89
|
-
|
|
90
|
-
RegisterAutoManager.register_path
|
|
86
|
+
Ukiryu::RegisterAutoManager.register_path
|
|
91
87
|
rescue StandardError
|
|
92
88
|
nil
|
|
93
89
|
end
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative 'base_command'
|
|
4
|
-
require_relative '../tool'
|
|
5
|
-
|
|
6
3
|
module Ukiryu
|
|
7
4
|
module CliCommands
|
|
8
5
|
# List all commands available for a tool
|
|
@@ -13,9 +10,9 @@ module Ukiryu
|
|
|
13
10
|
def run(tool_name)
|
|
14
11
|
setup_register
|
|
15
12
|
|
|
16
|
-
# Use
|
|
17
|
-
tool = Tool.
|
|
18
|
-
error!("Tool not found: #{tool_name}\nAvailable tools: #{Register.tools.sort.join(', ')}") unless tool
|
|
13
|
+
# Use get for direct tool loading (find_by is being migrated)
|
|
14
|
+
tool = Ukiryu::Tool.get(tool_name.to_sym)
|
|
15
|
+
error!("Tool not found: #{tool_name}\nAvailable tools: #{Ukiryu::Register.tools.sort.join(', ')}") unless tool
|
|
19
16
|
|
|
20
17
|
tool_commands = tool.commands
|
|
21
18
|
error! "No commands defined for #{tool_name}" unless tool_commands
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative 'base_command'
|
|
4
|
-
require_relative '../config'
|
|
5
|
-
require_relative '../register_auto_manager'
|
|
6
3
|
require 'yaml'
|
|
7
4
|
require 'fileutils'
|
|
8
5
|
|
|
@@ -54,7 +51,6 @@ module Ukiryu
|
|
|
54
51
|
'Shell' => format_config_value(config.shell, '(auto-detect)'),
|
|
55
52
|
'Format' => format_config_value(config.format),
|
|
56
53
|
'Output' => format_config_value(config.output, '(stdout)'),
|
|
57
|
-
'Search paths' => format_config_value(config.search_paths, '(not set)'),
|
|
58
54
|
'Use color' => format_config_value(config.use_color)
|
|
59
55
|
}
|
|
60
56
|
|
|
@@ -94,7 +90,6 @@ module Ukiryu
|
|
|
94
90
|
'UKIRYU_SHELL' => ENV['UKIRYU_SHELL'],
|
|
95
91
|
'UKIRYU_FORMAT' => ENV['UKIRYU_FORMAT'],
|
|
96
92
|
'UKIRYU_OUTPUT' => ENV['UKIRYU_OUTPUT'],
|
|
97
|
-
'UKIRYU_SEARCH_PATHS' => ENV['UKIRYU_SEARCH_PATHS'],
|
|
98
93
|
'UKIRYU_USE_COLOR' => ENV['UKIRYU_USE_COLOR']
|
|
99
94
|
}
|
|
100
95
|
|
|
@@ -123,10 +118,9 @@ module Ukiryu
|
|
|
123
118
|
when :shell then config.shell
|
|
124
119
|
when :format then config.format
|
|
125
120
|
when :output then config.output
|
|
126
|
-
when :search_paths then config.search_paths
|
|
127
121
|
when :use_color then config.use_color
|
|
128
122
|
else
|
|
129
|
-
error! "Unknown config key: #{key}\nValid keys: register, timeout, debug, dry_run, metrics, shell, format, output,
|
|
123
|
+
error! "Unknown config key: #{key}\nValid keys: register, timeout, debug, dry_run, metrics, shell, format, output, use_color"
|
|
130
124
|
end
|
|
131
125
|
|
|
132
126
|
say "#{key}: #{format_config_value(value, '(not set)')}", :white
|
|
@@ -211,7 +205,6 @@ module Ukiryu
|
|
|
211
205
|
when :format then config.format = value
|
|
212
206
|
when :output then config.output = value
|
|
213
207
|
when :register then config.register = value
|
|
214
|
-
when :search_paths then config.search_paths = value
|
|
215
208
|
when :use_color then config.use_color = value
|
|
216
209
|
end
|
|
217
210
|
end
|
|
@@ -229,7 +222,7 @@ module Ukiryu
|
|
|
229
222
|
#
|
|
230
223
|
# @return [String] formatted register display
|
|
231
224
|
def format_register_display
|
|
232
|
-
info = RegisterAutoManager.register_info
|
|
225
|
+
info = Ukiryu::RegisterAutoManager.register_info
|
|
233
226
|
|
|
234
227
|
case info[:status]
|
|
235
228
|
when :ok
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative '../definition'
|
|
4
|
-
|
|
5
3
|
module Ukiryu
|
|
6
4
|
module CliCommands
|
|
7
5
|
# CLI commands for managing tool definitions
|
|
@@ -21,13 +19,13 @@ module Ukiryu
|
|
|
21
19
|
desc 'list', 'List all discovered definitions'
|
|
22
20
|
method_option :verbose, aliases: :v, desc: 'Show detailed information', type: :boolean, default: false
|
|
23
21
|
def list
|
|
24
|
-
definitions = Definition::Discovery.discover
|
|
22
|
+
definitions = Ukiryu::Definition::Discovery.discover
|
|
25
23
|
|
|
26
24
|
if definitions.empty?
|
|
27
25
|
puts 'No definitions found.'
|
|
28
26
|
puts
|
|
29
27
|
puts 'Search paths:'
|
|
30
|
-
Definition::Discovery.search_paths.each do |path|
|
|
28
|
+
Ukiryu::Definition::Discovery.search_paths.each do |path|
|
|
31
29
|
puts " - #{path}"
|
|
32
30
|
end
|
|
33
31
|
return
|
|
@@ -93,7 +91,7 @@ module Ukiryu
|
|
|
93
91
|
# Load the definition to get metadata
|
|
94
92
|
begin
|
|
95
93
|
metadata = Definition::Loader.load_from_file(source_path, validation: :strict)
|
|
96
|
-
rescue DefinitionLoadError, DefinitionValidationError => e
|
|
94
|
+
rescue Ukiryu::Errors::DefinitionLoadError, Ukiryu::Errors::DefinitionValidationError => e
|
|
97
95
|
warn "Error: Failed to load definition: #{e.message}"
|
|
98
96
|
exit 1
|
|
99
97
|
end
|
|
@@ -244,7 +242,7 @@ module Ukiryu
|
|
|
244
242
|
puts 'Validation: ✓ Valid'
|
|
245
243
|
puts "Display Name: #{tool_def.display_name}" if tool_def.display_name
|
|
246
244
|
puts "Homepage: #{tool_def.homepage}" if tool_def.homepage
|
|
247
|
-
rescue DefinitionLoadError, DefinitionValidationError => e
|
|
245
|
+
rescue Ukiryu::Errors::DefinitionLoadError, Ukiryu::Errors::DefinitionValidationError => e
|
|
248
246
|
puts 'Validation: ✗ Invalid'
|
|
249
247
|
puts "Error: #{e.message}"
|
|
250
248
|
end
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative 'base_command'
|
|
4
|
-
require_relative '../tool'
|
|
5
|
-
|
|
6
3
|
module Ukiryu
|
|
7
4
|
module CliCommands
|
|
8
5
|
# Show comprehensive documentation for a tool or specific command
|
|
@@ -15,8 +12,8 @@ module Ukiryu
|
|
|
15
12
|
setup_register
|
|
16
13
|
|
|
17
14
|
# Use find_by for interface-based discovery (ping -> ping_bsd/ping_gnu)
|
|
18
|
-
tool = Tool.find_by(tool_name.to_sym)
|
|
19
|
-
error!("Tool not found: #{tool_name}\nAvailable tools: #{Register.tools.sort.join(', ')}") unless tool
|
|
15
|
+
tool = Ukiryu::Tool.find_by(tool_name.to_sym)
|
|
16
|
+
error!("Tool not found: #{tool_name}\nAvailable tools: #{Ukiryu::Register.tools.sort.join(', ')}") unless tool
|
|
20
17
|
|
|
21
18
|
tool_commands = tool.commands
|
|
22
19
|
error! "No commands defined for #{tool_name}" unless tool_commands
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative 'base_command'
|
|
4
|
-
require_relative '../extractors/extractor'
|
|
5
|
-
|
|
6
3
|
module Ukiryu
|
|
7
4
|
module CliCommands
|
|
8
5
|
# Extract tool definition from an installed CLI tool
|
|
@@ -15,7 +12,7 @@ module Ukiryu
|
|
|
15
12
|
#
|
|
16
13
|
# @param tool_name [String] the tool name to extract definition from
|
|
17
14
|
def run(tool_name)
|
|
18
|
-
result = Extractors::Extractor.extract(tool_name, extract_options)
|
|
15
|
+
result = Ukiryu::Extractors::Extractor.extract(tool_name, extract_options)
|
|
19
16
|
|
|
20
17
|
if result[:success]
|
|
21
18
|
output_result(result)
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative 'base_command'
|
|
4
|
-
require_relative '../tool'
|
|
5
|
-
|
|
6
3
|
module Ukiryu
|
|
7
4
|
module CliCommands
|
|
8
5
|
# Show detailed information about a tool
|
|
@@ -14,8 +11,8 @@ module Ukiryu
|
|
|
14
11
|
setup_register
|
|
15
12
|
|
|
16
13
|
# Use find_by for interface-based discovery (ping -> ping_bsd/ping_gnu)
|
|
17
|
-
tool = Tool.find_by(tool_name.to_sym)
|
|
18
|
-
error!("Tool not found: #{tool_name}\nAvailable tools: #{Register.tools.sort.join(', ')}") unless tool
|
|
14
|
+
tool = Ukiryu::Tool.find_by(tool_name.to_sym)
|
|
15
|
+
error!("Tool not found: #{tool_name}\nAvailable tools: #{Ukiryu::Register.tools.sort.join(', ')}") unless tool
|
|
19
16
|
|
|
20
17
|
profile = tool.profile
|
|
21
18
|
show_all = options[:all]
|
|
@@ -37,7 +34,7 @@ module Ukiryu
|
|
|
37
34
|
say "All '#{tool_name}' implementations:", :yellow
|
|
38
35
|
all_implementations = [profile.name, *other_implementations].sort
|
|
39
36
|
all_implementations.each do |impl|
|
|
40
|
-
impl_tool = Tool.get(impl)
|
|
37
|
+
impl_tool = Ukiryu::Tool.get(impl)
|
|
41
38
|
if impl_tool
|
|
42
39
|
status = impl_tool.available? ? '[✓]' : '[✗]'
|
|
43
40
|
color = impl_tool.available? ? :green : :red
|
|
@@ -45,7 +42,7 @@ module Ukiryu
|
|
|
45
42
|
else
|
|
46
43
|
say " [?] #{impl}", :white
|
|
47
44
|
end
|
|
48
|
-
rescue Ukiryu::ToolNotFoundError, Ukiryu::ProfileNotFoundError
|
|
45
|
+
rescue Ukiryu::Errors::ToolNotFoundError, Ukiryu::Errors::ProfileNotFoundError
|
|
49
46
|
# Tool exists but no compatible profile for this platform
|
|
50
47
|
say " [ ] #{impl}", :dim
|
|
51
48
|
end
|
|
@@ -71,22 +68,6 @@ module Ukiryu
|
|
|
71
68
|
say " Modern Threshold: #{vd.modern_threshold}", :white if vd.modern_threshold
|
|
72
69
|
end
|
|
73
70
|
|
|
74
|
-
# Search paths
|
|
75
|
-
if profile.search_paths
|
|
76
|
-
say '', :clear
|
|
77
|
-
say 'Search Paths:', :yellow
|
|
78
|
-
search_paths = profile.search_paths
|
|
79
|
-
|
|
80
|
-
# Iterate over platform attributes
|
|
81
|
-
%i[macos linux windows freebsd openbsd netbsd].each do |platform|
|
|
82
|
-
paths = search_paths.send(platform)
|
|
83
|
-
next if paths.nil? || paths.empty?
|
|
84
|
-
|
|
85
|
-
say " #{platform}:", :white
|
|
86
|
-
Array(paths).each { |p| say " - #{p}", :white }
|
|
87
|
-
end
|
|
88
|
-
end
|
|
89
|
-
|
|
90
71
|
# Profiles
|
|
91
72
|
if profile.profiles
|
|
92
73
|
say '', :clear
|
|
@@ -122,22 +103,20 @@ module Ukiryu
|
|
|
122
103
|
# @param current_tool_name [String] the current tool name to exclude
|
|
123
104
|
# @return [Array<String>] list of other tool names
|
|
124
105
|
def find_other_implementations(interface_name, current_tool_name)
|
|
125
|
-
require_relative '../register'
|
|
126
|
-
|
|
127
106
|
implementations = []
|
|
128
107
|
interface_sym = interface_name.to_sym
|
|
129
108
|
|
|
130
109
|
if config.debug
|
|
131
110
|
say " [DEBUG] Looking for tools implementing '#{interface_name}' (excluding '#{current_tool_name}')", :dim
|
|
132
|
-
say " [DEBUG] Register tools: #{Register.tools.inspect}", :dim
|
|
111
|
+
say " [DEBUG] Register tools: #{Ukiryu::Register.tools.inspect}", :dim
|
|
133
112
|
end
|
|
134
113
|
|
|
135
|
-
Register.tools.each do |tool_name|
|
|
114
|
+
Ukiryu::Register.tools.each do |tool_name|
|
|
136
115
|
next if tool_name == current_tool_name
|
|
137
116
|
|
|
138
117
|
begin
|
|
139
118
|
# Don't pass register_path - let it use the default
|
|
140
|
-
tool_metadata = Register.load_tool_metadata(tool_name.to_sym)
|
|
119
|
+
tool_metadata = Ukiryu::Register.load_tool_metadata(tool_name.to_sym)
|
|
141
120
|
if config.debug
|
|
142
121
|
say " [DEBUG] #{tool_name} -> metadata: #{tool_metadata ? tool_metadata.implements : 'nil'}", :dim
|
|
143
122
|
end
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative 'base_command'
|
|
4
|
-
require_relative '../tool'
|
|
5
|
-
require_relative '../register'
|
|
6
|
-
|
|
7
3
|
module Ukiryu
|
|
8
4
|
module CliCommands
|
|
9
5
|
# List all available tools in the register
|
|
@@ -12,7 +8,7 @@ module Ukiryu
|
|
|
12
8
|
def run
|
|
13
9
|
setup_register
|
|
14
10
|
|
|
15
|
-
tools = Register.tools
|
|
11
|
+
tools = Ukiryu::Register.tools
|
|
16
12
|
error! 'No tools found in register' if tools.empty?
|
|
17
13
|
|
|
18
14
|
say "Available tools (#{tools.count}):", :cyan
|
|
@@ -22,7 +18,7 @@ module Ukiryu
|
|
|
22
18
|
standalone_tools = []
|
|
23
19
|
|
|
24
20
|
tools.sort.each do |name|
|
|
25
|
-
metadata = Register.load_tool_metadata(name.to_sym)
|
|
21
|
+
metadata = Ukiryu::Register.load_tool_metadata(name.to_sym)
|
|
26
22
|
|
|
27
23
|
if metadata&.implements
|
|
28
24
|
# This tool implements an interface
|
|
@@ -36,7 +32,7 @@ module Ukiryu
|
|
|
36
32
|
# Regular standalone tool
|
|
37
33
|
standalone_tools << name
|
|
38
34
|
end
|
|
39
|
-
rescue Ukiryu::Error
|
|
35
|
+
rescue Ukiryu::Errors::Error
|
|
40
36
|
# If we can't load metadata, treat as standalone
|
|
41
37
|
standalone_tools << name
|
|
42
38
|
end
|
|
@@ -46,22 +42,22 @@ module Ukiryu
|
|
|
46
42
|
say " #{interface_name}:", :cyan
|
|
47
43
|
|
|
48
44
|
impls.sort.each do |impl_name|
|
|
49
|
-
tool = Tool.get(impl_name)
|
|
45
|
+
tool = Ukiryu::Tool.get(impl_name)
|
|
50
46
|
version_info = tool.version ? "v#{tool.version}" : 'version unknown'
|
|
51
47
|
available = tool.available? ? '[✓]' : '[✗]'
|
|
52
48
|
say " #{available.ljust(4)} #{impl_name.ljust(20)} #{version_info}", tool.available? ? :green : :red
|
|
53
|
-
rescue Ukiryu::Error => e
|
|
49
|
+
rescue Ukiryu::Errors::Error => e
|
|
54
50
|
say " [?] #{impl_name.ljust(20)} error: #{e.message}", :red
|
|
55
51
|
end
|
|
56
52
|
end
|
|
57
53
|
|
|
58
54
|
# Display standalone tools
|
|
59
55
|
standalone_tools.sort.each do |name|
|
|
60
|
-
tool = Tool.get(name)
|
|
56
|
+
tool = Ukiryu::Tool.get(name)
|
|
61
57
|
version_info = tool.version ? "v#{tool.version}" : 'version unknown'
|
|
62
58
|
available = tool.available? ? '[✓]' : '[✗]'
|
|
63
59
|
say " #{available.ljust(4)} #{name.ljust(20)} #{version_info}", tool.available? ? :green : :red
|
|
64
|
-
rescue Ukiryu::Error => e
|
|
60
|
+
rescue Ukiryu::Errors::Error => e
|
|
65
61
|
say " [?] #{name.ljust(20)} error: #{e.message}", :red
|
|
66
62
|
end
|
|
67
63
|
end
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative 'base_command'
|
|
4
|
-
require_relative '../tool'
|
|
5
|
-
|
|
6
3
|
module Ukiryu
|
|
7
4
|
module CliCommands
|
|
8
5
|
# Show options for a tool or specific command
|
|
@@ -15,8 +12,8 @@ module Ukiryu
|
|
|
15
12
|
setup_register
|
|
16
13
|
|
|
17
14
|
# Use find_by for interface-based discovery (ping -> ping_bsd/ping_gnu)
|
|
18
|
-
tool = Tool.find_by(tool_name.to_sym)
|
|
19
|
-
error!("Tool not found: #{tool_name}\nAvailable tools: #{Register.tools.sort.join(', ')}") unless tool
|
|
15
|
+
tool = Ukiryu::Tool.find_by(tool_name.to_sym)
|
|
16
|
+
error!("Tool not found: #{tool_name}\nAvailable tools: #{Ukiryu::Register.tools.sort.join(', ')}") unless tool
|
|
20
17
|
|
|
21
18
|
tool_commands = tool.commands
|
|
22
19
|
error! "No commands defined for #{tool_name}" unless tool_commands
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative '../register_auto_manager'
|
|
4
|
-
require_relative '../register'
|
|
5
|
-
|
|
6
3
|
module Ukiryu
|
|
7
4
|
module CliCommands
|
|
8
5
|
# Command to manage the register
|
|
@@ -24,7 +21,7 @@ module Ukiryu
|
|
|
24
21
|
else
|
|
25
22
|
error!("Unknown subcommand: #{subcommand}. Valid subcommands: info, update, path")
|
|
26
23
|
end
|
|
27
|
-
rescue RegisterAutoManager::RegisterError => e
|
|
24
|
+
rescue Ukiryu::RegisterAutoManager::RegisterError => e
|
|
28
25
|
error!("Register error: #{e.message}")
|
|
29
26
|
end
|
|
30
27
|
|
|
@@ -34,7 +31,7 @@ module Ukiryu
|
|
|
34
31
|
#
|
|
35
32
|
# @param options [Hash] command options
|
|
36
33
|
def show_info(_options = {})
|
|
37
|
-
info = RegisterAutoManager.register_info
|
|
34
|
+
info = Ukiryu::RegisterAutoManager.register_info
|
|
38
35
|
|
|
39
36
|
say 'Register Information', :cyan
|
|
40
37
|
say ''
|
|
@@ -92,7 +89,7 @@ module Ukiryu
|
|
|
92
89
|
say 'Updating register...', :cyan
|
|
93
90
|
end
|
|
94
91
|
|
|
95
|
-
RegisterAutoManager.update_register(force: force)
|
|
92
|
+
Ukiryu::RegisterAutoManager.update_register(force: force)
|
|
96
93
|
|
|
97
94
|
say 'Register updated successfully!', :green
|
|
98
95
|
show_info(options)
|
|
@@ -100,7 +97,7 @@ module Ukiryu
|
|
|
100
97
|
|
|
101
98
|
# Show the register path
|
|
102
99
|
def show_path
|
|
103
|
-
path = RegisterAutoManager.register_path
|
|
100
|
+
path = Ukiryu::RegisterAutoManager.register_path
|
|
104
101
|
|
|
105
102
|
if path
|
|
106
103
|
say path
|
|
@@ -132,7 +129,7 @@ module Ukiryu
|
|
|
132
129
|
say 'Manual setup:', :cyan
|
|
133
130
|
say ''
|
|
134
131
|
say ' 1. Clone the register:'
|
|
135
|
-
say " git clone #{RegisterAutoManager::REGISTER_URL} ~/.ukiryu/register"
|
|
132
|
+
say " git clone #{Ukiryu::RegisterAutoManager::REGISTER_URL} ~/.ukiryu/register"
|
|
136
133
|
say ''
|
|
137
134
|
say ' 2. Or set environment variable:'
|
|
138
135
|
say ' export UKIRYU_REGISTER=/path/to/register'
|
|
@@ -65,9 +65,11 @@ module Ukiryu
|
|
|
65
65
|
def format_yaml_response(response, config)
|
|
66
66
|
yaml_content = response.to_yaml
|
|
67
67
|
|
|
68
|
-
# Determine if we should use colors
|
|
69
|
-
#
|
|
70
|
-
#
|
|
68
|
+
# Determine if we should use colors
|
|
69
|
+
# Config handles environment (NO_COLOR) and TTY detection properly
|
|
70
|
+
# When config.use_color is nil, it means "auto-detect based on TTY"
|
|
71
|
+
# But Docker's pseudo-TTY makes TTY detection unreliable
|
|
72
|
+
# So we also check if NO_COLOR was set (via config.colors_disabled?)
|
|
71
73
|
use_colors = if config.use_color.nil?
|
|
72
74
|
$stdout.tty? && !config.colors_disabled?
|
|
73
75
|
else
|