Repository navigation
Conversation
`stackctl agent-guide` prints a Markdown guide for agents and scripts: machine-readable output and where it is not JSON, -q IDs, exit codes, authentication without a prompt, confirmations (Aborted. exits 0, < /dev/null), --dry-run limits, waiting for long-running operations and checking the status after --follow, and common tasks. The guide is embedded in the binary, so it matches the installed version, and the command works without a config. `stackctl --help` points to it. TestAgentGuide_CommandsExist checks every stackctl invocation in the guide against the command tree and the flags of each command. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…atus A normal WebSocket close (code 1000, for example on a server restart) ended `--follow` with status "unknown" and exit code 0, although the operation was still running. After such a close, --follow now reads the instance: a final status counts (error and partial still exit 1), else it exits 1 and says that the operation continues on the server. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A declined confirmation prompt printed "Aborted." to stdout and exited 0, so a script could not tell a declined delete from a done one. It now returns errAborted: exit code 1 and "aborted: not confirmed, nothing changed" on stderr. This covers every command with a confirmation (confirmAction), including bulk, override, chart and action commands. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Messages for people (PrintMessage: "Deleted ...", --dry-run text, "Deploying stack ...") went to stdout in every mode, so `-o json | jq` and `$(... -q)` got text. Printer.MachineReadable() (-o json|yaml, -q) now sends them to Printer.ErrWriter (stderr); the table format and custom formats keep them on stdout. - stack deploy, stop, clean and rollback share printOperation: -o json|yaml prints the 202 response (log_id, message), -q the log ID. With --follow in those modes the log goes to stderr and stdout gets the instance after the operation (-q: the log ID). `stack logs -f` prints the log as without --follow. followHelp describes it. - cluster shared-values list and config list print [] for an empty list with -o json|yaml instead of a message. - confirmAction returns errAborted itself (callers only pass the error on), and the skip-config check uses an annotation (skipsConfig) instead of command names. - agent-guide: rules for the new output, login needs a context, bulk commands exit 0 with failed items, draft after a clean, quick-deploy and bulk are asynchronous, SIGINT exits 0, no fixed --stop-at date. The guide test now also checks positional argument counts and quoted arguments. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
stackctl agent-guide, a Markdown guide for AI agents and scripts that is built into the binary. While writing the guide, three behaviours turned up that would mislead an agent or a script. This PR fixes them.New:
stackctl agent-guidecli/cmd/agent_guide.md(embedded withgo:embed;{{VERSION}}becomes the build version). It works without a config, likeversion.-q, exit codes, authentication without a prompt, confirmations,--dry-runlimits, waiting for long-running operations, errors, and common tasks.stackctl --helppoints to it; the README has a section "Use with AI agents and scripts".TestAgentGuide_CommandsExistchecks everystackctl …invocation in the guide against the command tree: subcommands, flags and the number of positional arguments.Fixes
Aborted.on stdout, exit 0). The message is nowaborted: not confirmed, nothing changedon stderr.confirmActionreturnserrAborteditself, which removes 17 copies of the check.--followafter a normal server close (code 1000, for example a restart): it reads the instance. A final status counts as before; otherwise it exits 1 and says that the operation continues on the server (was: exit 0).-o json,-o yamland-q.Printer.MachineReadable()sendsPrintMessagetext toPrinter.ErrWriter(stderr). The table format and custom formats are unchanged.stack deploy,stop,cleanandrollbackprint the 202 response (log_id,message) with-o json|yamland the log ID with-q(printOperation).--followin those modes, the log goes to stderr and stdout gets the instance after the operation (-q: the log ID).stack logs -fprints the log as it does without--follow.cluster shared-values listandconfig listprint[]for an empty list.skipsConfig) instead of matched by name.Behaviour changes for scripts
-o json,-o yamlor-q, messages such asDeleted stack …,--dry-runtext andAborted.moved from stdout to stderr.stack deploy|stop|clean -o json|yamlprint JSON or YAML instead of a text line.--followwith-o json|yaml|-qwrites the log to stderr instead of stdout.Not changed (documented in the guide)
bulkcommands exit 0 even when some items fail (checkfailedin-o json).--followexits 0.Test plan
make test: all packages pass, including e2e and integrationmake lint(go vet,staticcheck)--follow -o json|yaml|-q,stack logs -f -o json,--dry-runin json and quiet mode, empty lists as[], normal close during--follow, the e2e exit code of a declined prompt,MachineReadable,skipsConfigagent-guidewith a missing config;stack delete --dry-run -o json(stdout empty, message on stderr)🤖 Generated with Claude Code