feat(cli): split 'automations prompt' into 'prompt get' and 'prompt set'#3959
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughPrompt handling split into dedicated Changes
Sequence Diagram(s)sequenceDiagram
participant CLI
participant Tools as MCPv2_Tools
participant API as Server_API
participant DB
CLI->>API: automations prompt get <id>
API->>DB: SELECT automation summary (or full for prompt endpoint)
DB-->>API: row (prompt only for getPrompt)
API-->>CLI: structured { id, prompt } or raw prompt output
CLI->>API: automations prompt set <id> (file or stdin)
API->>DB: UPDATE automation.prompt
DB-->>API: updated full automation row
API-->>CLI: { id, name, length, message }
CLI->>Tools: automations/get or automations/list
Tools->>API: caller.automation.get/list()
API-->>Tools: returns summary (list/get) or full (getPrompt/setPrompt) depending on endpoint
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Review rate limit: 6/8 reviews remaining, refill in 8 minutes and 17 seconds.Comment |
Greptile SummaryThis PR replaces the single mixed
Confidence Score: 5/5Safe to merge — all remaining findings are P2 style/robustness suggestions with no impact on the primary use cases. The refactoring is clean and correct. The packages/cli/src/commands/automations/prompt/get/command.ts — the
|
| Filename | Overview |
|---|---|
| packages/cli/src/commands/automations/prompt/get/command.ts | New prompt get subcommand — writes raw prompt to stdout by default; falls back to structured { id, prompt } under --json/agent mode; --quiet silently discards the prompt content and returns only the ID. |
| packages/cli/src/commands/automations/prompt/set/command.ts | New prompt set subcommand — --from-file is required (enforced by framework); handles - for stdin; guards against empty prompts; clean separation from the read path. |
| packages/cli/src/commands/automations/prompt/command.ts | Old mixed read/write command deleted; prompt is now a group node backed by the new meta.ts, get/command.ts, and set/command.ts. |
| packages/cli/src/commands/automations/prompt/meta.ts | New group descriptor for automations prompt — provides the description shown in --help for the intermediate node. |
| packages/cli/src/commands/automations/get/command.ts | Comment updated to reference prompt get instead of the old prompt <id> command path; no functional changes. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["superset automations prompt …"] --> B{subcommand}
B -->|get <id>| C[fetch getPrompt API]
B -->|set <id> --from-file <path>| D{source}
B -->|"(anything else)"| E["CLIError: Unknown command\n(suggests get / set)"]
C --> F{output mode?}
F -->|"--json / agent mode"| G["return { data: { id, prompt } }\n→ framework renders JSON"]
F -->|"--quiet"| H["return { data: { id, prompt } }\n→ extractIds → prints ID only\n⚠ prompt silently dropped"]
F -->|default| I["process.stdout.write(prompt)\nno trailing newline"]
D -->|"path"| J["readFileSync(path, utf-8)"]
D -->|"-"| K["readStdin()"]
J --> L{empty after trim?}
K --> L
L -->|yes| M["throw: Refusing to write an empty prompt"]
L -->|no| N["setPrompt API → return metadata"]
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/prompt/get/command.ts:11-16
**`--quiet` silently drops the prompt**
When `--quiet` is passed, `wantsStructured` becomes `true` and the command returns `{ data: { id, prompt } }`. The framework's `extractIds` then strips everything except the `id` field, so `prompt get <id> --quiet` outputs only the UUID — the prompt content is silently discarded. A user expecting `--quiet` to give them a script-friendly version of the prompt will get nothing useful.
Consider either: (a) not entering the `wantsStructured` branch for `--quiet` so the raw bytes still go to stdout, or (b) adding a `display` function that returns `prompt` directly so the quiet path at least provides the content.
### Issue 2 of 2
packages/cli/src/commands/automations/prompt/get/command.ts:10-13
**`!== undefined` is fragile for boolean flags**
Boolean global flags are `true` when supplied and `undefined` when absent — never `false`. So `globals.json !== undefined` works today, but `globals.json === true` (and the same for `quiet`) more clearly expresses the intent and is immune to any future framework change that initialises globals with a default `false`.
```suggestion
const wantsStructured =
globals.json === true ||
globals.quiet === true ||
isAgentMode();
```
Reviews (1): Last reviewed commit: "feat(cli): split 'automations prompt' in..." | Re-trigger Greptile
| const wantsStructured = | ||
| globals.json !== undefined || | ||
| globals.quiet !== undefined || | ||
| isAgentMode(); | ||
| if (wantsStructured) { | ||
| return { data: { id, prompt } }; |
There was a problem hiding this comment.
--quiet silently drops the prompt
When --quiet is passed, wantsStructured becomes true and the command returns { data: { id, prompt } }. The framework's extractIds then strips everything except the id field, so prompt get <id> --quiet outputs only the UUID — the prompt content is silently discarded. A user expecting --quiet to give them a script-friendly version of the prompt will get nothing useful.
Consider either: (a) not entering the wantsStructured branch for --quiet so the raw bytes still go to stdout, or (b) adding a display function that returns prompt directly so the quiet path at least provides the content.
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/cli/src/commands/automations/prompt/get/command.ts
Line: 11-16
Comment:
**`--quiet` silently drops the prompt**
When `--quiet` is passed, `wantsStructured` becomes `true` and the command returns `{ data: { id, prompt } }`. The framework's `extractIds` then strips everything except the `id` field, so `prompt get <id> --quiet` outputs only the UUID — the prompt content is silently discarded. A user expecting `--quiet` to give them a script-friendly version of the prompt will get nothing useful.
Consider either: (a) not entering the `wantsStructured` branch for `--quiet` so the raw bytes still go to stdout, or (b) adding a `display` function that returns `prompt` directly so the quiet path at least provides the content.
How can I resolve this? If you propose a fix, please make it concise.| const globals = options as Record<string, unknown>; | ||
| const wantsStructured = | ||
| globals.json !== undefined || | ||
| globals.quiet !== undefined || |
There was a problem hiding this comment.
!== undefined is fragile for boolean flags
Boolean global flags are true when supplied and undefined when absent — never false. So globals.json !== undefined works today, but globals.json === true (and the same for quiet) more clearly expresses the intent and is immune to any future framework change that initialises globals with a default false.
| const globals = options as Record<string, unknown>; | |
| const wantsStructured = | |
| globals.json !== undefined || | |
| globals.quiet !== undefined || | |
| const wantsStructured = | |
| globals.json === true || | |
| globals.quiet === true || | |
| isAgentMode(); |
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/cli/src/commands/automations/prompt/get/command.ts
Line: 10-13
Comment:
**`!== undefined` is fragile for boolean flags**
Boolean global flags are `true` when supplied and `undefined` when absent — never `false`. So `globals.json !== undefined` works today, but `globals.json === true` (and the same for `quiet`) more clearly expresses the intent and is immune to any future framework change that initialises globals with a default `false`.
```suggestion
const wantsStructured =
globals.json === true ||
globals.quiet === true ||
isAgentMode();
```
How can I resolve this? If you propose a fix, please make it concise.
🚀 Preview Deployment🔗 Preview Links
Preview updates automatically with new commits |
There was a problem hiding this comment.
2 issues found across 5 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/cli/src/commands/automations/prompt/get/command.ts">
<violation number="1" location="packages/cli/src/commands/automations/prompt/get/command.ts:11">
P2: `wantsStructured` treats `--json false`/`--quiet false` as enabled because it checks for option presence, not truthy value. This can force structured/JSON output when raw prompt output was explicitly requested by passing false.</violation>
<violation number="2" location="packages/cli/src/commands/automations/prompt/get/command.ts:13">
P2: Including `--quiet` in the structured-output branch causes the prompt body to be discarded in quiet mode. `prompt get` should still emit prompt content for scripting; otherwise `--quiet` returns only the ID and breaks prompt retrieval.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/trpc/src/router/automation/automation.ts (1)
166-175:⚠️ Potential issue | 🟠 Major
db.select()fetches the fullpromptcolumn on everylistcall, then immediately discards it.Because
promptcan be an arbitrarily large Markdown body, this silently transfers that data from the DB → application on every list request only to drop it at the JS layer. Now that the tRPC layer is the authoritative owner of the "no prompt in list/get" contract, push the exclusion down to the query itself.Drizzle 0.45.2 supports column exclusion via
getTableColumns:const { content, ...rest } = getTableColumns(posts); await db.select({ ...rest }).from(posts);— use the same pattern here:⚡ Proposed fix for `list`
-import { and, desc, eq } from "drizzle-orm"; +import { and, desc, eq, getTableColumns } from "drizzle-orm";+ const { prompt: _omit, ...automationCols } = getTableColumns(automations); const rows = await db - .select() + .select(automationCols) .from(automations) .where(eq(automations.organizationId, organizationId)) .orderBy(desc(automations.createdAt)); - return rows.map(({ prompt: _prompt, ...row }) => ({ - ...row, + return rows.map((row) => ({ + ...row, scheduleText: safeDescribeRrule(row), }));The
getendpoint has the same issue viagetAutomationForUser(line 137), but since that helper is also called byrunNow(which needspromptfor dispatch), fixinggetcleanly requires a separate helper or an overload — treat that as a follow-up.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/trpc/src/router/automation/automation.ts` around lines 166 - 175, The query in list currently selects all columns (including the large prompt) and then discards prompt in JS; change the DB query to exclude prompt using Drizzle's getTableColumns pattern so we never fetch it: import/getTableColumns for the automations table, destructure to remove prompt (e.g., const { prompt, ...rest } = getTableColumns(automations)) and use await db.select({ ...rest }).from(automations).where(eq(automations.organizationId, organizationId)).orderBy(desc(automations.createdAt)); keep the downstream mapping that sets scheduleText via safeDescribeRrule; note getAutomationForUser/runNow need separate handling later and should not be changed in this PR.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@packages/trpc/src/router/automation/automation.ts`:
- Around line 166-175: The query in list currently selects all columns
(including the large prompt) and then discards prompt in JS; change the DB query
to exclude prompt using Drizzle's getTableColumns pattern so we never fetch it:
import/getTableColumns for the automations table, destructure to remove prompt
(e.g., const { prompt, ...rest } = getTableColumns(automations)) and use await
db.select({ ...rest }).from(automations).where(eq(automations.organizationId,
organizationId)).orderBy(desc(automations.createdAt)); keep the downstream
mapping that sets scheduleText via safeDescribeRrule; note
getAutomationForUser/runNow need separate handling later and should not be
changed in this PR.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: f83ba006-487a-4213-958b-c26f25c81b38
📒 Files selected for processing (4)
packages/cli/src/commands/automations/get/command.tspackages/mcp-v2/src/tools/automations/get.tspackages/mcp-v2/src/tools/automations/list.tspackages/trpc/src/router/automation/automation.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- packages/cli/src/commands/automations/get/command.ts
There was a problem hiding this comment.
2 issues found across 4 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/trpc/src/router/automation/automation.ts">
<violation number="1" location="packages/trpc/src/router/automation/automation.ts:172">
P2: `list` strips `prompt` after fetching it, so large prompt bodies are still read from the database for every automation.</violation>
<violation number="2" location="packages/trpc/src/router/automation/automation.ts:192">
P2: `get` removes `prompt` only after loading the full row, so metadata reads still fetch the large prompt field.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
The mixed read/write `automations prompt <id>` command was a footgun — without `--from-file` it tried to read from stdin and bailed on EOF, so stdout redirects produced empty files and there was no scriptable read path. Split into explicit subcommands: - `automations prompt get <id>` writes the prompt to stdout (no trailing newline added) so `get | diff -` and `get > file.md` round-trip cleanly. - `automations prompt set <id> --from-file <path>` replaces the prompt; `--from-file -` reads from stdin.
Both the CLI and the MCP `automations_get`/`automations_list` tools were stripping the `prompt` field client-side after fetching the full row. Move that to the tRPC procedures themselves so every caller gets the lean metadata shape by default and `getPrompt` is the single canonical read path for the (potentially large) prompt body.
`automation.list` and `automation.get` now omit the prompt body server-side (see preceding commit). Mirror that in the SDK so the static types match the wire shape: `list()` and `retrieve()` return `AutomationSummary` (no prompt), while mutations that return the full row keep returning `Automation`. Also point `getPrompt`/`setPrompt` JSDoc at the new CLI commands (`automations prompt get` / `automations prompt set`).
cd5c657 to
5a95661
Compare
…ling + docs - tRPC: project columns at the SQL level for `list` and `get` so the prompt body isn't shipped from the database for metadata reads (previously SELECT * + JS strip). - CLI: drop `--quiet` from the `prompt get` structured branch — quiet would have routed through `extractIds` and dropped the prompt body, leaving the caller with only the UUID they passed in. Also tighten `globals.json !== undefined` to `=== true` so `--no-json` doesn't accidentally trigger structured output. - Docs: split the CLI reference into `automations prompt get` / `automations prompt set` blocks; note `AutomationSummary` (no prompt) in the SDK reference.
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/cli/src/commands/automations/prompt/get/command.ts`:
- Around line 11-14: The wantsStructured boolean is incorrectly computed with
`globals.json !== undefined` and `globals.quiet !== undefined` which are always
true because the framework supplies booleans; update the check in the
wantsStructured calculation to test truthiness of those flags (e.g., use
`globals.json || globals.quiet || isAgentMode()` or explicit equality to true)
so the raw stdout branch in the prompt get command (where the file is written to
stdout) remains reachable; change the expression that sets wantsStructured
(referencing wantsStructured, globals.json, globals.quiet, and isAgentMode())
accordingly.
In `@packages/sdk/src/resources/automations.ts`:
- Around line 26-35: The SDK's retrieve and list methods
(AutomationResource.retrieve and AutomationResource.list) now return responses
that omit the prompt field because the underlying tRPC handlers
("automation.get" / "automation.list") no longer include it; update the release
artifacts: add a changelog entry and semver-major bump (or explicit migration
note) explaining the breaking change and point consumers to
automations.getPrompt(id) for prompt data, and also update the TypeScript
docs/comments for retrieve and list to reflect that prompt is no longer returned
so callers know to call getPrompt instead.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: c3e1b9a7-a36a-4d05-a002-f9f51a97d51e
📒 Files selected for processing (12)
packages/cli/src/commands/automations/get/command.tspackages/cli/src/commands/automations/prompt/command.tspackages/cli/src/commands/automations/prompt/get/command.tspackages/cli/src/commands/automations/prompt/meta.tspackages/cli/src/commands/automations/prompt/set/command.tspackages/mcp-v2/src/tools/automations/get.tspackages/mcp-v2/src/tools/automations/list.tspackages/sdk/src/client.tspackages/sdk/src/index.tspackages/sdk/src/resources/automations.tspackages/sdk/src/resources/index.tspackages/trpc/src/router/automation/automation.ts
💤 Files with no reviewable changes (1)
- packages/cli/src/commands/automations/prompt/command.ts
✅ Files skipped from review due to trivial changes (4)
- packages/sdk/src/resources/index.ts
- packages/cli/src/commands/automations/prompt/meta.ts
- packages/sdk/src/index.ts
- packages/sdk/src/client.ts
🚧 Files skipped from review as they are similar to previous changes (3)
- packages/mcp-v2/src/tools/automations/get.ts
- packages/cli/src/commands/automations/get/command.ts
- packages/mcp-v2/src/tools/automations/list.ts
| retrieve( | ||
| id: string, | ||
| options?: RequestOptions, | ||
| ): APIPromise<AutomationSummary> { | ||
| return this._client.query<AutomationSummary>( | ||
| "automation.get", | ||
| { id }, | ||
| options, | ||
| ); | ||
| } |
There was a problem hiding this comment.
Breaking SDK change: retrieve and list no longer return prompt — needs version bump or migration note
Both the TypeScript API type and the underlying automation.get / automation.list tRPC wire responses now omit prompt. Any existing SDK consumer reading .prompt from automations.retrieve(id) or automations.list() will silently receive undefined at runtime (even without TypeScript errors if they're on an older version of the package).
The PR description states "No wire-format/API changes," but the tRPC response shape for get and list has genuinely changed. This should be accompanied by a semver major bump, a changelog entry, or at minimum a migration note pointing consumers to automations.getPrompt(id).
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/sdk/src/resources/automations.ts` around lines 26 - 35, The SDK's
retrieve and list methods (AutomationResource.retrieve and
AutomationResource.list) now return responses that omit the prompt field because
the underlying tRPC handlers ("automation.get" / "automation.list") no longer
include it; update the release artifacts: add a changelog entry and semver-major
bump (or explicit migration note) explaining the breaking change and point
consumers to automations.getPrompt(id) for prompt data, and also update the
TypeScript docs/comments for retrieve and list to reflect that prompt is no
longer returned so callers know to call getPrompt instead.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@apps/docs/content/docs/cli/cli-reference.mdx`:
- Around line 668-685: The documentation for the Command "superset automations
prompt get <id>" only shows the raw Markdown output and omits the structured
JSON fallback; update the Command block to document both outputs so machine
users see the JSON shape used for --json/--quiet/agent modes (add an inline type
block showing { id: string; prompt: string }) and adjust the output
prop/description to reflect both the raw Markdown path and the structured JSON
fallback so the rendered docs show the machine-readable return shape as well as
the raw prompt behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: c7ae6139-aa1f-4334-87db-2a08ee10907e
📒 Files selected for processing (4)
apps/docs/content/docs/cli/cli-reference.mdxapps/docs/content/docs/sdk/reference.mdxpackages/cli/src/commands/automations/prompt/get/command.tspackages/trpc/src/router/automation/automation.ts
✅ Files skipped from review due to trivial changes (1)
- apps/docs/content/docs/sdk/reference.mdx
🚧 Files skipped from review as they are similar to previous changes (1)
- packages/cli/src/commands/automations/prompt/get/command.ts
| name="superset automations prompt get <id>" | ||
| args={[ | ||
| { name: "id", required: true, description: "Automation ID." }, | ||
| ]} | ||
| output="Markdown" | ||
| > | ||
| Print an automation's prompt body to stdout. The output is the raw prompt | ||
| with no trailing newline added, so `prompt get` and `prompt set` round-trip | ||
| byte-exactly. | ||
|
|
||
| ```bash | ||
| # Read to a file | ||
| superset automations prompt get aut_… > prompt.md | ||
|
|
||
| # Verify a push landed | ||
| superset automations prompt get aut_… | diff - ./prompt.md | ||
| ``` | ||
| </Command> |
There was a problem hiding this comment.
prompt get is missing its structured output shape for --json / --quiet / agent modes.
The PR description explicitly states that prompt get "falls back to structured { id, prompt } output" when --json, --quiet, or an agent-mode env var is active. The current block only documents the raw-text path via output="Markdown", so users scripting against prompt get --json (the typical machine-readable invocation) have no documented return shape.
Also, "Markdown" is not a TypeScript type name — every other output prop in this file is either a named type ("Automation", "Array<AutomationRun>") or an inline literal. Depending on how the Command component renders the output prop, this may appear oddly in the rendered docs.
Suggested fix — add the JSON fallback shape inline the same way other commands document multiple output modes:
📝 Proposed documentation update
<Command
name="superset automations prompt get <id>"
args={[
{ name: "id", required: true, description: "Automation ID." },
]}
- output="Markdown"
>
Print an automation's prompt body to stdout. The output is the raw prompt
with no trailing newline added, so `prompt get` and `prompt set` round-trip
byte-exactly.
+In `--json`, `--quiet`, or agent modes the command falls back to structured output:
+
+```ts
+{ id: string; prompt: string }
+```
+
```bash
# Read to a file
superset automations prompt get aut_… > prompt.md📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| name="superset automations prompt get <id>" | |
| args={[ | |
| { name: "id", required: true, description: "Automation ID." }, | |
| ]} | |
| output="Markdown" | |
| > | |
| Print an automation's prompt body to stdout. The output is the raw prompt | |
| with no trailing newline added, so `prompt get` and `prompt set` round-trip | |
| byte-exactly. | |
| ```bash | |
| # Read to a file | |
| superset automations prompt get aut_… > prompt.md | |
| # Verify a push landed | |
| superset automations prompt get aut_… | diff - ./prompt.md | |
| ``` | |
| </Command> | |
| name="superset automations prompt get <id>" | |
| args={[ | |
| { name: "id", required: true, description: "Automation ID." }, | |
| ]} | |
| > | |
| Print an automation's prompt body to stdout. The output is the raw prompt | |
| with no trailing newline added, so `prompt get` and `prompt set` round-trip | |
| byte-exactly. | |
| In `--json`, `--quiet`, or agent modes the command falls back to structured output: | |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@apps/docs/content/docs/cli/cli-reference.mdx` around lines 668 - 685, The
documentation for the Command "superset automations prompt get <id>" only shows
the raw Markdown output and omits the structured JSON fallback; update the
Command block to document both outputs so machine users see the JSON shape used
for --json/--quiet/agent modes (add an inline type block showing { id: string;
prompt: string }) and adjust the output prop/description to reflect both the raw
Markdown path and the structured JSON fallback so the rendered docs show the
machine-readable return shape as well as the raw prompt behavior.
Drop the helper indirection — getAutomationSummaryForUser was only used twice and the inline destructure makes each procedure self-contained.
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.
npm has alpha.6 as the most recent published; alpha.7 was bumped in 71bf008 but never `npm publish`-ed. Skip alpha.7 on the registry and ship the current repo state as alpha.8. Changes since alpha.6: - workspaces.create adopts the canonical host-service shape (#3893) - automations.list accepts --name filter (#3952) - automations.prompt split into automations.prompt.get / .set (#3959) - agents.list (presets demoted to UI-only configuration) (#4097) - agents.run / workspaces.create gain `superset-chat` agent + `kind` discriminator on launch results (terminal vs chat) (#4116) - type adjustments for v2 workspace render path (#4141) - redact x-api-key in debug-log header dumps (#3956, was alpha.7) After merge: `cd packages/sdk && bun run build && cd dist && npm publish --access public`.
Summary
The mixed read/write
automations prompt <id>command was a footgun. Without--from-fileit tried to read a new prompt from stdin and bailed on EOF, sosuperset automations prompt <id> > /tmp/x.mdproduced a 0-byte file withRefusing to write an empty prompt from stdin.. There was no non-interactive read path — the only way to inspect a live prompt wasautomations list+ grep — so verifying that a push landed (get | diff -) was impossible.Split into explicit subcommands:
superset automations prompt get <id>— writes the prompt to stdout. Usesprocess.stdout.writewith no trailing newline soget > file.mdandget | diff - file.mdround-trip byte-exactly. Falls back to structured{ id, prompt }output under--json/--quiet/agent mode.superset automations prompt set <id> --from-file <path>— replaces the prompt.--from-fileis required;--from-file -reads from stdin.automations getcontinues to omit thepromptfield (it can be large markdown);prompt getis the canonical read path. Comment onautomations getupdated to point at the new path.No legacy alias —
automations prompt <id>now errors with "Unknown command" and suggestsget/set. No wire-format / API changes.Test plan
superset automations prompt get <uuid>→ exit 0, prompt body on stdout, nothing on stderrsuperset automations prompt get <uuid> > /tmp/x.md→ file contains exactly the live promptsuperset automations prompt set <uuid> --from-file /tmp/x.md→ succeeds, returns updated metadatasuperset automations prompt set <uuid> --from-file -(heredoc/pipe) → reads from stdin, succeedssuperset automations prompt get <uuid> | diff - /tmp/x.md→ empty diff after asetsuperset automations prompt --helplistsgetandsetFollow-ups (out of scope)
superset automations prompt diff <id> <file>for cheap pre-push verification.accept-name-not-just-uuidtask once it lands, soprompt get "Sales — Update Notion"works.Summary by cubic
Split the footgun
superset automations prompt <id>into explicitprompt getandprompt setfor safe, scriptable reads/writes. Moved prompt omission to the server with SQL projection soautomation.list/automation.getreturn lean metadata;getPromptis the single read path.Migration
superset automations prompt get <id>(prints raw prompt to stdout, no trailing newline).superset automations prompt set <id> --from-file <path>(use--from-file -to read from stdin).superset automations prompt get <id> > file.mdthensuperset automations prompt set <id> --from-file file.mdand verify withsuperset automations prompt get <id> | diff - file.md.Refactors
prompt) inautomation.list/automation.getis now inlined;getPromptis the canonical read path.AutomationSummary(forlist/retrieve, noprompt) andAutomation(full row for mutations). Updated CLIautomations getand MCP tools to the server’s lean shape; outputs stay the same.prompt getemits structured{ id, prompt }only under--jsonand ignores--quietto avoid dropping the prompt body.Written for commit 72be5df. Summary will update on new commits.
Summary by CodeRabbit
Refactor
automations promptCLI command with distinctprompt getandprompt setsubcommands.New Features
prompt get: prints raw prompt or structured JSON.prompt set: accepts file or stdin, rejects empty input, returns update info.Behavior
automations list/retrieveomit prompt; useprompt get.automations getnow returns the full automation object (includes prompt).Documentation