Skip to content

Commit 3845768

Browse files
committed
docs(cli): explain why rule delete --json stays silent on success
A coordinator review flagged the delete branch's silence under --json as the same silent-success shape as #280's guard bug, and asked me to add a success envelope. Before landing that, I found test/error-envelope.test.ts already asserts the opposite as correct ("is silent on stdout when a real rule is deleted in --json mode"), introduced deliberately in 07c0d3c. The cli-check and cli-auth OpenSpec specs both say the standardized envelope applies "when ... exits with an error" — it is an error-only envelope. create/improve/ meta print on success because they have a payload to return; delete (like auth logout) does not, so silence is correct, not a bug. No behavior change. Adds a comment at the call site recording why, so the next reader (or reviewer) doesn't have to re-derive it.
1 parent 3cfbe5b commit 3845768

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

‎packages/cli/src/commands/rules.ts‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -749,6 +749,16 @@ const deleteCommand = defineCommand({
749749
try {
750750
const result = await deleteRuleFiles(cwd, id);
751751
if (result.outcome === "deleted") {
752+
// Silent on stdout under `--json`, deliberately, not an oversight.
753+
// The spec's `{ ok:false, code, message }` envelope is documented as
754+
// an ERROR envelope ("... exits with an error" — see
755+
// openspec/specs/cli-check/spec.md and cli-auth/spec.md), not a
756+
// general success/failure wrapper: `create`/`improve`/`meta` print on
757+
// success because they have a payload to hand back (generated rules,
758+
// metadata), and `delete` does not. `auth logout` is the same shape
759+
// for the same reason. Introduced this way in 07c0d3c; see
760+
// test/error-envelope.test.ts's "is silent on stdout when a real rule
761+
// is deleted in --json mode".
752762
if (!args.json) {
753763
console.log(`Deleted rule "${id}" and associated test files.`);
754764
}

0 commit comments

Comments
 (0)