pan-wizard 3.13.1 → 3.15.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/LICENSE +21 -21
- package/README.md +4 -5
- package/commands/pan/audit-deployment.md +384 -384
- package/commands/pan/focus-auto.md +683 -683
- package/commands/pan/focus-doc-audit.md +530 -530
- package/commands/pan/focus-drift-walking.md +525 -525
- package/commands/pan/git.md +1 -1
- package/commands/pan/hud.md +3 -2
- package/commands/pan/report.md +70 -0
- package/hooks/dist/pan-check-update.js +62 -62
- package/hooks/dist/pan-context-monitor.js +134 -122
- package/hooks/dist/pan-statusline.js +7 -1
- package/package.json +5 -5
- package/pan-wizard-core/bin/lib/config.cjs +14 -1
- package/pan-wizard-core/bin/lib/core.cjs +6 -2
- package/pan-wizard-core/bin/lib/doc-lint.cjs +86 -1
- package/pan-wizard-core/bin/lib/focus.cjs +48 -2
- package/pan-wizard-core/bin/lib/frontmatter.cjs +442 -442
- package/pan-wizard-core/bin/lib/hud.cjs +202 -17
- package/pan-wizard-core/bin/lib/knowledge.cjs +2 -2
- package/pan-wizard-core/bin/lib/optimize.cjs +2 -2
- package/pan-wizard-core/bin/lib/phase-remove.cjs +1 -1
- package/pan-wizard-core/bin/lib/phase-report.cjs +723 -0
- package/pan-wizard-core/bin/lib/phase.cjs +4 -4
- package/pan-wizard-core/bin/lib/review-deep.cjs +3 -1
- package/pan-wizard-core/bin/lib/utils.cjs +171 -171
- package/pan-wizard-core/bin/lib/verify.cjs +172 -61
- package/pan-wizard-core/bin/pan-tools.cjs +1499 -1463
- package/pan-wizard-core/references/checkpoints.md +776 -776
- package/pan-wizard-core/references/continuation-format.md +249 -249
- package/pan-wizard-core/references/questioning.md +145 -145
- package/pan-wizard-core/references/tdd.md +263 -263
- package/pan-wizard-core/references/ui-brand.md +160 -160
- package/pan-wizard-core/templates/config.json +38 -38
- package/pan-wizard-core/workflows/exec-phase.md +14 -0
- package/scripts/build-hooks.js +51 -51
- package/scripts/git-hooks/pre-commit +0 -0
- package/scripts/release-check.js +53 -47
- package/scripts/run-tests.cjs +44 -0
|
@@ -1,160 +1,160 @@
|
|
|
1
|
-
<ui_patterns>
|
|
2
|
-
|
|
3
|
-
Visual patterns for user-facing PAN output. Orchestrators @-reference this file.
|
|
4
|
-
|
|
5
|
-
## Stage Banners
|
|
6
|
-
|
|
7
|
-
Use for major workflow transitions.
|
|
8
|
-
|
|
9
|
-
```
|
|
10
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
11
|
-
PAN ► {STAGE NAME}
|
|
12
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
**Stage names (uppercase):**
|
|
16
|
-
- `QUESTIONING`
|
|
17
|
-
- `RESEARCHING`
|
|
18
|
-
- `DEFINING REQUIREMENTS`
|
|
19
|
-
- `CREATING ROADMAP`
|
|
20
|
-
- `PLANNING PHASE {N}`
|
|
21
|
-
- `EXECUTING WAVE {N}`
|
|
22
|
-
- `VERIFYING`
|
|
23
|
-
- `PHASE {N} COMPLETE ✓`
|
|
24
|
-
- `MILESTONE COMPLETE 🎉`
|
|
25
|
-
|
|
26
|
-
---
|
|
27
|
-
|
|
28
|
-
## Checkpoint Boxes
|
|
29
|
-
|
|
30
|
-
User action required. 62-character width.
|
|
31
|
-
|
|
32
|
-
```
|
|
33
|
-
╔══════════════════════════════════════════════════════════════╗
|
|
34
|
-
║ CHECKPOINT: {Type} ║
|
|
35
|
-
╚══════════════════════════════════════════════════════════════╝
|
|
36
|
-
|
|
37
|
-
{Content}
|
|
38
|
-
|
|
39
|
-
──────────────────────────────────────────────────────────────
|
|
40
|
-
→ {ACTION PROMPT}
|
|
41
|
-
──────────────────────────────────────────────────────────────
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
**Types:**
|
|
45
|
-
- `CHECKPOINT: Verification Required` → `→ Type "approved" or describe issues`
|
|
46
|
-
- `CHECKPOINT: Decision Required` → `→ Select: option-a / option-b`
|
|
47
|
-
- `CHECKPOINT: Action Required` → `→ Type "done" when complete`
|
|
48
|
-
|
|
49
|
-
---
|
|
50
|
-
|
|
51
|
-
## Status Symbols
|
|
52
|
-
|
|
53
|
-
```
|
|
54
|
-
✓ Complete / Passed / Verified
|
|
55
|
-
✗ Failed / Missing / Blocked
|
|
56
|
-
◆ In Progress
|
|
57
|
-
○ Pending
|
|
58
|
-
⚡ Auto-approved
|
|
59
|
-
⚠ Warning
|
|
60
|
-
🎉 Milestone complete (only in banner)
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
---
|
|
64
|
-
|
|
65
|
-
## Progress Display
|
|
66
|
-
|
|
67
|
-
**Phase/milestone level:**
|
|
68
|
-
```
|
|
69
|
-
Progress: ████████░░ 80%
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
**Task level:**
|
|
73
|
-
```
|
|
74
|
-
Tasks: 2/4 complete
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
**Plan level:**
|
|
78
|
-
```
|
|
79
|
-
Plans: 3/5 complete
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
---
|
|
83
|
-
|
|
84
|
-
## Spawning Indicators
|
|
85
|
-
|
|
86
|
-
```
|
|
87
|
-
◆ Spawning researcher...
|
|
88
|
-
|
|
89
|
-
◆ Spawning 4 researchers in parallel...
|
|
90
|
-
→ Stack research
|
|
91
|
-
→ Features research
|
|
92
|
-
→ Architecture research
|
|
93
|
-
→ Pitfalls research
|
|
94
|
-
|
|
95
|
-
✓ Researcher complete: STACK.md written
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
---
|
|
99
|
-
|
|
100
|
-
## Next Up Block
|
|
101
|
-
|
|
102
|
-
Always at end of major completions.
|
|
103
|
-
|
|
104
|
-
```
|
|
105
|
-
───────────────────────────────────────────────────────────────
|
|
106
|
-
|
|
107
|
-
## ▶ Next Up
|
|
108
|
-
|
|
109
|
-
**{Identifier}: {Name}** — {one-line description}
|
|
110
|
-
|
|
111
|
-
`{copy-paste command}`
|
|
112
|
-
|
|
113
|
-
<sub>`/clear` first → fresh context window</sub>
|
|
114
|
-
|
|
115
|
-
───────────────────────────────────────────────────────────────
|
|
116
|
-
|
|
117
|
-
**Also available:**
|
|
118
|
-
- `/pan:alternative-1` — description
|
|
119
|
-
- `/pan:alternative-2` — description
|
|
120
|
-
|
|
121
|
-
───────────────────────────────────────────────────────────────
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
---
|
|
125
|
-
|
|
126
|
-
## Error Box
|
|
127
|
-
|
|
128
|
-
```
|
|
129
|
-
╔══════════════════════════════════════════════════════════════╗
|
|
130
|
-
║ ERROR ║
|
|
131
|
-
╚══════════════════════════════════════════════════════════════╝
|
|
132
|
-
|
|
133
|
-
{Error description}
|
|
134
|
-
|
|
135
|
-
**To fix:** {Resolution steps}
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
---
|
|
139
|
-
|
|
140
|
-
## Tables
|
|
141
|
-
|
|
142
|
-
```
|
|
143
|
-
| Phase | Status | Plans | Progress |
|
|
144
|
-
|-------|--------|-------|----------|
|
|
145
|
-
| 1 | ✓ | 3/3 | 100% |
|
|
146
|
-
| 2 | ◆ | 1/4 | 25% |
|
|
147
|
-
| 3 | ○ | 0/2 | 0% |
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
---
|
|
151
|
-
|
|
152
|
-
## Anti-Patterns
|
|
153
|
-
|
|
154
|
-
- Varying box/banner widths
|
|
155
|
-
- Mixing banner styles (`===`, `---`, `***`)
|
|
156
|
-
- Skipping `PAN ►` prefix in banners
|
|
157
|
-
- Random emoji (`🚀`, `✨`, `💫`)
|
|
158
|
-
- Missing Next Up block after completions
|
|
159
|
-
|
|
160
|
-
</ui_patterns>
|
|
1
|
+
<ui_patterns>
|
|
2
|
+
|
|
3
|
+
Visual patterns for user-facing PAN output. Orchestrators @-reference this file.
|
|
4
|
+
|
|
5
|
+
## Stage Banners
|
|
6
|
+
|
|
7
|
+
Use for major workflow transitions.
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
11
|
+
PAN ► {STAGE NAME}
|
|
12
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
**Stage names (uppercase):**
|
|
16
|
+
- `QUESTIONING`
|
|
17
|
+
- `RESEARCHING`
|
|
18
|
+
- `DEFINING REQUIREMENTS`
|
|
19
|
+
- `CREATING ROADMAP`
|
|
20
|
+
- `PLANNING PHASE {N}`
|
|
21
|
+
- `EXECUTING WAVE {N}`
|
|
22
|
+
- `VERIFYING`
|
|
23
|
+
- `PHASE {N} COMPLETE ✓`
|
|
24
|
+
- `MILESTONE COMPLETE 🎉`
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Checkpoint Boxes
|
|
29
|
+
|
|
30
|
+
User action required. 62-character width.
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
╔══════════════════════════════════════════════════════════════╗
|
|
34
|
+
║ CHECKPOINT: {Type} ║
|
|
35
|
+
╚══════════════════════════════════════════════════════════════╝
|
|
36
|
+
|
|
37
|
+
{Content}
|
|
38
|
+
|
|
39
|
+
──────────────────────────────────────────────────────────────
|
|
40
|
+
→ {ACTION PROMPT}
|
|
41
|
+
──────────────────────────────────────────────────────────────
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**Types:**
|
|
45
|
+
- `CHECKPOINT: Verification Required` → `→ Type "approved" or describe issues`
|
|
46
|
+
- `CHECKPOINT: Decision Required` → `→ Select: option-a / option-b`
|
|
47
|
+
- `CHECKPOINT: Action Required` → `→ Type "done" when complete`
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Status Symbols
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
✓ Complete / Passed / Verified
|
|
55
|
+
✗ Failed / Missing / Blocked
|
|
56
|
+
◆ In Progress
|
|
57
|
+
○ Pending
|
|
58
|
+
⚡ Auto-approved
|
|
59
|
+
⚠ Warning
|
|
60
|
+
🎉 Milestone complete (only in banner)
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Progress Display
|
|
66
|
+
|
|
67
|
+
**Phase/milestone level:**
|
|
68
|
+
```
|
|
69
|
+
Progress: ████████░░ 80%
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
**Task level:**
|
|
73
|
+
```
|
|
74
|
+
Tasks: 2/4 complete
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
**Plan level:**
|
|
78
|
+
```
|
|
79
|
+
Plans: 3/5 complete
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Spawning Indicators
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
◆ Spawning researcher...
|
|
88
|
+
|
|
89
|
+
◆ Spawning 4 researchers in parallel...
|
|
90
|
+
→ Stack research
|
|
91
|
+
→ Features research
|
|
92
|
+
→ Architecture research
|
|
93
|
+
→ Pitfalls research
|
|
94
|
+
|
|
95
|
+
✓ Researcher complete: STACK.md written
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## Next Up Block
|
|
101
|
+
|
|
102
|
+
Always at end of major completions.
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
───────────────────────────────────────────────────────────────
|
|
106
|
+
|
|
107
|
+
## ▶ Next Up
|
|
108
|
+
|
|
109
|
+
**{Identifier}: {Name}** — {one-line description}
|
|
110
|
+
|
|
111
|
+
`{copy-paste command}`
|
|
112
|
+
|
|
113
|
+
<sub>`/clear` first → fresh context window</sub>
|
|
114
|
+
|
|
115
|
+
───────────────────────────────────────────────────────────────
|
|
116
|
+
|
|
117
|
+
**Also available:**
|
|
118
|
+
- `/pan:alternative-1` — description
|
|
119
|
+
- `/pan:alternative-2` — description
|
|
120
|
+
|
|
121
|
+
───────────────────────────────────────────────────────────────
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## Error Box
|
|
127
|
+
|
|
128
|
+
```
|
|
129
|
+
╔══════════════════════════════════════════════════════════════╗
|
|
130
|
+
║ ERROR ║
|
|
131
|
+
╚══════════════════════════════════════════════════════════════╝
|
|
132
|
+
|
|
133
|
+
{Error description}
|
|
134
|
+
|
|
135
|
+
**To fix:** {Resolution steps}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## Tables
|
|
141
|
+
|
|
142
|
+
```
|
|
143
|
+
| Phase | Status | Plans | Progress |
|
|
144
|
+
|-------|--------|-------|----------|
|
|
145
|
+
| 1 | ✓ | 3/3 | 100% |
|
|
146
|
+
| 2 | ◆ | 1/4 | 25% |
|
|
147
|
+
| 3 | ○ | 0/2 | 0% |
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## Anti-Patterns
|
|
153
|
+
|
|
154
|
+
- Varying box/banner widths
|
|
155
|
+
- Mixing banner styles (`===`, `---`, `***`)
|
|
156
|
+
- Skipping `PAN ►` prefix in banners
|
|
157
|
+
- Random emoji (`🚀`, `✨`, `💫`)
|
|
158
|
+
- Missing Next Up block after completions
|
|
159
|
+
|
|
160
|
+
</ui_patterns>
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
{
|
|
2
|
-
"mode": "interactive",
|
|
3
|
-
"depth": "standard",
|
|
4
|
-
"workflow": {
|
|
5
|
-
"research": true,
|
|
6
|
-
"plan_check": true,
|
|
7
|
-
"verifier": true,
|
|
8
|
-
"auto_advance": false,
|
|
9
|
-
"nyquist_validation": false,
|
|
10
|
-
"phase_record_compact": false
|
|
11
|
-
},
|
|
12
|
-
"planning": {
|
|
13
|
-
"commit_docs": true,
|
|
14
|
-
"search_gitignored": false
|
|
15
|
-
},
|
|
16
|
-
"parallelization": {
|
|
17
|
-
"enabled": true,
|
|
18
|
-
"plan_level": true,
|
|
19
|
-
"task_level": false,
|
|
20
|
-
"skip_checkpoints": true,
|
|
21
|
-
"max_concurrent_agents": 3,
|
|
22
|
-
"min_plans_for_parallel": 2
|
|
23
|
-
},
|
|
24
|
-
"gates": {
|
|
25
|
-
"confirm_project": true,
|
|
26
|
-
"confirm_phases": true,
|
|
27
|
-
"confirm_roadmap": true,
|
|
28
|
-
"confirm_breakdown": true,
|
|
29
|
-
"confirm_plan": true,
|
|
30
|
-
"execute_next_plan": true,
|
|
31
|
-
"issues_review": true,
|
|
32
|
-
"confirm_transition": true
|
|
33
|
-
},
|
|
34
|
-
"safety": {
|
|
35
|
-
"always_confirm_destructive": true,
|
|
36
|
-
"always_confirm_external_services": true
|
|
37
|
-
}
|
|
38
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"mode": "interactive",
|
|
3
|
+
"depth": "standard",
|
|
4
|
+
"workflow": {
|
|
5
|
+
"research": true,
|
|
6
|
+
"plan_check": true,
|
|
7
|
+
"verifier": true,
|
|
8
|
+
"auto_advance": false,
|
|
9
|
+
"nyquist_validation": false,
|
|
10
|
+
"phase_record_compact": false
|
|
11
|
+
},
|
|
12
|
+
"planning": {
|
|
13
|
+
"commit_docs": true,
|
|
14
|
+
"search_gitignored": false
|
|
15
|
+
},
|
|
16
|
+
"parallelization": {
|
|
17
|
+
"enabled": true,
|
|
18
|
+
"plan_level": true,
|
|
19
|
+
"task_level": false,
|
|
20
|
+
"skip_checkpoints": true,
|
|
21
|
+
"max_concurrent_agents": 3,
|
|
22
|
+
"min_plans_for_parallel": 2
|
|
23
|
+
},
|
|
24
|
+
"gates": {
|
|
25
|
+
"confirm_project": true,
|
|
26
|
+
"confirm_phases": true,
|
|
27
|
+
"confirm_roadmap": true,
|
|
28
|
+
"confirm_breakdown": true,
|
|
29
|
+
"confirm_plan": true,
|
|
30
|
+
"execute_next_plan": true,
|
|
31
|
+
"issues_review": true,
|
|
32
|
+
"confirm_transition": true
|
|
33
|
+
},
|
|
34
|
+
"safety": {
|
|
35
|
+
"always_confirm_destructive": true,
|
|
36
|
+
"always_confirm_external_services": true
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -659,6 +659,20 @@ if [ -n "$VERIF" ]; then
|
|
|
659
659
|
fi
|
|
660
660
|
```
|
|
661
661
|
|
|
662
|
+
**Cross-check the written verdict against the mechanical signals (anti-rubber-stamp, ADR-0036).** The `status:` string above is authored by the verifier agent; `reconcile` re-derives the artifact/key-link checks from disk and exits non-zero when a claimed pass contradicts them:
|
|
663
|
+
```bash
|
|
664
|
+
node ~/.claude/pan-wizard-core/bin/pan-tools.cjs verify reconcile "${PHASE_NUMBER}" --raw
|
|
665
|
+
RECONCILE_EXIT=$?
|
|
666
|
+
```
|
|
667
|
+
If `RECONCILE_EXIT` is non-zero:
|
|
668
|
+
```
|
|
669
|
+
⚠ Reconcile gate: Phase ${PHASE_NUMBER} verification says "passed" but the mechanical
|
|
670
|
+
checks disagree — artifacts fail substance checks or key-links are unwired.
|
|
671
|
+
This is a rubber-stamped verification. Do NOT auto-advance.
|
|
672
|
+
Re-run /pan:verify-phase and fix the failing artifacts/key-links.
|
|
673
|
+
```
|
|
674
|
+
STOP — do not auto-advance. Return to user.
|
|
675
|
+
|
|
662
676
|
If `VERIF_STATUS` is not `passed`:
|
|
663
677
|
```
|
|
664
678
|
⚠ Verification gate: Phase ${PHASE_NUMBER} verification status is "${VERIF_STATUS:-missing}"
|
package/scripts/build-hooks.js
CHANGED
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Copy PAN hooks from hooks/ to hooks/dist/ for installation.
|
|
4
|
-
*
|
|
5
|
-
* This is COPY-ONLY. PAN's hooks are pure Node.js with zero runtime
|
|
6
|
-
* dependencies, so no bundling step is needed. The script is named
|
|
7
|
-
* "build-hooks" for npm-script convention, but the work is `cp`.
|
|
8
|
-
*
|
|
9
|
-
* (See docs/IMPROVEMENT-TODO.md P2 for the rationale.)
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
const fs = require('fs');
|
|
13
|
-
const path = require('path');
|
|
14
|
-
|
|
15
|
-
const HOOKS_DIR = path.join(__dirname, '..', 'hooks');
|
|
16
|
-
const DIST_DIR = path.join(HOOKS_DIR, 'dist');
|
|
17
|
-
|
|
18
|
-
// Hooks to copy (pure Node.js, no bundling needed)
|
|
19
|
-
const HOOKS_TO_COPY = [
|
|
20
|
-
'pan-check-update.js',
|
|
21
|
-
'pan-context-monitor.js',
|
|
22
|
-
'pan-statusline.js',
|
|
23
|
-
'pan-cost-logger.js',
|
|
24
|
-
'pan-trace-logger.js'
|
|
25
|
-
];
|
|
26
|
-
|
|
27
|
-
function build() {
|
|
28
|
-
// Ensure dist directory exists
|
|
29
|
-
if (!fs.existsSync(DIST_DIR)) {
|
|
30
|
-
fs.mkdirSync(DIST_DIR, { recursive: true });
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// Copy hooks to dist
|
|
34
|
-
for (const hook of HOOKS_TO_COPY) {
|
|
35
|
-
const src = path.join(HOOKS_DIR, hook);
|
|
36
|
-
const dest = path.join(DIST_DIR, hook);
|
|
37
|
-
|
|
38
|
-
if (!fs.existsSync(src)) {
|
|
39
|
-
console.warn(`Warning: ${hook} not found, skipping`);
|
|
40
|
-
continue;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
console.log(`Copying ${hook}...`);
|
|
44
|
-
fs.copyFileSync(src, dest);
|
|
45
|
-
console.log(` → ${dest}`);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
console.log('\nBuild complete.');
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
build();
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Copy PAN hooks from hooks/ to hooks/dist/ for installation.
|
|
4
|
+
*
|
|
5
|
+
* This is COPY-ONLY. PAN's hooks are pure Node.js with zero runtime
|
|
6
|
+
* dependencies, so no bundling step is needed. The script is named
|
|
7
|
+
* "build-hooks" for npm-script convention, but the work is `cp`.
|
|
8
|
+
*
|
|
9
|
+
* (See docs/IMPROVEMENT-TODO.md P2 for the rationale.)
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
const fs = require('fs');
|
|
13
|
+
const path = require('path');
|
|
14
|
+
|
|
15
|
+
const HOOKS_DIR = path.join(__dirname, '..', 'hooks');
|
|
16
|
+
const DIST_DIR = path.join(HOOKS_DIR, 'dist');
|
|
17
|
+
|
|
18
|
+
// Hooks to copy (pure Node.js, no bundling needed)
|
|
19
|
+
const HOOKS_TO_COPY = [
|
|
20
|
+
'pan-check-update.js',
|
|
21
|
+
'pan-context-monitor.js',
|
|
22
|
+
'pan-statusline.js',
|
|
23
|
+
'pan-cost-logger.js',
|
|
24
|
+
'pan-trace-logger.js'
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
function build() {
|
|
28
|
+
// Ensure dist directory exists
|
|
29
|
+
if (!fs.existsSync(DIST_DIR)) {
|
|
30
|
+
fs.mkdirSync(DIST_DIR, { recursive: true });
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Copy hooks to dist
|
|
34
|
+
for (const hook of HOOKS_TO_COPY) {
|
|
35
|
+
const src = path.join(HOOKS_DIR, hook);
|
|
36
|
+
const dest = path.join(DIST_DIR, hook);
|
|
37
|
+
|
|
38
|
+
if (!fs.existsSync(src)) {
|
|
39
|
+
console.warn(`Warning: ${hook} not found, skipping`);
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
console.log(`Copying ${hook}...`);
|
|
44
|
+
fs.copyFileSync(src, dest);
|
|
45
|
+
console.log(` → ${dest}`);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
console.log('\nBuild complete.');
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
build();
|
|
File without changes
|