@workover/cli 0.13.0 → 0.14.4
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 +34 -1
- package/bin/workover.mjs +143 -64
- package/lib.mjs +164 -11
- package/package.json +2 -1
- package/skill/SKILL.md +64 -0
package/README.md
CHANGED
|
@@ -18,7 +18,8 @@ workover login --write # ...and also allow direct edits, with no suggestions
|
|
|
18
18
|
workover login --rules # ...and also allow changing the style guide
|
|
19
19
|
workover projects # the projects you can reach, with their ids
|
|
20
20
|
workover doc list --project 11
|
|
21
|
-
workover doc
|
|
21
|
+
workover doc get https://workover.io/app/acme/docs/<id> # a document, from its link
|
|
22
|
+
workover doc read 1234 # ...or its UUID, or its number
|
|
22
23
|
workover rules list --project 11 # the style guide agents should write by
|
|
23
24
|
workover comments list 1234 # the feedback people left on a document
|
|
24
25
|
workover doc images 1234 # image file names and alt text (set them with `doc image`)
|
|
@@ -40,6 +41,38 @@ Whatever you grant, a token can never change your account security, your billing
|
|
|
40
41
|
|
|
41
42
|
## Working on documents
|
|
42
43
|
|
|
44
|
+
**Any command that takes a document takes its link.** Paste the URL from the browser
|
|
45
|
+
(`https://workover.io/app/<workspace>/docs/<id>`, with or without anything after it), the UUID at
|
|
46
|
+
the end of it, or the number `doc list` prints (`1234` or `#1234`). `doc get` and `doc edit` are
|
|
47
|
+
the same as `doc read` and `doc write`.
|
|
48
|
+
|
|
49
|
+
```sh
|
|
50
|
+
workover doc get https://workover.io/app/acme/docs/7cd7e9ec-28af-4a2a-bb7c-668548380a08
|
|
51
|
+
workover doc edit https://workover.io/app/acme/docs/7cd7e9ec-28af-4a2a-bb7c-668548380a08 --file new.md
|
|
52
|
+
workover comments list 7cd7e9ec-28af-4a2a-bb7c-668548380a08
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
A link that the signed-in account cannot open says so ("not found, or no access"), and a
|
|
56
|
+
`workover.dev` link used with a production sign-in names the environment rather than reporting a
|
|
57
|
+
missing document.
|
|
58
|
+
|
|
59
|
+
`WORKOVER_CONFIG=/path/to/config.json` uses a different sign-in file, so a second environment can
|
|
60
|
+
be used without replacing the one in `~/.workover`. The MCP server reads it too.
|
|
61
|
+
|
|
62
|
+
## Claude Code
|
|
63
|
+
|
|
64
|
+
```sh
|
|
65
|
+
workover install-claude
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
installs a `workover` skill into `~/.claude/skills`. Claude Code lists skills to the model by their
|
|
69
|
+
description, so a pasted Workover link is matched to it and the agent runs `workover doc get <link>`
|
|
70
|
+
rather than writing its own client around the token file. For the tools as well (all projects):
|
|
71
|
+
|
|
72
|
+
```sh
|
|
73
|
+
claude mcp add --scope user workover -- npx -y @workover/mcp@latest
|
|
74
|
+
```
|
|
75
|
+
|
|
43
76
|
`workover doc` is the whole document surface, so signing in and then doing something with a document
|
|
44
77
|
are the same tool. Bodies come from `--file`, or from stdin:
|
|
45
78
|
|
package/bin/workover.mjs
CHANGED
|
@@ -13,15 +13,16 @@ import {
|
|
|
13
13
|
writeFileSync,
|
|
14
14
|
mkdirSync,
|
|
15
15
|
existsSync,
|
|
16
|
-
chmodSync,
|
|
17
16
|
rmSync,
|
|
18
17
|
} from 'fs';
|
|
19
18
|
import { homedir } from 'os';
|
|
20
|
-
import { join } from 'path';
|
|
19
|
+
import { dirname, join } from 'path';
|
|
21
20
|
import { spawn } from 'child_process';
|
|
21
|
+
import { fileURLToPath } from 'url';
|
|
22
22
|
import {
|
|
23
23
|
normalizeApi,
|
|
24
24
|
browserCommand,
|
|
25
|
+
writePrivateFile,
|
|
25
26
|
pollDecision,
|
|
26
27
|
summariseEvaluations,
|
|
27
28
|
parseArgs,
|
|
@@ -32,7 +33,9 @@ import {
|
|
|
32
33
|
renderRulesBlock,
|
|
33
34
|
threadComments,
|
|
34
35
|
docRef,
|
|
36
|
+
environmentMismatch,
|
|
35
37
|
imagesInHtml,
|
|
38
|
+
signInHelp,
|
|
36
39
|
} from '../lib.mjs';
|
|
37
40
|
|
|
38
41
|
/*
|
|
@@ -49,14 +52,13 @@ import {
|
|
|
49
52
|
* https://api.workover.test for local dev).
|
|
50
53
|
*/
|
|
51
54
|
const API = normalizeApi(process.env.WORKOVER_API || 'https://api.workover.io');
|
|
52
|
-
|
|
53
|
-
|
|
55
|
+
// WORKOVER_CONFIG points the CLI at another sign-in file, so a second environment (staging, a PR
|
|
56
|
+
// preview) can be used without replacing the one in ~/.workover. The MCP server reads the same
|
|
57
|
+
// variable, so both see the same sign-in.
|
|
58
|
+
const CONFIG_FILE = process.env.WORKOVER_CONFIG || join(homedir(), '.workover', 'config.json');
|
|
54
59
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
writeFileSync(CONFIG_FILE, JSON.stringify(cfg, null, 2));
|
|
58
|
-
chmodSync(CONFIG_FILE, 0o600); // owner read/write only — it holds a bearer token
|
|
59
|
-
};
|
|
60
|
+
// Owner read/write only, from the first byte — it holds a bearer token (see writePrivateFile).
|
|
61
|
+
const saveConfig = (cfg) => writePrivateFile(CONFIG_FILE, JSON.stringify(cfg, null, 2));
|
|
60
62
|
const loadConfig = () => {
|
|
61
63
|
try {
|
|
62
64
|
return JSON.parse(readFileSync(CONFIG_FILE, 'utf8'));
|
|
@@ -66,7 +68,9 @@ const loadConfig = () => {
|
|
|
66
68
|
};
|
|
67
69
|
|
|
68
70
|
const openBrowser = (url) => {
|
|
69
|
-
const
|
|
71
|
+
const command = browserCommand(process.platform, url);
|
|
72
|
+
if (!command) return; // not an http(s) URL — it is printed anyway
|
|
73
|
+
const { cmd, args } = command;
|
|
70
74
|
try {
|
|
71
75
|
spawn(cmd, args, { stdio: 'ignore', detached: true }).unref();
|
|
72
76
|
} catch {
|
|
@@ -129,7 +133,7 @@ const flagValue = (name) => {
|
|
|
129
133
|
const requireSignIn = (hint) => {
|
|
130
134
|
const cfg = loadConfig();
|
|
131
135
|
if (!cfg?.token) {
|
|
132
|
-
console.log(
|
|
136
|
+
console.log(signInHelp(hint, CONFIG_FILE));
|
|
133
137
|
process.exit(1);
|
|
134
138
|
}
|
|
135
139
|
return cfg;
|
|
@@ -230,8 +234,27 @@ async function login() {
|
|
|
230
234
|
async function logout() {
|
|
231
235
|
const cfg = loadConfig();
|
|
232
236
|
if (cfg?.token) {
|
|
233
|
-
|
|
234
|
-
|
|
237
|
+
/*
|
|
238
|
+
* Revoke on the api this sign-in BELONGS to, which login recorded as `cfg.api`.
|
|
239
|
+
*
|
|
240
|
+
* This used to post to WORKOVER_API, defaulting to production. So signing out of a staging or
|
|
241
|
+
* PR-preview sign-in (WORKOVER_CONFIG pointing at its own file, WORKOVER_API unset in the new
|
|
242
|
+
* shell) sent the token to production, which did not know it, and the real token stayed valid
|
|
243
|
+
* on the api that issued it while the local file was deleted and "Signed out." was printed.
|
|
244
|
+
* Possessing the token authorizes revoking it; best-effort, but no longer silent when it fails.
|
|
245
|
+
*/
|
|
246
|
+
const base = cfg.api ? normalizeApi(cfg.api) : API;
|
|
247
|
+
const revoked = await fetch(`${base}/cli-auth/logout`, {
|
|
248
|
+
method: 'POST',
|
|
249
|
+
headers: { 'content-type': 'application/json' },
|
|
250
|
+
body: JSON.stringify({ token: cfg.token }),
|
|
251
|
+
})
|
|
252
|
+
.then((res) => res.ok)
|
|
253
|
+
.catch(() => false);
|
|
254
|
+
if (!revoked) {
|
|
255
|
+
console.log(` ! Could not reach ${base} to revoke this device's token.`);
|
|
256
|
+
console.log(' It is removed from this computer; it stops working when it expires.');
|
|
257
|
+
}
|
|
235
258
|
}
|
|
236
259
|
if (existsSync(CONFIG_FILE)) rmSync(CONFIG_FILE);
|
|
237
260
|
console.log(' Signed out.');
|
|
@@ -602,15 +625,6 @@ const readBody = async (flags) => {
|
|
|
602
625
|
};
|
|
603
626
|
|
|
604
627
|
/** A document id from the first positional argument, or a usage error naming what to pass. */
|
|
605
|
-
const docIdArg = (positionals, usage) => {
|
|
606
|
-
const id = rowId(positionals[0]);
|
|
607
|
-
if (id === null) {
|
|
608
|
-
console.log(`\n Usage: ${usage}`);
|
|
609
|
-
console.log(' The numeric document id — `workover doc list` prints it as "#123".\n');
|
|
610
|
-
process.exit(1);
|
|
611
|
-
}
|
|
612
|
-
return id;
|
|
613
|
-
};
|
|
614
628
|
|
|
615
629
|
/**
|
|
616
630
|
* What the api said about house style after a write, printed to STDERR.
|
|
@@ -752,32 +766,36 @@ const DOC_USAGE = [
|
|
|
752
766
|
' Usage: workover doc <command>',
|
|
753
767
|
'',
|
|
754
768
|
' list --project <id> [--json] documents in a project',
|
|
755
|
-
' tabs <
|
|
756
|
-
' tab-new <
|
|
769
|
+
' tabs <doc> [--json] the document’s tabs',
|
|
770
|
+
' tab-new <doc> --title "<t>" add an empty tab',
|
|
757
771
|
' [--parent <tabId>]',
|
|
758
|
-
' read <
|
|
772
|
+
' read <doc> [--json] [--html] a document’s current text',
|
|
759
773
|
' [--tab <tabId>] one tab of it',
|
|
760
774
|
' create --project <id> --title "<t>" a new document, content written in',
|
|
761
775
|
' [--file <path> | piped stdin] [--json]',
|
|
762
|
-
' propose <
|
|
776
|
+
' propose <doc> [--note "<why>"] suggest a rewrite for review',
|
|
763
777
|
' [--file <path> | piped stdin] [--json] [--tab <tabId>]',
|
|
764
778
|
' [--why "<what was wrong>"] recorded as its reasoning',
|
|
765
|
-
' write <
|
|
779
|
+
' write <doc> [--note "<why>"] REPLACE the body, no review step',
|
|
766
780
|
' [--file <path> | piped stdin] [--json] [--tab <tabId>]',
|
|
767
781
|
' needs `workover login --write`; use it only when asked to',
|
|
768
|
-
' reshoot <
|
|
782
|
+
' reshoot <doc> [--replace] [--write] Workover AI retakes the screenshots',
|
|
769
783
|
' from the text; --replace drops the old ones; applied as',
|
|
770
784
|
' suggestions, or directly with --write. Needs `login --draft`',
|
|
771
|
-
' verify <
|
|
785
|
+
' verify <doc> [--write] Workover AI checks the text against',
|
|
772
786
|
' the linked repository and corrects what it finds wrong;',
|
|
773
787
|
' applied as suggestions, or directly with --write. Needs',
|
|
774
788
|
' `login --draft`',
|
|
775
|
-
' images <doc> [--tab <tabId>] [--json]
|
|
776
|
-
' image <doc> <n | --src <url>>
|
|
789
|
+
' images <doc> [--tab <tabId>] [--json] the images in it: file name, alt',
|
|
790
|
+
' image <doc> <n | --src <url>> set an image’s file name and/or',
|
|
777
791
|
' [--name <file>] [--alt "<text>"] alt text; needs `login --write`',
|
|
778
792
|
' [--tab <tabId>]',
|
|
779
793
|
' search "<query>" [--limit N] [--json] find documents by title/content',
|
|
780
|
-
' activity <
|
|
794
|
+
' activity <doc> [--limit N] [--json] who changed this document, and how',
|
|
795
|
+
'',
|
|
796
|
+
' <doc> is the document link as the browser shows it',
|
|
797
|
+
' (https://workover.io/app/<workspace>/docs/<id>), the id at the end of it, or',
|
|
798
|
+
' the number `doc list` prints. `get` and `edit` work as `read` and `write`.',
|
|
781
799
|
'',
|
|
782
800
|
' `workover projects` lists the project ids.',
|
|
783
801
|
'',
|
|
@@ -794,29 +812,59 @@ const DOC_USAGE = [
|
|
|
794
812
|
' lists or change bullet markers.',
|
|
795
813
|
'',
|
|
796
814
|
' Tabs: a document can hold several separate bodies. read and write act on ONE',
|
|
797
|
-
' of them, so run `workover doc tabs <
|
|
815
|
+
' of them, so run `workover doc tabs <doc>` first and pass --tab; without it',
|
|
798
816
|
' you get the main body, which on a multi-tab document is not the whole thing.',
|
|
799
817
|
'',
|
|
800
818
|
].join('\n');
|
|
801
819
|
|
|
802
820
|
/**
|
|
803
|
-
* The document a `<doc>` argument names
|
|
804
|
-
*
|
|
821
|
+
* The document a `<doc>` argument names, as a row id.
|
|
822
|
+
*
|
|
823
|
+
* Takes what people actually have: the URL out of the browser, the UUID in it, or the number
|
|
824
|
+
* `doc list` prints. A URL or UUID is resolved through `GET /project/doc/by-handle/<uuid>`, which
|
|
825
|
+
* applies the same access rules as reading the document by id. Every failure says what to do next,
|
|
826
|
+
* because an agent handed a link that "does not work" will otherwise go looking for another way in.
|
|
805
827
|
*/
|
|
806
828
|
const resolveDocArg = async (cfg, positionals, usage) => {
|
|
807
829
|
const ref = docRef(positionals[0]);
|
|
808
830
|
if (!ref) {
|
|
809
831
|
console.log(`\n Usage: ${usage}`);
|
|
810
|
-
console.log('
|
|
832
|
+
console.log(' <doc> is the document link (https://workover.io/app/<workspace>/docs/<id>),');
|
|
833
|
+
console.log(' the id at the end of it, or the number `workover doc list` prints ("#123").\n');
|
|
834
|
+
process.exit(1);
|
|
835
|
+
}
|
|
836
|
+
const mismatch = environmentMismatch(ref, cfg.api);
|
|
837
|
+
if (mismatch) {
|
|
838
|
+
console.error(`\n ✗ ${mismatch}\n`);
|
|
811
839
|
process.exit(1);
|
|
812
840
|
}
|
|
813
841
|
if (ref.id) return ref.id;
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
842
|
+
|
|
843
|
+
let res;
|
|
844
|
+
try {
|
|
845
|
+
res = await fetch(`${cfg.api}/project/doc/by-handle/${encodeURIComponent(ref.handle)}`, {
|
|
846
|
+
headers: { authorization: `Bearer ${cfg.token}` },
|
|
847
|
+
});
|
|
848
|
+
} catch {
|
|
849
|
+
console.error(`\n ✗ Couldn't reach Workover at ${cfg.api}\n`);
|
|
817
850
|
process.exit(1);
|
|
818
851
|
}
|
|
819
|
-
|
|
852
|
+
if (res.ok) {
|
|
853
|
+
const doc = await res.json().catch(() => null);
|
|
854
|
+
if (doc?.id) return doc.id;
|
|
855
|
+
}
|
|
856
|
+
const where = new URL(cfg.api).host;
|
|
857
|
+
const why =
|
|
858
|
+
res.status === 401
|
|
859
|
+
? 'Your Workover sign-in has expired or was revoked. Run `workover login`.'
|
|
860
|
+
: res.status === 410
|
|
861
|
+
? 'That document is in the Trash. Restore it in Workover first.'
|
|
862
|
+
: res.status === 403 || res.status === 404
|
|
863
|
+
? `No document at that link that this sign-in can open (${where}). Either it does not exist, ` +
|
|
864
|
+
'or this account has no access to it: ask its owner to share it, or check `workover whoami`.'
|
|
865
|
+
: `Workover answered ${res.status} resolving that link.`;
|
|
866
|
+
console.error(`\n ✗ ${why}\n`);
|
|
867
|
+
process.exit(1);
|
|
820
868
|
};
|
|
821
869
|
|
|
822
870
|
/**
|
|
@@ -921,7 +969,8 @@ async function imagesCommand(cfg, sub, positionals, flags, tabId, asJson) {
|
|
|
921
969
|
}
|
|
922
970
|
|
|
923
971
|
async function docCommand() {
|
|
924
|
-
|
|
972
|
+
// `get` and `edit` are what people (and agents) guess first; they are `read` and `write`.
|
|
973
|
+
const sub = { get: 'read', edit: 'write' }[process.argv[3]] || process.argv[3];
|
|
925
974
|
// Usage before sign-in: someone who typed the command wrong is asking what the commands are, and
|
|
926
975
|
// answering "not signed in" sends them to fix the wrong thing.
|
|
927
976
|
if (
|
|
@@ -954,7 +1003,7 @@ async function docCommand() {
|
|
|
954
1003
|
// what every one of these commands meant before tabs were addressable.
|
|
955
1004
|
const tabId = flags.tab == null ? null : rowId(flags.tab);
|
|
956
1005
|
if (flags.tab != null && tabId === null) {
|
|
957
|
-
console.log(`\n ✗ --tab must be a tab id. List them: workover doc tabs <
|
|
1006
|
+
console.log(`\n ✗ --tab must be a tab id. List them: workover doc tabs <doc>\n`);
|
|
958
1007
|
process.exit(1);
|
|
959
1008
|
}
|
|
960
1009
|
|
|
@@ -969,7 +1018,7 @@ async function docCommand() {
|
|
|
969
1018
|
};
|
|
970
1019
|
|
|
971
1020
|
if (sub === 'tabs') {
|
|
972
|
-
const docId =
|
|
1021
|
+
const docId = await resolveDocArg(cfg, positionals, 'workover doc tabs <doc>');
|
|
973
1022
|
const tabs = (await authedCall(cfg, `/project/doc/${docId}/tabs`)) || [];
|
|
974
1023
|
if (asJson) return console.log(JSON.stringify(tabs, null, 2));
|
|
975
1024
|
if (!tabs.length) {
|
|
@@ -995,8 +1044,8 @@ async function docCommand() {
|
|
|
995
1044
|
}
|
|
996
1045
|
|
|
997
1046
|
if (sub === 'tab-new') {
|
|
998
|
-
const usage = 'workover doc tab-new <
|
|
999
|
-
const docId =
|
|
1047
|
+
const usage = 'workover doc tab-new <doc> --title "<title>" [--parent <tabId>]';
|
|
1048
|
+
const docId = await resolveDocArg(cfg, positionals, usage);
|
|
1000
1049
|
const title = typeof flags.title === 'string' ? flags.title.trim() : '';
|
|
1001
1050
|
if (!title) {
|
|
1002
1051
|
console.log(`\n Usage: ${usage}\n`);
|
|
@@ -1042,7 +1091,7 @@ async function docCommand() {
|
|
|
1042
1091
|
}
|
|
1043
1092
|
|
|
1044
1093
|
if (sub === 'read') {
|
|
1045
|
-
const docId =
|
|
1094
|
+
const docId = await resolveDocArg(cfg, positionals, 'workover doc read <doc>');
|
|
1046
1095
|
const doc = await authedCall(cfg, `/project/doc/${docId}`);
|
|
1047
1096
|
if (!doc?.id) {
|
|
1048
1097
|
console.error(`\n ✗ Document ${docId} not found (or no access).\n`);
|
|
@@ -1163,8 +1212,8 @@ async function docCommand() {
|
|
|
1163
1212
|
|
|
1164
1213
|
if (sub === 'propose') {
|
|
1165
1214
|
const usage =
|
|
1166
|
-
'workover doc propose <
|
|
1167
|
-
const docId =
|
|
1215
|
+
'workover doc propose <doc> --file <path> [--note "<summary>"] [--why "<what was wrong>"]';
|
|
1216
|
+
const docId = await resolveDocArg(cfg, positionals, usage);
|
|
1168
1217
|
const markdown = (await readBody(flags)).trim();
|
|
1169
1218
|
if (!markdown) {
|
|
1170
1219
|
console.log(`\n Usage: ${usage}`);
|
|
@@ -1196,8 +1245,8 @@ async function docCommand() {
|
|
|
1196
1245
|
}
|
|
1197
1246
|
|
|
1198
1247
|
if (sub === 'write') {
|
|
1199
|
-
const usage = 'workover doc write <
|
|
1200
|
-
const docId =
|
|
1248
|
+
const usage = 'workover doc write <doc> --file <path> [--note "<why>"]';
|
|
1249
|
+
const docId = await resolveDocArg(cfg, positionals, usage);
|
|
1201
1250
|
const markdown = (await readBody(flags)).trim();
|
|
1202
1251
|
if (!markdown) {
|
|
1203
1252
|
console.log(`\n Usage: ${usage}`);
|
|
@@ -1230,9 +1279,10 @@ async function docCommand() {
|
|
|
1230
1279
|
// Workover AI plans and captures this document's screenshots from its current text, signed in
|
|
1231
1280
|
// to the workspace's connected app with the stored credential (which never reaches this
|
|
1232
1281
|
// machine). Needs `draft`. The result is applied as suggestions, or written with --write.
|
|
1233
|
-
const docId =
|
|
1282
|
+
const docId = await resolveDocArg(
|
|
1283
|
+
cfg,
|
|
1234
1284
|
positionals,
|
|
1235
|
-
'workover doc reshoot <
|
|
1285
|
+
'workover doc reshoot <doc> [--replace] [--write] [--note "<why>"]',
|
|
1236
1286
|
);
|
|
1237
1287
|
const res = await authedCall(cfg, `/ai/documents/${docId}/screenshots`, {
|
|
1238
1288
|
replace: flags.replace === true,
|
|
@@ -1275,7 +1325,7 @@ async function docCommand() {
|
|
|
1275
1325
|
// Workover AI reads the project's linked repository and corrects what the document gets wrong.
|
|
1276
1326
|
// Nothing is passed in but the id: the corrections have to come from the source, not from us.
|
|
1277
1327
|
// The result is applied as suggestions (or written with --write), like `reshoot`.
|
|
1278
|
-
const docId =
|
|
1328
|
+
const docId = await resolveDocArg(cfg, positionals, 'workover doc verify <doc> [--write] [--note "<why>"]');
|
|
1279
1329
|
// Started in the background and polled: the check reads the repository for minutes, and a
|
|
1280
1330
|
// single request is cut at 100 seconds by Cloudflare (a 524 whose answer never arrives).
|
|
1281
1331
|
let state = await authedCall(cfg, `/ai/documents/${docId}/verify`, {
|
|
@@ -1332,7 +1382,7 @@ async function docCommand() {
|
|
|
1332
1382
|
}
|
|
1333
1383
|
|
|
1334
1384
|
if (sub === 'activity') {
|
|
1335
|
-
const docId =
|
|
1385
|
+
const docId = await resolveDocArg(cfg, positionals, 'workover doc activity <doc>');
|
|
1336
1386
|
const limit = rowId(flags.limit) ?? 20;
|
|
1337
1387
|
const rows = (await authedCall(cfg, `/project/doc/${docId}/activity`)) || [];
|
|
1338
1388
|
const shown = rows.slice(0, limit);
|
|
@@ -1384,16 +1434,16 @@ const COMMENTS_USAGE = [
|
|
|
1384
1434
|
'',
|
|
1385
1435
|
' Usage: workover comments <command>',
|
|
1386
1436
|
'',
|
|
1387
|
-
' list <
|
|
1437
|
+
' list <doc> [--all] [--json] the feedback on a document,',
|
|
1388
1438
|
' open threads only unless --all',
|
|
1389
|
-
' add <
|
|
1439
|
+
' add <doc> "<text>" leave a comment',
|
|
1390
1440
|
' [--to <commentId>] ...as a reply in that thread',
|
|
1391
1441
|
' [--quote "<text>"] ...against the passage it is about',
|
|
1392
1442
|
' resolve <commentId> [--json] mark a thread dealt with',
|
|
1393
1443
|
' reopen <commentId> [--json] put it back',
|
|
1394
1444
|
'',
|
|
1395
1445
|
' Resolve the thread you actually answered, and say what you did first —',
|
|
1396
|
-
' `comments add <
|
|
1446
|
+
' `comments add <doc> --to <commentId> "..."` then `comments resolve`. A',
|
|
1397
1447
|
' thread that closes with no reply tells the person who raised it nothing,',
|
|
1398
1448
|
' and reopening is the only way back.',
|
|
1399
1449
|
'',
|
|
@@ -1446,7 +1496,7 @@ async function commentsCommand() {
|
|
|
1446
1496
|
const commentId = rowId(positionals[0]);
|
|
1447
1497
|
if (commentId === null) {
|
|
1448
1498
|
console.log(`\n Usage: workover comments ${sub} <commentId>`);
|
|
1449
|
-
console.log(' The comment id — `workover comments list <
|
|
1499
|
+
console.log(' The comment id — `workover comments list <doc>` prints it.\n');
|
|
1450
1500
|
process.exit(1);
|
|
1451
1501
|
}
|
|
1452
1502
|
const res = await authedCall(
|
|
@@ -1476,8 +1526,8 @@ async function commentsCommand() {
|
|
|
1476
1526
|
}
|
|
1477
1527
|
|
|
1478
1528
|
if (sub === 'add') {
|
|
1479
|
-
const usage = 'workover comments add <
|
|
1480
|
-
const docId =
|
|
1529
|
+
const usage = 'workover comments add <doc> "<text>" [--to <commentId>]';
|
|
1530
|
+
const docId = await resolveDocArg(cfg, positionals, usage);
|
|
1481
1531
|
// The text is everything after the document id, so an unquoted sentence still arrives whole.
|
|
1482
1532
|
let body = positionals.slice(1).join(' ').trim();
|
|
1483
1533
|
// `--file` only when asked for. `doc` reads piped stdin without being told, which is right for
|
|
@@ -1491,7 +1541,7 @@ async function commentsCommand() {
|
|
|
1491
1541
|
}
|
|
1492
1542
|
const parentId = flags.to == null ? null : rowId(flags.to);
|
|
1493
1543
|
if (flags.to != null && parentId === null) {
|
|
1494
|
-
console.log('\n ✗ --to must be a comment id. List them: workover comments list <
|
|
1544
|
+
console.log('\n ✗ --to must be a comment id. List them: workover comments list <doc>\n');
|
|
1495
1545
|
process.exit(1);
|
|
1496
1546
|
}
|
|
1497
1547
|
const created = await authedCall(cfg, `/project/doc/${docId}/comments`, {
|
|
@@ -1509,7 +1559,7 @@ async function commentsCommand() {
|
|
|
1509
1559
|
}
|
|
1510
1560
|
|
|
1511
1561
|
// list
|
|
1512
|
-
const docId =
|
|
1562
|
+
const docId = await resolveDocArg(cfg, positionals, 'workover comments list <doc>');
|
|
1513
1563
|
const rows = (await authedCall(cfg, `/project/doc/${docId}/comments`)) || [];
|
|
1514
1564
|
const all = threadComments(rows, { includeResolved: true });
|
|
1515
1565
|
const threads = flags.all === true ? all : all.filter((t) => !t.resolved);
|
|
@@ -1569,6 +1619,31 @@ async function projects() {
|
|
|
1569
1619
|
console.log('');
|
|
1570
1620
|
}
|
|
1571
1621
|
|
|
1622
|
+
/**
|
|
1623
|
+
* Teach Claude Code to use Workover: install the `workover` skill into ~/.claude/skills.
|
|
1624
|
+
*
|
|
1625
|
+
* A skill is listed to Claude Code in every session by its description, so a pasted
|
|
1626
|
+
* workover.io/app/.../docs/... link matches it and the agent reaches for these commands instead of
|
|
1627
|
+
* writing its own client around the token file (which is what happened on 2026-10-16, in a project
|
|
1628
|
+
* where the MCP server was not registered and this CLI was not installed).
|
|
1629
|
+
*
|
|
1630
|
+
* The MCP server is a separate, optional step, printed rather than run: registering it changes the
|
|
1631
|
+
* user's Claude Code configuration, and they should see the command that does that.
|
|
1632
|
+
*/
|
|
1633
|
+
function installClaude() {
|
|
1634
|
+
const root = process.env.CLAUDE_CONFIG_DIR || join(homedir(), '.claude');
|
|
1635
|
+
const target = join(root, 'skills', 'workover', 'SKILL.md');
|
|
1636
|
+
const source = join(dirname(fileURLToPath(import.meta.url)), '..', 'skill', 'SKILL.md');
|
|
1637
|
+
mkdirSync(dirname(target), { recursive: true });
|
|
1638
|
+
writeFileSync(target, readFileSync(source, 'utf8'));
|
|
1639
|
+
console.log(`\n \x1b[32m✓\x1b[0m Installed the Workover skill for Claude Code: ${target}`);
|
|
1640
|
+
console.log(' New Claude Code sessions will open a pasted Workover link with `workover doc get`.');
|
|
1641
|
+
console.log('\n Optional, to give Claude Code the Workover tools directly (all projects):');
|
|
1642
|
+
console.log(' claude mcp add --scope user workover -- npx -y @workover/mcp@latest');
|
|
1643
|
+
if (!loadConfig()?.token) console.log('\n You are not signed in yet: run `workover login`.');
|
|
1644
|
+
console.log('');
|
|
1645
|
+
}
|
|
1646
|
+
|
|
1572
1647
|
const cmd = process.argv[2];
|
|
1573
1648
|
if (cmd === 'login') await login();
|
|
1574
1649
|
else if (cmd === 'logout') await logout();
|
|
@@ -1580,6 +1655,7 @@ else if (cmd === 'doc') await docCommand();
|
|
|
1580
1655
|
else if (cmd === 'rules') await rulesCommand();
|
|
1581
1656
|
else if (cmd === 'comments') await commentsCommand();
|
|
1582
1657
|
else if (cmd === 'projects') await projects();
|
|
1658
|
+
else if (cmd === 'install-claude') installClaude();
|
|
1583
1659
|
else {
|
|
1584
1660
|
console.log('\n Workover CLI\n');
|
|
1585
1661
|
console.log(' Usage: workover <command>\n');
|
|
@@ -1594,7 +1670,9 @@ else {
|
|
|
1594
1670
|
console.log(' plus tabs and tab-new for documents with several bodies');
|
|
1595
1671
|
console.log(' plus images and image, for image file names and alt text');
|
|
1596
1672
|
console.log(' workover doc create --project 11 --title "Billing" --file b.md');
|
|
1597
|
-
console.log('
|
|
1673
|
+
console.log(' <doc> is the link from the browser, its UUID, or the number');
|
|
1674
|
+
console.log(' workover doc get https://workover.io/app/acme/docs/<id>');
|
|
1675
|
+
console.log(' workover doc propose <doc> --file new.md · doc edit <doc> --file new.md');
|
|
1598
1676
|
console.log(' comments Read, answer and resolve feedback on a document');
|
|
1599
1677
|
console.log(' workover comments list 123 · workover comments resolve 45');
|
|
1600
1678
|
console.log(' rules The style guide agents should write by: list, export, add');
|
|
@@ -1606,5 +1684,6 @@ else {
|
|
|
1606
1684
|
console.log(' eval Score a project’s documentation against the editorial rubric');
|
|
1607
1685
|
console.log(' --org <id> --project <id> [--limit N] [--json]');
|
|
1608
1686
|
console.log(' logout Sign out and revoke this device’s token');
|
|
1609
|
-
console.log(' whoami Show the current sign-in
|
|
1687
|
+
console.log(' whoami Show the current sign-in');
|
|
1688
|
+
console.log(' install-claude Teach Claude Code to open Workover links (installs a skill)\n');
|
|
1610
1689
|
}
|
package/lib.mjs
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
// Pure helpers for the Workover CLI, split out so they can be unit-tested without importing
|
|
2
2
|
// bin/workover.mjs (which runs a command + calls process.exit on load).
|
|
3
|
+
import { mkdirSync, writeFileSync, renameSync, chmodSync, rmSync } from 'fs';
|
|
4
|
+
import { dirname, join, basename } from 'path';
|
|
3
5
|
|
|
4
6
|
/**
|
|
5
7
|
* Strip trailing slashes from the API base URL (so `${API}${path}` never doubles up).
|
|
@@ -20,11 +22,52 @@ export const normalizeApi = (raw) => {
|
|
|
20
22
|
return s.slice(0, end);
|
|
21
23
|
};
|
|
22
24
|
|
|
23
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* Map a platform + URL to the browser-open command used to approve the device login.
|
|
27
|
+
*
|
|
28
|
+
* Windows does NOT go through `cmd /c start`: cmd re-parses its command line, and Node only quotes
|
|
29
|
+
* arguments that contain spaces, so a URL holding `&` (every query string with two parameters) was
|
|
30
|
+
* split into a second command. `rundll32 url.dll,FileProtocolHandler` takes the URL as a plain
|
|
31
|
+
* argument with no shell in between. Only http(s) URLs are opened at all; anything else returns
|
|
32
|
+
* null and the caller just prints the URL.
|
|
33
|
+
*/
|
|
24
34
|
export const browserCommand = (platform, url) => {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
35
|
+
let parsed;
|
|
36
|
+
try {
|
|
37
|
+
parsed = new URL(url);
|
|
38
|
+
} catch {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
if (parsed.protocol !== 'https:' && parsed.protocol !== 'http:') return null;
|
|
42
|
+
const href = parsed.href;
|
|
43
|
+
if (platform === 'darwin') return { cmd: 'open', args: [href] };
|
|
44
|
+
if (platform === 'win32') return { cmd: 'rundll32', args: ['url.dll,FileProtocolHandler', href] };
|
|
45
|
+
return { cmd: 'xdg-open', args: [href] };
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Write a file that holds a secret (the bearer token) so it is never readable by anyone else, not
|
|
50
|
+
* even for the moment between write and chmod: the directory is created 0700, the contents go to a
|
|
51
|
+
* temp file created 0600 in the same directory, and a rename swaps it in atomically. The chmod after
|
|
52
|
+
* covers a file that already existed with looser bits from an older CLI (rename keeps the temp
|
|
53
|
+
* file's mode, but an umask-free platform may still widen it).
|
|
54
|
+
*/
|
|
55
|
+
export const writePrivateFile = (file, contents) => {
|
|
56
|
+
const dir = dirname(file);
|
|
57
|
+
mkdirSync(dir, { recursive: true, mode: 0o700 });
|
|
58
|
+
const tmp = join(dir, `.${basename(file)}.${process.pid}.${Date.now()}.tmp`);
|
|
59
|
+
try {
|
|
60
|
+
writeFileSync(tmp, contents, { mode: 0o600, flag: 'wx' });
|
|
61
|
+
renameSync(tmp, file);
|
|
62
|
+
} catch (err) {
|
|
63
|
+
rmSync(tmp, { force: true });
|
|
64
|
+
throw err;
|
|
65
|
+
}
|
|
66
|
+
try {
|
|
67
|
+
chmodSync(file, 0o600);
|
|
68
|
+
} catch {
|
|
69
|
+
/* Windows: POSIX modes are advisory */
|
|
70
|
+
}
|
|
28
71
|
};
|
|
29
72
|
|
|
30
73
|
/**
|
|
@@ -272,19 +315,109 @@ export const threadComments = (comments, { includeResolved = false } = {}) => {
|
|
|
272
315
|
.map((r) => ({ ...r, replies: (repliesByRoot.get(r.id) || []).sort(order) }));
|
|
273
316
|
};
|
|
274
317
|
|
|
318
|
+
const UUID_RE = /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i;
|
|
319
|
+
const FULL_UUID_RE = new RegExp(`^${UUID_RE.source}$`, 'i');
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* `value` without any run of `chars` at its end. A loop rather than `/[…]+$/`: a regex anchored only
|
|
323
|
+
* at the end is retried from every position, which is quadratic on a long run of those characters
|
|
324
|
+
* that is not at the end (code scanning, js/polynomial-redos).
|
|
325
|
+
*/
|
|
326
|
+
const stripTrailing = (value, chars) => {
|
|
327
|
+
let end = value.length;
|
|
328
|
+
while (end > 0 && chars.includes(value[end - 1])) end -= 1;
|
|
329
|
+
return value.slice(0, end);
|
|
330
|
+
};
|
|
331
|
+
|
|
275
332
|
/**
|
|
276
|
-
* Which document
|
|
277
|
-
* (`https://workover.io/app/acme/docs/<uuid>`, or the bare uuid).
|
|
333
|
+
* Which document somebody meant, from whatever they pasted.
|
|
278
334
|
*
|
|
279
|
-
*
|
|
280
|
-
*
|
|
335
|
+
* 1234 / #1234 → { id: 1234 }
|
|
336
|
+
* https://workover.io/app/pellio/docs/<uuid> → { handle, host, workspace }
|
|
337
|
+
* …/docs/<uuid>/anything?tab=3#heading, workover.dev, → the same, with that host
|
|
338
|
+
* a preview host, or no scheme at all
|
|
339
|
+
* https://workover.io/app/projects/1234 → { id: 1234, host } (the old editor URL)
|
|
340
|
+
* <uuid> on its own → { handle }
|
|
341
|
+
*
|
|
342
|
+
* Returns null for anything else. The URL is what people paste because it is what the browser shows
|
|
343
|
+
* them, and on 2026-10-16 an agent handed one went digging through the source to turn it into a row
|
|
344
|
+
* id. Every command that names a document takes all of these, so nobody has to.
|
|
345
|
+
*
|
|
346
|
+
* `host` is kept so a link to one environment opened with a sign-in for another can be named as
|
|
347
|
+
* that, rather than reported as a missing document (see `environmentMismatch`).
|
|
281
348
|
*/
|
|
282
349
|
export const docRef = (value) => {
|
|
283
|
-
|
|
350
|
+
// Trim the wrapping that pasted links arrive in: <angle brackets>, quotes, a trailing full stop.
|
|
351
|
+
const s = stripTrailing(
|
|
352
|
+
String(value ?? '')
|
|
353
|
+
.trim()
|
|
354
|
+
.replace(/^[<"'([]+/, ''),
|
|
355
|
+
'>"\')].,;',
|
|
356
|
+
);
|
|
357
|
+
if (!s) return null;
|
|
284
358
|
const id = rowId(s);
|
|
285
359
|
if (id !== null) return { id };
|
|
286
|
-
|
|
287
|
-
|
|
360
|
+
if (FULL_UUID_RE.test(s)) return { handle: s.toLowerCase() };
|
|
361
|
+
|
|
362
|
+
const hasScheme = /^[a-z][a-z0-9+.-]*:\/\//i.test(s);
|
|
363
|
+
if (hasScheme || /^[a-z0-9-]+(\.[a-z0-9-]+)+(:\d+)?\//i.test(s)) {
|
|
364
|
+
let url;
|
|
365
|
+
try {
|
|
366
|
+
url = new URL(hasScheme ? s : `https://${s}`);
|
|
367
|
+
} catch {
|
|
368
|
+
return null;
|
|
369
|
+
}
|
|
370
|
+
const host = url.hostname.toLowerCase();
|
|
371
|
+
const segs = url.pathname.split('/').filter(Boolean);
|
|
372
|
+
const at = segs.findIndex((seg) => FULL_UUID_RE.test(seg));
|
|
373
|
+
if (at !== -1) {
|
|
374
|
+
// /app/<workspace>/docs/<uuid>: the canonical document URL.
|
|
375
|
+
const workspace =
|
|
376
|
+
segs[0] === 'app' && segs[2] === 'docs' && at === 3 ? decodeURIComponent(segs[1]) : null;
|
|
377
|
+
return { handle: segs[at].toLowerCase(), host, ...(workspace ? { workspace } : {}) };
|
|
378
|
+
}
|
|
379
|
+
// /app/projects/<id>: the numeric editor route, kept for old links and bookmarks.
|
|
380
|
+
if (segs[0] === 'app' && segs[1] === 'projects' && rowId(segs[2] ?? '') !== null) {
|
|
381
|
+
return { id: rowId(segs[2]), host };
|
|
382
|
+
}
|
|
383
|
+
return null;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
// Free text with a handle in it ("the doc 7cd7…"): take the handle.
|
|
387
|
+
const m = UUID_RE.exec(s);
|
|
388
|
+
return m ? { handle: m[0].toLowerCase() } : null;
|
|
389
|
+
};
|
|
390
|
+
|
|
391
|
+
/** The web host each known API serves, for telling a user which environment a link belongs to. */
|
|
392
|
+
const WEB_FOR_API = {
|
|
393
|
+
'api.workover.io': 'workover.io',
|
|
394
|
+
'api.workover.dev': 'workover.dev',
|
|
395
|
+
'api.workover.test': 'workover.test',
|
|
396
|
+
};
|
|
397
|
+
|
|
398
|
+
/**
|
|
399
|
+
* A sentence when a document link is for a different Workover than the one signed in to, else null.
|
|
400
|
+
*
|
|
401
|
+
* Only for hosts we know. A preview deploy's web and api hosts are not related by name, so they are
|
|
402
|
+
* left alone rather than guessed at — a wrong warning here would send someone to sign in somewhere
|
|
403
|
+
* they did not need to.
|
|
404
|
+
*/
|
|
405
|
+
export const environmentMismatch = (ref, api) => {
|
|
406
|
+
if (!ref?.host || !api) return null;
|
|
407
|
+
let apiHost;
|
|
408
|
+
try {
|
|
409
|
+
apiHost = new URL(String(api)).hostname.toLowerCase();
|
|
410
|
+
} catch {
|
|
411
|
+
return null;
|
|
412
|
+
}
|
|
413
|
+
const signedInWeb = WEB_FOR_API[apiHost];
|
|
414
|
+
const linkHost = ref.host.replace(/^www\./, '');
|
|
415
|
+
const linkApi = Object.keys(WEB_FOR_API).find((k) => WEB_FOR_API[k] === linkHost);
|
|
416
|
+
if (!signedInWeb || !linkApi || signedInWeb === linkHost) return null;
|
|
417
|
+
return (
|
|
418
|
+
`That link is to ${linkHost}, but you are signed in to ${apiHost}. ` +
|
|
419
|
+
`Sign in there first (it replaces your current sign-in): WORKOVER_API=https://${linkApi} workover login`
|
|
420
|
+
);
|
|
288
421
|
};
|
|
289
422
|
|
|
290
423
|
const decodeAttr = (v) =>
|
|
@@ -326,3 +459,23 @@ export const imagesInHtml = (html) => {
|
|
|
326
459
|
}
|
|
327
460
|
return out;
|
|
328
461
|
};
|
|
462
|
+
|
|
463
|
+
/**
|
|
464
|
+
* What to do when there is no sign-in, as printed lines.
|
|
465
|
+
*
|
|
466
|
+
* Spelled out because the reader is often an agent, and an agent told only "not signed in" goes
|
|
467
|
+
* looking for a token somewhere else. Signing in needs a person to approve it in a browser, so the
|
|
468
|
+
* agent's next move is to ask for that, and the text says so.
|
|
469
|
+
*/
|
|
470
|
+
export const signInHelp = (hint, configFile) =>
|
|
471
|
+
[
|
|
472
|
+
'',
|
|
473
|
+
' Not signed in to Workover.',
|
|
474
|
+
'',
|
|
475
|
+
` Run \`${`workover login ${hint || ''}`.trim()}\`. It opens a browser where a person approves`,
|
|
476
|
+
' this machine, so an agent should ask its user to run it rather than look for a token.',
|
|
477
|
+
' Add --write to allow editing documents directly (without it, changes are proposed).',
|
|
478
|
+
' Staging instead of production: WORKOVER_API=https://api.workover.dev workover login',
|
|
479
|
+
...(configFile ? [` The sign-in is saved to ${configFile}.`] : []),
|
|
480
|
+
'',
|
|
481
|
+
].join('\n');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workover/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.4",
|
|
4
4
|
"description": "Workover command line — sign in and cowork on your documents from the terminal.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "ScaleMath",
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"files": [
|
|
23
23
|
"bin/",
|
|
24
24
|
"lib.mjs",
|
|
25
|
+
"skill/",
|
|
25
26
|
"README.md"
|
|
26
27
|
],
|
|
27
28
|
"engines": {
|
package/skill/SKILL.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: workover
|
|
3
|
+
description: Read, edit, comment on or propose changes to a Workover document. Use whenever the user pastes a Workover doc link (workover.io/app/<workspace>/docs/<id>, workover.dev/app/..., a Workover PR preview link), a Workover document UUID or id, or asks to work on "my Workover doc". Covers reading the doc, writing it, proposing edits, tabs, comments and the team style guide, through the Workover MCP tools or the `workover` CLI.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Working on a Workover document
|
|
7
|
+
|
|
8
|
+
A Workover link such as `https://workover.io/app/pellio/docs/7cd7e9ec-28af-4a2a-bb7c-668548380a08`
|
|
9
|
+
IS the document reference. Pass it as it is. The tools take a full link, the UUID at the end of
|
|
10
|
+
it, or the numeric id, and resolve it themselves.
|
|
11
|
+
|
|
12
|
+
**Do not** read `~/.workover/config.json`, call the Workover REST API with curl or a script, or
|
|
13
|
+
search the Workover source code for routes. The tools below already do all of that, with the
|
|
14
|
+
right access checks and error messages.
|
|
15
|
+
|
|
16
|
+
## 1. Use the Workover MCP tools when they are loaded
|
|
17
|
+
|
|
18
|
+
If tools named `workover_*` are available:
|
|
19
|
+
|
|
20
|
+
- Read: `workover_read_doc` with `docId` set to the link. The result includes the style guide.
|
|
21
|
+
- Tabs: `workover_list_tabs`. Reading or editing acts on ONE tab, so check before editing.
|
|
22
|
+
- Propose a change (the default): `workover_propose_edit` with the FULL revised markdown.
|
|
23
|
+
- Edit directly (only when the user asked for the change to be made): `workover_edit_doc`.
|
|
24
|
+
- Comments are CLI-only for now; see below.
|
|
25
|
+
|
|
26
|
+
## 2. Otherwise use the `workover` CLI
|
|
27
|
+
|
|
28
|
+
Run `workover` if it is on PATH. If it is not, run `npx -y @workover/cli@latest` instead (same
|
|
29
|
+
commands).
|
|
30
|
+
|
|
31
|
+
```sh
|
|
32
|
+
workover doc get <link> # the body as markdown; title + tabs go to stderr
|
|
33
|
+
workover doc tabs <link> # the tabs, if any
|
|
34
|
+
workover doc propose <link> --file new.md --note "what changed" # suggestions to accept
|
|
35
|
+
workover doc edit <link> --file new.md --note "what changed" # replace the body now
|
|
36
|
+
workover comments list <link> # open comment threads
|
|
37
|
+
workover comments add <link> "reply" --to <commentId>
|
|
38
|
+
workover doc search "query" # find a doc when you have no link
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
`get` / `edit` are the same as `read` / `write`. Add `--tab <tabId>` to read or write one tab.
|
|
42
|
+
|
|
43
|
+
## Editing rules
|
|
44
|
+
|
|
45
|
+
- Read the document first. `propose` and `edit` take the COMPLETE document and replace the
|
|
46
|
+
body of one tab, so anything left out is deleted.
|
|
47
|
+
- The title is the H1. Start the body at `##` and never add a `#` heading.
|
|
48
|
+
- Change only what you mean to. Do not reflow paragraphs or renumber lists. Tables come back as
|
|
49
|
+
HTML; edit inside the cells.
|
|
50
|
+
- `propose` is the default. Use `edit` (or `workover_edit_doc`) only when the user asked for the
|
|
51
|
+
change to be made, and it needs a sign-in made with `workover login --write`.
|
|
52
|
+
- Follow the style guide that comes back with the read.
|
|
53
|
+
|
|
54
|
+
## When something fails
|
|
55
|
+
|
|
56
|
+
- **Not signed in**: signing in needs a person to approve it in a browser. Ask the user to run
|
|
57
|
+
`workover login` (`workover login --write` to allow direct edits). Do not look for a token.
|
|
58
|
+
- **"That link is to workover.dev, but you are signed in to api.workover.io"**: the link is for a
|
|
59
|
+
different environment. Tell the user and give them the command the error prints.
|
|
60
|
+
- **"No document at that link that this sign-in can open"**: it does not exist, or this account
|
|
61
|
+
has no access. Ask the user to check the link or to get the document shared. Do not try other
|
|
62
|
+
routes.
|
|
63
|
+
- **A permission error mentioning `--write`**: propose instead, or ask the user to sign in again
|
|
64
|
+
with `workover login --write`.
|