Skip to content

feat(cli): align automations + tasks commands with SDK and MCP-v2#3966

Merged
saddlepaddle merged 2 commits intomainfrom
align-sdk-cli-mcp-both-in-code-2026-05-01-22-44-28
May 1, 2026
Merged

feat(cli): align automations + tasks commands with SDK and MCP-v2#3966
saddlepaddle merged 2 commits intomainfrom
align-sdk-cli-mcp-both-in-code-2026-05-01-22-44-28

Conversation

@saddlepaddle
Copy link
Copy Markdown
Collaborator

@saddlepaddle saddlepaddle commented May 1, 2026

Summary

Audited the CLI, SDK, and MCP-v2 surfaces for automations / tasks / workspaces / hosts / projects and brought the CLI back into sync with what the SDK and MCP-v2 already expose. Four real misalignments — all in CLI:

  • superset automations logs <id> was missing. SDK already had automations.logs() and MCP-v2 already had automations_logs, both wrapping automation.listRuns. New command added at packages/cli/src/commands/automations/logs/command.ts. Required a .gitignore exception so the new logs/ directory isn't swallowed by the generic logs rule at the top of the file.
  • automations create required --project at runtime even though the API schema (and SDK / MCP-v2) accepts v2ProjectId OR v2WorkspaceId. Now accepts either; errors only when both are missing.
  • automations update didn't expose --project, --workspace, or --mcp-scope even though the underlying automation.update schema accepts all three (and SDK / MCP-v2 already pass them through). Added the flags; partial-update semantics preserved (omitting a flag leaves the field unchanged).
  • tasks update was missing --status-id, --pr-url, --estimate, --due-date, --labels. tasks create already had most of these, so the create/update flag surface was asymmetric. SDK and MCP-v2 expose the full set; CLI now does too.

Surfaces I checked and found already aligned: tasks list/get/create/delete, automations list/get/delete/pause/resume/run/getPrompt/setPrompt, hosts list, projects list, workspaces list/create/delete. The legacy packages/mcp (mounted at /api/agent/[transport]) is a separate older domain (devices/organizations/tasks) and out of scope; packages/desktop-mcp is a different domain entirely (DOM/browser control).

Test plan

  • bun run typecheck --filter=@superset/cli clean
  • bun run typecheck --filter=@superset/sdk --filter=@superset/mcp-v2 clean (no transitive breakage)
  • bun run lint:fix clean
  • Run superset automations logs <id> against a real automation and confirm table output
  • Run superset automations create --workspace <ws> (no --project) and confirm it succeeds
  • Run superset tasks update <slug> --status-id <id> --labels foo,bar --estimate 3 and confirm the patch applies

Summary by cubic

Aligns the superset CLI with @superset/sdk and @superset/mcp-v2 for automations and tasks. Adds automation run logs, completes update flags, and fixes create to accept workspace IDs.

  • New Features

    • Add superset automations logs <id> to list recent runs (supports --limit).
    • tasks update now supports --status-id, --pr-url, --estimate, --due-date (ISO), and --labels.
  • Bug Fixes

    • automations create now accepts --project or --workspace (either).
    • automations update exposes --project, --workspace, and --mcp-scope.
    • Use undefined (not null) for optional v2ProjectId/v2WorkspaceId on create to match schema expectations.

Written for commit 924c445. Summary will update on new commits.

Summary by CodeRabbit

  • New Features

    • Added automation logs command to display recent automation runs with run ID, status, scheduled/dispatched times, and host.
    • Added task update options: status ID, PR URL, estimate, due date, and labels.
  • Enhancements

    • Automation create command now accepts either --project or --workspace (requires at least one).
    • Automation update command now supports --project, --workspace, and --mcpScope options.

- Add 'superset automations logs <id>' (already in SDK as logs() and
  MCP-v2 as automations_logs).
- Drop the runtime-only "--project required" guard on
  'automations create'; accept --project or --workspace, matching the
  API schema and the other surfaces.
- Expose --project, --workspace, --mcp-scope on 'automations update'.
- Expose --status-id, --pr-url, --estimate, --due-date, --labels on
  'tasks update'; create already had them.
- Whitelist packages/cli/src/commands/automations/logs in .gitignore so
  the new directory isn't swallowed by the generic 'logs' rule.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 1, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: cf4e3534-bfb1-49af-a954-fac65ee8df3c

📥 Commits

Reviewing files that changed from the base of the PR and between d29c87f and 924c445.

📒 Files selected for processing (1)
  • packages/cli/src/commands/automations/create/command.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/cli/src/commands/automations/create/command.ts

📝 Walkthrough

Walkthrough

Adds a new "automation logs" CLI command, expands automation create/update commands to accept v2 scoping options, extends task update options with date/label parsing, and updates .gitignore to unignore the new logs command directory.

Changes

