aspera-cli 4.26.1 → 4.27.0

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 (145) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/CHANGELOG.md +300 -22
  4. data/CONTRIBUTING.md +100 -12
  5. data/bin/ascli +5 -5
  6. data/docs/README.md +10757 -0
  7. data/docs/test-mcp-with-ai.md +202 -0
  8. data/lib/aspera/agent/base.rb +20 -6
  9. data/lib/aspera/agent/connect.rb +53 -16
  10. data/lib/aspera/agent/desktop.rb +52 -17
  11. data/lib/aspera/agent/direct.rb +27 -25
  12. data/lib/aspera/agent/factory.rb +4 -0
  13. data/lib/aspera/agent/httpgw.rb +2 -2
  14. data/lib/aspera/agent/node.rb +34 -2
  15. data/lib/aspera/agent/transferd.rb +39 -3
  16. data/lib/aspera/api/alee.rb +1 -1
  17. data/lib/aspera/api/aoc.rb +56 -51
  18. data/lib/aspera/api/cos_node.rb +2 -2
  19. data/lib/aspera/api/faspex.rb +22 -20
  20. data/lib/aspera/api/httpgw.rb +4 -4
  21. data/lib/aspera/api/node.rb +33 -30
  22. data/lib/aspera/api/queries/bss_subscription_account.graphql +18 -0
  23. data/lib/aspera/api/queries/bss_subscription_usage.graphql +18 -0
  24. data/lib/aspera/ascmd.rb +25 -23
  25. data/lib/aspera/ascp/installation.rb +43 -40
  26. data/lib/aspera/ascp/management.rb +2 -3
  27. data/lib/aspera/cli/ascp_actions.rb +155 -0
  28. data/lib/aspera/cli/async_transfer_store.rb +81 -0
  29. data/lib/aspera/cli/bootstrapper.rb +197 -0
  30. data/lib/aspera/cli/command_registry.rb +145 -0
  31. data/lib/aspera/cli/command_spec.rb +138 -0
  32. data/lib/aspera/cli/context.rb +71 -0
  33. data/lib/aspera/cli/error.rb +16 -0
  34. data/lib/aspera/cli/extended_value.rb +5 -3
  35. data/lib/aspera/cli/formatter.rb +122 -209
  36. data/lib/aspera/cli/gem_checker.rb +65 -0
  37. data/lib/aspera/cli/hints.rb +2 -2
  38. data/lib/aspera/cli/http.rb +218 -0
  39. data/lib/aspera/cli/info.rb +2 -0
  40. data/lib/aspera/cli/mailer.rb +97 -0
  41. data/lib/aspera/cli/mcp_tool.rb +198 -0
  42. data/lib/aspera/cli/options.schema.yaml +364 -7
  43. data/lib/aspera/cli/{manager.rb → parser.rb} +337 -144
  44. data/lib/aspera/cli/plugins/alee.rb +20 -22
  45. data/lib/aspera/cli/plugins/aoc.rb +1173 -849
  46. data/lib/aspera/cli/plugins/ats.rb +200 -161
  47. data/lib/aspera/cli/plugins/base.rb +470 -107
  48. data/lib/aspera/cli/plugins/basic_auth.rb +14 -4
  49. data/lib/aspera/cli/plugins/config.rb +434 -1032
  50. data/lib/aspera/cli/plugins/console.rb +106 -64
  51. data/lib/aspera/cli/plugins/cos.rb +44 -32
  52. data/lib/aspera/cli/plugins/factory.rb +7 -4
  53. data/lib/aspera/cli/plugins/faspex.rb +296 -259
  54. data/lib/aspera/cli/plugins/faspex5.rb +592 -344
  55. data/lib/aspera/cli/plugins/faspio.rb +49 -51
  56. data/lib/aspera/cli/plugins/httpgw.rb +18 -25
  57. data/lib/aspera/cli/plugins/mcp.rb +279 -0
  58. data/lib/aspera/cli/plugins/node.rb +1001 -797
  59. data/lib/aspera/cli/plugins/oauth.rb +7 -10
  60. data/lib/aspera/cli/plugins/orchestrator.rb +111 -139
  61. data/lib/aspera/cli/plugins/preview.rb +183 -142
  62. data/lib/aspera/cli/plugins/server.rb +125 -80
  63. data/lib/aspera/cli/plugins/shares.rb +301 -107
  64. data/lib/aspera/cli/preset_actions.rb +139 -0
  65. data/lib/aspera/cli/preset_manager.rb +236 -0
  66. data/lib/aspera/cli/result.rb +360 -0
  67. data/lib/aspera/cli/runner.rb +473 -0
  68. data/lib/aspera/cli/secret_finder.rb +40 -0
  69. data/lib/aspera/cli/special_values.rb +1 -0
  70. data/lib/aspera/cli/sync_actions.rb +84 -56
  71. data/lib/aspera/cli/terminal_formatter.rb +65 -0
  72. data/lib/aspera/cli/transfer_actions.rb +83 -0
  73. data/lib/aspera/cli/transfer_agent.rb +116 -51
  74. data/lib/aspera/cli/transfer_progress.rb +9 -9
  75. data/lib/aspera/cli/vault_manager.rb +57 -0
  76. data/lib/aspera/cli/version.rb +1 -1
  77. data/lib/aspera/cli/wizard.rb +26 -26
  78. data/lib/aspera/command_line_builder.rb +23 -23
  79. data/lib/aspera/data_repository.rb +6 -1
  80. data/lib/aspera/dot_container.rb +5 -5
  81. data/lib/aspera/environment.rb +39 -13
  82. data/lib/aspera/exec_spec.rb +13 -0
  83. data/lib/aspera/faspex_gw.rb +2 -2
  84. data/lib/aspera/faspex_postproc.rb +4 -3
  85. data/lib/aspera/graphql.rb +35 -0
  86. data/lib/aspera/hash_ext.rb +6 -0
  87. data/lib/aspera/json_rpc/client.rb +62 -0
  88. data/lib/aspera/json_rpc/version.rb +7 -0
  89. data/lib/aspera/keychain/base.rb +1 -1
  90. data/lib/aspera/keychain/encrypted_hash.rb +2 -2
  91. data/lib/aspera/keychain/factory.rb +4 -4
  92. data/lib/aspera/keychain/macos_security.rb +4 -4
  93. data/lib/aspera/link_header.rb +82 -0
  94. data/lib/aspera/log.rb +23 -5
  95. data/lib/aspera/markdown.rb +85 -2
  96. data/lib/aspera/nagios.rb +2 -2
  97. data/lib/aspera/node_simulator.rb +3 -1
  98. data/lib/aspera/oauth/base.rb +10 -10
  99. data/lib/aspera/oauth/boot.rb +43 -0
  100. data/lib/aspera/oauth/factory.rb +41 -15
  101. data/lib/aspera/oauth/jwt.rb +4 -4
  102. data/lib/aspera/oauth/web.rb +4 -4
  103. data/lib/aspera/oauth.rb +1 -0
  104. data/lib/aspera/persistency_action_once.rb +10 -10
  105. data/lib/aspera/persistency_folder.rb +10 -3
  106. data/lib/aspera/preview/file_types.rb +7 -3
  107. data/lib/aspera/preview/generator.rb +3 -3
  108. data/lib/aspera/preview/utils.rb +1 -1
  109. data/lib/aspera/products/connect.rb +4 -1
  110. data/lib/aspera/products/other.rb +1 -1
  111. data/lib/aspera/products/transferd.rb +3 -3
  112. data/lib/aspera/proxy_auto_config.rb +10 -9
  113. data/lib/aspera/rest.rb +18 -40
  114. data/lib/aspera/rest_error_analyzer.rb +7 -3
  115. data/lib/aspera/rest_errors_aspera.rb +0 -10
  116. data/lib/aspera/rest_list.rb +13 -6
  117. data/lib/aspera/schema/IBM Aspera Faspex API-5.0-enhanced.yaml +14 -4
  118. data/lib/aspera/schema/IBM Aspera on Cloud API-0.2.6-enhanced.yaml +2730 -648
  119. data/lib/aspera/schema/async_tables.yaml +361 -0
  120. data/lib/aspera/schema/documentation.rb +57 -26
  121. data/lib/aspera/schema/reader.rb +60 -11
  122. data/lib/aspera/schema/registry.rb +50 -10
  123. data/lib/aspera/secret_hider.rb +11 -2
  124. data/lib/aspera/ssl.rb +4 -4
  125. data/lib/aspera/sync/conf.schema.yaml +2 -2
  126. data/lib/aspera/sync/database.rb +14 -10
  127. data/lib/aspera/sync/operations.rb +15 -18
  128. data/lib/aspera/temp_file_manager.rb +5 -1
  129. data/lib/aspera/timer_limiter.rb +1 -1
  130. data/lib/aspera/transfer/faux_file.rb +24 -11
  131. data/lib/aspera/transfer/parameters.rb +27 -25
  132. data/lib/aspera/transfer/result.rb +74 -0
  133. data/lib/aspera/transfer/resumer.rb +7 -7
  134. data/lib/aspera/transfer/spec.rb +18 -1
  135. data/lib/aspera/transfer/spec.schema.yaml +26 -8
  136. data/lib/aspera/transfer/uri.rb +1 -1
  137. data/lib/aspera/uri_reader.rb +2 -2
  138. data/lib/aspera/web_auth.rb +2 -2
  139. data/lib/aspera/web_server_simple.rb +8 -5
  140. data/lib/aspera/yaml.rb +2 -1
  141. data.tar.gz.sig +0 -0
  142. metadata +45 -16
  143. metadata.gz.sig +0 -0
  144. data/lib/aspera/cli/main.rb +0 -480
  145. data/lib/aspera/json_rpc.rb +0 -51
