@mmerterden/multi-agent-pipeline 17.1.0 → 17.4.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/CHANGELOG.md +194 -0
- package/README.md +7 -0
- package/README.tr.md +7 -0
- package/docs/token-budget-history.md +22 -0
- package/install/_dev-only-files.mjs +1 -0
- package/install/codex.mjs +18 -1
- package/install/copilot.mjs +17 -1
- package/package.json +1 -1
- package/pipeline/agents/code-reviewer.md +35 -1
- package/pipeline/commands/multi-agent/autopilot-on/SKILL.md +9 -1
- package/pipeline/lib/autopilot-state.sh +34 -0
- package/pipeline/multi-agent-refs/_dev-context.md +10 -0
- package/pipeline/multi-agent-refs/analysis/locked.md +4 -4
- package/pipeline/multi-agent-refs/analysis/redesign.md +8 -0
- package/pipeline/multi-agent-refs/analysis/render.md +2 -1
- package/pipeline/multi-agent-refs/analysis/review.md +9 -0
- package/pipeline/multi-agent-refs/android-guide.md +14 -0
- package/pipeline/multi-agent-refs/audit-guide.md +12 -0
- package/pipeline/multi-agent-refs/backend-guide.md +10 -0
- package/pipeline/multi-agent-refs/channels/confluence.md +11 -0
- package/pipeline/multi-agent-refs/channels/issue-comment.md +12 -0
- package/pipeline/multi-agent-refs/channels/jira.md +10 -0
- package/pipeline/multi-agent-refs/channels/pr-review-actions.md +13 -0
- package/pipeline/multi-agent-refs/channels/pr.md +37 -0
- package/pipeline/multi-agent-refs/component-dispatch.md +11 -0
- package/pipeline/multi-agent-refs/component-generation.md +11 -0
- package/pipeline/multi-agent-refs/conventions-defaults.md +15 -0
- package/pipeline/multi-agent-refs/cross-cli-contract.md +65 -0
- package/pipeline/multi-agent-refs/features/analysis-jira.md +11 -0
- package/pipeline/multi-agent-refs/features/code-graph.md +40 -0
- package/pipeline/multi-agent-refs/features/design-conformance.md +24 -0
- package/pipeline/multi-agent-refs/features/doctor.md +10 -0
- package/pipeline/multi-agent-refs/features/external-context-injection.md +7 -0
- package/pipeline/multi-agent-refs/features/jira-context.md +9 -0
- package/pipeline/multi-agent-refs/features/model-fallback.md +10 -0
- package/pipeline/multi-agent-refs/features/review-file-set.md +132 -0
- package/pipeline/multi-agent-refs/features/skill-conformance.md +13 -0
- package/pipeline/multi-agent-refs/features/url-enrichment.md +9 -0
- package/pipeline/multi-agent-refs/features/visual-evidence.md +42 -0
- package/pipeline/multi-agent-refs/generate-issue.md +7 -0
- package/pipeline/multi-agent-refs/issue-jira-triad.md +9 -0
- package/pipeline/multi-agent-refs/knowledge.md +6 -0
- package/pipeline/multi-agent-refs/multi-repo-integration-build.md +13 -0
- package/pipeline/multi-agent-refs/phases/modes.md +7 -0
- package/pipeline/multi-agent-refs/phases/operations.md +9 -0
- package/pipeline/multi-agent-refs/phases/phase-0-init.md +1 -1
- package/pipeline/multi-agent-refs/phases/phase-4-review.md +31 -23
- package/pipeline/multi-agent-refs/phases.md +11 -0
- package/pipeline/multi-agent-refs/picker-contract.md +12 -0
- package/pipeline/multi-agent-refs/platform-parity.md +10 -0
- package/pipeline/multi-agent-refs/progress-contract.md +10 -0
- package/pipeline/multi-agent-refs/setup/firebase.md +9 -0
- package/pipeline/multi-agent-refs/swiftui-guide.md +17 -0
- package/pipeline/multi-agent-refs/tracker-contract.md +12 -0
- package/pipeline/multi-agent-refs/web-guide.md +10 -0
- package/pipeline/multi-agent-refs/wiki-capture.md +11 -0
- package/pipeline/schemas/prefs.schema.json +4 -0
- package/pipeline/schemas/review-file-exclusions.json +137 -0
- package/pipeline/schemas/reviewer-output.schema.json +27 -1
- package/pipeline/schemas/token-budget.json +10 -19
- package/pipeline/scripts/autopilot-intake.mjs +5 -1
- package/pipeline/scripts/autopilot-runner.mjs +6 -1
- package/pipeline/scripts/autopilot-status.sh +3 -2
- package/pipeline/scripts/capture-evidence.sh +79 -11
- package/pipeline/scripts/diff-risk-score.mjs +1 -36
- package/pipeline/scripts/gen-ref-toc.mjs +279 -0
- package/pipeline/scripts/git-path.mjs +63 -0
- package/pipeline/scripts/glob-match.mjs +62 -0
- package/pipeline/scripts/graph-mermaid.mjs +251 -0
- package/pipeline/scripts/review-file-filter.mjs +180 -0
- package/pipeline/scripts/skill-conformance.mjs +1 -31
- package/pipeline/scripts/validate-analysis-doc.mjs +53 -0
- package/pipeline/scripts/validate-reviewer.mjs +90 -1
- package/pipeline/scripts/verify-citations.mjs +346 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
3
|
"$id": "https://github.com/mmerterden/multi-agent-pipeline/pipeline/schemas/reviewer-output.schema.json",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.3.0",
|
|
5
5
|
"title": "Multi-Agent Pipeline - Phase 4 reviewer output",
|
|
6
6
|
"description": "Contract for a single code-reviewer subagent's JSON output in Phase 4 Step 2. Every host dispatches 3 parallel reviewers; the middle slot is CLI-aware: Claude Code (Fable, Opus, Sonnet); Copilot CLI (Opus, GPT-5.4, Sonnet); Codex CLI dispatches 3 (gpt-5.6 at xhigh, gpt-5.4, gpt-5.6 at medium). Every reviewer must return an object matching this shape before Opus triage merges them. v1.1.0 adds the rule-ID conformance checklist: when the orchestrator supplies a ${CRITERIA} block (Phase 4 Step 1.78), the reviewer must return one conformance row per selected rule ID. Findings alone cannot answer 'was this applied completely' - a reviewer that opened nothing returns the same empty findings array as one that checked everything. v1.2.0 adds the optional per-finding fingerprint (Phase 4 Step 2.1): the stable id a finding keeps across review rounds.",
|
|
7
7
|
"type": "object",
|
|
@@ -55,6 +55,32 @@
|
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
+
},
|
|
59
|
+
"fileCoverage": {
|
|
60
|
+
"type": "array",
|
|
61
|
+
"description": "One row per file in the supplied review denominator, and none outside it. Required whenever a denominator was supplied. The set is computed by review-file-filter.mjs and written to disk BEFORE the reviewer runs, for the same reason selectedRules[] is: after seeing the diff, 'I did not look at that one' and 'there was nothing there' become the same sentence. An empty findings[] from a reviewer that skipped nine of ten files is not a clean review.",
|
|
62
|
+
"items": {
|
|
63
|
+
"type": "object",
|
|
64
|
+
"additionalProperties": false,
|
|
65
|
+
"required": ["path", "verdict"],
|
|
66
|
+
"properties": {
|
|
67
|
+
"path": {
|
|
68
|
+
"type": "string",
|
|
69
|
+
"minLength": 1,
|
|
70
|
+
"description": "Must appear in the supplied denominator, byte for byte."
|
|
71
|
+
},
|
|
72
|
+
"verdict": {
|
|
73
|
+
"type": "string",
|
|
74
|
+
"enum": ["reviewed", "skipped"],
|
|
75
|
+
"description": "reviewed = read in full. skipped = not read, and the reason says why. There is deliberately no 'partial': a file read in part is read, and what was not understood belongs in a finding."
|
|
76
|
+
},
|
|
77
|
+
"reason": {
|
|
78
|
+
"type": "string",
|
|
79
|
+
"minLength": 4,
|
|
80
|
+
"description": "Required when verdict is 'skipped'. Names why the file was not read (too large for the budget, truncated by the diff cap, binary content). 'Not relevant' is a review decision, not a skip reason."
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
58
84
|
}
|
|
59
85
|
},
|
|
60
86
|
"$defs": {
|
|
@@ -1,41 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
3
|
"$id": "https://github.com/mmerterden/multi-agent-pipeline/pipeline/schemas/token-budget.json",
|
|
4
|
-
"description": "Per-phase token
|
|
4
|
+
"description": "Per-phase token ceilings for the lazy-loaded pipeline docs, enforced by smoke-token-budget.sh. Only the ACTIVE phase is loaded at run time and nothing truncates a phase document, so these numbers govern what may be written, not what a run receives. Two rules, and the split is the point. `max_tokens` and `total_max_tokens` are committed constants a human owns: computing them would end the gate, because a ceiling that is always current x k can never fail. The warn tier is NOT stored - the gate derives it per phase from that phase's own git history (median + 3*MAD of its historical per-commit deltas, which is robust to the one 980-token release that makes sigma meaningless on phase-4), because a soft line maintained by hand rots, and this one rotted twice: it was reset at v13.6.0 when five lines had gone permanently amber, and six of eight were amber again by v17.1.0. A ceiling more than 25% above the measurement is stale and fails, which is the 'only ratchets down' rule the SKILL.md grace list always had and this budget never did. Change history: docs/token-budget-history.md.",
|
|
5
5
|
"phases": {
|
|
6
6
|
"phase-0-init": {
|
|
7
|
-
"max_tokens": 13100
|
|
8
|
-
"warn_tokens": 12400
|
|
7
|
+
"max_tokens": 13100
|
|
9
8
|
},
|
|
10
9
|
"phase-1-analysis": {
|
|
11
|
-
"max_tokens": 4600
|
|
12
|
-
"warn_tokens": 4050
|
|
10
|
+
"max_tokens": 4600
|
|
13
11
|
},
|
|
14
12
|
"phase-2-planning": {
|
|
15
|
-
"max_tokens": 6500
|
|
16
|
-
"warn_tokens": 5650
|
|
13
|
+
"max_tokens": 6500
|
|
17
14
|
},
|
|
18
15
|
"phase-3-dev": {
|
|
19
|
-
"max_tokens": 9300
|
|
20
|
-
"warn_tokens": 8600
|
|
16
|
+
"max_tokens": 9300
|
|
21
17
|
},
|
|
22
18
|
"phase-4-review": {
|
|
23
|
-
"max_tokens": 15150
|
|
24
|
-
"warn_tokens": 12950
|
|
19
|
+
"max_tokens": 15150
|
|
25
20
|
},
|
|
26
21
|
"phase-5-test": {
|
|
27
|
-
"max_tokens": 3050
|
|
28
|
-
"warn_tokens": 2850
|
|
22
|
+
"max_tokens": 3050
|
|
29
23
|
},
|
|
30
24
|
"phase-6-commit": {
|
|
31
|
-
"max_tokens": 6550
|
|
32
|
-
"warn_tokens": 6100
|
|
25
|
+
"max_tokens": 6550
|
|
33
26
|
},
|
|
34
27
|
"phase-7-report": {
|
|
35
|
-
"max_tokens": 6350
|
|
36
|
-
"warn_tokens": 5600
|
|
28
|
+
"max_tokens": 6350
|
|
37
29
|
}
|
|
38
30
|
},
|
|
39
|
-
"total_max_tokens": 62700
|
|
40
|
-
"note": "Token estimate = ceil(chars / 4). Per-phase budget rule: warn = current+10% (rounded to nearest 50), max = current+25%. Gives ~6 edit cycles of headroom before warn trips - intentionally quiet under normal maintenance, loud when a phase grows unusually. Only the active phase is loaded (lazy). Recalibrated at v10.0.0 after the validator/consistency/simplifier/lesson gate contracts landed in phases 1-4. Recalibrated again at v10.9.0 after the verify-by-test (Phase 4 Step 3.7), update-check (Phase 0 Step 0.6), immutable-test (Phase 3 GREEN) and redTests re-entry contracts landed - Step 3.7 prose was compressed to a pointer into refs/features/verify-by-test.md before the recalibration. Total bumped 50000 -> 51000 at v12.5.0 after the worktree residue/traversal-prune contract (Phase 0 + Phase 5 heal) and the Reflexion causal-diagnosis contract (Phase 4 lesson memory) landed; the prose was compressed first (161 tokens reclaimed) and every per-phase max still passes - only the aggregate needed room. Recalibrated again at v13.6.0 after the install-relative path correction: an instruction that names `pipeline/scripts/x` resolves only from a repo checkout, and a run happens in the user's worktree, so 157 references across these docs moved to `$HOME/.claude/...` at +5 bytes each - 196 tokens of pure correctness cost. Same discipline as before: prose was compressed FIRST (149 tokens reclaimed, by pointing Phase 1's Figma tier table at the Phase 0 probe that already resolved it and Phase 4's Codex constraints at the always-loaded AGENTS.md block), and only then were the budgets moved. Five warn lines had been permanently amber, which makes the amber tier useless as a signal, so every warn was reset to the documented current+10% and the four maxes that the new warn would have collided with were reset to current+25%. Aggregate 51000 -> 51500. Total bumped 51500 -> 52200 at v14.0.0 after Phase 4 Review entered the four --dev mode phase sets and the criteria-resolution contract (Step 1.78) landed. Same discipline as every prior bump: prose was compressed FIRST, 820 tokens reclaimed, before the number moved. Two of those compressions are structural rather than cosmetic - the hardcoded SwiftUI interaction list in Step 1.5 and the SwiftUI convention paragraph in Step 2.8 were transcriptions of rules that now live in a scoped registry, so keeping them here would have re-created the drift this release exists to remove, and the third moved the Step 1.78 full contract into refs/features/skill-conformance.md leaving a pointer. What remains is contract text that cannot be inferred: the manifest's four consumer-visible parts, the conformance checklist the reviewers must return, and the fail-closed semantics. Every per-phase max still passes (phase-4 12405/14750); only the aggregate needed room. Total bumped 52200 -> 52700 at v14.1.0 after two more contracts landed: stack skill routing (Phase 3 pre-flight step 9) and worktree finalize (Phase 6 step 9). Compression came first, as always, and twice: 224 tokens out of Phase 3 by pointing its criteria-ledger and routing steps at their feature files instead of restating them, and 190 out of Phase 6 by moving the finalize contract into refs/features/worktree-finalize.md and leaving the invocation plus the exit-3 semantics. Both new contracts follow the pattern the earlier ones set: the phase doc carries the call and the decision, the feature file carries the reasoning, and the feature files are outside this budget because it loops only the eight phase-N-* keys. Every per-phase max still passes (phase-3 7677/8950, phase-6 5223/6150 and both under warn); only the aggregate needed room. Total bumped 52700 -> 52750 for the Phase 0 Step 3 branch-persistence correction: the step wrote the legacy `projects[].branches` while the TTL filter two sections below read `global.recentBranches`, and both spots named a `{name, lastUsed}` shape the schema rejects (`branch` required, `additionalProperties: false`), so the recent-branch picker option could never populate and a literal implementation would have failed prefs validation. Naming the right target, the right key and the legacy field to avoid costs 41 tokens over the one line it replaces. Compression came first and was applied three times to the replacement text itself, from 120 tokens down to 66, by moving the rationale out of the phase doc entirely: the reasoning now lives where it is enforced, in the migrate-prefs carry-forward comment and the smoke-pref-migration f7 block, leaving the phase doc with only the instruction. 50 was the smallest step that clears it; phase-0-init sits at 10893/12400, far under its own max, so this is purely an aggregate ceiling. v15.0.0: total 52750 -> 53100, the stack-skill tables in phase-1/2/4 now carry plugin-namespaced names (ai-<stack>-toolkit:<skill>) - functional prefixes, ~170 tokens. v15.10.0: total 53350 -> 53950 for the memory-recall + context-offload contracts (Phase 1 two-block durable-knowledge injection and its telemetry, Phase 3 build-log offload pipe, Phase 4 ranked prior art, offload pipe and recall telemetry). Compression came first and twice, taking the new prose from 1168 tokens to 580: the reasoning behind the two blocks lives in multi-agent-refs/prompt-assembly.md and the reasoning behind the offload filter lives in the offload-ref.sh header, both outside this budget, so the phase docs carry only the call, the pref that gates it and the one fact an agent cannot infer - that the evidence gate still reads the whole build log, so offloading changes what is read, never what counts as a verified pass. Every per-phase max still passes (phase-3 7985/8950, phase-4 12997/14750); phase-3 and phase-4 crossed their warn lines and are left amber on purpose, because that is the signal that those two docs are the next ones needing structural compression rather than another bump. v15.13.0: total 53950 -> 54050 for the prefs-to-flag bridges. Five settings had shipped declared-but-inert: contextOffload.minLines and .tailLines (fixed in 15.11.0), learningsLedger.maxBriefEntries, and testGap.scanTree and .promoteSeverity - the last two declared in the schema AND implemented as flags in the scanner, with nothing in between reading the pref and passing the flag. Wiring three of them costs the phase docs 94 tokens, which is the wiring itself and not prose: two `--max` substitutions and a three-line GAP_FLAGS block. Compression came first and twice, as always: the rationale that would have sat in phase-5 now lives in the header of smoke-prefs-consumed.sh, the gate that makes this class fail a build instead of shipping, and a `--severity-promote` table row was dropped because the invocation above it now shows the flag and names the pref that triggers it, which the row did not. 100 was the smallest step that clears it. Every per-phase max still passes; phase-3 and phase-4 remain amber on purpose. v15.14.0: total 54050 -> 54400 for the supported-version gate. Phase 0 Step 0.6 stopped being purely advisory: a release can now publish an npm dist-tag `required` that names the oldest runnable version, and below it the run halts instead of nagging. What the phase doc has to carry is the part an agent cannot infer - the third stdout field, that the halt is identical in autopilot, and that the run must NOT continue on the freshly updated install because its docs were already loaded from the old version. Compression came first, as always, and took the new prose from 469 tokens to 337: the rationale for the floor, the exemption list, the fail-open rules and the `npm dist-tag add` recipe all moved to multi-agent-refs/rules.md \"Supported Version Gate\" (loaded by 25 commands, outside this budget) and to the header of require-supported-version.sh, leaving the phase doc with the call, the decision table and the halt. 350 was the smallest step that clears it. Every per-phase max still passes (phase-0-init 11230/12400); phase-3 and phase-4 remain amber on purpose. v15.17.0: total 54400 -> 54900 for the Phase 1 analysis-document step. Phase 2 and Phase 3 pre-flights had BLOCKED on `analysis/<feature>-<platform>.md` since v9.0.0 while nothing produced it, so a full run either aborted at Phase 2 or the model ignored its own BLOCKING contract; Step 4 is the producer. What the phase doc carries is only what cannot be inferred: the when-table (taskType x Figma reference), the four refs in load order, the two artefacts, and that the doc validator fails closed. Compression came first and took the step from 745 tokens to 497: the history of why the gap existed moved to the CHANGELOG, the per-ref one-line descriptions moved into the refs' own headers, and the autopilot carve-out collapsed to one clause. The 17.4k-token analysis engine itself is NOT in this budget - it moved out of commands/ into multi-agent-refs/analysis/{locked,evidence,synthesis,render}.md, loaded on demand, which also took analysis/SKILL.md from 18081 to 5974 tokens and retired its lint grace entry. 500 was the smallest step that clears it; phase-1-analysis sits at 4338/4600 and is amber on purpose, like phase-3 and phase-4. v15.18.0: total 54900 -> 55250 for analysis mode. Three phase docs gained a mode branch that cannot be inferred: Phase 4 reviews a document instead of a diff (validator, the one question reviewers answer, the open-question walk), and Phase 6 publishes instead of committing. Compression came first and was applied twice to the new prose and once to old: the Phase 4 branch went from 320 tokens to 180 and the Phase 6 branch from 190 to 120 by pointing at multi-agent-refs/analysis/{resolve,render}.md, which now hold the walks themselves, and the front-matter parse contract stopped being spelled out in both pre-flights. The analysis engine keeps leaving this budget rather than entering it: intake joined locked/evidence/synthesis/render/resolve in multi-agent-refs/analysis/, which is what let analysis/SKILL.md drop under the 6000 hard cap after its grace entry was retired. 350 was the smallest step that clears it; phase-4 and phase-6 are amber on purpose, as phase-1 and phase-3 already were. v15.20.0: total 55250 -> 55500 for the TDD bridge. Phase 3 pre-flight read the analysis doc's concept table and even said test method names come from it, while nothing read Section 15 - so the RED step invented tests and the analysis test matrix never reached development. Phase 3 step 5b now loads it into state.dev.testPlan[] and Phase 4 step 1.45 cross-checks every planned row against a real test, which is what turns \"analysis quality is output quality\" from a slogan into a finding. Compression came first on both blocks, 300 tokens down to 175, by dropping the enumerated failure modes to one line each and the rationale to one clause; the reasoning lives in the CHANGELOG. 250 was the smallest step that clears it. v15.21.0: total 55500 -> 55800 for the post-analysis confirmation. Phase 2 gained Step 0.9, the last human checkpoint before Phase 3: derived values are shown for confirmation and only Section 20 rows are asked, through the resolve engine that already exists in refs. It belongs here rather than Phase 4 because Phase 4 runs after development, where an answer arrives too late to change anything. Compression came first and twice, 430 tokens down to 250, by collapsing the derived-vs-asked explanation to one sentence each and moving the walk itself to multi-agent-refs/analysis/resolve.md, which Phase 4 and analysis-resolve already mount. 300 was the smallest step that clears it. v15.22.0: total 55800 -> 55900 for the analyst-toolkit hooks. Phase 1 Step 4 now names the two prefs that decide whether a document is produced at all and how deep it goes (forceFull, mode) - the first of those had shipped declared-but-inert and smoke-prefs-consumed caught it - and Phase 4 triage gained one clause: a finding that blames a third-party library asks evidence-github whether it is already open upstream, which turns it into a deferred item with a citation instead of Phase 3 rework on code that is not ours. Compression came first and three times, taking the new prose from 220 tokens to 110, and the Phase 1d evidence contract itself never entered this budget - it lives in multi-agent-refs/analysis/evidence.md beside the phases it belongs to. 100 was the smallest step that clears it, leaving 34 tokens of headroom. phase-4 stays amber and the debt named at v15.10.0 stands: it is the doc that needs structural compression rather than another bump, and the two candidates are the inline triage JSON shape and the 3.4 telemetry block, both of which restate something already authoritative elsewhere. v16.0.0: total 55900 -> 56350 for the depth picker. `--dev` and the four dev-* commands are gone; depth is Phase 0 Step 7.5, which costs phase-0-init a step it did not have. Compression came first and three times, taking the step from 530 tokens to 300: the question wording, the per-taskType recommendation and the mode tables all live in phases/modes.md (outside this budget), so the phase doc carries only what an agent cannot infer - that the step runs after Step 7 and why, who is exempt, that ASK_CHOICE_DEFAULT must be passed explicitly because ask-choice.sh takes the FIRST option on a non-TTY, and that Short flips the Phase 1/2 tiles late rather than pre-marking them. The phase-4 telemetry block named as compression debt at v15.22.0 was collapsed to an emit() helper (-27) and the four dev-* mode files left the tree entirely, but neither offsets a genuinely new phase step. 450 was the smallest step that clears it, leaving 119 tokens of headroom. phase-4 remains amber and its other named candidate, the inline triage JSON shape, was left alone on purpose: it is the prompt the triage agent is handed, not a restatement for readers. v16.2.0: total 56350 -> 56600 for the spec-freshness and reuse-tag contracts. Phase 3 step 3 had compared `state.run.lastAnalysisDigest` since it was written, against a key nothing ever set and that the state schema did not declare, so the staleness branch was unreachable and every run reported fresh by default. Phase 1 now persists the digest and a `base_commit` anchor, and step 3 gained the repo-drift half the digest cannot see: a reused document keeps a matching digest precisely because its evidence inputs did not change, while the code underneath it moved. The second contract is the Section 14 tag reaching development: Phase 2 carries it onto the todo as `sourceTag` and Phase 3 treats it as an instruction, which is what stops a Reuse row from being re-implemented. Compression came first and took the four additions from 380 tokens to 214, by moving every rationale clause out of the phase docs: why the commit anchor exists rather than a digest recomputation lives in this note and the CHANGELOG, and the schema descriptions carry the field semantics. The baseline had 9 tokens of headroom, so no addition of any size could have fit without a bump. 250 was the smallest step that clears it, leaving 45 tokens. phase-3 and phase-4 remain amber. v16.13.0: total 57600 -> 57700 for the code-graph injection and the fable-rung switch. Phase 1 gained Step 2.6 (query the graph, hand Explore a ranked starting set), Phase 7 gained the post-branch graph refresh, and Phase 0 Step 0 gained one line: a prefs switch that resolves every preferredModel: fable persona to opus for the run, which also collapses the Phase 4 Claude Code panel from three reviewers to two. Compression came first and mostly structurally: of roughly 1,630 tokens of new contract text, 1,310 never entered this budget at all - the whole code-graph contract lives in multi-agent-refs/features/code-graph.md (604) and the fable switch's scope table, per-host effects and cost-accounting consequence live in features/model-fallback.md (+707), leaving the phase docs with the call, the pref that gates it and the one fact an agent cannot infer. Phase 4 was compressed on top of that: its TLDR restated the reviewer matrix 270 lines below it, so 36 tokens came back and the doc nets +6 despite carrying two new clauses. One of those clauses is a correction rather than a feature - the consensus rule still said reviewerCount is 2 on Claude Code, which stopped being true when the third reviewer landed in 16.12.0, and the cross-CLI smoke never caught it because it reads the matrix line instead. 100 was the smallest step that clears it, leaving 54 tokens. phase-3 and phase-4 remain amber. v16.17.0: total 57700 -> 57850 for the platform-parity cross-check. Phase 4 gained Step 1.8: when dev-context carries a counterpart app repo, the review compares the change against the other platform on four axes. Compression came first and structurally, as always - of roughly 1,610 tokens of new contract text, 1,490 never entered this budget at all, because the four axes, the file cap, the graph-query recipe, the read-only prohibitions and the rule that an extractor miss may not be reported as an absence all live in multi-agent-refs/platform-parity.md. The step itself was then cut from ~200 tokens to 120 by deleting everything the ref already owns, leaving the trigger, the pointer and the two facts an agent must not infer: the counterpart repo is read-only, and parity findings are never blocking. The baseline had 13 tokens of headroom, so no addition of any size could have fit without a bump. 150 was the smallest step that clears it, leaving 35 tokens. phase-3 and phase-4 remain amber, and phase-4's structural-compression debt still stands. v16.20.0: phase-4-review max 14750 -> 15150 and total 58250 -> 60250 for the cross-round review delta, the scope self-check handoff and the circuit-breaker wiring. Compression came first and structurally: of roughly 3,900 tokens of new contract text, 2,700 never entered this budget at all - the previous-round-findings block, the scope-self-check block, the Step 3.8 state merge, telemetry and picker wording live in multi-agent-refs/features/review-delta.md, and the scope-check record rules and consumers in features/scope-check.md - so the phase docs carry the call, the pref that gates it and the exit table. The Phase 3 stability rule and the trigger-3 write were cut twice more before the bump; phase-3 stays under its max (8692/8950). Phase 4 is the first per-phase max raised since v10.9.0: the doc gained three steps that cannot be inferred (a per-round triage file, a prefix block that changes what reviewers report, and a halt condition), and its structural-compression debt (the inline triage JSON shape, named at v15.10.0) still stands and is the next candidate. 15150 and 60250 were the smallest steps that clear it, leaving 25 and 45 tokens. v16.23.0: phase-0-init max 12400 -> 12500 and total 60250 -> 60500 for the widget-registration call and the accounting gate. Phase 0 gained the `tiles` call and the exit-3 rule, Phase 7 gained the run report; together they are contract an agent cannot infer - which call registers this host's widget, and that a completion is refused without recorded spend. Compression came first and twice, taking the new prose from 472 tokens to 255: the per-host call list moved into tracker-contract.md \"The card is not the widget\" and the record-then-rerun recovery into \"Accounting is a gate\", both outside this budget, leaving the phase docs with the call and the one fact that cannot be looked up. 100 and 250 were the smallest steps that clear it, leaving 74 and 40 tokens. phase-3 and phase-4 remain amber. v16.24.0: total 60500 -> 60750 for visual evidence. Four phase docs gained one instruction each that cannot be inferred: Phase 0 keeps the issue's own images as the pre-fix evidence, Phase 3 captures the fixed state (there and not Phase 5, because every autopilot and --local entry drops Phase 5), Phase 5 hosts the flow recording when it runs, and Phase 6 blocks on a required artefact that is neither attached nor explained. Compression came first and twice, 42 tokens back, and the contract itself never entered this budget: the trigger matrix, the three video tiers, the size-degradation ladder and both render shapes live in multi-agent-refs/features/visual-evidence.md. phase-0-init cleared its own max without a bump. 250 was the smallest step that clears the aggregate. phase-3 and phase-4 remain amber. v17.0.0: phase-0-init max 13000 -> 13100 and total 62400 -> 62500 for the evidence-verdict writer. Phase 0 Step 7.7 probed with `--platform \"$PLATFORM\"`, a variable no phase document ever assigned, and it was gated on `visualEvidence.required`, which no phase document ever wrote - five readers, zero writers - so the step, Phase 3's capture and Phase 6's blocker were all unreachable and the pipeline reported nothing wrong. The step now writes the verdict and derives the platform from the stack, skipping the probe with a recorded reason when there is no device platform rather than passing the empty string the probe refuses with exit 2. Compression came first and three times, 30 tokens back from the Step 7.7 index rule that restated Step 7.5 verbatim and 55 from the new block itself; the reasoning never entered this budget, because who writes the verdict and how the platform is derived live in features/visual-evidence.md sections 1a and 1b. phase-3-dev max 9250 -> 9300 in the same change: it reads the platform back from state and re-decides the provisional verdict before capturing, which is the half of the fix that makes Phase 3 honest rather than merely reachable. Compressed three times first, 29 tokens back, by pointing its Phase-5 rationale and its tier mapping at visual-evidence.md sections 3 and 4.3 where both already live. 100, 50 and 150 were the smallest steps that clear it, leaving 24, 15 and 26 tokens. phase-3 and phase-4 remain amber. v17.1.0: total 62550 -> 62600 for the Figma/toolkit MCP distinction and web as an evidence platform. Three phase docs said \"MCP forbidden\" without qualifying it, while the gate that enforces it (smoke-no-mcp-in-dev-phases.sh) has always matched `figma` and nothing else - so the prose banned the screenshot, xcodebuild and UI-test tools that Phase 3 Steps 3.4 and 3.55 actually call, which is one way a run reaches Phase 7 with no evidence. Phase 0 gained one `web` arm in the platform derivation, now that run-ui-tests.sh has a web arm to derive it for. Compression came first and three times, taking the new prose from 175 tokens to 30: the reasoning moved to rules.md, whose own seven-row Figma phase matrix was deleted in the same pass because it duplicated rules/figma-pipeline.md \"Phase access matrix\" two paragraphs below this file's own instruction not to duplicate that rule file - 74 tokens back there, which is why phase-3-dev cleared its max without a bump (9298/9300). 50 was the smallest step that clears the aggregate, leaving 37 tokens. phase-3 and phase-4 remain amber. v17.1.0 (2): total 62600 -> 62700 for the plan reaching the task widget. Phase 2 computed tasks[], their order and their dependsOn[] edges, stored them, and used them to drive Phase 3's ready-task picker - and none of it was visible on the surface the user actually watches; the card had drawn sub-phases for releases, the widget never had. Phase 2 gains one call. Compression came first and twice: the tasks[]-to-todos[] jq blob left the phase doc for plan-todos.sh `set`, which now accepts a planning-output document directly (-28, and it removes a mapping two files defined, of which this was the untested copy), and the new step's own prose was cut from 116 tokens to 61. The parsing of the plan itself never entered this budget - it lives in phase-tracker.sh `plan`, which owns the sub-phase structure it writes. 100 was the smallest step that clears it, leaving 75 tokens. phase-3 and phase-4 remain amber."
|
|
31
|
+
"total_max_tokens": 62700
|
|
41
32
|
}
|
|
@@ -264,7 +264,11 @@ function fetchJira(repo) {
|
|
|
264
264
|
// One helper owns Jira search: URL encoding and JQL injection are already
|
|
265
265
|
// solved there, and a second copy here would be a second place to get them
|
|
266
266
|
// wrong. It prints one JSON document on stdout.
|
|
267
|
-
|
|
267
|
+
// Beside this file, for the same reason the runner resolves its siblings that
|
|
268
|
+
// way: on a Codex-only or Copilot-only host the literal ~/.claude/scripts does
|
|
269
|
+
// not exist, and the guard below turns that into an EMPTY Jira intake with no
|
|
270
|
+
// error - the silent shape, not the loud one.
|
|
271
|
+
const helper = join(import.meta.dirname, "jira-search.sh");
|
|
268
272
|
if (!existsSync(helper)) return [];
|
|
269
273
|
const out = sh("bash", [helper, "--jql", jql, "--fields", "key,summary,priority,created"]);
|
|
270
274
|
let rows;
|
|
@@ -54,7 +54,12 @@ import { homedir } from "node:os";
|
|
|
54
54
|
import { randomUUID } from "node:crypto";
|
|
55
55
|
|
|
56
56
|
const ROOT = process.env.MA_AUTOPILOT_ROOT || join(homedir(), ".claude", "autopilot");
|
|
57
|
-
|
|
57
|
+
// Siblings resolve from THIS file's own directory, not from ~/.claude/scripts.
|
|
58
|
+
// All five autopilot scripts install into whichever host tree took them, so a
|
|
59
|
+
// runner living in ~/.codex/scripts must find the intake beside it - naming one
|
|
60
|
+
// host's path means a Codex-only or Copilot-only tick finds nothing and does
|
|
61
|
+
// nothing, with no error anywhere. smoke-autopilot-hosts.sh covers this.
|
|
62
|
+
const SCRIPTS = process.env.MA_AP_SCRIPTS || import.meta.dirname;
|
|
58
63
|
const CLAUDE_BIN = process.env.MA_AP_CLAUDE_BIN || "claude";
|
|
59
64
|
const DRY = process.argv.includes("--dry-run");
|
|
60
65
|
|
|
@@ -62,8 +62,9 @@ BLOCKED=$(printf '%s' "$QUEUE" | jq -r '.blockedReason // empty' 2>/dev/null)
|
|
|
62
62
|
# the terminal, the menu bar and the runner cannot disagree about whether the
|
|
63
63
|
# queue is allowed to take an item.
|
|
64
64
|
ARM='{}'
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
ARMING=$(ma_ap_asset scripts/autopilot-arming.mjs 2>/dev/null || true)
|
|
66
|
+
if [ "$CONFIGURED" = true ] && [ -n "$ARMING" ]; then
|
|
67
|
+
ARM=$(node "$ARMING" check --json 2>/dev/null || echo '{}')
|
|
67
68
|
fi
|
|
68
69
|
SPEND=$(printf '%s' "$ARM" | jq -r '.spend.usd // 0' 2>/dev/null || echo 0)
|
|
69
70
|
CEILING_USD=$(printf '%s' "$ARM" | jq -r '.ceiling // 0' 2>/dev/null || echo 0)
|
|
@@ -38,20 +38,24 @@ MODE="${1:-}"; shift 2>/dev/null || true
|
|
|
38
38
|
EVIDENCE_DIR="${EVIDENCE_DIR:-$PWD/.pipeline/evidence}"
|
|
39
39
|
PREFS="$HOME/.claude/multi-agent-preferences.json"
|
|
40
40
|
|
|
41
|
-
# Reads visualEvidence.enabled,
|
|
42
|
-
#
|
|
43
|
-
#
|
|
41
|
+
# Reads visualEvidence.enabled, .maxAttachmentMb, .maxVideoSeconds and
|
|
42
|
+
# .webBaseUrl. One node call: separate ones cost a process start each on every
|
|
43
|
+
# phase boundary. webBaseUrl is shell-quoted because it is the only value here
|
|
44
|
+
# that is free text a user typed.
|
|
44
45
|
prefs_visual() {
|
|
45
46
|
node -e '
|
|
46
47
|
const fs=require("fs");
|
|
47
48
|
let v={};
|
|
48
49
|
try{v=((JSON.parse(fs.readFileSync(process.argv[1],"utf8")).global||{}).visualEvidence)||{}}catch{}
|
|
49
50
|
const num=(x,d)=>Number.isFinite(x)&&x>0?x:d;
|
|
51
|
+
const Q=String.fromCharCode(39);
|
|
52
|
+
const q=(x)=>String(x==null?"":x).split(Q).join(Q+"\\"+Q+Q);
|
|
50
53
|
process.stdout.write(
|
|
51
54
|
"VISUAL_EVIDENCE_ENABLED="+(v.enabled===false?"false":"true")+"\n"+
|
|
52
55
|
"MAX_ATTACHMENT_MB="+num(v.maxAttachmentMb,10)+"\n"+
|
|
53
|
-
"MAX_VIDEO_SECONDS="+num(v.maxVideoSeconds,60)+"\n"
|
|
54
|
-
|
|
56
|
+
"MAX_VIDEO_SECONDS="+num(v.maxVideoSeconds,60)+"\n"+
|
|
57
|
+
"WEB_BASE_URL="+Q+q(v.webBaseUrl)+Q+"\n");
|
|
58
|
+
' "$PREFS" 2>/dev/null || printf "VISUAL_EVIDENCE_ENABLED=true\nMAX_ATTACHMENT_MB=10\nMAX_VIDEO_SECONDS=60\nWEB_BASE_URL=''\n"
|
|
55
59
|
}
|
|
56
60
|
eval "$(prefs_visual)"
|
|
57
61
|
MAX_ATTACH_MB="${MAX_ATTACH_MB:-$MAX_ATTACHMENT_MB}"
|
|
@@ -77,17 +81,18 @@ file_bytes() {
|
|
|
77
81
|
|
|
78
82
|
case "$MODE" in
|
|
79
83
|
after)
|
|
80
|
-
TASK=""; PLATFORM=""; LABEL="screen"
|
|
84
|
+
TASK=""; PLATFORM=""; LABEL="screen"; URL=""
|
|
81
85
|
while [ "$#" -gt 0 ]; do
|
|
82
86
|
case "$1" in
|
|
83
87
|
--task) TASK="${2:-}"; shift 2 ;;
|
|
84
88
|
--platform) PLATFORM="${2:-}"; shift 2 ;;
|
|
85
89
|
--label) LABEL="${2:-screen}"; shift 2 ;;
|
|
90
|
+
--url) URL="${2:-}"; shift 2 ;;
|
|
86
91
|
*) echo "capture-evidence: unknown option $1" >&2; exit 2 ;;
|
|
87
92
|
esac
|
|
88
93
|
done
|
|
89
94
|
[ -n "$TASK" ] && [ -n "$PLATFORM" ] || {
|
|
90
|
-
echo "usage: capture-evidence.sh after --task <id> --platform <ios|android> [--label <slug>]" >&2
|
|
95
|
+
echo "usage: capture-evidence.sh after --task <id> --platform <ios|android|web> [--label <slug>] [--url <addr>]" >&2
|
|
91
96
|
exit 2
|
|
92
97
|
}
|
|
93
98
|
mkdir -p "$EVIDENCE_DIR"
|
|
@@ -112,6 +117,21 @@ case "$MODE" in
|
|
|
112
117
|
adb exec-out screencap -p > "$OUT" 2>/dev/null || { echo "capture-evidence: no attached device" >&2; exit 4; }
|
|
113
118
|
[ -s "$OUT" ] || { echo "capture-evidence: empty capture" >&2; exit 4; }
|
|
114
119
|
;;
|
|
120
|
+
web)
|
|
121
|
+
# The "device" here is the browser the test runner already drives, which
|
|
122
|
+
# is why the probe calls the runner the device for web. A URL is the one
|
|
123
|
+
# thing this platform needs and the other two do not: a simulator is
|
|
124
|
+
# already showing something, a dev server has to be pointed at.
|
|
125
|
+
[ -n "$URL" ] || URL="${WEB_BASE_URL:-}"
|
|
126
|
+
[ -n "$URL" ] || { echo "capture-evidence: no dev-server URL for the web capture (pass --url or set prefs.global.visualEvidence.webBaseUrl)" >&2; exit 4; }
|
|
127
|
+
npx --no-install playwright --version >/dev/null 2>&1 || { echo "capture-evidence: playwright is not installed in this project" >&2; exit 4; }
|
|
128
|
+
# --no-install, never a bare npx: a bare one DOWNLOADS the browser stack,
|
|
129
|
+
# turning "this project has no browser tooling" into a silent network
|
|
130
|
+
# fetch. run-ui-tests.sh carries the same rule and the same reason.
|
|
131
|
+
npx --no-install playwright screenshot --full-page --wait-for-timeout=1000 \
|
|
132
|
+
"$URL" "$OUT" >/dev/null 2>&1 || { echo "capture-evidence: playwright could not reach $URL" >&2; exit 4; }
|
|
133
|
+
[ -s "$OUT" ] || { echo "capture-evidence: empty capture" >&2; exit 4; }
|
|
134
|
+
;;
|
|
115
135
|
*) echo "capture-evidence: unsupported platform '$PLATFORM'" >&2; exit 2 ;;
|
|
116
136
|
esac
|
|
117
137
|
|
|
@@ -150,14 +170,14 @@ case "$MODE" in
|
|
|
150
170
|
esac
|
|
151
171
|
done
|
|
152
172
|
case "$ACTION" in start | stop) ;; *)
|
|
153
|
-
echo "usage: capture-evidence.sh video start|stop --task <id> --platform <ios|android> [--label <slug>]" >&2
|
|
173
|
+
echo "usage: capture-evidence.sh video start|stop --task <id> --platform <ios|android|web> [--label <slug>]" >&2
|
|
154
174
|
exit 2 ;;
|
|
155
175
|
esac
|
|
156
176
|
[ -n "$TASK" ] && [ -n "$PLATFORM" ] || {
|
|
157
|
-
echo "usage: capture-evidence.sh video start|stop --task <id> --platform <ios|android> [--label <slug>]" >&2
|
|
177
|
+
echo "usage: capture-evidence.sh video start|stop --task <id> --platform <ios|android|web> [--label <slug>]" >&2
|
|
158
178
|
exit 2
|
|
159
179
|
}
|
|
160
|
-
case "$PLATFORM" in ios | android) ;; *)
|
|
180
|
+
case "$PLATFORM" in ios | android | web) ;; *)
|
|
161
181
|
echo "capture-evidence: unsupported platform '$PLATFORM'" >&2; exit 2 ;;
|
|
162
182
|
esac
|
|
163
183
|
|
|
@@ -168,6 +188,54 @@ case "$MODE" in
|
|
|
168
188
|
WATCHFILE="$EVIDENCE_DIR/.${SLUG}.watchpid"
|
|
169
189
|
REMOTE="/sdcard/_ma_${SLUG}.mp4"
|
|
170
190
|
|
|
191
|
+
# Web does not use start/stop at all, and the reason is already written in
|
|
192
|
+
# probe-evidence-capability.sh: "the recorder IS the runner". Playwright and
|
|
193
|
+
# Cypress write the video themselves, so spawning a second recorder would
|
|
194
|
+
# record the same run twice. start marks the moment; stop harvests whatever
|
|
195
|
+
# the suite produced after that moment.
|
|
196
|
+
if [ "$PLATFORM" = "web" ]; then
|
|
197
|
+
MARKER="$EVIDENCE_DIR/.${SLUG}.webrec"
|
|
198
|
+
if [ "$ACTION" = "start" ]; then
|
|
199
|
+
date +%s > "$MARKER"
|
|
200
|
+
printf '%s\n' "$OUT"
|
|
201
|
+
exit 0
|
|
202
|
+
fi
|
|
203
|
+
[ -f "$MARKER" ] || { echo "capture-evidence: no web recording was started for $SLUG" >&2; exit 4; }
|
|
204
|
+
SINCE=$(cat "$MARKER" 2>/dev/null || echo 0)
|
|
205
|
+
rm -f "$MARKER"
|
|
206
|
+
# Both runners, newest first, and only files written after the marker: a
|
|
207
|
+
# stale video from yesterday's run attached as today's evidence is worse
|
|
208
|
+
# than no video, because nobody re-checks an artefact that is present.
|
|
209
|
+
SRC=""
|
|
210
|
+
for cand in $(find test-results cypress/videos -type f \( -name '*.webm' -o -name '*.mp4' \) 2>/dev/null); do
|
|
211
|
+
[ -f "$cand" ] || continue
|
|
212
|
+
MT=$(date -r "$cand" +%s 2>/dev/null || echo 0)
|
|
213
|
+
[ "$MT" -ge "$SINCE" ] 2>/dev/null || continue
|
|
214
|
+
if [ -z "$SRC" ]; then SRC="$cand"; else
|
|
215
|
+
PREV=$(date -r "$SRC" +%s 2>/dev/null || echo 0)
|
|
216
|
+
[ "$MT" -gt "$PREV" ] 2>/dev/null && SRC="$cand"
|
|
217
|
+
fi
|
|
218
|
+
done
|
|
219
|
+
[ -n "$SRC" ] || { echo "capture-evidence: the suite recorded no video after the marker (is video enabled in the project's runner config?)" >&2; exit 4; }
|
|
220
|
+
case "$SRC" in
|
|
221
|
+
*.webm)
|
|
222
|
+
# h264 because that is what the Jira preview and the PR body can play;
|
|
223
|
+
# the iOS arm re-encodes for the same reason and says so there too.
|
|
224
|
+
if command -v ffmpeg >/dev/null 2>&1; then
|
|
225
|
+
ffmpeg -y -i "$SRC" -c:v libx264 -preset veryfast -crf 28 -an "$OUT" >/dev/null 2>&1 \
|
|
226
|
+
|| { echo "capture-evidence: ffmpeg could not transcode $SRC" >&2; exit 4; }
|
|
227
|
+
else
|
|
228
|
+
OUT="${OUT%.mp4}.webm"
|
|
229
|
+
cp "$SRC" "$OUT"
|
|
230
|
+
echo "capture-evidence: ffmpeg unavailable, keeping webm - some viewers will not play it" >&2
|
|
231
|
+
fi
|
|
232
|
+
;;
|
|
233
|
+
*) cp "$SRC" "$OUT" ;;
|
|
234
|
+
esac
|
|
235
|
+
printf '%s\n' "$OUT"
|
|
236
|
+
exit 0
|
|
237
|
+
fi
|
|
238
|
+
|
|
171
239
|
# screenrecord's own ceiling is 180s and it is not negotiable, so a
|
|
172
240
|
# maxVideoSeconds above it would silently become 180 on Android and stay
|
|
173
241
|
# honoured on iOS - two platforms disagreeing about one preference. Clamp in
|
|
@@ -300,7 +368,7 @@ case "$MODE" in
|
|
|
300
368
|
|
|
301
369
|
BASE="${FILE%.*}"; EXT="${FILE##*.}"
|
|
302
370
|
case "$EXT" in
|
|
303
|
-
mp4|mov|m4v)
|
|
371
|
+
mp4|mov|m4v|webm)
|
|
304
372
|
# Quality down, artefact kept. 720p + a lower bitrate clears an order of
|
|
305
373
|
# magnitude; a flow video is watched for what moves, not for its pixels.
|
|
306
374
|
if command -v ffmpeg >/dev/null 2>&1; then
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
|
|
41
41
|
import { readFileSync, existsSync } from "node:fs";
|
|
42
42
|
import { execFileSync } from "node:child_process";
|
|
43
|
+
import { unquoteGitPath, unquotePathIfNeeded } from "./git-path.mjs";
|
|
43
44
|
|
|
44
45
|
const argv = process.argv.slice(2);
|
|
45
46
|
const flags = {};
|
|
@@ -171,42 +172,6 @@ const TEST_PATH_GLOBS = [
|
|
|
171
172
|
const DIFF_GIT_QUOTED_RE = /^diff --git "a\/((?:[^"\\]|\\.)*)" "b\/((?:[^"\\]|\\.)*)"$/;
|
|
172
173
|
const DIFF_GIT_UNQUOTED_RE = /^diff --git a\/(.+?) b\/(.+)$/;
|
|
173
174
|
|
|
174
|
-
// Reverse git's C-style quoting: octal byte escapes (\NNN, one per raw byte -
|
|
175
|
-
// a multi-byte UTF-8 character is several consecutive \NNN triplets) plus
|
|
176
|
-
// the standard \\ \" \t \n \r escapes.
|
|
177
|
-
function unquoteGitPath(s) {
|
|
178
|
-
const bytes = [];
|
|
179
|
-
for (let i = 0; i < s.length; i++) {
|
|
180
|
-
if (s[i] === "\\") {
|
|
181
|
-
const octal = s.slice(i + 1, i + 4);
|
|
182
|
-
if (/^[0-7]{3}$/.test(octal)) {
|
|
183
|
-
bytes.push(parseInt(octal, 8));
|
|
184
|
-
i += 3;
|
|
185
|
-
continue;
|
|
186
|
-
}
|
|
187
|
-
const simple = { "\\": 92, '"': 34, t: 9, n: 10, r: 13 };
|
|
188
|
-
const next = s[i + 1];
|
|
189
|
-
if (next in simple) {
|
|
190
|
-
bytes.push(simple[next]);
|
|
191
|
-
i += 1;
|
|
192
|
-
continue;
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
bytes.push(s.charCodeAt(i));
|
|
196
|
-
}
|
|
197
|
-
return Buffer.from(bytes).toString("utf-8");
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
// `git diff --numstat` quotes a non-ASCII/unusual path the same C-style way
|
|
201
|
-
// as the `diff --git` header line (e.g. `"\303\226deme.swift"`), just
|
|
202
|
-
// without the surrounding "diff --git a/...b/..." context to detect it by.
|
|
203
|
-
function unquotePathIfNeeded(s) {
|
|
204
|
-
if (s.length >= 2 && s[0] === '"' && s[s.length - 1] === '"') {
|
|
205
|
-
return unquoteGitPath(s.slice(1, -1));
|
|
206
|
-
}
|
|
207
|
-
return s;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
175
|
// Returns the b/-side path from a `diff --git` header line, or null if the
|
|
211
176
|
// line isn't one. Handles both the quoted and unquoted forms.
|
|
212
177
|
function matchDiffGitHeader(line) {
|