Cohort / File(s) Summary
Gitignore Configuration
\.gitignore
Added negation to explicitly unignore packages/cli/src/commands/automations/logs.
Automation CLI
packages/cli/src/commands/automations/create/command.ts, packages/cli/src/commands/automations/update/command.ts, packages/cli/src/commands/automations/logs/command.ts
Create: require at least one of --project or --workspace and conditionally set v2ProjectId/v2WorkspaceId. Update: add --project, --workspace, --mcpScope (comma-separated -> array) and conditionally map into payload. Logs: new command listing recent runs (id positional, --limit), calls ctx.api.automation.listRuns.query, formats dates and host, outputs table with headers RUN ID/STATUS/SCHEDULED/DISPATCHED/HOST.
Task CLI
packages/cli/src/commands/tasks/update/command.ts
Adds statusId, prUrl, estimate, dueDate, labels options. Parses ISO 8601 --due-date (errors on invalid) and splits --labels comma list; conditionally includes parsed values in update payload.

Sequence Diagram(s)

sequenceDiagram
participant CLI as CLI
participant Context as ctx (runtime)
participant API as Automation API
participant Formatter as Table Formatter

CLI->>Context: invoke `automations logs` (id, limit)
Context->>API: listRuns.query({automationId, limit})
API-->>Context: runs[]
Context->>Formatter: map runs -> table rows (format dates, host fallback)
Formatter-->>CLI: render table with headers RUN ID / STATUS / SCHEDULED / DISPATCHED / HOST
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~32 minutes

Poem

I hopped into the CLI with cheer,
New logs and options now appear,
Dates parsed, labels split with care,
Automation runs displayed to share,
A rabbit's clap — the changes near! 🐇✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: aligning CLI commands for automations and tasks with SDK and MCP-v2.
Description check ✅ Passed The description covers all template sections with comprehensive details on changes, test plan, and related context about SDK/MCP-v2 alignment.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch align-sdk-cli-mcp-both-in-code-2026-05-01-22-44-28

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 4/8 reviews remaining, refill in 24 minutes and 25 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 1, 2026

Greptile Summary

This PR closes four CLI gaps identified by auditing the CLI against the SDK and MCP-v2 surfaces: adds the missing automations logs <id> subcommand, relaxes automations create to accept --workspace as an alternative to --project, adds --project/--workspace/--mcp-scope to automations update, and brings tasks update to flag-parity with tasks create. All changes follow established command patterns in the codebase.

Confidence Score: 4/5

Safe to merge; only P2 concerns around null/undefined asymmetry and a silent empty-scope edge case.

No P0 or P1 issues found. Two P2 findings: an asymmetric null vs undefined fallback in automations create that could send an unintended explicit null to the API, and an --mcp-scope "" edge case in automations update that silently clears all scopes. Both are low-risk but worth addressing.

packages/cli/src/commands/automations/create/command.ts (null/undefined asymmetry) and packages/cli/src/commands/automations/update/command.ts (empty mcp-scope handling)

Important Files Changed

Filename Overview
.gitignore Adds a negation rule to allow the new packages/cli/src/commands/automations/logs directory, which would otherwise be swallowed by the top-level logs ignore rule.
packages/cli/src/commands/automations/create/command.ts Relaxes --project from required to optional and accepts --workspace as an alternative; minor asymmetry between null and undefined fallbacks for the two ID fields.
packages/cli/src/commands/automations/logs/command.ts New command wiring automation.listRuns into the CLI; follows existing list command patterns correctly including the display casting style.
packages/cli/src/commands/automations/update/command.ts Adds --project, --workspace, and --mcp-scope flags; --mcp-scope "" can silently produce an empty array and clear all scopes without warning.
packages/cli/src/commands/tasks/update/command.ts Adds --status-id, --pr-url, --estimate, --due-date, and --labels flags, bringing update parity with create; date validation and label splitting follow the same logic as tasks create.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[superset automations] --> B[create]
    A --> C[update]
    A --> D[logs NEW]
    A --> E[list / get / delete / pause / resume / run / prompt]

    B --> B1{--project OR --workspace?}
    B1 -- neither --> B2[Error: Provide --project or --workspace]
    B1 -- one or both --> B3[automation.create.mutate]

    C --> C1[--enabled? setEnabled.mutate]
    C1 --> C2[automation.update.mutate]
    C2 --> C3[+--project +--workspace +--mcp-scope NEW]

    D --> D1[automation.listRuns.query]
    D1 --> D2[table: id / status / scheduledFor / dispatchedAt / host]

    F[superset tasks update] --> G[task.byIdOrSlug.query]
    G --> H[task.update.mutate]
    H --> I[+statusId +prUrl +estimate +dueDate +labels NEW]
Loading
Prompt To Fix All With AI
Fix the following 2 code review issues. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 2
packages/cli/src/commands/automations/create/command.ts:91-92
**Asymmetric null vs undefined fallbacks for project/workspace**

