aspera-cli 4.27.1 → 4.27.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 (133) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/CHANGELOG.md +67 -1
  4. data/bin/ascli +2 -1
  5. data/docs/README.md +805 -747
  6. data/lib/aspera/agent/connect.rb +6 -4
  7. data/lib/aspera/agent/desktop.rb +2 -2
  8. data/lib/aspera/agent/direct.rb +3 -1
  9. data/lib/aspera/agent/node.rb +3 -3
  10. data/lib/aspera/api/alee.rb +1 -1
  11. data/lib/aspera/api/aoc.rb +14 -12
  12. data/lib/aspera/api/ats.rb +1 -1
  13. data/lib/aspera/api/cos_node.rb +2 -2
  14. data/lib/aspera/api/faspex.rb +9 -7
  15. data/lib/aspera/api/httpgw.rb +37 -33
  16. data/lib/aspera/api/node.rb +38 -33
  17. data/lib/aspera/ascmd.rb +3 -1
  18. data/lib/aspera/ascp/installation.rb +62 -27
  19. data/lib/aspera/ascp/management.rb +1 -0
  20. data/lib/aspera/assert.rb +4 -0
  21. data/lib/aspera/cli/ascp_actions.rb +20 -41
  22. data/lib/aspera/cli/async_transfer_store.rb +2 -2
  23. data/lib/aspera/cli/bootstrapper.rb +11 -15
  24. data/lib/aspera/cli/command_line.rb +252 -0
  25. data/lib/aspera/cli/command_registry.rb +149 -33
  26. data/lib/aspera/cli/command_spec.rb +103 -14
  27. data/lib/aspera/cli/completion/ascli.bash +12 -0
  28. data/lib/aspera/cli/completion/ascli.fish +16 -0
  29. data/lib/aspera/cli/completion/ascli.zsh +19 -0
  30. data/lib/aspera/cli/context.rb +3 -0
  31. data/lib/aspera/cli/deprecation.rb +37 -0
  32. data/lib/aspera/cli/extended_value.rb +2 -0
  33. data/lib/aspera/cli/formatter.rb +87 -75
  34. data/lib/aspera/cli/gem_checker.rb +1 -1
  35. data/lib/aspera/cli/hints.rb +7 -6
  36. data/lib/aspera/cli/http.rb +21 -21
  37. data/lib/aspera/cli/info.rb +3 -0
  38. data/lib/aspera/cli/mcp_tool.rb +47 -83
  39. data/lib/aspera/cli/option_declarator.rb +33 -42
  40. data/lib/aspera/cli/option_registry.rb +69 -0
  41. data/lib/aspera/cli/option_types.rb +103 -0
  42. data/lib/aspera/cli/option_value.rb +281 -0
  43. data/lib/aspera/cli/options.schema.yaml +38 -5
  44. data/lib/aspera/cli/parser.rb +307 -848
  45. data/lib/aspera/cli/plugins/alee.rb +7 -4
  46. data/lib/aspera/cli/plugins/aoc.rb +435 -380
  47. data/lib/aspera/cli/plugins/ats.rb +58 -73
  48. data/lib/aspera/cli/plugins/base.rb +190 -240
  49. data/lib/aspera/cli/plugins/basic_auth.rb +2 -10
  50. data/lib/aspera/cli/plugins/config.rb +244 -178
  51. data/lib/aspera/cli/plugins/console.rb +102 -38
  52. data/lib/aspera/cli/plugins/cos.rb +6 -23
  53. data/lib/aspera/cli/plugins/factory.rb +3 -0
  54. data/lib/aspera/cli/plugins/faspex5.rb +176 -173
  55. data/lib/aspera/cli/plugins/faspio.rb +5 -10
  56. data/lib/aspera/cli/plugins/httpgw.rb +8 -11
  57. data/lib/aspera/cli/plugins/mcp.rb +20 -55
  58. data/lib/aspera/cli/plugins/node.rb +277 -311
  59. data/lib/aspera/cli/plugins/orchestrator.rb +90 -77
  60. data/lib/aspera/cli/plugins/preview.rb +79 -90
  61. data/lib/aspera/cli/plugins/server.rb +76 -50
  62. data/lib/aspera/cli/plugins/shares.rb +68 -116
  63. data/lib/aspera/cli/preset_actions.rb +17 -10
  64. data/lib/aspera/cli/preset_manager.rb +12 -2
  65. data/lib/aspera/cli/prompt.rb +35 -0
  66. data/lib/aspera/cli/result.rb +13 -18
  67. data/lib/aspera/cli/runner.rb +31 -54
  68. data/lib/aspera/cli/special_values.rb +5 -0
  69. data/lib/aspera/cli/sync_actions.rb +41 -37
  70. data/lib/aspera/cli/terminal_formatter.rb +9 -3
  71. data/lib/aspera/cli/transfer_actions.rb +0 -6
  72. data/lib/aspera/cli/transfer_agent.rb +29 -35
  73. data/lib/aspera/cli/vault_manager.rb +0 -17
  74. data/lib/aspera/cli/version.rb +1 -1
  75. data/lib/aspera/cli/wizard.rb +4 -2
  76. data/lib/aspera/command_line_builder.rb +1 -0
  77. data/lib/aspera/coverage.rb +1 -0
  78. data/lib/aspera/environment.rb +7 -1
  79. data/lib/aspera/faspex_gw.rb +2 -1
  80. data/lib/aspera/faspex_postproc.rb +1 -0
  81. data/lib/aspera/graphql.rb +5 -5
  82. data/lib/aspera/json_rpc/client.rb +5 -5
  83. data/lib/aspera/keychain/encrypted_hash.rb +1 -1
  84. data/lib/aspera/keychain/one_password_api.rb +1 -1
  85. data/lib/aspera/link_header.rb +2 -2
  86. data/lib/aspera/log.rb +22 -25
  87. data/lib/aspera/markdown.rb +2 -0
  88. data/lib/aspera/mime.rb +25 -0
  89. data/lib/aspera/node_simulator.rb +1 -0
  90. data/lib/aspera/oauth/base.rb +35 -25
  91. data/lib/aspera/oauth/factory.rb +1 -0
  92. data/lib/aspera/oauth/generic.rb +1 -1
  93. data/lib/aspera/oauth/jwt.rb +1 -1
  94. data/lib/aspera/oauth/web.rb +9 -8
  95. data/lib/aspera/preview/file_types.rb +4 -4
  96. data/lib/aspera/preview/generator.rb +7 -0
  97. data/lib/aspera/preview/options.rb +4 -4
  98. data/lib/aspera/preview/terminal.rb +4 -3
  99. data/lib/aspera/preview/utils.rb +9 -6
  100. data/lib/aspera/products/connect.rb +1 -1
  101. data/lib/aspera/rainbow.rb +7 -0
  102. data/lib/aspera/rest/aspera_errors.rb +60 -0
  103. data/lib/aspera/rest/call_error.rb +27 -0
  104. data/lib/aspera/rest/client.rb +514 -0
  105. data/lib/aspera/rest/error_analyzer.rb +113 -0
  106. data/lib/aspera/rest/list.rb +143 -0
  107. data/lib/aspera/rest/parameters.rb +55 -0
  108. data/lib/aspera/rest/util.rb +176 -0
  109. data/lib/aspera/rest.rb +7 -621
  110. data/lib/aspera/schema/IBM Aspera Console-enhanced.yaml +1125 -0
  111. data/lib/aspera/schema/IBM Aspera on Cloud API-0.2.6-enhanced.yaml +39 -0
  112. data/lib/aspera/schema/IBM Aspera on Cloud Automation API-1.0.5-enhanced.yaml +2395 -0
  113. data/lib/aspera/schema/documentation.rb +13 -3
  114. data/lib/aspera/schema/registry.rb +18 -1
  115. data/lib/aspera/schema/validator.rb +92 -0
  116. data/lib/aspera/secret_hider.rb +36 -25
  117. data/lib/aspera/string_ext.rb +15 -0
  118. data/lib/aspera/temp_file_manager.rb +6 -5
  119. data/lib/aspera/transfer/parameters.rb +2 -0
  120. data/lib/aspera/transfer/spec.rb +1 -0
  121. data/lib/aspera/transfer/spec.schema.yaml +1 -0
  122. data/lib/aspera/uri_reader.rb +11 -11
  123. data/lib/aspera/web_auth/index.html +147 -0
  124. data/lib/aspera/web_auth/server.rb +81 -0
  125. data.tar.gz.sig +0 -0
  126. metadata +39 -7
  127. metadata.gz.sig +0 -0
  128. data/lib/aspera/colors.rb +0 -79
  129. data/lib/aspera/rest_call_error.rb +0 -25
  130. data/lib/aspera/rest_error_analyzer.rb +0 -111
  131. data/lib/aspera/rest_errors_aspera.rb +0 -58
  132. data/lib/aspera/rest_list.rb +0 -136
  133. data/lib/aspera/web_auth.rb +0 -211
