pan-wizard 3.35.0 → 3.37.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 +3645 -0
- package/README.md +46 -52
- package/agents/pan-conductor.md +2 -3
- package/agents/pan-counterfactual.md +1 -2
- package/agents/pan-debugger.md +14 -3
- package/agents/pan-design-checker.md +1 -2
- package/agents/pan-designer.md +2 -3
- package/agents/pan-document_code.md +1 -2
- package/agents/pan-executor.md +25 -0
- package/agents/pan-hardener.md +4 -3
- package/agents/pan-integration-checker.md +1 -2
- package/agents/pan-knowledge.md +1 -2
- package/agents/pan-meta-reviewer.md +3 -3
- package/agents/pan-optimizer.md +4 -4
- package/agents/pan-phase-researcher.md +80 -475
- package/agents/pan-plan-checker.md +40 -3
- package/agents/pan-planner.md +21 -7
- package/agents/pan-previewer.md +3 -2
- package/agents/pan-project-researcher.md +72 -493
- package/agents/pan-release.md +1 -1
- package/agents/pan-reviewer.md +14 -3
- package/agents/pan-roadmapper.md +12 -7
- package/agents/pan-verifier.md +9 -4
- package/bin/install-lib.cjs +134 -14
- package/bin/install.js +59 -12
- package/commands/pan/army.md +1 -1
- package/commands/pan/autodev.md +76 -0
- package/commands/pan/cost.md +21 -1
- package/commands/pan/exec-phase.md +3 -4
- package/commands/pan/focus-auto.md +14 -7
- package/commands/pan/focus-design.md +4 -5
- package/commands/pan/focus-docs.md +24 -0
- package/commands/pan/learn.md +13 -6
- package/commands/pan/milestone-audit.md +8 -1
- package/commands/pan/milestone-done.md +10 -5
- package/commands/pan/milestone-new.md +2 -2
- package/commands/pan/new-project.md +15 -12
- package/commands/pan/plan-phase.md +15 -9
- package/commands/pan/preview.md +1 -1
- package/commands/pan/quick.md +1 -1
- package/commands/pan/review-deep.md +11 -5
- package/commands/pan/settings.md +6 -0
- package/commands/pan/verify-phase.md +6 -2
- package/docs/AGENTS.md +917 -0
- package/docs/ARCHITECTURE.md +1054 -0
- package/docs/CLI-REFERENCE.md +4582 -0
- package/docs/COMPARISON.md +116 -0
- package/docs/DEVELOPMENT.md +490 -0
- package/docs/ECOSYSTEM-REVIEW-2026-06.md +107 -0
- package/docs/ECOSYSTEM-REVIEW-2026-08.md +349 -0
- package/docs/EXAMPLES.md +584 -0
- package/docs/FAQ.md +254 -0
- package/docs/FIELD-HARVEST-2026-07.md +88 -0
- package/docs/FIELD-REPORT-army-2026-06.md +121 -0
- package/docs/HOOKS.md +638 -0
- package/docs/IMPROVEMENT-TODO.md +246 -0
- package/docs/INTERNALS.md +485 -0
- package/docs/MIGRATION-v2-to-v3.md +258 -0
- package/docs/SECURITY-HARDENING.md +230 -0
- package/docs/SKILLS-ENHANCEMENT-PLAN-V2.md +122 -0
- package/docs/SKILLS-FULL-TEXT.md +9685 -0
- package/docs/SKILLS-REFERENCE.md +1037 -0
- package/docs/TROUBLESHOOTING.md +1084 -0
- package/docs/USER-GUIDE.md +1437 -0
- package/docs/archive/SKILLS-ENHANCEMENT-PLAN.md +230 -0
- package/docs/audits/AUDIT-2026-08-e2e-ROADMAP.md +117 -0
- package/docs/audits/AUDIT-2026-08-e2e-VERIFICATION.md +693 -0
- package/docs/audits/AUDIT-2026-08-e2e.md +1546 -0
- package/docs/audits/OUTSTANDING-2026-08.md +275 -0
- package/docs/audits/STABILITY-TEST-2026-08.md +640 -0
- package/docs/branding/README-brand-draft.md +119 -0
- package/docs/branding/handoff/IMPLEMENTATION.md +205 -0
- package/docs/branding/handoff/README-brand-draft.md +119 -0
- package/docs/branding/handoff/image-prompts.md +46 -0
- package/docs/branding/image-prompts.md +46 -0
- package/docs/branding/nano-banana-prompts.txt +60 -0
- package/docs/context-monitor.md +13 -0
- package/docs/decisions/ADR-0001-strategic-feature-prioritization.md +83 -0
- package/docs/decisions/ADR-0002-copilot-cli-runtime.md +71 -0
- package/docs/decisions/ADR-0003-smart-execution.md +84 -0
- package/docs/decisions/ADR-0004-copilot-cli-interaction.md +89 -0
- package/docs/decisions/ADR-0005-command-naming.md +80 -0
- package/docs/decisions/ADR-0006-focus-commands.md +101 -0
- package/docs/decisions/ADR-0007-ship-v1.md +73 -0
- package/docs/decisions/ADR-0008-map-codebase-mermaid-togaf.md +80 -0
- package/docs/decisions/ADR-0009-production-deployment-checklist.md +68 -0
- package/docs/decisions/ADR-0010-standards-integration.md +79 -0
- package/docs/decisions/ADR-0011-help-commands-rewrite.md +64 -0
- package/docs/decisions/ADR-0012-contributors-attribution-index.md +42 -0
- package/docs/decisions/ADR-0013-strategic-feature-additions.md +53 -0
- package/docs/decisions/ADR-0014-internal-cleanup-code-quality.md +53 -0
- package/docs/decisions/ADR-0015-focus-auto-runner.md +296 -0
- package/docs/decisions/ADR-0016-enhanced-doc-sync.md +54 -0
- package/docs/decisions/ADR-0017-enhanced-focus-design.md +69 -0
- package/docs/decisions/ADR-0018-user-reality-testing.md +84 -0
- package/docs/decisions/ADR-0019-end-to-end-user-acceptance-testing.md +113 -0
- package/docs/decisions/ADR-0020-ai-drift-prevention.md +55 -0
- package/docs/decisions/ADR-0021-codebase-mapper-v2.md +76 -0
- package/docs/decisions/ADR-0022-lifecycle-completeness.md +63 -0
- package/docs/decisions/ADR-0023-opus-4-7-adoption.md +89 -0
- package/docs/decisions/ADR-0024-spec-b-v2-completion.md +137 -0
- package/docs/decisions/ADR-0025-behavioral-guardrails-layer.md +129 -0
- package/docs/decisions/ADR-0026-self-improvement-loop.md +171 -0
- package/docs/decisions/ADR-0027-doc-code-link-graph.md +164 -0
- package/docs/decisions/ADR-0028-unified-agents-skills-target.md +46 -0
- package/docs/decisions/ADR-0029-experiment-evaluator.md +76 -0
- package/docs/decisions/ADR-0030-planning-concurrency.md +37 -0
- package/docs/decisions/ADR-0031-focus-auto-backlog-source.md +47 -0
- package/docs/decisions/ADR-0032-squad-model.md +64 -0
- package/docs/decisions/ADR-0033-army-campaign.md +40 -0
- package/docs/decisions/ADR-0034-scheduled-campaigns.md +57 -0
- package/docs/decisions/ADR-0035-army-hud-dashboard.md +40 -0
- package/docs/decisions/ADR-0036-agentic-memory-architecture.md +106 -0
- package/docs/decisions/ADR-0037-pin-security-agents-to-opus.md +51 -0
- package/docs/decisions/ADR-0038-skill-aligned-decomposition.md +41 -0
- package/docs/decisions/ADR-0039-worktree-as-project-variant.md +37 -0
- package/docs/decisions/ADR-0040-memory-injection-defense.md +55 -0
- package/docs/decisions/ADR-0041-mcp-dual-era-bridge.md +47 -0
- package/docs/decisions/ADR-0042-design-parity-both-flows.md +45 -0
- package/docs/decisions/ADR-0043-addressable-planning-roots.md +56 -0
- package/docs/decisions/ADR-0044-bound-the-cached-context.md +104 -0
- package/docs/decisions/ADR-0045-agent-plugins-bundle.md +76 -0
- package/docs/decisions/ADR-0046-subagent-frontmatter-decisions.md +39 -0
- package/docs/decisions/ADR-0047-pan-harness.md +76 -0
- package/docs/decisions/ADR-0048-one-core-per-project.md +43 -0
- package/docs/decisions/ADR-0049-machine-verdicts-and-findings-ledger.md +116 -0
- package/docs/specs/ai_drift_prevention_featureai.md +286 -0
- package/docs/specs/codebase_mapper_v2_featureai.md +930 -0
- package/docs/specs/command_naming_optimization_featureai.md +930 -0
- package/docs/specs/comp_analysis_markdown_v1.md +149 -0
- package/docs/specs/continuous_autonomous_execution_featureai.md +304 -0
- package/docs/specs/contributors_attribution_index_featureai.md +476 -0
- package/docs/specs/copilot_cli_interaction_featureai.md +868 -0
- package/docs/specs/copilot_cli_runtime_featureai.md +647 -0
- package/docs/specs/custom-skills-assessment.md +461 -0
- package/docs/specs/deployment_audit_findings_featureai.md +243 -0
- package/docs/specs/doc_code_link_graph_featureai.md +253 -0
- package/docs/specs/documentation_alignment_cleanup_featureai.md +69 -0
- package/docs/specs/e2e_visual_testing_featureai.md +615 -0
- package/docs/specs/end_to_end_user_acceptance_testing_featureai.md +810 -0
- package/docs/specs/evidence-loop-plan.md +76 -0
- package/docs/specs/evidence_loop_featureai.md +497 -0
- package/docs/specs/focus-auto-optimize-category.md +449 -0
- package/docs/specs/focus-auto-optimize-superplan.md +188 -0
- package/docs/specs/focus_auto_runner_featureai.md +1102 -0
- package/docs/specs/focus_design_v2_featureai.md +197 -0
- package/docs/specs/focus_sync_v2_featureai.md +202 -0
- package/docs/specs/git_integration_overhaul_featureai.md +326 -0
- package/docs/specs/glm_zai_provider_featureai.md +200 -0
- package/docs/specs/googlecli_adoption_featureai.md +661 -0
- package/docs/specs/help_commands_rewrite_featureai.md +860 -0
- package/docs/specs/industry_analysis_strategic_additions_featureai.md +231 -0
- package/docs/specs/industry_comparison_and_feature_gaps_featureai.md +674 -0
- package/docs/specs/internal_cleanup_code_quality_featureai.md +486 -0
- package/docs/specs/investigations/README.md +31 -0
- package/docs/specs/investigations/digests/2026-09-28.md +47 -0
- package/docs/specs/investigations/digests/2026-10-08.md +62 -0
- package/docs/specs/investigations/digests/2026-10-10.md +61 -0
- package/docs/specs/investigations/features/debugger-red-loop-first.md +55 -0
- package/docs/specs/investigations/features/harness-cross-host-behaviour.md +93 -0
- package/docs/specs/investigations/features/optimize-apply-regression-gate.md +66 -0
- package/docs/specs/investigations/features/reviewer-smell-baseline.md +57 -0
- package/docs/specs/investigations/features/trace-failure-capture.md +69 -0
- package/docs/specs/lifecycle_completeness_featureai.md +754 -0
- package/docs/specs/local-first-ci.md +42 -0
- package/docs/specs/map_codebase_mermaid_togaf_featureai.md +805 -0
- package/docs/specs/market-delta-2026-09-superplan.md +310 -0
- package/docs/specs/market-ideas-2026-09.md +131 -0
- package/docs/specs/market-ideas-2026-10.md +428 -0
- package/docs/specs/market-ideas-ledger.md +177 -0
- package/docs/specs/memory-optimization-2026-10.md +285 -0
- package/docs/specs/multi-track-planning-roots.md +143 -0
- package/docs/specs/multi_model_routing_featureai.md +687 -0
- package/docs/specs/multi_model_routing_superplan.md +197 -0
- package/docs/specs/opus_47_existing_enhancements_featureai.md +247 -0
- package/docs/specs/opus_47_extended_features_featureai.md +363 -0
- package/docs/specs/opus_47_extended_features_v2_featureai.md +397 -0
- package/docs/specs/pan_focus_commands_featureai.md +2336 -0
- package/docs/specs/pan_zcode_mcp_bridge_featureai.md +120 -0
- package/docs/specs/product-excellence-superplan.md +315 -0
- package/docs/specs/product_excellence_program_2026_q4_featureai.md +365 -0
- package/docs/specs/production_deployment_readiness_featureai.md +433 -0
- package/docs/specs/production_readiness_ship_v1_featureai.md +698 -0
- package/docs/specs/real_test_enforcement_featureai.md +213 -0
- package/docs/specs/reality-check-2026-09-superplan.md +362 -0
- package/docs/specs/right-sized-ceremony.md +74 -0
- package/docs/specs/roadmap_and_competition_2026_q4_featureai.md +390 -0
- package/docs/specs/self_improvement_loop_featureai.md +875 -0
- package/docs/specs/skill-aligned-decomposition.md +155 -0
- package/docs/specs/standards_integration_featureai.md +833 -0
- package/docs/specs/testing-system-redesign-2026-09.md +267 -0
- package/docs/specs/user_reality_testing_system_featureai.md +788 -0
- package/docs/specs/watch-triggers.json +22 -0
- package/docs/specs/workflow-integration-redesign.md +742 -0
- package/docs/specs/workflow_state_consistency_featureai.md +183 -0
- package/hooks/dist/pan-context-monitor.js +9 -2
- package/hooks/dist/pan-cost-logger.js +5 -0
- package/hooks/dist/pan-guard.js +28 -5
- package/hooks/dist/pan-stop-guard.js +9 -9
- package/hooks/dist/pan-trace-logger.js +5 -0
- package/package.json +10 -2
- package/pan-wizard-core/bin/lib/agents-md.cjs +57 -8
- package/pan-wizard-core/bin/lib/autodev-report.cjs +180 -0
- package/pan-wizard-core/bin/lib/autodev.cjs +642 -0
- package/pan-wizard-core/bin/lib/ci.cjs +143 -0
- package/pan-wizard-core/bin/lib/commands.cjs +1 -1
- package/pan-wizard-core/bin/lib/config.cjs +41 -5
- package/pan-wizard-core/bin/lib/constants.cjs +27 -1
- package/pan-wizard-core/bin/lib/core.cjs +31 -14
- package/pan-wizard-core/bin/lib/cost.cjs +160 -4
- package/pan-wizard-core/bin/lib/cross-family.cjs +164 -0
- package/pan-wizard-core/bin/lib/debug-cases.cjs +104 -0
- package/pan-wizard-core/bin/lib/doc-lint.cjs +5 -3
- package/pan-wizard-core/bin/lib/failure-class.cjs +81 -0
- package/pan-wizard-core/bin/lib/findings.cjs +148 -9
- package/pan-wizard-core/bin/lib/focus.cjs +1 -1
- package/pan-wizard-core/bin/lib/git.cjs +1 -1
- package/pan-wizard-core/bin/lib/hosts.cjs +88 -0
- package/pan-wizard-core/bin/lib/init.cjs +7 -2
- package/pan-wizard-core/bin/lib/knowledge.cjs +2 -0
- package/pan-wizard-core/bin/lib/merge.cjs +50 -0
- package/pan-wizard-core/bin/lib/mutate.cjs +268 -0
- package/pan-wizard-core/bin/lib/next-action.cjs +112 -0
- package/pan-wizard-core/bin/lib/optimize.cjs +2 -2
- package/pan-wizard-core/bin/lib/phase-gate.cjs +15 -9
- package/pan-wizard-core/bin/lib/phase-remove.cjs +91 -11
- package/pan-wizard-core/bin/lib/phase.cjs +85 -13
- package/pan-wizard-core/bin/lib/plan-lint.cjs +310 -0
- package/pan-wizard-core/bin/lib/preview.cjs +26 -4
- package/pan-wizard-core/bin/lib/requirements-lint.cjs +130 -0
- package/pan-wizard-core/bin/lib/research-lint.cjs +268 -0
- package/pan-wizard-core/bin/lib/review-deep.cjs +14 -22
- package/pan-wizard-core/bin/lib/review-vote.cjs +105 -0
- package/pan-wizard-core/bin/lib/roadmap.cjs +1 -0
- package/pan-wizard-core/bin/lib/runner.cjs +2 -16
- package/pan-wizard-core/bin/lib/sizing.cjs +356 -0
- package/pan-wizard-core/bin/lib/squads.cjs +1 -1
- package/pan-wizard-core/bin/lib/state-write.cjs +247 -0
- package/pan-wizard-core/bin/lib/test-gate.cjs +433 -0
- package/pan-wizard-core/bin/lib/uat.cjs +149 -0
- package/pan-wizard-core/bin/lib/usage.cjs +104 -0
- package/pan-wizard-core/bin/lib/verdict.cjs +26 -3
- package/pan-wizard-core/bin/lib/verify-plan-set.cjs +30 -1
- package/pan-wizard-core/bin/lib/verify-preflight.cjs +2 -2
- package/pan-wizard-core/bin/lib/verify-red.cjs +174 -0
- package/pan-wizard-core/bin/lib/verify-retro.cjs +3 -2
- package/pan-wizard-core/bin/lib/verify-scope.cjs +143 -2
- package/pan-wizard-core/bin/lib/verify.cjs +86 -31
- package/pan-wizard-core/bin/lib/worktree.cjs +70 -0
- package/pan-wizard-core/bin/pan-tools.cjs +257 -28
- package/pan-wizard-core/learnings/universal/autonomous-loop.md +2 -2
- package/pan-wizard-core/mcp/orchestrator.cjs +4 -1
- package/pan-wizard-core/references/continuation-format.md +3 -3
- package/pan-wizard-core/references/design-methodology.md +1 -1
- package/pan-wizard-core/references/guardrails.md +1 -1
- package/pan-wizard-core/references/handoff-decisions.md +1 -1
- package/pan-wizard-core/references/model-profiles.md +2 -3
- package/pan-wizard-core/references/questioning.md +24 -0
- package/pan-wizard-core/references/ui-brand.md +4 -6
- package/pan-wizard-core/references/verdict-contract.md +2 -1
- package/pan-wizard-core/templates/config.json +10 -2
- package/pan-wizard-core/templates/debug.md +1 -0
- package/pan-wizard-core/templates/design.md +5 -4
- package/pan-wizard-core/templates/discovery.md +2 -2
- package/pan-wizard-core/templates/phase-prompt.md +7 -0
- package/pan-wizard-core/templates/requirements.md +9 -0
- package/pan-wizard-core/templates/research.md +10 -0
- package/pan-wizard-core/templates/summary-complex.md +5 -1
- package/pan-wizard-core/templates/summary-minimal.md +4 -0
- package/pan-wizard-core/templates/summary-standard.md +5 -1
- package/pan-wizard-core/templates/summary.md +8 -1
- package/pan-wizard-core/workflows/add-phase.md +4 -6
- package/pan-wizard-core/workflows/assumptions.md +19 -1
- package/pan-wizard-core/workflows/diagnose-issues.md +2 -0
- package/pan-wizard-core/workflows/discuss-phase.md +4 -2
- package/pan-wizard-core/workflows/exec-lean.md +69 -0
- package/pan-wizard-core/workflows/exec-phase.md +79 -15
- package/pan-wizard-core/workflows/execute-plan.md +3 -1
- package/{commands/pan → pan-wizard-core/workflows}/focus-doc-audit.md +13 -29
- package/{commands/pan → pan-wizard-core/workflows}/focus-drift-walking.md +3 -18
- package/{commands/pan → pan-wizard-core/workflows}/focus-exec.md +8 -23
- package/{commands/pan → pan-wizard-core/workflows}/focus-plan.md +6 -20
- package/{commands/pan → pan-wizard-core/workflows}/focus-scan.md +3 -16
- package/{commands/pan → pan-wizard-core/workflows}/focus-sync.md +7 -21
- package/pan-wizard-core/workflows/health.md +6 -0
- package/pan-wizard-core/workflows/help.md +114 -77
- package/pan-wizard-core/workflows/insert-phase.md +4 -6
- package/pan-wizard-core/workflows/learn.md +3 -3
- package/pan-wizard-core/workflows/milestone-audit.md +2 -2
- package/pan-wizard-core/workflows/milestone-new.md +38 -95
- package/pan-wizard-core/workflows/new-project.md +96 -258
- package/pan-wizard-core/workflows/optimize.md +107 -5
- package/pan-wizard-core/workflows/phase-tests.md +10 -0
- package/pan-wizard-core/workflows/plan-phase.md +106 -45
- package/pan-wizard-core/workflows/profile.md +50 -0
- package/pan-wizard-core/workflows/progress.md +10 -0
- package/pan-wizard-core/workflows/quick.md +34 -43
- package/pan-wizard-core/workflows/remove-phase.md +11 -1
- package/pan-wizard-core/workflows/research-phase.md +118 -40
- package/pan-wizard-core/workflows/resume-project.md +18 -2
- package/pan-wizard-core/workflows/settings.md +33 -19
- package/pan-wizard-core/workflows/todo-check.md +6 -2
- package/pan-wizard-core/workflows/transition.md +22 -4
- package/pan-wizard-core/workflows/uat-walkthrough.md +90 -0
- package/pan-wizard-core/workflows/update.md +1 -1
- package/pan-wizard-core/workflows/verify-phase.md +39 -46
- package/scripts/build-agent-plugin.js +35 -15
- package/scripts/build-help.cjs +106 -0
- package/scripts/build-plugin.js +10 -1
- package/scripts/deprecate-old-versions.js +70 -3
- package/scripts/generate-skills-docs.py +1 -1
- package/scripts/git-hooks/pre-push +27 -0
- package/scripts/install-git-hooks.js +7 -5
- package/scripts/install-pre-push.cjs +38 -0
- package/scripts/land.cjs +151 -0
- package/scripts/local-ci.cjs +501 -0
- package/scripts/local-schedule.cjs +277 -0
- package/scripts/mutation-probe.cjs +7 -80
- package/scripts/prompt-lint.cjs +32 -0
- package/scripts/prompt-rules.cjs +156 -0
- package/scripts/run-tests.cjs +7 -1
- package/scripts/test-quality-lint.cjs +3 -3
- package/scripts/test-surface.cjs +175 -6
- package/agents/pan-research-synthesizer.md +0 -246
- package/commands/pan/audit-deployment.md +0 -386
- package/commands/pan/dashboard.md +0 -22
- package/commands/pan/discord.md +0 -19
- package/commands/pan/mcp-bridge.md +0 -143
- package/commands/pan/milestone-cleanup.md +0 -19
- package/commands/pan/milestone-gaps.md +0 -35
- package/commands/pan/optimize.md +0 -115
- package/commands/pan/profile.md +0 -76
- package/commands/pan/research-phase.md +0 -189
- package/pan-wizard-core/bin/lib/bridge.cjs +0 -269
- package/pan-wizard-core/templates/research-project/architecture.md +0 -204
- package/pan-wizard-core/templates/research-project/features.md +0 -147
- package/pan-wizard-core/templates/research-project/pitfalls.md +0 -200
- package/pan-wizard-core/templates/research-project/stack.md +0 -120
- package/pan-wizard-core/templates/research-project/summary.md +0 -170
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
# featureAI Spec: Git Integration Overhaul for PAN Wizard
|
|
2
|
+
|
|
3
|
+
**Date:** 2026-03-07
|
|
4
|
+
**Status:** Proposed
|
|
5
|
+
**Scope:** Focus system, build system, phase lifecycle, and commit infrastructure
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Phase 0: Problem Framing & Demand Validation
|
|
10
|
+
|
|
11
|
+
### 0.1 Problem Statement
|
|
12
|
+
PAN Wizard's git integration is a facade — the reference docs (`git-integration.md`, `git-planning-commit.md`) describe a comprehensive per-task commit strategy, rollback snapshots, and git-aware lifecycle gates, but the code implements almost none of it. Focus-exec runs batches without checking git state. Phase completion doesn't create commits. The auto-runner accumulates cycles of uncommitted changes. The result: users' git history is a mess of manual afterthought commits instead of the clean, bisectable, per-task changelog PAN promises.
|
|
13
|
+
|
|
14
|
+
### 0.2 Demand Evidence
|
|
15
|
+
|
|
16
|
+
| Evidence Type | Source | Finding |
|
|
17
|
+
|--------------|--------|---------|
|
|
18
|
+
| Internal audit (session 29) | Codebase analysis | 10 critical gaps: focus-exec ignores git, phase-complete doesn't commit, auto-runner has no git interaction, panmonty git gates are procedural-only |
|
|
19
|
+
| Competitor gap | Aider (gold standard) | Auto-commits per change + `/undo` = clean reversible history. PAN has neither. |
|
|
20
|
+
| Competitor gap | Copilot Workspace | Issue -> Plan -> Implement -> Validate -> PR flow. PAN's focus-exec does Plan -> Execute with no git bookends. |
|
|
21
|
+
| Architecture debt | git-integration.md vs code | Doc says "Task completed = YES commit" (line 20). Code: `cmdPhaseComplete()` never calls `cmdCommit()`. |
|
|
22
|
+
|
|
23
|
+
### 0.3 Success Criteria
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
SC-1: focus-exec checks git cleanliness before processing any batch item
|
|
27
|
+
SC-2: Phase completion creates an atomic commit with conventional message
|
|
28
|
+
SC-3: focus-auto creates checkpoint commits between cycles
|
|
29
|
+
SC-4: /commit skill handles all 7 scenarios (quick, selective, phase, amend, planning, wip, dry-run)
|
|
30
|
+
SC-5: execGit returns explicit 'not_a_git_repo' when .git doesn't exist
|
|
31
|
+
SC-6: No regression in 1557+ existing tests
|
|
32
|
+
SC-7: Works identically on Windows, Mac, Linux (CI matrix: 3 OS x 3 Node)
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Phase 1: Internal Reconnaissance — Current State
|
|
38
|
+
|
|
39
|
+
### What Works (keep)
|
|
40
|
+
| Capability | Location | Status |
|
|
41
|
+
|-----------|----------|--------|
|
|
42
|
+
| `execGit(cwd, args)` | core.cjs:217-232 | Solid — safe `execFileSync`, structured return |
|
|
43
|
+
| `isGitIgnored(cwd, path)` | core.cjs:199-209 | Works |
|
|
44
|
+
| `runCommitSafetyChecks()` | commands.cjs:318-356 | Good — deleted files, sensitive patterns |
|
|
45
|
+
| `cmdCommit()` | commands.cjs:358-409 | Works for `.planning/` commits |
|
|
46
|
+
| `cmdRollbackSnapshot()` | commands.cjs:851-886 | Works — tag-based rollback points |
|
|
47
|
+
| `cmdPreflight()` git_clean check | verify.cjs:1038-1050 | Works — counts uncommitted changes |
|
|
48
|
+
| `cmdVerifyCommits()` | verify.cjs:52-70 | Works — batch hash verification |
|
|
49
|
+
|
|
50
|
+
### What's Missing (the 10 gaps)
|
|
51
|
+
|
|
52
|
+
| Gap | Severity | Where It Should Be |
|
|
53
|
+
|-----|----------|-------------------|
|
|
54
|
+
| **G1: Focus-exec doesn't verify git cleanliness** | HIGH | `focus.cjs:cmdFocusExec()` |
|
|
55
|
+
| **G2: No git init for new projects** | MEDIUM | `init.cjs:cmdInitNewProject()` |
|
|
56
|
+
| **G3: Panmonty git checks are doc-only** | HIGH | No code enforces panmonty_protocol.md gates |
|
|
57
|
+
| **G4: Phase completion doesn't commit** | HIGH | `phase.cjs:cmdPhaseComplete()` |
|
|
58
|
+
| **G5: No push automation** | LOW | By design — keep manual |
|
|
59
|
+
| **G6: Focus-auto has no git interaction** | HIGH | `focus.cjs:focusAutoUpdate/Continue` |
|
|
60
|
+
| **G7: Preflight exists but exec doesn't call it** | HIGH | `focus.cjs:cmdFocusExec()` |
|
|
61
|
+
| **G8: No 'not_a_git_repo' explicit error** | MEDIUM | `commands.cjs:cmdCommit()` |
|
|
62
|
+
| **G9: No batch commit helper** | MEDIUM | Missing from `commands.cjs` |
|
|
63
|
+
| **G10: Milestone operations don't commit** | MEDIUM | `milestone.cjs:cmdMilestoneComplete()` |
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Phase 2: Competitive Intelligence Summary
|
|
68
|
+
|
|
69
|
+
### Gold Standards to Learn From
|
|
70
|
+
|
|
71
|
+
**Aider (per-change commits):**
|
|
72
|
+
- Auto-commit after every AI edit — git history = changelog
|
|
73
|
+
- `/undo` reverses last commit (`git reset`)
|
|
74
|
+
- `--dirty-commits` separates user changes from AI changes
|
|
75
|
+
- `--test-cmd` runs tests before committing, auto-fixes failures
|
|
76
|
+
|
|
77
|
+
**Copilot Workspace (workflow integration):**
|
|
78
|
+
- Issue -> Spec -> Plan -> Implement -> Validate -> PR
|
|
79
|
+
- Auto-branching per task, auto-linked PRs
|
|
80
|
+
- Cloud-based validation step before commit
|
|
81
|
+
|
|
82
|
+
### What PAN Should NOT Copy
|
|
83
|
+
- Auto-commit on every file change (too noisy for PAN's batch model)
|
|
84
|
+
- Auto-branching (PAN users work on single branch, feature branches are user choice)
|
|
85
|
+
- Cloud validation (PAN is zero-dep, local-only)
|
|
86
|
+
|
|
87
|
+
### What PAN Should CREATE (Blue Ocean)
|
|
88
|
+
- **Batch-aware commits**: One commit per focus-exec item, with phase-scoped messages
|
|
89
|
+
- **Lifecycle git gates**: Preflight before execution, commit after completion, tag at milestones
|
|
90
|
+
- **WIP checkpoints**: Auto-runner creates `wip:` commits between cycles
|
|
91
|
+
- **Commit-or-warn paradigm**: Never silently accumulate uncommitted work
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Phase 3: Strategic Design
|
|
96
|
+
|
|
97
|
+
### Architecture: Git Integration Layers
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
Layer 4: Skills (.claude/commands/commit.md) ← User-facing, AI-interpreted
|
|
101
|
+
Layer 3: Orchestrators (focus-exec, panmonty, etc.) ← Call Layer 2 at lifecycle points
|
|
102
|
+
Layer 2: Commands (cmdCommit, cmdRollbackSnapshot) ← High-level git operations
|
|
103
|
+
Layer 1: Primitives (execGit, isGitIgnored) ← Safe git execution
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
**Principle: Git logic lives in Layer 2-3, never Layer 4 alone.** The current commit.md (Layer 4) describes git checks that should be ENFORCED in code (Layer 2-3), not just suggested to an AI.
|
|
107
|
+
|
|
108
|
+
### Implementation Plan: 8 Work Items
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
### Item 1: `isGitRepo(cwd)` helper + explicit error in cmdCommit
|
|
113
|
+
**Size:** XS (1 pt) | **Priority:** P1 | **Track:** stability
|
|
114
|
+
**Files:** `core.cjs`, `commands.cjs`
|
|
115
|
+
|
|
116
|
+
Add to `core.cjs`:
|
|
117
|
+
```javascript
|
|
118
|
+
function isGitRepo(cwd) {
|
|
119
|
+
const result = execGit(cwd, ['rev-parse', '--is-inside-work-tree']);
|
|
120
|
+
return result.exitCode === 0;
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Update `cmdCommit()` to return `{ committed: false, reason: 'not_a_git_repo' }` explicitly when `isGitRepo()` returns false. Currently it returns a vague `commit_failed`.
|
|
125
|
+
|
|
126
|
+
Export `isGitRepo` for use by other modules.
|
|
127
|
+
|
|
128
|
+
**Tests:** 3 unit (isGitRepo true/false/non-dir), 2 integration (cmdCommit in non-git dir)
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
### Item 2: Git cleanliness gate in focus-exec
|
|
133
|
+
**Size:** S (3 pts) | **Priority:** P1 | **Track:** stability
|
|
134
|
+
**Files:** `focus.cjs`
|
|
135
|
+
|
|
136
|
+
Before `cmdFocusExec()` processes any batch item, check:
|
|
137
|
+
```javascript
|
|
138
|
+
const { execGit } = require('./core.cjs');
|
|
139
|
+
const status = execGit(cwd, ['status', '--porcelain']);
|
|
140
|
+
if (status.exitCode === 0 && status.stdout) {
|
|
141
|
+
// Dirty working tree
|
|
142
|
+
return output({ error: 'dirty_working_tree', uncommitted_count: status.stdout.split('\n').filter(Boolean).length, hint: 'Commit or stash changes before running focus-exec' }, raw, 'blocked');
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Add `--force` flag to bypass (for users who know what they're doing).
|
|
147
|
+
|
|
148
|
+
**Tests:** 4 unit (clean/dirty/non-git/force-override), 2 integration
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
### Item 3: Phase completion auto-commit
|
|
153
|
+
**Size:** S (3 pts) | **Priority:** P1 | **Track:** feature
|
|
154
|
+
**Files:** `phase.cjs`, `commands.cjs`
|
|
155
|
+
|
|
156
|
+
When `cmdPhaseComplete()` succeeds (roadmap + state updated), call `cmdCommit()` internally:
|
|
157
|
+
```javascript
|
|
158
|
+
// After roadmap/state updates succeed:
|
|
159
|
+
const commitMsg = `docs(${phaseId}): complete phase — ${phaseName}`;
|
|
160
|
+
cmdCommit(cwd, commitMsg, [PLANNING_DIR + '/'], false, false, { type: 'docs' });
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
This only commits `.planning/` files (metadata). Code commits are the user's responsibility during task execution.
|
|
164
|
+
|
|
165
|
+
Add `--no-commit` flag to skip if user doesn't want auto-commit.
|
|
166
|
+
|
|
167
|
+
**Tests:** 3 unit (commit created, no-commit flag, non-git graceful), 2 integration
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
### Item 4: Milestone completion auto-commit + tag
|
|
172
|
+
**Size:** S (2 pts) | **Priority:** P2 | **Track:** feature
|
|
173
|
+
**Files:** `milestone.cjs`, `commands.cjs`
|
|
174
|
+
|
|
175
|
+
When `cmdMilestoneComplete()` succeeds:
|
|
176
|
+
1. Commit `.planning/` with `docs: milestone vX.Y complete`
|
|
177
|
+
2. Create tag: `milestone-vX.Y`
|
|
178
|
+
|
|
179
|
+
**Tests:** 3 unit, 1 integration
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
### Item 5: Focus-auto cycle checkpoint commits
|
|
184
|
+
**Size:** M (5 pts) | **Priority:** P2 | **Track:** feature
|
|
185
|
+
**Files:** `focus.cjs`
|
|
186
|
+
|
|
187
|
+
After each auto-runner cycle completes (`focusAutoUpdate`):
|
|
188
|
+
1. Check if there are uncommitted `.planning/` changes
|
|
189
|
+
2. If yes, create: `docs: focus-auto cycle N — processed M items`
|
|
190
|
+
3. Update auto-run.json with last_commit_hash
|
|
191
|
+
|
|
192
|
+
This prevents multi-cycle runs from accumulating unbounded uncommitted metadata.
|
|
193
|
+
|
|
194
|
+
Add config option `focus.auto_commit: true|false` (default: true).
|
|
195
|
+
|
|
196
|
+
**Tests:** 4 unit (commit-per-cycle, no-change skip, config disable, non-git), 2 integration
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
### Item 6: Batch commit helper for focus-exec results
|
|
201
|
+
**Size:** S (3 pts) | **Priority:** P2 | **Track:** feature
|
|
202
|
+
**Files:** `commands.cjs`
|
|
203
|
+
|
|
204
|
+
New function `cmdBatchCommit(cwd, items, raw)`:
|
|
205
|
+
- Takes array of completed batch items
|
|
206
|
+
- Creates single commit: `docs: focus-exec batch — N items completed`
|
|
207
|
+
- Body lists item titles
|
|
208
|
+
- Only commits `.planning/` metadata, not code
|
|
209
|
+
|
|
210
|
+
This is called by orchestrators (focus-exec, execplan) after processing a batch, not by users directly.
|
|
211
|
+
|
|
212
|
+
**Tests:** 3 unit, 2 integration
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
### Item 7: `git init` in new project initialization
|
|
217
|
+
**Size:** XS (1 pt) | **Priority:** P3 | **Track:** stability
|
|
218
|
+
**Files:** `init.cjs`
|
|
219
|
+
|
|
220
|
+
In `cmdInitNewProject()`, after creating `.planning/` structure:
|
|
221
|
+
```javascript
|
|
222
|
+
if (!isGitRepo(cwd)) {
|
|
223
|
+
execGit(cwd, ['init']);
|
|
224
|
+
// Don't fail if git init fails — it's a convenience, not a requirement
|
|
225
|
+
}
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
Match what `git-integration.md` line 32 promises: "PAN projects always get their own repo."
|
|
229
|
+
|
|
230
|
+
**Tests:** 2 unit (init creates repo, existing repo untouched)
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
### Item 8: Build/check skills git status integration
|
|
235
|
+
**Size:** XS (1 pt) | **Priority:** P3 | **Track:** quality
|
|
236
|
+
**Files:** `.claude/commands/check.md`, `.claude/commands/build.md`
|
|
237
|
+
|
|
238
|
+
Update `/check` to include git status in health report:
|
|
239
|
+
```
|
|
240
|
+
Git: main (clean) | 3 ahead, 0 behind
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
Update `/build` to warn if building with uncommitted changes.
|
|
244
|
+
|
|
245
|
+
These are skill-level changes only (Layer 4) — no code changes needed.
|
|
246
|
+
|
|
247
|
+
**Tests:** None (skill files, not code)
|
|
248
|
+
|
|
249
|
+
---
|
|
250
|
+
|
|
251
|
+
## Implementation Order & Dependencies
|
|
252
|
+
|
|
253
|
+
```
|
|
254
|
+
Item 1: isGitRepo helper (no deps)
|
|
255
|
+
├─→ Item 2: focus-exec git gate (needs isGitRepo)
|
|
256
|
+
├─→ Item 3: phase-complete auto-commit (needs isGitRepo)
|
|
257
|
+
├─→ Item 4: milestone-complete auto-commit (needs isGitRepo)
|
|
258
|
+
└─→ Item 7: git init in new project (needs isGitRepo)
|
|
259
|
+
|
|
260
|
+
Item 6: batch commit helper (no deps)
|
|
261
|
+
└─→ Item 5: focus-auto cycle commits (needs batch commit)
|
|
262
|
+
|
|
263
|
+
Item 8: skill updates (no deps, no code)
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
**Wave 1 (P1, parallel):** Items 1 + 6 + 8
|
|
267
|
+
**Wave 2 (P1, needs Wave 1):** Items 2 + 3
|
|
268
|
+
**Wave 3 (P2):** Items 4 + 5
|
|
269
|
+
**Wave 4 (P3):** Item 7
|
|
270
|
+
|
|
271
|
+
### Effort Summary
|
|
272
|
+
| Wave | Items | Points | Tests |
|
|
273
|
+
|------|-------|--------|-------|
|
|
274
|
+
| 1 | 1, 6, 8 | 4 pts | 10 |
|
|
275
|
+
| 2 | 2, 3 | 6 pts | 11 |
|
|
276
|
+
| 3 | 4, 5 | 7 pts | 10 |
|
|
277
|
+
| 4 | 7 | 1 pt | 2 |
|
|
278
|
+
| **Total** | **8 items** | **18 pts** | **33 tests** |
|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
|
|
282
|
+
## Risk Register
|
|
283
|
+
|
|
284
|
+
| Risk | Probability | Impact | Mitigation |
|
|
285
|
+
|------|------------|--------|------------|
|
|
286
|
+
| Auto-commits annoy users | Medium | Medium | All auto-commits have `--no-commit` bypass + config toggle |
|
|
287
|
+
| Non-git repos break | Low | High | `isGitRepo()` gate on every git path; graceful fallback |
|
|
288
|
+
| Focus-exec git gate blocks CI | Low | Medium | `--force` flag bypasses; CI can set config |
|
|
289
|
+
| Phase-complete commit fails (disk) | Low | Medium | try-catch, surface warning, don't fail the phase completion |
|
|
290
|
+
| Windows path issues in git add | Low | Medium | Already using `execFileSync('git', args)` — no shell interpolation |
|
|
291
|
+
|
|
292
|
+
---
|
|
293
|
+
|
|
294
|
+
## What This Does NOT Include (Intentionally)
|
|
295
|
+
|
|
296
|
+
- **Auto-branching / PR creation** — Out of scope. PAN is branch-agnostic by design.
|
|
297
|
+
- **Push automation** — Intentionally manual. Too dangerous to automate.
|
|
298
|
+
- **Merge conflict resolution** — No AI tool does this well. Leave to user.
|
|
299
|
+
- **Undo/rollback command** — `cmdRollbackSnapshot()` already exists. Could be enhanced later.
|
|
300
|
+
- **Per-task commits during execution** — This is the EXECUTOR agent's responsibility, not infrastructure. The reference doc (`git-integration.md`) guides the agent.
|
|
301
|
+
|
|
302
|
+
---
|
|
303
|
+
|
|
304
|
+
## ADR: Git Lifecycle Gates in PAN Wizard
|
|
305
|
+
|
|
306
|
+
### Status
|
|
307
|
+
Proposed
|
|
308
|
+
|
|
309
|
+
### Context
|
|
310
|
+
PAN Wizard's documentation describes comprehensive git integration (per-task commits, git cleanliness gates, rollback snapshots), but the code only implements the primitives (`execGit`, `cmdCommit`). Orchestrators (focus-exec, auto-runner, phase lifecycle) have zero git awareness. This creates a gap where users follow PAN's workflow but end up with messy git history because the system never enforces its own git strategy.
|
|
311
|
+
|
|
312
|
+
### Decision
|
|
313
|
+
Add git lifecycle gates at orchestrator boundaries (before/after focus-exec, on phase/milestone completion, between auto-runner cycles). Keep gates soft (bypassable with flags/config) but default to enforcing clean git discipline.
|
|
314
|
+
|
|
315
|
+
### Consequences
|
|
316
|
+
**Positive:**
|
|
317
|
+
- Git history reflects PAN's per-task commit philosophy automatically
|
|
318
|
+
- Focus-exec won't silently accumulate uncommitted work
|
|
319
|
+
- Phase/milestone completions are tracked in git, not just STATE.md
|
|
320
|
+
|
|
321
|
+
**Negative:**
|
|
322
|
+
- Users with non-git workflows will see warnings (mitigated by `--force` + config)
|
|
323
|
+
- Slight overhead on each orchestrator call (one `git status` check)
|
|
324
|
+
|
|
325
|
+
**Neutral:**
|
|
326
|
+
- Existing `cmdCommit()` API unchanged — new callers added, not new API
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
# /featureAI — GLM (z.ai) Provider Support & ZCode Interop
|
|
2
|
+
|
|
3
|
+
**Status:** Proposed — not implemented; ZCode Surface B superseded by [`docs/specs/pan_zcode_mcp_bridge_featureai.md`](pan_zcode_mcp_bridge_featureai.md) / ADR-0041.
|
|
4
|
+
**Source:** User request — "make PAN work with ZCode / GLM."
|
|
5
|
+
**Lineage:** Concrete, shippable instance of [`multi_model_routing_featureai.md`](multi_model_routing_featureai.md) (that spec anticipated non-Anthropic providers; this one lands the first real one). Reuses the existing `PROVIDER_MODELS` / `detectProvider` / `resolveTierToModel` seam.
|
|
6
|
+
|
|
7
|
+
> GLM = Zhipu AI's model family, sold internationally as **z.ai**. The **GLM Coding Plan** is a flat-fee subscription exposing an **Anthropic-compatible** endpoint (`https://api.z.ai/api/anthropic`). GLM-5.2 (16 Jun 2026, MIT-licensed, 1M ctx) benches ~between Opus 4.7 and 4.8 on agentic coding. **ZCode** is z.ai's *own* coding-agent harness (a Claude-Code peer) built on GLM-5.2.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Phase 0: Problem Framing
|
|
12
|
+
|
|
13
|
+
### 0.1 Problem Statement
|
|
14
|
+
|
|
15
|
+
PAN's bot army is powerful but, in practice, Anthropic-priced. Users on z.ai's flat-fee GLM Coding Plan (a fraction of Claude Code Pro, ~parity on coding benchmarks) currently get PAN *accidentally* working under Claude Code — because Claude Code itself remaps `opus/sonnet/haiku` → GLM via `ANTHROPIC_DEFAULT_*_MODEL` env vars, and PAN already emits those tier tokens rather than hardcoded IDs. But that "accidental" path is unmanaged: PAN believes it's on Anthropic, the installer **false-warns** that the model lacks 1M-context/thinking, the cost ledger fabricates per-token dollars against a flat-fee plan, and there is **zero** provisioning help (the user hand-edits `settings.json`). PAN should make GLM a *first-class, provisioned, honestly-labelled* backend across the runtimes that actually support it — and give an honest answer on ZCode.
|
|
16
|
+
|
|
17
|
+
### 0.2 Scope
|
|
18
|
+
|
|
19
|
+
| In Scope | Out of Scope |
|
|
20
|
+
|----------|--------------|
|
|
21
|
+
| GLM/z.ai as a recognized **backend** + `zhipu` tier-provider | PAN making direct API calls to z.ai (PAN always delegates to the host CLI) |
|
|
22
|
+
| Provisioning z.ai config into **Claude Code** (`.claude/settings.json` env) and **OpenCode** (`opencode.json` provider) | Persisting the z.ai **API token** in any committed file (security — token stays in shell env / gitignored local settings) |
|
|
23
|
+
| `detectProvider` recognizing GLM (config / `PAN_PROVIDER` / `ANTHROPIC_BASE_URL`) | A generic "any OpenAI/Anthropic-compatible endpoint" wizard (GLM is the concrete target; generic BYO-endpoint is a follow-up) |
|
|
24
|
+
| GLM branch in `detectModelCapabilities` (stop the false 1M-ctx/thinking warning) | Benchmarking or auto-selecting GLM vs Claude per task |
|
|
25
|
+
| Cost honesty for flat-fee plans (no fabricated `$`) | Token/quota metering of the z.ai subscription |
|
|
26
|
+
| `/pan:provider` command + `pan-tools provider` verb | Codex / Gemini / Copilot GLM paths (not z.ai-blessed targets — see matrix) |
|
|
27
|
+
| **ZCode**: honest feasibility verdict + a *partial* `~/.zcode/agents/` agent-pack path | ZCode as a full 6th runtime (blocked — ZCode has no custom slash-commands / project config / hooks today) |
|
|
28
|
+
|
|
29
|
+
### 0.3 Success Criteria (Measurable)
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
SC-1: `routing.provider: "zhipu"` (aliases glm/zai) resolves — no silent downgrade to 'default'.
|
|
33
|
+
SC-2: PROVIDER_MODELS gains a `zhipu` entry; resolveTierToModel('mid','zhipu') → a GLM id; reasoning stays 'inherit'.
|
|
34
|
+
SC-3: detectProvider recognizes GLM via (a) config.routing.provider, (b) PAN_PROVIDER=glm, (c) ANTHROPIC_BASE_URL containing an allowlisted z.ai host.
|
|
35
|
+
SC-4: detectModelCapabilities('glm-5.2' / 'GLM-4.7' / 'glm-4.5-air') returns has_1m_ctx/has_thinking correctly; the installer E-9 warning no longer fires for GLM.
|
|
36
|
+
SC-5: `pan-tools provider set glm` provisions Claude Code (.claude/settings.json env block: ANTHROPIC_BASE_URL, ANTHROPIC_DEFAULT_{OPUS,SONNET,HAIKU}_MODEL, API_TIMEOUT_MS) — and NEVER writes the auth token to a tracked file.
|
|
37
|
+
SC-6: `pan-tools provider set glm` provisions OpenCode (opencode.json custom @ai-sdk/anthropic provider, baseURL …/anthropic/v1, GLM models).
|
|
38
|
+
SC-7: `pan-tools provider show` reports the active backend + effective tier→model mapping; `provider clear` reverts.
|
|
39
|
+
SC-8: Cost surfaces (cost.cjs / hud / report) show tokens + a "flat-fee plan" note instead of a fabricated $0.00 when backend=zai.
|
|
40
|
+
SC-9: Running `pan-tools provider set glm` for Codex/Gemini/Copilot prints a clear "not a supported z.ai target" message and makes no changes.
|
|
41
|
+
SC-10: Unit + scenario tests cover provider resolution, capability branch, provisioning (both runtimes), secret-safety, and the unsupported-runtime guard (≥10 cases, incl. 2 runtime-specific + 2 error).
|
|
42
|
+
SC-11: No regression; existing behavior identical when no GLM backend is configured (default path untouched).
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### 0.4 User Stories
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
US-1: As a GLM Coding Plan subscriber, I want `pan-tools provider set glm` to wire up
|
|
49
|
+
Claude Code for me, so the whole PAN bot army runs on GLM at flat-fee cost,
|
|
50
|
+
instead of hand-editing settings.json and guessing the env var names.
|
|
51
|
+
|
|
52
|
+
US-2: As an OpenCode user, I want PAN to register z.ai as a custom provider and emit
|
|
53
|
+
real glm-* model ids, so my agents actually route to GLM,
|
|
54
|
+
instead of OpenCode choking on the bare tier token "sonnet".
|
|
55
|
+
|
|
56
|
+
US-3: As any GLM user, I want PAN to stop telling me my model "lacks 1M context and
|
|
57
|
+
extended thinking" and stop inventing a $0.00 spend, so the HUD/report tell the
|
|
58
|
+
truth about a flat-fee GLM plan.
|
|
59
|
+
|
|
60
|
+
US-4: As a ZCode user, I want an honest answer on whether PAN runs inside ZCode today,
|
|
61
|
+
and the closest thing that does work, instead of a half-broken install.
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Phase 1: Internal Reconnaissance (findings)
|
|
67
|
+
|
|
68
|
+
PAN already has the *exact* abstraction this needs; it just has no notion of a custom **endpoint/backend**.
|
|
69
|
+
|
|
70
|
+
| Seam | Location | Today | GLM change |
|
|
71
|
+
|------|----------|-------|-----------|
|
|
72
|
+
| Tier→ID map | `core.cjs:35-40` `PROVIDER_MODELS` | `anthropic/openai/google/default` | **add `zhipu`** `{ reasoning:'inherit', mid:'glm-4.6', fast:'glm-4.5-air' }` |
|
|
73
|
+
| Legacy aliases | `core.cjs:43` `LEGACY_ALIASES` | opus/sonnet/haiku → reasoning/mid/fast | unchanged (GLM inherits the same tiers) |
|
|
74
|
+
| Provider detect | `core.cjs:714-735` `detectProvider` | config → `PAN_PROVIDER` → runtime-dir | **add** glm/zai alias acceptance + `ANTHROPIC_BASE_URL` z.ai sniff |
|
|
75
|
+
| Tier resolve | `core.cjs:743-747` `resolveTierToModel` | unknown provider → default; unknown tier → mid | unchanged (graceful; no allowlist to fight) |
|
|
76
|
+
| Agent model decl | `agents/*.md` frontmatter | tier alias only (`model: opus` on 3 security agents); **never full IDs** | unchanged — this is *why* GLM already flows under Claude Code |
|
|
77
|
+
| Installer model writes | `install.js:2337-2451` | **never writes model/provider/endpoint**; only *reads* `.claude` `model` for E-9 warn (`install.js:2477-2501`) | **new**: opt-in provider provisioning path |
|
|
78
|
+
| Capability classifier | `install-lib.cjs:1013-1071` `detectModelCapabilities` | no GLM branch → GLM falls to `unknown` (all caps false) → false warning | **add GLM branch** |
|
|
79
|
+
| Config defaults | `config.cjs:42-95` `buildConfigDefaults` | emits `routing{strategy,provider:'auto',…}`; **not** in `templates/config.json` | add optional `routing.backend`; (note the template/loader divergence) |
|
|
80
|
+
| Cost | `cost.cjs` per-token pricing + `ledgerReliability()` honesty | prices by model id; GLM unpriced | **flat-fee mode** when backend=zai (reuse honesty pattern) |
|
|
81
|
+
| Model catalog | — | **none** — no allowlist anywhere | nothing to gate; only `PROVIDER_MODELS` + `detectModelCapabilities` enumerate identity |
|
|
82
|
+
|
|
83
|
+
**Decisive fact:** PAN emits *tier tokens*, and Claude Code remaps them to GLM via env vars. So GLM already works under Claude Code — the feature is about *managing, provisioning, and telling the truth about* that path, plus adding the OpenCode path.
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Phase 2: Competitive Analysis
|
|
88
|
+
|
|
89
|
+
`docs/COMPARISON.md:24` already claims *"Multi-model routing (tier aliases + provider mapping)"* as a PAN differentiator — GLM makes that claim real for the value-leader backend of 2026. Peers: OpenCode/Cline/Kilo expose raw provider config (powerful, but the user assembles the JSON themselves); Claude Code takes env vars (no product-level notion of "provider = GLM"). **PAN's differentiation:** a one-command, tier-aware, *honest* GLM switch that carries the whole bot-army model policy (profiles, per-agent pins, effort) across the swap — and refuses to fake costs on a flat-fee plan.
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## Phase 3: Design
|
|
94
|
+
|
|
95
|
+
### 3.1 Two integration surfaces
|
|
96
|
+
|
|
97
|
+
**Surface A — GLM through PAN's existing runtimes (primary, feasible now).**
|
|
98
|
+
Point Claude Code / OpenCode at z.ai's Anthropic-compatible endpoint. This is where ~all the value is and where the work lands.
|
|
99
|
+
|
|
100
|
+
**Surface B — ZCode as a runtime (deferred/partial).**
|
|
101
|
+
ZCode's documented extensibility = subagents in `~/.zcode/agents/` (Markdown, `@name`), MCP, and a nascent skills/plugin system. It has **no** custom slash-commands, **no** project-level config dir, **no** hooks, **no** headless mode. PAN is command- and hook-heavy (58 commands, 5 hooks), so a *full* PAN-on-ZCode install is **not possible today**. Feasible subset: a "ZCode agent pack" — install PAN's `agents/*.md` into `~/.zcode/agents/` (they're already Markdown) + optionally register `pan-tools` as an MCP server. Recommendation: **ship Surface A now; track ZCode's roadmap** (gate the pack behind ZCode gaining command/config extensibility).
|
|
102
|
+
|
|
103
|
+
### 3.2 The key abstraction: separate **tier-provider** from **backend**
|
|
104
|
+
|
|
105
|
+
- `routing.provider` (existing) answers *"what model token do I emit?"* — for **Claude-Code-on-GLM** it stays `anthropic` (the host remaps sonnet/haiku→GLM); for **OpenCode-on-GLM** it becomes `zhipu` (emit real `glm-*` ids).
|
|
106
|
+
- `routing.backend` (**new**, e.g. `"zai"`) answers *"what service actually answers?"* — this single marker drives capability detection, cost honesty, telemetry labels, and provisioning, **without** contorting the tier map. Absent/`null` = today's behavior exactly.
|
|
107
|
+
|
|
108
|
+
### 3.3 Architecture decisions
|
|
109
|
+
|
|
110
|
+
1. **`PROVIDER_MODELS.zhipu`** (`core.cjs`): `{ reasoning:'inherit', mid:'glm-4.6', fast:'glm-4.5-air' }`. Model ids sourced from a single `GLM_MODELS` constant so a version bump is one edit. `reasoning:'inherit'` lets the host pick its top GLM (via `ANTHROPIC_DEFAULT_OPUS_MODEL` under Claude Code, or the provider's default under OpenCode).
|
|
111
|
+
2. **`detectProvider`** (`core.cjs`): accept `glm`/`zai` as aliases of `zhipu`; add an env sniff — if `ANTHROPIC_BASE_URL` matches an **allowlisted** z.ai host (exact host compare, not substring), infer backend=zai. (Host allowlist constant, not a regex over user input — avoids the taint-barrier pitfalls from the report/hud work.)
|
|
112
|
+
3. **`detectModelCapabilities`** (`install-lib.cjs`): add a `glm` branch → `{ has_1m_ctx:true, has_thinking:true, has_cache:true, tier: <by name> }` for glm-5._/glm-4.7; and when `backend=zai`, suppress the E-9 warning entirely.
|
|
113
|
+
4. **Provisioning** — new module `provider.cjs` + dispatcher verb `provider set|show|clear <name>` and command `commands/pan/provider.md`:
|
|
114
|
+
- **Claude Code:** merge an `env` block into `.claude/settings.json`: `ANTHROPIC_BASE_URL`, `ANTHROPIC_DEFAULT_OPUS_MODEL`, `ANTHROPIC_DEFAULT_SONNET_MODEL`, `ANTHROPIC_DEFAULT_HAIKU_MODEL`, `API_TIMEOUT_MS`. **Never** `ANTHROPIC_AUTH_TOKEN` in a tracked file — instead (a) instruct the user to `export ANTHROPIC_AUTH_TOKEN=…`, or (b) with explicit `--persist-token`, write it only to `.claude/settings.local.json` (gitignored). Proto-pollution-safe merge (reuse `config.cjs` guard).
|
|
115
|
+
- **OpenCode:** merge a custom provider into `opencode.json`: `@ai-sdk/anthropic`, `options.baseURL = https://api.z.ai/api/anthropic/v1`, `models: { "glm-4.6": {…}, "glm-4.5-air": {…} }`. Set `routing.provider=zhipu` so PAN emits real ids.
|
|
116
|
+
- **Codex/Gemini/Copilot:** no-op + a clear message: *"GLM via <runtime> isn't a supported z.ai target — use `--claude` or `--opencode`."*
|
|
117
|
+
5. **Cost honesty** (`cost.cjs` + `hud.cjs`/`phase-report.cjs` consumers): when `backend=zai`, route through the existing `ledgerReliability()` degradation — show token volume + a "flat-fee GLM Coding Plan (per-token cost N/A)" advisory instead of a dollar figure.
|
|
118
|
+
6. **Installer flag** (`bin/install.js`): `--provider <name>` (and convenience `--zai`) calls the same `provider.cjs` provisioning against the runtimes being installed. Purely additive; no change to the default install.
|
|
119
|
+
|
|
120
|
+
### 3.4 Implementation plan
|
|
121
|
+
|
|
122
|
+
```
|
|
123
|
+
1. pan-wizard-core/bin/lib/core.cjs
|
|
124
|
+
- GLM_MODELS constant; PROVIDER_MODELS.zhipu; detectProvider glm/zai alias + z.ai host sniff;
|
|
125
|
+
thread routing.backend through loadConfig fallback + buildConfig.
|
|
126
|
+
2. pan-wizard-core/bin/lib/config.cjs
|
|
127
|
+
- buildConfigDefaults: routing.backend default (null); document key. (Also close the
|
|
128
|
+
template↔loader routing divergence flagged in recon.)
|
|
129
|
+
3. bin/install-lib.cjs
|
|
130
|
+
- detectModelCapabilities: GLM branch (pure fn, easy to unit test).
|
|
131
|
+
4. pan-wizard-core/bin/lib/provider.cjs (NEW)
|
|
132
|
+
- setProvider/showProvider/clearProvider; per-runtime writers (claude settings.json env,
|
|
133
|
+
opencode.json provider); secret-safety; unsupported-runtime guard.
|
|
134
|
+
5. pan-wizard-core/bin/pan-tools.cjs
|
|
135
|
+
- `provider` dispatch case → provider.cjs.
|
|
136
|
+
6. bin/install.js
|
|
137
|
+
- `--provider`/`--zai` → provider provisioning after runtime install; teach E-9 warn about backend=zai.
|
|
138
|
+
7. pan-wizard-core/bin/lib/cost.cjs (+ hud/report consumers)
|
|
139
|
+
- flat-fee branch when backend=zai.
|
|
140
|
+
8. commands/pan/provider.md (NEW, runtime-agnostic)
|
|
141
|
+
9. pan-wizard-core/references/glm-provider.md (NEW agent-loaded reference)
|
|
142
|
+
10. Docs: CLI-REFERENCE (provider cmd + routing.backend + config row), USER-GUIDE (config table),
|
|
143
|
+
COMPARISON (GLM as the proven backend), FAQ (how do I run PAN on GLM?), README (qualitative).
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### 3.5 Test plan (≥10; 3 happy / 3 edge / 2 error / 2 runtime-specific)
|
|
147
|
+
|
|
148
|
+
```
|
|
149
|
+
tests/provider.test.cjs (NEW)
|
|
150
|
+
happy: set glm on claude writes the 5 env keys (not the token); show reports backend+mapping; clear reverts.
|
|
151
|
+
happy: set glm on opencode writes @ai-sdk/anthropic provider + routing.provider=zhipu.
|
|
152
|
+
resolve: resolveTierToModel('mid','zhipu') → glm-4.6; ('reasoning','zhipu') → 'inherit'; glm/zai alias == zhipu.
|
|
153
|
+
caps: detectModelCapabilities glm-5.2 / GLM-4.7 / glm-4.5-air → 1m/thinking true; unknown-glm-x graceful.
|
|
154
|
+
edge: settings.json already has an env block → merge, don't clobber; proto-pollution key rejected.
|
|
155
|
+
edge: ANTHROPIC_BASE_URL=z.ai host → detectProvider infers backend=zai; look-alike host NOT matched.
|
|
156
|
+
edge: cost with backend=zai → no $ fabricated (tokens + advisory) via ledgerReliability.
|
|
157
|
+
error: `provider set glm` on codex/gemini/copilot → unsupported message, zero writes.
|
|
158
|
+
error: `--persist-token` writes ONLY to .claude/settings.local.json (assert not settings.json, and gitignored).
|
|
159
|
+
runtime: full matrix — claude ✅, opencode ✅, others guarded.
|
|
160
|
+
tests/scenarios/provider-install.test.cjs (NEW)
|
|
161
|
+
`install.js --claude --zai` end-to-end → settings.json env present, token absent, install verifies.
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## Phase 4: Specification Output
|
|
167
|
+
|
|
168
|
+
### Files to Create/Modify
|
|
169
|
+
- **New:** `pan-wizard-core/bin/lib/provider.cjs`, `commands/pan/provider.md`, `pan-wizard-core/references/glm-provider.md`, `tests/provider.test.cjs`, `tests/scenarios/provider-install.test.cjs`.
|
|
170
|
+
- **Modify:** `core.cjs`, `config.cjs`, `install-lib.cjs`, `install.js`, `pan-tools.cjs`, `cost.cjs` (+ hud/report consumers), `templates/config.json`; docs (CLI-REFERENCE, USER-GUIDE, COMPARISON, FAQ, README qualitative); CLAUDE.md counts refresh.
|
|
171
|
+
|
|
172
|
+
### Runtime Matrix
|
|
173
|
+
| Runtime | GLM Supported | Mechanism / Notes |
|
|
174
|
+
|---------|:---:|---|
|
|
175
|
+
| Claude Code | ✅ Full | `.claude/settings.json` `env`: base URL + `ANTHROPIC_DEFAULT_{OPUS,SONNET,HAIKU}_MODEL`; host remaps PAN's tier tokens → GLM. Token via shell env. |
|
|
176
|
+
| OpenCode | ✅ Full | `opencode.json` custom `@ai-sdk/anthropic` provider (baseURL `…/anthropic/v1`); PAN emits real `glm-*` ids (`routing.provider=zhipu`). |
|
|
177
|
+
| Codex | ⚠️ Not a z.ai target | OpenAI-compatible override is technically possible but unsupported by z.ai; guarded no-op + message. |
|
|
178
|
+
| Gemini | ❌ | Google-native; no BYO Anthropic endpoint. |
|
|
179
|
+
| GitHub Copilot | ❌ | GitHub-managed models; no custom endpoint. |
|
|
180
|
+
| **ZCode** (new) | ⚠️ Deferred/partial | Agent-pack into `~/.zcode/agents/` + optional MCP only; no commands/hooks/config → not a full runtime yet. |
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## Phase 5: Risk Assessment
|
|
185
|
+
|
|
186
|
+
| Risk | Impact | Mitigation |
|
|
187
|
+
|------|--------|------------|
|
|
188
|
+
| **Secret leakage** — z.ai token written to a committed `settings.json` | High | Never persist the token by default; non-secret env only; `--persist-token` writes solely to gitignored `settings.local.json`; test asserts token absent from tracked files. |
|
|
189
|
+
| Clobbering a user's existing `settings.json`/`opencode.json` | High | Deep-merge with proto-pollution guard; `provider clear` restores; snapshot the pre-write file. |
|
|
190
|
+
| GLM model ids drift (4.6 → 5.2 → …) | Medium | Single `GLM_MODELS` constant; `reasoning:'inherit'` defers top-tier choice to the host/plan; document that ids track the plan. |
|
|
191
|
+
| Base-URL string reaching a shell / taint barrier | Medium | Fixed allowlisted host constant + exact-host compare; no user string interpolated into any exec (reuse the report/hud opener discipline). |
|
|
192
|
+
| False cost data on flat-fee plan | Medium | `backend=zai` → flat-fee branch via `ledgerReliability()`; never emit a per-token `$`. |
|
|
193
|
+
| Users expect full ZCode support | Low | Spec + docs state the honest partial verdict and the blocking reason up front. |
|
|
194
|
+
| Regression for non-GLM users | Low | Entire path is opt-in behind `backend`/`--provider`; default resolution untouched; SC-11 guards it. |
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
## Recommendation
|
|
199
|
+
|
|
200
|
+
Ship **Surface A** in milestones: **M1** provider awareness (core.cjs + capability branch — GLM stops being mislabelled), **M2** provisioning (`provider.cjs` + `/pan:provider` + `--zai`), **M3** cost honesty + docs. Treat **ZCode** (Surface B) as a tracked, gated follow-up pending ZCode extensibility. Net: PAN's whole bot army runs on the 2026 value-leader backend with one command, and never lies about cost or capability.
|