Skip to content

feat(cli): alien operations publish/list custom plugin bundles (ALIEN-428) - #282

Closed
ab-alien-dev wants to merge 1 commit into
mainfrom
alan/alien-428-implement-alien-operations
Closed

feat(cli): alien operations publish/list custom plugin bundles (ALIEN-428)#282
ab-alien-dev wants to merge 1 commit into
mainfrom
alan/alien-428-implement-alien-operations

Conversation

@ab-alien-dev

Copy link
Copy Markdown
Contributor

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's metadata.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

  • Platform-gated (#[cfg(feature = "platform")]): talks to the platform API via the authenticated http client, exactly like alien managers.
  • Reads the ZIP with the zip crate and forwards the full metadata.json verbatim — the platform re-validates it authoritatively (the CLI doesn't depend on the private plugin crate, keeping the OSS boundary clean).
  • base64-inlines the bundle so there's no multipart handling.

Test plan

  • cargo test -p alien-cli --features platform operations::3 tests pass (reads metadata, rejects missing metadata.json, rejects metadata missing required fields)
  • cargo build -p alien-cli --features platform
  • alien operations --help renders the command group

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).
@ab-alien-dev

Copy link
Copy Markdown
Contributor Author

Reopening #281 on the same branch instead (per request).

@greptile-apps

greptile-apps Bot commented Aug 2, 2026

Copy link
Copy Markdown

Greptile Summary

Adds platform-gated CLI support for managing operations plugin bundles.

  • Adds alien operations publish to validate ZIP metadata and upload a base64-encoded bundle.
  • Adds alien operations list with human-readable and JSON output.
  • Registers the new command in CLI parsing, JSON-output routing, and dispatch.
  • Adds the ZIP workspace dependency and metadata-reading tests.

Confidence Score: 4/5

The 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

Important Files Changed

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
Loading

Fix All in Codex

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?;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 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.

Fix in Codex

Comment on lines +83 to +84
pub async fn operations_task(args: OperationsArgs, ctx: ExecutionMode) -> Result<()> {
let auth = ctx.auth_http().await?;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 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.

Fix in Codex

Comment on lines +179 to +181
let body: Value = response.json().await.unwrap_or(Value::Null);
if json {
println!("{}", serde_json::to_string_pretty(&body).unwrap_or_default());

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 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.

Fix in Codex

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant