pan-wizard 3.7.10 → 3.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -2
- package/agents/pan-conductor.md +1 -2
- package/agents/pan-counterfactual.md +1 -2
- package/agents/pan-debugger.md +1 -2
- package/agents/pan-distiller.md +1 -2
- package/agents/pan-document_code.md +1 -0
- package/agents/pan-executor.md +1 -0
- package/agents/pan-experiment-runner.md +1 -2
- package/agents/pan-hardener.md +1 -2
- package/agents/pan-integration-checker.md +1 -2
- package/agents/pan-knowledge.md +1 -2
- package/agents/pan-meta-reviewer.md +1 -2
- package/agents/pan-optimizer.md +1 -0
- package/agents/pan-phase-researcher.md +1 -0
- package/agents/pan-plan-checker.md +1 -2
- package/agents/pan-planner.md +1 -0
- package/agents/pan-previewer.md +1 -2
- package/agents/pan-project-researcher.md +6 -0
- package/agents/pan-research-synthesizer.md +7 -0
- package/agents/pan-reviewer.md +2 -3
- package/agents/pan-roadmapper.md +1 -0
- package/agents/pan-verifier.md +1 -2
- package/bin/install-lib.cjs +661 -46
- package/bin/install.js +722 -116
- package/commands/pan/experiment.md +2 -0
- package/commands/pan/links.md +102 -0
- package/commands/pan/profile.md +2 -0
- package/hooks/dist/pan-cost-logger.js +22 -7
- package/package.json +5 -4
- package/pan-wizard-core/bin/lib/codebase.cjs +2 -0
- package/pan-wizard-core/bin/lib/commands-learnings.cjs +544 -0
- package/pan-wizard-core/bin/lib/commands.cjs +12 -523
- package/pan-wizard-core/bin/lib/core.cjs +69 -0
- package/pan-wizard-core/bin/lib/cost.cjs +62 -8
- package/pan-wizard-core/bin/lib/experiment.cjs +1 -0
- package/pan-wizard-core/bin/lib/git.cjs +6 -1
- package/pan-wizard-core/bin/lib/links.cjs +549 -0
- package/pan-wizard-core/bin/lib/lock.cjs +108 -0
- package/pan-wizard-core/bin/lib/milestone.cjs +3 -2
- package/pan-wizard-core/bin/lib/phase-remove.cjs +392 -0
- package/pan-wizard-core/bin/lib/phase.cjs +4 -369
- package/pan-wizard-core/bin/lib/runner.cjs +6 -0
- package/pan-wizard-core/bin/lib/state.cjs +10 -1
- package/pan-wizard-core/bin/lib/verify-deploy.cjs +181 -0
- package/pan-wizard-core/bin/lib/verify-drift.cjs +255 -0
- package/pan-wizard-core/bin/lib/verify-preflight.cjs +261 -0
- package/pan-wizard-core/bin/lib/verify-retro.cjs +177 -0
- package/pan-wizard-core/bin/lib/verify.cjs +33 -797
- package/pan-wizard-core/bin/pan-tools.cjs +35 -1
- package/pan-wizard-core/workflows/plan-phase.md +11 -0
- package/scripts/build-plugin.js +105 -0
- package/scripts/git-hooks/pre-commit +40 -0
- package/scripts/install-git-hooks.js +64 -0
- package/scripts/release-check.js +13 -2
|
@@ -105,6 +105,8 @@ Spawn the external AI runtime against the experiment folder. **Synchronous** —
|
|
|
105
105
|
|
|
106
106
|
**Runtime support:** claude / codex / gemini / opencode (via `RUNTIME_RUNNERS` adapter map in `runner.cjs`). GitHub Copilot CLI is **unsupported** for the `run` subcommand — no documented headless prompt mode. Copilot users can still scaffold and harvest manually.
|
|
107
107
|
|
|
108
|
+
**Billing note (Claude runtime):** headless `claude -p` runs bill against the **Claude Agent SDK credit pool** — a monthly allotment separate from your interactive subscription limits (Anthropic split the two effective June 15, 2026). Experiment runs do not consume interactive-session quota, but heavy experimentation can exhaust the SDK pool independently. Captured metrics are tagged `billing_pool: "agent_sdk"` so you can reconcile experiment spend separately.
|
|
109
|
+
|
|
108
110
|
### `/pan:experiment status <slug>`
|
|
109
111
|
|
|
110
112
|
Read the current `run-state.json` snapshot. Returns the full state object (`status`, `stop_reason`, `exit_code`, `elapsed_ms`, `events`).
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pan:links
|
|
3
|
+
group: Validation
|
|
4
|
+
description: Validate the doc-code link graph — inline wiki-style refs, source-comment anchors, and require-code-mention contracts (ADR-0027, v3.8.0+)
|
|
5
|
+
allowed-tools:
|
|
6
|
+
- Bash
|
|
7
|
+
- Read
|
|
8
|
+
- Grep
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# /pan:links
|
|
12
|
+
|
|
13
|
+
Validate the doc-code link graph. Walks `docs/`, `pan-wizard-core/`, `commands/`, and `agents/` for inline `[[<id>]]` references and `// @pan: <id>` source-comment anchors. Reports broken refs, stale anchors, and uncovered backlink contracts.
|
|
14
|
+
|
|
15
|
+
**Usage:**
|
|
16
|
+
```
|
|
17
|
+
/pan:links
|
|
18
|
+
/pan:links --strict
|
|
19
|
+
/pan:links --doc-root <path> [--doc-root <path>...]
|
|
20
|
+
/pan:links --source-root <path> [--source-root <path>...]
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
**Flags:**
|
|
24
|
+
- `--strict` — fail (exit 1) on warnings, not only errors. Default is advisory: warnings do not flip status.
|
|
25
|
+
- `--doc-root <path>` — override default doc roots. Repeatable.
|
|
26
|
+
- `--source-root <path>` — override default source roots. Repeatable.
|
|
27
|
+
- `--raw` — human-readable output instead of JSON.
|
|
28
|
+
|
|
29
|
+
**What it does:**
|
|
30
|
+
|
|
31
|
+
Three sequential passes share one walk pair:
|
|
32
|
+
|
|
33
|
+
1. **Forward links** — every `[[<id>]]` in body text and every `must_haves.key_links` entry must resolve. Section anchors (`[[ADR-0021#Decision]]`) check that the named heading exists.
|
|
34
|
+
2. **Backlink contract** — docs with `require-code-mention: true` in frontmatter must have at least one `@pan:` source anchor that resolves to them.
|
|
35
|
+
3. **Anchor-target existence** — every `// @pan: <id>` comment must point to a real doc.
|
|
36
|
+
|
|
37
|
+
**Doc-id forms accepted:**
|
|
38
|
+
|
|
39
|
+
- `ADR-NNNN` — resolves via glob to `docs/decisions/ADR-NNNN-*.md`
|
|
40
|
+
- `<path>.md` — exact path relative to repo root
|
|
41
|
+
- `<path>` (no extension) — tries `<path>.md` then `<path>/README.md`
|
|
42
|
+
- Any of the above with `#section` — verifies a heading whose slug matches
|
|
43
|
+
|
|
44
|
+
**Source-anchor grammar:**
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
// @pan: ADR-0027 (JS / TS / CJS)
|
|
48
|
+
# @pan: ADR-0027 (Python / shell)
|
|
49
|
+
<!-- @pan: ADR-0027 --> (Markdown / HTML)
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Anchors cluster at the top of a file under a single banner; comment leader must be the line's first non-whitespace token.
|
|
53
|
+
|
|
54
|
+
**Exit codes:**
|
|
55
|
+
|
|
56
|
+
- `0` — pass
|
|
57
|
+
- `1` — fail (errors present, or warnings present under `--strict`)
|
|
58
|
+
|
|
59
|
+
**Output (JSON):**
|
|
60
|
+
|
|
61
|
+
```json
|
|
62
|
+
{
|
|
63
|
+
"ok": true,
|
|
64
|
+
"summary": {
|
|
65
|
+
"total_findings": 0,
|
|
66
|
+
"errors": 0,
|
|
67
|
+
"warnings": 0,
|
|
68
|
+
"status": "pass",
|
|
69
|
+
"doc_files_scanned": 280,
|
|
70
|
+
"source_files_scanned": 170,
|
|
71
|
+
"anchors_found": 4,
|
|
72
|
+
"forward_links_found": 12,
|
|
73
|
+
"backlink_contracts_checked": 3
|
|
74
|
+
},
|
|
75
|
+
"findings": []
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**Finding codes:**
|
|
80
|
+
|
|
81
|
+
| Code | Severity | Meaning |
|
|
82
|
+
|---|---|---|
|
|
83
|
+
| F-001 | error | Inline `[[<id>]]` does not resolve |
|
|
84
|
+
| F-002 | error | `[[<doc>#<section>]]` resolves the file but the section is missing |
|
|
85
|
+
| F-003 | warning | `must_haves.key_links` entry's `from` or `to` does not exist |
|
|
86
|
+
| F-004 | warning | `must_haves.key_links` regex pattern is invalid |
|
|
87
|
+
| B-001 | error | Doc has `require-code-mention: true` but no `@pan:` anchors resolve to it |
|
|
88
|
+
| B-002 | warning | Doc is anchored by exactly one source file (single-source informational) |
|
|
89
|
+
| A-001 | error | `@pan:` anchor target does not resolve |
|
|
90
|
+
| A-002 | warning | `@pan:` anchor section is missing in the resolved file |
|
|
91
|
+
| A-004 | warning | `@pan:` anchor has empty id |
|
|
92
|
+
|
|
93
|
+
**Composing with `validate health`:**
|
|
94
|
+
|
|
95
|
+
`validate health --links` includes the link-graph summary as a `link_graph` field in the health report. Used as a pre-flight check before release. Errors degrade the health report to a warning-level issue (`LINKS_ERR`); non-blocking unless `--strict` is added to a separate `links validate` invocation.
|
|
96
|
+
|
|
97
|
+
**See also:**
|
|
98
|
+
|
|
99
|
+
- ADR-0027 — Doc–Code Link Graph
|
|
100
|
+
- `docs/specs/doc_code_link_graph_featureai.md` — wire-level spec
|
|
101
|
+
- `pan-tools doc-lint` — frontmatter schema validator (orthogonal concern)
|
|
102
|
+
- `pan-tools verify-key-links` — legacy frontmatter-only link verifier (subsumed; both still ship)
|
package/commands/pan/profile.md
CHANGED
|
@@ -71,4 +71,6 @@ Final tier → provider-native model name
|
|
|
71
71
|
- All rules are additive to the `quality` / `balanced` / `budget` profile you pick here — profile sets the floor, capability hints adjust upward or downward within that floor's band.
|
|
72
72
|
|
|
73
73
|
**Inspecting routing:** use `pan-tools resolve-model <agent> --metadata '{"context_estimate":900000,"needs_thinking":true}'` to see what tier a given hint set resolves to.
|
|
74
|
+
|
|
75
|
+
**Effort dimension (2026-06):** `resolve-model` also returns an `effort` level (`low`/`medium`/`high`/`xhigh`) per agent — the within-model reasoning-depth dial on current models. Profiles modulate it: `budget` steps each agent's base effort down one level (floor `low`); `quality`/`balanced` keep the base. Per-agent override: `.planning/config.json` → `"effort_overrides": { "pan-verifier": "xhigh" }`.
|
|
74
76
|
</tier_decision_tree>
|
|
@@ -37,23 +37,33 @@ function buildCostRecord(data, cwd) {
|
|
|
37
37
|
// doesn't include it in the SubagentStop payload), fall back to reading the
|
|
38
38
|
// transcript_path JSONL and summing usage across the subagent's messages.
|
|
39
39
|
// Same approach as pan-trace-logger.js for consistency.
|
|
40
|
+
//
|
|
41
|
+
// 2026-06: the SubagentStop payload carries no model id either, which left
|
|
42
|
+
// every hook record with model:null and /pan:cost unable to price it. The
|
|
43
|
+
// transcript's assistant messages carry message.model right next to the
|
|
44
|
+
// usage we already read — capture it whenever data.model is absent.
|
|
40
45
|
let inputTokens = extractNumber(data.usage, 'input_tokens');
|
|
41
46
|
let outputTokens = extractNumber(data.usage, 'output_tokens');
|
|
42
47
|
let cacheRead = extractNumber(data.usage, 'cache_read_input_tokens');
|
|
43
48
|
let cacheWrite = extractNumber(data.usage, 'cache_creation_input_tokens');
|
|
44
|
-
|
|
49
|
+
let model = typeof data.model === 'string' && data.model ? data.model : null;
|
|
50
|
+
const needUsage = (inputTokens + outputTokens + cacheRead + cacheWrite) === 0;
|
|
51
|
+
if ((needUsage || !model) && data.transcript_path) {
|
|
45
52
|
const fromTranscript = readUsageFromTranscript(data.transcript_path, data.session_id);
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
53
|
+
if (needUsage) {
|
|
54
|
+
inputTokens = fromTranscript.input_tokens;
|
|
55
|
+
outputTokens = fromTranscript.output_tokens;
|
|
56
|
+
cacheRead = fromTranscript.cache_read_input_tokens;
|
|
57
|
+
cacheWrite = fromTranscript.cache_creation_input_tokens;
|
|
58
|
+
}
|
|
59
|
+
if (!model) model = fromTranscript.model;
|
|
50
60
|
}
|
|
51
61
|
|
|
52
62
|
const record = {
|
|
53
63
|
ts: new Date().toISOString(),
|
|
54
64
|
agent: data.agent_type || data.subagent_type || null,
|
|
55
65
|
command: null,
|
|
56
|
-
model
|
|
66
|
+
model,
|
|
57
67
|
tier: null,
|
|
58
68
|
input_tokens: inputTokens,
|
|
59
69
|
output_tokens: outputTokens,
|
|
@@ -85,6 +95,7 @@ function readUsageFromTranscript(transcriptPath, sessionId) {
|
|
|
85
95
|
output_tokens: 0,
|
|
86
96
|
cache_read_input_tokens: 0,
|
|
87
97
|
cache_creation_input_tokens: 0,
|
|
98
|
+
model: null,
|
|
88
99
|
};
|
|
89
100
|
if (!transcriptPath || typeof transcriptPath !== 'string') return totals;
|
|
90
101
|
let raw;
|
|
@@ -94,6 +105,10 @@ function readUsageFromTranscript(transcriptPath, sessionId) {
|
|
|
94
105
|
let entry;
|
|
95
106
|
try { entry = JSON.parse(line); } catch { continue; }
|
|
96
107
|
if (sessionId && entry.session_id && entry.session_id !== sessionId) continue;
|
|
108
|
+
// Assistant messages carry the model id alongside their usage — keep the
|
|
109
|
+
// last one seen (mid-session model switches resolve to the final model).
|
|
110
|
+
const entryModel = entry.message?.model || entry.model || null;
|
|
111
|
+
if (typeof entryModel === 'string' && entryModel) totals.model = entryModel;
|
|
97
112
|
const usage = entry.usage
|
|
98
113
|
|| entry.message?.usage
|
|
99
114
|
|| entry.response?.usage
|
|
@@ -149,4 +164,4 @@ if (require.main === module) {
|
|
|
149
164
|
});
|
|
150
165
|
}
|
|
151
166
|
|
|
152
|
-
module.exports = { buildCostRecord, appendRecord, METRICS_DIR, TOKENS_FILE };
|
|
167
|
+
module.exports = { buildCostRecord, appendRecord, readUsageFromTranscript, METRICS_DIR, TOKENS_FILE };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pan-wizard",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.10.0",
|
|
4
4
|
"description": "A lightweight workflow automation and context engineering system for Claude Code, OpenCode, Gemini CLI, Codex, and Copilot CLI.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"pan-wizard": "bin/install.js"
|
|
@@ -50,11 +50,11 @@
|
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@playwright/test": "^1.58.2",
|
|
53
|
-
"@vscode/test-electron": "^2.5.2"
|
|
54
|
-
"esbuild": "^0.24.0"
|
|
53
|
+
"@vscode/test-electron": "^2.5.2"
|
|
55
54
|
},
|
|
56
55
|
"scripts": {
|
|
57
56
|
"build:hooks": "node scripts/build-hooks.js",
|
|
57
|
+
"prepare": "node scripts/install-git-hooks.js",
|
|
58
58
|
"release:check": "node scripts/release-check.js",
|
|
59
59
|
"prepublishOnly": "node scripts/release-check.js",
|
|
60
60
|
"test": "node --test tests/*.test.cjs",
|
|
@@ -62,6 +62,7 @@
|
|
|
62
62
|
"test:all": "node --test tests/*.test.cjs tests/scenarios/*.test.cjs",
|
|
63
63
|
"test:e2e": "node --test tests/scenarios/*.test.cjs",
|
|
64
64
|
"test:vscode": "npx playwright test --config tests/e2e/playwright.config.mjs",
|
|
65
|
-
"test:watch": "node --test --watch tests/*.test.cjs"
|
|
65
|
+
"test:watch": "node --test --watch tests/*.test.cjs",
|
|
66
|
+
"build:plugin": "node scripts/build-plugin.js"
|
|
66
67
|
}
|
|
67
68
|
}
|