`v2ProjectId` falls back to `undefined` (field omitted from payload) while `v2WorkspaceId` falls back to `null` (field explicitly sent as `null`). When the user passes only `--project`, `v2WorkspaceId: null` is always included in the mutation payload. Whether this intentionally clears any pre-existing workspace association on the server depends on how the API schema handles a `null` vs absent field — if `null` is treated as "clear this field", the behaviour is asymmetric and potentially surprising.

```suggestion
			v2ProjectId: options.project ?? undefined,
			v2WorkspaceId: options.workspace ?? undefined,
```

### Issue 2 of 2
packages/cli/src/commands/automations/update/command.ts:75-81
**Empty `--mcp-scope` silently clears all scopes**

If a user passes `--mcp-scope ""` or `--mcp-scope " "`, the split-trim-filter chain produces `[]`, and `mcpScope: []` is then spread into the mutation — clearing every scope on the automation. A guard that rejects an all-whitespace value would make the intent explicit and prevent accidental scope-clearing.

Reviews (1): Last reviewed commit: "feat(cli): align automations + tasks com..." | Re-trigger Greptile

Comment on lines 91 to 92
v2ProjectId: options.project ?? undefined,
v2WorkspaceId: options.workspace ?? null,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Asymmetric null vs undefined fallbacks for project/workspace

v2ProjectId falls back to undefined (field omitted from payload) while v2WorkspaceId falls back to null (field explicitly sent as null). When the user passes only --project, v2WorkspaceId: null is always included in the mutation payload. Whether this intentionally clears any pre-existing workspace association on the server depends on how the API schema handles a null vs absent field — if null is treated as "clear this field", the behaviour is asymmetric and potentially surprising.

Suggested change
v2ProjectId: options.project ?? undefined,
v2WorkspaceId: options.workspace ?? null,
v2ProjectId: options.project ?? undefined,
v2WorkspaceId: options.workspace ?? undefined,
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/cli/src/commands/automations/create/command.ts
Line: 91-92

Comment:
**Asymmetric null vs undefined fallbacks for project/workspace**

`v2ProjectId` falls back to `undefined` (field omitted from payload) while `v2WorkspaceId` falls back to `null` (field explicitly sent as `null`). When the user passes only `--project`, `v2WorkspaceId: null` is always included in the mutation payload. Whether this intentionally clears any pre-existing workspace association on the server depends on how the API schema handles a `null` vs absent field — if `null` is treated as "clear this field", the behaviour is asymmetric and potentially surprising.

```suggestion
			v2ProjectId: options.project ?? undefined,
			v2WorkspaceId: options.workspace ?? undefined,
```

How can I resolve this? If you propose a fix, please make it concise.

Comment on lines +75 to +81
const mcpScope =
options.mcpScope !== undefined
? options.mcpScope
.split(",")
.map((s) => s.trim())
.filter(Boolean)
: undefined;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Empty --mcp-scope silently clears all scopes

If a user passes --mcp-scope "" or --mcp-scope " ", the split-trim-filter chain produces [], and mcpScope: [] is then spread into the mutation — clearing every scope on the automation. A guard that rejects an all-whitespace value would make the intent explicit and prevent accidental scope-clearing.

Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/cli/src/commands/automations/update/command.ts
Line: 75-81

Comment:
**Empty `--mcp-scope` silently clears all scopes**

If a user passes `--mcp-scope ""` or `--mcp-scope " "`, the split-trim-filter chain produces `[]`, and `mcpScope: []` is then spread into the mutation — clearing every scope on the automation. A guard that rejects an all-whitespace value would make the intent explicit and prevent accidental scope-clearing.

How can I resolve this? If you propose a fix, please make it concise.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 1, 2026

🧹 Preview Cleanup Complete

The following preview resources have been cleaned up:

  • ✅ Neon database branch

Thank you for your contribution! 🎉

Previously v2WorkspaceId fell back to null while v2ProjectId fell back
to undefined; with the schema treating both as nullish/optional this
just sent an unnecessary explicit null. Use undefined for both.
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 5 files

@saddlepaddle saddlepaddle merged commit 3a41cc6 into main May 1, 2026
15 checks passed
saddlepaddle added a commit that referenced this pull request May 2, 2026
Bundles the 5 feat(cli) commits since v0.2.2:
- automations + tasks alignment with SDK and MCP-v2 (#3966)
- cross-device login via OAuth code + PKCE (#3965)
- 'automations prompt' split into 'prompt get' / 'prompt set' (#3959)
- --name filter on automations list (#3952)
- --assignee filter on tasks list (#3972)

Push cli-v0.2.3 after this lands to fire the release pipeline.
@Kitenite Kitenite deleted the align-sdk-cli-mcp-both-in-code-2026-05-01-22-44-28 branch May 6, 2026 04:51
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