@@ -13,7 +13,7 @@ module Aspera
13
13
  class << self
14
14
  # @return [Hash,NilClass]
15
15
  def detect(base_url)
16
- api = Rest.new(base_url: base_url)
16
+ api = Rest::Client.new(base_url: base_url)
17
17
  data, http = api.read('ping', ret: :both)
18
18
  server_type = http['Server']
19
19
  return unless data.is_a?(Hash) && data.empty?
@@ -37,7 +37,7 @@ module Aspera
37
37
  }
38
38
  end
39
39
 
40
- command :health, description: 'Check health of faspio Gateway'
40
+ command :health, description: 'Check faspio Gateway health'
41
41
 
42
42
  commands_under :bridges do
43
43
  crud_commands entity: 'bridges',
@@ -50,13 +50,8 @@ module Aspera
50
50
  option :private_key, description: 'OAuth JWT RSA private key PEM **value**'
51
51
  option :passphrase, description: 'OAuth JWT RSA private key passphrase'
52
52
 
53
- def initialize(**_)
54
- super
55
- options.parse_options!
56
- end
57
-
58
53
  # Build the REST API object based on the configured auth type.
59
- # @return [Rest]
54
+ # @return [Rest::Client]
60
55
  def build_api
61
56
  base_url = options.get_option(:url, mandatory: true)
