@clickminded/coauthor-cli 0.0.43 → 0.0.45

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/README.md CHANGED
@@ -46,6 +46,7 @@ A typical piece:
46
46
 
47
47
  ```sh
48
48
  coauthor profile list --json # pick the writer profile (voice, context, image style)
49
+ coauthor site status --json # SEO mode: the profile website's page index (limited rollout)
49
50
  coauthor project create --title "Post title" --contract @brief.json --profile <profile id> --json
50
51
  coauthor source add <id> notes.pdf --json # optional reference documents, before research
51
52
  coauthor workflow run <id> --target contract --briefing-mode strict --json # CoAuthor questions the brief
package/dist/commands.js CHANGED
@@ -37,6 +37,8 @@ export async function runCommand(input, context) {
37
37
  return runLogCommand(action, input, context.client);
38
38
  if (scope === 'profile')
39
39
  return runProfileCommand(action, input, context.client);
40
+ if (scope === 'site')
41
+ return runSiteCommand(action, input, context.client);
40
42
  if (scope === 'integrations')
41
43
  return { ok: true, data: await context.client.request({ path: 'integrations' }) };
42
44
  if (scope === 'source')
@@ -1852,6 +1854,48 @@ async function runProfileCommand(action, input, client) {
1852
1854
  }
1853
1855
  throw new Error('Usage: coauthor profile <list|show>');
1854
1856
  }
1857
+ function siteMessage(data, request) {
1858
+ const site = getResponseValue(data, 'site');
1859
+ if (!site)
1860
+ return 'This profile has no website. Add one to the profile in the CoAuthor web app.';
1861
+ const origin = typeof site.origin === 'string' ? site.origin : 'The site';
1862
+ if (request === 'queued')
1863
+ return `Reindexing ${origin}. Check progress with \`coauthor site status\`.`;
1864
+ if (request === 'already_indexing')
1865
+ return `${origin} is already being indexed.`;
1866
+ const pages = typeof site.indexed_pages === 'number' ? site.indexed_pages : 0;
1867
+ const when = typeof site.last_indexed_at === 'string' ? ` (last indexed ${site.last_indexed_at.slice(0, 10)})` : '';
1868
+ if (site.status === 'ready')
1869
+ return `${origin}: ${pages} page${pages === 1 ? '' : 's'} indexed${when}.`;
1870
+ if (site.status === 'indexing')
1871
+ return `${origin} is being indexed now.`;
1872
+ if (site.status === 'blocked')
1873
+ return `${origin} could not be read: no readable sitemap, or the site blocks crawlers${pages ? `. ${pages} page${pages === 1 ? '' : 's'} known from search data` : ''}.`;
1874
+ if (site.status === 'failed')
1875
+ return `The last index of ${origin} failed. Try \`coauthor site reindex\`.`;
1876
+ return `${origin} has not been indexed yet.`;
1877
+ }
1878
+ // SEO mode (limited rollout): the site index behind a profile's website, which
1879
+ // internal links and own-site evidence read. Defaults to the default profile.
1880
+ async function runSiteCommand(action, input, client) {
1881
+ if (action && !['status', 'reindex'].includes(action))
1882
+ throw new Error('Usage: coauthor site <status|reindex> [--profile <profile-id>]');
1883
+ let profileId = getString(input.values, 'profile') ?? input.positionals[0];
1884
+ if (!profileId) {
1885
+ const profiles = await client.request({ path: 'profiles' });
1886
+ const fallback = getResponseValue(profiles, 'default_profile_id');
1887
+ if (typeof fallback !== 'string' || !fallback)
1888
+ throw new Error('No writer profile found. Create one in the CoAuthor web app.');
1889
+ profileId = fallback;
1890
+ }
1891
+ const path = `profiles/${encodeURIComponent(profileId)}/site`;
1892
+ if (action === 'reindex') {
1893
+ const data = await client.request({ method: 'POST', path: `${path}/reindex`, body: {} });
1894
+ return { ok: true, message: siteMessage(data, getResponseValue(data, 'request')), data };
1895
+ }
1896
+ const data = await client.request({ path });
1897
+ return { ok: true, message: siteMessage(data), data };
1898
+ }
1855
1899
  const SOURCE_TYPES = { pdf: 'application/pdf', txt: 'text/plain', md: 'text/markdown', markdown: 'text/markdown' };
1856
1900
  // Mirrors the server: base64 over the API caps PDFs at ~3.3 MB; text at 512 KB.
1857
1901
  const MAX_SOURCE_PDF_BYTES = 3_300_000;