data/CONTRIBUTING.md CHANGED
@@ -50,18 +50,110 @@ To submit a contribution, follow these steps:
50
50
  1. **Create a feature branch** specifically for your changes.
51
51
 
52
52
  1. **Implement** your feature or bug fix.
53
-
54
- 1. **Write tests** to ensure your changes are robust and prevent regressions.
55
-
56
- 1. **Run** `rubocop` to ensure your code adheres to the Ruby style guide.
57
-
58
- 1. **Update** `CHANGELOG.md` with a concise summary of your changes.
53
+ See [Development Cycle for a New CLI Command](#development-cycle-for-a-new-cli-command) for the complete checklist.
59
54
 
60
55
  1. **Submit a pull request** with a detailed description of your work.
61
56
 
62
57
  > [!TIP]
63
58
  > Keep pull requests focused; include only changes relevant to the specific feature or fix.
64
59
 
60
+ ### Development Cycle for a New CLI Command
61
+
62
+ When adding or modifying a CLI command, complete **every step** in the following order.
63
+ Each step is self-contained so that an automated agent can apply them independently.
64
+
65
+ #### 1 — Implement
66
+
67
+ - Add the command logic in the relevant plugin file under `lib/aspera/cli/plugins/`.
68
+ - If the command belongs to a mixin (e.g. `AscpActions`, `PresetActions`), add the method in the corresponding file under `lib/aspera/cli/`.
69
+ - Declare the new command with `command(...)` at class level and implement the corresponding `handle_<path>` method.
70
+ - For agent-related schemas, declare parameters in `lib/aspera/cli/options.schema.yaml` under `components/schemas/`.
71
+
72
+ #### 2 — Add tests in `tests/tests.yml`
73
+
74
+ Every new command needs at least one entry in `tests/tests.yml`.
75
+ Follow the naming convention `<plugin>_<sub>_<action>` (e.g. `conf_agents_list`).
76
+
77
+ - Add a **happy-path** test (no extra tags).
78
+ - Add a **failure test** for invalid input with tags `must_fail` and `nodoc`, and set `expect:` to a substring of the expected error message.
79
+ - Tests that should not appear in generated documentation get the `nodoc` tag.
80
+ - Insert the new entries near related tests (same plugin/sub-command group).
81
+
82
+ Minimal example:
83
+
84
+ ```yaml
85
+ conf_agents_list:
86
+ args:
87
+ - config
88
+ - agents
89
+ - list
90
+ conf_agents_show_bad:
91
+ tags:
92
+ - must_fail
93
+ - nodoc
94
+ expect: "unknown value"
95
+ args:
96
+ - config
97
+ - agents
98
+ - show
99
+ - badagent
100
+ ```
101
+
102
+ Run only the new tests to validate quickly:
103
+
104
+ ```shell
105
+ bundle exec rake test:run'[conf_agents_list conf_agents_show_bad]'
106
+ ```
107
+
108
+ #### 3 — Update `docs/README.erb.md`
109
+
110
+ `docs/README.erb.md` is the source for the generated documentation (`docs/README.md` and the PDF manual).
111
+ **Never edit `docs/README.md` directly.**
112
+
113
+ - Find the section closest to the new command (search for the parent command or a sibling).
114
+ - Add a short prose paragraph and one or more fenced `shell` blocks showing usage.
115
+ - Use ERB variables: `<%=cmd%>` for the tool name, `<%=tool%>` for the display name, `<%=ph :name%>` for placeholders.
116
+ - For parameter tables generated from JSON schema, use `<%=schema_to_table(Aspera::Schema::Registry::MY_SCHEMA_KEY)%>`.
117
+
118
+ Regenerate and verify:
119
+
120
+ ```shell
121
+ bundle exec rake doc:prep
122
+ ```
123
+
124
+ #### 4 — Update `CHANGELOG.md`
125
+
126
+ Add one bullet under `### New Features` (or `### Issues Fixed` / `### Breaking Changes`) in the current `.pre` section at the top of `CHANGELOG.md`.
127
+
128
+ Style rules:
129
+ - Plugin name in backticks: `` `config` ``, `` `aoc` ``, or `**global**` for cross-cutting changes.
130
+ - Command path and argument names in backticks.
131
+ - One sentence per bullet; end without a period.
132
+
133
+ Example:
134
+
135
+ ```markdown
136
+ * `config`: New commands `agents list`, `agents show <name>` and `agents parameters <name>` to discover available transfer agents, their short identifier and their configurable parameters
137
+ ```
138
+
139
+ #### 5 — Static analysis
140
+
141
+ ```shell
142
+ bundle exec rake tools:rubocop # Ruby style guide
143
+ bundle exec rake tools:reek # code smell detection
144
+ ```
145
+
146
+ Fix any new offence introduced by your changes before committing.
147
+ Pre-existing offences listed in `.rubocop_todo.yml` can be left as-is.
148
+
149
+ #### 6 — Full test suite
150
+
151
+ ```shell
152
+ bundle exec rake test:run
153
+ ```
154
+
155
+ All tests must pass (status `passed`) before opening a pull request.
156
+
65
157
  ## Architecture
66
158
 
67
159
  The `aspera-cli` architecture is designed to be modular and extensible.
@@ -72,7 +164,7 @@ The `aspera-cli` architecture is designed to be modular and extensible.
72
164
 
73
165
  - **Entry Point**:
74
166
 
75
- `lib/aspera/cli/main.rb` contains the core CLI startup logic.
167
+ `lib/aspera/cli/runner.rb` contains the core CLI startup logic.
76
168
 
77
169
  - **Plugins**:
78
170
 
@@ -112,15 +204,12 @@ The following environment variables and macros control specific build behaviors:
112
204
  | `LOG_SECRETS` | `yes`/`no` | Toggles the logging of secrets in `rake` tasks. |
113
205
  | `LOG_LEVEL` | `debug`, ... | Sets the logging verbosity for `rake` tasks. |
114
206
  | `ENABLE_COVERAGE` | set/unset | Enables test coverage analysis when defined. |
115
- | `SIGNING_KEY` | File path | Path to the signing key used for building the gem file. |
116
- | `SIGNING_KEY_PEM` | PEM Value | The PEM content of the signing key. |
207
+ | `SIGNING_KEY` | File path or PEM | Path to the signing key file, or PEM content (starts with `-----BEGIN`). |
117
208
  | `DRY_RUN` | `1` | Simulates execution without performing actual operations (`git`, `gh`). |
118
209
  | `DEBUG` | `1` | Shows stack trace on errors during documentation generation. |
119
210
 
120
211
  These values can be set as standard environment variables or passed directly to the `rake` command.
121
212
 
122
- Setting `SIGNING_KEY_PEM` automatically generates a file at `$HOME/.gem/signing_key.pem` and sets the `SIGNING_KEY` variable accordingly.
123
-
124
213
  > [!NOTE]
125
214
  > `ASPERA_CLI_TEST_CONF_URL` is typically defined in your shell profile for development, while others are usually for ad-hoc command-line use.
126
215
 
@@ -321,5 +410,4 @@ This triggers the `.github/workflows/deploy.yml` action to publish to RubyGems.
321
410
  - Evaluate replacing custom REST and OAuth implementations with standard gems:
322
411
  - [rest-client](https://github.com/rest-client/rest-client)
323
412
  - [oauth2](https://github.com/oauth-xx/oauth2)
324
- - Integrate `thor` <http://whatisthor.com/> or another standard Ruby CLI framework.
325
413
  - Explore [Traveling Ruby](https://github.com/phusion/traveling-ruby) for distribution, or [truby Traveling Ruby](https://github.com/trubygems/traveling-ruby).
data/bin/ascli CHANGED
@@ -20,9 +20,9 @@ Aspera::Log.instance.program_name = Aspera::Cli::Info::CMD_NAME
20
20
  ARGV.each do |arg|
21
21
  case arg
22
22
  when '--' then break
23
- when /^--log-level=(.*)/ then Aspera::Log.instance.level = Regexp.last_match(1).to_sym
24
- when /^--log-format=(.*)/ then Aspera::Log.instance.formatter = Regexp.last_match(1) unless Regexp.last_match(1).start_with?('@ruby:')
25
- when /^--logger=(.*)/ then Aspera::Log.instance.logger_type = Regexp.last_match(1).to_sym
23
+ when /^--log-level=(.*)/, /^--log\.level=(.*)/ then Aspera::Log.instance.level = Regexp.last_match(1).to_sym
24
+ when /^--log-format=(.*)/, /^--log\.format=(.*)/ then Aspera::Log.instance.formatter = Regexp.last_match(1) unless Regexp.last_match(1).start_with?('@ruby:')
25
+ when /^--logger=(.*)/, /^--log\.type=(.*)/ then Aspera::Log.instance.logger_type = Regexp.last_match(1).to_sym
26
26
  end
27
27
  rescue => e
28
28
  $stderr.puts("Error: #{e}") # rubocop:disable Style/StderrPuts
@@ -31,6 +31,6 @@ end
31
31
 
32
32
  require 'aspera/coverage'
33
33
  require 'aspera/environment'
34
- require 'aspera/cli/main'
34
+ require 'aspera/cli/runner'
35
35
  Aspera::Environment.instance.fix_home
36
- Aspera::Cli::Main.new(ARGV).process_command_line
36
+ Aspera::Cli::Runner.new(ARGV).run