62
57
  case options.get_option(:auth, mandatory: true)
@@ -64,7 +59,7 @@ module Aspera
64
59
  basic_auth_api
65
60
  when :jwt
66
61
  app_client_id = options.get_option(:client_id, mandatory: true)
67
- Rest.new(
62
+ Rest::Client.new(
68
63
  base_url: base_url,
69
64
  auth: {
70
65
  type: :oauth2,
@@ -85,7 +80,7 @@ module Aspera
85
80
  end
86
81
  end
87
82
 
88
- def action_health
83
+ def action_health(**)
89
84
  nagios = Nagios.new
90
85
  begin
91
86
  result = build_api.read('ping')
@@ -36,7 +36,14 @@ module Aspera
36
36
  }
37
37
  end
38
38
 
39
- command(:health, description: 'Check health of HTTP Gateway', action: lambda do
39
+ command :health, description: 'Check HTTP Gateway health'
40
+
41
+ command :info, description: 'Show HTTP Gateway information',
42
+ action: ->(**) { Result::SingleObject.new(Api::Httpgw.new(url: options.get_option(:url, mandatory: true)).info) }
43
+
44
+ option :url, description: 'URL of application, e.g. https://app.example.com/aspera/app'
45
+
46
+ def action_health(**)
40
47
  nagios = Nagios.new
41
48
  begin
42
49
  Api::Httpgw.new(url: options.get_option(:url, mandatory: true))
@@ -45,16 +52,6 @@ module Aspera
45
52
  nagios.add_critical('api', e.to_s)
46
53
  end
47
54
  Result::ObjectList.new(nagios.status_list)
48
- end)
49
-
50
- command :info, description: 'Show HTTP Gateway information',
51
- action: -> { Result::SingleObject.new(Api::Httpgw.new(url: options.get_option(:url, mandatory: true)).info) }
52
-
53
- option :url, description: 'URL of application, e.g. https://app.example.com/aspera/app'
54
-
55
- def initialize(**_)
56
- super
57
- options.parse_options!
58
55
  end
59
56
  end
60
57
  end
@@ -45,64 +45,29 @@ module Aspera
45
45
  DEFAULT_INSTRUCTIONS = <<~INST.strip
46
46
  This is the Aspera CLI (ascli) MCP server (IBM Aspera file transfer and management).
47
47
  It exposes a single tool, execute_ascli_command, which runs any ascli command in-process.
48
- Refer to the tool description for full syntax, discovery steps, and examples.
49
-
50
- Key plugins: aoc (Aspera on Cloud), faspex5 (Faspex 5), node (Node API),
51
- server (FASP/SSH server), config (local configuration), console, orchestrator,
52
- ats (Aspera Transfer Service), preview, shares, cos, httpgw, faspio, alee.
53
-
54
- Recommended workflow for any task:
55
- 1. Call ["config", "commands"] to map all 800+ commands to their syntax.
56
- Never guess subcommand names from training data — always verify with this call.
57
- 2. For any command whose syntax shows a <data> argument, call it with "help"
58
- instead of the real value to see the full field schema before constructing
59
- the @json:{...} payload. This is mandatory — never infer fields from errors.
60
- 2b. For any list command, add --query=help to discover available filter parameters.
61
- Example: ["aoc", "admin", "user", "list", "--query=help"]
62
- 3. Call ["config", "options", "<plugin>"] to list every --flag accepted by a
63
- plugin with its allowed values (e.g. --auth=basic|oauth2|..., --url, --preset).
64
- 4. When credentials are already saved, use --preset=name instead of inline
65
- credentials. Call ["config", "preset", "list"] to see saved presets.
66
-
67
- AUTOMATIC FLAGS
68
- The server automatically injects --interactive=no and --transfer.asynchronous=true
69
- before every command. Do NOT add them yourself — they are already applied.
70
- If credentials are missing, the command returns an error; report it and stop.
71
- The transfer agent defaults to "direct" (in-process ascp). To use the IBM Aspera
72
- Desktop Client for all transfers, the server can be started with extra_args including
73
- --transfer.agent=desktop:
74
- ascli mcp server @json:{"extra_args":["--interactive=no","--transfer.asynchronous=true","--transfer.agent=desktop"]}
75
-
76
- CREDENTIAL INTEGRITY
77
- Use saved presets by default — do not specify server address or credentials if a
78
- default preset is already configured, unless the user asks otherwise.
79
- Call ["config", "preset", "overview"] to check available presets.
80
- Some plugins support web-based authentication: the user logs in via a browser
81
- (use --auth=web or follow the wizard).
82
- If the user explicitly provides credentials inline (--url, --username, --password,
83
- --private-key), use those exact values verbatim — never silently substitute a
84
- preset or a different server. Report errors as-is and stop.
85
-
86
- TRANSFER OPTIONS
87
- Any flags explicitly requested by the user (--transfer.agent=<agent>, --to-folder,
88
- etc.) must be passed verbatim. Never omit or replace them.
89
- The agent is selected with "--transfer.agent=<agent>" (e.g. "--transfer.agent=desktop",
90
- "--transfer.agent=direct", "--transfer.agent=node").
91
- For a graphical transfer (IBM Aspera Desktop Client), use --transfer.agent=desktop.
92
- Because --transfer.asynchronous=true is injected automatically, transfer commands
93
- return a job_id immediately — never retry a command that already returned one.
94
- Async transfer lifecycle:
95
- submit → e.g. ["server", "download", "/file", "--to-folder=/tmp"] → returns job_id
48
+ Its description gives the syntax and the discovery sequence: follow it before any
49
+ command whose syntax you have not verified in this session.
50
+
51
+ Plugins: aoc (Aspera on Cloud), faspex5 (Faspex 5), node (Node API), server (FASP/SSH
52
+ server), config (local configuration), console, orchestrator, ats, preview, shares,
53
+ cos, httpgw, faspio, alee.
54
+
55
+ CREDENTIALS
56
+ Use saved presets by default: call ["config", "preset", "overview"] first, then pass
57
+ --preset=<name>, or nothing if a default preset exists for the plugin.
58
+ If the user provides credentials inline (--url, --username, --password, --private-key),
59
+ use those exact values verbatim — never substitute a preset or another server.
60
+ Some plugins support browser login (--auth=web).
61
+ On error, report it as-is and stop.
62
+
63
+ TRANSFERS
64
+ Pass verbatim any flag the user requests (--transfer.agent=<agent>, --to-folder, …).
65
+ Agents: direct (default, in-process ascp), desktop (IBM Aspera Desktop Client,
66
+ graphical), node, transferd, httpgw, connect.
67
+ Transfers are asynchronous: the command returns a job_id immediately — never retry it.
96
68
  monitor → ["config", "transfer", "status", "<job_id>"]
97
69
  list → ["config", "transfer", "list"]
98
70
  cleanup → ["config", "transfer", "cleanup"]
99
-
100
- FILE LIST FOR TRANSFERS
101
- For all transfers (upload, download, package send, …), append source file paths
102
- at the end of the args array — no --sources flag needed.
103
- ["server", "upload", "--to-folder=/dst", "/local/a.txt", "/local/b.txt"]
104
- ["aoc", "packages", "send", "@:", "name=pkg", "recipients.0=u@example.com", "END",
105
- "/local/a.txt", "/local/b.txt"]
106
71
  INST
107
72
 
108
73
  # Keys forwarded to MCP::Server constructor (symbolized)