nawabari 0.10.3 → 0.12.2
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 +110 -29
- package/dist/cli-command-registry.d.ts +1102 -2
- package/dist/cli-command-registry.js +262 -4
- package/dist/cli-command-registry.js.map +1 -1
- package/dist/cli.d.ts +25 -11
- package/dist/cli.js +717 -134
- package/dist/cli.js.map +1 -1
- package/dist/contract.d.ts +6 -0
- package/dist/contract.js +294 -7
- package/dist/contract.js.map +1 -1
- package/dist/coordination-admission.d.ts +1 -0
- package/dist/coordination-admission.js +2 -0
- package/dist/coordination-admission.js.map +1 -0
- package/dist/coordination-preview.d.ts +107 -0
- package/dist/coordination-preview.js +401 -0
- package/dist/coordination-preview.js.map +1 -0
- package/dist/coordination-transactions.d.ts +131 -0
- package/dist/coordination-transactions.js +538 -0
- package/dist/coordination-transactions.js.map +1 -0
- package/dist/domain/auxiliary-state-policy.d.ts +98 -0
- package/dist/domain/auxiliary-state-policy.js +545 -0
- package/dist/domain/auxiliary-state-policy.js.map +1 -0
- package/dist/domain/auxiliary-state-projection.d.ts +83 -0
- package/dist/domain/auxiliary-state-projection.js +265 -0
- package/dist/domain/auxiliary-state-projection.js.map +1 -0
- package/dist/domain/cgroups-v2.d.ts +40 -2
- package/dist/domain/cgroups-v2.js +128 -22
- package/dist/domain/cgroups-v2.js.map +1 -1
- package/dist/domain/errors.d.ts +2 -2
- package/dist/domain/errors.js +1 -0
- package/dist/domain/errors.js.map +1 -1
- package/dist/domain/fhs-development-runtime.d.ts +14 -1
- package/dist/domain/fhs-development-runtime.js +206 -8
- package/dist/domain/fhs-development-runtime.js.map +1 -1
- package/dist/domain/filesystem-enforcement-integration.d.ts +23 -0
- package/dist/domain/filesystem-enforcement-integration.js +34 -0
- package/dist/domain/filesystem-enforcement-integration.js.map +1 -0
- package/dist/domain/filesystem-policy-decision.d.ts +66 -0
- package/dist/domain/filesystem-policy-decision.js +203 -0
- package/dist/domain/filesystem-policy-decision.js.map +1 -0
- package/dist/domain/filesystem-policy-enforcement.d.ts +52 -0
- package/dist/domain/filesystem-policy-enforcement.js +340 -0
- package/dist/domain/filesystem-policy-enforcement.js.map +1 -0
- package/dist/domain/filesystem-policy-evidence.d.ts +128 -0
- package/dist/domain/filesystem-policy-evidence.js +791 -0
- package/dist/domain/filesystem-policy-evidence.js.map +1 -0
- package/dist/domain/filesystem-policy-materialization.d.ts +132 -0
- package/dist/domain/filesystem-policy-materialization.js +704 -0
- package/dist/domain/filesystem-policy-materialization.js.map +1 -0
- package/dist/domain/filesystem-policy-revision.d.ts +58 -0
- package/dist/domain/filesystem-policy-revision.js +199 -0
- package/dist/domain/filesystem-policy-revision.js.map +1 -0
- package/dist/domain/filesystem-policy.d.ts +146 -0
- package/dist/domain/filesystem-policy.js +942 -0
- package/dist/domain/filesystem-policy.js.map +1 -0
- package/dist/domain/landlock.d.ts +1 -0
- package/dist/domain/landlock.js +1 -1
- package/dist/domain/landlock.js.map +1 -1
- package/dist/domain/runtime-projection.d.ts +3 -0
- package/dist/domain/runtime-projection.js +10 -1
- package/dist/domain/runtime-projection.js.map +1 -1
- package/dist/domain/runtime-provider-declared.d.ts +98 -0
- package/dist/domain/runtime-provider-declared.js +416 -0
- package/dist/domain/runtime-provider-declared.js.map +1 -0
- package/dist/domain/runtime-resolution.d.ts +4 -0
- package/dist/domain/runtime-resolution.js +91 -1
- package/dist/domain/runtime-resolution.js.map +1 -1
- package/dist/domain/sandbox-launcher.d.ts +15 -2
- package/dist/domain/sandbox-launcher.js +514 -104
- package/dist/domain/sandbox-launcher.js.map +1 -1
- package/dist/domain/sandbox.d.ts +9 -1
- package/dist/domain/sandbox.js +46 -3
- package/dist/domain/sandbox.js.map +1 -1
- package/dist/domain/session-admission-decision.d.ts +67 -0
- package/dist/domain/session-admission-decision.js +200 -0
- package/dist/domain/session-admission-decision.js.map +1 -0
- package/dist/domain/session-backend.d.ts +40 -4
- package/dist/domain/session-backend.js +645 -36
- package/dist/domain/session-backend.js.map +1 -1
- package/dist/domain/session-bootstrap.d.ts +11 -0
- package/dist/domain/session-bootstrap.js +292 -0
- package/dist/domain/session-bootstrap.js.map +1 -0
- package/dist/domain/session-console.d.ts +119 -0
- package/dist/domain/session-console.js +600 -0
- package/dist/domain/session-console.js.map +1 -0
- package/dist/domain/session-environment.d.ts +114 -0
- package/dist/domain/session-environment.js +563 -0
- package/dist/domain/session-environment.js.map +1 -0
- package/dist/domain/session-execution-control.d.ts +114 -0
- package/dist/domain/session-execution-control.js +517 -0
- package/dist/domain/session-execution-control.js.map +1 -0
- package/dist/domain/session-execution-record.d.ts +163 -0
- package/dist/domain/session-execution-record.js +524 -0
- package/dist/domain/session-execution-record.js.map +1 -0
- package/dist/domain/session-git-hooks.d.ts +145 -0
- package/dist/domain/session-git-hooks.js +789 -0
- package/dist/domain/session-git-hooks.js.map +1 -0
- package/dist/domain/session-launch-supervisor-worker.d.ts +19 -0
- package/dist/domain/session-launch-supervisor-worker.js +261 -0
- package/dist/domain/session-launch-supervisor-worker.js.map +1 -0
- package/dist/domain/session-launch-supervisor.d.ts +142 -0
- package/dist/domain/session-launch-supervisor.js +591 -0
- package/dist/domain/session-launch-supervisor.js.map +1 -0
- package/dist/domain/session-process-observation.d.ts +84 -0
- package/dist/domain/session-process-observation.js +196 -0
- package/dist/domain/session-process-observation.js.map +1 -0
- package/dist/domain/session-protected-launch.d.ts +68 -0
- package/dist/domain/session-protected-launch.js +335 -0
- package/dist/domain/session-protected-launch.js.map +1 -0
- package/dist/domain/session-resource-accounting.d.ts +39 -0
- package/dist/domain/session-resource-accounting.js +183 -0
- package/dist/domain/session-resource-accounting.js.map +1 -0
- package/dist/domain/session.d.ts +151 -0
- package/dist/domain/session.js +3 -0
- package/dist/domain/session.js.map +1 -1
- package/dist/domain/shell-runtime.d.ts +22 -0
- package/dist/domain/shell-runtime.js +38 -0
- package/dist/domain/shell-runtime.js.map +1 -0
- package/dist/domain/working-set-runtime-projection.d.ts +29 -0
- package/dist/domain/working-set-runtime-projection.js +254 -0
- package/dist/domain/working-set-runtime-projection.js.map +1 -0
- package/dist/domain/worktree-file-operation-helper.d.ts +10 -0
- package/dist/domain/worktree-file-operation-helper.js +255 -0
- package/dist/domain/worktree-file-operation-helper.js.map +1 -0
- package/dist/domain/worktree-file-operation.d.ts +116 -0
- package/dist/domain/worktree-file-operation.js +529 -0
- package/dist/domain/worktree-file-operation.js.map +1 -0
- package/dist/domain/worktree-profile-builtins.d.ts +41 -0
- package/dist/domain/worktree-profile-builtins.js +239 -0
- package/dist/domain/worktree-profile-builtins.js.map +1 -0
- package/dist/domain/worktree-profile-catalog.d.ts +21 -0
- package/dist/domain/worktree-profile-catalog.js +163 -0
- package/dist/domain/worktree-profile-catalog.js.map +1 -0
- package/dist/domain/worktree-profile-inspection.d.ts +77 -0
- package/dist/domain/worktree-profile-inspection.js +114 -0
- package/dist/domain/worktree-profile-inspection.js.map +1 -0
- package/dist/domain/worktree-profile-overrides.d.ts +67 -0
- package/dist/domain/worktree-profile-overrides.js +685 -0
- package/dist/domain/worktree-profile-overrides.js.map +1 -0
- package/dist/domain/worktree-profile-pinning.d.ts +47 -0
- package/dist/domain/worktree-profile-pinning.js +96 -0
- package/dist/domain/worktree-profile-pinning.js.map +1 -0
- package/dist/domain/worktree-profile-runtime.d.ts +72 -0
- package/dist/domain/worktree-profile-runtime.js +221 -0
- package/dist/domain/worktree-profile-runtime.js.map +1 -0
- package/dist/domain/worktree-profile-scope.d.ts +54 -0
- package/dist/domain/worktree-profile-scope.js +285 -0
- package/dist/domain/worktree-profile-scope.js.map +1 -0
- package/dist/domain/worktree-runtime-profile.d.ts +99 -0
- package/dist/domain/worktree-runtime-profile.js +505 -0
- package/dist/domain/worktree-runtime-profile.js.map +1 -0
- package/dist/errors.d.ts +1 -1
- package/dist/errors.js.map +1 -1
- package/dist/failure-code-vocabulary.d.ts +7 -2
- package/dist/failure-code-vocabulary.js +85 -1
- package/dist/failure-code-vocabulary.js.map +1 -1
- package/dist/git.d.ts +2 -0
- package/dist/git.js +18 -0
- package/dist/git.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/public-contract.d.ts +18 -0
- package/dist/public-contract.js +42 -0
- package/dist/public-contract.js.map +1 -1
- package/dist/public-state.d.ts +21 -0
- package/dist/public-state.js +25 -0
- package/dist/public-state.js.map +1 -1
- package/dist/registry/file-operation-record.d.ts +169 -0
- package/dist/registry/file-operation-record.js +634 -0
- package/dist/registry/file-operation-record.js.map +1 -0
- package/dist/registry/runtime-records.d.ts +59 -0
- package/dist/registry/runtime-records.js +426 -0
- package/dist/registry/runtime-records.js.map +1 -0
- package/dist/repository-runtime-observations.d.ts +56 -0
- package/dist/repository-runtime-observations.js +388 -0
- package/dist/repository-runtime-observations.js.map +1 -0
- package/dist/repository-runtime-snapshot.d.ts +52 -0
- package/dist/repository-runtime-snapshot.js +170 -0
- package/dist/repository-runtime-snapshot.js.map +1 -0
- package/dist/resource-claims.d.ts +31 -7
- package/dist/resource-claims.js +68 -15
- package/dist/resource-claims.js.map +1 -1
- package/dist/resource-coordination-cli.d.ts +9 -0
- package/dist/resource-coordination-cli.js +199 -0
- package/dist/resource-coordination-cli.js.map +1 -0
- package/dist/resource-coordination-evidence.d.ts +185 -0
- package/dist/resource-coordination-evidence.js +750 -0
- package/dist/resource-coordination-evidence.js.map +1 -0
- package/dist/resource-coordination-snapshot.d.ts +181 -0
- package/dist/resource-coordination-snapshot.js +433 -0
- package/dist/resource-coordination-snapshot.js.map +1 -0
- package/dist/resource-coordination-view.d.ts +60 -0
- package/dist/resource-coordination-view.js +342 -0
- package/dist/resource-coordination-view.js.map +1 -0
- package/dist/resource-coordination.d.ts +125 -0
- package/dist/resource-coordination.js +482 -0
- package/dist/resource-coordination.js.map +1 -0
- package/dist/resource-handoff-execution.d.ts +14 -0
- package/dist/resource-handoff-execution.js +111 -0
- package/dist/resource-handoff-execution.js.map +1 -0
- package/dist/resource-handoff.d.ts +172 -0
- package/dist/resource-handoff.js +576 -0
- package/dist/resource-handoff.js.map +1 -0
- package/dist/resource-merge-decision.d.ts +54 -0
- package/dist/resource-merge-decision.js +287 -0
- package/dist/resource-merge-decision.js.map +1 -0
- package/dist/resource-text-merge.d.ts +63 -0
- package/dist/resource-text-merge.js +254 -0
- package/dist/resource-text-merge.js.map +1 -0
- package/dist/session-attention.d.ts +41 -0
- package/dist/session-attention.js +226 -0
- package/dist/session-attention.js.map +1 -0
- package/dist/session-console-cli.d.ts +38 -0
- package/dist/session-console-cli.js +132 -0
- package/dist/session-console-cli.js.map +1 -0
- package/dist/session-lifecycle-actions.d.ts +14 -0
- package/dist/session-lifecycle-actions.js +15 -0
- package/dist/session-lifecycle-actions.js.map +1 -1
- package/dist/session-parking.d.ts +54 -0
- package/dist/session-parking.js +348 -0
- package/dist/session-parking.js.map +1 -0
- package/dist/session-registry.d.ts +332 -21
- package/dist/session-registry.js +2549 -100
- package/dist/session-registry.js.map +1 -1
- package/dist/session-retention.d.ts +211 -0
- package/dist/session-retention.js +428 -0
- package/dist/session-retention.js.map +1 -0
- package/dist/session-runtime-history.d.ts +26 -0
- package/dist/session-runtime-history.js +48 -0
- package/dist/session-runtime-history.js.map +1 -0
- package/dist/session-runtime-lifecycle.d.ts +142 -0
- package/dist/session-runtime-lifecycle.js +188 -0
- package/dist/session-runtime-lifecycle.js.map +1 -0
- package/dist/session-runtime-reconciliation.d.ts +22 -0
- package/dist/session-runtime-reconciliation.js +159 -0
- package/dist/session-runtime-reconciliation.js.map +1 -0
- package/dist/state/session/machine.d.ts +2 -2
- package/dist/ui/repository-screen.d.ts +59 -0
- package/dist/ui/repository-screen.js +323 -0
- package/dist/ui/repository-screen.js.map +1 -0
- package/dist/ui/repository-terminal.d.ts +42 -0
- package/dist/ui/repository-terminal.js +414 -0
- package/dist/ui/repository-terminal.js.map +1 -0
- package/dist/ui/session-actions.d.ts +77 -0
- package/dist/ui/session-actions.js +711 -0
- package/dist/ui/session-actions.js.map +1 -0
- package/dist/verification-executor.d.ts +78 -0
- package/dist/verification-executor.js +299 -0
- package/dist/verification-executor.js.map +1 -0
- package/dist/working-set.d.ts +160 -0
- package/dist/working-set.js +525 -0
- package/dist/working-set.js.map +1 -0
- package/dist/worktree-file-operation-cli.d.ts +68 -0
- package/dist/worktree-file-operation-cli.js +470 -0
- package/dist/worktree-file-operation-cli.js.map +1 -0
- package/dist/worktree-profile-cli.d.ts +105 -0
- package/dist/worktree-profile-cli.js +389 -0
- package/dist/worktree-profile-cli.js.map +1 -0
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="./docs/assets/readme/nawabari-hero.webp" alt="Nawabari — Git Worktree Isolation." width="100%">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
<a href="https://github.com/yohn-jp/nawabari/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/yohn-jp/nawabari/actions/workflows/ci.yml/badge.svg"></a>
|
|
7
|
+
<a href="https://www.npmjs.com/package/nawabari"><img alt="npm" src="https://img.shields.io/npm/v/nawabari"></a>
|
|
8
|
+
<a href="https://www.npmjs.com/package/nawabari"><img alt="Node" src="https://img.shields.io/node/v/nawabari"></a>
|
|
9
|
+
<a href="./LICENSE"><img alt="License" src="https://img.shields.io/npm/l/nawabari"></a>
|
|
10
|
+
</p>
|
|
11
|
+
|
|
1
12
|
# Nawabari
|
|
2
13
|
|
|
3
14
|
Nawabari is a local governance layer for parallel coding agents. It gives each agent session an owned Git worktree and branch, records which repository resources that session may use, and checks those boundaries before governed mutations.
|
|
@@ -6,12 +17,17 @@ It is for teams and tools that need several agents to work in one repository wit
|
|
|
6
17
|
|
|
7
18
|
This README describes the current 0.10.x product model. It is an overview and navigation surface, not a copy of generated contracts or implementation history.
|
|
8
19
|
|
|
9
|
-
The
|
|
20
|
+
The canonical routine-use workflow is one machine-authority path for both people
|
|
21
|
+
and agents:
|
|
10
22
|
|
|
11
|
-
1. Create a session
|
|
12
|
-
2.
|
|
13
|
-
3.
|
|
14
|
-
4.
|
|
23
|
+
1. Create a managed session with explicit initial claims.
|
|
24
|
+
2. Declare any required auxiliary repository-local state explicitly.
|
|
25
|
+
3. Inspect the session and its claims.
|
|
26
|
+
4. Run governed work and mutations through the claim and evidence surfaces.
|
|
27
|
+
5. Handle claim conflicts from machine-readable evidence and typed lifecycle actions.
|
|
28
|
+
6. Reconcile stale or inconsistent physical state through the canonical operation.
|
|
29
|
+
7. Close or discard according to the lifecycle authority.
|
|
30
|
+
8. Confirm convergence with `doctor` and garbage-collection observation.
|
|
15
31
|
|
|
16
32
|
Nawabari governs operations routed through Nawabari. A normal governed session is an ownership and authorization boundary, not an operating-system or filesystem sandbox. A process with ambient filesystem permissions can still edit another worktree directly.
|
|
17
33
|
|
|
@@ -27,29 +43,52 @@ git nawabari --help
|
|
|
27
43
|
|
|
28
44
|
The package installs both `nawabari` and `git-nawabari`; `git nawabari ...` works as Git's external subcommand.
|
|
29
45
|
|
|
30
|
-
##
|
|
46
|
+
## Canonical routine-use workflow
|
|
31
47
|
|
|
32
|
-
Run from the repository's integration worktree.
|
|
48
|
+
Run from the repository's integration worktree. The following bootstrap uses the
|
|
49
|
+
same public option shape as the packed routine-use certification. Omit the
|
|
50
|
+
auxiliary declaration when the session needs no declared repository-local state;
|
|
51
|
+
do not replace it with an arbitrary host path.
|
|
33
52
|
|
|
34
53
|
```bash
|
|
35
54
|
nawabari capabilities --json
|
|
36
|
-
|
|
37
|
-
|
|
55
|
+
nawabari doctor --json
|
|
56
|
+
|
|
57
|
+
auxiliary_state='{"source":{"kind":"repository-local","path":".codegraph/ignored"},"target":{"kind":"managed-worktree","path":".codegraph/ignored"},"mode":"copy","durability":"durable"}'
|
|
58
|
+
created=$(git nawabari session create \
|
|
59
|
+
--branch feature/example \
|
|
60
|
+
--resource README.md --mode write \
|
|
61
|
+
--auxiliary-state "$auxiliary_state" \
|
|
62
|
+
--json)
|
|
38
63
|
session_id=$(printf '%s' "$created" | jq -r .session_id)
|
|
39
64
|
worktree=$(printf '%s' "$created" | jq -r .worktree)
|
|
40
65
|
|
|
41
|
-
(cd "$worktree" && git nawabari session
|
|
42
|
-
(cd "$worktree" && git nawabari
|
|
43
|
-
(cd "$worktree" && "$
|
|
66
|
+
(cd "$worktree" && git nawabari session show --session "$session_id" --json)
|
|
67
|
+
(cd "$worktree" && git nawabari session claims --session "$session_id" --json)
|
|
68
|
+
(cd "$worktree" && git nawabari session inspect --session "$session_id" --schema-version 2 --json)
|
|
69
|
+
|
|
70
|
+
(cd "$worktree" && git nawabari session claim --session "$session_id" --resource contract-lifecycle.txt --mode exclusive-write --json)
|
|
71
|
+
(cd "$worktree" && git nawabari authorize --session "$session_id" --operation source-write --resource contract-lifecycle.txt --json)
|
|
72
|
+
(cd "$worktree" && "$EDITOR" contract-lifecycle.txt)
|
|
73
|
+
(cd "$worktree" && git nawabari evidence snapshot --session "$session_id" --json)
|
|
44
74
|
(cd "$worktree" && git nawabari checkpoint --session "$session_id" --json)
|
|
45
|
-
(cd "$worktree" && git nawabari commit --session "$session_id" --
|
|
75
|
+
(cd "$worktree" && git nawabari commit --session "$session_id" --message "Exercise governed lifecycle" --resource contract-lifecycle.txt --json)
|
|
76
|
+
(cd "$worktree" && git nawabari push --session "$session_id" --remote origin --branch feature/example --resource contract-lifecycle.txt --create-upstream --json)
|
|
46
77
|
```
|
|
47
78
|
|
|
48
79
|
`session create` provisions the new worktree under `<repository-parent>/.nawabari/worktrees` by default (discoverable via `status --json` as `managed_worktree_root`). Nawabari creates that managed subdirectory on first default placement. New exact `--worktree` paths must be under the reported root; an absolute path directly under the repository parent remains accepted for compatibility with older callers and persisted sessions.
|
|
49
80
|
|
|
81
|
+
The initial-claim grammar is `--resource <path-or-glob> --mode <read|write|exclusive-write>` and the pair may be repeated. Each resource is paired with its own mode. The parser also permits zero pairs for backward compatibility, but the canonical routine path declares at least one initial claim. Initial claims are committed atomically with the new session, worktree, and branch. A conflict returns a machine-readable failure such as `RESOURCE_CLAIM_CONFLICT` and does not leave a partially established session or claim set.
|
|
82
|
+
|
|
83
|
+
Resource-claim enforcement is disabled by default for a new session: `commit`/`push` authorization does not require the session to hold a resource claim for its own session-owned operations. Pass `--enforce-claims` to `session create` to opt that session into the previous claim-authorization behavior, including `MISSING_RESOURCE_CLAIM`/`INSUFFICIENT_CLAIM_MODE` denials and existing claim-mode compatibility rules. Worktree ownership, branch ownership, and `RESOURCE_CLAIM_CONFLICT` protection against another session's active claim remain enforced either way.
|
|
84
|
+
|
|
85
|
+
The packed auxiliary-state declaration above is the bounded `copy` form: a `repository-local` source is copied to a `managed-worktree` target with `durability: durable`. It is an explicit, repeatable, allowlisted capability. It does not discover ignored state, project process-local sockets/PID files/logs, shadow Git-tracked paths, or expose arbitrary host filesystem paths. Auxiliary-state projection is separate from `SessionRuntimeProjection`: the former copies declared repository-local durable state for a managed worktree; the latter describes explicit runtime material and filesystem visibility for protected execution. Auxiliary state does not change the runtime projection.
|
|
86
|
+
|
|
87
|
+
The create operation is atomic, but a caller must treat an uncertain result carefully. If JSON reports `REGISTRY_DURABILITY_UNCERTAIN`, re-read the reported session and claims before retrying. If the exact original declaration is already present, follow `bootstrap_retry.next_action: inspect-established-session` and inspect that `session_id`; if another declaration owns the worktree or branch, follow `bootstrap_retry.next_action: inspect-blocking-session`. Nawabari never silently adopts an existing owner. A retry is appropriate only after the authoritative state proves that the requested bootstrap was not established.
|
|
88
|
+
|
|
50
89
|
`--all-claimed` is an explicit resource selector. It resolves safely observed Git-changed paths covered by qualifying claims; it does not bypass claim authorization. Use repeated `--resource <path>` when an explicit path list is preferable.
|
|
51
90
|
|
|
52
|
-
After reviewing and integrating the session branch:
|
|
91
|
+
After reviewing and integrating the session branch through the caller's normal local Git/provider process:
|
|
53
92
|
|
|
54
93
|
```bash
|
|
55
94
|
git nawabari session inspect --session "$session_id" --json
|
|
@@ -58,34 +97,68 @@ git nawabari session close --session "$session_id" --json
|
|
|
58
97
|
|
|
59
98
|
Close is conservative. Unintegrated commits, dirty worktrees, ambiguous Git state, and ownership mismatches remain blocked. For a squash or rebase merge, pass an exact local `--integrated-revision <rev>` so Nawabari can independently re-verify the content.
|
|
60
99
|
|
|
100
|
+
If the lifecycle result exposes a recoverable blocker, follow its typed `next_action`/`next_actions` entry. `reconcile-physical-state` is the non-mutating observation action (its command is `doctor`). Its explicit apply action is `reconcile-physical-state-apply`, and its exact command is:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
git nawabari session reconcile --session "$owner_session_id" --apply --json
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
The session ID must be the blocking owner reported by the machine result. A successful apply returns `operation: "reconcile-apply"`, `action.action_id: "reconcile-physical-state-apply"`, and a completed outcome; the owner is terminalized and its claims are released only when the existing lifecycle and physical-state evidence authorizes that transition. Retry the blocked claim only after this result succeeds.
|
|
107
|
+
|
|
108
|
+
After every session reaches its terminal lifecycle result, confirm convergence from
|
|
109
|
+
the repository integration worktree:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
git nawabari gc --dry-run --json
|
|
113
|
+
git nawabari doctor --json
|
|
114
|
+
```
|
|
115
|
+
|
|
61
116
|
## Authority model
|
|
62
117
|
|
|
63
118
|
Each boundary has one job and one local authority. README summarizes the product contract; executable code and machine-readable projections remain authoritative for exact schemas, transitions, and failure vocabularies.
|
|
64
119
|
|
|
65
|
-
| Boundary | What it answers
|
|
66
|
-
| ---------------------- |
|
|
67
|
-
| Session lifecycle | Which session owns a worktree/branch and whether it can safely progress or terminate
|
|
68
|
-
| Resource Claims | Which session may access a canonical repository resource and at what mode
|
|
69
|
-
| Mutation authorization | Whether a concrete operation has sufficient claims and no conflicting owner
|
|
70
|
-
| Repository evidence | What Git can observe about revisions, paths, changes, ancestry, and bounded diffs
|
|
71
|
-
|
|
|
120
|
+
| Boundary | What it answers | Typical commands |
|
|
121
|
+
| ---------------------- | -------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- |
|
|
122
|
+
| Session lifecycle | Which session owns a worktree/branch and whether it can safely progress or terminate | `session create`, `session inspect`, `session close` |
|
|
123
|
+
| Resource Claims | Which session may access a canonical repository resource and at what mode | `session claim`, `session claims`, `session update`, `session release` |
|
|
124
|
+
| Mutation authorization | Whether a concrete operation has sufficient claims and no conflicting owner | `guard`, `authorize`, `commit`, `push` |
|
|
125
|
+
| Repository evidence | What Git can observe about revisions, paths, changes, ancestry, and bounded diffs | `checkpoint`, `evidence snapshot`, `diff` |
|
|
126
|
+
| Auxiliary state | Whether explicitly declared durable repository-local state may be copied into the managed worktree | `session create --auxiliary-state`, `capabilities` |
|
|
127
|
+
| Reconciliation/cleanup | Whether observed physical state permits a lifecycle recovery or cleanup action | `session inspect`, `session reconcile`, `doctor`, `gc` |
|
|
128
|
+
| Protected execution | Whether a command runs inside the opt-in Linux process/filesystem boundary | `session run`, `session exec`, `session shell`, `doctor` |
|
|
72
129
|
|
|
73
130
|
Claims are not task labels and do not encode GitHub or agent semantics. `write` permits ordinary path changes; `exclusive-write` is required for finalizing operations such as commit and push. Conflicting or ambiguous claims fail closed.
|
|
74
131
|
|
|
75
132
|
The default governance path does not install hooks and does not prevent direct filesystem writes outside Nawabari. Its guarantee is that Nawabari-routed operations consult authoritative session, Git, and claim state before mutation.
|
|
76
133
|
|
|
134
|
+
Nawabari's authority ends at local session ownership, claims, Git evidence, and the lifecycle of the managed worktree and branch. Task meaning, Issue/PR state, review decisions, and provider/GitHub state remain outside that authority.
|
|
135
|
+
|
|
136
|
+
### Claim conflict and physical recovery
|
|
137
|
+
|
|
138
|
+
`RESOURCE_CLAIM_CONFLICT` does not always mean stale state. A healthy owner is reported with `ownerState: "active"`; the certified contention path exposes `inspect-blocking-session` and `wait-for-conflicting-claim-release` safe actions without a reconciliation `nextAction`. Inspect the owner and wait for the legitimate claim release; do not remove another session's claim.
|
|
139
|
+
|
|
140
|
+
For a stale or inconsistent owner, the machine result instead carries physical and lifecycle evidence such as `ownerPhysicalState: "prunable-missing"`, `ownerLifecycleState: "stale-inconsistent"`, and the typed `nextAction.actionId: "reconcile-physical-state"`. Inspect it first:
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
git nawabari session inspect --session "$owner_session_id" --schema-version 2 --json
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Then use the explicit apply operation shown above and retry the original claim after it completes. Age or a missing path alone is not destructive authority. The packed test removes a worktree only as external fault injection; supported recovery does not involve editing the session registry manually or deleting a raw Git worktree.
|
|
147
|
+
|
|
77
148
|
## Session and resource lifecycle
|
|
78
149
|
|
|
79
150
|
The normal path is:
|
|
80
151
|
|
|
81
152
|
```text
|
|
82
|
-
session create
|
|
153
|
+
session create (explicit initial claims)
|
|
83
154
|
↓
|
|
84
|
-
|
|
155
|
+
inspect session/claims → claim/authorize → checkpoint → commit or push
|
|
85
156
|
↓ ↓
|
|
86
157
|
inspect readiness integrate the branch
|
|
87
158
|
↓ ↓
|
|
88
|
-
session close
|
|
159
|
+
session close or discard ←─────────────────────────┘
|
|
160
|
+
↓
|
|
161
|
+
doctor + gc --dry-run convergence check
|
|
89
162
|
```
|
|
90
163
|
|
|
91
164
|
If work is not integrated, `session inspect` reports bounded blockers and safe next actions. Discard is never an implicit fallback for close or garbage collection.
|
|
@@ -94,7 +167,7 @@ The Session lifecycle is backed by the executable XState authority in 0.10.x and
|
|
|
94
167
|
|
|
95
168
|
### Claims
|
|
96
169
|
|
|
97
|
-
Claims are canonical repository-relative resource records attached to a session. Supported modes are `read`, `write`, and `exclusive-write`.
|
|
170
|
+
Claims are canonical repository-relative resource records attached to a session. Supported modes are `read`, `write`, and `exclusive-write`. The canonical routine path establishes its first claim during `session create`; later additions, transitions, and releases use the existing claim surfaces.
|
|
98
171
|
|
|
99
172
|
```bash
|
|
100
173
|
git nawabari session claim --session "$session_id" --resource src/example.ts --mode exclusive-write --json
|
|
@@ -115,7 +188,7 @@ The policy requires `exclusive-write` for operations that finalize or remove sha
|
|
|
115
188
|
|
|
116
189
|
### Inspect, close, discard, and garbage collection
|
|
117
190
|
|
|
118
|
-
`session inspect` is read-only and uses the same close/cleanup evidence as `session close`.
|
|
191
|
+
`session inspect` is read-only and uses the same close/cleanup evidence as `session close`. Use `--schema-version 2` when consuming the single-authority lifecycle and action projection.
|
|
119
192
|
|
|
120
193
|
```bash
|
|
121
194
|
git nawabari session inspect --session "$session_id" --json
|
|
@@ -124,7 +197,11 @@ git nawabari session discard --session "$session_id" --preview --json
|
|
|
124
197
|
|
|
125
198
|
`session discard` requires an explicit session ID and may destroy unintegrated commits and uncommitted work in that session's worktree. Preview reports bounded destructive scope without mutation. Actual discard revalidates repository, worktree, branch, `HEAD`, and registry ownership before destructive steps.
|
|
126
199
|
|
|
127
|
-
|
|
200
|
+
When the caller intentionally abandons the session, apply that explicit
|
|
201
|
+
decision with `git nawabari session discard --session "$session_id" --json`.
|
|
202
|
+
Discard is not an automatic fallback for a blocked close.
|
|
203
|
+
|
|
204
|
+
`gc --dry-run` reports stale candidates and blockers. `gc --apply` only cleans candidates passing the same safety checks; elapsed age alone is diagnostic suspicion, not destructive authority. `doctor` reports prerequisite and reconciliation state without silently repairing ownership. Use the typed lifecycle action and explicit `session reconcile` operation for supported stale/inconsistent-owner recovery; `doctor` does not silently repair it.
|
|
128
205
|
|
|
129
206
|
## Governed Git work
|
|
130
207
|
|
|
@@ -172,14 +249,18 @@ The installed CLI is the primary integration surface. Discover its contract rath
|
|
|
172
249
|
nawabari capabilities --json
|
|
173
250
|
nawabari --version --json
|
|
174
251
|
nawabari session create --help --json
|
|
252
|
+
nawabari session inspect --help --json
|
|
253
|
+
nawabari session reconcile --help --json
|
|
175
254
|
nawabari commit --help --json
|
|
176
255
|
```
|
|
177
256
|
|
|
178
|
-
`capabilities --json` works without a Git repository. The top-level contract is `nawabari.standalone-execution.v1`, schema version `1`; Resource Claim meaning is separately versioned as `nawabari.resource-claims.v2`. Package version alone is not a compatibility decision.
|
|
257
|
+
`capabilities --json` works without a Git repository. The top-level contract is `nawabari.standalone-execution.v1`, schema version `1`; Resource Claim meaning is separately versioned as `nawabari.resource-claims.v2`. Package version alone is not a compatibility decision. The capability projection publishes the initial-claim grammar and retry vocabulary, auxiliary-state contract, lifecycle action IDs, and the `session reconcile --session <id> --apply` apply arguments used above.
|
|
179
258
|
|
|
180
259
|
JSON mode emits one bounded document on stdout. Consumers should use machine-readable fields and stable codes rather than parse human-oriented text.
|
|
181
260
|
|
|
182
|
-
The command surface includes Session lifecycle, Resource Claims, authorization/evidence, governed Git commit/push, reconciliation/discovery, and protected execution. Use `--help --json` and `capabilities --json` for the authoritative inventory.
|
|
261
|
+
The command surface includes Session lifecycle, Resource Claims, authorization/evidence, governed Git commit/push, reconciliation/discovery, and protected execution. Use `--help --json` and `capabilities --json` for the authoritative inventory. Human-readable guidance and agent integrations use these same command and action identifiers; there is no separate human or agent workflow.
|
|
262
|
+
|
|
263
|
+
`src/cli-command-registry.ts` is the single canonical authority for that surface: every command/option name is a `CommandId`/`OptionId` literal type derived directly from the registry data (not hand-typed), and `--help`, `capabilities`, and the executable dispatcher's own accepted-flag parsing all read that same data. There is no second command or option table to keep in sync.
|
|
183
264
|
|
|
184
265
|
## Stable package exports
|
|
185
266
|
|