pan-wizard 2.8.1 → 2.9.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 +4 -2
- package/bin/install.js +23 -0
- package/commands/pan/focus-design.md +235 -12
- package/commands/pan/focus-doc-audit.md +530 -0
- package/commands/pan/focus-drift-walking.md +525 -0
- package/commands/pan/focus-plan.md +204 -12
- package/commands/pan/profile.md +2 -1
- package/package.json +1 -1
- package/pan-wizard-core/bin/lib/commands.cjs +29 -7
- package/pan-wizard-core/bin/lib/config.cjs +10 -0
- package/pan-wizard-core/bin/lib/core.cjs +168 -21
- package/pan-wizard-core/bin/lib/verify.cjs +283 -4
- package/pan-wizard-core/bin/pan-tools.cjs +11 -2
- package/pan-wizard-core/references/model-profiles.md +191 -62
- package/pan-wizard-core/workflows/help.md +11 -1
- package/pan-wizard-core/workflows/profile.md +8 -1
- package/pan-wizard-core/workflows/settings.md +14 -0
package/README.md
CHANGED
|
@@ -47,7 +47,7 @@ PAN is the context engineering layer that makes Claude Code reliable. It breaks
|
|
|
47
47
|
└─────────────────────┬───────────────────────────────────────┘
|
|
48
48
|
│ invokes
|
|
49
49
|
┌─────────────────────▼───────────────────────────────────────┐
|
|
50
|
-
│ COMMANDS (
|
|
50
|
+
│ COMMANDS (42 .md files + 4 CLI operations) │
|
|
51
51
|
│ Thin orchestrators that spawn agents and route results │
|
|
52
52
|
└─────────────────────┬───────────────────────────────────────┘
|
|
53
53
|
│ spawns
|
|
@@ -149,7 +149,7 @@ node bin/install.js --claude --local
|
|
|
149
149
|
Installs to `./.claude/` for testing modifications before contributing.
|
|
150
150
|
|
|
151
151
|
```bash
|
|
152
|
-
npm test #
|
|
152
|
+
npm test # 1736 unit tests
|
|
153
153
|
npm run test:scenarios # Scenario tests (install + integration)
|
|
154
154
|
npm run test:all # All tests (unit + scenario)
|
|
155
155
|
```
|
|
@@ -580,6 +580,8 @@ PAN is not a replacement for your IDE or AI agent — it's the orchestration lay
|
|
|
580
580
|
| `/pan:focus-auto` | Continuous scan→plan→exec loop with purpose-driven categories and 5-layer safety harness |
|
|
581
581
|
| `/pan:focus-sync` | Detect and report stale documentation counts |
|
|
582
582
|
| `/pan:focus-design` | 10-phase strategic feature investigation pipeline |
|
|
583
|
+
| `/pan:focus-drift-walking` | Walk project tree, detect doc-code drift, score severity, auto-repair |
|
|
584
|
+
| `/pan:focus-doc-audit` | Multi-dimensional document audit with 8-dimension quality scoring |
|
|
583
585
|
|
|
584
586
|
<sup>¹ Contributed by reddit user OracleGreyBeard</sup>
|
|
585
587
|
|
package/bin/install.js
CHANGED
|
@@ -1501,8 +1501,11 @@ function install(isGlobal, runtime = 'claude') {
|
|
|
1501
1501
|
console.error(` ${yellow}✗${reset} package.json write failed: ${e.message}`);
|
|
1502
1502
|
failures.push('package.json');
|
|
1503
1503
|
}
|
|
1504
|
+
}
|
|
1504
1505
|
|
|
1506
|
+
if (!isCodex && !isOpencode) {
|
|
1505
1507
|
// Copy hooks from dist/ (bundled with dependencies)
|
|
1508
|
+
// Hooks are only supported by Claude Code, Gemini, and Copilot CLI
|
|
1506
1509
|
// Template paths for the target runtime (replaces '.claude' with correct config dir)
|
|
1507
1510
|
try {
|
|
1508
1511
|
const hooksSrc = path.join(src, 'hooks', 'dist');
|
|
@@ -1549,6 +1552,26 @@ function install(isGlobal, runtime = 'claude') {
|
|
|
1549
1552
|
// Report any backed-up local patches
|
|
1550
1553
|
reportLocalPatches(targetDir, runtime);
|
|
1551
1554
|
|
|
1555
|
+
// Post-install self-check: verify critical files exist before declaring success
|
|
1556
|
+
const selfCheckIssues = [];
|
|
1557
|
+
const panToolsPath = path.join(targetDir, 'pan-wizard-core', 'bin', 'pan-tools.cjs');
|
|
1558
|
+
if (!fs.existsSync(panToolsPath)) selfCheckIssues.push('pan-tools.cjs missing');
|
|
1559
|
+
const manifestFullPath = path.join(targetDir, MANIFEST_NAME);
|
|
1560
|
+
if (fs.existsSync(manifestFullPath)) {
|
|
1561
|
+
try {
|
|
1562
|
+
const mfst = JSON.parse(fs.readFileSync(manifestFullPath, 'utf8'));
|
|
1563
|
+
const fileCount = Object.keys(mfst.files || {}).length;
|
|
1564
|
+
if (fileCount < 50) selfCheckIssues.push(`manifest has only ${fileCount} files (expected 150+)`);
|
|
1565
|
+
} catch { selfCheckIssues.push('manifest unreadable'); }
|
|
1566
|
+
} else {
|
|
1567
|
+
selfCheckIssues.push('manifest missing');
|
|
1568
|
+
}
|
|
1569
|
+
if (selfCheckIssues.length > 0) {
|
|
1570
|
+
console.error(`\n ${yellow}⚠ Post-install check found issues:${reset}`);
|
|
1571
|
+
for (const issue of selfCheckIssues) console.error(` - ${issue}`);
|
|
1572
|
+
console.error(` Run ${cyan}pan-tools validate deployment${reset} for full diagnostics.\n`);
|
|
1573
|
+
}
|
|
1574
|
+
|
|
1552
1575
|
if (isCodex) {
|
|
1553
1576
|
return { settingsPath: null, settings: null, statuslineCommand: null, runtime };
|
|
1554
1577
|
}
|
|
@@ -569,36 +569,255 @@ Every error condition must specify:
|
|
|
569
569
|
|
|
570
570
|
## Phase 5: Architecture Decision Record
|
|
571
571
|
|
|
572
|
-
|
|
572
|
+
> *An ADR is the institutional memory of WHY. Make it comprehensive enough that a developer joining 12 months from now can understand the full decision landscape without asking anyone.*
|
|
573
|
+
|
|
574
|
+
### 5.0 ADR Numbering
|
|
575
|
+
- Read existing ADRs in `docs/decisions/` to determine the next sequential number
|
|
576
|
+
- Format: `ADR-NNNN-<kebab-case-feature-name>.md` (e.g., `ADR-0019-webhook-support.md`)
|
|
577
|
+
|
|
578
|
+
### 5.1 ADR Structure (MANDATORY — all sections required)
|
|
579
|
+
|
|
580
|
+
The ADR MUST contain ALL of the following sections. Do NOT produce a skeleton with placeholder text — every section must have substantive, project-specific content drawn from the preceding phases.
|
|
573
581
|
|
|
574
582
|
```markdown
|
|
575
|
-
# ADR-NNNN: [
|
|
583
|
+
# ADR-NNNN: [Descriptive Title — not just feature name but what was decided]
|
|
576
584
|
|
|
577
585
|
## Status
|
|
578
|
-
Proposed
|
|
586
|
+
Proposed | Accepted | Superseded by ADR-NNNN | Amended by ADR-NNNN
|
|
587
|
+
|
|
588
|
+
## Date
|
|
589
|
+
YYYY-MM-DD
|
|
579
590
|
|
|
580
591
|
## Context
|
|
581
|
-
|
|
592
|
+
|
|
593
|
+
### Problem Statement
|
|
594
|
+
[1-2 paragraphs: What problem exists? Why does it matter? What is the cost of inaction?
|
|
595
|
+
Pull directly from Phase 0.1 — do not paraphrase into vague generalities.]
|
|
596
|
+
|
|
597
|
+
### Forces & Constraints
|
|
598
|
+
[Enumerate the specific technical, business, regulatory, and organizational forces
|
|
599
|
+
that constrain the solution space. These come from Phase 0 + Phase 1 discoveries.]
|
|
600
|
+
|
|
601
|
+
- **[Force 1]:** [Specific constraint and why it matters]
|
|
602
|
+
- **[Force 2]:** [Specific constraint and why it matters]
|
|
603
|
+
- **[Force 3]:** [Specific constraint and why it matters]
|
|
604
|
+
|
|
605
|
+
### Current State
|
|
606
|
+
[What exists today? Reference actual files, modules, endpoints discovered in Phase 0.8.
|
|
607
|
+
If enhancing an existing feature, include the Before/After delta from Phase 0.2.5.]
|
|
608
|
+
|
|
609
|
+
### Requirements Traceability
|
|
610
|
+
[Map to the spec that triggered this ADR. List the success criteria from Phase 0.4.]
|
|
611
|
+
|
|
612
|
+
| Requirement | Source | ADR Section |
|
|
613
|
+
|-------------|--------|-------------|
|
|
614
|
+
| [SC-1 from Phase 0.4] | [spec file or user request] | Decision §X |
|
|
615
|
+
| [SC-2 from Phase 0.4] | [spec file or user request] | Decision §Y |
|
|
582
616
|
|
|
583
617
|
## Decision
|
|
584
|
-
|
|
618
|
+
|
|
619
|
+
### Summary
|
|
620
|
+
[1-2 sentences: The decision in plain language. A busy reader should understand
|
|
621
|
+
the choice from this paragraph alone.]
|
|
622
|
+
|
|
623
|
+
### Detailed Design Decisions
|
|
624
|
+
[Number each sub-decision. For each, state WHAT was decided and WHY.
|
|
625
|
+
Pull from Phase 4 design synthesis — every design choice documented there
|
|
626
|
+
must appear here with rationale.]
|
|
627
|
+
|
|
628
|
+
#### 1. [Sub-decision title]
|
|
629
|
+
**Decided:** [What]
|
|
630
|
+
**Rationale:** [Why — reference forces from Context, competitive findings from Phase 2,
|
|
631
|
+
or architectural constraints from Phase 3.5]
|
|
632
|
+
**Alternatives rejected:** [Brief — full analysis in Options Considered]
|
|
633
|
+
|
|
634
|
+
#### 2. [Sub-decision title]
|
|
635
|
+
**Decided:** [What]
|
|
636
|
+
**Rationale:** [Why]
|
|
637
|
+
**Alternatives rejected:** [Brief]
|
|
638
|
+
|
|
639
|
+
[Continue for all significant decisions — typically 3-8 sub-decisions]
|
|
640
|
+
|
|
641
|
+
### Architecture & Integration
|
|
642
|
+
[How does this fit into the existing system? Include the dependency map from Phase 1.4
|
|
643
|
+
and the layer violation check from Phase 3.5.2. Show which modules are touched.]
|
|
644
|
+
|
|
645
|
+
```
|
|
646
|
+
[Dependency diagram or integration flow from Phase 1.4 / 3.5.6]
|
|
647
|
+
```
|
|
648
|
+
|
|
649
|
+
### Interface Contract
|
|
650
|
+
[The output schema or API contract from Phase 3.5.3 — exact format, not just description.
|
|
651
|
+
Include request/response examples for APIs, CLI input/output for commands,
|
|
652
|
+
or data schema for storage changes.]
|
|
585
653
|
|
|
586
654
|
## Consequences
|
|
655
|
+
|
|
587
656
|
### Positive
|
|
588
|
-
|
|
657
|
+
[Minimum 3 consequences. Each must be specific and measurable, not generic platitudes.
|
|
658
|
+
BAD: "Better user experience" — GOOD: "Reduces statement processing failure rate
|
|
659
|
+
from 80% to <5% for image-based uploads"]
|
|
660
|
+
|
|
661
|
+
- **[Specific benefit 1]:** [Measurable impact]
|
|
662
|
+
- **[Specific benefit 2]:** [Measurable impact]
|
|
663
|
+
- **[Specific benefit 3]:** [Measurable impact]
|
|
664
|
+
|
|
589
665
|
### Negative
|
|
590
|
-
|
|
666
|
+
[Minimum 2 consequences. Be honest about costs and tradeoffs.
|
|
667
|
+
Every negative must include a mitigation strategy or explicit acceptance rationale.]
|
|
668
|
+
|
|
669
|
+
- **[Specific cost 1]:** [Impact] — *Mitigation:* [how addressed or why accepted]
|
|
670
|
+
- **[Specific cost 2]:** [Impact] — *Mitigation:* [how addressed or why accepted]
|
|
671
|
+
|
|
591
672
|
### Neutral
|
|
592
|
-
|
|
673
|
+
[Side effects that are neither clearly positive nor negative]
|
|
674
|
+
|
|
675
|
+
- [Side effect 1]
|
|
676
|
+
- [Side effect 2]
|
|
593
677
|
|
|
594
678
|
## Options Considered
|
|
595
|
-
1. [Option A] — [summary]
|
|
596
|
-
2. [Option B — chosen] — [summary]
|
|
597
679
|
|
|
598
|
-
|
|
599
|
-
|
|
680
|
+
> *Document ALL options evaluated, including the chosen one. For each option,
|
|
681
|
+
> provide enough detail that a reader can understand why it was accepted or rejected
|
|
682
|
+
> WITHOUT reading the full spec.*
|
|
683
|
+
|
|
684
|
+
### Option 1: [Name] — REJECTED
|
|
685
|
+
**Description:** [2-3 sentences: what this approach involves]
|
|
686
|
+
**Pros:** [Bullet list]
|
|
687
|
+
**Cons:** [Bullet list]
|
|
688
|
+
**Rejected because:** [Specific reason tied to forces/constraints in Context]
|
|
689
|
+
|
|
690
|
+
### Option 2: [Name] — REJECTED
|
|
691
|
+
**Description:** [2-3 sentences]
|
|
692
|
+
**Pros:** [Bullet list]
|
|
693
|
+
**Cons:** [Bullet list]
|
|
694
|
+
**Rejected because:** [Specific reason]
|
|
695
|
+
|
|
696
|
+
### Option 3: [Name] — CHOSEN
|
|
697
|
+
**Description:** [2-3 sentences]
|
|
698
|
+
**Pros:** [Bullet list]
|
|
699
|
+
**Cons:** [Bullet list — same as Negative consequences]
|
|
700
|
+
**Chosen because:** [Specific reason — ties back to forces, competitive position, strategic analysis]
|
|
701
|
+
|
|
702
|
+
### Option 4: [Name] — DEFERRED
|
|
703
|
+
**Description:** [2-3 sentences]
|
|
704
|
+
**Deferred because:** [Not rejected — viable for future consideration. State trigger conditions.]
|
|
705
|
+
|
|
706
|
+
[Include 3-5 options minimum. If fewer than 3 alternatives were genuinely considered,
|
|
707
|
+
explain why the solution space was constrained.]
|
|
708
|
+
|
|
709
|
+
### Decision Matrix (when 3+ options share comparable tradeoffs)
|
|
710
|
+
| Criterion (from forces) | Weight | Option 1 | Option 2 | Option 3 (chosen) |
|
|
711
|
+
|--------------------------|--------|----------|----------|-------------------|
|
|
712
|
+
| [Force/requirement 1] | High | Poor | Good | Excellent |
|
|
713
|
+
| [Force/requirement 2] | Medium | Good | Poor | Good |
|
|
714
|
+
| [Force/requirement 3] | High | N/A | Good | Excellent |
|
|
715
|
+
| **Weighted Score** | | Low | Medium | **High** |
|
|
716
|
+
|
|
717
|
+
## Success Criteria
|
|
718
|
+
|
|
719
|
+
[Copy directly from Phase 0.4 — these are the machine-checkable acceptance criteria
|
|
720
|
+
that determine whether this ADR's decision was correctly implemented.]
|
|
721
|
+
|
|
722
|
+
| ID | Criterion | Verification Method | Pass Condition |
|
|
723
|
+
|----|-----------|-------------------|----------------|
|
|
724
|
+
| SC-1 | [description] | test / grep / manual | [exact condition] |
|
|
725
|
+
| SC-2 | [description] | test / grep / manual | [exact condition] |
|
|
726
|
+
| SC-3 | No regression | project test command | All existing tests pass |
|
|
727
|
+
|
|
728
|
+
## Breaking Changes
|
|
729
|
+
|
|
730
|
+
[From Phase 3.5.5. If no breaking changes, state "None — all changes are additive."]
|
|
731
|
+
|
|
732
|
+
| Change | Impact | Migration Strategy |
|
|
733
|
+
|--------|--------|--------------------|
|
|
734
|
+
| [What changes] | [Who is affected] | [How to migrate] |
|
|
735
|
+
|
|
736
|
+
## Security Implications
|
|
737
|
+
|
|
738
|
+
[From Phase 7. Summarize the threat model and key controls.]
|
|
739
|
+
|
|
740
|
+
| Threat | Risk Level | Control |
|
|
741
|
+
|--------|-----------|---------|
|
|
742
|
+
| [Threat from STRIDE-lite] | Low/Medium/High | [Mitigation implemented] |
|
|
743
|
+
|
|
744
|
+
If no security implications: "No new attack surface introduced. [Brief justification.]"
|
|
745
|
+
|
|
746
|
+
## Performance Implications
|
|
747
|
+
|
|
748
|
+
[From Phase 3.5.7 performance budget. State the expected performance characteristics
|
|
749
|
+
and any budgets that must be maintained.]
|
|
750
|
+
|
|
751
|
+
| Operation | Budget | Justification |
|
|
752
|
+
|-----------|--------|---------------|
|
|
753
|
+
| [Key operation 1] | < Xms | [Why this budget] |
|
|
754
|
+
| [Key operation 2] | < Xms | [Why this budget] |
|
|
755
|
+
|
|
756
|
+
## Implementation Guidance
|
|
757
|
+
|
|
758
|
+
[From Phase 8. Not the full task list — just enough for an implementer to know
|
|
759
|
+
WHERE to start and what patterns to follow.]
|
|
760
|
+
|
|
761
|
+
| Order | Task | Files Affected | Effort |
|
|
762
|
+
|-------|------|---------------|--------|
|
|
763
|
+
| 1 | [First task] | [file paths] | XS/S/M/L |
|
|
764
|
+
| 2 | [Second task] | [file paths] | XS/S/M/L |
|
|
765
|
+
|
|
766
|
+
**Patterns to follow:** [Reference specific existing implementations discovered in Phase 0.8
|
|
767
|
+
that the implementer should use as templates]
|
|
768
|
+
|
|
769
|
+
## Feature Ladder
|
|
770
|
+
|
|
771
|
+
[From Phase 4.5. Shows the incremental delivery plan.]
|
|
772
|
+
|
|
773
|
+
| Version | Scope | Value Delivered |
|
|
774
|
+
|---------|-------|----------------|
|
|
775
|
+
| v0 (MVP) | [smallest useful slice] | [what user can do] |
|
|
776
|
+
| v1 (Complete) | [full feature] | [full value] |
|
|
777
|
+
| v2 (Enhanced) | [future extensions] | [additional value] |
|
|
778
|
+
|
|
779
|
+
## Links & References
|
|
780
|
+
|
|
781
|
+
- **Spec:** `docs/specs/<feature>_featureai.md`
|
|
782
|
+
- **Related ADRs:** [list with brief relationship description]
|
|
783
|
+
- **Supersedes:** [ADR number if replacing a previous decision, or "N/A"]
|
|
784
|
+
- **External references:** [Standards, RFCs, competitor docs, regulatory requirements]
|
|
785
|
+
- **Affected components:** [List of files/modules/services from impact analysis]
|
|
600
786
|
```
|
|
601
787
|
|
|
788
|
+
### 5.2 ADR Quality Gate (Self-Check Before Writing)
|
|
789
|
+
|
|
790
|
+
Before writing the ADR file, verify ALL of these:
|
|
791
|
+
|
|
792
|
+
| Check | Requirement | Source Phase |
|
|
793
|
+
|-------|-------------|-------------|
|
|
794
|
+
| Context has specific forces | Not just "we need X" — enumerate WHY and WHAT CONSTRAINS | Phase 0 + 1 |
|
|
795
|
+
| Decision has numbered sub-decisions | Every design choice from Phase 4 is captured with rationale | Phase 4 |
|
|
796
|
+
| Options >= 3 | At least 3 genuine alternatives evaluated | Phase 2 + 3 |
|
|
797
|
+
| Each option has pros AND cons | No straw-man options set up just to be rejected | Phase 2 + 3 |
|
|
798
|
+
| Consequences are specific | No generic "better UX" — measurable impacts only | Phase 3 + 4 |
|
|
799
|
+
| Negative consequences have mitigations | Every cost is either mitigated or explicitly accepted | Phase 4 |
|
|
800
|
+
| Success criteria are machine-checkable | At least 2 can be verified by automated test | Phase 0.4 |
|
|
801
|
+
| Breaking changes documented or "None" stated | Never omitted silently | Phase 3.5.5 |
|
|
802
|
+
| Security section present | Even if "no new attack surface" — must be explicit | Phase 7 |
|
|
803
|
+
| Performance budget stated | Key operations with time budgets | Phase 3.5.7 |
|
|
804
|
+
| Implementation guidance references real files | Not hypothetical paths — actual discovered locations | Phase 0.8 + 8 |
|
|
805
|
+
| Links trace to spec file | ADR → spec → requirements chain is complete | Phase 10 |
|
|
806
|
+
|
|
807
|
+
**If any check fails:** Go back to the relevant phase and extract the missing content. Do NOT write placeholder text.
|
|
808
|
+
|
|
809
|
+
### 5.3 ADR Anti-Patterns (NEVER DO)
|
|
810
|
+
|
|
811
|
+
- **Skeleton ADR:** `[Problem context — what forces are at play?]` — NEVER use placeholder brackets in the output
|
|
812
|
+
- **Single-option ADR:** Only describing the chosen approach without alternatives — this is a design doc, not an ADR
|
|
813
|
+
- **Consequence-free ADR:** Listing only positives — EVERY decision has real costs
|
|
814
|
+
- **Generic consequences:** "Improves code quality" / "Better maintainability" — be specific or remove
|
|
815
|
+
- **Missing rationale:** "We chose X" without explaining WHY over alternatives
|
|
816
|
+
- **Orphan ADR:** No link to spec, no link to related ADRs, no traceability
|
|
817
|
+
- **Copy-paste from spec:** The ADR is a DECISION record, not a spec summary — focus on WHY, not WHAT
|
|
818
|
+
- **Straw-man options:** Including obviously bad alternatives just to make the chosen option look good
|
|
819
|
+
- **Missing migration strategy:** Documenting breaking changes without explaining how to handle them
|
|
820
|
+
|
|
602
821
|
---
|
|
603
822
|
|
|
604
823
|
## Phase 6: Error Handling & Diagnostics Design
|
|
@@ -753,6 +972,10 @@ Write complete spec to: `docs/specs/<feature_name>_featureai.md`
|
|
|
753
972
|
### 10.2 Save ADR
|
|
754
973
|
Write ADR to: `docs/decisions/ADR-NNNN-<feature_name>.md`
|
|
755
974
|
|
|
975
|
+
**ADR completeness gate:** Before saving, verify the ADR passes ALL checks from Phase 5.2. The ADR file must contain every section defined in Phase 5.1 with substantive content — no placeholder brackets, no skeleton sections, no missing tables. If any section would be empty, go back to the relevant phase and extract the content.
|
|
976
|
+
|
|
977
|
+
**Minimum ADR size:** A proper ADR for a `--full` mode investigation should be 80-200+ lines. If the ADR is under 60 lines, it is almost certainly missing required sections. For `--internal` mode, minimum 60 lines. For `--outward` mode, minimum 70 lines.
|
|
978
|
+
|
|
756
979
|
### 10.3 Report Summary
|
|
757
980
|
Output a complete summary with:
|
|
758
981
|
- **Problem & Evidence** — 1-sentence problem, evidence sources
|