grounder 0.5.0 → 0.6.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 +21 -20
- package/dist/agents/claude.d.ts +4 -4
- package/dist/agents/claude.d.ts.map +1 -1
- package/dist/agents/claude.js +158 -179
- package/dist/agents/claude.js.map +1 -1
- package/dist/agents/cursor.d.ts +3 -3
- package/dist/agents/cursor.d.ts.map +1 -1
- package/dist/agents/cursor.js +97 -144
- package/dist/agents/cursor.js.map +1 -1
- package/dist/agents/home-skills.d.ts +46 -0
- package/dist/agents/home-skills.d.ts.map +1 -0
- package/dist/agents/home-skills.js +83 -0
- package/dist/agents/home-skills.js.map +1 -0
- package/dist/agents/hook-fragment.d.ts +52 -0
- package/dist/agents/hook-fragment.d.ts.map +1 -0
- package/dist/agents/hook-fragment.js +76 -0
- package/dist/agents/hook-fragment.js.map +1 -0
- package/dist/agents/hook-install.d.ts +62 -0
- package/dist/agents/hook-install.d.ts.map +1 -0
- package/dist/agents/hook-install.js +74 -0
- package/dist/agents/hook-install.js.map +1 -0
- package/dist/agents/hook-runtime.d.ts +77 -10
- package/dist/agents/hook-runtime.d.ts.map +1 -1
- package/dist/agents/hook-runtime.js +274 -70
- package/dist/agents/hook-runtime.js.map +1 -1
- package/dist/agents/index.d.ts +8 -14
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +13 -19
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/types.d.ts +56 -16
- package/dist/agents/types.d.ts.map +1 -1
- package/dist/cli.js +4 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/apply.d.ts +69 -0
- package/dist/commands/apply.d.ts.map +1 -0
- package/dist/commands/apply.js +238 -0
- package/dist/commands/apply.js.map +1 -0
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +190 -97
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/handoff/peek.d.ts +1 -1
- package/dist/commands/handoff/peek.d.ts.map +1 -1
- package/dist/commands/handoff/peek.js +28 -12
- package/dist/commands/handoff/peek.js.map +1 -1
- package/dist/commands/install-drift.d.ts +34 -0
- package/dist/commands/install-drift.d.ts.map +1 -0
- package/dist/commands/install-drift.js +72 -0
- package/dist/commands/install-drift.js.map +1 -0
- package/dist/commands/migrate.d.ts +11 -3
- package/dist/commands/migrate.d.ts.map +1 -1
- package/dist/commands/migrate.js +67 -33
- package/dist/commands/migrate.js.map +1 -1
- package/dist/commands/overview.d.ts +33 -0
- package/dist/commands/overview.d.ts.map +1 -0
- package/dist/commands/overview.js +150 -0
- package/dist/commands/overview.js.map +1 -0
- package/dist/commands/render-artifact-table.d.ts +85 -0
- package/dist/commands/render-artifact-table.d.ts.map +1 -0
- package/dist/commands/render-artifact-table.js +232 -0
- package/dist/commands/render-artifact-table.js.map +1 -0
- package/dist/commands/search.d.ts.map +1 -1
- package/dist/commands/search.js +15 -4
- package/dist/commands/search.js.map +1 -1
- package/dist/commands/setup.d.ts.map +1 -1
- package/dist/commands/setup.js +86 -13
- package/dist/commands/setup.js.map +1 -1
- package/dist/commands/status.d.ts +7 -0
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +269 -88
- package/dist/commands/status.js.map +1 -1
- package/dist/connector/ledger-migrations.d.ts +55 -0
- package/dist/connector/ledger-migrations.d.ts.map +1 -0
- package/dist/connector/ledger-migrations.js +94 -0
- package/dist/connector/ledger-migrations.js.map +1 -0
- package/dist/connector/state.d.ts +96 -59
- package/dist/connector/state.d.ts.map +1 -1
- package/dist/connector/state.js +165 -107
- package/dist/connector/state.js.map +1 -1
- package/dist/help.d.ts +1 -1
- package/dist/help.d.ts.map +1 -1
- package/dist/help.js +27 -5
- package/dist/help.js.map +1 -1
- package/dist/reconcile/apply.d.ts +31 -0
- package/dist/reconcile/apply.d.ts.map +1 -0
- package/dist/reconcile/apply.js +97 -0
- package/dist/reconcile/apply.js.map +1 -0
- package/dist/reconcile/core.d.ts +82 -0
- package/dist/reconcile/core.d.ts.map +1 -0
- package/dist/reconcile/core.js +163 -0
- package/dist/reconcile/core.js.map +1 -0
- package/dist/reconcile/disk.d.ts +13 -0
- package/dist/reconcile/disk.d.ts.map +1 -0
- package/dist/reconcile/disk.js +28 -0
- package/dist/reconcile/disk.js.map +1 -0
- package/dist/util/fs.d.ts +14 -0
- package/dist/util/fs.d.ts.map +1 -1
- package/dist/util/fs.js +27 -1
- package/dist/util/fs.js.map +1 -1
- package/dist/util/merge-json.d.ts +13 -2
- package/dist/util/merge-json.d.ts.map +1 -1
- package/dist/util/merge-json.js +24 -10
- package/dist/util/merge-json.js.map +1 -1
- package/dist/vault/list-handoffs.d.ts +13 -3
- package/dist/vault/list-handoffs.d.ts.map +1 -1
- package/dist/vault/list-handoffs.js +28 -13
- package/dist/vault/list-handoffs.js.map +1 -1
- package/dist/vault/list-notes.d.ts +12 -3
- package/dist/vault/list-notes.d.ts.map +1 -1
- package/dist/vault/list-notes.js +13 -7
- package/dist/vault/list-notes.js.map +1 -1
- package/dist/vault/list-plans.d.ts +12 -3
- package/dist/vault/list-plans.d.ts.map +1 -1
- package/dist/vault/list-plans.js +13 -7
- package/dist/vault/list-plans.js.map +1 -1
- package/dist/vault/search.d.ts.map +1 -1
- package/dist/vault/search.js +128 -24
- package/dist/vault/search.js.map +1 -1
- package/package.json +2 -2
- package/templates/agents/claude/skills/grounder-handoff/SKILL.md +73 -0
- package/templates/agents/claude/{commands/grounder-note.md → skills/grounder-note/SKILL.md} +6 -0
- package/templates/agents/claude/skills/grounder-overview/SKILL.md +21 -0
- package/templates/agents/claude/{commands/grounder-plan.md → skills/grounder-plan/SKILL.md} +6 -0
- package/templates/agents/claude/skills/grounder-recall/SKILL.md +34 -0
- package/templates/agents/claude/{commands/grounder-search.md → skills/grounder-search/SKILL.md} +16 -8
- package/templates/agents/cursor/skills/grounder-handoff/SKILL.md +73 -0
- package/templates/agents/cursor/{commands/grounder-note.md → skills/grounder-note/SKILL.md} +6 -0
- package/templates/agents/cursor/skills/grounder-overview/SKILL.md +21 -0
- package/templates/agents/cursor/{commands/grounder-plan.md → skills/grounder-plan/SKILL.md} +6 -0
- package/templates/agents/cursor/skills/grounder-recall/SKILL.md +34 -0
- package/templates/agents/cursor/{commands/grounder-search.md → skills/grounder-search/SKILL.md} +16 -8
- package/templates/vault/plan.md +1 -1
- package/templates/vault/session-handoff.md +2 -1
- package/dist/agents/install-command.d.ts +0 -35
- package/dist/agents/install-command.d.ts.map +0 -1
- package/dist/agents/install-command.js +0 -65
- package/dist/agents/install-command.js.map +0 -1
- package/dist/commands/apply-agent-installs.d.ts +0 -34
- package/dist/commands/apply-agent-installs.d.ts.map +0 -1
- package/dist/commands/apply-agent-installs.js +0 -137
- package/dist/commands/apply-agent-installs.js.map +0 -1
- package/templates/agents/claude/commands/grounder-task-handoff.md +0 -58
- package/templates/agents/claude/commands/grounder-task.md +0 -22
- package/templates/agents/cursor/commands/grounder-task-handoff.md +0 -58
- package/templates/agents/cursor/commands/grounder-task.md +0 -22
|
@@ -1,86 +1,123 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
id: string;
|
|
4
|
-
name: string;
|
|
5
|
-
commandsSchema: number;
|
|
6
|
-
hooksSchema?: number;
|
|
7
|
-
}
|
|
8
|
-
/** Per-file install record for chezmoi-style drift detection on command markdown. */
|
|
1
|
+
export { LEDGER_SCHEMA, MIN_SUPPORTED_LEDGER_SCHEMA } from "./ledger-migrations.js";
|
|
2
|
+
/** Per-file install record for chezmoi-style drift detection on managed markdown. */
|
|
9
3
|
export interface AgentFileState {
|
|
10
4
|
/** `sha256:…` of the exact bytes Grounder last wrote (see `hashContent`). */
|
|
11
|
-
hash
|
|
5
|
+
hash: string;
|
|
12
6
|
}
|
|
13
|
-
export interface
|
|
14
|
-
commandsSchema: number;
|
|
15
|
-
hooksSchema?: number;
|
|
7
|
+
export interface AgentLedgerEntry {
|
|
16
8
|
files: Record<string, AgentFileState>;
|
|
9
|
+
/**
|
|
10
|
+
* Tri-state, deliberately not a plain boolean: `undefined` = never recorded
|
|
11
|
+
* (legacy ledger, or hooks never touched), `true` = on, `false` =
|
|
12
|
+
* explicitly turned off via `--no-hooks`. Collapsing "never recorded" into
|
|
13
|
+
* `false` would make setup/migrate's disk-recognizer hydration silently
|
|
14
|
+
* flip a user's `--no-hooks` opt-out back on.
|
|
15
|
+
*/
|
|
16
|
+
hooksEnabled?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* The exact `{{GROUNDER_CLI}}` substitution (`runtimeInvocation()`) used the
|
|
19
|
+
* last time `setup`/`migrate` actually wrote this agent's files. Lets the
|
|
20
|
+
* cheap drift check (`installDriftDetected`) re-render "desired" content
|
|
21
|
+
* with the *same* invocation baked in last time, instead of the checking
|
|
22
|
+
* process's own `process.execPath` — see
|
|
23
|
+
* docs/architecture/runtime-invocation.md's "Repair loop" section for why
|
|
24
|
+
* that distinction matters. `undefined` for a ledger predating this field;
|
|
25
|
+
* self-heals on the next real `setup`/`migrate`.
|
|
26
|
+
*/
|
|
27
|
+
lastInvocation?: string;
|
|
17
28
|
}
|
|
18
29
|
export interface GrounderState {
|
|
30
|
+
/** `state.json`'s own file-format version — forward-compat for the ledger shape itself. */
|
|
31
|
+
ledgerSchema: number;
|
|
19
32
|
/** Package version that last wrote install artifacts (via setup / migrate). */
|
|
20
33
|
grounderVersion: string;
|
|
21
|
-
agents: Record<string,
|
|
34
|
+
agents: Record<string, AgentLedgerEntry>;
|
|
22
35
|
}
|
|
23
36
|
export declare function statePath(homeDir?: string): string;
|
|
24
37
|
/**
|
|
25
38
|
* Read `~/.grounder/state.json`. Missing file → `null` (legacy / pre-ledger
|
|
26
|
-
* install
|
|
39
|
+
* install). A `ledgerSchema` older than current (only v0.5.0's real shape —
|
|
40
|
+
* `commandsSchema`/`hooksSchema`, no `ledgerSchema` field — has ever existed
|
|
41
|
+
* on disk) is upgraded to the current shape in memory only; disk is untouched
|
|
42
|
+
* until a real ledger write (`setup`/`migrate`/`setLedgerFileHash`/etc).
|
|
43
|
+
* `status`, `doctor`, and `handoff peek` must never write `state.json` as a
|
|
44
|
+
* side effect of reading it.
|
|
45
|
+
*
|
|
46
|
+
* The gate runs immediately after `JSON.parse`, ahead of the
|
|
47
|
+
* `grounderVersion`/`agents` validation below: a schema-2 file that
|
|
48
|
+
* restructures `agents` must report "upgrade grounder", not "missing
|
|
49
|
+
* agents — fix or remove it".
|
|
27
50
|
*/
|
|
28
51
|
export declare function readGrounderState(homeDir?: string): Promise<GrounderState | null>;
|
|
52
|
+
/** Atomic write — tmp file + rename, so a crash mid-write never leaves a truncated ledger. */
|
|
29
53
|
export declare function writeGrounderState(state: GrounderState, homeDir?: string): Promise<void>;
|
|
30
|
-
/**
|
|
31
|
-
export declare function
|
|
32
|
-
/**
|
|
33
|
-
export declare function
|
|
34
|
-
|
|
54
|
+
/** Last-recorded content hash for a managed file, or `undefined` if unknown. */
|
|
55
|
+
export declare function recordedFileHash(state: GrounderState | null, agentId: string, filePath: string): string | undefined;
|
|
56
|
+
/** One agent's last-applied manifest, or `undefined` when this agent has no ledger entry at all. */
|
|
57
|
+
export declare function ledgerFilesFor(state: GrounderState | null, agentId: string): Record<string, AgentFileState> | undefined;
|
|
58
|
+
/** Tri-state hooks intent for an agent: `undefined` (never recorded) / `true` / `false`. */
|
|
59
|
+
export declare function recordedHooksEnabled(state: GrounderState | null, agentId: string): boolean | undefined;
|
|
60
|
+
/** The `{{GROUNDER_CLI}}` invocation used at this agent's last real install, or `undefined`. */
|
|
61
|
+
export declare function recordedInvocation(state: GrounderState | null, agentId: string): string | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* Persist one file's hash for one agent, right after that file's own write
|
|
64
|
+
* succeeds — per-artifact, not batched, so a mid-run crash leaves the ledger
|
|
65
|
+
* consistent with whatever actually completed. No-op if already current.
|
|
66
|
+
*/
|
|
67
|
+
export declare function setLedgerFileHash(opts: {
|
|
35
68
|
agentId: string;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
* existing value (or `0` for a new agent). Omit when every command file was
|
|
39
|
-
* skipped as locally edited or from an old install, so state does not look
|
|
40
|
-
* up to date when the files were not updated.
|
|
41
|
-
*/
|
|
42
|
-
commandsSchema?: number;
|
|
43
|
-
/** When set, updates the hooks version; when omitted, keeps any existing value. */
|
|
44
|
-
hooksSchema?: number;
|
|
45
|
-
/**
|
|
46
|
-
* Merge into the agent's `files` map (absolute path → state). Omitting leaves
|
|
47
|
-
* existing entries alone; pass `{}` is a no-op merge.
|
|
48
|
-
*/
|
|
49
|
-
files?: Record<string, AgentFileState>;
|
|
69
|
+
filePath: string;
|
|
70
|
+
hash: string;
|
|
50
71
|
grounderVersion: string;
|
|
51
72
|
homeDir?: string;
|
|
52
|
-
}
|
|
73
|
+
}): Promise<void>;
|
|
53
74
|
/**
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
75
|
+
* Drop one path's ledger entry — for a file deleted outright (tombstone
|
|
76
|
+
* retirement), where there is no new hash to overwrite it with. No-op when
|
|
77
|
+
* there's no state, no such agent, or no recorded entry for that path.
|
|
57
78
|
*/
|
|
58
|
-
export declare function
|
|
79
|
+
export declare function forgetLedgerFile(opts: {
|
|
80
|
+
agentId: string;
|
|
81
|
+
filePath: string;
|
|
82
|
+
grounderVersion: string;
|
|
83
|
+
homeDir?: string;
|
|
84
|
+
}): Promise<void>;
|
|
85
|
+
/** Persist an agent's hooks intent (tri-state). Setup/migrate only — never called from doctor. */
|
|
86
|
+
export declare function setHooksEnabled(opts: {
|
|
87
|
+
agentId: string;
|
|
88
|
+
enabled: boolean;
|
|
89
|
+
grounderVersion: string;
|
|
90
|
+
homeDir?: string;
|
|
91
|
+
}): Promise<void>;
|
|
59
92
|
/**
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
* If there is no state file, returns false (callers handle that separately).
|
|
65
|
-
* Only agents listed in state are checked.
|
|
66
|
-
*
|
|
67
|
-
* Session hooks: if an agent has no `hooksSchema` in state, that means hooks
|
|
68
|
-
* were never turned on for them. That is not "behind" — otherwise peek would
|
|
69
|
-
* keep telling people who never enabled hooks to run migrate. Doctor verifies
|
|
70
|
-
* on-disk command/hook drift via migrate dry-run, and also warns when files
|
|
71
|
-
* already match but these ledger schema numbers still lag.
|
|
93
|
+
* Persist the exact invocation used for this agent's just-completed real
|
|
94
|
+
* install, so the cheap drift check can replay it later instead of the
|
|
95
|
+
* checking process's own `process.execPath`. No-op if already current.
|
|
72
96
|
*/
|
|
73
|
-
export declare function
|
|
97
|
+
export declare function setLedgerInvocation(opts: {
|
|
98
|
+
agentId: string;
|
|
99
|
+
invocation: string;
|
|
100
|
+
grounderVersion: string;
|
|
101
|
+
homeDir?: string;
|
|
102
|
+
}): Promise<void>;
|
|
74
103
|
/**
|
|
75
|
-
*
|
|
76
|
-
*
|
|
104
|
+
* Shared by `touchGrounderVersion`'s own no-op guard and `migrate`/`setup`'s
|
|
105
|
+
* reported "did the ledger change" row, so the two can't independently drift
|
|
106
|
+
* on the same comparison.
|
|
77
107
|
*/
|
|
78
|
-
export declare function
|
|
79
|
-
/**
|
|
80
|
-
|
|
108
|
+
export declare function ledgerVersionChanged(existing: GrounderState | null, grounderVersion: string): boolean;
|
|
109
|
+
/**
|
|
110
|
+
* Stamp `grounderVersion` unconditionally — the hook for an all-noop plan
|
|
111
|
+
* (nothing else in a per-artifact write loop touches it when every entry was
|
|
112
|
+
* `noop`), so the upgrade banner still clears on a fully-current machine.
|
|
113
|
+
*/
|
|
114
|
+
export declare function touchGrounderVersion(grounderVersion: string, homeDir?: string): Promise<void>;
|
|
81
115
|
/**
|
|
82
|
-
*
|
|
83
|
-
*
|
|
116
|
+
* Write-path-only hard stop (gap 2): an older binary reconciling a ledger
|
|
117
|
+
* written by a newer one must refuse to write, not silently overwrite newer
|
|
118
|
+
* skill files with older ones. Never called from `doctor`/`status`/`peek` —
|
|
119
|
+
* those keep today's warning and stay fully functional against a newer
|
|
120
|
+
* ledger (see `package-version-notice.ts`'s `"behind"` branch).
|
|
84
121
|
*/
|
|
85
|
-
export declare function
|
|
122
|
+
export declare function assertVersionSupportsWrite(runningVersion: string, state: GrounderState | null): void;
|
|
86
123
|
//# sourceMappingURL=state.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/connector/state.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/connector/state.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,aAAa,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAEpF,qFAAqF;AACrF,MAAM,WAAW,cAAc;IAC7B,6EAA6E;IAC7E,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IACtC;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;;;;;;;OASG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,aAAa;IAC5B,2FAA2F;IAC3F,YAAY,EAAE,MAAM,CAAC;IACrB,+EAA+E;IAC/E,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;CAC1C;AAED,wBAAgB,SAAS,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAElD;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,iBAAiB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CA0GvF;AAED,8FAA8F;AAC9F,wBAAsB,kBAAkB,CAAC,KAAK,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE9F;AAED,gFAAgF;AAChF,wBAAgB,gBAAgB,CAC9B,KA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;;GAIG;AACH,wBAAsB,mBAAmB,CAAC,IAAI,EAAE;IAC9C,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,GAAG,OAAO,CAAC,IAAI,CAAC,CAYhB;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,aAAa,GAAG,IAAI,EAC9B,eAAe,EAAE,MAAM,GACtB,OAAO,CAET;AAED;;;;GAIG;AACH,wBAAsB,oBAAoB,CACxC,eAAe,EAAE,MAAM,EACvB,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC,CASf;AAED;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CACxC,cAAc,EAAE,MAAM,EACtB,KAAK,EAAE,aAAa,GAAG,IAAI,GAC1B,IAAI,CASN"}
|
package/dist/connector/state.js
CHANGED
|
@@ -1,14 +1,27 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import { fileExists } from "../util/fs.js";
|
|
3
|
+
import { fileExists, writeFileAtomic } from "../util/fs.js";
|
|
4
|
+
import { packageVersionRelation } from "../util/semver.js";
|
|
4
5
|
import { resolveHomeDir } from "./home.js";
|
|
6
|
+
import { applyLedgerUpgrades, LEDGER_SCHEMA, MIN_SUPPORTED_LEDGER_SCHEMA, } from "./ledger-migrations.js";
|
|
5
7
|
import { UnsupportedSchemaError } from "./unsupported-schema.js";
|
|
8
|
+
export { LEDGER_SCHEMA, MIN_SUPPORTED_LEDGER_SCHEMA } from "./ledger-migrations.js";
|
|
6
9
|
export function statePath(homeDir) {
|
|
7
10
|
return path.join(resolveHomeDir(homeDir), ".grounder", "state.json");
|
|
8
11
|
}
|
|
9
12
|
/**
|
|
10
13
|
* Read `~/.grounder/state.json`. Missing file → `null` (legacy / pre-ledger
|
|
11
|
-
* install
|
|
14
|
+
* install). A `ledgerSchema` older than current (only v0.5.0's real shape —
|
|
15
|
+
* `commandsSchema`/`hooksSchema`, no `ledgerSchema` field — has ever existed
|
|
16
|
+
* on disk) is upgraded to the current shape in memory only; disk is untouched
|
|
17
|
+
* until a real ledger write (`setup`/`migrate`/`setLedgerFileHash`/etc).
|
|
18
|
+
* `status`, `doctor`, and `handoff peek` must never write `state.json` as a
|
|
19
|
+
* side effect of reading it.
|
|
20
|
+
*
|
|
21
|
+
* The gate runs immediately after `JSON.parse`, ahead of the
|
|
22
|
+
* `grounderVersion`/`agents` validation below: a schema-2 file that
|
|
23
|
+
* restructures `agents` must report "upgrade grounder", not "missing
|
|
24
|
+
* agents — fix or remove it".
|
|
12
25
|
*/
|
|
13
26
|
export async function readGrounderState(homeDir) {
|
|
14
27
|
const filePath = statePath(homeDir);
|
|
@@ -23,149 +36,194 @@ export async function readGrounderState(homeDir) {
|
|
|
23
36
|
const detail = error instanceof Error ? error.message : String(error);
|
|
24
37
|
throw new Error(`Invalid grounder state at ${filePath}: ${detail}. Fix or remove it, then run: grounder migrate --force`);
|
|
25
38
|
}
|
|
26
|
-
if (typeof raw
|
|
39
|
+
if (raw === null || typeof raw !== "object" || Array.isArray(raw)) {
|
|
40
|
+
// Same "missing grounderVersion" message a non-object payload already
|
|
41
|
+
// gets further down (`raw.grounderVersion` on a boxed number/string
|
|
42
|
+
// reads as `undefined`, not a throw) — `null` is the one JSON value
|
|
43
|
+
// whose property access throws before reaching that check, so it's
|
|
44
|
+
// guarded here explicitly rather than falling through.
|
|
45
|
+
throw new Error(`Invalid grounder state at ${filePath}: missing grounderVersion. Fix or remove it, then run: grounder migrate --force`);
|
|
46
|
+
}
|
|
47
|
+
let ledgerSchema;
|
|
48
|
+
if (raw.ledgerSchema === undefined) {
|
|
49
|
+
ledgerSchema = 0;
|
|
50
|
+
}
|
|
51
|
+
else if (typeof raw.ledgerSchema === "number" && Number.isInteger(raw.ledgerSchema)) {
|
|
52
|
+
ledgerSchema = raw.ledgerSchema;
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
// Deliberate tightening, not preserved behavior: previously a non-number
|
|
56
|
+
// silently became `0`.
|
|
57
|
+
throw new Error(`Invalid grounder state at ${filePath}: ledgerSchema must be an integer. Fix or remove it, then run: grounder migrate --force`);
|
|
58
|
+
}
|
|
59
|
+
if (ledgerSchema > LEDGER_SCHEMA) {
|
|
60
|
+
throw new UnsupportedSchemaError(`${filePath} requires ledger schema ${ledgerSchema}; this grounder supports ${LEDGER_SCHEMA}. Upgrade grounder.`);
|
|
61
|
+
}
|
|
62
|
+
if (ledgerSchema < MIN_SUPPORTED_LEDGER_SCHEMA) {
|
|
63
|
+
throw new Error(`Invalid grounder state at ${filePath}: ledger schema ${ledgerSchema} is older than this grounder supports (minimum ${MIN_SUPPORTED_LEDGER_SCHEMA}). Fix or remove it, then run: grounder migrate --force`);
|
|
64
|
+
}
|
|
65
|
+
const upgraded = applyLedgerUpgrades(raw, ledgerSchema);
|
|
66
|
+
if (typeof upgraded.grounderVersion !== "string" || upgraded.grounderVersion.length === 0) {
|
|
27
67
|
throw new Error(`Invalid grounder state at ${filePath}: missing grounderVersion. Fix or remove it, then run: grounder migrate --force`);
|
|
28
68
|
}
|
|
29
|
-
if (
|
|
69
|
+
if (upgraded.agents === null ||
|
|
70
|
+
typeof upgraded.agents !== "object" ||
|
|
71
|
+
Array.isArray(upgraded.agents)) {
|
|
30
72
|
throw new Error(`Invalid grounder state at ${filePath}: missing agents`);
|
|
31
73
|
}
|
|
74
|
+
// Explicit field-by-field construction (not a spread of `upgraded`'s agent
|
|
75
|
+
// entries) so an upgraded-but-unknown key can never round-trip back to disk
|
|
76
|
+
// through `withUpdatedAgent`'s `...existing.agents` spread.
|
|
32
77
|
const agents = {};
|
|
33
|
-
for (const [id, entry] of Object.entries(
|
|
78
|
+
for (const [id, entry] of Object.entries(upgraded.agents)) {
|
|
34
79
|
if (!entry || typeof entry !== "object" || Array.isArray(entry)) {
|
|
35
80
|
throw new Error(`Invalid grounder state at ${filePath}: bad agent entry "${id}"`);
|
|
36
81
|
}
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
82
|
+
const e = entry;
|
|
83
|
+
const filesRaw = e.files;
|
|
84
|
+
// Drop, rather than cast through, any file entry whose `hash` isn't a
|
|
85
|
+
// string — a corrupted or hand-edited `{ hash: 123 }` / `{}` entry would
|
|
86
|
+
// otherwise persist forever via `withUpdatedAgent`'s `...prev.files`
|
|
87
|
+
// spread and compare unequal to every real hash anyway.
|
|
88
|
+
const files = {};
|
|
89
|
+
if (filesRaw && typeof filesRaw === "object" && !Array.isArray(filesRaw)) {
|
|
90
|
+
for (const [entryPath, fileEntry] of Object.entries(filesRaw)) {
|
|
91
|
+
const hash = fileEntry?.hash;
|
|
92
|
+
if (typeof hash === "string") {
|
|
93
|
+
files[entryPath] = { hash };
|
|
94
|
+
}
|
|
95
|
+
}
|
|
40
96
|
}
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
const
|
|
47
|
-
|
|
97
|
+
const hooksEnabled = typeof e.hooksEnabled === "boolean" ? e.hooksEnabled : undefined;
|
|
98
|
+
// Empty string treated as missing, not as a real (empty) override — a
|
|
99
|
+
// hand-edited `"lastInvocation": ""` would otherwise pass `?? ` in
|
|
100
|
+
// `desiredArtifacts()`'s override check and render with no interpreter
|
|
101
|
+
// baked in at all.
|
|
102
|
+
const lastInvocation = typeof e.lastInvocation === "string" && e.lastInvocation.length > 0
|
|
103
|
+
? e.lastInvocation
|
|
104
|
+
: undefined;
|
|
48
105
|
agents[id] = {
|
|
49
|
-
commandsSchema,
|
|
50
|
-
...(hooksSchema !== undefined ? { hooksSchema } : {}),
|
|
51
106
|
files,
|
|
107
|
+
...(hooksEnabled !== undefined ? { hooksEnabled } : {}),
|
|
108
|
+
...(lastInvocation !== undefined ? { lastInvocation } : {}),
|
|
52
109
|
};
|
|
53
110
|
}
|
|
54
|
-
return { grounderVersion:
|
|
111
|
+
return { ledgerSchema: LEDGER_SCHEMA, grounderVersion: upgraded.grounderVersion, agents };
|
|
55
112
|
}
|
|
113
|
+
/** Atomic write — tmp file + rename, so a crash mid-write never leaves a truncated ledger. */
|
|
56
114
|
export async function writeGrounderState(state, homeDir) {
|
|
57
|
-
|
|
58
|
-
await mkdir(path.dirname(filePath), { recursive: true });
|
|
59
|
-
await writeFile(filePath, `${JSON.stringify(state, null, 2)}\n`, "utf8");
|
|
115
|
+
await writeFileAtomic(statePath(homeDir), `${JSON.stringify(state, null, 2)}\n`);
|
|
60
116
|
}
|
|
61
|
-
/**
|
|
62
|
-
export function
|
|
63
|
-
return state?.agents[agentId]?.
|
|
117
|
+
/** Last-recorded content hash for a managed file, or `undefined` if unknown. */
|
|
118
|
+
export function recordedFileHash(state, agentId, filePath) {
|
|
119
|
+
return state?.agents[agentId]?.files[filePath]?.hash;
|
|
64
120
|
}
|
|
65
|
-
/**
|
|
66
|
-
export function
|
|
67
|
-
return state?.agents[agentId]?.
|
|
121
|
+
/** One agent's last-applied manifest, or `undefined` when this agent has no ledger entry at all. */
|
|
122
|
+
export function ledgerFilesFor(state, agentId) {
|
|
123
|
+
return state?.agents[agentId]?.files;
|
|
68
124
|
}
|
|
69
|
-
/**
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
*/
|
|
74
|
-
export
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
},
|
|
83
|
-
};
|
|
84
|
-
if (opts.hooksSchema !== undefined) {
|
|
85
|
-
nextEntry.hooksSchema = opts.hooksSchema;
|
|
86
|
-
}
|
|
87
|
-
else if (prev?.hooksSchema !== undefined) {
|
|
88
|
-
nextEntry.hooksSchema = prev.hooksSchema;
|
|
89
|
-
}
|
|
90
|
-
const next = {
|
|
91
|
-
grounderVersion: opts.grounderVersion,
|
|
125
|
+
/** Tri-state hooks intent for an agent: `undefined` (never recorded) / `true` / `false`. */
|
|
126
|
+
export function recordedHooksEnabled(state, agentId) {
|
|
127
|
+
return state?.agents[agentId]?.hooksEnabled;
|
|
128
|
+
}
|
|
129
|
+
/** The `{{GROUNDER_CLI}}` invocation used at this agent's last real install, or `undefined`. */
|
|
130
|
+
export function recordedInvocation(state, agentId) {
|
|
131
|
+
return state?.agents[agentId]?.lastInvocation;
|
|
132
|
+
}
|
|
133
|
+
function withUpdatedAgent(existing, agentId, updateEntry, grounderVersion) {
|
|
134
|
+
const prevAgent = existing?.agents[agentId] ?? { files: {} };
|
|
135
|
+
return {
|
|
136
|
+
ledgerSchema: LEDGER_SCHEMA,
|
|
137
|
+
grounderVersion,
|
|
92
138
|
agents: {
|
|
93
139
|
...(existing?.agents ?? {}),
|
|
94
|
-
[
|
|
140
|
+
[agentId]: updateEntry(prevAgent),
|
|
95
141
|
},
|
|
96
142
|
};
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Persist one file's hash for one agent, right after that file's own write
|
|
146
|
+
* succeeds — per-artifact, not batched, so a mid-run crash leaves the ledger
|
|
147
|
+
* consistent with whatever actually completed. No-op if already current.
|
|
148
|
+
*/
|
|
149
|
+
export async function setLedgerFileHash(opts) {
|
|
150
|
+
const existing = await readGrounderState(opts.homeDir);
|
|
151
|
+
if (existing?.agents[opts.agentId]?.files[opts.filePath]?.hash === opts.hash) {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
const next = withUpdatedAgent(existing, opts.agentId, (prev) => ({ ...prev, files: { ...prev.files, [opts.filePath]: { hash: opts.hash } } }), opts.grounderVersion);
|
|
97
155
|
await writeGrounderState(next, opts.homeDir);
|
|
98
|
-
return next;
|
|
99
156
|
}
|
|
100
157
|
/**
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
* If there is no state file, returns false (callers handle that separately).
|
|
106
|
-
* Only agents listed in state are checked.
|
|
107
|
-
*
|
|
108
|
-
* Session hooks: if an agent has no `hooksSchema` in state, that means hooks
|
|
109
|
-
* were never turned on for them. That is not "behind" — otherwise peek would
|
|
110
|
-
* keep telling people who never enabled hooks to run migrate. Doctor verifies
|
|
111
|
-
* on-disk command/hook drift via migrate dry-run, and also warns when files
|
|
112
|
-
* already match but these ledger schema numbers still lag.
|
|
158
|
+
* Drop one path's ledger entry — for a file deleted outright (tombstone
|
|
159
|
+
* retirement), where there is no new hash to overwrite it with. No-op when
|
|
160
|
+
* there's no state, no such agent, or no recorded entry for that path.
|
|
113
161
|
*/
|
|
114
|
-
export function
|
|
115
|
-
|
|
116
|
-
|
|
162
|
+
export async function forgetLedgerFile(opts) {
|
|
163
|
+
const existing = await readGrounderState(opts.homeDir);
|
|
164
|
+
const prevAgent = existing?.agents[opts.agentId];
|
|
165
|
+
if (!existing || !prevAgent || !(opts.filePath in prevAgent.files)) {
|
|
166
|
+
return;
|
|
117
167
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
entry.hooksSchema !== undefined &&
|
|
128
|
-
entry.hooksSchema < agent.hooksSchema) {
|
|
129
|
-
return true;
|
|
130
|
-
}
|
|
168
|
+
const files = Object.fromEntries(Object.entries(prevAgent.files).filter(([p]) => p !== opts.filePath));
|
|
169
|
+
const next = withUpdatedAgent(existing, opts.agentId, (prev) => ({ ...prev, files }), opts.grounderVersion);
|
|
170
|
+
await writeGrounderState(next, opts.homeDir);
|
|
171
|
+
}
|
|
172
|
+
/** Persist an agent's hooks intent (tri-state). Setup/migrate only — never called from doctor. */
|
|
173
|
+
export async function setHooksEnabled(opts) {
|
|
174
|
+
const existing = await readGrounderState(opts.homeDir);
|
|
175
|
+
if (existing?.agents[opts.agentId]?.hooksEnabled === opts.enabled) {
|
|
176
|
+
return;
|
|
131
177
|
}
|
|
132
|
-
|
|
178
|
+
const next = withUpdatedAgent(existing, opts.agentId, (prev) => ({ ...prev, hooksEnabled: opts.enabled }), opts.grounderVersion);
|
|
179
|
+
await writeGrounderState(next, opts.homeDir);
|
|
133
180
|
}
|
|
134
181
|
/**
|
|
135
|
-
*
|
|
136
|
-
*
|
|
182
|
+
* Persist the exact invocation used for this agent's just-completed real
|
|
183
|
+
* install, so the cheap drift check can replay it later instead of the
|
|
184
|
+
* checking process's own `process.execPath`. No-op if already current.
|
|
137
185
|
*/
|
|
138
|
-
export function
|
|
139
|
-
|
|
140
|
-
|
|
186
|
+
export async function setLedgerInvocation(opts) {
|
|
187
|
+
const existing = await readGrounderState(opts.homeDir);
|
|
188
|
+
if (existing?.agents[opts.agentId]?.lastInvocation === opts.invocation) {
|
|
189
|
+
return;
|
|
141
190
|
}
|
|
142
|
-
|
|
191
|
+
const next = withUpdatedAgent(existing, opts.agentId, (prev) => ({ ...prev, lastInvocation: opts.invocation }), opts.grounderVersion);
|
|
192
|
+
await writeGrounderState(next, opts.homeDir);
|
|
143
193
|
}
|
|
144
|
-
/**
|
|
145
|
-
|
|
146
|
-
|
|
194
|
+
/**
|
|
195
|
+
* Shared by `touchGrounderVersion`'s own no-op guard and `migrate`/`setup`'s
|
|
196
|
+
* reported "did the ledger change" row, so the two can't independently drift
|
|
197
|
+
* on the same comparison.
|
|
198
|
+
*/
|
|
199
|
+
export function ledgerVersionChanged(existing, grounderVersion) {
|
|
200
|
+
return existing?.grounderVersion !== grounderVersion;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Stamp `grounderVersion` unconditionally — the hook for an all-noop plan
|
|
204
|
+
* (nothing else in a per-artifact write loop touches it when every entry was
|
|
205
|
+
* `noop`), so the upgrade banner still clears on a fully-current machine.
|
|
206
|
+
*/
|
|
207
|
+
export async function touchGrounderVersion(grounderVersion, homeDir) {
|
|
208
|
+
const existing = await readGrounderState(homeDir);
|
|
209
|
+
if (!ledgerVersionChanged(existing, grounderVersion)) {
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
await writeGrounderState({ ledgerSchema: LEDGER_SCHEMA, grounderVersion, agents: existing?.agents ?? {} }, homeDir);
|
|
147
213
|
}
|
|
148
214
|
/**
|
|
149
|
-
*
|
|
150
|
-
*
|
|
215
|
+
* Write-path-only hard stop (gap 2): an older binary reconciling a ledger
|
|
216
|
+
* written by a newer one must refuse to write, not silently overwrite newer
|
|
217
|
+
* skill files with older ones. Never called from `doctor`/`status`/`peek` —
|
|
218
|
+
* those keep today's warning and stay fully functional against a newer
|
|
219
|
+
* ledger (see `package-version-notice.ts`'s `"behind"` branch).
|
|
151
220
|
*/
|
|
152
|
-
export function
|
|
221
|
+
export function assertVersionSupportsWrite(runningVersion, state) {
|
|
153
222
|
if (!state) {
|
|
154
223
|
return;
|
|
155
224
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
if (!recorded) {
|
|
159
|
-
continue;
|
|
160
|
-
}
|
|
161
|
-
if (recorded.commandsSchema > agent.commandsSchema) {
|
|
162
|
-
throw new UnsupportedSchemaError(`${agent.name} commands schema ${recorded.commandsSchema} is newer than this grounder supports (${agent.commandsSchema}). Upgrade grounder.`);
|
|
163
|
-
}
|
|
164
|
-
if (recorded.hooksSchema !== undefined &&
|
|
165
|
-
agent.hooksSchema !== undefined &&
|
|
166
|
-
recorded.hooksSchema > agent.hooksSchema) {
|
|
167
|
-
throw new UnsupportedSchemaError(`${agent.name} hooks schema ${recorded.hooksSchema} is newer than this grounder supports (${agent.hooksSchema}). Upgrade grounder.`);
|
|
168
|
-
}
|
|
225
|
+
if (packageVersionRelation(runningVersion, state.grounderVersion) === "behind") {
|
|
226
|
+
throw new UnsupportedSchemaError(`This Grounder (${runningVersion}) is older than your configuration (${state.grounderVersion}). Install a newer Grounder.`);
|
|
169
227
|
}
|
|
170
228
|
}
|
|
171
229
|
//# sourceMappingURL=state.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../src/connector/state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../src/connector/state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,2BAA2B,GAC5B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAEjE,OAAO,EAAE,aAAa,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAuCpF,MAAM,UAAU,SAAS,CAAC,OAAgB;IACxC,OAAO,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,WAAW,EAAE,YAAY,CAAC,CAAC;AACvE,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,OAAgB;IACtD,MAAM,QAAQ,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;IACpC,IAAI,CAAC,CAAC,MAAM,UAAU,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC;QAClC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,GAA4B,CAAC;IACjC,IAAI,CAAC;QACH,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,CAA4B,CAAC;IAChF,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACxB,MAAM,MAAM,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,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;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,eAAuB,EACvB,OAAgB;IAEhB,MAAM,QAAQ,GAAG,MAAM,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAClD,IAAI,CAAC,oBAAoB,CAAC,QAAQ,EAAE,eAAe,CAAC,EAAE,CAAC;QACrD,OAAO;IACT,CAAC;IACD,MAAM,kBAAkB,CACtB,EAAE,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,IAAI,EAAE,EAAE,EAChF,OAAO,CACR,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,0BAA0B,CACxC,cAAsB,EACtB,KAA2B;IAE3B,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO;IACT,CAAC;IACD,IAAI,sBAAsB,CAAC,cAAc,EAAE,KAAK,CAAC,eAAe,CAAC,KAAK,QAAQ,EAAE,CAAC;QAC/E,MAAM,IAAI,sBAAsB,CAC9B,kBAAkB,cAAc,uCAAuC,KAAK,CAAC,eAAe,8BAA8B,CAC3H,CAAC;IACJ,CAAC;AACH,CAAC"}
|
package/dist/help.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ export declare const COMMANDS: readonly CommandMeta[];
|
|
|
24
24
|
* Command ids the CLI dispatches (including parent topics). Keep in sync with
|
|
25
25
|
* `cli.ts` / `helpExitCode(...)` call sites — the invariant test locks this.
|
|
26
26
|
*/
|
|
27
|
-
export declare const DISPATCHED_COMMAND_IDS: readonly ["setup", "link", "note", "note list", "handoff", "handoff list", "handoff peek", "plan", "plan list", "search", "path", "path notes", "path logs", "path plans", "status", "doctor", "migrate", "help"];
|
|
27
|
+
export declare const DISPATCHED_COMMAND_IDS: readonly ["setup", "link", "note", "note list", "handoff", "handoff list", "handoff peek", "plan", "plan list", "search", "overview", "path", "path notes", "path logs", "path plans", "status", "doctor", "migrate", "help"];
|
|
28
28
|
/** True when argv contains an exact `-h` or `--help` token. */
|
|
29
29
|
export declare function wantsHelp(argv: string[]): boolean;
|
|
30
30
|
/**
|
package/dist/help.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../src/help.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAE5D,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,OAAO,GAAG,UAAU,GAAG,OAAO,GAAG,UAAU,GAAG,UAAU,CAAC;AAE3F,MAAM,WAAW,WAAW;IAC1B,yDAAyD;IACzD,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,SAAS,CAAC;IACjB,0DAA0D;IAC1D,OAAO,EAAE,MAAM,CAAC;IAChB,iEAAiE;IACjE,KAAK,EAAE,MAAM,CAAC;IACd,gEAAgE;IAChE,SAAS,EAAE,MAAM,CAAC;IAClB,gDAAgD;IAChD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iEAAiE;IACjE,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAaD;;;GAGG;AACH,eAAO,MAAM,QAAQ,EAAE,SAAS,WAAW,
|
|
1
|
+
{"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../src/help.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAE5D,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,OAAO,GAAG,UAAU,GAAG,OAAO,GAAG,UAAU,GAAG,UAAU,CAAC;AAE3F,MAAM,WAAW,WAAW;IAC1B,yDAAyD;IACzD,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,SAAS,CAAC;IACjB,0DAA0D;IAC1D,OAAO,EAAE,MAAM,CAAC;IAChB,iEAAiE;IACjE,KAAK,EAAE,MAAM,CAAC;IACd,gEAAgE;IAChE,SAAS,EAAE,MAAM,CAAC;IAClB,gDAAgD;IAChD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iEAAiE;IACjE,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAaD;;;GAG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