@clickminded/coauthor-cli 0.0.81 → 0.0.83
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
|
@@ -2076,6 +2076,22 @@ function revisionMessage(artifact, data) {
|
|
|
2076
2076
|
if (diff.reordered === true)
|
|
2077
2077
|
lines.push('Sections were reordered.');
|
|
2078
2078
|
}
|
|
2079
|
+
const notApplied = getResponseValue(data, 'not_applied');
|
|
2080
|
+
if (Array.isArray(notApplied) && notApplied.length > 0) {
|
|
2081
|
+
lines.push(`Not applied (${notApplied.length}):`);
|
|
2082
|
+
for (const entry of notApplied) {
|
|
2083
|
+
const record = entry && typeof entry === 'object' && !Array.isArray(entry) ? entry : {};
|
|
2084
|
+
const request = typeof record.request === 'string' ? record.request : JSON.stringify(entry);
|
|
2085
|
+
const reason = typeof record.reason === 'string' && record.reason ? ` (${record.reason})` : '';
|
|
2086
|
+
lines.push(`- ${request}${reason}`);
|
|
2087
|
+
}
|
|
2088
|
+
}
|
|
2089
|
+
const plan = getResponseValue(data, 'research_plan');
|
|
2090
|
+
if (plan && typeof plan === 'object' && !Array.isArray(plan) && plan.stale === true) {
|
|
2091
|
+
const missing = plan.sections_without_tasks;
|
|
2092
|
+
const names = Array.isArray(missing) ? missing.filter((name) => typeof name === 'string') : [];
|
|
2093
|
+
lines.push(`The research plan is out of date${names.length ? ` (no tasks for: ${names.join('; ')})` : ''}. After approving the outline, run: coauthor research-plan generate <project-id> --json`);
|
|
2094
|
+
}
|
|
2079
2095
|
lines.push(`Review it with: coauthor ${artifact} show <project-id> --json, then approve with: coauthor ${artifact} approve <project-id> --json`);
|
|
2080
2096
|
return lines.join('\n');
|
|
2081
2097
|
}
|
|
@@ -3872,7 +3888,7 @@ function commandHelp(command) {
|
|
|
3872
3888
|
'Usage: coauthor outline <show|generate|revise|save|approve> <project-id> [--feedback "..."] [--data <json|@file>] [--planning-model <id>] [--json]',
|
|
3873
3889
|
'',
|
|
3874
3890
|
'generate creates an outline without approving it (data.sections). show returns the saved outline (data.artifact).',
|
|
3875
|
-
'revise --feedback: CoAuthor rewrites the outline from your feedback, saves it (not approved), and returns data.diff.',
|
|
3891
|
+
'revise --feedback: CoAuthor rewrites the outline from your feedback, saves it (not approved), and returns data.diff and data.not_applied (requested changes it did not make, with reasons).',
|
|
3876
3892
|
'save replaces it with the complete list {"sections":[...]}; omitted sections are removed. approve approves the saved outline.',
|
|
3877
3893
|
].join('\n'),
|
|
3878
3894
|
'research-plan': [
|
package/package.json
CHANGED
package/skills/coauthor/SKILL.md
CHANGED
|
@@ -33,7 +33,7 @@ Typical timing: brief and outline under a minute; research and draft 3–10 minu
|
|
|
33
33
|
**Profile first.** A writer profile carries the voice, writer and business context, and image style, and a project keeps its profile for good. Run `coauthor profile list --json`. With one profile, omit `--profile`. With several, pick the one that fits the request (for example the company blog vs a personal newsletter) and ask the user if it isn't clear.
|
|
34
34
|
**Sources.** If the user gave you documents to work from (PDF, .txt, .md), add each before research: `coauthor source add <id> <file> --json` (up to 5; see `references/brief-and-contract.md`). Put source URLs in the brief instead.
|
|
35
35
|
2. **Brief review.** `coauthor brief review <id> --json`. CoAuthor critiques the brief and returns `data.verdict`, `data.concerns`, and `data.questions`, each with `why`, the `field` it changes, and `answerable_by`. Answer the `agent` questions from your context; take `human` ones (opinions, private business facts, numbers, risk tolerance) to the user in one message, or, if they asked not to be interrupted, answer them as assumptions. Write `{"answers":[{"question","answer","source":"agent|user|assumption"}]}` to a file (add `"apply_suggested_patch": <data.suggested_patch>` if its suggestions are good) and run `coauthor brief answer <id> --data @answers.json --json`. Repeat once if the verdict was `needs_answers`, then approve: `coauthor contract approve <id> --json`. Log what you assumed: `coauthor log add <id> --kind assumption --message "..." --json`.
|
|
36
|
-
3. **Outline checkpoint.** `coauthor outline generate <id> --json` (this does not approve it; sections are in `data.sections`). Review it as the user's editor: every section serves the core promise, must-includes are covered, the order builds, nothing is generic, repeated, or unsupported. Find problems; a bare approval is the exception. Send all your changes in one request: `coauthor outline revise <id> --feedback "Merge sections 3 and 4. Replace the conclusion with a one-week checklist." --json`. It saves the revision and returns `data.diff` (added, removed, renamed, changed, reordered); check the diff matches what you asked, and revise again (at most twice) if not. For exact wording you already have, `coauthor outline save <id> --data @outline.json --json` with the complete `{"sections":[...]}` instead. Then `coauthor outline approve <id> --json` and log it (`coauthor log add <id> --message "Approved the outline after …" --json`). If the user asked to see the outline, show it to them here and wait.
|
|
36
|
+
3. **Outline checkpoint.** `coauthor outline generate <id> --json` (this does not approve it; sections are in `data.sections`). Review it as the user's editor: every section serves the core promise, must-includes are covered, the order builds, nothing is generic, repeated, or unsupported. Find problems; a bare approval is the exception. Send all your changes in one request: `coauthor outline revise <id> --feedback "Merge sections 3 and 4. Replace the conclusion with a one-week checklist." --json`. It saves the revision and returns `data.diff` (added, removed, renamed, changed, reordered); check the diff matches what you asked, and revise again (at most twice) if not. `data.not_applied` lists any requested change CoAuthor did not make, each with `request` and `reason`; resend those with clearer wording or tell the user why they were left out. When `data.research_plan.stale` is true (the outline changed after a research plan was made; `sections_without_tasks` lists sections it does not cover), run `coauthor research-plan generate <id> --json` after approving the outline instead of approving the old plan. For exact wording you already have, `coauthor outline save <id> --data @outline.json --json` with the complete `{"sections":[...]}` instead. Then `coauthor outline approve <id> --json` and log it (`coauthor log add <id> --message "Approved the outline after …" --json`). If the user asked to see the outline, show it to them here and wait.
|
|
37
37
|
4. **Research-plan checkpoint.** `coauthor research-plan generate <id> --json` (tasks in `data.research_tasks`). Check every section has a task, every claim that needs proof points at the right sources (including URLs the user gave you), and deep research is used only where it matters. Fix it with `coauthor research-plan revise <id> --feedback "Add a task for the checklist section. Use https://… as a required source for the limits section." --json` and check `data.diff`, then `coauthor research-plan approve <id> --json` and log it.
|
|
38
38
|
5. **Research and draft.** `COAUTHOR_CLI_WAIT_TIMEOUT_MS=540000 coauthor workflow run <id> --target draft --wait --json`. It is done when the message says the draft completed (`data.draft_status.project_state` is `draft_generated`); ignore the stale `data.workflow.status`. On `timed_out`: `coauthor workflow resume <id> --target draft --wait --json`.
|
|
39
39
|
6. **Quality pass.** CoAuthor already checks each new draft against the brief and for consistency, and fixes what it can: must-include items, non-negotiables, tables vs their sections, "see the table" references, unsourced "most readers" claims, FAQ answers that defer, and links (cut-short or malformed URLs, dead pages, citations that open a page about something else). Whatever is still open is in `quality_check.unresolved` of `coauthor draft status <id> --json` (and `post-details show`), and the completion message says how many. Fix those first. Then `coauthor draft get <id> --format markdown --json` and read `data.markdown` in full. Check it against the brief's must-include, must-avoid, and non-negotiables. Look for: notes about the research process ("the retrieved sources do not…"), invented "checked <date>" lines, numbered lists that restart at 1, garbled `*`, `_`, or code spans, literal `[ ]` in checklists, the same caveat repeated across sections, claims without a source or cited to a page that doesn't support them, contradictions, and a messy Sources list (generic titles like "Google", duplicate entries). Fix them in step 8.
|
|
@@ -20,6 +20,8 @@ coauthor draft revise <id> --instruction "Cut the intro to two sentences and lea
|
|
|
20
20
|
- While a revision runs, up to 100 available credits are temporarily held for its steps. Only actual usage is charged; unused held credits are released when it finishes or stops. A hold is included in `coauthor credits <id> --json` and does not change the request's spending limit.
|
|
21
21
|
- A revision that ends without a result (it failed, or didn't finish within 12 minutes and was closed) has the credits it used refunded automatically. A revision you cancel is not refunded.
|
|
22
22
|
- `revise_unavailable` means this account cannot revise by instruction yet; use a direct edit.
|
|
23
|
+
- `draft revise` targets whatever version is saved when it starts, and retries once by itself if a save lands at the same moment. A `stale_draft` after that names `details.base_version` and the command to re-read the draft.
|
|
24
|
+
- When `draft revise` is refused, the error's `code` and `details.reason` say why. `editor_context_too_large` will not clear on retry (the project's research and recent editor messages are over the editor's size limit), so make the change with a direct edit.
|
|
23
25
|
|
|
24
26
|
## 2. Direct edit (exact text you already have)
|
|
25
27
|
|
|
@@ -22,12 +22,17 @@ Every failure prints JSON on stderr with `ok: false`, `error` (a readable messag
|
|
|
22
22
|
| `draft_exists` | `brief answer` on a project that already has a draft. | Edit the draft instead. `--force` only if the user wants to restart from the brief (the draft is regenerated). |
|
|
23
23
|
| `downstream_exists` | `outline revise` or `research-plan revise` after research ran. | Same: edit the draft, or `--force` to restart from that stage with the user's OK. |
|
|
24
24
|
| `outline_generation_failed` | `outline generate` (or `workflow run`/`advance` reaching the outline) couldn't produce an outline. Nothing was saved; the current outline is unchanged. | Retry once after a minute. If it fails again, tell the user; never write a generic outline yourself and approve it. |
|
|
25
|
+
| `research_plan_stale` | `research-plan approve` on a plan made before the outline changed, with no tasks for some current sections. | `coauthor research-plan generate <id> --json`, review it, then approve. |
|
|
25
26
|
| `revision_invalid` | CoAuthor's revision referenced sections that don't exist. | Run `revise` again with feedback that names sections by their current headings. |
|
|
26
27
|
| `stale_draft` | The draft changed after you read it. | Re-read with `draft get`, reapply your edit, save. |
|
|
27
28
|
| `user_recently_editing` | The user saved in the browser in the last 90 seconds. | Wait, or ask them. `--force` only with their OK. |
|
|
28
29
|
| `review_pending`, `document_locked` | An AI review or edit is in progress in the editor. | Wait, or apply or discard it. |
|
|
29
30
|
| `revision_pending` | Another draft revision is open. | Apply or discard it (`details.revision_id`). An agent revision left in review is discarded automatically at `details.expires_at`. |
|
|
30
31
|
| `revise_unavailable` | Revise by instruction isn't available on this account. | Use a direct edit (`references/editing-drafts.md`). |
|
|
32
|
+
| `editor_context_too_large` | `draft revise` refused: the project's research, sources, reference documents and recent editor messages are over the editor's size limit (`details.request_context_bytes`, `details.limit_bytes`). Retrying won't help. | Make the change with a direct edit (`references/editing-drafts.md`). |
|
|
33
|
+
| `editor_history_invalid` | `draft revise` refused because an earlier message in the draft's editor conversation has an attachment the editor can no longer read. | Use a direct edit and tell the user. |
|
|
34
|
+
| `project_changed` | Another step started or finished on the project while a revision was being set up. | Run `coauthor workflow status <id> --json`, then retry once. |
|
|
35
|
+
| `invalid_request` with `details.reason` | The editor rejected the request; `details.reason` names the check. | Don't retry the same request. Report `details.reason` and use a direct edit. |
|
|
31
36
|
| `invalid_document` | `draft save` content isn't an editor document. | Send the edited `data.content` from `draft get --format json`, never markdown. |
|
|
32
37
|
| `workflow_token_mismatch`, `conflict` | The project moved on since you read it (for example someone used the web app). | Re-read the state with `coauthor workflow status <id> --json` and continue from there. |
|
|
33
38
|
| `insufficient_scope` | The token can't publish. | `coauthor auth login --with-publish`. |
|
|
@@ -35,7 +35,7 @@ Typical timing: brief and outline under a minute; research and draft 3–10 minu
|
|
|
35
35
|
**Profile first.** A writer profile carries the voice, writer and business context, and image style, and a project keeps its profile for good. Run `coauthor profile list --json`. With one profile, omit `--profile`. With several, pick the one that fits the request (for example the company blog vs a personal newsletter) and ask the user if it isn't clear.
|
|
36
36
|
**Sources.** If the user gave you documents to work from (PDF, .txt, .md), add each before research: `coauthor source add <id> <file> --json` (up to 5; see `references/brief-and-contract.md`). Put source URLs in the brief instead.
|
|
37
37
|
2. **Brief review.** `coauthor brief review <id> --json`. CoAuthor critiques the brief and returns `data.verdict`, `data.concerns`, and `data.questions`, each with `why`, the `field` it changes, and `answerable_by`. Answer the `agent` questions from your context; take `human` ones (opinions, private business facts, numbers, risk tolerance) to the user in one message, or, if they asked not to be interrupted, answer them as assumptions. Write `{"answers":[{"question","answer","source":"agent|user|assumption"}]}` to a file (add `"apply_suggested_patch": <data.suggested_patch>` if its suggestions are good) and run `coauthor brief answer <id> --data @answers.json --json`. Repeat once if the verdict was `needs_answers`, then approve: `coauthor contract approve <id> --json`. Log what you assumed: `coauthor log add <id> --kind assumption --message "..." --json`.
|
|
38
|
-
3. **Outline checkpoint.** `coauthor outline generate <id> --json` (this does not approve it; sections are in `data.sections`). Review it as the user's editor: every section serves the core promise, must-includes are covered, the order builds, nothing is generic, repeated, or unsupported. Find problems; a bare approval is the exception. Send all your changes in one request: `coauthor outline revise <id> --feedback "Merge sections 3 and 4. Replace the conclusion with a one-week checklist." --json`. It saves the revision and returns `data.diff` (added, removed, renamed, changed, reordered); check the diff matches what you asked, and revise again (at most twice) if not. For exact wording you already have, `coauthor outline save <id> --data @outline.json --json` with the complete `{"sections":[...]}` instead. Then `coauthor outline approve <id> --json` and log it (`coauthor log add <id> --message "Approved the outline after …" --json`). If the user asked to see the outline, show it to them here and wait.
|
|
38
|
+
3. **Outline checkpoint.** `coauthor outline generate <id> --json` (this does not approve it; sections are in `data.sections`). Review it as the user's editor: every section serves the core promise, must-includes are covered, the order builds, nothing is generic, repeated, or unsupported. Find problems; a bare approval is the exception. Send all your changes in one request: `coauthor outline revise <id> --feedback "Merge sections 3 and 4. Replace the conclusion with a one-week checklist." --json`. It saves the revision and returns `data.diff` (added, removed, renamed, changed, reordered); check the diff matches what you asked, and revise again (at most twice) if not. `data.not_applied` lists any requested change CoAuthor did not make, each with `request` and `reason`; resend those with clearer wording or tell the user why they were left out. When `data.research_plan.stale` is true (the outline changed after a research plan was made; `sections_without_tasks` lists sections it does not cover), run `coauthor research-plan generate <id> --json` after approving the outline instead of approving the old plan. For exact wording you already have, `coauthor outline save <id> --data @outline.json --json` with the complete `{"sections":[...]}` instead. Then `coauthor outline approve <id> --json` and log it (`coauthor log add <id> --message "Approved the outline after …" --json`). If the user asked to see the outline, show it to them here and wait.
|
|
39
39
|
4. **Research-plan checkpoint.** `coauthor research-plan generate <id> --json` (tasks in `data.research_tasks`). Check every section has a task, every claim that needs proof points at the right sources (including URLs the user gave you), and deep research is used only where it matters. Fix it with `coauthor research-plan revise <id> --feedback "Add a task for the checklist section. Use https://… as a required source for the limits section." --json` and check `data.diff`, then `coauthor research-plan approve <id> --json` and log it.
|
|
40
40
|
5. **Research and draft.** `COAUTHOR_CLI_WAIT_TIMEOUT_MS=540000 coauthor workflow run <id> --target draft --wait --json`. It is done when the message says the draft completed (`data.draft_status.project_state` is `draft_generated`); ignore the stale `data.workflow.status`. On `timed_out`: `coauthor workflow resume <id> --target draft --wait --json`.
|
|
41
41
|
6. **Quality pass.** CoAuthor already checks each new draft against the brief and for consistency, and fixes what it can: must-include items, non-negotiables, tables vs their sections, "see the table" references, unsourced "most readers" claims, FAQ answers that defer, and links (cut-short or malformed URLs, dead pages, citations that open a page about something else). Whatever is still open is in `quality_check.unresolved` of `coauthor draft status <id> --json` (and `post-details show`), and the completion message says how many. Fix those first. Then `coauthor draft get <id> --format markdown --json` and read `data.markdown` in full. Check it against the brief's must-include, must-avoid, and non-negotiables. Look for: notes about the research process ("the retrieved sources do not…"), invented "checked <date>" lines, numbered lists that restart at 1, garbled `*`, `_`, or code spans, literal `[ ]` in checklists, the same caveat repeated across sections, claims without a source or cited to a page that doesn't support them, contradictions, and a messy Sources list (generic titles like "Google", duplicate entries). Fix them in step 8.
|
|
@@ -322,6 +322,8 @@ coauthor draft revise <id> --instruction "Cut the intro to two sentences and lea
|
|
|
322
322
|
- While a revision runs, up to 100 available credits are temporarily held for its steps. Only actual usage is charged; unused held credits are released when it finishes or stops. A hold is included in `coauthor credits <id> --json` and does not change the request's spending limit.
|
|
323
323
|
- A revision that ends without a result (it failed, or didn't finish within 12 minutes and was closed) has the credits it used refunded automatically. A revision you cancel is not refunded.
|
|
324
324
|
- `revise_unavailable` means this account cannot revise by instruction yet; use a direct edit.
|
|
325
|
+
- `draft revise` targets whatever version is saved when it starts, and retries once by itself if a save lands at the same moment. A `stale_draft` after that names `details.base_version` and the command to re-read the draft.
|
|
326
|
+
- When `draft revise` is refused, the error's `code` and `details.reason` say why. `editor_context_too_large` will not clear on retry (the project's research and recent editor messages are over the editor's size limit), so make the change with a direct edit.
|
|
325
327
|
|
|
326
328
|
### 2. Direct edit (exact text you already have)
|
|
327
329
|
|
|
@@ -741,12 +743,17 @@ Every failure prints JSON on stderr with `ok: false`, `error` (a readable messag
|
|
|
741
743
|
| `draft_exists` | `brief answer` on a project that already has a draft. | Edit the draft instead. `--force` only if the user wants to restart from the brief (the draft is regenerated). |
|
|
742
744
|
| `downstream_exists` | `outline revise` or `research-plan revise` after research ran. | Same: edit the draft, or `--force` to restart from that stage with the user's OK. |
|
|
743
745
|
| `outline_generation_failed` | `outline generate` (or `workflow run`/`advance` reaching the outline) couldn't produce an outline. Nothing was saved; the current outline is unchanged. | Retry once after a minute. If it fails again, tell the user; never write a generic outline yourself and approve it. |
|
|
746
|
+
| `research_plan_stale` | `research-plan approve` on a plan made before the outline changed, with no tasks for some current sections. | `coauthor research-plan generate <id> --json`, review it, then approve. |
|
|
744
747
|
| `revision_invalid` | CoAuthor's revision referenced sections that don't exist. | Run `revise` again with feedback that names sections by their current headings. |
|
|
745
748
|
| `stale_draft` | The draft changed after you read it. | Re-read with `draft get`, reapply your edit, save. |
|
|
746
749
|
| `user_recently_editing` | The user saved in the browser in the last 90 seconds. | Wait, or ask them. `--force` only with their OK. |
|
|
747
750
|
| `review_pending`, `document_locked` | An AI review or edit is in progress in the editor. | Wait, or apply or discard it. |
|
|
748
751
|
| `revision_pending` | Another draft revision is open. | Apply or discard it (`details.revision_id`). An agent revision left in review is discarded automatically at `details.expires_at`. |
|
|
749
752
|
| `revise_unavailable` | Revise by instruction isn't available on this account. | Use a direct edit (`references/editing-drafts.md`). |
|
|
753
|
+
| `editor_context_too_large` | `draft revise` refused: the project's research, sources, reference documents and recent editor messages are over the editor's size limit (`details.request_context_bytes`, `details.limit_bytes`). Retrying won't help. | Make the change with a direct edit (`references/editing-drafts.md`). |
|
|
754
|
+
| `editor_history_invalid` | `draft revise` refused because an earlier message in the draft's editor conversation has an attachment the editor can no longer read. | Use a direct edit and tell the user. |
|
|
755
|
+
| `project_changed` | Another step started or finished on the project while a revision was being set up. | Run `coauthor workflow status <id> --json`, then retry once. |
|
|
756
|
+
| `invalid_request` with `details.reason` | The editor rejected the request; `details.reason` names the check. | Don't retry the same request. Report `details.reason` and use a direct edit. |
|
|
750
757
|
| `invalid_document` | `draft save` content isn't an editor document. | Send the edited `data.content` from `draft get --format json`, never markdown. |
|
|
751
758
|
| `workflow_token_mismatch`, `conflict` | The project moved on since you read it (for example someone used the web app). | Re-read the state with `coauthor workflow status <id> --json` and continue from there. |
|
|
752
759
|
| `insufficient_scope` | The token can't publish. | `coauthor auth login --with-publish`. |
|