@popovych.co/witness 0.28.0 → 0.28.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 +6 -3
- package/dist/adopt.js +92 -6
- package/dist/allowlist.js +10 -1
- package/dist/arbiter.js +5 -3
- package/dist/drive-presence.js +96 -13
- package/dist/drive.js +37 -8
- package/dist/gates/decompose.js +25 -7
- package/dist/needs.js +6 -2
- package/dist/principles.js +18 -0
- package/dist/recommend.js +13 -5
- package/dist/reviewed.js +30 -1
- package/dist/runner.js +7 -3
- package/dist/verbs/adopt.js +20 -3
- package/dist/verbs/check.js +17 -4
- package/dist/verbs/decide.js +25 -9
- package/dist/verbs/drive.js +9 -1
- package/dist/verbs/floor.js +34 -4
- package/dist/verbs/init.js +5 -7
- package/dist/verbs/migrate.js +43 -11
- package/dist/verbs/next.js +64 -16
- package/dist/verbs/satisfy.js +8 -0
- package/dist/verbs/trust.js +37 -19
- package/dist/verbs/write.js +6 -1
- package/package.json +1 -1
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/commands/witness.md +1 -1
- package/plugin/hooks/session-dashboard.sh +1 -1
- package/plugin/skills/witness-brainstorm/SKILL.md +1 -1
- package/plugin/skills/witness-decompose/SKILL.md +1 -1
- package/plugin/skills/witness-design/SKILL.md +1 -1
- package/plugin/skills/witness-implement/SKILL.md +1 -1
- package/plugin/skills/witness-plan/SKILL.md +1 -1
- package/plugin/skills/witness-ship/SKILL.md +1 -1
package/dist/verbs/trust.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { parseArgs } from 'node:util';
|
|
2
2
|
import { EXIT } from '../cli.js';
|
|
3
|
-
import { commandsRun, grantCommands, repoCommands, trustedCommands } from '../allowlist.js';
|
|
3
|
+
import { commandsRun, grantCommands, repoCommands, trustedCommands, unsafeLeft } from '../allowlist.js';
|
|
4
4
|
import { loadConfig } from '../config.js';
|
|
5
5
|
import { sessionMarker } from '../drive-presence.js';
|
|
6
6
|
import { primaryRoot, stateCommit } from '../gitio.js';
|
|
7
7
|
import { appendEntry, entryLine, journalRel } from '../journal.js';
|
|
8
|
-
import {
|
|
8
|
+
import { acquireLock } from '../lock.js';
|
|
9
|
+
import { ok, renderRefusal, v } from '../refusal.js';
|
|
9
10
|
import { effortOf } from '../reviewed.js';
|
|
10
11
|
import { findById, loadCanon } from '../scan.js';
|
|
11
12
|
import { cmd as cmdLine, hasControl, kv, rows, shellArg, visible } from '../toon.js';
|
|
12
|
-
import { guardTxn, withTxn } from '../txn.js';
|
|
13
|
+
import { crashPoint, guardTxn, withTxn } from '../txn.js';
|
|
13
14
|
const USAGE = "witness trust [<artifact-id>] [--cmd '<exact command>']… [--yes]";
|
|
14
15
|
// D154. The green-path half. Trust rides the decision surface wherever a stop exists
|
|
15
16
|
// (`decide --approve --trust-cmds`), but a green-path class never stops — and a headless
|
|
@@ -83,7 +84,7 @@ export async function run(ctx, argv) {
|
|
|
83
84
|
ctx.out(kv('trust', 'every command is already trusted'));
|
|
84
85
|
return EXIT.OK;
|
|
85
86
|
}
|
|
86
|
-
ctx.out(kv('trust',
|
|
87
|
+
ctx.out(kv('trust', unsafeLeft(unsafe)));
|
|
87
88
|
return EXIT.FINDINGS;
|
|
88
89
|
};
|
|
89
90
|
if (id === undefined) {
|
|
@@ -149,22 +150,39 @@ export async function run(ctx, argv) {
|
|
|
149
150
|
ctx.out(cmdLine('run', `witness trust ${id} --cmd ${shellArg(c)}`));
|
|
150
151
|
return EXIT.FINDINGS;
|
|
151
152
|
}
|
|
152
|
-
|
|
153
|
-
|
|
153
|
+
const granted = grantTrust(ctx, root, id, grant, 'verb');
|
|
154
|
+
if (!granted.ok) {
|
|
155
|
+
renderRefusal(granted.violations).forEach((l) => ctx.err(l));
|
|
156
|
+
return granted.violations.some((x) => x.rule === 'locked') ? EXIT.BLOCKED : EXIT.REFUSED;
|
|
157
|
+
}
|
|
154
158
|
ctx.out(kv('trusted', grant.join(' · ')));
|
|
155
159
|
return EXIT.OK;
|
|
156
160
|
}
|
|
157
|
-
//
|
|
158
|
-
//
|
|
159
|
-
// allow.json
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
const
|
|
165
|
-
|
|
166
|
-
return
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
161
|
+
// Row 222 (#67). A grant is a state write like every other: under the repo lock, one
|
|
162
|
+
// transaction appends the `trust` entry and lands its trailer commit, and only then does
|
|
163
|
+
// allow.json take the commands — D154's order, a grant follows the durable record, so a
|
|
164
|
+
// refused commit or a crash before it leaves no grant nobody journaled. allow.json is
|
|
165
|
+
// machine-local and gitignored, so it rides the lock, never the commit; the lock is what
|
|
166
|
+
// keeps two grants' read-modify-write of it from losing one.
|
|
167
|
+
export function grantTrust(ctx, root, artifact, cmds, via) {
|
|
168
|
+
const lock = acquireLock(root);
|
|
169
|
+
if (!lock.ok)
|
|
170
|
+
return lock;
|
|
171
|
+
try {
|
|
172
|
+
const stream = effortOf(root, artifact) ?? artifact;
|
|
173
|
+
const entry = { t: 'trust', artifact, cmds, via };
|
|
174
|
+
const rel = journalRel(stream);
|
|
175
|
+
const res = withTxn(root, { op: `trust(${artifact})`, files: [rel], journal: { stream, line: entryLine(entry) } }, () => {
|
|
176
|
+
appendEntry(root, stream, entry);
|
|
177
|
+
crashPoint(ctx.env, 'trust-journal');
|
|
178
|
+
const committed = stateCommit(root, [rel], `trust(${artifact}): ${cmds.length} command(s)`);
|
|
179
|
+
if (committed.ok)
|
|
180
|
+
grantCommands(root, cmds);
|
|
181
|
+
return committed;
|
|
182
|
+
});
|
|
183
|
+
return res.ok ? ok(undefined) : res;
|
|
184
|
+
}
|
|
185
|
+
finally {
|
|
186
|
+
lock.value();
|
|
187
|
+
}
|
|
170
188
|
}
|
package/dist/verbs/write.js
CHANGED
|
@@ -12,6 +12,7 @@ import { dirtyStatePaths, primaryRoot, stateCommit } from '../gitio.js';
|
|
|
12
12
|
import { appendEntry, entryLine, journalRel, latestRecap, readStream, streamExists } from '../journal.js';
|
|
13
13
|
import { acquireLock } from '../lock.js';
|
|
14
14
|
import { humanCall, renderRefusal, v } from '../refusal.js';
|
|
15
|
+
import { principlesApproval } from './next.js';
|
|
15
16
|
import { baseForSpec, contentAtSha } from '../history.js';
|
|
16
17
|
import { findById, findCycle, loadCanon, planFinished, plansOn } from '../scan.js';
|
|
17
18
|
import { canonicalJson, canonicalSha, short } from '../sha.js';
|
|
@@ -324,7 +325,11 @@ function buildPlanMeta(root, id, manifest, recap, canon, existing, body) {
|
|
|
324
325
|
violations.push(v('parent', 'kind', String(parent.meta.type), 'a spec (or principles for chores)'));
|
|
325
326
|
}
|
|
326
327
|
if (parent.meta.status === 'draft') {
|
|
327
|
-
|
|
328
|
+
// Row 221. Draft principles name what approves them (`principlesApproval`, the derivation
|
|
329
|
+
// `next` routes by), so the remedy never routes back to this refused write.
|
|
330
|
+
const approval = parent.meta.type === 'principles' ? principlesApproval(root, canon) : undefined;
|
|
331
|
+
violations.push(v('parent', 'parent-not-approved', String(parentId), approval?.remedy
|
|
332
|
+
?? 'a parent stamped approved by its gate — run: witness gate decompose --effort <slug>'));
|
|
328
333
|
}
|
|
329
334
|
const computed = canonicalSha(parent.meta, parent.body);
|
|
330
335
|
const supplied = manifest['derives-from'];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@popovych.co/witness",
|
|
3
|
-
"version": "0.28.
|
|
3
|
+
"version": "0.28.2",
|
|
4
4
|
"description": "Evidence-gated spec-driven development pipeline for AI coding agents: brainstorm to PR in six stages, where specs are state, plans are motion, and no transition passes without evidence. Drives from Claude Code or Pi.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"spec-driven-development",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "witness",
|
|
3
3
|
"description": "Spec-driven development with evidence gates: brainstorm → PR through six stages and five gates. Skills author, the pinned witness CLI writes state and witnesses evidence; gates stop where judgment is owed.",
|
|
4
|
-
"version": "0.28.
|
|
4
|
+
"version": "0.28.2",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Kostiantyn Popovych"
|
|
7
7
|
},
|
|
@@ -12,7 +12,7 @@ Any other words in `$ARGUMENTS` are the human's ask: run `$WITNESS ask "<those w
|
|
|
12
12
|
Resolve the CLI once:
|
|
13
13
|
|
|
14
14
|
```bash
|
|
15
|
-
WITNESS="${WITNESS_BIN:-npx -y @popovych.co/witness@0.28.
|
|
15
|
+
WITNESS="${WITNESS_BIN:-npx -y @popovych.co/witness@0.28.2}"
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
If the repo has no `witness.config.yaml`, run `$WITNESS init` first (one bootstrap commit), then proceed. If init or any verb refuses on a dirty tree, the human commits or cleans it — **never `git commit` yourself, anywhere, at any stage**: the CLI makes its own state commits, and the ship phase makes the sole code commit.
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
[ -f witness.config.yaml ] || exit 0
|
|
6
6
|
# row 217: a reviewer reads; it never runs witness
|
|
7
7
|
[ -n "$WITNESS_REVIEWER" ] && exit 0
|
|
8
|
-
${WITNESS_BIN:-npx -y @popovych.co/witness@0.28.
|
|
8
|
+
${WITNESS_BIN:-npx -y @popovych.co/witness@0.28.2} 2>/dev/null || true
|
|
@@ -16,7 +16,7 @@ recap, keeps a local draft, writes no document. See NOTICE.md. -->
|
|
|
16
16
|
Resolve the CLI once per session:
|
|
17
17
|
|
|
18
18
|
```bash
|
|
19
|
-
WITNESS="${WITNESS_BIN:-npx -y @popovych.co/witness@0.28.
|
|
19
|
+
WITNESS="${WITNESS_BIN:-npx -y @popovych.co/witness@0.28.2}"
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
- **Render the CLI's decision output verbatim and in full — every line, unmodified.** Never print a command set you remember; never recompose, reformat, summarise or reorder what the CLI emitted. Which decisions are live, how they rank, and what each costs are the CLI's answers, and they change with the round, the bound, the repair grant and the content sha — a remembered set is wrong in more states than it is right.
|
|
@@ -10,7 +10,7 @@ description: Slice a witness effort's confirmed recap into vertical spec slices,
|
|
|
10
10
|
Resolve the CLI once per session:
|
|
11
11
|
|
|
12
12
|
```bash
|
|
13
|
-
WITNESS="${WITNESS_BIN:-npx -y @popovych.co/witness@0.28.
|
|
13
|
+
WITNESS="${WITNESS_BIN:-npx -y @popovych.co/witness@0.28.2}"
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
- **Render the CLI's decision output verbatim and in full — every line, unmodified.** Never print a command set you remember; never recompose, reformat, summarise or reorder what the CLI emitted. Which decisions are live, how they rank, and what each costs are the CLI's answers, and they change with the round, the bound, the repair grant and the content sha — a remembered set is wrong in more states than it is right.
|
|
@@ -16,7 +16,7 @@ No text copied verbatim; the design-critic lens is new material. -->
|
|
|
16
16
|
Resolve the CLI once per session:
|
|
17
17
|
|
|
18
18
|
```bash
|
|
19
|
-
WITNESS="${WITNESS_BIN:-npx -y @popovych.co/witness@0.28.
|
|
19
|
+
WITNESS="${WITNESS_BIN:-npx -y @popovych.co/witness@0.28.2}"
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
- **Render the CLI's decision output verbatim and in full — every line, unmodified.** Never print a command set you remember; never recompose, reformat, summarise or reorder what the CLI emitted. Which decisions are live, how they rank, and what each costs are the CLI's answers, and they change with the round, the bound, the repair grant and the content sha — a remembered set is wrong in more states than it is right.
|
|
@@ -15,7 +15,7 @@ tests carry the parent spec's tag in their NAME. See NOTICE.md. -->
|
|
|
15
15
|
Resolve the CLI once per session:
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
|
-
WITNESS="${WITNESS_BIN:-npx -y @popovych.co/witness@0.28.
|
|
18
|
+
WITNESS="${WITNESS_BIN:-npx -y @popovych.co/witness@0.28.2}"
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
- **Render the CLI's decision output verbatim and in full — every line, unmodified.** Never print a command set you remember; never recompose, reformat, summarise or reorder what the CLI emitted. Which decisions are live, how they rank, and what each costs are the CLI's answers, and they change with the round, the bound, the repair grant and the content sha — a remembered set is wrong in more states than it is right.
|
|
@@ -15,7 +15,7 @@ parent's criteria. See NOTICE.md. -->
|
|
|
15
15
|
Resolve the CLI once per session:
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
|
-
WITNESS="${WITNESS_BIN:-npx -y @popovych.co/witness@0.28.
|
|
18
|
+
WITNESS="${WITNESS_BIN:-npx -y @popovych.co/witness@0.28.2}"
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
- **Render the CLI's decision output verbatim and in full — every line, unmodified.** Never print a command set you remember; never recompose, reformat, summarise or reorder what the CLI emitted. Which decisions are live, how they rank, and what each costs are the CLI's answers, and they change with the round, the bound, the repair grant and the content sha — a remembered set is wrong in more states than it is right.
|
|
@@ -15,7 +15,7 @@ model can. See NOTICE.md. -->
|
|
|
15
15
|
Resolve the CLI once per session:
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
|
-
WITNESS="${WITNESS_BIN:-npx -y @popovych.co/witness@0.28.
|
|
18
|
+
WITNESS="${WITNESS_BIN:-npx -y @popovych.co/witness@0.28.2}"
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
- **Render the CLI's decision output verbatim and in full — every line, unmodified.** Never print a command set you remember; never recompose, reformat, summarise or reorder what the CLI emitted. Which decisions are live, how they rank, and what each costs are the CLI's answers, and they change with the round, the bound, the repair grant and the content sha — a remembered set is wrong in more states than it is right.
|