@popovych.co/witness 0.29.0 → 0.31.1
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 +14 -3
- package/dist/arbiter.d.ts +1 -0
- package/dist/arbiter.js +20 -3
- package/dist/autonomy.js +8 -0
- package/dist/carry.d.ts +74 -0
- package/dist/carry.js +683 -0
- package/dist/change-set.d.ts +9 -0
- package/dist/change-set.js +135 -0
- package/dist/clash.d.ts +23 -0
- package/dist/clash.js +225 -0
- package/dist/cli.js +3 -3
- package/dist/content-sha.d.ts +3 -0
- package/dist/content-sha.js +48 -0
- package/dist/criteria.d.ts +9 -0
- package/dist/criteria.js +13 -0
- package/dist/decide-view.d.ts +10 -1
- package/dist/decide-view.js +55 -30
- package/dist/drafts.js +5 -1
- package/dist/drift.js +8 -3
- package/dist/drive-report.js +3 -0
- package/dist/drive.d.ts +5 -4
- package/dist/drive.js +89 -47
- package/dist/evidence.d.ts +4 -3
- package/dist/evidence.js +163 -45
- package/dist/gate.d.ts +4 -0
- package/dist/gate.js +250 -56
- package/dist/gates/decompose.js +41 -28
- package/dist/gates/design.js +13 -11
- package/dist/gates/implement.js +48 -41
- package/dist/gates/plan.js +23 -20
- package/dist/gates/ship.js +81 -43
- package/dist/gitio.d.ts +3 -0
- package/dist/gitio.js +19 -2
- package/dist/harness.d.ts +2 -0
- package/dist/harness.js +9 -4
- package/dist/held.d.ts +41 -0
- package/dist/held.js +411 -0
- package/dist/install.d.ts +9 -2
- package/dist/install.js +152 -11
- package/dist/journal.d.ts +20 -1
- package/dist/journal.js +11 -0
- package/dist/json-format.d.ts +7 -0
- package/dist/json-format.js +49 -0
- package/dist/junit.d.ts +10 -0
- package/dist/junit.js +16 -0
- package/dist/lint-config.d.ts +17 -0
- package/dist/lint-config.js +239 -0
- package/dist/merge-clock.d.ts +7 -0
- package/dist/merge-clock.js +27 -0
- package/dist/models.d.ts +1 -0
- package/dist/models.js +2 -0
- package/dist/progress.js +5 -0
- package/dist/recommend.d.ts +3 -0
- package/dist/recommend.js +148 -23
- package/dist/record.d.ts +51 -0
- package/dist/record.js +176 -0
- package/dist/retired-payload.d.ts +1 -0
- package/dist/retired-payload.js +98 -0
- package/dist/reviewed.js +6 -5
- package/dist/reviewer.d.ts +3 -3
- package/dist/reviewer.js +117 -55
- package/dist/rounds.d.ts +47 -4
- package/dist/rounds.js +425 -65
- package/dist/runner.d.ts +8 -0
- package/dist/runner.js +30 -6
- package/dist/scratch.d.ts +1 -0
- package/dist/scratch.js +16 -0
- package/dist/session-end.d.ts +14 -0
- package/dist/session-end.js +89 -0
- package/dist/settle.d.ts +1 -0
- package/dist/settle.js +24 -8
- package/dist/ship.d.ts +18 -1
- package/dist/ship.js +464 -86
- package/dist/slice.js +4 -2
- package/dist/snapshot.js +16 -16
- package/dist/stamp.js +16 -2
- package/dist/verbs/check.js +89 -7
- package/dist/verbs/dashboard.d.ts +1 -1
- package/dist/verbs/dashboard.js +26 -15
- package/dist/verbs/decide.js +106 -84
- package/dist/verbs/diff.js +7 -6
- package/dist/verbs/draft.js +6 -2
- package/dist/verbs/evidence.js +23 -2
- package/dist/verbs/gate.js +5 -2
- package/dist/verbs/init.js +29 -3
- package/dist/verbs/log.js +26 -9
- package/dist/verbs/migrate.js +4 -8
- package/dist/verbs/next.d.ts +10 -1
- package/dist/verbs/next.js +383 -84
- package/dist/verbs/recap.d.ts +2 -0
- package/dist/verbs/recap.js +151 -5
- package/dist/verbs/recover.js +68 -3
- package/dist/verbs/start.js +11 -0
- package/dist/verbs/turn.js +18 -0
- package/dist/worker-stream.d.ts +7 -0
- package/dist/worker-stream.js +150 -5
- package/dist/worktree.d.ts +1 -0
- package/dist/worktree.js +54 -16
- package/package.json +1 -1
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/commands/witness.md +14 -2
- package/plugin/hooks/session-dashboard.sh +1 -1
- package/plugin/skills/witness-brainstorm/SKILL.md +8 -4
- package/plugin/skills/witness-decompose/SKILL.md +3 -3
- package/plugin/skills/witness-design/SKILL.md +3 -3
- package/plugin/skills/witness-implement/SKILL.md +8 -6
- package/plugin/skills/witness-plan/SKILL.md +3 -3
- package/plugin/skills/witness-ship/SKILL.md +40 -22
package/README.md
CHANGED
|
@@ -149,6 +149,16 @@ with `cli-behind-state` rather than answering from rules the repository has move
|
|
|
149
149
|
release, say — lower it first with `witness floor --set <version> --note <why>`; the
|
|
150
150
|
decision is journaled, and `floor` is the one verb that still runs under a bound it fails.
|
|
151
151
|
|
|
152
|
+
From **0.30.1** witness's Claude Code hooks live in `.witness/hooks/`, which a repo's lint
|
|
153
|
+
usually skips. `init --agent claude-code` moves them from `.claude/hooks/` at the root,
|
|
154
|
+
rewires `.claude/settings.json` and writes it in your formatter's default style; your own
|
|
155
|
+
hooks in `.claude/hooks/` stay where they are. The settings file is rewritten and committed
|
|
156
|
+
once, so commit your own edits to it first. Restart any open Claude Code session in the
|
|
157
|
+
repo (a session keeps the hooks it started with) and push the init commit (new worktrees
|
|
158
|
+
and `witness ship` read the remote). A worktree started earlier keeps its old hooks until
|
|
159
|
+
`witness ship` carries it onto the moved base. `witness check` warns `payload-linted` when
|
|
160
|
+
your Biome config would still check witness's files.
|
|
161
|
+
|
|
152
162
|
### Support tiers
|
|
153
163
|
|
|
154
164
|
| Tier | Agents | What they get |
|
|
@@ -294,7 +304,8 @@ the wrong file refuses. There are no `WITNESS_*` env vars for configuration.
|
|
|
294
304
|
| verb | does |
|
|
295
305
|
| --- | --- |
|
|
296
306
|
| `init [--agent claude-code\|pi\|auto]` | scaffold config, principles, journal — one trailer commit; `--agent` also installs that harness's engine, guard and dashboard (idempotent) |
|
|
297
|
-
| `recap [--amend] --file <json>` | validate + persist a scope recap — class, goals, non-goals, constraints and numbered decisions; births the effort journal |
|
|
307
|
+
| `recap [--amend] --file <json>` | validate + persist a scope recap — class, goals, non-goals, constraints and numbered decisions; births the effort journal; a fix adds `"cause": "escape"` or `"cause": "decision"` |
|
|
308
|
+
| `recap --effort <slug> --cause escape\|decision` | the human names the cause of a fix that predates causes, in their own chat or terminal (refused in a witness-spawned session); `status` lists those fixes under `cause-owed` |
|
|
298
309
|
| `draft <key> [--file <json>]` | a grill's or design session's local draft — saved after every settled answer, read back to resume; never committed or journaled |
|
|
299
310
|
| `write <id> --effort <e> --meta <json> --body <md>` | validated manifest → spec/plan on disk + journal entry; a spec's `covers` and `carries` map it to the recap's goals and decisions |
|
|
300
311
|
| `diff <spec-id>` | delta since the last realized state (plan pin → empty), and the decisions that moved since that plan |
|
|
@@ -306,7 +317,7 @@ the wrong file refuses. There are no `WITNESS_*` env vars for configuration.
|
|
|
306
317
|
| `retry <target>` | ask drive to try a set-aside target again, after a fix that leaves no record of its own (code, a tool, an account); refused inside a session |
|
|
307
318
|
| `wait [--since <token>]` | under autonomy, block until something new needs you, drive stops with work left, a merge lands on GitHub, or a newer chat takes over — the `/witness` chat runs it; journals nothing |
|
|
308
319
|
| `log <id>` | render a journal stream |
|
|
309
|
-
| `gate <decompose\|plan\|implement\|ship\|design> <id
|
|
320
|
+
| `gate <decompose\|plan\|implement\|ship\|design> <id> [--fresh] [--manual] [--unchanged]` | run the reviewer gate; journals the round, stamps on pass · `--unchanged` hands a revise back when the author judges it needs no change: where the gate would answer changed-nothing it journals the hand-back and the revise is decided again, and anywhere else it runs as the plain gate and says why nothing was handed back |
|
|
310
321
|
| `decide <gate> <id> --approve\|--revise [--pin <policy>]` | record the human decision on a stopped gate; `--pin` adds a standing content policy |
|
|
311
322
|
| `design <spec-id> --file <html>\|--open\|--reconfirm\|--preview <html>` | register/show a `ui` spec's approved look; `--preview` opens a page and records nothing |
|
|
312
323
|
| `review design <spec-id> [--file <html>]` | the design gate's reviewers on a look — the registered one, or a page not yet registered — asking the gate's full-review question; journals nothing, decides nothing, and replays the gate's answer when the gate already judged the same bytes in full |
|
|
@@ -324,7 +335,7 @@ the wrong file refuses. There are no `WITNESS_*` env vars for configuration.
|
|
|
324
335
|
| `clean` | reap stale worktrees |
|
|
325
336
|
| `sync` | pull --rebase + push state commits |
|
|
326
337
|
| `recover [--complete\|--rollback]` | resolve a crashed write transaction |
|
|
327
|
-
| `status` | orientation: flows, blocked docs, reconcile rows, pending gates |
|
|
338
|
+
| `status [--record]` | orientation: flows, blocked docs, reconcile rows, pending gates and the track record's line; `--record` prints the track record in full |
|
|
328
339
|
| *(no verb)* | the same screen as `status` |
|
|
329
340
|
|
|
330
341
|
## Exit codes
|
package/dist/arbiter.d.ts
CHANGED
|
@@ -28,6 +28,7 @@ export declare function arbitrate(ctx: Ctx, root: string, cfg: Config, req: Arbi
|
|
|
28
28
|
export declare function menuFor(block: Decision, run: GateRunEntry): Array<Option & {
|
|
29
29
|
act: Act;
|
|
30
30
|
}>;
|
|
31
|
+
export declare const HANDED_BACK_FACT = "the author handed this revise back with the content unchanged";
|
|
31
32
|
export declare function decisionEvidence(root: string, canon: Canon, stop: {
|
|
32
33
|
gate: string;
|
|
33
34
|
target: string;
|
package/dist/arbiter.js
CHANGED
|
@@ -9,7 +9,7 @@ import { SESSION_DEFAULT, stageModel, unansweredPin } from './model.js';
|
|
|
9
9
|
import { ok, refuse, v } from './refusal.js';
|
|
10
10
|
import { invokeReviewerAsync, parseVerdictText, promptsSha, resolvePrompt } from './reviewer.js';
|
|
11
11
|
import { effortCanon, effortOf } from './reviewed.js';
|
|
12
|
-
import { anchorRecurrence, gateRuns, roundBudget } from './rounds.js';
|
|
12
|
+
import { REVISE_HUMAN, anchorRecurrence, gateRuns, roundBudget } from './rounds.js';
|
|
13
13
|
import { findById } from './scan.js';
|
|
14
14
|
import { canonicalJson } from './sha.js';
|
|
15
15
|
// How a later mode adds its own prompt without a second invoker.
|
|
@@ -98,19 +98,31 @@ export async function arbitrate(ctx, root, cfg, req) {
|
|
|
98
98
|
// Row 239. Read off each option's act, never its printed line: an option the CLI built from no
|
|
99
99
|
// act is not offered, a word is a flag only where the act holds it as one, and the one input the
|
|
100
100
|
// arbiter may fill is the `<why>` slot (settle fills it through argv).
|
|
101
|
+
// Row 244 (design §4.2.6, §4.2.7; P38). The arbiter never revises a gate a revise already stands on:
|
|
102
|
+
// in the states where a plain revise is the human's alone (`REVISE_HUMAN`) every plain revise goes,
|
|
103
|
+
// the noted one included, while the send-upstream stays. A handed-back revise (`revise-returned`) is
|
|
104
|
+
// the one such state a settle brings to the arbiter, and there it matters twice over: hand-backs spend
|
|
105
|
+
// no rounds, so the bound would never stop a revise → hand-back loop.
|
|
101
106
|
export function menuFor(block, run) {
|
|
102
107
|
const failed = run.checks.filter((c) => !c.ok);
|
|
103
108
|
const approveBarred = run.gate === 'design' || (failed.length > 0 && !failed.every((c) => c.name === 'amendment-ack'));
|
|
109
|
+
const reviseBarred = block.state !== undefined && REVISE_HUMAN.has(block.state);
|
|
110
|
+
const plainRevise = (argv) => argv.includes('--revise') && !argv.includes('--upstream') && !argv.includes('--repair');
|
|
104
111
|
return block.options.filter((o) => o.act?.argv[0] === 'decide' &&
|
|
105
112
|
!o.act.argv.includes('--trust-cmds') &&
|
|
106
113
|
o.act.inputs.every((i) => i.name === 'why') &&
|
|
107
|
-
!(approveBarred && o.act.argv.includes('--approve'))
|
|
114
|
+
!(approveBarred && o.act.argv.includes('--approve')) &&
|
|
115
|
+
!(reviseBarred && plainRevise(o.act.argv)));
|
|
108
116
|
}
|
|
117
|
+
// Row 244 (design §4.2.6). A hand-back as the arbiter hears it: a journal fact in this fixed sentence,
|
|
118
|
+
// never a word the author wrote (anti-goal 1) — the entry carries none, and no field of it is read.
|
|
119
|
+
export const HANDED_BACK_FACT = 'the author handed this revise back with the content unchanged';
|
|
109
120
|
const anchorText = (a) => (typeof a === 'string' ? a : `omission:${a.scope}`);
|
|
110
121
|
const HISTORY_RUNS = 10;
|
|
111
122
|
// The evidence the arbiter reads, composed by the CLI from the journal and canon. It never
|
|
112
123
|
// carries a session transcript: none exists to carry, and the author's narration is
|
|
113
|
-
// exactly what the arbiter must not hear (anti-goal 1).
|
|
124
|
+
// exactly what the arbiter must not hear (anti-goal 1). A hand-back reaches it as a fact the CLI
|
|
125
|
+
// states (`HANDED_BACK_FACT`), never as the author's account of why.
|
|
114
126
|
export function decisionEvidence(root, canon, stop) {
|
|
115
127
|
const { gate, target, entries, run, block } = stop;
|
|
116
128
|
const findings = (run.verdicts ?? []).flatMap((rv) => rv.findings.map((f) => ({ reviewer: rv.reviewer, f })));
|
|
@@ -145,6 +157,11 @@ export function decisionEvidence(root, canon, stop) {
|
|
|
145
157
|
for (const e of entries.slice(at + 1)) {
|
|
146
158
|
if (e.t === 'gate-run' && e.gate === gate)
|
|
147
159
|
break;
|
|
160
|
+
// Row 244 (design §4.2.6). The hand-back in its place among the gate's decisions, after the revise it answers.
|
|
161
|
+
if (e.t === 'revise-returned' && e.gate === gate) {
|
|
162
|
+
history.push(` - handed back · ${HANDED_BACK_FACT}`);
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
148
165
|
if (e.t !== 'human-decision' || e.gate !== gate)
|
|
149
166
|
continue;
|
|
150
167
|
const d = e;
|
package/dist/autonomy.js
CHANGED
|
@@ -80,6 +80,13 @@ export function policyFor(facts) {
|
|
|
80
80
|
if (failed.some((c) => (c.untrusted?.length ?? 0) > 0) && !boundReached(entries, gate)) {
|
|
81
81
|
return { kind: 'take', act: cliAct('gate', gate, target) };
|
|
82
82
|
}
|
|
83
|
+
// Row 244 (design §4.2.6; the user's decision 2). A revise its author handed back unchanged is decided
|
|
84
|
+
// again, by the arbiter: neither the author nor a reviewer found a fix, so no rule has the right
|
|
85
|
+
// answer. It comes after the arms that belong elsewhere — the human's trust grant, the free re-runs
|
|
86
|
+
// (stale or malformed, fallen back, trust granted since) and the human's design look — and stays out
|
|
87
|
+
// of TAKEN, whose revise the author would only hand back again.
|
|
88
|
+
if (block.rule === 'revise-returned')
|
|
89
|
+
return { kind: 'arbiter' };
|
|
83
90
|
if (block.rule === 'checks-failed') {
|
|
84
91
|
// amendment-ack is the one check an approve clears, so approving is a judgment about the
|
|
85
92
|
// amendment against the ask — the arbiter's, never the rule's (§11 call 10).
|
|
@@ -88,6 +95,7 @@ export function policyFor(facts) {
|
|
|
88
95
|
if (TAKEN.has(block.rule) || block.rule.startsWith('anchor-recurrence-'))
|
|
89
96
|
return first();
|
|
90
97
|
// bound · bound-stale · ladder-spent · pin-contradiction · reserved-stop-clean · manual-stop
|
|
98
|
+
// (revise-returned has its own arm above)
|
|
91
99
|
return { kind: 'arbiter' };
|
|
92
100
|
}
|
|
93
101
|
// Row 173. Who made a disposition, in one spelling for every surface that says so
|
package/dist/carry.d.ts
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { type Result, type Violation } from './refusal.js';
|
|
2
|
+
import { type Platform } from './toon.js';
|
|
3
|
+
export declare const CARRY_ACTION = "witness-carry";
|
|
4
|
+
export declare function carryGit(wt: string, ...args: string[]): {
|
|
5
|
+
code: number | null;
|
|
6
|
+
stdout: string;
|
|
7
|
+
stderr: string;
|
|
8
|
+
};
|
|
9
|
+
export declare function carryRef(planId: string): string;
|
|
10
|
+
export declare function keptPrefix(planId: string): string;
|
|
11
|
+
export type OpInProgress = 'rebase-merge' | 'rebase-apply' | 'MERGE_HEAD' | 'CHERRY_PICK_HEAD' | 'REVERT_HEAD';
|
|
12
|
+
export declare function operationInProgress(wt: string): OpInProgress | undefined;
|
|
13
|
+
export interface UnmergedPath {
|
|
14
|
+
path: string;
|
|
15
|
+
stages: Partial<Record<1 | 2 | 3, string>>;
|
|
16
|
+
}
|
|
17
|
+
export declare function unmergedPaths(wt: string): UnmergedPath[];
|
|
18
|
+
export interface KeptRef {
|
|
19
|
+
ref: string;
|
|
20
|
+
sha: string;
|
|
21
|
+
files: string[];
|
|
22
|
+
}
|
|
23
|
+
export declare function keptRefs(wt: string, planId: string): KeptRef[];
|
|
24
|
+
export declare function keepCarry(wt: string, planId: string, carry: string, files: string[]): Result<string>;
|
|
25
|
+
export declare function carryPending(planId: string, got: string): Violation;
|
|
26
|
+
export declare function seeWork(ref: string): string;
|
|
27
|
+
export declare function carryGone(planId: string, wt: string): Violation;
|
|
28
|
+
export declare function offBranchPending(planId: string, head: string): Violation;
|
|
29
|
+
export declare function sessionUnmerged(planId: string, files: readonly UnmergedPath[]): Violation[];
|
|
30
|
+
export declare function restorePending(planId: string, got: string): Violation;
|
|
31
|
+
export declare function touchedRebasePending(planId: string, why: string): Violation;
|
|
32
|
+
export declare function heldLock(wt: string, out: string, locks?: readonly string[]): string | undefined;
|
|
33
|
+
export declare function lockedRow(planId: string, lock: string, carried: boolean, unfinished?: boolean): Violation;
|
|
34
|
+
export declare function headReflog(wt: string): string[];
|
|
35
|
+
export type RebaseOwner = 'witness' | 'session' | 'silent';
|
|
36
|
+
export declare function rebaseOwnerSince(wt: string, op: OpInProgress | undefined, out: string, before: readonly string[]): RebaseOwner;
|
|
37
|
+
export declare function witnessOwnRebase(wt: string, carry: string): RebaseOwner;
|
|
38
|
+
export type StopReading = {
|
|
39
|
+
fresh: true;
|
|
40
|
+
unmerged: UnmergedPath[];
|
|
41
|
+
} | {
|
|
42
|
+
fresh: false;
|
|
43
|
+
why: string;
|
|
44
|
+
};
|
|
45
|
+
export declare function freshStop(wt: string): StopReading;
|
|
46
|
+
export declare function keepStopped(wt: string, planId: string, files: readonly string[]): Result<string>;
|
|
47
|
+
export declare function gitAtLeast(versionLine: string, major: number, minor: number): boolean;
|
|
48
|
+
export declare function blobAt(wt: string, rev: string, path: string): string | undefined;
|
|
49
|
+
export declare function workAlreadyBack(wt: string, carry: string): {
|
|
50
|
+
back: boolean;
|
|
51
|
+
lock?: string;
|
|
52
|
+
};
|
|
53
|
+
export declare function operationRefusal(wt: string, planId: string, op: OpInProgress, silent?: boolean): Violation;
|
|
54
|
+
export declare function captureCarry(wt: string, planId: string): Result<string | undefined>;
|
|
55
|
+
export declare function cleanTree(wt: string, planId: string): Result<void>;
|
|
56
|
+
export type Reapplied = {
|
|
57
|
+
kind: 'clean';
|
|
58
|
+
kept?: string;
|
|
59
|
+
} | {
|
|
60
|
+
kind: 'clash';
|
|
61
|
+
kept: string;
|
|
62
|
+
files: UnmergedPath[];
|
|
63
|
+
} | {
|
|
64
|
+
kind: 'refused';
|
|
65
|
+
out: string;
|
|
66
|
+
} | {
|
|
67
|
+
kind: 'locked';
|
|
68
|
+
lock: string;
|
|
69
|
+
};
|
|
70
|
+
export declare function reapply(wt: string, planId: string, carry: string): Reapplied;
|
|
71
|
+
export declare function dropCarry(wt: string, planId: string, carry: string): Reapplied;
|
|
72
|
+
export declare function baseInTheWay(wt: string, planId: string, base: string): Result<void>;
|
|
73
|
+
export declare function untrackedInTheWay(wt: string, paths: readonly string[]): string[] | undefined;
|
|
74
|
+
export declare function remedyLine(argv: readonly string[], platform?: Platform): string;
|