pan-wizard 2.8.1
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 -0
- package/README.md +772 -0
- package/agents/pan-debugger.md +1246 -0
- package/agents/pan-document_code.md +965 -0
- package/agents/pan-executor.md +469 -0
- package/agents/pan-integration-checker.md +443 -0
- package/agents/pan-phase-researcher.md +572 -0
- package/agents/pan-plan-checker.md +763 -0
- package/agents/pan-planner.md +1297 -0
- package/agents/pan-project-researcher.md +647 -0
- package/agents/pan-research-synthesizer.md +239 -0
- package/agents/pan-reviewer.md +112 -0
- package/agents/pan-roadmapper.md +642 -0
- package/agents/pan-verifier.md +672 -0
- package/assets/pan-logo-2000-transparent.svg +30 -0
- package/assets/pan-logo-2000.svg +43 -0
- package/assets/terminal.svg +119 -0
- package/bin/install-lib.cjs +616 -0
- package/bin/install.js +1936 -0
- package/commands/pan/add-phase.md +44 -0
- package/commands/pan/assumptions.md +47 -0
- package/commands/pan/audit-deployment.md +378 -0
- package/commands/pan/debug.md +168 -0
- package/commands/pan/discord.md +19 -0
- package/commands/pan/discuss-phase.md +84 -0
- package/commands/pan/exec-phase.md +45 -0
- package/commands/pan/focus-auto.md +323 -0
- package/commands/pan/focus-design.md +816 -0
- package/commands/pan/focus-exec.md +316 -0
- package/commands/pan/focus-plan.md +101 -0
- package/commands/pan/focus-scan.md +272 -0
- package/commands/pan/focus-sync.md +104 -0
- package/commands/pan/health.md +23 -0
- package/commands/pan/help.md +23 -0
- package/commands/pan/insert-phase.md +33 -0
- package/commands/pan/map-codebase.md +72 -0
- package/commands/pan/milestone-audit.md +37 -0
- package/commands/pan/milestone-cleanup.md +19 -0
- package/commands/pan/milestone-done.md +137 -0
- package/commands/pan/milestone-gaps.md +35 -0
- package/commands/pan/milestone-new.md +45 -0
- package/commands/pan/new-project.md +43 -0
- package/commands/pan/patches.md +110 -0
- package/commands/pan/pause.md +39 -0
- package/commands/pan/phase-budget.md +23 -0
- package/commands/pan/phase-tests.md +42 -0
- package/commands/pan/plan-phase.md +46 -0
- package/commands/pan/profile.md +36 -0
- package/commands/pan/progress.md +25 -0
- package/commands/pan/quick.md +42 -0
- package/commands/pan/remove-phase.md +32 -0
- package/commands/pan/research-phase.md +190 -0
- package/commands/pan/resume.md +41 -0
- package/commands/pan/retro.md +33 -0
- package/commands/pan/settings.md +37 -0
- package/commands/pan/todo-add.md +48 -0
- package/commands/pan/todo-check.md +46 -0
- package/commands/pan/update.md +38 -0
- package/commands/pan/verify-phase.md +39 -0
- package/hooks/dist/pan-check-update.js +62 -0
- package/hooks/dist/pan-context-monitor.js +122 -0
- package/hooks/dist/pan-statusline.js +108 -0
- package/package.json +66 -0
- package/pan-wizard-core/bin/lib/codebase.cjs +746 -0
- package/pan-wizard-core/bin/lib/commands.cjs +1435 -0
- package/pan-wizard-core/bin/lib/config.cjs +611 -0
- package/pan-wizard-core/bin/lib/constants.cjs +696 -0
- package/pan-wizard-core/bin/lib/context-budget.cjs +150 -0
- package/pan-wizard-core/bin/lib/core.cjs +650 -0
- package/pan-wizard-core/bin/lib/focus.cjs +900 -0
- package/pan-wizard-core/bin/lib/frontmatter.cjs +442 -0
- package/pan-wizard-core/bin/lib/init.cjs +881 -0
- package/pan-wizard-core/bin/lib/milestone.cjs +276 -0
- package/pan-wizard-core/bin/lib/phase.cjs +1212 -0
- package/pan-wizard-core/bin/lib/roadmap.cjs +470 -0
- package/pan-wizard-core/bin/lib/state.cjs +1029 -0
- package/pan-wizard-core/bin/lib/template.cjs +314 -0
- package/pan-wizard-core/bin/lib/utils.cjs +171 -0
- package/pan-wizard-core/bin/lib/verify.cjs +1808 -0
- package/pan-wizard-core/bin/pan-tools.cjs +773 -0
- package/pan-wizard-core/references/checkpoints.md +776 -0
- package/pan-wizard-core/references/continuation-format.md +249 -0
- package/pan-wizard-core/references/decimal-phase-calculation.md +65 -0
- package/pan-wizard-core/references/git-integration.md +248 -0
- package/pan-wizard-core/references/git-planning-commit.md +38 -0
- package/pan-wizard-core/references/model-profile-resolution.md +34 -0
- package/pan-wizard-core/references/model-profiles.md +111 -0
- package/pan-wizard-core/references/phase-argument-parsing.md +61 -0
- package/pan-wizard-core/references/planning-config.md +196 -0
- package/pan-wizard-core/references/questioning.md +145 -0
- package/pan-wizard-core/references/tdd.md +263 -0
- package/pan-wizard-core/references/ui-brand.md +160 -0
- package/pan-wizard-core/references/verification-patterns.md +612 -0
- package/pan-wizard-core/templates/codebase/architecture.md +283 -0
- package/pan-wizard-core/templates/codebase/best-practices.md +133 -0
- package/pan-wizard-core/templates/codebase/concerns.md +325 -0
- package/pan-wizard-core/templates/codebase/conventions.md +307 -0
- package/pan-wizard-core/templates/codebase/integrations.md +305 -0
- package/pan-wizard-core/templates/codebase/relationships.md +124 -0
- package/pan-wizard-core/templates/codebase/stack.md +199 -0
- package/pan-wizard-core/templates/codebase/structure.md +298 -0
- package/pan-wizard-core/templates/codebase/testing.md +480 -0
- package/pan-wizard-core/templates/config.json +37 -0
- package/pan-wizard-core/templates/context.md +283 -0
- package/pan-wizard-core/templates/continue-here.md +78 -0
- package/pan-wizard-core/templates/debug-subagent-prompt.md +91 -0
- package/pan-wizard-core/templates/debug.md +164 -0
- package/pan-wizard-core/templates/discovery.md +146 -0
- package/pan-wizard-core/templates/milestone-archive.md +123 -0
- package/pan-wizard-core/templates/milestone.md +115 -0
- package/pan-wizard-core/templates/phase-prompt.md +593 -0
- package/pan-wizard-core/templates/planner-subagent-prompt.md +117 -0
- package/pan-wizard-core/templates/project.md +184 -0
- package/pan-wizard-core/templates/requirements.md +231 -0
- package/pan-wizard-core/templates/research-project/architecture.md +204 -0
- package/pan-wizard-core/templates/research-project/features.md +147 -0
- package/pan-wizard-core/templates/research-project/pitfalls.md +200 -0
- package/pan-wizard-core/templates/research-project/stack.md +120 -0
- package/pan-wizard-core/templates/research-project/summary.md +170 -0
- package/pan-wizard-core/templates/research.md +552 -0
- package/pan-wizard-core/templates/retrospective.md +54 -0
- package/pan-wizard-core/templates/roadmap.md +202 -0
- package/pan-wizard-core/templates/standards.md +24 -0
- package/pan-wizard-core/templates/state.md +176 -0
- package/pan-wizard-core/templates/summary-complex.md +59 -0
- package/pan-wizard-core/templates/summary-minimal.md +41 -0
- package/pan-wizard-core/templates/summary-standard.md +49 -0
- package/pan-wizard-core/templates/summary.md +249 -0
- package/pan-wizard-core/templates/uat.md +247 -0
- package/pan-wizard-core/templates/user-setup.md +311 -0
- package/pan-wizard-core/templates/validation.md +76 -0
- package/pan-wizard-core/templates/verification-report.md +322 -0
- package/pan-wizard-core/workflows/add-phase.md +111 -0
- package/pan-wizard-core/workflows/assumptions.md +178 -0
- package/pan-wizard-core/workflows/diagnose-issues.md +219 -0
- package/pan-wizard-core/workflows/discuss-phase.md +542 -0
- package/pan-wizard-core/workflows/exec-phase.md +572 -0
- package/pan-wizard-core/workflows/execute-plan.md +448 -0
- package/pan-wizard-core/workflows/health.md +156 -0
- package/pan-wizard-core/workflows/help.md +431 -0
- package/pan-wizard-core/workflows/insert-phase.md +129 -0
- package/pan-wizard-core/workflows/map-codebase.md +401 -0
- package/pan-wizard-core/workflows/milestone-audit.md +297 -0
- package/pan-wizard-core/workflows/milestone-cleanup.md +152 -0
- package/pan-wizard-core/workflows/milestone-gaps.md +274 -0
- package/pan-wizard-core/workflows/milestone-new.md +382 -0
- package/pan-wizard-core/workflows/new-project.md +1178 -0
- package/pan-wizard-core/workflows/pause.md +122 -0
- package/pan-wizard-core/workflows/phase-tests.md +388 -0
- package/pan-wizard-core/workflows/plan-phase.md +569 -0
- package/pan-wizard-core/workflows/profile.md +115 -0
- package/pan-wizard-core/workflows/progress.md +381 -0
- package/pan-wizard-core/workflows/quick.md +453 -0
- package/pan-wizard-core/workflows/remove-phase.md +154 -0
- package/pan-wizard-core/workflows/research-phase.md +73 -0
- package/pan-wizard-core/workflows/resume-project.md +306 -0
- package/pan-wizard-core/workflows/retro.md +121 -0
- package/pan-wizard-core/workflows/settings.md +213 -0
- package/pan-wizard-core/workflows/todo-add.md +157 -0
- package/pan-wizard-core/workflows/todo-check.md +176 -0
- package/pan-wizard-core/workflows/transition.md +544 -0
- package/pan-wizard-core/workflows/update.md +219 -0
- package/pan-wizard-core/workflows/verify-phase.md +301 -0
- package/scripts/build-hooks.js +43 -0
|
@@ -0,0 +1,696 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Constants — Shared path constants, file patterns, and regex patterns
|
|
3
|
+
*
|
|
4
|
+
* All hardcoded strings that appear across multiple modules are centralized here.
|
|
5
|
+
* Import from this module instead of using inline string literals.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// ─── Directory names ─────────────────────────────────────────────────────────
|
|
9
|
+
|
|
10
|
+
const PLANNING_DIR = '.planning';
|
|
11
|
+
const PHASES_DIR = 'phases';
|
|
12
|
+
const MILESTONES_DIR = 'milestones';
|
|
13
|
+
const CODEBASE_DIR = 'codebase';
|
|
14
|
+
const QUICK_DIR = 'quick';
|
|
15
|
+
|
|
16
|
+
// ─── File names ──────────────────────────────────────────────────────────────
|
|
17
|
+
|
|
18
|
+
const STATE_FILE = 'state.md';
|
|
19
|
+
const ROADMAP_FILE = 'roadmap.md';
|
|
20
|
+
const CONFIG_FILE = 'config.json';
|
|
21
|
+
const PROJECT_FILE = 'project.md';
|
|
22
|
+
const REQUIREMENTS_FILE = 'requirements.md';
|
|
23
|
+
const PAUSE_FILE = 'pause.md';
|
|
24
|
+
const PATTERNS_FILE = 'patterns.md';
|
|
25
|
+
const SESSION_HISTORY_FILE = 'session-history.md';
|
|
26
|
+
const LEARNINGS_FILE = 'learnings.md';
|
|
27
|
+
|
|
28
|
+
// ─── File suffixes ───────────────────────────────────────────────────────────
|
|
29
|
+
|
|
30
|
+
const PLAN_SUFFIX = '-plan.md';
|
|
31
|
+
const SUMMARY_SUFFIX = '-summary.md';
|
|
32
|
+
const CONTEXT_SUFFIX = '-context.md';
|
|
33
|
+
const RESEARCH_SUFFIX = '-research.md';
|
|
34
|
+
const VERIFICATION_SUFFIX = '-verification.md';
|
|
35
|
+
const UAT_SUFFIX = '-uat.md';
|
|
36
|
+
|
|
37
|
+
// ─── File matching helpers ───────────────────────────────────────────────────
|
|
38
|
+
|
|
39
|
+
/** Check if a filename is a plan file (plan.md or *-plan.md) */
|
|
40
|
+
function isPlanFile(f) {
|
|
41
|
+
return f.endsWith(PLAN_SUFFIX) || f === 'plan.md';
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Check if a filename is a summary file (summary.md or *-summary.md) */
|
|
45
|
+
function isSummaryFile(f) {
|
|
46
|
+
return f.endsWith(SUMMARY_SUFFIX) || f === 'summary.md';
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** Check if a filename is a research file (research.md or *-research.md) */
|
|
50
|
+
function isResearchFile(f) {
|
|
51
|
+
return f.endsWith(RESEARCH_SUFFIX) || f === 'research.md';
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** Check if a filename is a context file (context.md or *-context.md) */
|
|
55
|
+
function isContextFile(f) {
|
|
56
|
+
return f.endsWith(CONTEXT_SUFFIX) || f === 'context.md';
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** Check if a filename is a verification file (verification.md or *-verification.md) */
|
|
60
|
+
function isVerificationFile(f) {
|
|
61
|
+
return f.endsWith(VERIFICATION_SUFFIX) || f === 'verification.md';
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// ─── Plan/Summary ID extraction ──────────────────────────────────────────────
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Extract the plan ID from a plan filename.
|
|
68
|
+
* e.g. "01-plan.md" → "01", "plan.md" → ""
|
|
69
|
+
*/
|
|
70
|
+
function getPlanId(filename) {
|
|
71
|
+
return filename.replace(PLAN_SUFFIX, '').replace('plan.md', '');
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Extract the summary ID from a summary filename.
|
|
76
|
+
* e.g. "01-summary.md" → "01", "summary.md" → ""
|
|
77
|
+
*/
|
|
78
|
+
function getSummaryId(filename) {
|
|
79
|
+
return filename.replace(SUMMARY_SUFFIX, '').replace('summary.md', '');
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// ─── Regex patterns (precompiled) ────────────────────────────────────────────
|
|
83
|
+
|
|
84
|
+
/** Match a phase header in roadmap.md: ## Phase 01: Name */
|
|
85
|
+
const PHASE_HEADER_RE = /#{2,4}\s*Phase\s+(\d+[A-Z]?(?:\.\d+)*)\s*:\s*([^\n]+)/gi;
|
|
86
|
+
|
|
87
|
+
/** Match a phase directory name: "01-setup-auth" → ["01", "setup-auth"] */
|
|
88
|
+
const PHASE_DIR_RE = /^(\d+[A-Z]?(?:\.\d+)*)-?(.*)/i;
|
|
89
|
+
|
|
90
|
+
/** Match a phase number with optional letter and decimals: "03A.1.2" */
|
|
91
|
+
const PHASE_NUM_RE = /^(\d+)([A-Z])?((?:\.\d+)*)/i;
|
|
92
|
+
|
|
93
|
+
/** Match a bold markdown field: **Field Name:** value */
|
|
94
|
+
const FIELD_VALUE_RE = /\*\*([^:*]+):\*\*\s*(.+)/;
|
|
95
|
+
|
|
96
|
+
/** Match an archive directory: "v0.1.0-phases" */
|
|
97
|
+
const ARCHIVE_DIR_RE = /^v[\d.]+-phases$/;
|
|
98
|
+
|
|
99
|
+
/** Match a milestone version in text: "v1.0" */
|
|
100
|
+
const MILESTONE_VERSION_RE = /v(\d+\.\d+)/;
|
|
101
|
+
|
|
102
|
+
// ─── Focus enums ────────────────────────────────────────────────────────────
|
|
103
|
+
|
|
104
|
+
/** Valid priority levels for focus commands (P0 = highest urgency) */
|
|
105
|
+
const PRIORITY_LEVELS = ['P0', 'P1', 'P2', 'P3', 'P4', 'P5', 'P6'];
|
|
106
|
+
|
|
107
|
+
/** Valid effort sizes for focus commands */
|
|
108
|
+
const EFFORT_SIZES = ['XS', 'S', 'M', 'L', 'XL'];
|
|
109
|
+
|
|
110
|
+
/** Effort-to-points mapping for capacity budgeting */
|
|
111
|
+
const EFFORT_POINTS = { XS: 1, S: 2, M: 4, L: 10, XL: 20 };
|
|
112
|
+
|
|
113
|
+
/** Focus execution modes */
|
|
114
|
+
const FOCUS_MODES = ['bugfix', 'balanced', 'features', 'full'];
|
|
115
|
+
|
|
116
|
+
/** Focus execution tiers */
|
|
117
|
+
const FOCUS_TIERS = { MICRO: 'MICRO', STANDARD: 'STANDARD', FULL: 'FULL' };
|
|
118
|
+
|
|
119
|
+
/** Focus directory under .planning */
|
|
120
|
+
const FOCUS_DIR = 'focus';
|
|
121
|
+
|
|
122
|
+
/** Focus auto-run state file */
|
|
123
|
+
const AUTO_RUN_FILE = 'auto-run.json';
|
|
124
|
+
|
|
125
|
+
/** Focus auto-runner categories */
|
|
126
|
+
const FOCUS_CATEGORIES = ['cleanup', 'tests', 'stability', 'features', 'docs', 'optimize'];
|
|
127
|
+
|
|
128
|
+
/** Category → priority index range (indices into PRIORITY_LEVELS) */
|
|
129
|
+
const CATEGORY_PRIORITY_RANGE = {
|
|
130
|
+
cleanup: { min: 3, max: 5 }, // P3-P5
|
|
131
|
+
tests: { min: 2, max: 5 }, // P2-P5
|
|
132
|
+
stability: { min: 0, max: 2 }, // P0-P2
|
|
133
|
+
features: { min: 3, max: 5 }, // P3-P5
|
|
134
|
+
docs: { min: 5, max: 6 }, // P5-P6
|
|
135
|
+
optimize: { min: 1, max: 4 }, // P1-P4
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
/** Category → default mode + budget */
|
|
139
|
+
const CATEGORY_DEFAULTS = {
|
|
140
|
+
cleanup: { mode: 'balanced', budget: 50 },
|
|
141
|
+
tests: { mode: 'balanced', budget: 50 },
|
|
142
|
+
stability: { mode: 'bugfix', budget: 40 },
|
|
143
|
+
features: { mode: 'features', budget: 50 },
|
|
144
|
+
docs: { mode: 'balanced', budget: 30 },
|
|
145
|
+
optimize: { mode: 'balanced', budget: 50 },
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
/** Doc files to scan for staleness (focus sync) */
|
|
149
|
+
const DOC_SYNC_FILES = ['README.md', 'docs/DEVELOPMENT.md', 'docs/CLI-REFERENCE.md', 'docs/USER-GUIDE.md', 'docs/ARCHITECTURE.md'];
|
|
150
|
+
|
|
151
|
+
/** Old→new command name mapping for detecting stale docs */
|
|
152
|
+
const COMMAND_RENAME_MAP = {
|
|
153
|
+
'execute-phase': 'exec-phase',
|
|
154
|
+
'verify-work': 'verify-phase',
|
|
155
|
+
'list-phase-assumptions': 'assumptions',
|
|
156
|
+
'add-tests': 'phase-tests',
|
|
157
|
+
'context-budget': 'phase-budget',
|
|
158
|
+
'pause-work': 'pause',
|
|
159
|
+
'resume-work': 'resume',
|
|
160
|
+
'set-profile': 'profile',
|
|
161
|
+
'new-milestone': 'milestone-new',
|
|
162
|
+
'complete-milestone': 'milestone-done',
|
|
163
|
+
'audit-milestone': 'milestone-audit',
|
|
164
|
+
'plan-milestone-gaps': 'milestone-gaps',
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
/** Default max cycles for auto-runner */
|
|
168
|
+
const DEFAULT_MAX_CYCLES = 10;
|
|
169
|
+
|
|
170
|
+
/** Default cumulative budget cap for auto-runner */
|
|
171
|
+
const DEFAULT_TOTAL_BUDGET = 500;
|
|
172
|
+
|
|
173
|
+
// ─── Standards ──────────────────────────────────────────────────────────────
|
|
174
|
+
|
|
175
|
+
const STANDARDS_FILE = 'standards.md';
|
|
176
|
+
|
|
177
|
+
/** Standards categories */
|
|
178
|
+
const STANDARDS_CATEGORIES = ['security', 'accessibility', 'quality', 'architecture', 'process'];
|
|
179
|
+
|
|
180
|
+
/** Built-in standards catalog */
|
|
181
|
+
const STANDARDS_CATALOG = {
|
|
182
|
+
'owasp-top10': {
|
|
183
|
+
name: 'OWASP Top 10 (2025)',
|
|
184
|
+
category: 'security',
|
|
185
|
+
description: 'Top 10 web application security risks',
|
|
186
|
+
applicable_to: ['web', 'api', 'all'],
|
|
187
|
+
level: 'foundational',
|
|
188
|
+
url: 'https://owasp.org/www-project-top-ten/',
|
|
189
|
+
checklist: [
|
|
190
|
+
'A01: Broken Access Control — verify authorization checks on all endpoints',
|
|
191
|
+
'A02: Cryptographic Failures — verify sensitive data encryption at rest and in transit',
|
|
192
|
+
'A03: Injection — verify input validation and parameterized queries',
|
|
193
|
+
'A04: Insecure Design — verify threat modeling and secure design patterns',
|
|
194
|
+
'A05: Security Misconfiguration — verify default credentials removed, headers set',
|
|
195
|
+
'A06: Vulnerable Components — verify dependency scanning, no known CVEs',
|
|
196
|
+
'A07: Authentication Failures — verify MFA support, session management, credential storage',
|
|
197
|
+
'A08: Software and Data Integrity — verify CI/CD pipeline integrity, signed updates',
|
|
198
|
+
'A09: Logging and Monitoring — verify security events logged, alerts configured',
|
|
199
|
+
'A10: SSRF — verify server-side request validation, allowlists',
|
|
200
|
+
],
|
|
201
|
+
},
|
|
202
|
+
'owasp-asvs-l1': {
|
|
203
|
+
name: 'OWASP ASVS Level 1',
|
|
204
|
+
category: 'security',
|
|
205
|
+
description: 'Application Security Verification Standard — automated testing level',
|
|
206
|
+
applicable_to: ['web', 'api', 'all'],
|
|
207
|
+
level: 'foundational',
|
|
208
|
+
url: 'https://owasp.org/www-project-application-security-verification-standard/',
|
|
209
|
+
checklist: [
|
|
210
|
+
'V1: Architecture — verify security architecture documentation exists',
|
|
211
|
+
'V2: Authentication — verify credential storage uses approved hashing',
|
|
212
|
+
'V3: Session Management — verify session tokens are random, expire, and rotate',
|
|
213
|
+
'V4: Access Control — verify principle of least privilege enforced',
|
|
214
|
+
'V5: Validation — verify all input validated server-side',
|
|
215
|
+
'V7: Cryptography — verify no hardcoded secrets or weak algorithms',
|
|
216
|
+
'V8: Data Protection — verify sensitive data classified and protected',
|
|
217
|
+
'V11: HTTP Security — verify security headers set (CSP, HSTS, X-Frame)',
|
|
218
|
+
'V13: API Security — verify API authentication, rate limiting, input validation',
|
|
219
|
+
'V14: Configuration — verify default credentials changed, debug disabled',
|
|
220
|
+
],
|
|
221
|
+
},
|
|
222
|
+
'owasp-llm-top10': {
|
|
223
|
+
name: 'OWASP Top 10 for LLM Applications (2025)',
|
|
224
|
+
category: 'security',
|
|
225
|
+
description: 'Security risks specific to LLM/AI applications',
|
|
226
|
+
applicable_to: ['ai', 'llm', 'all'],
|
|
227
|
+
level: 'specialized',
|
|
228
|
+
url: 'https://genai.owasp.org/resource/owasp-top-10-for-llm-applications-2025/',
|
|
229
|
+
checklist: [
|
|
230
|
+
'LLM01: Prompt Injection — verify input sanitization and prompt boundaries',
|
|
231
|
+
'LLM02: Sensitive Information Disclosure — verify no PII/secrets in outputs',
|
|
232
|
+
'LLM03: Supply Chain — verify model and dependency provenance',
|
|
233
|
+
'LLM04: Data and Model Poisoning — verify training data integrity',
|
|
234
|
+
'LLM05: Improper Output Handling — verify output validation before use',
|
|
235
|
+
'LLM06: Excessive Agency — verify tool-use permissions and boundaries',
|
|
236
|
+
'LLM07: System Prompt Leakage — verify system prompts not extractable',
|
|
237
|
+
'LLM08: Vector and Embedding Weaknesses — verify embedding pipeline security',
|
|
238
|
+
'LLM09: Misinformation — verify output accuracy validation mechanisms',
|
|
239
|
+
'LLM10: Unbounded Consumption — verify rate limits and resource caps',
|
|
240
|
+
],
|
|
241
|
+
},
|
|
242
|
+
'owasp-agentic-top10': {
|
|
243
|
+
name: 'OWASP Top 10 for Agentic Applications (2026)',
|
|
244
|
+
category: 'security',
|
|
245
|
+
description: 'Security risks for autonomous AI agent systems',
|
|
246
|
+
applicable_to: ['ai', 'agent', 'all'],
|
|
247
|
+
level: 'specialized',
|
|
248
|
+
url: 'https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/',
|
|
249
|
+
checklist: [
|
|
250
|
+
'AG01: Agent Goal Hijacking — verify goal integrity and boundary enforcement',
|
|
251
|
+
'AG02: Tool Misuse — verify tool permissions, input validation, output checking',
|
|
252
|
+
'AG03: Privilege Escalation — verify agent runs with minimum required permissions',
|
|
253
|
+
'AG04: Memory Corruption — verify agent memory integrity and poisoning resistance',
|
|
254
|
+
'AG05: Inter-Agent Communication — verify secure messaging between agents',
|
|
255
|
+
'AG06: Cascading Hallucination — verify cross-agent output validation',
|
|
256
|
+
'AG07: Denial of Service — verify resource limits and timeout enforcement',
|
|
257
|
+
'AG08: Repudiation — verify audit logging for all agent actions',
|
|
258
|
+
'AG09: Data Exfiltration — verify output boundaries and data classification',
|
|
259
|
+
'AG10: Uncontrolled Autonomy — verify human-in-the-loop checkpoints',
|
|
260
|
+
],
|
|
261
|
+
},
|
|
262
|
+
'wcag-22': {
|
|
263
|
+
name: 'WCAG 2.2 (Level AA)',
|
|
264
|
+
category: 'accessibility',
|
|
265
|
+
description: 'Web Content Accessibility Guidelines for inclusive design',
|
|
266
|
+
applicable_to: ['web', 'ui', 'all'],
|
|
267
|
+
level: 'foundational',
|
|
268
|
+
url: 'https://www.w3.org/TR/WCAG22/',
|
|
269
|
+
checklist: [
|
|
270
|
+
'Perceivable — verify text alternatives for non-text content',
|
|
271
|
+
'Perceivable — verify captions/alternatives for audio and video',
|
|
272
|
+
'Perceivable — verify content adaptable without loss of information',
|
|
273
|
+
'Perceivable — verify sufficient color contrast (4.5:1 for text)',
|
|
274
|
+
'Operable — verify all functionality available from keyboard',
|
|
275
|
+
'Operable — verify no content causes seizures or physical reactions',
|
|
276
|
+
'Operable — verify users can navigate and find content easily',
|
|
277
|
+
'Understandable — verify text is readable and predictable',
|
|
278
|
+
'Understandable — verify input assistance and error prevention',
|
|
279
|
+
'Robust — verify compatibility with assistive technologies',
|
|
280
|
+
],
|
|
281
|
+
},
|
|
282
|
+
'nist-ssdf': {
|
|
283
|
+
name: 'NIST Secure Software Development Framework',
|
|
284
|
+
category: 'security',
|
|
285
|
+
description: 'NIST SP 800-218 practices for secure SDLC',
|
|
286
|
+
applicable_to: ['all'],
|
|
287
|
+
level: 'organizational',
|
|
288
|
+
url: 'https://csrc.nist.gov/projects/ssdf',
|
|
289
|
+
checklist: [
|
|
290
|
+
'PO: Prepare — define security requirements and roles',
|
|
291
|
+
'PS: Protect Software — protect all code and build components from tampering',
|
|
292
|
+
'PW: Produce Well-Secured Software — design and code with security in mind',
|
|
293
|
+
'PW: Produce — review and test code for vulnerabilities before release',
|
|
294
|
+
'RV: Respond to Vulnerabilities — monitor, triage, and remediate discovered flaws',
|
|
295
|
+
],
|
|
296
|
+
},
|
|
297
|
+
'iso-25010': {
|
|
298
|
+
name: 'ISO/IEC 25010 Software Quality Model',
|
|
299
|
+
category: 'quality',
|
|
300
|
+
description: 'Eight quality characteristics for software product quality',
|
|
301
|
+
applicable_to: ['all'],
|
|
302
|
+
level: 'organizational',
|
|
303
|
+
url: 'https://iso25000.com/index.php/en/iso-25000-standards/iso-25010',
|
|
304
|
+
checklist: [
|
|
305
|
+
'Functional Suitability — verify completeness, correctness, and appropriateness',
|
|
306
|
+
'Performance Efficiency — verify time behavior, resource utilization, and capacity',
|
|
307
|
+
'Compatibility — verify co-existence and interoperability',
|
|
308
|
+
'Usability — verify learnability, operability, and error protection',
|
|
309
|
+
'Reliability — verify maturity, availability, fault tolerance, and recoverability',
|
|
310
|
+
'Security — verify confidentiality, integrity, non-repudiation, and accountability',
|
|
311
|
+
'Maintainability — verify modularity, reusability, analysability, and testability',
|
|
312
|
+
'Portability — verify adaptability, installability, and replaceability',
|
|
313
|
+
],
|
|
314
|
+
},
|
|
315
|
+
'stride': {
|
|
316
|
+
name: 'STRIDE Threat Modeling',
|
|
317
|
+
category: 'security',
|
|
318
|
+
description: 'Systematic threat identification across six categories',
|
|
319
|
+
applicable_to: ['all'],
|
|
320
|
+
level: 'foundational',
|
|
321
|
+
url: 'https://learn.microsoft.com/en-us/azure/security/develop/threat-modeling-tool-threats',
|
|
322
|
+
checklist: [
|
|
323
|
+
'Spoofing — verify authentication mechanisms prevent identity impersonation',
|
|
324
|
+
'Tampering — verify integrity checks protect data and code from modification',
|
|
325
|
+
'Repudiation — verify audit logging provides non-repudiation',
|
|
326
|
+
'Information Disclosure — verify sensitive data protected in transit and at rest',
|
|
327
|
+
'Denial of Service — verify rate limiting, resource caps, and graceful degradation',
|
|
328
|
+
'Elevation of Privilege — verify least privilege and proper authorization boundaries',
|
|
329
|
+
],
|
|
330
|
+
},
|
|
331
|
+
'cwe-top25': {
|
|
332
|
+
name: 'CWE Top 25 Most Dangerous Software Weaknesses',
|
|
333
|
+
category: 'security',
|
|
334
|
+
description: 'MITRE\'s most critical software weaknesses by prevalence and severity',
|
|
335
|
+
applicable_to: ['all'],
|
|
336
|
+
level: 'foundational',
|
|
337
|
+
url: 'https://cwe.mitre.org/top25/',
|
|
338
|
+
checklist: [
|
|
339
|
+
'CWE-787/CWE-125: Memory Safety — verify bounds checking on all buffer operations',
|
|
340
|
+
'CWE-79: XSS — verify output encoding and Content-Security-Policy',
|
|
341
|
+
'CWE-89: SQL Injection — verify parameterized queries exclusively',
|
|
342
|
+
'CWE-416/CWE-476: Use-After-Free/Null Deref — verify pointer and reference safety',
|
|
343
|
+
'CWE-20: Improper Input Validation — verify all inputs validated and sanitized',
|
|
344
|
+
'CWE-78: OS Command Injection — verify no shell metacharacter injection possible',
|
|
345
|
+
'CWE-22: Path Traversal — verify path normalization and boundary enforcement',
|
|
346
|
+
'CWE-352: CSRF — verify anti-CSRF tokens on state-changing requests',
|
|
347
|
+
'CWE-434: Unrestricted Upload — verify file type and size validation',
|
|
348
|
+
'CWE-862/CWE-863: Missing Authorization — verify access control on all resources',
|
|
349
|
+
],
|
|
350
|
+
},
|
|
351
|
+
'soc2-dev': {
|
|
352
|
+
name: 'SOC 2 Development Controls',
|
|
353
|
+
category: 'process',
|
|
354
|
+
description: 'Software development practices for SOC 2 compliance',
|
|
355
|
+
applicable_to: ['all'],
|
|
356
|
+
level: 'organizational',
|
|
357
|
+
url: 'https://www.aicpa-cima.com/topic/audit-assurance/audit-and-assurance-greater-than-soc-2',
|
|
358
|
+
checklist: [
|
|
359
|
+
'Change Management — verify all changes tracked in version control with approval',
|
|
360
|
+
'Code Review — verify peer review required before merge',
|
|
361
|
+
'Testing — verify automated test suite runs on every change',
|
|
362
|
+
'Vulnerability Management — verify dependency scanning and remediation process',
|
|
363
|
+
'Incident Response — verify documented process for security incidents',
|
|
364
|
+
'Access Control — verify least-privilege access to code repositories and infrastructure',
|
|
365
|
+
],
|
|
366
|
+
},
|
|
367
|
+
'togaf-adm': {
|
|
368
|
+
name: 'TOGAF Architecture Development Method',
|
|
369
|
+
category: 'architecture',
|
|
370
|
+
description: 'Enterprise architecture governance framework',
|
|
371
|
+
applicable_to: ['enterprise', 'all'],
|
|
372
|
+
level: 'organizational',
|
|
373
|
+
url: 'https://www.opengroup.org/togaf',
|
|
374
|
+
checklist: [
|
|
375
|
+
'Architecture Vision — verify stakeholders and scope are defined',
|
|
376
|
+
'Business Architecture — verify business capabilities mapped to system features',
|
|
377
|
+
'Information Systems Architecture — verify data and application architecture documented',
|
|
378
|
+
'Technology Architecture — verify infrastructure and deployment architecture documented',
|
|
379
|
+
'Opportunities and Solutions — verify transition architectures and implementation plan',
|
|
380
|
+
'Architecture Governance — verify compliance review process established',
|
|
381
|
+
],
|
|
382
|
+
},
|
|
383
|
+
'conventional-commits': {
|
|
384
|
+
name: 'Conventional Commits',
|
|
385
|
+
category: 'process',
|
|
386
|
+
description: 'Structured commit message specification for automated changelogs',
|
|
387
|
+
applicable_to: ['all'],
|
|
388
|
+
level: 'foundational',
|
|
389
|
+
url: 'https://www.conventionalcommits.org/',
|
|
390
|
+
checklist: [
|
|
391
|
+
'Format — verify commits use type(scope): description format',
|
|
392
|
+
'Types — verify correct type used (feat, fix, docs, test, refactor, chore)',
|
|
393
|
+
'Breaking Changes — verify BREAKING CHANGE footer or ! after type for breaking changes',
|
|
394
|
+
'Scope — verify scope identifies the component or module affected',
|
|
395
|
+
],
|
|
396
|
+
},
|
|
397
|
+
};
|
|
398
|
+
|
|
399
|
+
/** Project-type to recommended standards mapping */
|
|
400
|
+
const STANDARDS_RECOMMENDATIONS = {
|
|
401
|
+
web: ['owasp-top10', 'wcag-22', 'owasp-asvs-l1'],
|
|
402
|
+
api: ['owasp-top10', 'owasp-asvs-l1', 'stride'],
|
|
403
|
+
ai: ['owasp-llm-top10', 'owasp-top10', 'stride'],
|
|
404
|
+
agent: ['owasp-agentic-top10', 'owasp-llm-top10', 'stride'],
|
|
405
|
+
enterprise: ['togaf-adm', 'iso-25010', 'owasp-top10'],
|
|
406
|
+
cli: ['cwe-top25', 'stride', 'conventional-commits'],
|
|
407
|
+
general: ['owasp-top10', 'stride', 'conventional-commits'],
|
|
408
|
+
};
|
|
409
|
+
|
|
410
|
+
/** Keywords in phase content that map to relevant standard IDs */
|
|
411
|
+
const PHASE_KEYWORDS_TO_STANDARDS = {
|
|
412
|
+
auth: ['owasp-top10', 'owasp-asvs-l1'],
|
|
413
|
+
login: ['owasp-top10', 'owasp-asvs-l1'],
|
|
414
|
+
session: ['owasp-top10', 'owasp-asvs-l1'],
|
|
415
|
+
password: ['owasp-top10', 'owasp-asvs-l1'],
|
|
416
|
+
encrypt: ['owasp-top10', 'nist-ssdf'],
|
|
417
|
+
security: ['owasp-top10', 'stride', 'nist-ssdf'],
|
|
418
|
+
injection: ['owasp-top10', 'cwe-top25'],
|
|
419
|
+
xss: ['owasp-top10', 'cwe-top25'],
|
|
420
|
+
sql: ['owasp-top10', 'cwe-top25'],
|
|
421
|
+
api: ['owasp-top10', 'owasp-asvs-l1'],
|
|
422
|
+
endpoint: ['owasp-top10', 'owasp-asvs-l1'],
|
|
423
|
+
accessibility: ['wcag-22'],
|
|
424
|
+
a11y: ['wcag-22'],
|
|
425
|
+
aria: ['wcag-22'],
|
|
426
|
+
'screen reader': ['wcag-22'],
|
|
427
|
+
llm: ['owasp-llm-top10'],
|
|
428
|
+
'ai model': ['owasp-llm-top10'],
|
|
429
|
+
prompt: ['owasp-llm-top10'],
|
|
430
|
+
agent: ['owasp-agentic-top10'],
|
|
431
|
+
autonomous: ['owasp-agentic-top10'],
|
|
432
|
+
'tool use': ['owasp-agentic-top10'],
|
|
433
|
+
architecture: ['togaf-adm', 'iso-25010'],
|
|
434
|
+
governance: ['togaf-adm', 'soc2-dev'],
|
|
435
|
+
compliance: ['soc2-dev', 'nist-ssdf'],
|
|
436
|
+
audit: ['soc2-dev'],
|
|
437
|
+
quality: ['iso-25010'],
|
|
438
|
+
performance: ['iso-25010'],
|
|
439
|
+
reliability: ['iso-25010'],
|
|
440
|
+
threat: ['stride'],
|
|
441
|
+
'threat model': ['stride'],
|
|
442
|
+
commit: ['conventional-commits'],
|
|
443
|
+
changelog: ['conventional-commits'],
|
|
444
|
+
vulnerability: ['cwe-top25', 'owasp-top10'],
|
|
445
|
+
buffer: ['cwe-top25'],
|
|
446
|
+
overflow: ['cwe-top25'],
|
|
447
|
+
};
|
|
448
|
+
|
|
449
|
+
/** External scanning tool recommendations per standard */
|
|
450
|
+
const STANDARDS_EXTERNAL_TOOLS = {
|
|
451
|
+
'owasp-top10': [
|
|
452
|
+
{ name: 'OWASP ZAP', url: 'https://www.zaproxy.org/', description: 'Dynamic application security scanner' },
|
|
453
|
+
{ name: 'Semgrep', url: 'https://semgrep.dev/', description: 'Static analysis with OWASP rule packs' },
|
|
454
|
+
],
|
|
455
|
+
'owasp-asvs-l1': [
|
|
456
|
+
{ name: 'OWASP ZAP', url: 'https://www.zaproxy.org/', description: 'Automated ASVS verification' },
|
|
457
|
+
{ name: 'Semgrep', url: 'https://semgrep.dev/', description: 'Static ASVS rule validation' },
|
|
458
|
+
],
|
|
459
|
+
'owasp-llm-top10': [
|
|
460
|
+
{ name: 'Garak', url: 'https://github.com/leondz/garak', description: 'LLM vulnerability scanner' },
|
|
461
|
+
{ name: 'Rebuff', url: 'https://github.com/protectai/rebuff', description: 'Prompt injection detection' },
|
|
462
|
+
],
|
|
463
|
+
'owasp-agentic-top10': [
|
|
464
|
+
{ name: 'Garak', url: 'https://github.com/leondz/garak', description: 'LLM/agent vulnerability scanner' },
|
|
465
|
+
],
|
|
466
|
+
'wcag-22': [
|
|
467
|
+
{ name: 'axe-core', url: 'https://github.com/dequelabs/axe-core', description: 'Accessibility testing engine' },
|
|
468
|
+
{ name: 'Pa11y', url: 'https://pa11y.org/', description: 'Automated accessibility testing CLI' },
|
|
469
|
+
{ name: 'Lighthouse', url: 'https://developer.chrome.com/docs/lighthouse', description: 'Chrome accessibility audit' },
|
|
470
|
+
],
|
|
471
|
+
'nist-ssdf': [
|
|
472
|
+
{ name: 'SonarQube', url: 'https://www.sonarsource.com/products/sonarqube/', description: 'Code quality and security platform' },
|
|
473
|
+
],
|
|
474
|
+
'iso-25010': [
|
|
475
|
+
{ name: 'SonarQube', url: 'https://www.sonarsource.com/products/sonarqube/', description: 'Quality characteristics measurement' },
|
|
476
|
+
],
|
|
477
|
+
'stride': [
|
|
478
|
+
{ name: 'Microsoft Threat Modeling Tool', url: 'https://learn.microsoft.com/en-us/azure/security/develop/threat-modeling-tool', description: 'STRIDE-based threat modeling' },
|
|
479
|
+
{ name: 'OWASP Threat Dragon', url: 'https://owasp.org/www-project-threat-dragon/', description: 'Open-source threat modeling' },
|
|
480
|
+
],
|
|
481
|
+
'cwe-top25': [
|
|
482
|
+
{ name: 'Semgrep', url: 'https://semgrep.dev/', description: 'CWE-aware static analysis' },
|
|
483
|
+
{ name: 'CodeQL', url: 'https://codeql.github.com/', description: 'GitHub semantic code analysis' },
|
|
484
|
+
],
|
|
485
|
+
'soc2-dev': [
|
|
486
|
+
{ name: 'Drata', url: 'https://drata.com/', description: 'Continuous SOC 2 compliance automation' },
|
|
487
|
+
{ name: 'Vanta', url: 'https://www.vanta.com/', description: 'Automated compliance monitoring' },
|
|
488
|
+
],
|
|
489
|
+
'togaf-adm': [],
|
|
490
|
+
'conventional-commits': [
|
|
491
|
+
{ name: 'commitlint', url: 'https://commitlint.js.org/', description: 'Commit message linting' },
|
|
492
|
+
{ name: 'Husky', url: 'https://typicode.github.io/husky/', description: 'Git hooks for commit validation' },
|
|
493
|
+
],
|
|
494
|
+
};
|
|
495
|
+
|
|
496
|
+
// ─── Magic number constants ──────────────────────────────────────────────────
|
|
497
|
+
|
|
498
|
+
/** Focus budget limits by mode */
|
|
499
|
+
const BUDGET_LIMIT_BUGFIX = 40;
|
|
500
|
+
const BUDGET_LIMIT_FULL = 60;
|
|
501
|
+
|
|
502
|
+
/** Focus allocation ratios */
|
|
503
|
+
const STABILITY_RATIO = 0.6;
|
|
504
|
+
const FEATURE_RATIO = 0.8;
|
|
505
|
+
|
|
506
|
+
/** Efficiency drop threshold for optimize category diminishing-returns stop */
|
|
507
|
+
const DIMINISHING_RETURNS_THRESHOLD = 0.3;
|
|
508
|
+
|
|
509
|
+
/** Template complexity thresholds */
|
|
510
|
+
const SIMPLE_TASK_THRESHOLD = 2;
|
|
511
|
+
const SIMPLE_FILE_THRESHOLD = 3;
|
|
512
|
+
const COMPLEX_TASK_THRESHOLD = 5;
|
|
513
|
+
const COMPLEX_FILE_THRESHOLD = 6;
|
|
514
|
+
|
|
515
|
+
/** Token estimation: average characters per token */
|
|
516
|
+
const CHARS_PER_TOKEN = 4;
|
|
517
|
+
|
|
518
|
+
/** Health status values for project validation */
|
|
519
|
+
const HEALTH_STATUS = { HEALTHY: 'healthy', DEGRADED: 'degraded', BROKEN: 'broken' };
|
|
520
|
+
|
|
521
|
+
/** Max JSON payload size before writing to tmpfile (bytes) */
|
|
522
|
+
const MAX_JSON_SIZE = 50000;
|
|
523
|
+
|
|
524
|
+
/** Width of progress bar in status display (character count) */
|
|
525
|
+
const PROGRESS_BAR_WIDTH = 10;
|
|
526
|
+
|
|
527
|
+
/** Max slug length for phase names */
|
|
528
|
+
const MAX_SLUG_LENGTH = 40;
|
|
529
|
+
|
|
530
|
+
/** Context window size in tokens (Claude's effective window) */
|
|
531
|
+
const CONTEXT_WINDOW = 200000;
|
|
532
|
+
|
|
533
|
+
/** Budget warning threshold (fraction of context window) */
|
|
534
|
+
const WARNING_THRESHOLD = 0.6;
|
|
535
|
+
|
|
536
|
+
/** Budget critical threshold (fraction of context window) */
|
|
537
|
+
const CRITICAL_THRESHOLD = 0.8;
|
|
538
|
+
|
|
539
|
+
/** Focus budget validation bounds */
|
|
540
|
+
const BUDGET_MIN = 5;
|
|
541
|
+
const BUDGET_MAX = 100;
|
|
542
|
+
const MAX_CYCLES_MIN = 1;
|
|
543
|
+
const MAX_CYCLES_MAX = 50;
|
|
544
|
+
const TOTAL_BUDGET_MIN = 5;
|
|
545
|
+
const TOTAL_BUDGET_MAX = 5000;
|
|
546
|
+
|
|
547
|
+
/** Valid conventional commit types */
|
|
548
|
+
const VALID_COMMIT_TYPES = ['feat', 'fix', 'docs', 'test', 'refactor', 'chore'];
|
|
549
|
+
|
|
550
|
+
/** Default sensitive file patterns for commit safety checks */
|
|
551
|
+
const DEFAULT_SENSITIVE_PATTERNS = ['\\.env$', '\\.pem$', '\\.key$', 'credentials', 'secret', 'password', 'token'];
|
|
552
|
+
|
|
553
|
+
// ─── Drift detection ─────────────────────────────────────────────────────────
|
|
554
|
+
|
|
555
|
+
/** Built-in drift detection rules for PAN Wizard conventions */
|
|
556
|
+
const BUILTIN_DRIFT_RULES = [
|
|
557
|
+
{ id: 'no-console-log', antiPattern: /\bconsole\.log\b/, message: 'Use output() instead of console.log', severity: 'error', fileGlob: '.cjs' },
|
|
558
|
+
{ id: 'no-console-error', antiPattern: /\bconsole\.error\b/, message: 'Use error() instead of console.error', severity: 'error', fileGlob: '.cjs' },
|
|
559
|
+
{ id: 'no-existsSync', antiPattern: /\bexistsSync\b/, message: 'Use safeReadFile() or fileAccessible() instead of existsSync', severity: 'warning', fileGlob: '.cjs' },
|
|
560
|
+
{ id: 'no-throw-to-user', antiPattern: /\bthrow new Error\b/, message: 'Use error() function instead of throw', severity: 'warning', fileGlob: '.cjs' },
|
|
561
|
+
{ id: 'no-raw-path-output', antiPattern: /output\([^)]*path\.join/, message: 'Wrap path.join() in toPosix() for output', severity: 'warning', fileGlob: '.cjs' },
|
|
562
|
+
];
|
|
563
|
+
|
|
564
|
+
/** Drift score verdict bands */
|
|
565
|
+
const DRIFT_VERDICTS = [
|
|
566
|
+
{ max: 0.2, verdict: 'clean' },
|
|
567
|
+
{ max: 0.5, verdict: 'low' },
|
|
568
|
+
{ max: 0.8, verdict: 'medium' },
|
|
569
|
+
{ max: 1.0, verdict: 'high' },
|
|
570
|
+
];
|
|
571
|
+
|
|
572
|
+
/** Binary file extensions to skip in drift check */
|
|
573
|
+
const BINARY_EXTENSIONS = new Set(['.png', '.jpg', '.jpeg', '.gif', '.ico', '.woff', '.woff2', '.ttf', '.eot', '.lock', '.map']);
|
|
574
|
+
|
|
575
|
+
/** Max files to check in a single drift-check run */
|
|
576
|
+
const DRIFT_MAX_FILES = 100;
|
|
577
|
+
|
|
578
|
+
/** Max file size (bytes) to check — skip files larger than this */
|
|
579
|
+
const DRIFT_MAX_FILE_SIZE = 102400;
|
|
580
|
+
|
|
581
|
+
/** Severity weights for drift score calculation */
|
|
582
|
+
const DRIFT_SEVERITY_WEIGHTS = { error: 3, warning: 1, info: 0.5 };
|
|
583
|
+
|
|
584
|
+
/** Auto-run status values */
|
|
585
|
+
const AUTORUN_STATUSES = {
|
|
586
|
+
INITIALIZED: 'initialized',
|
|
587
|
+
IN_PROGRESS: 'in_progress',
|
|
588
|
+
STOPPED: 'stopped',
|
|
589
|
+
COMPLETED: 'completed',
|
|
590
|
+
};
|
|
591
|
+
|
|
592
|
+
/** Unicode block characters for progress bar */
|
|
593
|
+
const FILLED_BLOCK = '\u2588';
|
|
594
|
+
const EMPTY_BLOCK = '\u2591';
|
|
595
|
+
|
|
596
|
+
module.exports = {
|
|
597
|
+
// Directories
|
|
598
|
+
PLANNING_DIR,
|
|
599
|
+
PHASES_DIR,
|
|
600
|
+
MILESTONES_DIR,
|
|
601
|
+
CODEBASE_DIR,
|
|
602
|
+
QUICK_DIR,
|
|
603
|
+
// Files
|
|
604
|
+
STATE_FILE,
|
|
605
|
+
ROADMAP_FILE,
|
|
606
|
+
CONFIG_FILE,
|
|
607
|
+
PROJECT_FILE,
|
|
608
|
+
REQUIREMENTS_FILE,
|
|
609
|
+
PAUSE_FILE,
|
|
610
|
+
PATTERNS_FILE,
|
|
611
|
+
SESSION_HISTORY_FILE,
|
|
612
|
+
LEARNINGS_FILE,
|
|
613
|
+
// Suffixes
|
|
614
|
+
PLAN_SUFFIX,
|
|
615
|
+
SUMMARY_SUFFIX,
|
|
616
|
+
CONTEXT_SUFFIX,
|
|
617
|
+
RESEARCH_SUFFIX,
|
|
618
|
+
VERIFICATION_SUFFIX,
|
|
619
|
+
UAT_SUFFIX,
|
|
620
|
+
// File matchers
|
|
621
|
+
isPlanFile,
|
|
622
|
+
isSummaryFile,
|
|
623
|
+
isResearchFile,
|
|
624
|
+
isContextFile,
|
|
625
|
+
isVerificationFile,
|
|
626
|
+
// ID extraction
|
|
627
|
+
getPlanId,
|
|
628
|
+
getSummaryId,
|
|
629
|
+
// Regex patterns
|
|
630
|
+
PHASE_HEADER_RE,
|
|
631
|
+
PHASE_DIR_RE,
|
|
632
|
+
PHASE_NUM_RE,
|
|
633
|
+
FIELD_VALUE_RE,
|
|
634
|
+
ARCHIVE_DIR_RE,
|
|
635
|
+
MILESTONE_VERSION_RE,
|
|
636
|
+
// Focus enums
|
|
637
|
+
PRIORITY_LEVELS,
|
|
638
|
+
EFFORT_SIZES,
|
|
639
|
+
EFFORT_POINTS,
|
|
640
|
+
FOCUS_MODES,
|
|
641
|
+
FOCUS_TIERS,
|
|
642
|
+
FOCUS_DIR,
|
|
643
|
+
AUTO_RUN_FILE,
|
|
644
|
+
FOCUS_CATEGORIES,
|
|
645
|
+
DOC_SYNC_FILES,
|
|
646
|
+
COMMAND_RENAME_MAP,
|
|
647
|
+
CATEGORY_PRIORITY_RANGE,
|
|
648
|
+
CATEGORY_DEFAULTS,
|
|
649
|
+
DEFAULT_MAX_CYCLES,
|
|
650
|
+
DEFAULT_TOTAL_BUDGET,
|
|
651
|
+
// Standards
|
|
652
|
+
STANDARDS_FILE,
|
|
653
|
+
STANDARDS_CATEGORIES,
|
|
654
|
+
STANDARDS_CATALOG,
|
|
655
|
+
STANDARDS_RECOMMENDATIONS,
|
|
656
|
+
PHASE_KEYWORDS_TO_STANDARDS,
|
|
657
|
+
STANDARDS_EXTERNAL_TOOLS,
|
|
658
|
+
// Magic numbers
|
|
659
|
+
BUDGET_LIMIT_BUGFIX,
|
|
660
|
+
BUDGET_LIMIT_FULL,
|
|
661
|
+
STABILITY_RATIO,
|
|
662
|
+
FEATURE_RATIO,
|
|
663
|
+
DIMINISHING_RETURNS_THRESHOLD,
|
|
664
|
+
SIMPLE_TASK_THRESHOLD,
|
|
665
|
+
SIMPLE_FILE_THRESHOLD,
|
|
666
|
+
COMPLEX_TASK_THRESHOLD,
|
|
667
|
+
COMPLEX_FILE_THRESHOLD,
|
|
668
|
+
CHARS_PER_TOKEN,
|
|
669
|
+
HEALTH_STATUS,
|
|
670
|
+
MAX_JSON_SIZE,
|
|
671
|
+
PROGRESS_BAR_WIDTH,
|
|
672
|
+
MAX_SLUG_LENGTH,
|
|
673
|
+
FILLED_BLOCK,
|
|
674
|
+
EMPTY_BLOCK,
|
|
675
|
+
CONTEXT_WINDOW,
|
|
676
|
+
WARNING_THRESHOLD,
|
|
677
|
+
CRITICAL_THRESHOLD,
|
|
678
|
+
BUDGET_MIN,
|
|
679
|
+
BUDGET_MAX,
|
|
680
|
+
MAX_CYCLES_MIN,
|
|
681
|
+
MAX_CYCLES_MAX,
|
|
682
|
+
TOTAL_BUDGET_MIN,
|
|
683
|
+
TOTAL_BUDGET_MAX,
|
|
684
|
+
// Commit
|
|
685
|
+
VALID_COMMIT_TYPES,
|
|
686
|
+
DEFAULT_SENSITIVE_PATTERNS,
|
|
687
|
+
// Auto-run
|
|
688
|
+
AUTORUN_STATUSES,
|
|
689
|
+
// Drift detection
|
|
690
|
+
BUILTIN_DRIFT_RULES,
|
|
691
|
+
DRIFT_VERDICTS,
|
|
692
|
+
BINARY_EXTENSIONS,
|
|
693
|
+
DRIFT_MAX_FILES,
|
|
694
|
+
DRIFT_MAX_FILE_SIZE,
|
|
695
|
+
DRIFT_SEVERITY_WEIGHTS,
|
|
696
|
+
};
|