feat(cli): alien operations publish/list custom plugin bundles (ALIEN-428) - #282
feat(cli): alien operations publish/list custom plugin bundles (ALIEN-428)#282ab-alien-dev wants to merge 1 commit into
Conversation
Operations plugins run inside a deployment via the commands interface (`plugin/operation`). This adds the customer-facing CLI to manage them: - `alien operations publish <bundle.zip>` — reads the bundle's metadata.json, validates it, and uploads the bundle to the platform (POST /v1/operations/plugins). - `alien operations list` — shows the catalog (builtin + custom). Platform-gated (talks to the platform API via the authenticated http client, like `alien managers`). Reads the ZIP with the `zip` crate; forwards the full metadata.json verbatim for the platform to re-validate. base64-inlines the bundle so no multipart handling is needed. Tests: 3 (reads metadata, rejects missing metadata.json, rejects bad metadata).
|
Reopening #281 on the same branch instead (per request). |
Greptile SummaryAdds platform-gated CLI support for managing operations plugin bundles.
Confidence Score: 4/5The PR should not merge until operations commands work with workspace-scoped API keys, reject standalone routing, and propagate invalid API responses. The new command fails before making requests for API-key-authenticated platform users, can route platform requests to a standalone manager, and can report successful but fabricated output when response decoding fails. Files Needing Attention: crates/alien-cli/src/commands/operations.rs and crates/alien-cli/src/lib.rs
|
| Filename | Overview |
|---|---|
| crates/alien-cli/src/commands/operations.rs | Implements the new API flows, but workspace resolution blocks API-key users, standalone mode targets the wrong service, and response decoding errors are silently hidden. |
| crates/alien-cli/src/lib.rs | Correctly registers JSON routing and dispatch, but does not prevent the platform-only command from running in standalone mode. |
| crates/alien-cli/src/commands/mod.rs | Correctly exposes the operations module only with the platform feature. |
| crates/alien-cli/Cargo.toml | Adds the workspace ZIP dependency used for bundle metadata extraction. |
| Cargo.toml | Declares the ZIP dependency centrally with only deflate support enabled. |
Sequence Diagram
sequenceDiagram
participant User
participant CLI as alien operations
participant Context as ExecutionMode
participant API as Platform API
User->>CLI: publish bundle.zip / list
CLI->>Context: resolve auth and workspace
Context-->>CLI: AuthHttp + workspace
alt publish
CLI->>CLI: Read ZIP and metadata.json
CLI->>API: POST /v1/operations/plugins
else list
CLI->>API: GET /v1/operations/plugins
end
API-->>CLI: JSON response
CLI-->>User: JSON or human-readable output
Prompt To Fix All With AI
### Issue 1
crates/alien-cli/src/commands/operations.rs:84
**API keys fail workspace resolution**
When `--api-key` or `ALIEN_API_KEY` is used, `operations_task` unconditionally calls `resolve_workspace_with_bootstrap`, which rejects platform API keys because they are already workspace-scoped. Both operations commands therefore exit before sending a request.
### Issue 2
crates/alien-cli/src/commands/operations.rs:83-84
**Standalone mode targets manager API**
When `ALIEN_MANAGER_URL` is set, `run_cli` passes a standalone context whose authenticated base URL is the manager to this platform-only command. Publish and list then send `/v1/operations/plugins?workspace=default` to the standalone manager instead of the platform API, causing the commands to fail.
### Issue 3
crates/alien-cli/src/commands/operations.rs:179-181
**JSON decoding failures look successful**
When the platform returns a successful status with an empty, malformed, or unexpectedly shaped JSON body, `unwrap_or(Value::Null)` discards the decoding error. List then reports that no plugins are available, while publish JSON output prints `null` and exits successfully, misleading users and automation.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Reviews (1): Last reviewed commit: "feat(cli): add `alien operations` to pub..." | Re-trigger Greptile
| } | ||
|
|
||
| pub async fn operations_task(args: OperationsArgs, ctx: ExecutionMode) -> Result<()> { | ||
| let auth = ctx.auth_http().await?; |
There was a problem hiding this comment.
API keys fail workspace resolution
When --api-key or ALIEN_API_KEY is used, operations_task unconditionally calls resolve_workspace_with_bootstrap, which rejects platform API keys because they are already workspace-scoped. Both operations commands therefore exit before sending a request.
Knowledge Base Used: Developer CLI and Deploy CLI
Prompt To Fix With AI
This is a comment left during a code review.
Path: crates/alien-cli/src/commands/operations.rs
Line: 84
Comment:
**API keys fail workspace resolution**
When `--api-key` or `ALIEN_API_KEY` is used, `operations_task` unconditionally calls `resolve_workspace_with_bootstrap`, which rejects platform API keys because they are already workspace-scoped. Both operations commands therefore exit before sending a request.
**Knowledge Base Used:** [Developer CLI and Deploy CLI](https://app.greptile.com/alien/-/custom-context/knowledge-base/alienplatform/alien/-/docs/developer-cli.md)
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| pub async fn operations_task(args: OperationsArgs, ctx: ExecutionMode) -> Result<()> { | ||
| let auth = ctx.auth_http().await?; |
There was a problem hiding this comment.
Standalone mode targets manager API
When ALIEN_MANAGER_URL is set, run_cli passes a standalone context whose authenticated base URL is the manager to this platform-only command. Publish and list then send /v1/operations/plugins?workspace=default to the standalone manager instead of the platform API, causing the commands to fail.
Knowledge Base Used: Developer CLI and Deploy CLI
Prompt To Fix With AI
This is a comment left during a code review.
Path: crates/alien-cli/src/commands/operations.rs
Line: 83-84
Comment:
**Standalone mode targets manager API**
When `ALIEN_MANAGER_URL` is set, `run_cli` passes a standalone context whose authenticated base URL is the manager to this platform-only command. Publish and list then send `/v1/operations/plugins?workspace=default` to the standalone manager instead of the platform API, causing the commands to fail.
**Knowledge Base Used:** [Developer CLI and Deploy CLI](https://app.greptile.com/alien/-/custom-context/knowledge-base/alienplatform/alien/-/docs/developer-cli.md)
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| let body: Value = response.json().await.unwrap_or(Value::Null); | ||
| if json { | ||
| println!("{}", serde_json::to_string_pretty(&body).unwrap_or_default()); |
There was a problem hiding this comment.
JSON decoding failures look successful
When the platform returns a successful status with an empty, malformed, or unexpectedly shaped JSON body, unwrap_or(Value::Null) discards the decoding error. List then reports that no plugins are available, while publish JSON output prints null and exits successfully, misleading users and automation.
Knowledge Base Used: Developer CLI and Deploy CLI
Prompt To Fix With AI
This is a comment left during a code review.
Path: crates/alien-cli/src/commands/operations.rs
Line: 179-181
Comment:
**JSON decoding failures look successful**
When the platform returns a successful status with an empty, malformed, or unexpectedly shaped JSON body, `unwrap_or(Value::Null)` discards the decoding error. List then reports that no plugins are available, while publish JSON output prints `null` and exits successfully, misleading users and automation.
**Knowledge Base Used:** [Developer CLI and Deploy CLI](https://app.greptile.com/alien/-/custom-context/knowledge-base/alienplatform/alien/-/docs/developer-cli.md)
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
What
Adds the customer-facing CLI to manage operations plugins. Operations plugins run inside a deployment via the commands interface (
plugin/operation); this lets a customer publish a custom plugin bundle so its operations become available in their workspace.Commands
alien operations publish <bundle.zip>— reads the bundle'smetadata.json, validates it (name/version present, valid ZIP), and uploads the bundle to the platform (POST /v1/operations/plugins).alien operations list— shows the catalog (builtin + custom).Notes
#[cfg(feature = "platform")]): talks to the platform API via the authenticated http client, exactly likealien managers.zipcrate and forwards the fullmetadata.jsonverbatim — the platform re-validates it authoritatively (the CLI doesn't depend on the private plugin crate, keeping the OSS boundary clean).Test plan
cargo test -p alien-cli --features platform operations::— 3 tests pass (reads metadata, rejects missingmetadata.json, rejects metadata missing required fields)cargo build -p alien-cli --features platformalien operations --helprenders the command group