@clickminded/coauthor-cli 0.0.78 → 0.0.79

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/commands.js CHANGED
@@ -916,6 +916,21 @@ async function runDraftReviseCommand(projectId, input, context) {
916
916
  data: started,
917
917
  };
918
918
  }
919
+ if (getResponseString(revision, 'state') === 'failed') {
920
+ // A failed revision is an error, never a result to review (dogfood, Nov 2026: a "safe limit" failure
921
+ // came back as ok: true with apply/discard next_commands).
922
+ const code = getResponseString(revision, 'error_code') ?? 'revision_failed';
923
+ const reply = getResponseString(revision, 'assistant_message');
924
+ const tooBig = /budget_exhausted$/.test(code);
925
+ return {
926
+ ok: false,
927
+ status: 'failed',
928
+ code,
929
+ exitCode: 1,
930
+ message: `Revision ${revisionId} failed (${code}); the draft was not changed.${reply ? `\nCoAuthor replied: ${reply}` : ''}${tooBig ? '\nSplit the instruction: send one or two fixes per `draft revise`, or edit exact text directly (references/editing-drafts.md).' : ''}`,
931
+ data: revision,
932
+ };
933
+ }
919
934
  if (getResponseValue(revision, 'awaiting_review') !== true) {
920
935
  // No changes usually means CoAuthor asked a question or explained why it
921
936
  // did not edit. Show its reply so the caller can answer or rephrase.
package/dist/output.d.ts CHANGED
@@ -5,6 +5,8 @@ export type CommandResult = {
5
5
  message?: string;
6
6
  data?: JsonValue;
7
7
  exitCode?: number;
8
+ /** Machine-readable failure code for --json (otherwise derived from status). */
9
+ code?: string;
8
10
  settings_url?: string;
9
11
  resume_command?: string;
10
12
  /** The Idempotency-Key sent with the command's live request; look it up with `coauthor operation status <key>`. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clickminded/coauthor-cli",
3
- "version": "0.0.78",
3
+ "version": "0.0.79",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "coauthor": "dist/index.js",
@@ -12,6 +12,7 @@ coauthor draft revise <id> --instruction "Cut the intro to two sentences and lea
12
12
 
13
13
  - The result's `data.groups` lists each proposed change with `before_markdown` and `after_markdown`. Review every group against the brief: is it accurate, in voice, and limited to what was asked?
14
14
  - Apply all groups: `coauthor draft revision apply <id> <revision-id> --json`. Keep only some with `--accept <group id>,<group id>`, or all but some with `--reject <group id>`, copying the ids (`review_…`) from `data.groups[].id`. Groups not named in `--accept` are dropped. Drop the whole revision with `coauthor draft revision discard <id> <revision-id> --json`.
15
+ - A failed revision exits 1 with `ok: false`, `status: "failed"` and a `code`; the draft is unchanged. `call_budget_exhausted`, `token_budget_exhausted`, `cost_budget_exhausted` and `time_budget_exhausted` mean the request was too big for one pass: send one or two fixes per `draft revise`, or make exact text fixes (a URL, a checklist's `[ ]` markers) with a direct edit (section 2).
15
16
  - `status: "no_changes"` usually means CoAuthor asked a question instead of guessing. Read `data.assistant_message`, then run `draft revise` again with a clearer instruction.
16
17
  - Name the place precisely ("the paragraph after the 'Write the first line' heading") and give numbers for cuts ("under 60 words"). Vague targets get a clarifying question back, and a vague "tighten" changes little.
17
18
  - One revision can be open on a draft at a time, and an open one blocks the user's saves in the browser. Always apply or discard it. `revision_pending` means one is already open. A revision you leave waiting for review is discarded automatically after 30 minutes (`expires_at` in `draft revision show`), so review it promptly; after that, start a new one.
@@ -312,6 +312,7 @@ coauthor draft revise <id> --instruction "Cut the intro to two sentences and lea
312
312
 
313
313
  - The result's `data.groups` lists each proposed change with `before_markdown` and `after_markdown`. Review every group against the brief: is it accurate, in voice, and limited to what was asked?
314
314
  - Apply all groups: `coauthor draft revision apply <id> <revision-id> --json`. Keep only some with `--accept <group id>,<group id>`, or all but some with `--reject <group id>`, copying the ids (`review_…`) from `data.groups[].id`. Groups not named in `--accept` are dropped. Drop the whole revision with `coauthor draft revision discard <id> <revision-id> --json`.
315
+ - A failed revision exits 1 with `ok: false`, `status: "failed"` and a `code`; the draft is unchanged. `call_budget_exhausted`, `token_budget_exhausted`, `cost_budget_exhausted` and `time_budget_exhausted` mean the request was too big for one pass: send one or two fixes per `draft revise`, or make exact text fixes (a URL, a checklist's `[ ]` markers) with a direct edit (section 2).
315
316
  - `status: "no_changes"` usually means CoAuthor asked a question instead of guessing. Read `data.assistant_message`, then run `draft revise` again with a clearer instruction.
316
317
  - Name the place precisely ("the paragraph after the 'Write the first line' heading") and give numbers for cuts ("under 60 words"). Vague targets get a clarifying question back, and a vague "tighten" changes little.
317
318
  - One revision can be open on a draft at a time, and an open one blocks the user's saves in the browser. Always apply or discard it. `revision_pending` means one is already open. A revision you leave waiting for review is discarded automatically after 30 minutes (`expires_at` in `draft revision show`), so review it promptly; after that, start a new one.