nawabari 0.7.0 → 0.8.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 +262 -32
- package/dist/cli-command-registry.d.ts +44 -0
- package/dist/cli-command-registry.js +488 -0
- package/dist/cli-command-registry.js.map +1 -0
- package/dist/cli.d.ts +18 -0
- package/dist/cli.js +345 -584
- package/dist/cli.js.map +1 -1
- package/dist/contract.d.ts +16 -0
- package/dist/contract.js +505 -220
- package/dist/contract.js.map +1 -1
- package/dist/domain/cgroups-v2.d.ts +77 -0
- package/dist/domain/cgroups-v2.js +434 -0
- package/dist/domain/cgroups-v2.js.map +1 -0
- package/dist/domain/doctor.d.ts +4 -1
- package/dist/domain/doctor.js +20 -13
- package/dist/domain/doctor.js.map +1 -1
- package/dist/domain/errors.d.ts +7 -1
- package/dist/domain/errors.js +45 -0
- package/dist/domain/errors.js.map +1 -1
- package/dist/domain/landlock.d.ts +55 -0
- package/dist/domain/landlock.js +279 -0
- package/dist/domain/landlock.js.map +1 -0
- package/dist/domain/runtime.d.ts +12 -0
- package/dist/domain/runtime.js +50 -0
- package/dist/domain/runtime.js.map +1 -0
- package/dist/domain/sandbox-launcher.d.ts +26 -0
- package/dist/domain/sandbox-launcher.js +312 -23
- package/dist/domain/sandbox-launcher.js.map +1 -1
- package/dist/domain/sandbox-seccomp.d.ts +46 -0
- package/dist/domain/sandbox-seccomp.js +302 -0
- package/dist/domain/sandbox-seccomp.js.map +1 -0
- package/dist/domain/sandbox.d.ts +45 -1
- package/dist/domain/sandbox.js +176 -25
- package/dist/domain/sandbox.js.map +1 -1
- package/dist/domain/session-backend.d.ts +3 -1
- package/dist/domain/session-backend.js +155 -1
- package/dist/domain/session-backend.js.map +1 -1
- package/dist/domain/session.d.ts +128 -1
- package/dist/domain/session.js.map +1 -1
- package/dist/errors.d.ts +10 -1
- package/dist/errors.js.map +1 -1
- package/dist/failure-code-vocabulary.d.ts +20 -0
- package/dist/failure-code-vocabulary.js +216 -0
- package/dist/failure-code-vocabulary.js.map +1 -0
- package/dist/git.js +92 -6
- package/dist/git.js.map +1 -1
- package/dist/operation-authorization.d.ts +3 -3
- package/dist/registry/lock.d.ts +8 -0
- package/dist/registry/lock.js +38 -20
- package/dist/registry/lock.js.map +1 -1
- package/dist/repository-evidence.d.ts +16 -0
- package/dist/repository-evidence.js.map +1 -1
- package/dist/resource-claims.d.ts +17 -2
- package/dist/resource-claims.js +98 -27
- package/dist/resource-claims.js.map +1 -1
- package/dist/session-lifecycle-actions.d.ts +63 -0
- package/dist/session-lifecycle-actions.js +108 -0
- package/dist/session-lifecycle-actions.js.map +1 -0
- package/dist/session-lifecycle-classification.d.ts +67 -0
- package/dist/session-lifecycle-classification.js +355 -0
- package/dist/session-lifecycle-classification.js.map +1 -0
- package/dist/session-registry.d.ts +133 -3
- package/dist/session-registry.js +984 -91
- package/dist/session-registry.js.map +1 -1
- package/package.json +25 -25
|
@@ -0,0 +1,488 @@
|
|
|
1
|
+
import { DEFAULT_SESSION_LIST_LIMIT, MAX_SESSION_LIST_LIMIT } from "./domain/session.js";
|
|
2
|
+
import { EVIDENCE_MAX_DIFF_BYTES, EVIDENCE_MAX_DIFF_HUNKS } from "./repository-evidence.js";
|
|
3
|
+
const CLI_NAME = "nawabari";
|
|
4
|
+
export const GLOBAL_HELP_OPTIONS = [
|
|
5
|
+
{ name: "--json", description: "Emit one stable JSON document on stdout" },
|
|
6
|
+
{ name: "--help", aliases: ["-h"], description: "Show command-specific help" },
|
|
7
|
+
{ name: "--version", description: "Print the installed version" },
|
|
8
|
+
];
|
|
9
|
+
const option = (name, description, options = {}) => ({ name, description, ...options });
|
|
10
|
+
/**
|
|
11
|
+
* Canonical public command/discovery registry.
|
|
12
|
+
*
|
|
13
|
+
* Dispatcher implementation deliberately remains below in this module. This
|
|
14
|
+
* registry only describes the public discovery surface; aliases point at the
|
|
15
|
+
* canonical command so option metadata cannot drift between projections.
|
|
16
|
+
*/
|
|
17
|
+
export const CLI_COMMAND_REGISTRY = [
|
|
18
|
+
{
|
|
19
|
+
name: "session create",
|
|
20
|
+
summary: "Request a new Nawabari session",
|
|
21
|
+
usage: `${CLI_NAME} session create [options]`,
|
|
22
|
+
options: [
|
|
23
|
+
option("--branch", "Branch to create; omitted uses the generated session branch", {
|
|
24
|
+
value: "<name>",
|
|
25
|
+
default: "nawabari/session/<session_id>",
|
|
26
|
+
}),
|
|
27
|
+
option("--worktree", "Exact managed worktree path override; mutually exclusive with --worktree-root", {
|
|
28
|
+
value: "<path>",
|
|
29
|
+
default: "<managed_worktree_root>/<repository>-<session_id>",
|
|
30
|
+
}),
|
|
31
|
+
option("--worktree-root", "Managed root to place the worktree under; Nawabari derives the final path. Mutually exclusive with --worktree", { value: "<path>", default: "resolved repository-local root" }),
|
|
32
|
+
option("--base", "Commit-resolving base ref for the new worktree", { value: "<ref>", default: "HEAD" }),
|
|
33
|
+
option("--label", "Optional display label; never used as an identity", { value: "<text>", default: "omitted" }),
|
|
34
|
+
],
|
|
35
|
+
notes: [
|
|
36
|
+
"All create options are optional. Use status --json to discover managed_worktree_root.",
|
|
37
|
+
"--worktree and --worktree-root cannot be combined.",
|
|
38
|
+
],
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: "session id",
|
|
42
|
+
summary: "Resolve the current session identity",
|
|
43
|
+
usage: `${CLI_NAME} session id`,
|
|
44
|
+
options: [],
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: "session show",
|
|
48
|
+
summary: "Show the current or selected session",
|
|
49
|
+
usage: `${CLI_NAME} session show [<session-id>|--session <id>]`,
|
|
50
|
+
options: [option("--session", "Select a session instead of the current worktree owner", { value: "<id>" })],
|
|
51
|
+
notes: [
|
|
52
|
+
"Target grammar is consistent: an optional first positional <session-id> is an alias for --session <id>; do not supply both.",
|
|
53
|
+
],
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: "session inspect",
|
|
57
|
+
summary: "Report side-effect-free close/cleanup readiness for a session",
|
|
58
|
+
usage: `${CLI_NAME} session inspect [<session-id>|--session <id>] [--integrated-revision <rev>]`,
|
|
59
|
+
options: [
|
|
60
|
+
option("--session", "Select a session instead of the current worktree owner", { value: "<id>" }),
|
|
61
|
+
option("--integrated-revision", "Externally evidenced revision to test for non-ancestry (squash/rebase) integration; independently re-verified via exact Git tree-object equivalence, never trusted blindly", { value: "<rev>" }),
|
|
62
|
+
],
|
|
63
|
+
notes: [
|
|
64
|
+
"Read-only: never mutates session, claim, Git, worktree, branch, or registry state. Repeated calls are idempotent.",
|
|
65
|
+
"Derived from the same authoritative close/cleanup Git evidence as session close; does not duplicate or diverge from that logic.",
|
|
66
|
+
"Nawabari never queries GitHub or any remote provider; --integrated-revision only names a local revision for Nawabari to independently verify.",
|
|
67
|
+
"Target grammar: optional first positional <session-id> is an alias for --session <id>; do not supply both.",
|
|
68
|
+
],
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: "session run",
|
|
72
|
+
aliases: ["session exec"],
|
|
73
|
+
summary: "Run one command inside the protected session sandbox",
|
|
74
|
+
usage: `${CLI_NAME} session run [--session <id>] -- <command> [args...]`,
|
|
75
|
+
options: [option("--session", "Select the active owned session", { value: "<id>" })],
|
|
76
|
+
notes: [
|
|
77
|
+
"The -- terminator is mandatory. The command is passed as argv without a shell, and protected execution is fail-closed.",
|
|
78
|
+
"session exec is an alias.",
|
|
79
|
+
],
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
name: "session list",
|
|
83
|
+
summary: "List bounded repository session records",
|
|
84
|
+
usage: `${CLI_NAME} session list [--all|--history] [--limit <n>] [--offset <n>]`,
|
|
85
|
+
options: [
|
|
86
|
+
option("--all", "Include closed history in the bounded result"),
|
|
87
|
+
option("--history", "Alias for --all", { alias_of: "--all" }),
|
|
88
|
+
option("--limit", `Maximum records per page; must be between 1 and ${MAX_SESSION_LIST_LIMIT}`, {
|
|
89
|
+
value: "<n>",
|
|
90
|
+
default: String(DEFAULT_SESSION_LIST_LIMIT),
|
|
91
|
+
minimum: 1,
|
|
92
|
+
maximum: MAX_SESSION_LIST_LIMIT,
|
|
93
|
+
}),
|
|
94
|
+
option("--offset", "Number of visible records to skip; must be a non-negative integer", {
|
|
95
|
+
value: "<n>",
|
|
96
|
+
default: "0",
|
|
97
|
+
minimum: 0,
|
|
98
|
+
}),
|
|
99
|
+
],
|
|
100
|
+
notes: [
|
|
101
|
+
`Default output excludes closed records; --all and --history include closed history. Both views are bounded by --limit (default ${DEFAULT_SESSION_LIST_LIMIT}, maximum ${MAX_SESSION_LIST_LIMIT}) and --offset (default 0).`,
|
|
102
|
+
],
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
name: "session claim",
|
|
106
|
+
aliases: ["resource claim"],
|
|
107
|
+
summary: "Add a canonical resource claim",
|
|
108
|
+
usage: `${CLI_NAME} session claim [<session-id>|--session <id>] [--repository <id>] --resource <path-or-glob> --mode <read|write|exclusive-write>`,
|
|
109
|
+
options: [
|
|
110
|
+
option("--resource", "Repository-relative resource", { value: "<path-or-glob>", required: true }),
|
|
111
|
+
option("--mode", "Granted claim mode", { value: "<read|write|exclusive-write>", required: true }),
|
|
112
|
+
option("--session", "Target active session; omitted resolves the current owner", { value: "<id>" }),
|
|
113
|
+
option("--repository", "Expected repository identity", { value: "<id>" }),
|
|
114
|
+
],
|
|
115
|
+
notes: [
|
|
116
|
+
"Exactly one --resource/--mode pair is required; --mode must immediately follow its own --resource.",
|
|
117
|
+
"Target grammar: optional first positional <session-id> is an alias for --session <id>; do not supply both.",
|
|
118
|
+
],
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
name: "session update",
|
|
122
|
+
aliases: ["resource update"],
|
|
123
|
+
summary: "Atomically replace a session's complete resource claim set",
|
|
124
|
+
usage: `${CLI_NAME} session update [<session-id>|--session <id>] [--repository <id>] --resource <path-or-glob> --mode <read|write|exclusive-write> [--resource <path-or-glob> --mode <read|write|exclusive-write> ...]`,
|
|
125
|
+
options: [
|
|
126
|
+
option("--resource", "Repository-relative resource; repeatable, each paired with the --mode immediately after it", {
|
|
127
|
+
value: "<path-or-glob>",
|
|
128
|
+
required: true,
|
|
129
|
+
repeatable: true,
|
|
130
|
+
}),
|
|
131
|
+
option("--mode", "Mode for the --resource immediately before it; repeatable", {
|
|
132
|
+
value: "<read|write|exclusive-write>",
|
|
133
|
+
required: true,
|
|
134
|
+
repeatable: true,
|
|
135
|
+
}),
|
|
136
|
+
option("--if-generation", "Expected claim-set generation for CAS; mutually exclusive with --force", {
|
|
137
|
+
value: "<non-negative-integer>",
|
|
138
|
+
}),
|
|
139
|
+
option("--force", "Explicitly permit unconditional complete replacement; mutually exclusive with --if-generation"),
|
|
140
|
+
option("--session", "Target active session; omitted resolves the current owner", { value: "<id>" }),
|
|
141
|
+
option("--repository", "Expected repository identity", { value: "<id>" }),
|
|
142
|
+
],
|
|
143
|
+
notes: [
|
|
144
|
+
"The desired claim set is a full replacement performed atomically in one updateClaims() transaction; " +
|
|
145
|
+
"use exactly one concurrency intent: --if-generation <non-negative-integer> for claim-set generation CAS, " +
|
|
146
|
+
"or explicit --force for unconditional replacement. On any invalid, conflicting, or stale claim the prior set is left unchanged.",
|
|
147
|
+
"Each --resource must be immediately followed by its own --mode; pairing is positional adjacency, not flag order.",
|
|
148
|
+
"Target grammar: optional first positional <session-id> is an alias for --session <id>; do not supply both.",
|
|
149
|
+
],
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
name: "session mutate",
|
|
153
|
+
aliases: ["resource mutate"],
|
|
154
|
+
summary: "Atomically apply exact-resource claim additions, changes, and releases",
|
|
155
|
+
usage: `${CLI_NAME} session mutate [<session>|--session <id>] [--repository <id>] ` +
|
|
156
|
+
`(--upsert-resource <path-or-glob> --mode <read|write|exclusive-write> | --release-resource <path-or-glob>)+ ` +
|
|
157
|
+
`(--if-generation <non-negative-safe-int> | --force)`,
|
|
158
|
+
options: [
|
|
159
|
+
option("--upsert-resource", "Exact repository-relative resource to add or change; each occurrence must be immediately followed by --mode", { value: "<path-or-glob>", repeatable: true }),
|
|
160
|
+
option("--mode", "Mode for the immediately preceding --upsert-resource", {
|
|
161
|
+
value: "<read|write|exclusive-write>",
|
|
162
|
+
repeatable: true,
|
|
163
|
+
}),
|
|
164
|
+
option("--release-resource", "Exact repository-relative resource to release; repeatable", {
|
|
165
|
+
value: "<path-or-glob>",
|
|
166
|
+
repeatable: true,
|
|
167
|
+
}),
|
|
168
|
+
option("--if-generation", "Expected claim-set generation for CAS; mutually exclusive with --force", {
|
|
169
|
+
value: "<non-negative-safe-int>",
|
|
170
|
+
}),
|
|
171
|
+
option("--force", "Explicitly permit unconditional atomic mutation; mutually exclusive with --if-generation"),
|
|
172
|
+
option("--session", "Target active session; omitted resolves the current owner", { value: "<id>" }),
|
|
173
|
+
option("--repository", "Expected repository identity", { value: "<id>" }),
|
|
174
|
+
],
|
|
175
|
+
notes: [
|
|
176
|
+
"Apply one or more ordered upsert/release deltas in one backend transaction; exactly one concurrency intent is required.",
|
|
177
|
+
"Every --upsert-resource must be immediately followed by its own --mode; --release-resource takes exactly one value.",
|
|
178
|
+
"Target grammar: optional first positional <session> is an alias for --session <id>; do not supply both.",
|
|
179
|
+
],
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
name: "session transition",
|
|
183
|
+
aliases: ["resource transition"],
|
|
184
|
+
summary: "Atomically transition one exact resource claim mode",
|
|
185
|
+
usage: `${CLI_NAME} session transition [<session>|--session <id>] [--repository <id>] ` +
|
|
186
|
+
`--resource <path-or-glob> --mode <read|write|exclusive-write> ` +
|
|
187
|
+
`(--if-generation <non-negative-safe-int> | --force)`,
|
|
188
|
+
options: [
|
|
189
|
+
option("--resource", "Exact repository-relative resource to acquire or change", {
|
|
190
|
+
value: "<path-or-glob>",
|
|
191
|
+
required: true,
|
|
192
|
+
}),
|
|
193
|
+
option("--mode", "Target mode for the immediately preceding --resource", {
|
|
194
|
+
value: "<read|write|exclusive-write>",
|
|
195
|
+
required: true,
|
|
196
|
+
}),
|
|
197
|
+
option("--if-generation", "Expected claim-set generation for CAS; mutually exclusive with --force", {
|
|
198
|
+
value: "<non-negative-safe-int>",
|
|
199
|
+
}),
|
|
200
|
+
option("--force", "Explicitly permit unconditional atomic mutation; mutually exclusive with --if-generation"),
|
|
201
|
+
option("--session", "Target active session; omitted resolves the current owner", { value: "<id>" }),
|
|
202
|
+
option("--repository", "Expected repository identity", { value: "<id>" }),
|
|
203
|
+
],
|
|
204
|
+
notes: [
|
|
205
|
+
"Exactly one resource/mode pair is projected as one atomic upsert delta; same mode is an idempotent no-op.",
|
|
206
|
+
"Use exactly one concurrency intent: --if-generation <non-negative-safe-int> or explicit --force.",
|
|
207
|
+
"The target grammar accepts an optional first positional <session> or --session <id>, but not both.",
|
|
208
|
+
],
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
name: "session claims",
|
|
212
|
+
aliases: ["resource list", "resource claims"],
|
|
213
|
+
summary: "List canonical resource claims",
|
|
214
|
+
usage: `${CLI_NAME} session claims [<session-id>|--session <id>]`,
|
|
215
|
+
options: [option("--session", "Select a session; omitted lists all claims", { value: "<id>" })],
|
|
216
|
+
notes: [
|
|
217
|
+
"Target grammar: optional first positional <session-id> is an alias for --session <id>; do not supply both.",
|
|
218
|
+
],
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
name: "session release",
|
|
222
|
+
aliases: ["resource release"],
|
|
223
|
+
summary: "Release resource claims",
|
|
224
|
+
usage: `${CLI_NAME} session release [<session-id>|--session <id>] (--resource <path-or-glob> ... | --claim-id <id> ... | --all) (--if-generation <n> | --force)`,
|
|
225
|
+
options: [
|
|
226
|
+
option("--session", "Target session; omitted resolves the current owner", { value: "<id>" }),
|
|
227
|
+
option("--resource", "Release one exact canonical resource; repeatable", {
|
|
228
|
+
value: "<path-or-glob>",
|
|
229
|
+
repeatable: true,
|
|
230
|
+
}),
|
|
231
|
+
option("--claim-id", "Release one owned claim ID; repeatable", { value: "<id>", repeatable: true }),
|
|
232
|
+
option("--all", "Explicitly release all claims owned by the target session"),
|
|
233
|
+
option("--if-generation", "Require the expected claim-set generation; mutually exclusive with --force", {
|
|
234
|
+
value: "<non-negative-safe-int>",
|
|
235
|
+
}),
|
|
236
|
+
option("--force", "Explicitly allow unconditional release; mutually exclusive with --if-generation"),
|
|
237
|
+
],
|
|
238
|
+
notes: [
|
|
239
|
+
"Target grammar: optional first positional <session-id> is an alias for --session <id>; do not supply both.",
|
|
240
|
+
"Exactly one selector family is required: repeated --resource, repeated --claim-id, or explicit --all.",
|
|
241
|
+
"Exactly one destructive concurrency intent is required: --if-generation <non-negative-safe-int> or --force.",
|
|
242
|
+
],
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
name: "session close",
|
|
246
|
+
summary: "Close the current or selected session",
|
|
247
|
+
usage: `${CLI_NAME} session close [<session-id>|--session <id>] [--integrated-revision <rev>] [--fetch-remote <name> --fetch-branch <branch>]`,
|
|
248
|
+
options: [
|
|
249
|
+
option("--session", "Select a session instead of the current worktree owner", { value: "<id>" }),
|
|
250
|
+
option("--integrated-revision", "Externally evidenced revision proving non-ancestry (squash/rebase) integration; independently re-verified via exact Git tree-object equivalence, never trusted blindly", { value: "<rev>" }),
|
|
251
|
+
option("--fetch-remote", "Explicitly fetch one remote integration branch into a disposable proof ref", {
|
|
252
|
+
value: "<name>",
|
|
253
|
+
}),
|
|
254
|
+
option("--fetch-branch", "Integration branch to fetch; requires --fetch-remote", { value: "<branch>" }),
|
|
255
|
+
],
|
|
256
|
+
notes: [
|
|
257
|
+
"Ordinary ancestry-based close remains the cheap/default path and requires no flags.",
|
|
258
|
+
"Network access is never implicit; --fetch-remote and --fetch-branch are accepted only with a full lowercase --integrated-revision SHA.",
|
|
259
|
+
"Fetch updates only a disposable internal proof ref with no tags, FETCH_HEAD, tracking-ref, or local integration-branch changes; remote tip races fail closed.",
|
|
260
|
+
"Nawabari never calls provider APIs such as GitHub; only explicit --fetch-remote/--fetch-branch options connect to the configured Git remote.",
|
|
261
|
+
"Target grammar: optional first positional <session-id> is an alias for --session <id>; do not supply both.",
|
|
262
|
+
],
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
name: "session discard",
|
|
266
|
+
summary: "Explicitly discard one selected session and its owned resources",
|
|
267
|
+
usage: `${CLI_NAME} session discard <session-id>|--session <id>`,
|
|
268
|
+
options: [
|
|
269
|
+
option("--session", "Required explicit target; the current session is never inferred", {
|
|
270
|
+
value: "<id>",
|
|
271
|
+
required: true,
|
|
272
|
+
}),
|
|
273
|
+
],
|
|
274
|
+
notes: [
|
|
275
|
+
"Destructive and explicit: unintegrated commits and uncommitted work in the selected owned worktree may be destroyed.",
|
|
276
|
+
"Discard never changes close, gc, doctor, reconciliation, or integration-lineage proof behavior.",
|
|
277
|
+
"Use exactly one target form: positional <session-id> or --session <id>; do not supply both.",
|
|
278
|
+
"Machine JSON mode is non-interactive and deterministic.",
|
|
279
|
+
],
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
name: "authorize",
|
|
283
|
+
summary: "Authorize an operation against concrete claims",
|
|
284
|
+
usage: `${CLI_NAME} authorize --operation <name> --resource <path> [--resource <path>] [--session <id>]`,
|
|
285
|
+
options: [
|
|
286
|
+
option("--session", "Assert the current session identity", { value: "<id>" }),
|
|
287
|
+
option("--operation", "Operation vocabulary entry", { value: "<name>", required: true }),
|
|
288
|
+
option("--resource", "Concrete repository-relative path; repeatable", {
|
|
289
|
+
value: "<path>",
|
|
290
|
+
required: true,
|
|
291
|
+
repeatable: true,
|
|
292
|
+
}),
|
|
293
|
+
],
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
name: "checkpoint",
|
|
297
|
+
summary: "Capture bounded Git execution evidence",
|
|
298
|
+
usage: `${CLI_NAME} checkpoint [--session <id>]`,
|
|
299
|
+
options: [option("--session", "Assert the current session identity", { value: "<id>" })],
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
name: "evidence snapshot",
|
|
303
|
+
summary: "Capture bounded read-only evidence for one owned session",
|
|
304
|
+
usage: `${CLI_NAME} evidence snapshot --session <id>`,
|
|
305
|
+
options: [option("--session", "Explicit owned session to observe", { value: "<id>", required: true })],
|
|
306
|
+
notes: ["The result is Git-observable physical evidence only; it contains no task or semantic interpretation."],
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
name: "diff",
|
|
310
|
+
summary: "Inspect bounded Git evidence for explicit paths",
|
|
311
|
+
usage: `${CLI_NAME} diff --session <id> --path <path> [options]`,
|
|
312
|
+
options: [
|
|
313
|
+
option("--session", "Explicit owned session to observe", { value: "<id>", required: true }),
|
|
314
|
+
option("--path", "Concrete repository-relative path; repeatable", {
|
|
315
|
+
value: "<path>",
|
|
316
|
+
required: true,
|
|
317
|
+
repeatable: true,
|
|
318
|
+
}),
|
|
319
|
+
option("--from", "Commit/ref at the start of the range", { value: "<ref>", default: "HEAD" }),
|
|
320
|
+
option("--to", "Commit/ref at the end of the range; omitted means worktree", { value: "<ref>" }),
|
|
321
|
+
option("--patch", "Include patch text; requires the bounded byte/hunk limits"),
|
|
322
|
+
option("--max-bytes", "Maximum UTF-8 patch bytes", {
|
|
323
|
+
value: "<n>",
|
|
324
|
+
default: String(EVIDENCE_MAX_DIFF_BYTES),
|
|
325
|
+
minimum: 1,
|
|
326
|
+
maximum: EVIDENCE_MAX_DIFF_BYTES,
|
|
327
|
+
}),
|
|
328
|
+
option("--max-hunks", "Maximum patch hunks", {
|
|
329
|
+
value: "<n>",
|
|
330
|
+
default: String(EVIDENCE_MAX_DIFF_HUNKS),
|
|
331
|
+
minimum: 1,
|
|
332
|
+
maximum: EVIDENCE_MAX_DIFF_HUNKS,
|
|
333
|
+
}),
|
|
334
|
+
],
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
name: "commit",
|
|
338
|
+
summary: "Commit explicit claim-authorized resources",
|
|
339
|
+
usage: `${CLI_NAME} commit --message <final-message> --resource <path> [--resource <path>] [--session <id>] [--message-pattern <regex>]`,
|
|
340
|
+
options: [
|
|
341
|
+
option("--session", "Assert the current session identity", { value: "<id>" }),
|
|
342
|
+
option("--message", "Caller-decided final commit message", { value: "<final-message>", required: true }),
|
|
343
|
+
option("--resource", "Claim-covered concrete path; repeatable", {
|
|
344
|
+
value: "<path>",
|
|
345
|
+
required: true,
|
|
346
|
+
repeatable: true,
|
|
347
|
+
}),
|
|
348
|
+
option("--message-pattern", "Caller-declared commit-message rule; validated only when supplied", {
|
|
349
|
+
value: "<regex>",
|
|
350
|
+
}),
|
|
351
|
+
],
|
|
352
|
+
},
|
|
353
|
+
{
|
|
354
|
+
name: "push",
|
|
355
|
+
summary: "Push the owned branch to an explicit target",
|
|
356
|
+
usage: `${CLI_NAME} push --remote <name> --branch <name> --resource <path> [options]`,
|
|
357
|
+
options: [
|
|
358
|
+
option("--session", "Assert the current session identity", { value: "<id>" }),
|
|
359
|
+
option("--resource", "Claim-covered concrete path; repeatable", {
|
|
360
|
+
value: "<path>",
|
|
361
|
+
required: true,
|
|
362
|
+
repeatable: true,
|
|
363
|
+
}),
|
|
364
|
+
option("--remote", "Explicit Git remote", { value: "<name>", required: true }),
|
|
365
|
+
option("--branch", "Explicit target branch", {
|
|
366
|
+
value: "<name>",
|
|
367
|
+
required: true,
|
|
368
|
+
aliases: ["--remote-branch"],
|
|
369
|
+
}),
|
|
370
|
+
option("--remote-branch", "Explicit remote branch alias for --branch", {
|
|
371
|
+
value: "<name>",
|
|
372
|
+
alias_of: "--branch",
|
|
373
|
+
}),
|
|
374
|
+
option("--force", "Allow force-with-lease when relation requires it"),
|
|
375
|
+
option("--create-upstream", "Allow creation of a missing upstream"),
|
|
376
|
+
],
|
|
377
|
+
},
|
|
378
|
+
{
|
|
379
|
+
name: "status",
|
|
380
|
+
summary: "Show repository context and bounded session status",
|
|
381
|
+
usage: `${CLI_NAME} status [--all|--history] [--limit <n>] [--offset <n>]`,
|
|
382
|
+
options: [
|
|
383
|
+
option("--all", "Include closed history in the bounded result"),
|
|
384
|
+
option("--history", "Alias for --all", { alias_of: "--all" }),
|
|
385
|
+
option("--limit", `Maximum records per page; must be between 1 and ${MAX_SESSION_LIST_LIMIT}`, {
|
|
386
|
+
value: "<n>",
|
|
387
|
+
default: String(DEFAULT_SESSION_LIST_LIMIT),
|
|
388
|
+
minimum: 1,
|
|
389
|
+
maximum: MAX_SESSION_LIST_LIMIT,
|
|
390
|
+
}),
|
|
391
|
+
option("--offset", "Number of visible records to skip; must be a non-negative integer", {
|
|
392
|
+
value: "<n>",
|
|
393
|
+
default: "0",
|
|
394
|
+
minimum: 0,
|
|
395
|
+
}),
|
|
396
|
+
],
|
|
397
|
+
notes: [
|
|
398
|
+
`The default machine result exposes managed_worktree_root for session-create path discovery. Session rows are bounded by --limit (default ${DEFAULT_SESSION_LIST_LIMIT}, maximum ${MAX_SESSION_LIST_LIMIT}) and --offset (default 0); --all and --history include closed history.`,
|
|
399
|
+
],
|
|
400
|
+
},
|
|
401
|
+
{
|
|
402
|
+
name: "guard",
|
|
403
|
+
summary: "Authorize the current worktree or operation",
|
|
404
|
+
usage: `${CLI_NAME} guard [--session <id>] [--operation <name> --resource <path>]`,
|
|
405
|
+
options: [
|
|
406
|
+
option("--session", "Assert the current session identity", { value: "<id>" }),
|
|
407
|
+
option("--operation", "Authorize an operation when resources are supplied", { value: "<name>" }),
|
|
408
|
+
option("--resource", "Concrete resource; repeatable with --operation", { value: "<path>" }),
|
|
409
|
+
],
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
name: "gc",
|
|
413
|
+
summary: "Detect or clean eligible stale sessions",
|
|
414
|
+
usage: `${CLI_NAME} gc [--dry-run|--apply]`,
|
|
415
|
+
options: [
|
|
416
|
+
option("--apply", "Apply only cleanup that passes safety checks"),
|
|
417
|
+
option("--dry-run", "Preflight eligible stale cleanup without mutation"),
|
|
418
|
+
],
|
|
419
|
+
notes: [
|
|
420
|
+
"Default stale threshold is 24 hours (86,400,000 ms). Elapsed age is diagnostic suspicion only; destructive eligibility requires explicit stale/closing state or a safely prunable missing worktree. Closed history is not a candidate.",
|
|
421
|
+
],
|
|
422
|
+
},
|
|
423
|
+
{
|
|
424
|
+
name: "doctor",
|
|
425
|
+
summary: "Check local Nawabari prerequisites and reconciliation",
|
|
426
|
+
usage: `${CLI_NAME} doctor`,
|
|
427
|
+
options: [],
|
|
428
|
+
},
|
|
429
|
+
{
|
|
430
|
+
name: "migrate",
|
|
431
|
+
summary: "Migrate legacy resource-claim registry state",
|
|
432
|
+
usage: `${CLI_NAME} migrate`,
|
|
433
|
+
options: [],
|
|
434
|
+
notes: [
|
|
435
|
+
"Explicitly upgrades claim-schema-v1 (and pre-claim registries) to the current schema under the registry lock.",
|
|
436
|
+
"Migration is atomic, idempotent, and fail-closed; do not edit or delete the registry manually.",
|
|
437
|
+
],
|
|
438
|
+
},
|
|
439
|
+
{
|
|
440
|
+
name: "capabilities",
|
|
441
|
+
summary: "Describe the standalone CLI/JSON contract",
|
|
442
|
+
usage: `${CLI_NAME} capabilities`,
|
|
443
|
+
options: [],
|
|
444
|
+
},
|
|
445
|
+
];
|
|
446
|
+
export const ROOT_HELP_SPEC = {
|
|
447
|
+
name: "root",
|
|
448
|
+
summary: "Standalone local Git/session ownership CLI",
|
|
449
|
+
usage: `${CLI_NAME} <command> [options]`,
|
|
450
|
+
options: GLOBAL_HELP_OPTIONS,
|
|
451
|
+
};
|
|
452
|
+
/** Resolve a public name through the one canonical registry. */
|
|
453
|
+
export function canonicalCommandForName(name) {
|
|
454
|
+
return CLI_COMMAND_REGISTRY.find((definition) => definition.name === name || definition.aliases?.includes(name));
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* Materialize public names for projections without copying option metadata.
|
|
458
|
+
* Alias entries are generated from their canonical definition, including the
|
|
459
|
+
* usage, options, and parser notes.
|
|
460
|
+
*/
|
|
461
|
+
export function publicCliCommandDefinitions() {
|
|
462
|
+
return CLI_COMMAND_REGISTRY.flatMap((definition) => [
|
|
463
|
+
definition,
|
|
464
|
+
...(definition.aliases ?? []).map((alias) => ({
|
|
465
|
+
name: alias,
|
|
466
|
+
summary: `${definition.summary} (alias)`,
|
|
467
|
+
usage: definition.usage.replace(definition.name, alias),
|
|
468
|
+
options: definition.options,
|
|
469
|
+
...(definition.notes === undefined ? {} : { notes: definition.notes }),
|
|
470
|
+
})),
|
|
471
|
+
]);
|
|
472
|
+
}
|
|
473
|
+
/** Stable alias for consumers such as the future dispatcher parity layer. */
|
|
474
|
+
export const COMMAND_REGISTRY = CLI_COMMAND_REGISTRY;
|
|
475
|
+
/** Resolve either a canonical command or one of its public aliases. */
|
|
476
|
+
export function resolveCliCommandDefinition(name) {
|
|
477
|
+
const canonical = canonicalCommandForName(name);
|
|
478
|
+
if (canonical === undefined)
|
|
479
|
+
return undefined;
|
|
480
|
+
if (canonical.name === name)
|
|
481
|
+
return canonical;
|
|
482
|
+
return publicCliCommandDefinitions().find((definition) => definition.name === name);
|
|
483
|
+
}
|
|
484
|
+
/** Return the complete public discovery name list in registry order. */
|
|
485
|
+
export function publicCliCommandNames() {
|
|
486
|
+
return publicCliCommandDefinitions().map((definition) => definition.name);
|
|
487
|
+
}
|
|
488
|
+
//# sourceMappingURL=cli-command-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-command-registry.js","sourceRoot":"","sources":["../src/cli-command-registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AACzF,OAAO,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAE5F,MAAM,QAAQ,GAAG,UAAU,CAAC;AAwB5B,MAAM,CAAC,MAAM,mBAAmB,GAAiC;IAC/D,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,yCAAyC,EAAE;IAC1E,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,IAAI,CAAC,EAAE,WAAW,EAAE,4BAA4B,EAA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AAoB,CAAC;AAErD,uEAAuE;AACvE,MAAM,UAAU,2BAA2B,CAAC,IAAY;IACtD,MAAM,SAAS,GAAG,uBAAuB,CAAC,IAAI,CAAC,CAAC;IAChD,IAAI,SAAS,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC9C,IAAI,SAAS,CAAC,IAAI,KAAK,IAAI;QAAE,OAAO,SAAS,CAAC;IAC9C,OAAO,2BAA2B,EAAE,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AACtF,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,qBAAqB;IACnC,OAAO,2BAA2B,EAAE,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;AAC5E,CAAC"}
|
package/dist/cli.d.ts
CHANGED
|
@@ -2,6 +2,24 @@ import { type DomainResult } from "./domain/errors.js";
|
|
|
2
2
|
import { type SessionBackend } from "./domain/session.js";
|
|
3
3
|
import { type CliIO } from "./presentation.js";
|
|
4
4
|
import { type SandboxCommand, type SandboxExecutionResult, type SandboxProbe, type SandboxRuntimeLayout } from "./domain/sandbox.js";
|
|
5
|
+
export { CLI_COMMAND_REGISTRY, COMMAND_REGISTRY, publicCliCommandDefinitions, publicCliCommandNames, resolveCliCommandDefinition, canonicalCommandForName, } from "./cli-command-registry.js";
|
|
6
|
+
export type { CliCommandDefinition, CliHelpOptionSpec } from "./cli-command-registry.js";
|
|
7
|
+
/**
|
|
8
|
+
* The dispatcher deliberately keeps its command branches specialized, but
|
|
9
|
+
* this inventory makes the executable surface explicit for structural parity
|
|
10
|
+
* checks. Aliases are listed because they are public entry points too.
|
|
11
|
+
*/
|
|
12
|
+
export declare const DISPATCHER_COMMAND_INVENTORY: readonly ["session create", "session id", "session show", "session inspect", "session run", "session exec", "session list", "session claim", "resource claim", "session update", "resource update", "session mutate", "resource mutate", "session transition", "resource transition", "session claims", "resource list", "resource claims", "session release", "resource release", "session close", "session discard", "authorize", "checkpoint", "evidence snapshot", "diff", "commit", "push", "status", "guard", "gc", "doctor", "migrate", "capabilities"];
|
|
13
|
+
/** Dispatcher option inventory, keyed by canonical registry command identity. */
|
|
14
|
+
export declare const DISPATCHER_OPTION_INVENTORY: Readonly<Record<string, readonly string[]>>;
|
|
15
|
+
/** Return the registry-backed option set used by a specialized dispatcher parser. */
|
|
16
|
+
export declare function dispatcherAllowedOptions(command: string): ReadonlySet<string>;
|
|
17
|
+
/**
|
|
18
|
+
* Verify both executable command/option inventory and registry metadata. This
|
|
19
|
+
* is intentionally structural: parser semantics remain in their command
|
|
20
|
+
* handlers, while drift becomes a deterministic failure in tests/startup.
|
|
21
|
+
*/
|
|
22
|
+
export declare function validateCliRegistryParity(): void;
|
|
5
23
|
export type CliDependencies = {
|
|
6
24
|
backend?: SessionBackend;
|
|
7
25
|
cwd?: string;
|