@@ -2650,6 +2694,7 @@ export function helpResult(command = []) {
2650
2694
  ' repurpose list|generate|show|save|status|render|download',
2651
2695
  ' brief review|answer',
2652
2696
  ' profile list|show',
2697
+ ' site status|reindex [--profile <profile-id>] (limited rollout)',
2653
2698
  ' source list|add|remove',
2654
2699
  ' integrations list',
2655
2700
  ' log add|show',
@@ -2754,6 +2799,14 @@ function commandHelp(command) {
2754
2799
  '',
2755
2800
  'Writer profiles hold the voice, writer and business context, and visual style. New projects use the default (most recently used) profile unless you pass --profile to project create. A project keeps its profile for good.',
2756
2801
  ].join('\n'),
2802
+ site: [
2803
+ 'Usage: coauthor site status [--profile <profile-id>] [--json]',
2804
+ ' coauthor site reindex [--profile <profile-id>] [--json]',
2805
+ '',
2806
+ 'SEO mode (limited rollout). CoAuthor reads the website on a writer profile from its sitemap (up to 500 recent pages) to link new posts to it and cite its own pages as evidence.',
2807
+ 'status shows the website, its index status (pending, indexing, ready, blocked, failed) and how many pages are indexed. Without --profile it uses the default profile.',
2808
+ 'reindex starts a fresh read (free). It answers already_indexing during a crawl and reindex_too_soon within 15 minutes of the last one; no_website when the profile has no website.',
2809
+ ].join('\n'),
2757
2810
  integrations: [
2758
2811
  'Usage: coauthor integrations list [--json]',
2759
2812
  '',
package/dist/parser.js CHANGED
@@ -177,6 +177,8 @@ function commandLength(positionals) {
177
177
  return second && ['add', 'show'].includes(second) ? 2 : 1;
178
178
  if (first === 'profile')
179
179
  return second && ['list', 'show'].includes(second) ? 2 : 1;
180
+ if (first === 'site')
181
+ return second && ['status', 'reindex'].includes(second) ? 2 : 1;
180
182
  if (first === 'integrations')
181
183
  return second === 'list' ? 2 : 1;
182
184
  if (first === 'source')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clickminded/coauthor-cli",
3
- "version": "0.0.43",
3
+ "version": "0.0.45",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "coauthor": "dist/index.js",
@@ -13,6 +13,7 @@ All fields are optional and omitted ones get defaults, but always include at lea
13
13
  ## Profiles and source documents
14
14
 
15
15
  - `coauthor profile list --json` shows the user's writer profiles: `is_default` marks the one new projects get without `--profile`, plus a `summary` and the `visual_style`. `coauthor profile show <profile id> --json` shows the voice, writer context, and business context in full, plus the profile's `website` and `search_country` (null until set in the web app; the search language follows the language each post is written in). Pass `--profile <id>` to `project create`; the profile can't be changed later, so pick deliberately. Profiles are created and edited in the web app (`manage_url`).
16
+ - `coauthor site status [--profile <id>] --json` (SEO mode, limited rollout) shows how much of the profile's website CoAuthor has read (`site.status`: pending, indexing, ready, blocked, failed; `site.indexed_pages`). SEO posts link to those pages and cite them as evidence. `coauthor site reindex` refreshes it after the user publishes new pages; it is free and needs no confirmation.
16
17
  - `coauthor source add <id> <file>` uploads a reference document CoAuthor's research reads (PDF up to about 3.3 MB through the CLI, .txt or .md up to 512 KB, 5 per project). `coauthor source list <id> --json` shows them; `coauthor source remove <id> <source id> --yes` deletes one.
17
18
  - Add sources before research runs. Adding or removing one after research marks the research and draft stale (the output says `research_invalidated`), so research has to run again.
18
19
 
@@ -24,6 +24,8 @@ coauthor post-details set <id> --seo-title "..." --description "..." --slug "...
24
24
 
25
25
  `set` changes only the fields you pass; an empty value clears one. Fields the user or you edited are kept when the draft is regenerated. Keep the SEO title near 60 characters and the description near 155. `post_details_unavailable` means the draft predates post details.
26
26
 
27
+ For SEO posts on a profile with a website, `post_details.incoming_link_suggestions` lists existing pages on the user's site that could link to the new post: `{status, suggestions: [{url, title, anchor, sentence}]}`. `status` is `ready`, `none`, or `index_not_ready` (the site was still being indexed when the draft was written; links appear on the next post). It is read-only. After the post is published, offer the user the sentences to add on those pages, linking the anchor text to the new post's URL. It is `null` for other posts.
28
+
27
29
  ## Share link (public)
28
30
 
29
31
  `coauthor share <id> --json` returns `data.share_url`, a public read-only page anyone with the link can open. Create one only when the user asks for a link. Calling it again returns the same link.
@@ -30,7 +30,10 @@ Every failure prints JSON on stderr with `ok: false`, `error` (a readable messag
30
30
  | `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. |
31
31
  | `insufficient_scope` | The token can't publish. | `coauthor auth login --with-publish`. |
32
32
  | `wordpress_connection_required` | Several WordPress sites are connected. | Ask which one from `details.connections`, add `--connection-id`. |
33
- | `feature_unavailable` | SEO targeting (`search-brief`, `project create --keyword`) isn't enabled for this account yet, or search data is temporarily unavailable. | Continue without a target keyword; the post is written as usual. |
33
+ | `feature_unavailable` | SEO features (`search-brief`, `project create --keyword`, `site`) aren't enabled for this account yet, or search data is temporarily unavailable. | Continue without a target keyword; the post is written as usual. |
34
+ | `no_website` | `site status`/`site reindex` on a profile with no website. | Ask the user to add their website to the profile in the web app. |
35
+ | `reindex_too_soon` | `site reindex` within 15 minutes of the last read. | Wait, or check `coauthor site status`. |
36
+ | `site_index_unavailable` | The site reader couldn't be reached. | Try again later; posts are still written, just without new internal links. |
34
37
  | `seo_not_applicable` | The project was created before SEO mode launched. | Create a new project with `--keyword`. |
35
38
  | `confirmation_required` | `search-brief set-keyword` on a project that already has an outline. | Tell the user the outline, research and draft will be regenerated; with their OK, repeat with `--confirm-reset`. |
36
39
  | `invalid_keyword` | The keyword is empty or longer than 200 characters. | Pass a plain search phrase. |
@@ -92,6 +92,7 @@ All fields are optional and omitted ones get defaults, but always include at lea
92
92
  ### Profiles and source documents
93
93
 
94
94
  - `coauthor profile list --json` shows the user's writer profiles: `is_default` marks the one new projects get without `--profile`, plus a `summary` and the `visual_style`. `coauthor profile show <profile id> --json` shows the voice, writer context, and business context in full, plus the profile's `website` and `search_country` (null until set in the web app; the search language follows the language each post is written in). Pass `--profile <id>` to `project create`; the profile can't be changed later, so pick deliberately. Profiles are created and edited in the web app (`manage_url`).
95
+ - `coauthor site status [--profile <id>] --json` (SEO mode, limited rollout) shows how much of the profile's website CoAuthor has read (`site.status`: pending, indexing, ready, blocked, failed; `site.indexed_pages`). SEO posts link to those pages and cite them as evidence. `coauthor site reindex` refreshes it after the user publishes new pages; it is free and needs no confirmation.
95
96
  - `coauthor source add <id> <file>` uploads a reference document CoAuthor's research reads (PDF up to about 3.3 MB through the CLI, .txt or .md up to 512 KB, 5 per project). `coauthor source list <id> --json` shows them; `coauthor source remove <id> <source id> --yes` deletes one.
96
97
  - Add sources before research runs. Adding or removing one after research marks the research and draft stale (the output says `research_invalidated`), so research has to run again.
97
98
 
@@ -403,6 +404,8 @@ coauthor post-details set <id> --seo-title "..." --description "..." --slug "...
403
404
 
404
405
  `set` changes only the fields you pass; an empty value clears one. Fields the user or you edited are kept when the draft is regenerated. Keep the SEO title near 60 characters and the description near 155. `post_details_unavailable` means the draft predates post details.
405
406
 
407
+ For SEO posts on a profile with a website, `post_details.incoming_link_suggestions` lists existing pages on the user's site that could link to the new post: `{status, suggestions: [{url, title, anchor, sentence}]}`. `status` is `ready`, `none`, or `index_not_ready` (the site was still being indexed when the draft was written; links appear on the next post). It is read-only. After the post is published, offer the user the sentences to add on those pages, linking the anchor text to the new post's URL. It is `null` for other posts.
408
+
406
409
  ### Share link (public)
407
410
 
408
411
  `coauthor share <id> --json` returns `data.share_url`, a public read-only page anyone with the link can open. Create one only when the user asks for a link. Calling it again returns the same link.
@@ -545,7 +548,10 @@ Every failure prints JSON on stderr with `ok: false`, `error` (a readable messag
545
548
  | `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. |
546
549
  | `insufficient_scope` | The token can't publish. | `coauthor auth login --with-publish`. |
547
550
  | `wordpress_connection_required` | Several WordPress sites are connected. | Ask which one from `details.connections`, add `--connection-id`. |
548
- | `feature_unavailable` | SEO targeting (`search-brief`, `project create --keyword`) isn't enabled for this account yet, or search data is temporarily unavailable. | Continue without a target keyword; the post is written as usual. |
551
+ | `feature_unavailable` | SEO features (`search-brief`, `project create --keyword`, `site`) aren't enabled for this account yet, or search data is temporarily unavailable. | Continue without a target keyword; the post is written as usual. |
552
+ | `no_website` | `site status`/`site reindex` on a profile with no website. | Ask the user to add their website to the profile in the web app. |
553
+ | `reindex_too_soon` | `site reindex` within 15 minutes of the last read. | Wait, or check `coauthor site status`. |
554
+ | `site_index_unavailable` | The site reader couldn't be reached. | Try again later; posts are still written, just without new internal links. |
549
555
  | `seo_not_applicable` | The project was created before SEO mode launched. | Create a new project with `--keyword`. |
550
556
  | `confirmation_required` | `search-brief set-keyword` on a project that already has an outline. | Tell the user the outline, research and draft will be regenerated; with their OK, repeat with `--confirm-reset`. |
551
557
  | `invalid_keyword` | The keyword is empty or longer than 200 characters. | Pass a plain search phrase. |