@workjournal/cli 0.8.0 → 0.16.0
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 +11 -1
- package/dist/api-client.d.ts +24 -9
- package/dist/api-client.d.ts.map +1 -1
- package/dist/api-client.js +109 -57
- package/dist/api-client.js.map +1 -1
- package/dist/auth.d.ts +6 -0
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +18 -0
- package/dist/auth.js.map +1 -1
- package/dist/cli-args.d.ts +19 -0
- package/dist/cli-args.d.ts.map +1 -0
- package/dist/cli-args.js +50 -0
- package/dist/cli-args.js.map +1 -0
- package/dist/commands/entries.d.ts +6 -0
- package/dist/commands/entries.d.ts.map +1 -1
- package/dist/commands/entries.js +68 -14
- package/dist/commands/entries.js.map +1 -1
- package/dist/commands/export.d.ts.map +1 -1
- package/dist/commands/export.js +2 -3
- package/dist/commands/export.js.map +1 -1
- package/dist/commands/invites.d.ts.map +1 -1
- package/dist/commands/invites.js +6 -7
- package/dist/commands/invites.js.map +1 -1
- package/dist/commands/journals.d.ts +1 -1
- package/dist/commands/journals.d.ts.map +1 -1
- package/dist/commands/journals.js +20 -19
- package/dist/commands/journals.js.map +1 -1
- package/dist/commands/prompts.d.ts +9 -0
- package/dist/commands/prompts.d.ts.map +1 -0
- package/dist/commands/prompts.js +83 -0
- package/dist/commands/prompts.js.map +1 -0
- package/dist/commands/shares.d.ts.map +1 -1
- package/dist/commands/shares.js +11 -13
- package/dist/commands/shares.js.map +1 -1
- package/dist/commands/workspaces.d.ts.map +1 -1
- package/dist/commands/workspaces.js +4 -7
- package/dist/commands/workspaces.js.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +3 -1
- package/dist/config.js.map +1 -1
- package/dist/help/_dispatch.d.ts +29 -0
- package/dist/help/_dispatch.d.ts.map +1 -0
- package/dist/help/_dispatch.js +132 -0
- package/dist/help/_dispatch.js.map +1 -0
- package/dist/help/_registry.d.ts +18 -0
- package/dist/help/_registry.d.ts.map +1 -0
- package/dist/help/_registry.js +88 -0
- package/dist/help/_registry.js.map +1 -0
- package/dist/help/_renderer.d.ts +31 -0
- package/dist/help/_renderer.d.ts.map +1 -0
- package/dist/help/_renderer.js +99 -0
- package/dist/help/_renderer.js.map +1 -0
- package/dist/help/_types.d.ts +53 -0
- package/dist/help/_types.d.ts.map +1 -0
- package/dist/help/_types.js +15 -0
- package/dist/help/_types.js.map +1 -0
- package/dist/help/auth-login.json +12 -0
- package/dist/help/auth-logout.json +7 -0
- package/dist/help/auth-status.json +7 -0
- package/dist/help/auth-whoami.json +7 -0
- package/dist/help/config-show.json +7 -0
- package/dist/help/entries-delete.json +12 -0
- package/dist/help/entries-get.json +12 -0
- package/dist/help/entries-last.json +19 -0
- package/dist/help/entries-list.json +14 -0
- package/dist/help/entries-search.json +15 -0
- package/dist/help/entries-update.json +37 -0
- package/dist/help/entries-write.json +33 -0
- package/dist/help/export.json +29 -0
- package/dist/help/invites-delete.json +16 -0
- package/dist/help/invites-list.json +11 -0
- package/dist/help/invites-new.json +12 -0
- package/dist/help/journal.json +13 -0
- package/dist/help/journals-assign-prompt.json +12 -0
- package/dist/help/journals-delete.json +11 -0
- package/dist/help/journals-get.json +20 -0
- package/dist/help/journals-list.json +14 -0
- package/dist/help/journals-new.json +21 -0
- package/dist/help/journals-rename.json +12 -0
- package/dist/help/journals-select.json +11 -0
- package/dist/help/journals-set-slug.json +16 -0
- package/dist/help/journals-unassign-prompt.json +11 -0
- package/dist/help/prompts-delete.json +11 -0
- package/dist/help/prompts-get.json +11 -0
- package/dist/help/prompts-list.json +14 -0
- package/dist/help/prompts-new.json +23 -0
- package/dist/help/prompts-update.json +29 -0
- package/dist/help/shares-delete.json +16 -0
- package/dist/help/shares-list.json +11 -0
- package/dist/index.js +197 -76
- package/dist/index.js.map +1 -1
- package/package.json +4 -5
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { HELP_DOCS, listCommands } from './_registry.js';
|
|
2
|
+
import { FEEDBACK_FOOTER, renderHelp } from './_renderer.js';
|
|
3
|
+
/**
|
|
4
|
+
* Returns true if any element of argv is the literal `--help` or `-h`.
|
|
5
|
+
*
|
|
6
|
+
* The CLI accepts `--help` / `-h` in any position — not just as the subcommand
|
|
7
|
+
* — because users (and especially agents) habitually probe `<cmd> --help` to
|
|
8
|
+
* discover flags. This walker treats every position equally so
|
|
9
|
+
* `journals list --help` works the same as `journals --help list`.
|
|
10
|
+
*/
|
|
11
|
+
export function hasHelpFlag(argv) {
|
|
12
|
+
return argv.some((a) => a === '--help' || a === '-h');
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* If argv is asking for help, print the appropriate help block (per-command if
|
|
16
|
+
* we can resolve a HelpDoc, else group summary) and return true. Caller should
|
|
17
|
+
* `return` immediately on true.
|
|
18
|
+
*
|
|
19
|
+
* `command` is the space-separated form as it would appear in the registry —
|
|
20
|
+
* e.g. `entries update`, `auth login`, or just `entries` for the group level.
|
|
21
|
+
*/
|
|
22
|
+
export function tryHandleHelp(command, argv, jsonOutput) {
|
|
23
|
+
if (!hasHelpFlag(argv))
|
|
24
|
+
return false;
|
|
25
|
+
const doc = HELP_DOCS[command];
|
|
26
|
+
if (doc) {
|
|
27
|
+
printDoc(doc, jsonOutput);
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
// No exact match — fall back to a group summary if `command` is a prefix.
|
|
31
|
+
const matches = listCommands().filter((c) => c.startsWith(`${command} `));
|
|
32
|
+
if (matches.length > 0) {
|
|
33
|
+
printGroupSummary(command, matches, jsonOutput);
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
// No match anywhere — print the top-level help so the user has something.
|
|
37
|
+
printTopLevelHelp(jsonOutput);
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Print a single command's help. Text or JSON depending on `--json`.
|
|
42
|
+
*/
|
|
43
|
+
export function printDoc(doc, jsonOutput) {
|
|
44
|
+
if (jsonOutput) {
|
|
45
|
+
process.stdout.write(`${JSON.stringify(doc, null, 2)}\n`);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
process.stdout.write(renderHelp(doc));
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Print a one-liner summary for every command under a group prefix
|
|
52
|
+
* (e.g. `entries` → list, write, last, get, update, delete, search).
|
|
53
|
+
*/
|
|
54
|
+
function printGroupSummary(group, commands, jsonOutput) {
|
|
55
|
+
if (jsonOutput) {
|
|
56
|
+
const docs = commands.map((c) => HELP_DOCS[c]);
|
|
57
|
+
process.stdout.write(`${JSON.stringify(docs, null, 2)}\n`);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const lines = [];
|
|
61
|
+
lines.push(`workjournal ${group} <subcommand> [...]`);
|
|
62
|
+
lines.push('');
|
|
63
|
+
lines.push(`Subcommands:`);
|
|
64
|
+
const labels = commands.map((c) => c.slice(group.length + 1));
|
|
65
|
+
const width = Math.max(...labels.map((l) => l.length));
|
|
66
|
+
for (let i = 0; i < commands.length; i++) {
|
|
67
|
+
const doc = HELP_DOCS[commands[i]];
|
|
68
|
+
const label = labels[i].padEnd(width);
|
|
69
|
+
lines.push(` ${label} ${firstSentence(doc.description)}`);
|
|
70
|
+
}
|
|
71
|
+
lines.push('');
|
|
72
|
+
lines.push(`Run \`workjournal ${group} <subcommand> --help\` for full details.`);
|
|
73
|
+
lines.push('');
|
|
74
|
+
lines.push(FEEDBACK_FOOTER);
|
|
75
|
+
process.stdout.write(`${lines.join('\n')}\n`);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Print the top-level help — every command in the registry, grouped by the
|
|
79
|
+
* first word. This replaces the legacy hand-written `printHelp()` template.
|
|
80
|
+
*/
|
|
81
|
+
export function printTopLevelHelp(jsonOutput) {
|
|
82
|
+
if (jsonOutput) {
|
|
83
|
+
const docs = listCommands().map((c) => HELP_DOCS[c]);
|
|
84
|
+
process.stdout.write(`${JSON.stringify(docs, null, 2)}\n`);
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
const lines = [];
|
|
88
|
+
lines.push('workjournal — CLI for Workjournal (https://workjournal.pro)');
|
|
89
|
+
lines.push('');
|
|
90
|
+
lines.push('Usage:');
|
|
91
|
+
lines.push(' workjournal List entries in the selected journal');
|
|
92
|
+
lines.push(' workjournal <command> [<subcommand>] [...] Run a specific command');
|
|
93
|
+
lines.push(' workjournal <command> --help Detailed help for one command');
|
|
94
|
+
lines.push(' workjournal --version Print version');
|
|
95
|
+
lines.push('');
|
|
96
|
+
// Group keys by their first word so the output mirrors how users think
|
|
97
|
+
// about the surface (workspaces, journals, entries, …).
|
|
98
|
+
const grouped = new Map();
|
|
99
|
+
for (const cmd of listCommands()) {
|
|
100
|
+
const group = cmd.includes(' ') ? cmd.slice(0, cmd.indexOf(' ')) : cmd;
|
|
101
|
+
const list = grouped.get(group) ?? [];
|
|
102
|
+
list.push(cmd);
|
|
103
|
+
grouped.set(group, list);
|
|
104
|
+
}
|
|
105
|
+
for (const [group, cmds] of grouped) {
|
|
106
|
+
lines.push(`${capitalize(group)}:`);
|
|
107
|
+
const labels = cmds.map((c) => `workjournal ${c}`);
|
|
108
|
+
const width = Math.max(...labels.map((l) => l.length));
|
|
109
|
+
for (let i = 0; i < cmds.length; i++) {
|
|
110
|
+
const doc = HELP_DOCS[cmds[i]];
|
|
111
|
+
const label = labels[i].padEnd(width);
|
|
112
|
+
lines.push(` ${label} ${firstSentence(doc.description)}`);
|
|
113
|
+
}
|
|
114
|
+
lines.push('');
|
|
115
|
+
}
|
|
116
|
+
lines.push('Global flags:');
|
|
117
|
+
lines.push(' --json Machine-readable output (where applicable)');
|
|
118
|
+
lines.push(' --verbose Extra detail on `journals get` / `journal`');
|
|
119
|
+
lines.push('');
|
|
120
|
+
lines.push(FEEDBACK_FOOTER);
|
|
121
|
+
process.stdout.write(`${lines.join('\n')}\n`);
|
|
122
|
+
}
|
|
123
|
+
function firstSentence(s) {
|
|
124
|
+
const idx = s.indexOf('.');
|
|
125
|
+
if (idx === -1)
|
|
126
|
+
return s;
|
|
127
|
+
return s.slice(0, idx + 1);
|
|
128
|
+
}
|
|
129
|
+
function capitalize(s) {
|
|
130
|
+
return s.charAt(0).toUpperCase() + s.slice(1);
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=_dispatch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_dispatch.js","sourceRoot":"","sources":["../../src/help/_dispatch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAG7D;;;;;;;GAOG;AACH,MAAM,UAAU,WAAW,CAAC,IAAc;IACzC,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC;AACvD,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAAC,OAAe,EAAE,IAAc,EAAE,UAAmB;IACjF,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC;IAErC,MAAM,GAAG,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;IAC/B,IAAI,GAAG,EAAE,CAAC;QACT,QAAQ,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;QAC1B,OAAO,IAAI,CAAC;IACb,CAAC;IAED,0EAA0E;IAC1E,MAAM,OAAO,GAAG,YAAY,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,OAAO,GAAG,CAAC,CAAC,CAAC;IAC1E,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACxB,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,U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AAC/C,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { HelpDoc } from './_types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Every command's help doc, keyed by the space-separated command form as the
|
|
4
|
+
* user types it (`entries update`, `auth login`, `journal`, …). Lookups in
|
|
5
|
+
* `index.ts` use this map to render `--help` output on demand.
|
|
6
|
+
*
|
|
7
|
+
* Adding a new command is two steps: drop a `<group>-<sub>.json` here, and
|
|
8
|
+
* register it below.
|
|
9
|
+
*/
|
|
10
|
+
export declare const HELP_DOCS: Readonly<Record<string, HelpDoc>>;
|
|
11
|
+
/**
|
|
12
|
+
* Look up a HelpDoc by command form (`entries update`, etc.) — returns
|
|
13
|
+
* `undefined` for unknown keys.
|
|
14
|
+
*/
|
|
15
|
+
export declare function getHelpDoc(command: string): HelpDoc | undefined;
|
|
16
|
+
/** Stable list of command keys for iteration (alphabetical). */
|
|
17
|
+
export declare function listCommands(): string[];
|
|
18
|
+
//# sourceMappingURL=_registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_registry.d.ts","sourceRoot":"","sources":["../../src/help/_registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAmC3C;;;;;;;GAOG;AACH,eAAO,MAAM,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAkCtD,CAAC;AAEH;;;GAGG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAE/D;AAED,gEAAgE;AAChE,wBAAgB,YAAY,IAAI,MAAM,EAAE,CAEvC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import authLogin from './auth-login.json' with { type: 'json' };
|
|
2
|
+
import authLogout from './auth-logout.json' with { type: 'json' };
|
|
3
|
+
import authStatus from './auth-status.json' with { type: 'json' };
|
|
4
|
+
import authWhoami from './auth-whoami.json' with { type: 'json' };
|
|
5
|
+
import configShow from './config-show.json' with { type: 'json' };
|
|
6
|
+
import entriesDelete from './entries-delete.json' with { type: 'json' };
|
|
7
|
+
import entriesGet from './entries-get.json' with { type: 'json' };
|
|
8
|
+
import entriesLast from './entries-last.json' with { type: 'json' };
|
|
9
|
+
import entriesList from './entries-list.json' with { type: 'json' };
|
|
10
|
+
import entriesSearch from './entries-search.json' with { type: 'json' };
|
|
11
|
+
import entriesUpdate from './entries-update.json' with { type: 'json' };
|
|
12
|
+
import entriesWrite from './entries-write.json' with { type: 'json' };
|
|
13
|
+
import exportCmd from './export.json' with { type: 'json' };
|
|
14
|
+
import invitesDelete from './invites-delete.json' with { type: 'json' };
|
|
15
|
+
import invitesList from './invites-list.json' with { type: 'json' };
|
|
16
|
+
import invitesNew from './invites-new.json' with { type: 'json' };
|
|
17
|
+
import journal from './journal.json' with { type: 'json' };
|
|
18
|
+
import journalsAssignPrompt from './journals-assign-prompt.json' with { type: 'json' };
|
|
19
|
+
import journalsDelete from './journals-delete.json' with { type: 'json' };
|
|
20
|
+
import journalsGet from './journals-get.json' with { type: 'json' };
|
|
21
|
+
import journalsList from './journals-list.json' with { type: 'json' };
|
|
22
|
+
import journalsNew from './journals-new.json' with { type: 'json' };
|
|
23
|
+
import journalsRename from './journals-rename.json' with { type: 'json' };
|
|
24
|
+
import journalsSelect from './journals-select.json' with { type: 'json' };
|
|
25
|
+
import journalsSetSlug from './journals-set-slug.json' with { type: 'json' };
|
|
26
|
+
import journalsUnassignPrompt from './journals-unassign-prompt.json' with { type: 'json' };
|
|
27
|
+
import promptsDelete from './prompts-delete.json' with { type: 'json' };
|
|
28
|
+
import promptsGet from './prompts-get.json' with { type: 'json' };
|
|
29
|
+
import promptsList from './prompts-list.json' with { type: 'json' };
|
|
30
|
+
import promptsNew from './prompts-new.json' with { type: 'json' };
|
|
31
|
+
import promptsUpdate from './prompts-update.json' with { type: 'json' };
|
|
32
|
+
import sharesDelete from './shares-delete.json' with { type: 'json' };
|
|
33
|
+
import sharesList from './shares-list.json' with { type: 'json' };
|
|
34
|
+
/**
|
|
35
|
+
* Every command's help doc, keyed by the space-separated command form as the
|
|
36
|
+
* user types it (`entries update`, `auth login`, `journal`, …). Lookups in
|
|
37
|
+
* `index.ts` use this map to render `--help` output on demand.
|
|
38
|
+
*
|
|
39
|
+
* Adding a new command is two steps: drop a `<group>-<sub>.json` here, and
|
|
40
|
+
* register it below.
|
|
41
|
+
*/
|
|
42
|
+
export const HELP_DOCS = Object.freeze({
|
|
43
|
+
'auth login': authLogin,
|
|
44
|
+
'auth logout': authLogout,
|
|
45
|
+
'auth status': authStatus,
|
|
46
|
+
'auth whoami': authWhoami,
|
|
47
|
+
'config show': configShow,
|
|
48
|
+
'entries delete': entriesDelete,
|
|
49
|
+
'entries get': entriesGet,
|
|
50
|
+
'entries last': entriesLast,
|
|
51
|
+
'entries list': entriesList,
|
|
52
|
+
'entries search': entriesSearch,
|
|
53
|
+
'entries update': entriesUpdate,
|
|
54
|
+
'entries write': entriesWrite,
|
|
55
|
+
'invites delete': invitesDelete,
|
|
56
|
+
'invites list': invitesList,
|
|
57
|
+
'invites new': invitesNew,
|
|
58
|
+
'journals assign-prompt': journalsAssignPrompt,
|
|
59
|
+
'journals delete': journalsDelete,
|
|
60
|
+
'journals get': journalsGet,
|
|
61
|
+
'journals list': journalsList,
|
|
62
|
+
'journals new': journalsNew,
|
|
63
|
+
'journals rename': journalsRename,
|
|
64
|
+
'journals select': journalsSelect,
|
|
65
|
+
'journals set-slug': journalsSetSlug,
|
|
66
|
+
'journals unassign-prompt': journalsUnassignPrompt,
|
|
67
|
+
'prompts delete': promptsDelete,
|
|
68
|
+
'prompts get': promptsGet,
|
|
69
|
+
'prompts list': promptsList,
|
|
70
|
+
'prompts new': promptsNew,
|
|
71
|
+
'prompts update': promptsUpdate,
|
|
72
|
+
'shares delete': sharesDelete,
|
|
73
|
+
'shares list': sharesList,
|
|
74
|
+
export: exportCmd,
|
|
75
|
+
journal: journal,
|
|
76
|
+
});
|
|
77
|
+
/**
|
|
78
|
+
* Look up a HelpDoc by command form (`entries update`, etc.) — returns
|
|
79
|
+
* `undefined` for unknown keys.
|
|
80
|
+
*/
|
|
81
|
+
export function getHelpDoc(command) {
|
|
82
|
+
return HELP_DOCS[command];
|
|
83
|
+
}
|
|
84
|
+
/** Stable list of command keys for iteration (alphabetical). */
|
|
85
|
+
export function listCommands() {
|
|
86
|
+
return Object.keys(HELP_DOCS).sort();
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=_registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_registry.js","sourceRoot":"","sources":["../../src/help/_registry.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,mBAAmB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAChE,OAAO,UAAU,MAAM,oBAAoB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAClE,OAAO,UAAU,MAAM,oBAAoB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAClE,OAAO,UAAU,MAAM,oBAAoB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAClE,OAAO,UAAU,MAAM,oBAAoB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAClE,OAAO,aAAa,MAAM,uBAAuB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AACxE,OAAO,UAAU,MAAM,oBAAoB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAClE,OAAO,WAAW,MAAM,qBAAqB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AACpE,OAAO,WAAW,MAAM,qBAAqB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AACpE,OAAO,aAAa,MAAM,uBAAuB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AACxE,OAAO,aAAa,MAAM,uBAAuB,CAAC,OA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ACpC,cAAc,EAAE,WAAsB;IACtC,aAAa,EAAE,UAAqB;IACpC,gBAAgB,EAAE,aAAwB;IAC1C,eAAe,EAAE,YAAuB;IACxC,aAAa,EAAE,UAAqB;IACpC,MAAM,EAAE,SAAoB;IAC5B,OAAO,EAAE,OAAkB;CAC3B,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,OAAe;IACzC,OAAO,SAAS,CAAC,OAAO,CAAC,CAAC;AAC3B,CAAC;AAED,gEAAgE;AAChE,MAAM,UAAU,YAAY;IAC3B,OAAO,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,CAAC;AACtC,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { HelpDoc } from './_types.js';
|
|
2
|
+
/** Public so route handlers can append the same footer to ad-hoc usage lines. */
|
|
3
|
+
export declare const FEEDBACK_FOOTER = "Report issues / feedback: https://github.com/workjournal-pro/feedback/issues";
|
|
4
|
+
/**
|
|
5
|
+
* Render a `HelpDoc` to a terminal-friendly string. The output is one block:
|
|
6
|
+
*
|
|
7
|
+
* workjournal entries update <workspaceSlug> <journalSlug> <index> [-t <title>] [-s <summary>] [-b <file>|-]
|
|
8
|
+
*
|
|
9
|
+
* <description>
|
|
10
|
+
*
|
|
11
|
+
* Arguments:
|
|
12
|
+
* <workspaceSlug> ...
|
|
13
|
+
*
|
|
14
|
+
* Flags:
|
|
15
|
+
* -t, --title <title> ...
|
|
16
|
+
*
|
|
17
|
+
* At least one of -t/-s/-b is required.
|
|
18
|
+
*
|
|
19
|
+
* Examples:
|
|
20
|
+
* workjournal entries update acme engineering 5 -t "Verified"
|
|
21
|
+
*
|
|
22
|
+
* When to use:
|
|
23
|
+
* Annotate, verify, or fix typos ...
|
|
24
|
+
*
|
|
25
|
+
* Report issues / feedback: <url>
|
|
26
|
+
*
|
|
27
|
+
* Rendering is intentionally naive — no terminal-width detection, no colour. We
|
|
28
|
+
* favour deterministic output (so tests can assert verbatim) over polish.
|
|
29
|
+
*/
|
|
30
|
+
export declare function renderHelp(doc: HelpDoc): string;
|
|
31
|
+
//# sourceMappingURL=_renderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_renderer.d.ts","sourceRoot":"","sources":["../../src/help/_renderer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAI3C,iFAAiF;AACjF,eAAO,MAAM,eAAe,iFAA8C,CAAC;AAE3E;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAkD/C"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
const FEEDBACK_URL = 'https://github.com/workjournal-pro/feedback/issues';
|
|
2
|
+
/** Public so route handlers can append the same footer to ad-hoc usage lines. */
|
|
3
|
+
export const FEEDBACK_FOOTER = `Report issues / feedback: ${FEEDBACK_URL}`;
|
|
4
|
+
/**
|
|
5
|
+
* Render a `HelpDoc` to a terminal-friendly string. The output is one block:
|
|
6
|
+
*
|
|
7
|
+
* workjournal entries update <workspaceSlug> <journalSlug> <index> [-t <title>] [-s <summary>] [-b <file>|-]
|
|
8
|
+
*
|
|
9
|
+
* <description>
|
|
10
|
+
*
|
|
11
|
+
* Arguments:
|
|
12
|
+
* <workspaceSlug> ...
|
|
13
|
+
*
|
|
14
|
+
* Flags:
|
|
15
|
+
* -t, --title <title> ...
|
|
16
|
+
*
|
|
17
|
+
* At least one of -t/-s/-b is required.
|
|
18
|
+
*
|
|
19
|
+
* Examples:
|
|
20
|
+
* workjournal entries update acme engineering 5 -t "Verified"
|
|
21
|
+
*
|
|
22
|
+
* When to use:
|
|
23
|
+
* Annotate, verify, or fix typos ...
|
|
24
|
+
*
|
|
25
|
+
* Report issues / feedback: <url>
|
|
26
|
+
*
|
|
27
|
+
* Rendering is intentionally naive — no terminal-width detection, no colour. We
|
|
28
|
+
* favour deterministic output (so tests can assert verbatim) over polish.
|
|
29
|
+
*/
|
|
30
|
+
export function renderHelp(doc) {
|
|
31
|
+
const lines = [];
|
|
32
|
+
lines.push(usageLine(doc));
|
|
33
|
+
lines.push('');
|
|
34
|
+
lines.push(doc.description);
|
|
35
|
+
if (doc.args && doc.args.length > 0) {
|
|
36
|
+
lines.push('');
|
|
37
|
+
lines.push('Arguments:');
|
|
38
|
+
const width = Math.max(...doc.args.map((a) => formatArgName(a).length));
|
|
39
|
+
for (const arg of doc.args) {
|
|
40
|
+
const name = formatArgName(arg).padEnd(width);
|
|
41
|
+
lines.push(` ${name} ${arg.description}`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (doc.flags && doc.flags.length > 0) {
|
|
45
|
+
lines.push('');
|
|
46
|
+
lines.push('Flags:');
|
|
47
|
+
const formatted = doc.flags.map(formatFlag);
|
|
48
|
+
const width = Math.max(...formatted.map((f) => f.label.length));
|
|
49
|
+
for (const f of formatted) {
|
|
50
|
+
lines.push(` ${f.label.padEnd(width)} ${f.description}`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
if (doc.constraints && doc.constraints.length > 0) {
|
|
54
|
+
lines.push('');
|
|
55
|
+
for (const c of doc.constraints) {
|
|
56
|
+
lines.push(c);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (doc.examples.length > 0) {
|
|
60
|
+
lines.push('');
|
|
61
|
+
lines.push('Examples:');
|
|
62
|
+
for (const ex of doc.examples) {
|
|
63
|
+
lines.push(` ${ex}`);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
lines.push('');
|
|
67
|
+
lines.push('When to use:');
|
|
68
|
+
lines.push(` ${doc.when_to_use}`);
|
|
69
|
+
lines.push('');
|
|
70
|
+
lines.push(FEEDBACK_FOOTER);
|
|
71
|
+
return `${lines.join('\n')}\n`;
|
|
72
|
+
}
|
|
73
|
+
function usageLine(doc) {
|
|
74
|
+
const parts = ['workjournal', doc.command];
|
|
75
|
+
if (doc.args) {
|
|
76
|
+
for (const arg of doc.args) {
|
|
77
|
+
parts.push(arg.required ? `<${arg.name}>` : `[${arg.name}]`);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if (doc.flags) {
|
|
81
|
+
for (const flag of doc.flags) {
|
|
82
|
+
parts.push(`[${formatFlagInline(flag)}]`);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return parts.join(' ');
|
|
86
|
+
}
|
|
87
|
+
function formatArgName(arg) {
|
|
88
|
+
return arg.required ? `<${arg.name}>` : `[${arg.name}]`;
|
|
89
|
+
}
|
|
90
|
+
function formatFlagInline(flag) {
|
|
91
|
+
const aliases = [flag.short, flag.long].filter(Boolean).join('/');
|
|
92
|
+
return flag.value ? `${aliases} ${flag.value}` : aliases;
|
|
93
|
+
}
|
|
94
|
+
function formatFlag(flag) {
|
|
95
|
+
const aliases = [flag.short, flag.long].filter(Boolean).join(', ');
|
|
96
|
+
const label = flag.value ? `${aliases} ${flag.value}` : aliases;
|
|
97
|
+
return { label, description: flag.description };
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=_renderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_renderer.js","sourceRoot":"","sources":["../../src/help/_renderer.ts"],"names":[],"mappings":"AAEA,MAAM,YAAY,GAAG,oDAAoD,CAAC;AAE1E,iFAAiF;AACjF,MAAM,CAAC,MAAM,eAAe,GAAG,6BAA6B,YAAY,EAAE,CAAC;AAE3E;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,UAAU,UAAU,CAAC,GAAY;IACtC,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;IAC3B,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,C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}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Schema for the per-command help JSON files in this directory.
|
|
3
|
+
*
|
|
4
|
+
* Every `<group>-<sub>.json` (or `<sub>.json` for top-level commands like
|
|
5
|
+
* `export`) conforms to this interface. The renderer at `_renderer.ts` walks
|
|
6
|
+
* a `HelpDoc` to produce terminal output; `--help --json` emits the raw JSON
|
|
7
|
+
* untouched. The registry at `_registry.ts` is the single import surface for
|
|
8
|
+
* the routes in `index.ts`.
|
|
9
|
+
*
|
|
10
|
+
* The shape is CLI-flavoured (positional `args[]` ordered, aliased `flags[]`,
|
|
11
|
+
* free-form `constraints[]`) rather than a JSON-Schema clone — see the plan
|
|
12
|
+
* doc for the rationale.
|
|
13
|
+
*/
|
|
14
|
+
export interface HelpArg {
|
|
15
|
+
/** Camel-cased name as it appears in usage strings (e.g. `workspaceSlug`). */
|
|
16
|
+
name: string;
|
|
17
|
+
required: boolean;
|
|
18
|
+
description: string;
|
|
19
|
+
}
|
|
20
|
+
export interface HelpFlag {
|
|
21
|
+
/** Single-dash short form (e.g. `-t`). Optional for long-only flags. */
|
|
22
|
+
short?: string;
|
|
23
|
+
/** Double-dash long form (e.g. `--title`). Required. */
|
|
24
|
+
long: string;
|
|
25
|
+
/**
|
|
26
|
+
* Placeholder shown after the flag in usage (e.g. `<title>` or `<file>|-`).
|
|
27
|
+
* Omit for boolean toggles that take no value.
|
|
28
|
+
*/
|
|
29
|
+
value?: string;
|
|
30
|
+
description: string;
|
|
31
|
+
}
|
|
32
|
+
export interface HelpAnnotations {
|
|
33
|
+
/** Mutates server state in a way that can't be reversed (delete, set-slug). */
|
|
34
|
+
destructive: boolean;
|
|
35
|
+
/** Repeated identical calls converge on identical server state. */
|
|
36
|
+
idempotent: boolean;
|
|
37
|
+
}
|
|
38
|
+
export interface HelpDoc {
|
|
39
|
+
/** Space-separated form as the user types it (e.g. `entries update`). */
|
|
40
|
+
command: string;
|
|
41
|
+
/** 1–2 sentence summary used in both the human and the JSON output. */
|
|
42
|
+
description: string;
|
|
43
|
+
args?: HelpArg[];
|
|
44
|
+
flags?: HelpFlag[];
|
|
45
|
+
/** Free-form constraint strings rendered verbatim under flags. */
|
|
46
|
+
constraints?: string[];
|
|
47
|
+
annotations: HelpAnnotations;
|
|
48
|
+
/** 1–2 realistic invocations a user (or agent) would actually run. */
|
|
49
|
+
examples: string[];
|
|
50
|
+
/** Why an agent or user would reach for this command over alternatives. */
|
|
51
|
+
when_to_use: string;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=_types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_types.d.ts","sourceRoot":"","sources":["../../src/help/_types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,MAAM,WAAW,OAAO;IACvB,8EAA8E;IAC9E,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,QAAQ;IACxB,wEAAwE;IACxE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wDAAwD;IACxD,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,eAAe;IAC/B,+EAA+E;IAC/E,WAAW,EAAE,OAAO,CAAC;IACrB,mEAAmE;IACnE,UAAU,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,OAAO;IACvB,yEAAyE;IACzE,OAAO,EAAE,MAAM,CAAC;IAChB,uEAAuE;IACvE,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC;IACjB,KAAK,CAAC,EAAE,QAAQ,EAAE,CAAC;IACnB,kEAAkE;IAClE,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,WAAW,EAAE,eAAe,CAAC;IAC7B,sEAAsE;IACtE,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,2EAA2E;IAC3E,WAAW,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Schema for the per-command help JSON files in this directory.
|
|
3
|
+
*
|
|
4
|
+
* Every `<group>-<sub>.json` (or `<sub>.json` for top-level commands like
|
|
5
|
+
* `export`) conforms to this interface. The renderer at `_renderer.ts` walks
|
|
6
|
+
* a `HelpDoc` to produce terminal output; `--help --json` emits the raw JSON
|
|
7
|
+
* untouched. The registry at `_registry.ts` is the single import surface for
|
|
8
|
+
* the routes in `index.ts`.
|
|
9
|
+
*
|
|
10
|
+
* The shape is CLI-flavoured (positional `args[]` ordered, aliased `flags[]`,
|
|
11
|
+
* free-form `constraints[]`) rather than a JSON-Schema clone — see the plan
|
|
12
|
+
* doc for the rationale.
|
|
13
|
+
*/
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=_types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_types.js","sourceRoot":"","sources":["../../src/help/_types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"command": "auth login",
|
|
3
|
+
"description": "Authenticate with Workjournal via browser-based OAuth (PKCE). Two-phase flow for headless environments: `auth login start` prints the authorize URL, `auth login finish <CODE>` exchanges the 8-character code for credentials.",
|
|
4
|
+
"flags": [],
|
|
5
|
+
"annotations": { "destructive": false, "idempotent": true },
|
|
6
|
+
"examples": [
|
|
7
|
+
"workjournal auth login",
|
|
8
|
+
"workjournal auth login start",
|
|
9
|
+
"workjournal auth login finish ABC23DEF"
|
|
10
|
+
],
|
|
11
|
+
"when_to_use": "First-time setup, after a logout, or when an existing token has been revoked. The two-phase form works in SSH sessions, dev containers, and CI where no browser is available locally."
|
|
12
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"command": "auth logout",
|
|
3
|
+
"description": "Sign out the current device. Best-effort revokes the per-device session server-side and clears local credentials at `~/.config/workjournal/credentials.json`.",
|
|
4
|
+
"annotations": { "destructive": false, "idempotent": true },
|
|
5
|
+
"examples": ["workjournal auth logout"],
|
|
6
|
+
"when_to_use": "When stepping away from a shared machine, rotating credentials, or before re-running `auth login` to force a fresh token."
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"command": "auth status",
|
|
3
|
+
"description": "Print whether the CLI is authenticated and when the current access token expires (ISO timestamp, with `(expired, will auto-refresh)` when in the past).",
|
|
4
|
+
"annotations": { "destructive": false, "idempotent": true },
|
|
5
|
+
"examples": ["workjournal auth status"],
|
|
6
|
+
"when_to_use": "Diagnosing token-expiry issues or scripting an auth-precheck before a batch of CLI calls. The CLI auto-refreshes on 401, so an expired timestamp here is rarely a real problem."
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"command": "auth whoami",
|
|
3
|
+
"description": "Print whether the CLI is authenticated and where credentials are stored on disk.",
|
|
4
|
+
"annotations": { "destructive": false, "idempotent": true },
|
|
5
|
+
"examples": ["workjournal auth whoami"],
|
|
6
|
+
"when_to_use": "Quick yes/no check that credentials are present. For token-expiry detail use `auth status` instead."
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"command": "config show",
|
|
3
|
+
"description": "Print the resolved CLI configuration — both project-config (the `.workjournal` file in the current directory or any parent) and global-config (in the user config dir).",
|
|
4
|
+
"annotations": { "destructive": false, "idempotent": true },
|
|
5
|
+
"examples": ["workjournal config show"],
|
|
6
|
+
"when_to_use": "Diagnosing which workspace and journal the shortcut forms (`workjournal`, `workjournal journal`) will resolve to. Project values take precedence over global."
|
|
7
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"command": "entries delete",
|
|
3
|
+
"description": "Delete a single entry by its per-journal index. Irreversible. The index is not reused; subsequent entries keep their existing indices.",
|
|
4
|
+
"args": [
|
|
5
|
+
{ "name": "workspaceSlug", "required": true, "description": "Slug from `workspaces list`." },
|
|
6
|
+
{ "name": "journalSlug", "required": true, "description": "Slug from `journals list`." },
|
|
7
|
+
{ "name": "index", "required": true, "description": "Per-journal positive integer (≥ 1)." }
|
|
8
|
+
],
|
|
9
|
+
"annotations": { "destructive": true, "idempotent": true },
|
|
10
|
+
"examples": ["workjournal entries delete acme engineering 5"],
|
|
11
|
+
"when_to_use": "Removing an entry that was created by mistake or contains content that shouldn't have been recorded. Prefer `entries update` for any fix that doesn't require removal."
|
|
12
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"command": "entries get",
|
|
3
|
+
"description": "Fetch a single entry by its per-journal index. The index is the integer shown as `#N` in `entries list` output and is monotonic, never reused.",
|
|
4
|
+
"args": [
|
|
5
|
+
{ "name": "workspaceSlug", "required": true, "description": "Slug from `workspaces list`." },
|
|
6
|
+
{ "name": "journalSlug", "required": true, "description": "Slug from `journals list`." },
|
|
7
|
+
{ "name": "index", "required": true, "description": "Per-journal positive integer (≥ 1)." }
|
|
8
|
+
],
|
|
9
|
+
"annotations": { "destructive": false, "idempotent": true },
|
|
10
|
+
"examples": ["workjournal entries get acme engineering 5"],
|
|
11
|
+
"when_to_use": "Reading one specific entry by its index — useful when correlating across `entries search` results or following a reference like `entry #5`."
|
|
12
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"command": "entries last",
|
|
3
|
+
"description": "Print the N most recent entries with their full body content. Defaults to 1.",
|
|
4
|
+
"args": [
|
|
5
|
+
{ "name": "workspaceSlug", "required": true, "description": "Slug from `workspaces list`." },
|
|
6
|
+
{ "name": "journalSlug", "required": true, "description": "Slug from `journals list`." },
|
|
7
|
+
{
|
|
8
|
+
"name": "count",
|
|
9
|
+
"required": false,
|
|
10
|
+
"description": "How many entries to fetch (positive integer; default 1)."
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"annotations": { "destructive": false, "idempotent": true },
|
|
14
|
+
"examples": [
|
|
15
|
+
"workjournal entries last acme engineering",
|
|
16
|
+
"workjournal entries last acme engineering 5"
|
|
17
|
+
],
|
|
18
|
+
"when_to_use": "Reading recent work back to recover context — the most common opening move for an agent starting a new session in an existing journal."
|
|
19
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"command": "entries list",
|
|
3
|
+
"description": "List entries in a journal (newest first), slim form — no body. Use `entries last` or `entries get` to read full content.",
|
|
4
|
+
"args": [
|
|
5
|
+
{ "name": "workspaceSlug", "required": true, "description": "Slug from `workspaces list`." },
|
|
6
|
+
{ "name": "journalSlug", "required": true, "description": "Slug from `journals list`." }
|
|
7
|
+
],
|
|
8
|
+
"annotations": { "destructive": false, "idempotent": true },
|
|
9
|
+
"examples": [
|
|
10
|
+
"workjournal entries list acme engineering",
|
|
11
|
+
"workjournal entries list acme engineering --json"
|
|
12
|
+
],
|
|
13
|
+
"when_to_use": "Browsing what's in a journal. For a view that includes the body, use `entries last <ws> <j> N`."
|
|
14
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"command": "entries search",
|
|
3
|
+
"description": "Search a journal's entries by keyword. Returns slim entries (id, index, summary, created_at) — follow up with `entries get` for the full body.",
|
|
4
|
+
"args": [
|
|
5
|
+
{ "name": "workspaceSlug", "required": true, "description": "Slug from `workspaces list`." },
|
|
6
|
+
{ "name": "journalSlug", "required": true, "description": "Slug from `journals list`." },
|
|
7
|
+
{ "name": "query", "required": true, "description": "Search string. Quote multi-word queries." }
|
|
8
|
+
],
|
|
9
|
+
"annotations": { "destructive": false, "idempotent": true },
|
|
10
|
+
"examples": [
|
|
11
|
+
"workjournal entries search acme engineering auth",
|
|
12
|
+
"workjournal entries search acme engineering \"refresh token\" --json"
|
|
13
|
+
],
|
|
14
|
+
"when_to_use": "Finding past entries on a topic — file paths, feature names, error strings, decision keywords. Run several searches with different terms to find related entries."
|
|
15
|
+
}
|