maxsimcli 1.0.9 → 1.0.10

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/dist/cli.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.cjs","names":["node_fs_1","node_path_1","node_os_1","node_child_process_1","node_fs_1","node_path_1","node_fs_1","node_path_1","node_os_1","node_fs_1","node_path_1","node_fs_1","node_path_1","node_fs_1","node_path_1","node_fs_1","node_path_1","node_fs_1","node_path_1","node_fs_1","node_path_1","node_fs_1","node_path_1","path","fs"],"sources":["../../core/dist/types.js","../../core/dist/core.js","../../core/dist/frontmatter.js","../../core/dist/config.js","../../core/dist/state.js","../../core/dist/roadmap.js","../../core/dist/milestone.js","../../core/dist/commands.js","../../core/dist/verify.js","../../core/dist/phase.js","../../core/dist/template.js","../../core/dist/init.js","../../core/dist/index.js","../src/cli.ts"],"sourcesContent":["\"use strict\";\n/**\n * @maxsim/core — Shared type definitions\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.PLANNING_CONFIG_DEFAULTS = void 0;\nexports.phaseNumber = phaseNumber;\nexports.phasePath = phasePath;\nexports.phaseSlug = phaseSlug;\nexports.ok = ok;\nexports.err = err;\nfunction phaseNumber(value) {\n const match = value.match(/^\\d+[A-Z]?(\\.\\d+)?$/i);\n if (!match) {\n throw new Error(`Invalid phase number: ${value}`);\n }\n return value;\n}\nfunction phasePath(value) {\n if (!value || typeof value !== 'string') {\n throw new Error(`Invalid phase path: ${value}`);\n }\n return value;\n}\nfunction phaseSlug(value) {\n if (!value || typeof value !== 'string') {\n throw new Error(`Invalid phase slug: ${value}`);\n }\n return value;\n}\nfunction ok(data) {\n return { success: true, data };\n}\nfunction err(error) {\n return { success: false, error };\n}\nexports.PLANNING_CONFIG_DEFAULTS = {\n model_profile: 'balanced',\n commit_docs: true,\n search_gitignored: false,\n branching_strategy: 'none',\n phase_branch_template: 'maxsim/phase-{phase}-{slug}',\n milestone_branch_template: 'maxsim/{milestone}-{slug}',\n workflow: {\n research: true,\n plan_check: true,\n verifier: true,\n nyquist_validation: false,\n },\n parallelization: true,\n brave_search: false,\n};\n//# sourceMappingURL=types.js.map","\"use strict\";\n/**\n * Core — Shared utilities, constants, and internal helpers\n *\n * Ported from maxsim/bin/lib/core.cjs\n */\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.MODEL_PROFILES = void 0;\nexports.output = output;\nexports.error = error;\nexports.safeReadFile = safeReadFile;\nexports.loadConfig = loadConfig;\nexports.isGitIgnored = isGitIgnored;\nexports.execGit = execGit;\nexports.normalizePhaseName = normalizePhaseName;\nexports.comparePhaseNum = comparePhaseNum;\nexports.findPhaseInternal = findPhaseInternal;\nexports.getArchivedPhaseDirs = getArchivedPhaseDirs;\nexports.getRoadmapPhaseInternal = getRoadmapPhaseInternal;\nexports.resolveModelInternal = resolveModelInternal;\nexports.pathExistsInternal = pathExistsInternal;\nexports.generateSlugInternal = generateSlugInternal;\nexports.getMilestoneInfo = getMilestoneInfo;\nconst node_fs_1 = __importDefault(require(\"node:fs\"));\nconst node_path_1 = __importDefault(require(\"node:path\"));\nconst node_os_1 = __importDefault(require(\"node:os\"));\nconst node_child_process_1 = require(\"node:child_process\");\n// ─── Model Profile Table ─────────────────────────────────────────────────────\nexports.MODEL_PROFILES = {\n 'maxsim-planner': { quality: 'opus', balanced: 'opus', budget: 'sonnet' },\n 'maxsim-roadmapper': { quality: 'opus', balanced: 'sonnet', budget: 'sonnet' },\n 'maxsim-executor': { quality: 'opus', balanced: 'sonnet', budget: 'sonnet' },\n 'maxsim-phase-researcher': { quality: 'opus', balanced: 'sonnet', budget: 'haiku' },\n 'maxsim-project-researcher': { quality: 'opus', balanced: 'sonnet', budget: 'haiku' },\n 'maxsim-research-synthesizer': { quality: 'sonnet', balanced: 'sonnet', budget: 'haiku' },\n 'maxsim-debugger': { quality: 'opus', balanced: 'sonnet', budget: 'sonnet' },\n 'maxsim-codebase-mapper': { quality: 'sonnet', balanced: 'haiku', budget: 'haiku' },\n 'maxsim-verifier': { quality: 'sonnet', balanced: 'sonnet', budget: 'haiku' },\n 'maxsim-plan-checker': { quality: 'sonnet', balanced: 'sonnet', budget: 'haiku' },\n 'maxsim-integration-checker': { quality: 'sonnet', balanced: 'sonnet', budget: 'haiku' },\n};\n// ─── Output helpers ──────────────────────────────────────────────────────────\n// DEPRECATION: output() and error() call process.exit() and belong in the CLI\n// layer. They are kept here for backward compatibility during the port. Future\n// plans should move these to @maxsim/cli.\nfunction output(result, raw, rawValue) {\n if (raw && rawValue !== undefined) {\n process.stdout.write(String(rawValue));\n }\n else {\n const json = JSON.stringify(result, null, 2);\n if (json.length > 50000) {\n const tmpPath = node_path_1.default.join(node_os_1.default.tmpdir(), `maxsim-${Date.now()}.json`);\n node_fs_1.default.writeFileSync(tmpPath, json, 'utf-8');\n process.stdout.write('@file:' + tmpPath);\n }\n else {\n process.stdout.write(json);\n }\n }\n process.exit(0);\n}\nfunction error(message) {\n process.stderr.write('Error: ' + message + '\\n');\n process.exit(1);\n}\n// ─── File & Config utilities ─────────────────────────────────────────────────\nfunction safeReadFile(filePath) {\n try {\n return node_fs_1.default.readFileSync(filePath, 'utf-8');\n }\n catch {\n return null;\n }\n}\nfunction loadConfig(cwd) {\n const configPath = node_path_1.default.join(cwd, '.planning', 'config.json');\n const defaults = {\n model_profile: 'balanced',\n commit_docs: true,\n search_gitignored: false,\n branching_strategy: 'none',\n phase_branch_template: 'maxsim/phase-{phase}-{slug}',\n milestone_branch_template: 'maxsim/{milestone}-{slug}',\n research: true,\n plan_checker: true,\n verifier: true,\n parallelization: true,\n brave_search: false,\n };\n try {\n const raw = node_fs_1.default.readFileSync(configPath, 'utf-8');\n const parsed = JSON.parse(raw);\n const get = (key, nested) => {\n if (parsed[key] !== undefined)\n return parsed[key];\n if (nested) {\n const section = parsed[nested.section];\n if (section && typeof section === 'object' && section !== null && nested.field in section) {\n return section[nested.field];\n }\n }\n return undefined;\n };\n const parallelization = (() => {\n const val = get('parallelization');\n if (typeof val === 'boolean')\n return val;\n if (typeof val === 'object' && val !== null && 'enabled' in val) {\n return val.enabled;\n }\n return defaults.parallelization;\n })();\n return {\n model_profile: get('model_profile') ?? defaults.model_profile,\n commit_docs: get('commit_docs', { section: 'planning', field: 'commit_docs' }) ?? defaults.commit_docs,\n search_gitignored: get('search_gitignored', { section: 'planning', field: 'search_gitignored' }) ?? defaults.search_gitignored,\n branching_strategy: get('branching_strategy', { section: 'git', field: 'branching_strategy' }) ?? defaults.branching_strategy,\n phase_branch_template: get('phase_branch_template', { section: 'git', field: 'phase_branch_template' }) ?? defaults.phase_branch_template,\n milestone_branch_template: get('milestone_branch_template', { section: 'git', field: 'milestone_branch_template' }) ?? defaults.milestone_branch_template,\n research: get('research', { section: 'workflow', field: 'research' }) ?? defaults.research,\n plan_checker: get('plan_checker', { section: 'workflow', field: 'plan_check' }) ?? defaults.plan_checker,\n verifier: get('verifier', { section: 'workflow', field: 'verifier' }) ?? defaults.verifier,\n parallelization,\n brave_search: get('brave_search') ?? defaults.brave_search,\n model_overrides: parsed['model_overrides'],\n };\n }\n catch {\n return defaults;\n }\n}\n// ─── Git utilities ───────────────────────────────────────────────────────────\nfunction isGitIgnored(cwd, targetPath) {\n try {\n (0, node_child_process_1.execSync)('git check-ignore -q -- ' + targetPath.replace(/[^a-zA-Z0-9._\\-/]/g, ''), {\n cwd,\n stdio: 'pipe',\n });\n return true;\n }\n catch {\n return false;\n }\n}\nfunction execGit(cwd, args) {\n try {\n const escaped = args.map(a => {\n if (/^[a-zA-Z0-9._\\-/=:@]+$/.test(a))\n return a;\n return \"'\" + a.replace(/'/g, \"'\\\\''\") + \"'\";\n });\n const stdout = (0, node_child_process_1.execSync)('git ' + escaped.join(' '), {\n cwd,\n stdio: 'pipe',\n encoding: 'utf-8',\n });\n return { exitCode: 0, stdout: stdout.trim(), stderr: '' };\n }\n catch (thrown) {\n const err = thrown;\n return {\n exitCode: err.status ?? 1,\n stdout: (err.stdout ?? '').toString().trim(),\n stderr: (err.stderr ?? '').toString().trim(),\n };\n }\n}\n// ─── Phase utilities ─────────────────────────────────────────────────────────\nfunction normalizePhaseName(phase) {\n const match = phase.match(/^(\\d+)([A-Z])?(\\.\\d+)?/i);\n if (!match)\n return phase;\n const padded = match[1].padStart(2, '0');\n const letter = match[2] ? match[2].toUpperCase() : '';\n const decimal = match[3] || '';\n return padded + letter + decimal;\n}\nfunction comparePhaseNum(a, b) {\n const pa = String(a).match(/^(\\d+)([A-Z])?(\\.\\d+)?/i);\n const pb = String(b).match(/^(\\d+)([A-Z])?(\\.\\d+)?/i);\n if (!pa || !pb)\n return String(a).localeCompare(String(b));\n const intDiff = parseInt(pa[1], 10) - parseInt(pb[1], 10);\n if (intDiff !== 0)\n return intDiff;\n const la = (pa[2] || '').toUpperCase();\n const lb = (pb[2] || '').toUpperCase();\n if (la !== lb) {\n if (!la)\n return -1;\n if (!lb)\n return 1;\n return la < lb ? -1 : 1;\n }\n const da = pa[3] ? parseFloat(pa[3]) : -1;\n const db = pb[3] ? parseFloat(pb[3]) : -1;\n return da - db;\n}\nfunction searchPhaseInDir(baseDir, relBase, normalized) {\n try {\n const entries = node_fs_1.default.readdirSync(baseDir, { withFileTypes: true });\n const dirs = entries.filter(e => e.isDirectory()).map(e => e.name).sort((a, b) => comparePhaseNum(a, b));\n const match = dirs.find(d => d.startsWith(normalized));\n if (!match)\n return null;\n const dirMatch = match.match(/^(\\d+[A-Z]?(?:\\.\\d+)?)-?(.*)/i);\n const phaseNumber = dirMatch ? dirMatch[1] : normalized;\n const phaseName = dirMatch && dirMatch[2] ? dirMatch[2] : null;\n const phaseDir = node_path_1.default.join(baseDir, match);\n const phaseFiles = node_fs_1.default.readdirSync(phaseDir);\n const plans = phaseFiles.filter(f => f.endsWith('-PLAN.md') || f === 'PLAN.md').sort();\n const summaries = phaseFiles.filter(f => f.endsWith('-SUMMARY.md') || f === 'SUMMARY.md').sort();\n const hasResearch = phaseFiles.some(f => f.endsWith('-RESEARCH.md') || f === 'RESEARCH.md');\n const hasContext = phaseFiles.some(f => f.endsWith('-CONTEXT.md') || f === 'CONTEXT.md');\n const hasVerification = phaseFiles.some(f => f.endsWith('-VERIFICATION.md') || f === 'VERIFICATION.md');\n const completedPlanIds = new Set(summaries.map(s => s.replace('-SUMMARY.md', '').replace('SUMMARY.md', '')));\n const incompletePlans = plans.filter(p => {\n const planId = p.replace('-PLAN.md', '').replace('PLAN.md', '');\n return !completedPlanIds.has(planId);\n });\n return {\n found: true,\n directory: node_path_1.default.join(relBase, match),\n phase_number: phaseNumber,\n phase_name: phaseName,\n phase_slug: phaseName ? phaseName.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '') : null,\n plans,\n summaries,\n incomplete_plans: incompletePlans,\n has_research: hasResearch,\n has_context: hasContext,\n has_verification: hasVerification,\n };\n }\n catch {\n return null;\n }\n}\nfunction findPhaseInternal(cwd, phase) {\n if (!phase)\n return null;\n const phasesDir = node_path_1.default.join(cwd, '.planning', 'phases');\n const normalized = normalizePhaseName(phase);\n const current = searchPhaseInDir(phasesDir, node_path_1.default.join('.planning', 'phases'), normalized);\n if (current)\n return current;\n const milestonesDir = node_path_1.default.join(cwd, '.planning', 'milestones');\n if (!node_fs_1.default.existsSync(milestonesDir))\n return null;\n try {\n const milestoneEntries = node_fs_1.default.readdirSync(milestonesDir, { withFileTypes: true });\n const archiveDirs = milestoneEntries\n .filter(e => e.isDirectory() && /^v[\\d.]+-phases$/.test(e.name))\n .map(e => e.name)\n .sort()\n .reverse();\n for (const archiveName of archiveDirs) {\n const versionMatch = archiveName.match(/^(v[\\d.]+)-phases$/);\n if (!versionMatch)\n continue;\n const version = versionMatch[1];\n const archivePath = node_path_1.default.join(milestonesDir, archiveName);\n const relBase = node_path_1.default.join('.planning', 'milestones', archiveName);\n const result = searchPhaseInDir(archivePath, relBase, normalized);\n if (result) {\n result.archived = version;\n return result;\n }\n }\n }\n catch { /* ignore */ }\n return null;\n}\nfunction getArchivedPhaseDirs(cwd) {\n const milestonesDir = node_path_1.default.join(cwd, '.planning', 'milestones');\n const results = [];\n if (!node_fs_1.default.existsSync(milestonesDir))\n return results;\n try {\n const milestoneEntries = node_fs_1.default.readdirSync(milestonesDir, { withFileTypes: true });\n const phaseDirs = milestoneEntries\n .filter(e => e.isDirectory() && /^v[\\d.]+-phases$/.test(e.name))\n .map(e => e.name)\n .sort()\n .reverse();\n for (const archiveName of phaseDirs) {\n const versionMatch = archiveName.match(/^(v[\\d.]+)-phases$/);\n if (!versionMatch)\n continue;\n const version = versionMatch[1];\n const archivePath = node_path_1.default.join(milestonesDir, archiveName);\n const entries = node_fs_1.default.readdirSync(archivePath, { withFileTypes: true });\n const dirs = entries.filter(e => e.isDirectory()).map(e => e.name).sort((a, b) => comparePhaseNum(a, b));\n for (const dir of dirs) {\n results.push({\n name: dir,\n milestone: version,\n basePath: node_path_1.default.join('.planning', 'milestones', archiveName),\n fullPath: node_path_1.default.join(archivePath, dir),\n });\n }\n }\n }\n catch { /* ignore */ }\n return results;\n}\n// ─── Roadmap & model utilities ───────────────────────────────────────────────\nfunction getRoadmapPhaseInternal(cwd, phaseNum) {\n if (!phaseNum)\n return null;\n const roadmapPath = node_path_1.default.join(cwd, '.planning', 'ROADMAP.md');\n if (!node_fs_1.default.existsSync(roadmapPath))\n return null;\n try {\n const content = node_fs_1.default.readFileSync(roadmapPath, 'utf-8');\n const escapedPhase = phaseNum.toString().replace(/\\./g, '\\\\.');\n const phasePattern = new RegExp(`#{2,4}\\\\s*Phase\\\\s+${escapedPhase}:\\\\s*([^\\\\n]+)`, 'i');\n const headerMatch = content.match(phasePattern);\n if (!headerMatch)\n return null;\n const phaseName = headerMatch[1].trim();\n const headerIndex = headerMatch.index;\n const restOfContent = content.slice(headerIndex);\n const nextHeaderMatch = restOfContent.match(/\\n#{2,4}\\s+Phase\\s+\\d/i);\n const sectionEnd = nextHeaderMatch ? headerIndex + nextHeaderMatch.index : content.length;\n const section = content.slice(headerIndex, sectionEnd).trim();\n const goalMatch = section.match(/\\*\\*Goal:\\*\\*\\s*([^\\n]+)/i);\n const goal = goalMatch ? goalMatch[1].trim() : null;\n return {\n found: true,\n phase_number: phaseNum.toString(),\n phase_name: phaseName,\n goal,\n section,\n };\n }\n catch {\n return null;\n }\n}\nfunction resolveModelInternal(cwd, agentType) {\n const config = loadConfig(cwd);\n const override = config.model_overrides?.[agentType];\n if (override) {\n return override === 'opus' ? 'inherit' : override;\n }\n const profile = config.model_profile || 'balanced';\n const agentModels = exports.MODEL_PROFILES[agentType];\n if (!agentModels)\n return 'sonnet';\n const resolved = agentModels[profile] || agentModels['balanced'] || 'sonnet';\n return resolved === 'opus' ? 'inherit' : resolved;\n}\n// ─── Misc utilities ──────────────────────────────────────────────────────────\nfunction pathExistsInternal(cwd, targetPath) {\n const fullPath = node_path_1.default.isAbsolute(targetPath) ? targetPath : node_path_1.default.join(cwd, targetPath);\n try {\n node_fs_1.default.statSync(fullPath);\n return true;\n }\n catch {\n return false;\n }\n}\nfunction generateSlugInternal(text) {\n if (!text)\n return null;\n return text.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '');\n}\nfunction getMilestoneInfo(cwd) {\n try {\n const roadmap = node_fs_1.default.readFileSync(node_path_1.default.join(cwd, '.planning', 'ROADMAP.md'), 'utf-8');\n const versionMatch = roadmap.match(/v(\\d+\\.\\d+)/);\n const nameMatch = roadmap.match(/## .*v\\d+\\.\\d+[:\\s]+([^\\n(]+)/);\n return {\n version: versionMatch ? versionMatch[0] : 'v1.0',\n name: nameMatch ? nameMatch[1].trim() : 'milestone',\n };\n }\n catch {\n return { version: 'v1.0', name: 'milestone' };\n }\n}\n//# sourceMappingURL=core.js.map","\"use strict\";\n/**\n * Frontmatter — YAML frontmatter parsing, serialization, and CRUD commands\n *\n * Ported from maxsim/bin/lib/frontmatter.cjs\n */\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.FRONTMATTER_SCHEMAS = void 0;\nexports.extractFrontmatter = extractFrontmatter;\nexports.reconstructFrontmatter = reconstructFrontmatter;\nexports.spliceFrontmatter = spliceFrontmatter;\nexports.parseMustHavesBlock = parseMustHavesBlock;\nexports.cmdFrontmatterGet = cmdFrontmatterGet;\nexports.cmdFrontmatterSet = cmdFrontmatterSet;\nexports.cmdFrontmatterMerge = cmdFrontmatterMerge;\nexports.cmdFrontmatterValidate = cmdFrontmatterValidate;\nconst node_fs_1 = __importDefault(require(\"node:fs\"));\nconst node_path_1 = __importDefault(require(\"node:path\"));\nconst core_js_1 = require(\"./core.js\");\n/**\n * Extract YAML frontmatter from markdown content into a typed object.\n */\nfunction extractFrontmatter(content) {\n const frontmatter = {};\n const match = content.match(/^---\\n([\\s\\S]+?)\\n---/);\n if (!match)\n return frontmatter;\n const yaml = match[1];\n const lines = yaml.split('\\n');\n const stack = [{ obj: frontmatter, key: null, indent: -1 }];\n for (const line of lines) {\n if (line.trim() === '')\n continue;\n const indentMatch = line.match(/^(\\s*)/);\n const indent = indentMatch ? indentMatch[1].length : 0;\n // Pop stack back to appropriate level\n while (stack.length > 1 && indent <= stack[stack.length - 1].indent) {\n stack.pop();\n }\n const current = stack[stack.length - 1];\n // Check for key: value pattern\n const keyMatch = line.match(/^(\\s*)([a-zA-Z0-9_-]+):\\s*(.*)/);\n if (keyMatch) {\n const key = keyMatch[2];\n const value = keyMatch[3].trim();\n if (value === '' || value === '[') {\n // Key with no value or opening bracket\n const newObj = value === '[' ? [] : {};\n current.obj[key] = newObj;\n current.key = null;\n stack.push({ obj: newObj, key: null, indent });\n }\n else if (value.startsWith('[') && value.endsWith(']')) {\n // Inline array: key: [a, b, c]\n current.obj[key] = value\n .slice(1, -1)\n .split(',')\n .map(s => s.trim().replace(/^[\"']|[\"']$/g, ''))\n .filter(Boolean);\n current.key = null;\n }\n else {\n // Simple key: value\n current.obj[key] = value.replace(/^[\"']|[\"']$/g, '');\n current.key = null;\n }\n }\n else if (line.trim().startsWith('- ')) {\n // Array item\n const itemValue = line.trim().slice(2).replace(/^[\"']|[\"']$/g, '');\n if (typeof current.obj === 'object' &&\n !Array.isArray(current.obj) &&\n Object.keys(current.obj).length === 0) {\n // Convert empty object to array\n const parent = stack.length > 1 ? stack[stack.length - 2] : null;\n if (parent && !Array.isArray(parent.obj)) {\n for (const k of Object.keys(parent.obj)) {\n if (parent.obj[k] === current.obj) {\n const arr = [itemValue];\n parent.obj[k] = arr;\n current.obj = arr;\n break;\n }\n }\n }\n }\n else if (Array.isArray(current.obj)) {\n current.obj.push(itemValue);\n }\n }\n }\n return frontmatter;\n}\n/**\n * Reconstruct YAML frontmatter string from an object.\n */\nfunction reconstructFrontmatter(obj) {\n const lines = [];\n for (const [key, value] of Object.entries(obj)) {\n if (value === null || value === undefined)\n continue;\n if (Array.isArray(value)) {\n formatArray(lines, key, value, 0);\n }\n else if (typeof value === 'object') {\n lines.push(`${key}:`);\n for (const [subkey, subval] of Object.entries(value)) {\n if (subval === null || subval === undefined)\n continue;\n if (Array.isArray(subval)) {\n formatArray(lines, subkey, subval, 2);\n }\n else if (typeof subval === 'object') {\n lines.push(` ${subkey}:`);\n for (const [subsubkey, subsubval] of Object.entries(subval)) {\n if (subsubval === null || subsubval === undefined)\n continue;\n if (Array.isArray(subsubval)) {\n if (subsubval.length === 0) {\n lines.push(` ${subsubkey}: []`);\n }\n else {\n lines.push(` ${subsubkey}:`);\n for (const item of subsubval) {\n lines.push(` - ${item}`);\n }\n }\n }\n else {\n lines.push(` ${subsubkey}: ${subsubval}`);\n }\n }\n }\n else {\n const sv = String(subval);\n lines.push(` ${subkey}: ${sv.includes(':') || sv.includes('#') ? `\"${sv}\"` : sv}`);\n }\n }\n }\n else {\n const sv = String(value);\n if (sv.includes(':') || sv.includes('#') || sv.startsWith('[') || sv.startsWith('{')) {\n lines.push(`${key}: \"${sv}\"`);\n }\n else {\n lines.push(`${key}: ${sv}`);\n }\n }\n }\n return lines.join('\\n');\n}\nfunction formatArray(lines, key, value, indentLevel) {\n const prefix = ' '.repeat(indentLevel);\n if (value.length === 0) {\n lines.push(`${prefix}${key}: []`);\n }\n else if (value.every(v => typeof v === 'string') &&\n value.length <= 3 &&\n value.join(', ').length < 60) {\n lines.push(`${prefix}${key}: [${value.join(', ')}]`);\n }\n else {\n lines.push(`${prefix}${key}:`);\n for (const item of value) {\n const itemStr = String(item);\n lines.push(`${prefix} - ${typeof item === 'string' && (itemStr.includes(':') || itemStr.includes('#')) ? `\"${itemStr}\"` : itemStr}`);\n }\n }\n}\n/**\n * Replace or insert frontmatter in markdown content.\n */\nfunction spliceFrontmatter(content, newObj) {\n const yamlStr = reconstructFrontmatter(newObj);\n const match = content.match(/^---\\n[\\s\\S]+?\\n---/);\n if (match) {\n return `---\\n${yamlStr}\\n---` + content.slice(match[0].length);\n }\n return `---\\n${yamlStr}\\n---\\n\\n` + content;\n}\n/**\n * Parse a specific block from must_haves in raw frontmatter YAML.\n */\nfunction parseMustHavesBlock(content, blockName) {\n const fmMatch = content.match(/^---\\n([\\s\\S]+?)\\n---/);\n if (!fmMatch)\n return [];\n const yaml = fmMatch[1];\n const blockPattern = new RegExp(`^\\\\s{4}${blockName}:\\\\s*$`, 'm');\n const blockStart = yaml.search(blockPattern);\n if (blockStart === -1)\n return [];\n const afterBlock = yaml.slice(blockStart);\n const blockLines = afterBlock.split('\\n').slice(1);\n const items = [];\n let current = null;\n for (const line of blockLines) {\n if (line.trim() === '')\n continue;\n const indent = line.match(/^(\\s*)/)[1].length;\n if (indent <= 4 && line.trim() !== '')\n break;\n if (line.match(/^\\s{6}-\\s+/)) {\n if (current !== null)\n items.push(current);\n current = {};\n const simpleMatch = line.match(/^\\s{6}-\\s+\"?([^\"]+)\"?\\s*$/);\n if (simpleMatch && !line.includes(':')) {\n current = simpleMatch[1];\n }\n else {\n const kvMatch = line.match(/^\\s{6}-\\s+(\\w+):\\s*\"?([^\"]*)\"?\\s*$/);\n if (kvMatch) {\n current = { [kvMatch[1]]: kvMatch[2] };\n }\n }\n }\n else if (current !== null && typeof current === 'object') {\n const kvMatch = line.match(/^\\s{8,}(\\w+):\\s*\"?([^\"]*)\"?\\s*$/);\n if (kvMatch) {\n const val = kvMatch[2];\n current[kvMatch[1]] = /^\\d+$/.test(val) ? parseInt(val, 10) : val;\n }\n const arrMatch = line.match(/^\\s{10,}-\\s+\"?([^\"]+)\"?\\s*$/);\n if (arrMatch) {\n const keys = Object.keys(current);\n const lastKey = keys[keys.length - 1];\n if (lastKey && !Array.isArray(current[lastKey])) {\n current[lastKey] = current[lastKey] ? [String(current[lastKey])] : [];\n }\n if (lastKey)\n current[lastKey].push(arrMatch[1]);\n }\n }\n }\n if (current !== null)\n items.push(current);\n return items;\n}\n// ─── Frontmatter schema validation ──────────────────────────────────────────\nexports.FRONTMATTER_SCHEMAS = {\n plan: {\n required: ['phase', 'plan', 'type', 'wave', 'depends_on', 'files_modified', 'autonomous', 'must_haves'],\n },\n summary: {\n required: ['phase', 'plan', 'subsystem', 'tags', 'duration', 'completed'],\n },\n verification: {\n required: ['phase', 'verified', 'status', 'score'],\n },\n};\n// ─── Frontmatter CRUD commands ──────────────────────────────────────────────\nfunction cmdFrontmatterGet(cwd, filePath, field, raw) {\n if (!filePath) {\n (0, core_js_1.error)('file path required');\n }\n const fullPath = node_path_1.default.isAbsolute(filePath) ? filePath : node_path_1.default.join(cwd, filePath);\n const content = (0, core_js_1.safeReadFile)(fullPath);\n if (!content) {\n (0, core_js_1.output)({ error: 'File not found', path: filePath }, raw);\n return;\n }\n const fm = extractFrontmatter(content);\n if (field) {\n const value = fm[field];\n if (value === undefined) {\n (0, core_js_1.output)({ error: 'Field not found', field }, raw);\n return;\n }\n (0, core_js_1.output)({ [field]: value }, raw, JSON.stringify(value));\n }\n else {\n (0, core_js_1.output)(fm, raw);\n }\n}\nfunction cmdFrontmatterSet(cwd, filePath, field, value, raw) {\n if (!filePath || !field || value === undefined) {\n (0, core_js_1.error)('file, field, and value required');\n }\n const fullPath = node_path_1.default.isAbsolute(filePath) ? filePath : node_path_1.default.join(cwd, filePath);\n if (!node_fs_1.default.existsSync(fullPath)) {\n (0, core_js_1.output)({ error: 'File not found', path: filePath }, raw);\n return;\n }\n const content = node_fs_1.default.readFileSync(fullPath, 'utf-8');\n const fm = extractFrontmatter(content);\n let parsedValue;\n try {\n parsedValue = JSON.parse(value);\n }\n catch {\n parsedValue = value;\n }\n fm[field] = parsedValue;\n const newContent = spliceFrontmatter(content, fm);\n node_fs_1.default.writeFileSync(fullPath, newContent, 'utf-8');\n (0, core_js_1.output)({ updated: true, field, value: parsedValue }, raw, 'true');\n}\nfunction cmdFrontmatterMerge(cwd, filePath, data, raw) {\n if (!filePath || !data) {\n (0, core_js_1.error)('file and data required');\n }\n const fullPath = node_path_1.default.isAbsolute(filePath) ? filePath : node_path_1.default.join(cwd, filePath);\n if (!node_fs_1.default.existsSync(fullPath)) {\n (0, core_js_1.output)({ error: 'File not found', path: filePath }, raw);\n return;\n }\n const content = node_fs_1.default.readFileSync(fullPath, 'utf-8');\n const fm = extractFrontmatter(content);\n let mergeData;\n try {\n mergeData = JSON.parse(data);\n }\n catch {\n (0, core_js_1.error)('Invalid JSON for --data');\n return;\n }\n Object.assign(fm, mergeData);\n const newContent = spliceFrontmatter(content, fm);\n node_fs_1.default.writeFileSync(fullPath, newContent, 'utf-8');\n (0, core_js_1.output)({ merged: true, fields: Object.keys(mergeData) }, raw, 'true');\n}\nfunction cmdFrontmatterValidate(cwd, filePath, schemaName, raw) {\n if (!filePath || !schemaName) {\n (0, core_js_1.error)('file and schema required');\n }\n const schema = exports.FRONTMATTER_SCHEMAS[schemaName];\n if (!schema) {\n (0, core_js_1.error)(`Unknown schema: ${schemaName}. Available: ${Object.keys(exports.FRONTMATTER_SCHEMAS).join(', ')}`);\n }\n const fullPath = node_path_1.default.isAbsolute(filePath) ? filePath : node_path_1.default.join(cwd, filePath);\n const content = (0, core_js_1.safeReadFile)(fullPath);\n if (!content) {\n (0, core_js_1.output)({ error: 'File not found', path: filePath }, raw);\n return;\n }\n const fm = extractFrontmatter(content);\n const missing = schema.required.filter(f => fm[f] === undefined);\n const present = schema.required.filter(f => fm[f] !== undefined);\n const result = {\n valid: missing.length === 0,\n missing,\n present,\n schema: schemaName,\n };\n (0, core_js_1.output)(result, raw, missing.length === 0 ? 'valid' : 'invalid');\n}\n//# sourceMappingURL=frontmatter.js.map","\"use strict\";\n/**\n * Config — Planning config CRUD operations\n *\n * Ported from maxsim/bin/lib/config.cjs\n */\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.cmdConfigEnsureSection = cmdConfigEnsureSection;\nexports.cmdConfigSet = cmdConfigSet;\nexports.cmdConfigGet = cmdConfigGet;\nconst node_fs_1 = __importDefault(require(\"node:fs\"));\nconst node_path_1 = __importDefault(require(\"node:path\"));\nconst node_os_1 = __importDefault(require(\"node:os\"));\nconst core_js_1 = require(\"./core.js\");\nconst types_js_1 = require(\"./types.js\");\n// ─── Config CRUD commands ───────────────────────────────────────────────────\nfunction cmdConfigEnsureSection(cwd, raw) {\n const configPath = node_path_1.default.join(cwd, '.planning', 'config.json');\n const planningDir = node_path_1.default.join(cwd, '.planning');\n try {\n if (!node_fs_1.default.existsSync(planningDir)) {\n node_fs_1.default.mkdirSync(planningDir, { recursive: true });\n }\n }\n catch (err) {\n (0, core_js_1.error)('Failed to create .planning directory: ' + err.message);\n }\n if (node_fs_1.default.existsSync(configPath)) {\n const result = { created: false, reason: 'already_exists' };\n (0, core_js_1.output)(result, raw, 'exists');\n return;\n }\n // Detect Brave Search API key availability\n const homedir = node_os_1.default.homedir();\n const braveKeyFile = node_path_1.default.join(homedir, '.maxsim', 'brave_api_key');\n const hasBraveSearch = !!(process.env.BRAVE_API_KEY || node_fs_1.default.existsSync(braveKeyFile));\n // Load user-level defaults from ~/.maxsim/defaults.json if available\n const globalDefaultsPath = node_path_1.default.join(homedir, '.maxsim', 'defaults.json');\n let userDefaults = {};\n try {\n if (node_fs_1.default.existsSync(globalDefaultsPath)) {\n userDefaults = JSON.parse(node_fs_1.default.readFileSync(globalDefaultsPath, 'utf-8'));\n }\n }\n catch {\n // Ignore malformed global defaults, fall back to hardcoded\n }\n const hardcoded = {\n ...types_js_1.PLANNING_CONFIG_DEFAULTS,\n brave_search: hasBraveSearch,\n };\n const defaults = {\n ...hardcoded,\n ...userDefaults,\n workflow: {\n ...hardcoded.workflow,\n ...(userDefaults.workflow || {}),\n },\n };\n try {\n node_fs_1.default.writeFileSync(configPath, JSON.stringify(defaults, null, 2), 'utf-8');\n const result = { created: true, path: '.planning/config.json' };\n (0, core_js_1.output)(result, raw, 'created');\n }\n catch (err) {\n (0, core_js_1.error)('Failed to create config.json: ' + err.message);\n }\n}\nfunction cmdConfigSet(cwd, keyPath, value, raw) {\n const configPath = node_path_1.default.join(cwd, '.planning', 'config.json');\n if (!keyPath) {\n (0, core_js_1.error)('Usage: config-set <key.path> <value>');\n }\n // Parse value (handle booleans and numbers)\n let parsedValue = value;\n if (value === 'true')\n parsedValue = true;\n else if (value === 'false')\n parsedValue = false;\n else if (value !== undefined && !isNaN(Number(value)) && value !== '')\n parsedValue = Number(value);\n // Load existing config or start with empty object\n let config = {};\n try {\n if (node_fs_1.default.existsSync(configPath)) {\n config = JSON.parse(node_fs_1.default.readFileSync(configPath, 'utf-8'));\n }\n }\n catch (err) {\n (0, core_js_1.error)('Failed to read config.json: ' + err.message);\n }\n // Set nested value using dot notation\n const keys = keyPath.split('.');\n let current = config;\n for (let i = 0; i < keys.length - 1; i++) {\n const key = keys[i];\n if (current[key] === undefined || typeof current[key] !== 'object') {\n current[key] = {};\n }\n current = current[key];\n }\n current[keys[keys.length - 1]] = parsedValue;\n try {\n node_fs_1.default.writeFileSync(configPath, JSON.stringify(config, null, 2), 'utf-8');\n const result = { updated: true, key: keyPath, value: parsedValue };\n (0, core_js_1.output)(result, raw, `${keyPath}=${parsedValue}`);\n }\n catch (err) {\n (0, core_js_1.error)('Failed to write config.json: ' + err.message);\n }\n}\nfunction cmdConfigGet(cwd, keyPath, raw) {\n const configPath = node_path_1.default.join(cwd, '.planning', 'config.json');\n if (!keyPath) {\n (0, core_js_1.error)('Usage: config-get <key.path>');\n }\n let config = {};\n try {\n if (node_fs_1.default.existsSync(configPath)) {\n config = JSON.parse(node_fs_1.default.readFileSync(configPath, 'utf-8'));\n }\n else {\n (0, core_js_1.error)('No config.json found at ' + configPath);\n }\n }\n catch (err) {\n if (err.message.startsWith('No config.json'))\n throw err;\n (0, core_js_1.error)('Failed to read config.json: ' + err.message);\n }\n const keys = keyPath.split('.');\n let current = config;\n for (const key of keys) {\n if (current === undefined || current === null || typeof current !== 'object') {\n (0, core_js_1.error)(`Key not found: ${keyPath}`);\n }\n current = current[key];\n }\n if (current === undefined) {\n (0, core_js_1.error)(`Key not found: ${keyPath}`);\n }\n (0, core_js_1.output)(current, raw, String(current));\n}\n//# sourceMappingURL=config.js.map","\"use strict\";\n/**\n * State — STATE.md operations and progression engine\n *\n * Ported from maxsim/bin/lib/state.cjs\n */\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.stateExtractField = stateExtractField;\nexports.stateReplaceField = stateReplaceField;\nexports.cmdStateLoad = cmdStateLoad;\nexports.cmdStateGet = cmdStateGet;\nexports.cmdStatePatch = cmdStatePatch;\nexports.cmdStateUpdate = cmdStateUpdate;\nexports.cmdStateAdvancePlan = cmdStateAdvancePlan;\nexports.cmdStateRecordMetric = cmdStateRecordMetric;\nexports.cmdStateUpdateProgress = cmdStateUpdateProgress;\nexports.cmdStateAddDecision = cmdStateAddDecision;\nexports.cmdStateAddBlocker = cmdStateAddBlocker;\nexports.cmdStateResolveBlocker = cmdStateResolveBlocker;\nexports.cmdStateRecordSession = cmdStateRecordSession;\nexports.cmdStateSnapshot = cmdStateSnapshot;\nconst node_fs_1 = __importDefault(require(\"node:fs\"));\nconst node_path_1 = __importDefault(require(\"node:path\"));\nconst core_js_1 = require(\"./core.js\");\n// ─── Internal helpers ────────────────────────────────────────────────────────\nfunction escapeRegex(str) {\n return str.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n}\nfunction stateExtractField(content, fieldName) {\n const pattern = new RegExp(`\\\\*\\\\*${fieldName}:\\\\*\\\\*\\\\s*(.+)`, 'i');\n const match = content.match(pattern);\n return match ? match[1].trim() : null;\n}\nfunction stateReplaceField(content, fieldName, newValue) {\n const escaped = escapeRegex(fieldName);\n const pattern = new RegExp(`(\\\\*\\\\*${escaped}:\\\\*\\\\*\\\\s*)(.*)`, 'i');\n if (pattern.test(content)) {\n return content.replace(pattern, (_match, prefix) => `${prefix}${newValue}`);\n }\n return null;\n}\nfunction readTextArgOrFile(cwd, value, filePath, label) {\n if (!filePath)\n return value;\n const resolvedPath = node_path_1.default.isAbsolute(filePath) ? filePath : node_path_1.default.join(cwd, filePath);\n try {\n return node_fs_1.default.readFileSync(resolvedPath, 'utf-8').trimEnd();\n }\n catch {\n throw new Error(`${label} file not found: ${filePath}`);\n }\n}\n// ─── State commands ──────────────────────────────────────────────────────────\nfunction cmdStateLoad(cwd, raw) {\n const config = (0, core_js_1.loadConfig)(cwd);\n const planningDir = node_path_1.default.join(cwd, '.planning');\n let stateRaw = '';\n try {\n stateRaw = node_fs_1.default.readFileSync(node_path_1.default.join(planningDir, 'STATE.md'), 'utf-8');\n }\n catch { /* empty */ }\n const configExists = node_fs_1.default.existsSync(node_path_1.default.join(planningDir, 'config.json'));\n const roadmapExists = node_fs_1.default.existsSync(node_path_1.default.join(planningDir, 'ROADMAP.md'));\n const stateExists = stateRaw.length > 0;\n const result = {\n config,\n state_raw: stateRaw,\n state_exists: stateExists,\n roadmap_exists: roadmapExists,\n config_exists: configExists,\n };\n if (raw) {\n const c = config;\n const lines = [\n `model_profile=${c.model_profile}`,\n `commit_docs=${c.commit_docs}`,\n `branching_strategy=${c.branching_strategy}`,\n `phase_branch_template=${c.phase_branch_template}`,\n `milestone_branch_template=${c.milestone_branch_template}`,\n `parallelization=${c.parallelization}`,\n `research=${c.research}`,\n `plan_checker=${c.plan_checker}`,\n `verifier=${c.verifier}`,\n `config_exists=${configExists}`,\n `roadmap_exists=${roadmapExists}`,\n `state_exists=${stateExists}`,\n ];\n process.stdout.write(lines.join('\\n'));\n process.exit(0);\n }\n (0, core_js_1.output)(result);\n}\nfunction cmdStateGet(cwd, section, raw) {\n const statePath = node_path_1.default.join(cwd, '.planning', 'STATE.md');\n try {\n const content = node_fs_1.default.readFileSync(statePath, 'utf-8');\n if (!section) {\n (0, core_js_1.output)({ content }, raw, content);\n return;\n }\n const fieldEscaped = escapeRegex(section);\n // Check for **field:** value\n const fieldPattern = new RegExp(`\\\\*\\\\*${fieldEscaped}:\\\\*\\\\*\\\\s*(.*)`, 'i');\n const fieldMatch = content.match(fieldPattern);\n if (fieldMatch) {\n (0, core_js_1.output)({ [section]: fieldMatch[1].trim() }, raw, fieldMatch[1].trim());\n return;\n }\n // Check for ## Section\n const sectionPattern = new RegExp(`##\\\\s*${fieldEscaped}\\\\s*\\n([\\\\s\\\\S]*?)(?=\\\\n##|$)`, 'i');\n const sectionMatch = content.match(sectionPattern);\n if (sectionMatch) {\n (0, core_js_1.output)({ [section]: sectionMatch[1].trim() }, raw, sectionMatch[1].trim());\n return;\n }\n (0, core_js_1.output)({ error: `Section or field \"${section}\" not found` }, raw, '');\n }\n catch {\n (0, core_js_1.error)('STATE.md not found');\n }\n}\nfunction cmdStatePatch(cwd, patches, raw) {\n const statePath = node_path_1.default.join(cwd, '.planning', 'STATE.md');\n try {\n let content = node_fs_1.default.readFileSync(statePath, 'utf-8');\n const results = { updated: [], failed: [] };\n for (const [field, value] of Object.entries(patches)) {\n const fieldEscaped = escapeRegex(field);\n const pattern = new RegExp(`(\\\\*\\\\*${fieldEscaped}:\\\\*\\\\*\\\\s*)(.*)`, 'i');\n if (pattern.test(content)) {\n content = content.replace(pattern, (_match, prefix) => `${prefix}${value}`);\n results.updated.push(field);\n }\n else {\n results.failed.push(field);\n }\n }\n if (results.updated.length > 0) {\n node_fs_1.default.writeFileSync(statePath, content, 'utf-8');\n }\n (0, core_js_1.output)(results, raw, results.updated.length > 0 ? 'true' : 'false');\n }\n catch {\n (0, core_js_1.error)('STATE.md not found');\n }\n}\nfunction cmdStateUpdate(cwd, field, value) {\n if (!field || value === undefined) {\n (0, core_js_1.error)('field and value required for state update');\n }\n const statePath = node_path_1.default.join(cwd, '.planning', 'STATE.md');\n try {\n let content = node_fs_1.default.readFileSync(statePath, 'utf-8');\n const fieldEscaped = escapeRegex(field);\n const pattern = new RegExp(`(\\\\*\\\\*${fieldEscaped}:\\\\*\\\\*\\\\s*)(.*)`, 'i');\n if (pattern.test(content)) {\n content = content.replace(pattern, (_match, prefix) => `${prefix}${value}`);\n node_fs_1.default.writeFileSync(statePath, content, 'utf-8');\n (0, core_js_1.output)({ updated: true });\n }\n else {\n (0, core_js_1.output)({ updated: false, reason: `Field \"${field}\" not found in STATE.md` });\n }\n }\n catch {\n (0, core_js_1.output)({ updated: false, reason: 'STATE.md not found' });\n }\n}\n// ─── State Progression Engine ────────────────────────────────────────────────\nfunction cmdStateAdvancePlan(cwd, raw) {\n const statePath = node_path_1.default.join(cwd, '.planning', 'STATE.md');\n if (!node_fs_1.default.existsSync(statePath)) {\n (0, core_js_1.output)({ error: 'STATE.md not found' }, raw);\n return;\n }\n let content = node_fs_1.default.readFileSync(statePath, 'utf-8');\n const currentPlan = parseInt(stateExtractField(content, 'Current Plan') ?? '', 10);\n const totalPlans = parseInt(stateExtractField(content, 'Total Plans in Phase') ?? '', 10);\n const today = new Date().toISOString().split('T')[0];\n if (isNaN(currentPlan) || isNaN(totalPlans)) {\n (0, core_js_1.output)({ error: 'Cannot parse Current Plan or Total Plans in Phase from STATE.md' }, raw);\n return;\n }\n if (currentPlan >= totalPlans) {\n content = stateReplaceField(content, 'Status', 'Phase complete — ready for verification') || content;\n content = stateReplaceField(content, 'Last Activity', today) || content;\n node_fs_1.default.writeFileSync(statePath, content, 'utf-8');\n (0, core_js_1.output)({ advanced: false, reason: 'last_plan', current_plan: currentPlan, total_plans: totalPlans, status: 'ready_for_verification' }, raw, 'false');\n }\n else {\n const newPlan = currentPlan + 1;\n content = stateReplaceField(content, 'Current Plan', String(newPlan)) || content;\n content = stateReplaceField(content, 'Status', 'Ready to execute') || content;\n content = stateReplaceField(content, 'Last Activity', today) || content;\n node_fs_1.default.writeFileSync(statePath, content, 'utf-8');\n (0, core_js_1.output)({ advanced: true, previous_plan: currentPlan, current_plan: newPlan, total_plans: totalPlans }, raw, 'true');\n }\n}\nfunction cmdStateRecordMetric(cwd, options, raw) {\n const statePath = node_path_1.default.join(cwd, '.planning', 'STATE.md');\n if (!node_fs_1.default.existsSync(statePath)) {\n (0, core_js_1.output)({ error: 'STATE.md not found' }, raw);\n return;\n }\n let content = node_fs_1.default.readFileSync(statePath, 'utf-8');\n const { phase, plan, duration, tasks, files } = options;\n if (!phase || !plan || !duration) {\n (0, core_js_1.output)({ error: 'phase, plan, and duration required' }, raw);\n return;\n }\n const metricsPattern = /(##\\s*Performance Metrics[\\s\\S]*?\\n\\|[^\\n]+\\n\\|[-|\\s]+\\n)([\\s\\S]*?)(?=\\n##|\\n$|$)/i;\n const metricsMatch = content.match(metricsPattern);\n if (metricsMatch) {\n let tableBody = metricsMatch[2].trimEnd();\n const newRow = `| Phase ${phase} P${plan} | ${duration} | ${tasks || '-'} tasks | ${files || '-'} files |`;\n if (tableBody.trim() === '' || tableBody.includes('None yet')) {\n tableBody = newRow;\n }\n else {\n tableBody = tableBody + '\\n' + newRow;\n }\n content = content.replace(metricsPattern, (_match, header) => `${header}${tableBody}\\n`);\n node_fs_1.default.writeFileSync(statePath, content, 'utf-8');\n (0, core_js_1.output)({ recorded: true, phase, plan, duration }, raw, 'true');\n }\n else {\n (0, core_js_1.output)({ recorded: false, reason: 'Performance Metrics section not found in STATE.md' }, raw, 'false');\n }\n}\nfunction cmdStateUpdateProgress(cwd, raw) {\n const statePath = node_path_1.default.join(cwd, '.planning', 'STATE.md');\n if (!node_fs_1.default.existsSync(statePath)) {\n (0, core_js_1.output)({ error: 'STATE.md not found' }, raw);\n return;\n }\n let content = node_fs_1.default.readFileSync(statePath, 'utf-8');\n const phasesDir = node_path_1.default.join(cwd, '.planning', 'phases');\n let totalPlans = 0;\n let totalSummaries = 0;\n if (node_fs_1.default.existsSync(phasesDir)) {\n const phaseDirs = node_fs_1.default.readdirSync(phasesDir, { withFileTypes: true })\n .filter(e => e.isDirectory()).map(e => e.name);\n for (const dir of phaseDirs) {\n const files = node_fs_1.default.readdirSync(node_path_1.default.join(phasesDir, dir));\n totalPlans += files.filter(f => f.match(/-PLAN\\.md$/i)).length;\n totalSummaries += files.filter(f => f.match(/-SUMMARY\\.md$/i)).length;\n }\n }\n const percent = totalPlans > 0 ? Math.min(100, Math.round(totalSummaries / totalPlans * 100)) : 0;\n const barWidth = 10;\n const filled = Math.round(percent / 100 * barWidth);\n const bar = '\\u2588'.repeat(filled) + '\\u2591'.repeat(barWidth - filled);\n const progressStr = `[${bar}] ${percent}%`;\n const progressPattern = /(\\*\\*Progress:\\*\\*\\s*).*/i;\n if (progressPattern.test(content)) {\n content = content.replace(progressPattern, (_match, prefix) => `${prefix}${progressStr}`);\n node_fs_1.default.writeFileSync(statePath, content, 'utf-8');\n (0, core_js_1.output)({ updated: true, percent, completed: totalSummaries, total: totalPlans, bar: progressStr }, raw, progressStr);\n }\n else {\n (0, core_js_1.output)({ updated: false, reason: 'Progress field not found in STATE.md' }, raw, 'false');\n }\n}\nfunction cmdStateAddDecision(cwd, options, raw) {\n const statePath = node_path_1.default.join(cwd, '.planning', 'STATE.md');\n if (!node_fs_1.default.existsSync(statePath)) {\n (0, core_js_1.output)({ error: 'STATE.md not found' }, raw);\n return;\n }\n const { phase, summary, summary_file, rationale, rationale_file } = options;\n let summaryText;\n let rationaleText = '';\n try {\n summaryText = readTextArgOrFile(cwd, summary, summary_file, 'summary');\n rationaleText = readTextArgOrFile(cwd, rationale || '', rationale_file, 'rationale') || '';\n }\n catch (thrown) {\n const e = thrown;\n (0, core_js_1.output)({ added: false, reason: e.message }, raw, 'false');\n return;\n }\n if (!summaryText) {\n (0, core_js_1.output)({ error: 'summary required' }, raw);\n return;\n }\n let content = node_fs_1.default.readFileSync(statePath, 'utf-8');\n const entry = `- [Phase ${phase || '?'}]: ${summaryText}${rationaleText ? ` — ${rationaleText}` : ''}`;\n const sectionPattern = /(###?\\s*(?:Decisions|Decisions Made|Accumulated.*Decisions)\\s*\\n)([\\s\\S]*?)(?=\\n###?|\\n##[^#]|$)/i;\n const match = content.match(sectionPattern);\n if (match) {\n let sectionBody = match[2];\n sectionBody = sectionBody.replace(/None yet\\.?\\s*\\n?/gi, '').replace(/No decisions yet\\.?\\s*\\n?/gi, '');\n sectionBody = sectionBody.trimEnd() + '\\n' + entry + '\\n';\n content = content.replace(sectionPattern, (_match, header) => `${header}${sectionBody}`);\n node_fs_1.default.writeFileSync(statePath, content, 'utf-8');\n (0, core_js_1.output)({ added: true, decision: entry }, raw, 'true');\n }\n else {\n (0, core_js_1.output)({ added: false, reason: 'Decisions section not found in STATE.md' }, raw, 'false');\n }\n}\nfunction cmdStateAddBlocker(cwd, text, raw) {\n const statePath = node_path_1.default.join(cwd, '.planning', 'STATE.md');\n if (!node_fs_1.default.existsSync(statePath)) {\n (0, core_js_1.output)({ error: 'STATE.md not found' }, raw);\n return;\n }\n const blockerOptions = typeof text === 'object' && text !== null ? text : { text: text };\n let blockerText;\n try {\n blockerText = readTextArgOrFile(cwd, blockerOptions.text, blockerOptions.text_file, 'blocker');\n }\n catch (thrown) {\n const e = thrown;\n (0, core_js_1.output)({ added: false, reason: e.message }, raw, 'false');\n return;\n }\n if (!blockerText) {\n (0, core_js_1.output)({ error: 'text required' }, raw);\n return;\n }\n let content = node_fs_1.default.readFileSync(statePath, 'utf-8');\n const entry = `- ${blockerText}`;\n const sectionPattern = /(###?\\s*(?:Blockers|Blockers\\/Concerns|Concerns)\\s*\\n)([\\s\\S]*?)(?=\\n###?|\\n##[^#]|$)/i;\n const match = content.match(sectionPattern);\n if (match) {\n let sectionBody = match[2];\n sectionBody = sectionBody.replace(/None\\.?\\s*\\n?/gi, '').replace(/None yet\\.?\\s*\\n?/gi, '');\n sectionBody = sectionBody.trimEnd() + '\\n' + entry + '\\n';\n content = content.replace(sectionPattern, (_match, header) => `${header}${sectionBody}`);\n node_fs_1.default.writeFileSync(statePath, content, 'utf-8');\n (0, core_js_1.output)({ added: true, blocker: blockerText }, raw, 'true');\n }\n else {\n (0, core_js_1.output)({ added: false, reason: 'Blockers section not found in STATE.md' }, raw, 'false');\n }\n}\nfunction cmdStateResolveBlocker(cwd, text, raw) {\n const statePath = node_path_1.default.join(cwd, '.planning', 'STATE.md');\n if (!node_fs_1.default.existsSync(statePath)) {\n (0, core_js_1.output)({ error: 'STATE.md not found' }, raw);\n return;\n }\n if (!text) {\n (0, core_js_1.output)({ error: 'text required' }, raw);\n return;\n }\n let content = node_fs_1.default.readFileSync(statePath, 'utf-8');\n const sectionPattern = /(###?\\s*(?:Blockers|Blockers\\/Concerns|Concerns)\\s*\\n)([\\s\\S]*?)(?=\\n###?|\\n##[^#]|$)/i;\n const match = content.match(sectionPattern);\n if (match) {\n const sectionBody = match[2];\n const lines = sectionBody.split('\\n');\n const filtered = lines.filter(line => {\n if (!line.startsWith('- '))\n return true;\n return !line.toLowerCase().includes(text.toLowerCase());\n });\n let newBody = filtered.join('\\n');\n if (!newBody.trim() || !newBody.includes('- ')) {\n newBody = 'None\\n';\n }\n content = content.replace(sectionPattern, (_match, header) => `${header}${newBody}`);\n node_fs_1.default.writeFileSync(statePath, content, 'utf-8');\n (0, core_js_1.output)({ resolved: true, blocker: text }, raw, 'true');\n }\n else {\n (0, core_js_1.output)({ resolved: false, reason: 'Blockers section not found in STATE.md' }, raw, 'false');\n }\n}\nfunction cmdStateRecordSession(cwd, options, raw) {\n const statePath = node_path_1.default.join(cwd, '.planning', 'STATE.md');\n if (!node_fs_1.default.existsSync(statePath)) {\n (0, core_js_1.output)({ error: 'STATE.md not found' }, raw);\n return;\n }\n let content = node_fs_1.default.readFileSync(statePath, 'utf-8');\n const now = new Date().toISOString();\n const updated = [];\n let result = stateReplaceField(content, 'Last session', now);\n if (result) {\n content = result;\n updated.push('Last session');\n }\n result = stateReplaceField(content, 'Last Date', now);\n if (result) {\n content = result;\n updated.push('Last Date');\n }\n if (options.stopped_at) {\n result = stateReplaceField(content, 'Stopped At', options.stopped_at);\n if (!result)\n result = stateReplaceField(content, 'Stopped at', options.stopped_at);\n if (result) {\n content = result;\n updated.push('Stopped At');\n }\n }\n const resumeFile = options.resume_file || 'None';\n result = stateReplaceField(content, 'Resume File', resumeFile);\n if (!result)\n result = stateReplaceField(content, 'Resume file', resumeFile);\n if (result) {\n content = result;\n updated.push('Resume File');\n }\n if (updated.length > 0) {\n node_fs_1.default.writeFileSync(statePath, content, 'utf-8');\n (0, core_js_1.output)({ recorded: true, updated }, raw, 'true');\n }\n else {\n (0, core_js_1.output)({ recorded: false, reason: 'No session fields found in STATE.md' }, raw, 'false');\n }\n}\nfunction cmdStateSnapshot(cwd, raw) {\n const statePath = node_path_1.default.join(cwd, '.planning', 'STATE.md');\n if (!node_fs_1.default.existsSync(statePath)) {\n (0, core_js_1.output)({ error: 'STATE.md not found' }, raw);\n return;\n }\n const content = node_fs_1.default.readFileSync(statePath, 'utf-8');\n const extractField = (fieldName) => {\n const pattern = new RegExp(`\\\\*\\\\*${fieldName}:\\\\*\\\\*\\\\s*(.+)`, 'i');\n const match = content.match(pattern);\n return match ? match[1].trim() : null;\n };\n const currentPhase = extractField('Current Phase');\n const currentPhaseName = extractField('Current Phase Name');\n const totalPhasesRaw = extractField('Total Phases');\n const currentPlan = extractField('Current Plan');\n const totalPlansRaw = extractField('Total Plans in Phase');\n const status = extractField('Status');\n const progressRaw = extractField('Progress');\n const lastActivity = extractField('Last Activity');\n const lastActivityDesc = extractField('Last Activity Description');\n const pausedAt = extractField('Paused At');\n const totalPhases = totalPhasesRaw ? parseInt(totalPhasesRaw, 10) : null;\n const totalPlansInPhase = totalPlansRaw ? parseInt(totalPlansRaw, 10) : null;\n const progressPercent = progressRaw ? parseInt(progressRaw.replace('%', ''), 10) : null;\n const decisions = [];\n const decisionsMatch = content.match(/##\\s*Decisions Made[\\s\\S]*?\\n\\|[^\\n]+\\n\\|[-|\\s]+\\n([\\s\\S]*?)(?=\\n##|\\n$|$)/i);\n if (decisionsMatch) {\n const tableBody = decisionsMatch[1];\n const rows = tableBody.trim().split('\\n').filter(r => r.includes('|'));\n for (const row of rows) {\n const cells = row.split('|').map(c => c.trim()).filter(Boolean);\n if (cells.length >= 3) {\n decisions.push({\n phase: cells[0],\n summary: cells[1],\n rationale: cells[2],\n });\n }\n }\n }\n const blockers = [];\n const blockersMatch = content.match(/##\\s*Blockers\\s*\\n([\\s\\S]*?)(?=\\n##|$)/i);\n if (blockersMatch) {\n const blockersSection = blockersMatch[1];\n const items = blockersSection.match(/^-\\s+(.+)$/gm) || [];\n for (const item of items) {\n blockers.push(item.replace(/^-\\s+/, '').trim());\n }\n }\n const session = {\n last_date: null,\n stopped_at: null,\n resume_file: null,\n };\n const sessionMatch = content.match(/##\\s*Session\\s*\\n([\\s\\S]*?)(?=\\n##|$)/i);\n if (sessionMatch) {\n const sessionSection = sessionMatch[1];\n const lastDateMatch = sessionSection.match(/\\*\\*Last Date:\\*\\*\\s*(.+)/i);\n const stoppedAtMatch = sessionSection.match(/\\*\\*Stopped At:\\*\\*\\s*(.+)/i);\n const resumeFileMatch = sessionSection.match(/\\*\\*Resume File:\\*\\*\\s*(.+)/i);\n if (lastDateMatch)\n session.last_date = lastDateMatch[1].trim();\n if (stoppedAtMatch)\n session.stopped_at = stoppedAtMatch[1].trim();\n if (resumeFileMatch)\n session.resume_file = resumeFileMatch[1].trim();\n }\n const snapshot = {\n current_phase: currentPhase,\n current_phase_name: currentPhaseName,\n total_phases: totalPhases,\n current_plan: currentPlan,\n total_plans_in_phase: totalPlansInPhase,\n status,\n progress_percent: progressPercent,\n last_activity: lastActivity,\n last_activity_desc: lastActivityDesc,\n decisions,\n blockers,\n paused_at: pausedAt,\n session,\n };\n (0, core_js_1.output)(snapshot, raw);\n}\n//# sourceMappingURL=state.js.map","\"use strict\";\n/**\n * Roadmap — Roadmap parsing and update operations\n *\n * Ported from maxsim/bin/lib/roadmap.cjs\n */\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.cmdRoadmapGetPhase = cmdRoadmapGetPhase;\nexports.cmdRoadmapAnalyze = cmdRoadmapAnalyze;\nexports.cmdRoadmapUpdatePlanProgress = cmdRoadmapUpdatePlanProgress;\nconst node_fs_1 = __importDefault(require(\"node:fs\"));\nconst node_path_1 = __importDefault(require(\"node:path\"));\nconst core_js_1 = require(\"./core.js\");\n// ─── Roadmap commands ────────────────────────────────────────────────────────\nfunction cmdRoadmapGetPhase(cwd, phaseNum, raw) {\n const roadmapPath = node_path_1.default.join(cwd, '.planning', 'ROADMAP.md');\n if (!node_fs_1.default.existsSync(roadmapPath)) {\n (0, core_js_1.output)({ found: false, error: 'ROADMAP.md not found' }, raw, '');\n return;\n }\n try {\n const content = node_fs_1.default.readFileSync(roadmapPath, 'utf-8');\n const escapedPhase = phaseNum.replace(/\\./g, '\\\\.');\n const phasePattern = new RegExp(`#{2,4}\\\\s*Phase\\\\s+${escapedPhase}:\\\\s*([^\\\\n]+)`, 'i');\n const headerMatch = content.match(phasePattern);\n if (!headerMatch) {\n const checklistPattern = new RegExp(`-\\\\s*\\\\[[ x]\\\\]\\\\s*\\\\*\\\\*Phase\\\\s+${escapedPhase}:\\\\s*([^*]+)\\\\*\\\\*`, 'i');\n const checklistMatch = content.match(checklistPattern);\n if (checklistMatch) {\n (0, core_js_1.output)({\n found: false,\n phase_number: phaseNum,\n phase_name: checklistMatch[1].trim(),\n error: 'malformed_roadmap',\n message: `Phase ${phaseNum} exists in summary list but missing \"### Phase ${phaseNum}:\" detail section. ROADMAP.md needs both formats.`\n }, raw, '');\n return;\n }\n (0, core_js_1.output)({ found: false, phase_number: phaseNum }, raw, '');\n return;\n }\n const phaseName = headerMatch[1].trim();\n const headerIndex = headerMatch.index;\n const restOfContent = content.slice(headerIndex);\n const nextHeaderMatch = restOfContent.match(/\\n#{2,4}\\s+Phase\\s+\\d/i);\n const sectionEnd = nextHeaderMatch\n ? headerIndex + nextHeaderMatch.index\n : content.length;\n const section = content.slice(headerIndex, sectionEnd).trim();\n const goalMatch = section.match(/\\*\\*Goal:\\*\\*\\s*([^\\n]+)/i);\n const goal = goalMatch ? goalMatch[1].trim() : null;\n const criteriaMatch = section.match(/\\*\\*Success Criteria\\*\\*[^\\n]*:\\s*\\n((?:\\s*\\d+\\.\\s*[^\\n]+\\n?)+)/i);\n const success_criteria = criteriaMatch\n ? criteriaMatch[1].trim().split('\\n').map(line => line.replace(/^\\s*\\d+\\.\\s*/, '').trim()).filter(Boolean)\n : [];\n (0, core_js_1.output)({\n found: true,\n phase_number: phaseNum,\n phase_name: phaseName,\n goal,\n success_criteria,\n section,\n }, raw, section);\n }\n catch (e) {\n (0, core_js_1.error)('Failed to read ROADMAP.md: ' + e.message);\n }\n}\nfunction cmdRoadmapAnalyze(cwd, raw) {\n const roadmapPath = node_path_1.default.join(cwd, '.planning', 'ROADMAP.md');\n if (!node_fs_1.default.existsSync(roadmapPath)) {\n (0, core_js_1.output)({ error: 'ROADMAP.md not found', milestones: [], phases: [], current_phase: null }, raw);\n return;\n }\n const content = node_fs_1.default.readFileSync(roadmapPath, 'utf-8');\n const phasesDir = node_path_1.default.join(cwd, '.planning', 'phases');\n const phasePattern = /#{2,4}\\s*Phase\\s+(\\d+[A-Z]?(?:\\.\\d+)?)\\s*:\\s*([^\\n]+)/gi;\n const phases = [];\n let match;\n while ((match = phasePattern.exec(content)) !== null) {\n const phaseNum = match[1];\n const phaseName = match[2].replace(/\\(INSERTED\\)/i, '').trim();\n const sectionStart = match.index;\n const restOfContent = content.slice(sectionStart);\n const nextHeader = restOfContent.match(/\\n#{2,4}\\s+Phase\\s+\\d/i);\n const sectionEnd = nextHeader ? sectionStart + nextHeader.index : content.length;\n const section = content.slice(sectionStart, sectionEnd);\n const goalMatch = section.match(/\\*\\*Goal:\\*\\*\\s*([^\\n]+)/i);\n const goal = goalMatch ? goalMatch[1].trim() : null;\n const dependsMatch = section.match(/\\*\\*Depends on:\\*\\*\\s*([^\\n]+)/i);\n const depends_on = dependsMatch ? dependsMatch[1].trim() : null;\n const normalized = (0, core_js_1.normalizePhaseName)(phaseNum);\n let diskStatus = 'no_directory';\n let planCount = 0;\n let summaryCount = 0;\n let hasContext = false;\n let hasResearch = false;\n try {\n const entries = node_fs_1.default.readdirSync(phasesDir, { withFileTypes: true });\n const dirs = entries.filter(e => e.isDirectory()).map(e => e.name);\n const dirMatch = dirs.find(d => d.startsWith(normalized + '-') || d === normalized);\n if (dirMatch) {\n const phaseFiles = node_fs_1.default.readdirSync(node_path_1.default.join(phasesDir, dirMatch));\n planCount = phaseFiles.filter(f => f.endsWith('-PLAN.md') || f === 'PLAN.md').length;\n summaryCount = phaseFiles.filter(f => f.endsWith('-SUMMARY.md') || f === 'SUMMARY.md').length;\n hasContext = phaseFiles.some(f => f.endsWith('-CONTEXT.md') || f === 'CONTEXT.md');\n hasResearch = phaseFiles.some(f => f.endsWith('-RESEARCH.md') || f === 'RESEARCH.md');\n if (summaryCount >= planCount && planCount > 0)\n diskStatus = 'complete';\n else if (summaryCount > 0)\n diskStatus = 'partial';\n else if (planCount > 0)\n diskStatus = 'planned';\n else if (hasResearch)\n diskStatus = 'researched';\n else if (hasContext)\n diskStatus = 'discussed';\n else\n diskStatus = 'empty';\n }\n }\n catch { /* empty */ }\n const checkboxPattern = new RegExp(`-\\\\s*\\\\[(x| )\\\\]\\\\s*.*Phase\\\\s+${phaseNum.replace('.', '\\\\.')}`, 'i');\n const checkboxMatch = content.match(checkboxPattern);\n const roadmapComplete = checkboxMatch ? checkboxMatch[1] === 'x' : false;\n phases.push({\n number: phaseNum,\n name: phaseName,\n goal,\n depends_on,\n plan_count: planCount,\n summary_count: summaryCount,\n has_context: hasContext,\n has_research: hasResearch,\n disk_status: diskStatus,\n roadmap_complete: roadmapComplete,\n });\n }\n const milestones = [];\n const milestonePattern = /##\\s*(.*v(\\d+\\.\\d+)[^(\\n]*)/gi;\n let mMatch;\n while ((mMatch = milestonePattern.exec(content)) !== null) {\n milestones.push({\n heading: mMatch[1].trim(),\n version: 'v' + mMatch[2],\n });\n }\n const currentPhase = phases.find(p => p.disk_status === 'planned' || p.disk_status === 'partial') || null;\n const nextPhase = phases.find(p => p.disk_status === 'empty' || p.disk_status === 'no_directory' || p.disk_status === 'discussed' || p.disk_status === 'researched') || null;\n const totalPlans = phases.reduce((sum, p) => sum + p.plan_count, 0);\n const totalSummaries = phases.reduce((sum, p) => sum + p.summary_count, 0);\n const completedPhases = phases.filter(p => p.disk_status === 'complete').length;\n const checklistPattern = /-\\s*\\[[ x]\\]\\s*\\*\\*Phase\\s+(\\d+[A-Z]?(?:\\.\\d+)?)/gi;\n const checklistPhases = new Set();\n let checklistMatch;\n while ((checklistMatch = checklistPattern.exec(content)) !== null) {\n checklistPhases.add(checklistMatch[1]);\n }\n const detailPhases = new Set(phases.map(p => p.number));\n const missingDetails = [...checklistPhases].filter(p => !detailPhases.has(p));\n const result = {\n milestones,\n phases,\n phase_count: phases.length,\n completed_phases: completedPhases,\n total_plans: totalPlans,\n total_summaries: totalSummaries,\n progress_percent: totalPlans > 0 ? Math.min(100, Math.round((totalSummaries / totalPlans) * 100)) : 0,\n current_phase: currentPhase ? currentPhase.number : null,\n next_phase: nextPhase ? nextPhase.number : null,\n missing_phase_details: missingDetails.length > 0 ? missingDetails : null,\n };\n (0, core_js_1.output)(result, raw);\n}\nfunction cmdRoadmapUpdatePlanProgress(cwd, phaseNum, raw) {\n if (!phaseNum) {\n (0, core_js_1.error)('phase number required for roadmap update-plan-progress');\n }\n const roadmapPath = node_path_1.default.join(cwd, '.planning', 'ROADMAP.md');\n const phaseInfo = (0, core_js_1.findPhaseInternal)(cwd, phaseNum);\n if (!phaseInfo) {\n (0, core_js_1.error)(`Phase ${phaseNum} not found`);\n }\n const planCount = phaseInfo.plans.length;\n const summaryCount = phaseInfo.summaries.length;\n if (planCount === 0) {\n (0, core_js_1.output)({ updated: false, reason: 'No plans found', plan_count: 0, summary_count: 0 }, raw, 'no plans');\n return;\n }\n const isComplete = summaryCount >= planCount;\n const status = isComplete ? 'Complete' : summaryCount > 0 ? 'In Progress' : 'Planned';\n const today = new Date().toISOString().split('T')[0];\n if (!node_fs_1.default.existsSync(roadmapPath)) {\n (0, core_js_1.output)({ updated: false, reason: 'ROADMAP.md not found', plan_count: planCount, summary_count: summaryCount }, raw, 'no roadmap');\n return;\n }\n let roadmapContent = node_fs_1.default.readFileSync(roadmapPath, 'utf-8');\n const phaseEscaped = phaseNum.replace('.', '\\\\.');\n const tablePattern = new RegExp(`(\\\\|\\\\s*${phaseEscaped}\\\\.?\\\\s[^|]*\\\\|)[^|]*(\\\\|)\\\\s*[^|]*(\\\\|)\\\\s*[^|]*(\\\\|)`, 'i');\n const dateField = isComplete ? ` ${today} ` : ' ';\n roadmapContent = roadmapContent.replace(tablePattern, `$1 ${summaryCount}/${planCount} $2 ${status.padEnd(11)}$3${dateField}$4`);\n const planCountPattern = new RegExp(`(#{2,4}\\\\s*Phase\\\\s+${phaseEscaped}[\\\\s\\\\S]*?\\\\*\\\\*Plans:\\\\*\\\\*\\\\s*)[^\\\\n]+`, 'i');\n const planCountText = isComplete\n ? `${summaryCount}/${planCount} plans complete`\n : `${summaryCount}/${planCount} plans executed`;\n roadmapContent = roadmapContent.replace(planCountPattern, `$1${planCountText}`);\n if (isComplete) {\n const checkboxPattern = new RegExp(`(-\\\\s*\\\\[)[ ](\\\\]\\\\s*.*Phase\\\\s+${phaseEscaped}[:\\\\s][^\\\\n]*)`, 'i');\n roadmapContent = roadmapContent.replace(checkboxPattern, `$1x$2 (completed ${today})`);\n }\n node_fs_1.default.writeFileSync(roadmapPath, roadmapContent, 'utf-8');\n (0, core_js_1.output)({\n updated: true,\n phase: phaseNum,\n plan_count: planCount,\n summary_count: summaryCount,\n status,\n complete: isComplete,\n }, raw, `${summaryCount}/${planCount} ${status}`);\n}\n//# sourceMappingURL=roadmap.js.map","\"use strict\";\n/**\n * Milestone — Milestone and requirements lifecycle operations\n *\n * Ported from maxsim/bin/lib/milestone.cjs\n */\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.cmdRequirementsMarkComplete = cmdRequirementsMarkComplete;\nexports.cmdMilestoneComplete = cmdMilestoneComplete;\nconst node_fs_1 = __importDefault(require(\"node:fs\"));\nconst node_path_1 = __importDefault(require(\"node:path\"));\nconst core_js_1 = require(\"./core.js\");\nconst frontmatter_js_1 = require(\"./frontmatter.js\");\n// ─── Requirements commands ───────────────────────────────────────────────────\nfunction cmdRequirementsMarkComplete(cwd, reqIdsRaw, raw) {\n if (!reqIdsRaw || reqIdsRaw.length === 0) {\n (0, core_js_1.error)('requirement IDs required. Usage: requirements mark-complete REQ-01,REQ-02 or REQ-01 REQ-02');\n }\n const reqIds = reqIdsRaw\n .join(' ')\n .replace(/[\\[\\]]/g, '')\n .split(/[,\\s]+/)\n .map(r => r.trim())\n .filter(Boolean);\n if (reqIds.length === 0) {\n (0, core_js_1.error)('no valid requirement IDs found');\n }\n const reqPath = node_path_1.default.join(cwd, '.planning', 'REQUIREMENTS.md');\n if (!node_fs_1.default.existsSync(reqPath)) {\n (0, core_js_1.output)({ updated: false, reason: 'REQUIREMENTS.md not found', ids: reqIds }, raw, 'no requirements file');\n return;\n }\n let reqContent = node_fs_1.default.readFileSync(reqPath, 'utf-8');\n const updated = [];\n const notFound = [];\n for (const reqId of reqIds) {\n let found = false;\n const checkboxPattern = new RegExp(`(-\\\\s*\\\\[)[ ](\\\\]\\\\s*\\\\*\\\\*${reqId}\\\\*\\\\*)`, 'gi');\n if (checkboxPattern.test(reqContent)) {\n reqContent = reqContent.replace(checkboxPattern, '$1x$2');\n found = true;\n }\n const tablePattern = new RegExp(`(\\\\|\\\\s*${reqId}\\\\s*\\\\|[^|]+\\\\|)\\\\s*Pending\\\\s*(\\\\|)`, 'gi');\n if (tablePattern.test(reqContent)) {\n reqContent = reqContent.replace(new RegExp(`(\\\\|\\\\s*${reqId}\\\\s*\\\\|[^|]+\\\\|)\\\\s*Pending\\\\s*(\\\\|)`, 'gi'), '$1 Complete $2');\n found = true;\n }\n if (found) {\n updated.push(reqId);\n }\n else {\n notFound.push(reqId);\n }\n }\n if (updated.length > 0) {\n node_fs_1.default.writeFileSync(reqPath, reqContent, 'utf-8');\n }\n const result = {\n updated: updated.length > 0,\n marked_complete: updated,\n not_found: notFound,\n total: reqIds.length,\n };\n (0, core_js_1.output)(result, raw, `${updated.length}/${reqIds.length} requirements marked complete`);\n}\n// ─── Milestone commands ──────────────────────────────────────────────────────\nfunction cmdMilestoneComplete(cwd, version, options, raw) {\n if (!version) {\n (0, core_js_1.error)('version required for milestone complete (e.g., v1.0)');\n }\n const roadmapPath = node_path_1.default.join(cwd, '.planning', 'ROADMAP.md');\n const reqPath = node_path_1.default.join(cwd, '.planning', 'REQUIREMENTS.md');\n const statePath = node_path_1.default.join(cwd, '.planning', 'STATE.md');\n const milestonesPath = node_path_1.default.join(cwd, '.planning', 'MILESTONES.md');\n const archiveDir = node_path_1.default.join(cwd, '.planning', 'milestones');\n const phasesDir = node_path_1.default.join(cwd, '.planning', 'phases');\n const today = new Date().toISOString().split('T')[0];\n const milestoneName = options.name || version;\n node_fs_1.default.mkdirSync(archiveDir, { recursive: true });\n let phaseCount = 0;\n let totalPlans = 0;\n let totalTasks = 0;\n const accomplishments = [];\n try {\n const entries = node_fs_1.default.readdirSync(phasesDir, { withFileTypes: true });\n const dirs = entries.filter(e => e.isDirectory()).map(e => e.name).sort();\n for (const dir of dirs) {\n phaseCount++;\n const phaseFiles = node_fs_1.default.readdirSync(node_path_1.default.join(phasesDir, dir));\n const plans = phaseFiles.filter(f => f.endsWith('-PLAN.md') || f === 'PLAN.md');\n const summaries = phaseFiles.filter(f => f.endsWith('-SUMMARY.md') || f === 'SUMMARY.md');\n totalPlans += plans.length;\n for (const s of summaries) {\n try {\n const content = node_fs_1.default.readFileSync(node_path_1.default.join(phasesDir, dir, s), 'utf-8');\n const fm = (0, frontmatter_js_1.extractFrontmatter)(content);\n if (fm['one-liner']) {\n accomplishments.push(String(fm['one-liner']));\n }\n const taskMatches = content.match(/##\\s*Task\\s*\\d+/gi) || [];\n totalTasks += taskMatches.length;\n }\n catch { /* empty */ }\n }\n }\n }\n catch { /* empty */ }\n // Archive ROADMAP.md\n if (node_fs_1.default.existsSync(roadmapPath)) {\n const roadmapContent = node_fs_1.default.readFileSync(roadmapPath, 'utf-8');\n node_fs_1.default.writeFileSync(node_path_1.default.join(archiveDir, `${version}-ROADMAP.md`), roadmapContent, 'utf-8');\n }\n // Archive REQUIREMENTS.md\n if (node_fs_1.default.existsSync(reqPath)) {\n const reqContent = node_fs_1.default.readFileSync(reqPath, 'utf-8');\n const archiveHeader = `# Requirements Archive: ${version} ${milestoneName}\\n\\n**Archived:** ${today}\\n**Status:** SHIPPED\\n\\nFor current requirements, see \\`.planning/REQUIREMENTS.md\\`.\\n\\n---\\n\\n`;\n node_fs_1.default.writeFileSync(node_path_1.default.join(archiveDir, `${version}-REQUIREMENTS.md`), archiveHeader + reqContent, 'utf-8');\n }\n // Archive audit file if exists\n const auditFile = node_path_1.default.join(cwd, '.planning', `${version}-MILESTONE-AUDIT.md`);\n if (node_fs_1.default.existsSync(auditFile)) {\n node_fs_1.default.renameSync(auditFile, node_path_1.default.join(archiveDir, `${version}-MILESTONE-AUDIT.md`));\n }\n // Create/append MILESTONES.md entry\n const accomplishmentsList = accomplishments.map(a => `- ${a}`).join('\\n');\n const milestoneEntry = `## ${version} ${milestoneName} (Shipped: ${today})\\n\\n**Phases completed:** ${phaseCount} phases, ${totalPlans} plans, ${totalTasks} tasks\\n\\n**Key accomplishments:**\\n${accomplishmentsList || '- (none recorded)'}\\n\\n---\\n\\n`;\n if (node_fs_1.default.existsSync(milestonesPath)) {\n const existing = node_fs_1.default.readFileSync(milestonesPath, 'utf-8');\n node_fs_1.default.writeFileSync(milestonesPath, existing + '\\n' + milestoneEntry, 'utf-8');\n }\n else {\n node_fs_1.default.writeFileSync(milestonesPath, `# Milestones\\n\\n${milestoneEntry}`, 'utf-8');\n }\n // Update STATE.md\n if (node_fs_1.default.existsSync(statePath)) {\n let stateContent = node_fs_1.default.readFileSync(statePath, 'utf-8');\n stateContent = stateContent.replace(/(\\*\\*Status:\\*\\*\\s*).*/, `$1${version} milestone complete`);\n stateContent = stateContent.replace(/(\\*\\*Last Activity:\\*\\*\\s*).*/, `$1${today}`);\n stateContent = stateContent.replace(/(\\*\\*Last Activity Description:\\*\\*\\s*).*/, `$1${version} milestone completed and archived`);\n node_fs_1.default.writeFileSync(statePath, stateContent, 'utf-8');\n }\n // Archive phase directories if requested\n let phasesArchived = false;\n if (options.archivePhases) {\n try {\n const phaseArchiveDir = node_path_1.default.join(archiveDir, `${version}-phases`);\n node_fs_1.default.mkdirSync(phaseArchiveDir, { recursive: true });\n const phaseEntries = node_fs_1.default.readdirSync(phasesDir, { withFileTypes: true });\n const phaseDirNames = phaseEntries.filter(e => e.isDirectory()).map(e => e.name);\n for (const dir of phaseDirNames) {\n node_fs_1.default.renameSync(node_path_1.default.join(phasesDir, dir), node_path_1.default.join(phaseArchiveDir, dir));\n }\n phasesArchived = phaseDirNames.length > 0;\n }\n catch { /* empty */ }\n }\n const result = {\n version,\n name: milestoneName,\n date: today,\n phases: phaseCount,\n plans: totalPlans,\n tasks: totalTasks,\n accomplishments,\n archived: {\n roadmap: node_fs_1.default.existsSync(node_path_1.default.join(archiveDir, `${version}-ROADMAP.md`)),\n requirements: node_fs_1.default.existsSync(node_path_1.default.join(archiveDir, `${version}-REQUIREMENTS.md`)),\n audit: node_fs_1.default.existsSync(node_path_1.default.join(archiveDir, `${version}-MILESTONE-AUDIT.md`)),\n phases: phasesArchived,\n },\n milestones_updated: true,\n state_updated: node_fs_1.default.existsSync(statePath),\n };\n (0, core_js_1.output)(result, raw);\n}\n//# sourceMappingURL=milestone.js.map","\"use strict\";\n/**\n * Commands — Standalone utility commands\n *\n * Ported from maxsim/bin/lib/commands.cjs\n */\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.cmdGenerateSlug = cmdGenerateSlug;\nexports.cmdCurrentTimestamp = cmdCurrentTimestamp;\nexports.cmdListTodos = cmdListTodos;\nexports.cmdVerifyPathExists = cmdVerifyPathExists;\nexports.cmdHistoryDigest = cmdHistoryDigest;\nexports.cmdResolveModel = cmdResolveModel;\nexports.cmdCommit = cmdCommit;\nexports.cmdSummaryExtract = cmdSummaryExtract;\nexports.cmdWebsearch = cmdWebsearch;\nexports.cmdProgressRender = cmdProgressRender;\nexports.cmdTodoComplete = cmdTodoComplete;\nexports.cmdScaffold = cmdScaffold;\nconst node_fs_1 = __importDefault(require(\"node:fs\"));\nconst node_path_1 = __importDefault(require(\"node:path\"));\nconst core_js_1 = require(\"./core.js\");\nconst frontmatter_js_1 = require(\"./frontmatter.js\");\n// ─── Slug generation ────────────────────────────────────────────────────────\nfunction cmdGenerateSlug(text, raw) {\n if (!text) {\n (0, core_js_1.error)('text required for slug generation');\n }\n const slug = text\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, '-')\n .replace(/^-+|-+$/g, '');\n const result = { slug };\n (0, core_js_1.output)(result, raw, slug);\n}\n// ─── Timestamp ──────────────────────────────────────────────────────────────\nfunction cmdCurrentTimestamp(format, raw) {\n const now = new Date();\n let result;\n switch (format) {\n case 'date':\n result = now.toISOString().split('T')[0];\n break;\n case 'filename':\n result = now.toISOString().replace(/:/g, '-').replace(/\\..+/, '');\n break;\n case 'full':\n default:\n result = now.toISOString();\n break;\n }\n (0, core_js_1.output)({ timestamp: result }, raw, result);\n}\n// ─── Todos ──────────────────────────────────────────────────────────────────\nfunction cmdListTodos(cwd, area, raw) {\n const pendingDir = node_path_1.default.join(cwd, '.planning', 'todos', 'pending');\n let count = 0;\n const todos = [];\n try {\n const files = node_fs_1.default.readdirSync(pendingDir).filter(f => f.endsWith('.md'));\n for (const file of files) {\n try {\n const content = node_fs_1.default.readFileSync(node_path_1.default.join(pendingDir, file), 'utf-8');\n const createdMatch = content.match(/^created:\\s*(.+)$/m);\n const titleMatch = content.match(/^title:\\s*(.+)$/m);\n const areaMatch = content.match(/^area:\\s*(.+)$/m);\n const todoArea = areaMatch ? areaMatch[1].trim() : 'general';\n // Apply area filter if specified\n if (area && todoArea !== area)\n continue;\n count++;\n todos.push({\n file,\n created: createdMatch ? createdMatch[1].trim() : 'unknown',\n title: titleMatch ? titleMatch[1].trim() : 'Untitled',\n area: todoArea,\n path: node_path_1.default.join('.planning', 'todos', 'pending', file),\n });\n }\n catch { /* skip unreadable files */ }\n }\n }\n catch { /* no pending dir */ }\n const result = { count, todos };\n (0, core_js_1.output)(result, raw, count.toString());\n}\n// ─── Path verification ──────────────────────────────────────────────────────\nfunction cmdVerifyPathExists(cwd, targetPath, raw) {\n if (!targetPath) {\n (0, core_js_1.error)('path required for verification');\n }\n const fullPath = node_path_1.default.isAbsolute(targetPath) ? targetPath : node_path_1.default.join(cwd, targetPath);\n try {\n const stats = node_fs_1.default.statSync(fullPath);\n const type = stats.isDirectory() ? 'directory' : stats.isFile() ? 'file' : 'other';\n const result = { exists: true, type };\n (0, core_js_1.output)(result, raw, 'true');\n }\n catch {\n const result = { exists: false, type: null };\n (0, core_js_1.output)(result, raw, 'false');\n }\n}\n// ─── History digest ─────────────────────────────────────────────────────────\nfunction cmdHistoryDigest(cwd, raw) {\n const phasesDir = node_path_1.default.join(cwd, '.planning', 'phases');\n const digest = { phases: {}, decisions: [], tech_stack: new Set() };\n // Collect all phase directories: archived + current\n const allPhaseDirs = [];\n // Add archived phases first (oldest milestones first)\n const archived = (0, core_js_1.getArchivedPhaseDirs)(cwd);\n for (const a of archived) {\n allPhaseDirs.push({ name: a.name, fullPath: a.fullPath, milestone: a.milestone });\n }\n // Add current phases\n if (node_fs_1.default.existsSync(phasesDir)) {\n try {\n const currentDirs = node_fs_1.default.readdirSync(phasesDir, { withFileTypes: true })\n .filter(e => e.isDirectory())\n .map(e => e.name)\n .sort();\n for (const dir of currentDirs) {\n allPhaseDirs.push({ name: dir, fullPath: node_path_1.default.join(phasesDir, dir), milestone: null });\n }\n }\n catch { /* ignore */ }\n }\n if (allPhaseDirs.length === 0) {\n const emptyDigest = { phases: {}, decisions: [], tech_stack: [] };\n (0, core_js_1.output)(emptyDigest, raw);\n return;\n }\n try {\n for (const { name: dir, fullPath: dirPath } of allPhaseDirs) {\n const summaries = node_fs_1.default.readdirSync(dirPath).filter(f => f.endsWith('-SUMMARY.md') || f === 'SUMMARY.md');\n for (const summary of summaries) {\n try {\n const content = node_fs_1.default.readFileSync(node_path_1.default.join(dirPath, summary), 'utf-8');\n const fm = (0, frontmatter_js_1.extractFrontmatter)(content);\n const phaseNum = fm.phase || dir.split('-')[0];\n if (!digest.phases[phaseNum]) {\n digest.phases[phaseNum] = {\n name: fm.name || dir.split('-').slice(1).join(' ') || 'Unknown',\n provides: new Set(),\n affects: new Set(),\n patterns: new Set(),\n };\n }\n // Merge provides\n const depGraph = fm['dependency-graph'];\n if (depGraph && depGraph.provides) {\n depGraph.provides.forEach(p => digest.phases[phaseNum].provides.add(p));\n }\n else if (fm.provides) {\n fm.provides.forEach(p => digest.phases[phaseNum].provides.add(p));\n }\n // Merge affects\n if (depGraph && depGraph.affects) {\n depGraph.affects.forEach(a => digest.phases[phaseNum].affects.add(a));\n }\n // Merge patterns\n if (fm['patterns-established']) {\n fm['patterns-established'].forEach(p => digest.phases[phaseNum].patterns.add(p));\n }\n // Merge decisions\n if (fm['key-decisions']) {\n fm['key-decisions'].forEach(d => {\n digest.decisions.push({ phase: phaseNum, decision: d });\n });\n }\n // Merge tech stack\n const techStack = fm['tech-stack'];\n if (techStack && techStack.added) {\n techStack.added.forEach(t => digest.tech_stack.add(typeof t === 'string' ? t : t.name));\n }\n }\n catch {\n // Skip malformed summaries\n }\n }\n }\n // Convert Sets to Arrays for JSON output\n const outputDigest = {\n phases: {},\n decisions: digest.decisions,\n tech_stack: [...digest.tech_stack],\n };\n for (const [p, data] of Object.entries(digest.phases)) {\n outputDigest.phases[p] = {\n name: data.name,\n provides: [...data.provides],\n affects: [...data.affects],\n patterns: [...data.patterns],\n };\n }\n (0, core_js_1.output)(outputDigest, raw);\n }\n catch (e) {\n (0, core_js_1.error)('Failed to generate history digest: ' + e.message);\n }\n}\n// ─── Model resolution ───────────────────────────────────────────────────────\nfunction cmdResolveModel(cwd, agentType, raw) {\n if (!agentType) {\n (0, core_js_1.error)('agent-type required');\n }\n const config = (0, core_js_1.loadConfig)(cwd);\n const profile = config.model_profile || 'balanced';\n const agentModels = core_js_1.MODEL_PROFILES[agentType];\n if (!agentModels) {\n const result = { model: 'sonnet', profile, unknown_agent: true };\n (0, core_js_1.output)(result, raw, 'sonnet');\n return;\n }\n const resolved = agentModels[profile] || agentModels['balanced'] || 'sonnet';\n const model = resolved === 'opus' ? 'inherit' : resolved;\n const result = { model, profile };\n (0, core_js_1.output)(result, raw, model);\n}\n// ─── Commit ─────────────────────────────────────────────────────────────────\nfunction cmdCommit(cwd, message, files, raw, amend) {\n if (!message && !amend) {\n (0, core_js_1.error)('commit message required');\n }\n const config = (0, core_js_1.loadConfig)(cwd);\n // Check commit_docs config\n if (!config.commit_docs) {\n const result = { committed: false, hash: null, reason: 'skipped_commit_docs_false' };\n (0, core_js_1.output)(result, raw, 'skipped');\n return;\n }\n // Check if .planning is gitignored\n if ((0, core_js_1.isGitIgnored)(cwd, '.planning')) {\n const result = { committed: false, hash: null, reason: 'skipped_gitignored' };\n (0, core_js_1.output)(result, raw, 'skipped');\n return;\n }\n // Stage files\n const filesToStage = files && files.length > 0 ? files : ['.planning/'];\n for (const file of filesToStage) {\n (0, core_js_1.execGit)(cwd, ['add', file]);\n }\n // Commit\n const commitArgs = amend ? ['commit', '--amend', '--no-edit'] : ['commit', '-m', message];\n const commitResult = (0, core_js_1.execGit)(cwd, commitArgs);\n if (commitResult.exitCode !== 0) {\n if (commitResult.stdout.includes('nothing to commit') || commitResult.stderr.includes('nothing to commit')) {\n const result = { committed: false, hash: null, reason: 'nothing_to_commit' };\n (0, core_js_1.output)(result, raw, 'nothing');\n return;\n }\n const result = { committed: false, hash: null, reason: 'nothing_to_commit', error: commitResult.stderr };\n (0, core_js_1.output)(result, raw, 'nothing');\n return;\n }\n // Get short hash\n const hashResult = (0, core_js_1.execGit)(cwd, ['rev-parse', '--short', 'HEAD']);\n const hash = hashResult.exitCode === 0 ? hashResult.stdout : null;\n const result = { committed: true, hash, reason: 'committed' };\n (0, core_js_1.output)(result, raw, hash || 'committed');\n}\n// ─── Summary extract ────────────────────────────────────────────────────────\nfunction cmdSummaryExtract(cwd, summaryPath, fields, raw) {\n if (!summaryPath) {\n (0, core_js_1.error)('summary-path required for summary-extract');\n }\n const fullPath = node_path_1.default.join(cwd, summaryPath);\n if (!node_fs_1.default.existsSync(fullPath)) {\n (0, core_js_1.output)({ error: 'File not found', path: summaryPath }, raw);\n return;\n }\n const content = node_fs_1.default.readFileSync(fullPath, 'utf-8');\n const fm = (0, frontmatter_js_1.extractFrontmatter)(content);\n // Parse key-decisions into structured format\n const parseDecisions = (decisionsList) => {\n if (!decisionsList || !Array.isArray(decisionsList))\n return [];\n return decisionsList.map((d) => {\n const colonIdx = d.indexOf(':');\n if (colonIdx > 0) {\n return {\n summary: d.substring(0, colonIdx).trim(),\n rationale: d.substring(colonIdx + 1).trim(),\n };\n }\n return { summary: d, rationale: null };\n });\n };\n const techStack = fm['tech-stack'];\n // Build full result\n const fullResult = {\n path: summaryPath,\n one_liner: fm['one-liner'] || null,\n key_files: fm['key-files'] || [],\n tech_added: (techStack && techStack.added) || [],\n patterns: fm['patterns-established'] || [],\n decisions: parseDecisions(fm['key-decisions']),\n requirements_completed: fm['requirements-completed'] || [],\n };\n // If fields specified, filter to only those fields\n if (fields && fields.length > 0) {\n const filtered = { path: summaryPath };\n for (const field of fields) {\n if (fullResult[field] !== undefined) {\n filtered[field] = fullResult[field];\n }\n }\n (0, core_js_1.output)(filtered, raw);\n return;\n }\n (0, core_js_1.output)(fullResult, raw);\n}\n// ─── Web search ─────────────────────────────────────────────────────────────\nasync function cmdWebsearch(query, options, raw) {\n const apiKey = process.env.BRAVE_API_KEY;\n if (!apiKey) {\n (0, core_js_1.output)({ available: false, reason: 'BRAVE_API_KEY not set' }, raw, '');\n return;\n }\n if (!query) {\n (0, core_js_1.output)({ available: false, error: 'Query required' }, raw, '');\n return;\n }\n const params = new URLSearchParams({\n q: query,\n count: String(options.limit || 10),\n country: 'us',\n search_lang: 'en',\n text_decorations: 'false',\n });\n if (options.freshness) {\n params.set('freshness', options.freshness);\n }\n try {\n const response = await fetch(`https://api.search.brave.com/res/v1/web/search?${params}`, {\n headers: {\n Accept: 'application/json',\n 'X-Subscription-Token': apiKey,\n },\n });\n if (!response.ok) {\n (0, core_js_1.output)({ available: false, error: `API error: ${response.status}` }, raw, '');\n return;\n }\n const data = (await response.json());\n const results = (data.web?.results || []).map(r => ({\n title: r.title,\n url: r.url,\n description: r.description,\n age: r.age || null,\n }));\n (0, core_js_1.output)({\n available: true,\n query,\n count: results.length,\n results,\n }, raw, results.map(r => `${r.title}\\n${r.url}\\n${r.description}`).join('\\n\\n'));\n }\n catch (err) {\n (0, core_js_1.output)({ available: false, error: err.message }, raw, '');\n }\n}\n// ─── Progress render ────────────────────────────────────────────────────────\nfunction cmdProgressRender(cwd, format, raw) {\n const phasesDir = node_path_1.default.join(cwd, '.planning', 'phases');\n const milestone = (0, core_js_1.getMilestoneInfo)(cwd);\n const phases = [];\n let totalPlans = 0;\n let totalSummaries = 0;\n try {\n const entries = node_fs_1.default.readdirSync(phasesDir, { withFileTypes: true });\n const dirs = entries\n .filter(e => e.isDirectory())\n .map(e => e.name)\n .sort((a, b) => {\n const aNum = parseFloat(a.match(/^(\\d+(?:\\.\\d+)?)/)?.[1] || '0');\n const bNum = parseFloat(b.match(/^(\\d+(?:\\.\\d+)?)/)?.[1] || '0');\n return aNum - bNum;\n });\n for (const dir of dirs) {\n const dm = dir.match(/^(\\d+(?:\\.\\d+)?)-?(.*)/);\n const phaseNum = dm ? dm[1] : dir;\n const phaseName = dm && dm[2] ? dm[2].replace(/-/g, ' ') : '';\n const phaseFiles = node_fs_1.default.readdirSync(node_path_1.default.join(phasesDir, dir));\n const planCount = phaseFiles.filter(f => f.endsWith('-PLAN.md') || f === 'PLAN.md').length;\n const summaryCount = phaseFiles.filter(f => f.endsWith('-SUMMARY.md') || f === 'SUMMARY.md').length;\n totalPlans += planCount;\n totalSummaries += summaryCount;\n let status;\n if (planCount === 0)\n status = 'Pending';\n else if (summaryCount >= planCount)\n status = 'Complete';\n else if (summaryCount > 0)\n status = 'In Progress';\n else\n status = 'Planned';\n phases.push({ number: phaseNum, name: phaseName, plans: planCount, summaries: summaryCount, status });\n }\n }\n catch { /* ignore */ }\n const percent = totalPlans > 0 ? Math.min(100, Math.round((totalSummaries / totalPlans) * 100)) : 0;\n if (format === 'table') {\n const barWidth = 10;\n const filled = Math.round((percent / 100) * barWidth);\n const bar = '\\u2588'.repeat(filled) + '\\u2591'.repeat(barWidth - filled);\n let out = `# ${milestone.version} ${milestone.name}\\n\\n`;\n out += `**Progress:** [${bar}] ${totalSummaries}/${totalPlans} plans (${percent}%)\\n\\n`;\n out += `| Phase | Name | Plans | Status |\\n`;\n out += `|-------|------|-------|--------|\\n`;\n for (const p of phases) {\n out += `| ${p.number} | ${p.name} | ${p.summaries}/${p.plans} | ${p.status} |\\n`;\n }\n (0, core_js_1.output)({ rendered: out }, raw, out);\n }\n else if (format === 'bar') {\n const barWidth = 20;\n const filled = Math.round((percent / 100) * barWidth);\n const bar = '\\u2588'.repeat(filled) + '\\u2591'.repeat(barWidth - filled);\n const text = `[${bar}] ${totalSummaries}/${totalPlans} plans (${percent}%)`;\n (0, core_js_1.output)({ bar: text, percent, completed: totalSummaries, total: totalPlans }, raw, text);\n }\n else {\n (0, core_js_1.output)({\n milestone_version: milestone.version,\n milestone_name: milestone.name,\n phases,\n total_plans: totalPlans,\n total_summaries: totalSummaries,\n percent,\n }, raw);\n }\n}\n// ─── Todo complete ──────────────────────────────────────────────────────────\nfunction cmdTodoComplete(cwd, filename, raw) {\n if (!filename) {\n (0, core_js_1.error)('filename required for todo complete');\n }\n const pendingDir = node_path_1.default.join(cwd, '.planning', 'todos', 'pending');\n const completedDir = node_path_1.default.join(cwd, '.planning', 'todos', 'completed');\n const sourcePath = node_path_1.default.join(pendingDir, filename);\n if (!node_fs_1.default.existsSync(sourcePath)) {\n (0, core_js_1.error)(`Todo not found: ${filename}`);\n }\n // Ensure completed directory exists\n node_fs_1.default.mkdirSync(completedDir, { recursive: true });\n // Read, add completion timestamp, move\n let content = node_fs_1.default.readFileSync(sourcePath, 'utf-8');\n const today = new Date().toISOString().split('T')[0];\n content = `completed: ${today}\\n` + content;\n node_fs_1.default.writeFileSync(node_path_1.default.join(completedDir, filename), content, 'utf-8');\n node_fs_1.default.unlinkSync(sourcePath);\n (0, core_js_1.output)({ completed: true, file: filename, date: today }, raw, 'completed');\n}\n// ─── Scaffold ───────────────────────────────────────────────────────────────\nfunction cmdScaffold(cwd, type, options, raw) {\n const { phase, name } = options;\n const padded = phase ? (0, core_js_1.normalizePhaseName)(phase) : '00';\n const today = new Date().toISOString().split('T')[0];\n // Find phase directory\n const phaseInfo = phase ? (0, core_js_1.findPhaseInternal)(cwd, phase) : null;\n const phaseDir = phaseInfo ? node_path_1.default.join(cwd, phaseInfo.directory) : null;\n if (phase && !phaseDir && type !== 'phase-dir') {\n (0, core_js_1.error)(`Phase ${phase} directory not found`);\n }\n let filePath;\n let content;\n switch (type) {\n case 'context': {\n filePath = node_path_1.default.join(phaseDir, `${padded}-CONTEXT.md`);\n content = `---\\nphase: \"${padded}\"\\nname: \"${name || phaseInfo?.phase_name || 'Unnamed'}\"\\ncreated: ${today}\\n---\\n\\n# Phase ${phase}: ${name || phaseInfo?.phase_name || 'Unnamed'} — Context\\n\\n## Decisions\\n\\n_Decisions will be captured during /maxsim:discuss-phase ${phase}_\\n\\n## Discretion Areas\\n\\n_Areas where the executor can use judgment_\\n\\n## Deferred Ideas\\n\\n_Ideas to consider later_\\n`;\n break;\n }\n case 'uat': {\n filePath = node_path_1.default.join(phaseDir, `${padded}-UAT.md`);\n content = `---\\nphase: \"${padded}\"\\nname: \"${name || phaseInfo?.phase_name || 'Unnamed'}\"\\ncreated: ${today}\\nstatus: pending\\n---\\n\\n# Phase ${phase}: ${name || phaseInfo?.phase_name || 'Unnamed'} — User Acceptance Testing\\n\\n## Test Results\\n\\n| # | Test | Status | Notes |\\n|---|------|--------|-------|\\n\\n## Summary\\n\\n_Pending UAT_\\n`;\n break;\n }\n case 'verification': {\n filePath = node_path_1.default.join(phaseDir, `${padded}-VERIFICATION.md`);\n content = `---\\nphase: \"${padded}\"\\nname: \"${name || phaseInfo?.phase_name || 'Unnamed'}\"\\ncreated: ${today}\\nstatus: pending\\n---\\n\\n# Phase ${phase}: ${name || phaseInfo?.phase_name || 'Unnamed'} — Verification\\n\\n## Goal-Backward Verification\\n\\n**Phase Goal:** [From ROADMAP.md]\\n\\n## Checks\\n\\n| # | Requirement | Status | Evidence |\\n|---|------------|--------|----------|\\n\\n## Result\\n\\n_Pending verification_\\n`;\n break;\n }\n case 'phase-dir': {\n if (!phase || !name) {\n (0, core_js_1.error)('phase and name required for phase-dir scaffold');\n }\n const slug = (0, core_js_1.generateSlugInternal)(name);\n const dirName = `${padded}-${slug}`;\n const phasesParent = node_path_1.default.join(cwd, '.planning', 'phases');\n node_fs_1.default.mkdirSync(phasesParent, { recursive: true });\n const dirPath = node_path_1.default.join(phasesParent, dirName);\n node_fs_1.default.mkdirSync(dirPath, { recursive: true });\n (0, core_js_1.output)({ created: true, directory: `.planning/phases/${dirName}`, path: dirPath }, raw, dirPath);\n return;\n }\n default:\n (0, core_js_1.error)(`Unknown scaffold type: ${type}. Available: context, uat, verification, phase-dir`);\n return; // unreachable but satisfies TS\n }\n if (node_fs_1.default.existsSync(filePath)) {\n (0, core_js_1.output)({ created: false, reason: 'already_exists', path: filePath }, raw, 'exists');\n return;\n }\n node_fs_1.default.writeFileSync(filePath, content, 'utf-8');\n const relPath = node_path_1.default.relative(cwd, filePath);\n (0, core_js_1.output)({ created: true, path: relPath }, raw, relPath);\n}\n//# sourceMappingURL=commands.js.map","\"use strict\";\n/**\n * Verify — Verification suite, consistency, and health validation\n *\n * Ported from maxsim/bin/lib/verify.cjs\n */\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.cmdVerifySummary = cmdVerifySummary;\nexports.cmdVerifyPlanStructure = cmdVerifyPlanStructure;\nexports.cmdVerifyPhaseCompleteness = cmdVerifyPhaseCompleteness;\nexports.cmdVerifyReferences = cmdVerifyReferences;\nexports.cmdVerifyCommits = cmdVerifyCommits;\nexports.cmdVerifyArtifacts = cmdVerifyArtifacts;\nexports.cmdVerifyKeyLinks = cmdVerifyKeyLinks;\nexports.cmdValidateConsistency = cmdValidateConsistency;\nexports.cmdValidateHealth = cmdValidateHealth;\nconst node_fs_1 = __importDefault(require(\"node:fs\"));\nconst node_path_1 = __importDefault(require(\"node:path\"));\nconst core_js_1 = require(\"./core.js\");\nconst frontmatter_js_1 = require(\"./frontmatter.js\");\n// ─── Verify Summary ──────────────────────────────────────────────────────────\nfunction cmdVerifySummary(cwd, summaryPath, checkFileCount, raw) {\n if (!summaryPath) {\n (0, core_js_1.error)('summary-path required');\n }\n const fullPath = node_path_1.default.join(cwd, summaryPath);\n const checkCount = checkFileCount || 2;\n if (!node_fs_1.default.existsSync(fullPath)) {\n const result = {\n passed: false,\n checks: {\n summary_exists: false,\n files_created: { checked: 0, found: 0, missing: [] },\n commits_exist: false,\n self_check: 'not_found',\n },\n errors: ['SUMMARY.md not found'],\n };\n (0, core_js_1.output)(result, raw, 'failed');\n return;\n }\n const content = node_fs_1.default.readFileSync(fullPath, 'utf-8');\n const errors = [];\n // Spot-check files mentioned in summary\n const mentionedFiles = new Set();\n const patterns = [\n /`([^`]+\\.[a-zA-Z]+)`/g,\n /(?:Created|Modified|Added|Updated|Edited):\\s*`?([^\\s`]+\\.[a-zA-Z]+)`?/gi,\n ];\n for (const pattern of patterns) {\n let m;\n while ((m = pattern.exec(content)) !== null) {\n const filePath = m[1];\n if (filePath && !filePath.startsWith('http') && filePath.includes('/')) {\n mentionedFiles.add(filePath);\n }\n }\n }\n const filesToCheck = Array.from(mentionedFiles).slice(0, checkCount);\n const missing = [];\n for (const file of filesToCheck) {\n if (!node_fs_1.default.existsSync(node_path_1.default.join(cwd, file))) {\n missing.push(file);\n }\n }\n // Check commits exist\n const commitHashPattern = /\\b[0-9a-f]{7,40}\\b/g;\n const hashes = content.match(commitHashPattern) || [];\n let commitsExist = false;\n if (hashes.length > 0) {\n for (const hash of hashes.slice(0, 3)) {\n const result = (0, core_js_1.execGit)(cwd, ['cat-file', '-t', hash]);\n if (result.exitCode === 0 && result.stdout === 'commit') {\n commitsExist = true;\n break;\n }\n }\n }\n // Self-check section\n let selfCheck = 'not_found';\n const selfCheckPattern = /##\\s*(?:Self[- ]?Check|Verification|Quality Check)/i;\n if (selfCheckPattern.test(content)) {\n const passPattern = /(?:all\\s+)?(?:pass|✓|✅|complete|succeeded)/i;\n const failPattern = /(?:fail|✗|❌|incomplete|blocked)/i;\n const checkSection = content.slice(content.search(selfCheckPattern));\n if (failPattern.test(checkSection)) {\n selfCheck = 'failed';\n }\n else if (passPattern.test(checkSection)) {\n selfCheck = 'passed';\n }\n }\n if (missing.length > 0)\n errors.push('Missing files: ' + missing.join(', '));\n if (!commitsExist && hashes.length > 0)\n errors.push('Referenced commit hashes not found in git history');\n if (selfCheck === 'failed')\n errors.push('Self-check section indicates failure');\n const checks = {\n summary_exists: true,\n files_created: { checked: filesToCheck.length, found: filesToCheck.length - missing.length, missing },\n commits_exist: commitsExist,\n self_check: selfCheck,\n };\n const passed = missing.length === 0 && selfCheck !== 'failed';\n const result = { passed, checks, errors };\n (0, core_js_1.output)(result, raw, passed ? 'passed' : 'failed');\n}\n// ─── Verify Plan Structure ───────────────────────────────────────────────────\nfunction cmdVerifyPlanStructure(cwd, filePath, raw) {\n if (!filePath) {\n (0, core_js_1.error)('file path required');\n }\n const fullPath = node_path_1.default.isAbsolute(filePath) ? filePath : node_path_1.default.join(cwd, filePath);\n const content = (0, core_js_1.safeReadFile)(fullPath);\n if (!content) {\n (0, core_js_1.output)({ error: 'File not found', path: filePath }, raw);\n return;\n }\n const fm = (0, frontmatter_js_1.extractFrontmatter)(content);\n const errors = [];\n const warnings = [];\n const required = ['phase', 'plan', 'type', 'wave', 'depends_on', 'files_modified', 'autonomous', 'must_haves'];\n for (const field of required) {\n if (fm[field] === undefined)\n errors.push(`Missing required frontmatter field: ${field}`);\n }\n const taskPattern = /<task[^>]*>([\\s\\S]*?)<\\/task>/g;\n const tasks = [];\n let taskMatch;\n while ((taskMatch = taskPattern.exec(content)) !== null) {\n const taskContent = taskMatch[1];\n const nameMatch = taskContent.match(/<name>([\\s\\S]*?)<\\/name>/);\n const taskName = nameMatch ? nameMatch[1].trim() : 'unnamed';\n const hasFiles = /<files>/.test(taskContent);\n const hasAction = /<action>/.test(taskContent);\n const hasVerify = /<verify>/.test(taskContent);\n const hasDone = /<done>/.test(taskContent);\n if (!nameMatch)\n errors.push('Task missing <name> element');\n if (!hasAction)\n errors.push(`Task '${taskName}' missing <action>`);\n if (!hasVerify)\n warnings.push(`Task '${taskName}' missing <verify>`);\n if (!hasDone)\n warnings.push(`Task '${taskName}' missing <done>`);\n if (!hasFiles)\n warnings.push(`Task '${taskName}' missing <files>`);\n tasks.push({ name: taskName, hasFiles, hasAction, hasVerify, hasDone });\n }\n if (tasks.length === 0)\n warnings.push('No <task> elements found');\n if (fm.wave && parseInt(String(fm.wave)) > 1 && (!fm.depends_on || (Array.isArray(fm.depends_on) && fm.depends_on.length === 0))) {\n warnings.push('Wave > 1 but depends_on is empty');\n }\n const hasCheckpoints = /<task\\s+type=[\"']?checkpoint/.test(content);\n if (hasCheckpoints && fm.autonomous !== 'false' && fm.autonomous !== false) {\n errors.push('Has checkpoint tasks but autonomous is not false');\n }\n const result = {\n valid: errors.length === 0,\n errors,\n warnings,\n task_count: tasks.length,\n tasks,\n frontmatter_fields: Object.keys(fm),\n };\n (0, core_js_1.output)(result, raw, errors.length === 0 ? 'valid' : 'invalid');\n}\n// ─── Verify Phase Completeness ───────────────────────────────────────────────\nfunction cmdVerifyPhaseCompleteness(cwd, phase, raw) {\n if (!phase) {\n (0, core_js_1.error)('phase required');\n }\n const phaseInfo = (0, core_js_1.findPhaseInternal)(cwd, phase);\n if (!phaseInfo) {\n (0, core_js_1.output)({ error: 'Phase not found', phase }, raw);\n return;\n }\n const errors = [];\n const warnings = [];\n const phaseDir = node_path_1.default.join(cwd, phaseInfo.directory);\n let files;\n try {\n files = node_fs_1.default.readdirSync(phaseDir);\n }\n catch {\n (0, core_js_1.output)({ error: 'Cannot read phase directory' }, raw);\n return;\n }\n const plans = files.filter(f => /-PLAN\\.md$/i.test(f));\n const summaries = files.filter(f => /-SUMMARY\\.md$/i.test(f));\n const planIds = new Set(plans.map(p => p.replace(/-PLAN\\.md$/i, '')));\n const summaryIds = new Set(summaries.map(s => s.replace(/-SUMMARY\\.md$/i, '')));\n const incompletePlans = [...planIds].filter(id => !summaryIds.has(id));\n if (incompletePlans.length > 0) {\n errors.push(`Plans without summaries: ${incompletePlans.join(', ')}`);\n }\n const orphanSummaries = [...summaryIds].filter(id => !planIds.has(id));\n if (orphanSummaries.length > 0) {\n warnings.push(`Summaries without plans: ${orphanSummaries.join(', ')}`);\n }\n const result = {\n complete: errors.length === 0,\n phase: phaseInfo.phase_number,\n plan_count: plans.length,\n summary_count: summaries.length,\n incomplete_plans: incompletePlans,\n orphan_summaries: orphanSummaries,\n errors,\n warnings,\n };\n (0, core_js_1.output)(result, raw, errors.length === 0 ? 'complete' : 'incomplete');\n}\n// ─── Verify References ───────────────────────────────────────────────────────\nfunction cmdVerifyReferences(cwd, filePath, raw) {\n if (!filePath) {\n (0, core_js_1.error)('file path required');\n }\n const fullPath = node_path_1.default.isAbsolute(filePath) ? filePath : node_path_1.default.join(cwd, filePath);\n const content = (0, core_js_1.safeReadFile)(fullPath);\n if (!content) {\n (0, core_js_1.output)({ error: 'File not found', path: filePath }, raw);\n return;\n }\n const found = [];\n const missing = [];\n const atRefs = content.match(/@([^\\s\\n,)]+\\/[^\\s\\n,)]+)/g) || [];\n for (const ref of atRefs) {\n const cleanRef = ref.slice(1);\n const resolved = cleanRef.startsWith('~/')\n ? node_path_1.default.join(process.env.HOME || '', cleanRef.slice(2))\n : node_path_1.default.join(cwd, cleanRef);\n if (node_fs_1.default.existsSync(resolved)) {\n found.push(cleanRef);\n }\n else {\n missing.push(cleanRef);\n }\n }\n const backtickRefs = content.match(/`([^`]+\\/[^`]+\\.[a-zA-Z]{1,10})`/g) || [];\n for (const ref of backtickRefs) {\n const cleanRef = ref.slice(1, -1);\n if (cleanRef.startsWith('http') || cleanRef.includes('${') || cleanRef.includes('{{'))\n continue;\n if (found.includes(cleanRef) || missing.includes(cleanRef))\n continue;\n const resolved = node_path_1.default.join(cwd, cleanRef);\n if (node_fs_1.default.existsSync(resolved)) {\n found.push(cleanRef);\n }\n else {\n missing.push(cleanRef);\n }\n }\n const result = {\n valid: missing.length === 0,\n found: found.length,\n missing,\n total: found.length + missing.length,\n };\n (0, core_js_1.output)(result, raw, missing.length === 0 ? 'valid' : 'invalid');\n}\n// ─── Verify Commits ──────────────────────────────────────────────────────────\nfunction cmdVerifyCommits(cwd, hashes, raw) {\n if (!hashes || hashes.length === 0) {\n (0, core_js_1.error)('At least one commit hash required');\n }\n const valid = [];\n const invalid = [];\n for (const hash of hashes) {\n const result = (0, core_js_1.execGit)(cwd, ['cat-file', '-t', hash]);\n if (result.exitCode === 0 && result.stdout.trim() === 'commit') {\n valid.push(hash);\n }\n else {\n invalid.push(hash);\n }\n }\n const commitResult = {\n all_valid: invalid.length === 0,\n valid,\n invalid,\n total: hashes.length,\n };\n (0, core_js_1.output)(commitResult, raw, invalid.length === 0 ? 'valid' : 'invalid');\n}\nfunction cmdVerifyArtifacts(cwd, planFilePath, raw) {\n if (!planFilePath) {\n (0, core_js_1.error)('plan file path required');\n }\n const fullPath = node_path_1.default.isAbsolute(planFilePath) ? planFilePath : node_path_1.default.join(cwd, planFilePath);\n const content = (0, core_js_1.safeReadFile)(fullPath);\n if (!content) {\n (0, core_js_1.output)({ error: 'File not found', path: planFilePath }, raw);\n return;\n }\n const artifacts = (0, frontmatter_js_1.parseMustHavesBlock)(content, 'artifacts');\n if (artifacts.length === 0) {\n (0, core_js_1.output)({ error: 'No must_haves.artifacts found in frontmatter', path: planFilePath }, raw);\n return;\n }\n const results = [];\n for (const artifact of artifacts) {\n if (typeof artifact === 'string')\n continue;\n const artObj = artifact;\n const artPath = artObj.path;\n if (!artPath)\n continue;\n const artFullPath = node_path_1.default.join(cwd, artPath);\n const exists = node_fs_1.default.existsSync(artFullPath);\n const check = { path: artPath, exists, issues: [], passed: false };\n if (exists) {\n const fileContent = (0, core_js_1.safeReadFile)(artFullPath) || '';\n const lineCount = fileContent.split('\\n').length;\n if (artObj.min_lines && lineCount < artObj.min_lines) {\n check.issues.push(`Only ${lineCount} lines, need ${artObj.min_lines}`);\n }\n if (artObj.contains && !fileContent.includes(artObj.contains)) {\n check.issues.push(`Missing pattern: ${artObj.contains}`);\n }\n if (artObj.exports) {\n const exportList = Array.isArray(artObj.exports) ? artObj.exports : [artObj.exports];\n for (const exp of exportList) {\n if (!fileContent.includes(exp))\n check.issues.push(`Missing export: ${exp}`);\n }\n }\n check.passed = check.issues.length === 0;\n }\n else {\n check.issues.push('File not found');\n }\n results.push(check);\n }\n const passed = results.filter(r => r.passed).length;\n const artifactsResult = {\n all_passed: passed === results.length,\n passed,\n total: results.length,\n artifacts: results,\n };\n (0, core_js_1.output)(artifactsResult, raw, passed === results.length ? 'valid' : 'invalid');\n}\nfunction cmdVerifyKeyLinks(cwd, planFilePath, raw) {\n if (!planFilePath) {\n (0, core_js_1.error)('plan file path required');\n }\n const fullPath = node_path_1.default.isAbsolute(planFilePath) ? planFilePath : node_path_1.default.join(cwd, planFilePath);\n const content = (0, core_js_1.safeReadFile)(fullPath);\n if (!content) {\n (0, core_js_1.output)({ error: 'File not found', path: planFilePath }, raw);\n return;\n }\n const keyLinks = (0, frontmatter_js_1.parseMustHavesBlock)(content, 'key_links');\n if (keyLinks.length === 0) {\n (0, core_js_1.output)({ error: 'No must_haves.key_links found in frontmatter', path: planFilePath }, raw);\n return;\n }\n const results = [];\n for (const link of keyLinks) {\n if (typeof link === 'string')\n continue;\n const linkObj = link;\n const check = {\n from: linkObj.from || '',\n to: linkObj.to || '',\n via: linkObj.via || '',\n verified: false,\n detail: '',\n };\n const sourceContent = (0, core_js_1.safeReadFile)(node_path_1.default.join(cwd, linkObj.from || ''));\n if (!sourceContent) {\n check.detail = 'Source file not found';\n }\n else if (linkObj.pattern) {\n try {\n const regex = new RegExp(linkObj.pattern);\n if (regex.test(sourceContent)) {\n check.verified = true;\n check.detail = 'Pattern found in source';\n }\n else {\n const targetContent = (0, core_js_1.safeReadFile)(node_path_1.default.join(cwd, linkObj.to || ''));\n if (targetContent && regex.test(targetContent)) {\n check.verified = true;\n check.detail = 'Pattern found in target';\n }\n else {\n check.detail = `Pattern \"${linkObj.pattern}\" not found in source or target`;\n }\n }\n }\n catch {\n check.detail = `Invalid regex pattern: ${linkObj.pattern}`;\n }\n }\n else {\n if (sourceContent.includes(linkObj.to || '')) {\n check.verified = true;\n check.detail = 'Target referenced in source';\n }\n else {\n check.detail = 'Target not referenced in source';\n }\n }\n results.push(check);\n }\n const verified = results.filter(r => r.verified).length;\n const linksResult = {\n all_verified: verified === results.length,\n verified,\n total: results.length,\n links: results,\n };\n (0, core_js_1.output)(linksResult, raw, verified === results.length ? 'valid' : 'invalid');\n}\n// ─── Validate Consistency ────────────────────────────────────────────────────\nfunction cmdValidateConsistency(cwd, raw) {\n const roadmapPath = node_path_1.default.join(cwd, '.planning', 'ROADMAP.md');\n const phasesDir = node_path_1.default.join(cwd, '.planning', 'phases');\n const errors = [];\n const warnings = [];\n if (!node_fs_1.default.existsSync(roadmapPath)) {\n errors.push('ROADMAP.md not found');\n (0, core_js_1.output)({ passed: false, errors, warnings }, raw, 'failed');\n return;\n }\n const roadmapContent = node_fs_1.default.readFileSync(roadmapPath, 'utf-8');\n const roadmapPhases = new Set();\n const phasePattern = /#{2,4}\\s*Phase\\s+(\\d+[A-Z]?(?:\\.\\d+)?)\\s*:/gi;\n let m;\n while ((m = phasePattern.exec(roadmapContent)) !== null) {\n roadmapPhases.add(m[1]);\n }\n const diskPhases = new Set();\n try {\n const entries = node_fs_1.default.readdirSync(phasesDir, { withFileTypes: true });\n const dirs = entries.filter(e => e.isDirectory()).map(e => e.name);\n for (const dir of dirs) {\n const dm = dir.match(/^(\\d+[A-Z]?(?:\\.\\d+)?)/i);\n if (dm)\n diskPhases.add(dm[1]);\n }\n }\n catch { /* ignore */ }\n for (const p of roadmapPhases) {\n if (!diskPhases.has(p) && !diskPhases.has((0, core_js_1.normalizePhaseName)(p))) {\n warnings.push(`Phase ${p} in ROADMAP.md but no directory on disk`);\n }\n }\n for (const p of diskPhases) {\n const unpadded = String(parseInt(p, 10));\n if (!roadmapPhases.has(p) && !roadmapPhases.has(unpadded)) {\n warnings.push(`Phase ${p} exists on disk but not in ROADMAP.md`);\n }\n }\n const integerPhases = [...diskPhases]\n .filter(p => !p.includes('.'))\n .map(p => parseInt(p, 10))\n .sort((a, b) => a - b);\n for (let i = 1; i < integerPhases.length; i++) {\n if (integerPhases[i] !== integerPhases[i - 1] + 1) {\n warnings.push(`Gap in phase numbering: ${integerPhases[i - 1]} → ${integerPhases[i]}`);\n }\n }\n try {\n const entries = node_fs_1.default.readdirSync(phasesDir, { withFileTypes: true });\n const dirs = entries.filter(e => e.isDirectory()).map(e => e.name).sort();\n for (const dir of dirs) {\n const phaseFiles = node_fs_1.default.readdirSync(node_path_1.default.join(phasesDir, dir));\n const plans = phaseFiles.filter(f => f.endsWith('-PLAN.md')).sort();\n const planNums = plans.map(p => {\n const pm = p.match(/-(\\d{2})-PLAN\\.md$/);\n return pm ? parseInt(pm[1], 10) : null;\n }).filter((n) => n !== null);\n for (let i = 1; i < planNums.length; i++) {\n if (planNums[i] !== planNums[i - 1] + 1) {\n warnings.push(`Gap in plan numbering in ${dir}: plan ${planNums[i - 1]} → ${planNums[i]}`);\n }\n }\n const summaries = phaseFiles.filter(f => f.endsWith('-SUMMARY.md'));\n const planIdsSet = new Set(plans.map(p => p.replace('-PLAN.md', '')));\n const summaryIdsSet = new Set(summaries.map(s => s.replace('-SUMMARY.md', '')));\n for (const sid of summaryIdsSet) {\n if (!planIdsSet.has(sid)) {\n warnings.push(`Summary ${sid}-SUMMARY.md in ${dir} has no matching PLAN.md`);\n }\n }\n }\n }\n catch { /* ignore */ }\n try {\n const entries = node_fs_1.default.readdirSync(phasesDir, { withFileTypes: true });\n const dirs = entries.filter(e => e.isDirectory()).map(e => e.name);\n for (const dir of dirs) {\n const phaseFiles = node_fs_1.default.readdirSync(node_path_1.default.join(phasesDir, dir));\n const plans = phaseFiles.filter(f => f.endsWith('-PLAN.md'));\n for (const plan of plans) {\n const content = node_fs_1.default.readFileSync(node_path_1.default.join(phasesDir, dir, plan), 'utf-8');\n const fm = (0, frontmatter_js_1.extractFrontmatter)(content);\n if (!fm.wave) {\n warnings.push(`${dir}/${plan}: missing 'wave' in frontmatter`);\n }\n }\n }\n }\n catch { /* ignore */ }\n const passed = errors.length === 0;\n const result = { passed, errors, warnings, warning_count: warnings.length };\n (0, core_js_1.output)(result, raw, passed ? 'passed' : 'failed');\n}\n// ─── Validate Health ─────────────────────────────────────────────────────────\nfunction cmdValidateHealth(cwd, options, raw) {\n const planningDir = node_path_1.default.join(cwd, '.planning');\n const projectPath = node_path_1.default.join(planningDir, 'PROJECT.md');\n const roadmapPath = node_path_1.default.join(planningDir, 'ROADMAP.md');\n const statePath = node_path_1.default.join(planningDir, 'STATE.md');\n const configPath = node_path_1.default.join(planningDir, 'config.json');\n const phasesDir = node_path_1.default.join(planningDir, 'phases');\n const errors = [];\n const warnings = [];\n const info = [];\n const repairs = [];\n const addIssue = (severity, code, message, fix, repairable = false) => {\n const issue = { code, message, fix, repairable };\n if (severity === 'error')\n errors.push(issue);\n else if (severity === 'warning')\n warnings.push(issue);\n else\n info.push(issue);\n };\n // Check 1: .planning/ exists\n if (!node_fs_1.default.existsSync(planningDir)) {\n addIssue('error', 'E001', '.planning/ directory not found', 'Run /maxsim:new-project to initialize');\n (0, core_js_1.output)({\n status: 'broken',\n errors,\n warnings,\n info,\n repairable_count: 0,\n }, raw);\n return;\n }\n // Check 2: PROJECT.md\n if (!node_fs_1.default.existsSync(projectPath)) {\n addIssue('error', 'E002', 'PROJECT.md not found', 'Run /maxsim:new-project to create');\n }\n else {\n const content = node_fs_1.default.readFileSync(projectPath, 'utf-8');\n const requiredSections = ['## What This Is', '## Core Value', '## Requirements'];\n for (const section of requiredSections) {\n if (!content.includes(section)) {\n addIssue('warning', 'W001', `PROJECT.md missing section: ${section}`, 'Add section manually');\n }\n }\n }\n // Check 3: ROADMAP.md\n if (!node_fs_1.default.existsSync(roadmapPath)) {\n addIssue('error', 'E003', 'ROADMAP.md not found', 'Run /maxsim:new-milestone to create roadmap');\n }\n // Check 4: STATE.md\n if (!node_fs_1.default.existsSync(statePath)) {\n addIssue('error', 'E004', 'STATE.md not found', 'Run /maxsim:health --repair to regenerate', true);\n repairs.push('regenerateState');\n }\n else {\n const stateContent = node_fs_1.default.readFileSync(statePath, 'utf-8');\n const phaseRefs = [...stateContent.matchAll(/[Pp]hase\\s+(\\d+(?:\\.\\d+)?)/g)].map(m => m[1]);\n const diskPhases = new Set();\n try {\n const entries = node_fs_1.default.readdirSync(phasesDir, { withFileTypes: true });\n for (const e of entries) {\n if (e.isDirectory()) {\n const dm = e.name.match(/^(\\d+(?:\\.\\d+)?)/);\n if (dm)\n diskPhases.add(dm[1]);\n }\n }\n }\n catch { /* ignore */ }\n for (const ref of phaseRefs) {\n const normalizedRef = String(parseInt(ref, 10)).padStart(2, '0');\n if (!diskPhases.has(ref) && !diskPhases.has(normalizedRef) && !diskPhases.has(String(parseInt(ref, 10)))) {\n if (diskPhases.size > 0) {\n addIssue('warning', 'W002', `STATE.md references phase ${ref}, but only phases ${[...diskPhases].sort().join(', ')} exist`, 'Run /maxsim:health --repair to regenerate STATE.md', true);\n if (!repairs.includes('regenerateState'))\n repairs.push('regenerateState');\n }\n }\n }\n }\n // Check 5: config.json\n if (!node_fs_1.default.existsSync(configPath)) {\n addIssue('warning', 'W003', 'config.json not found', 'Run /maxsim:health --repair to create with defaults', true);\n repairs.push('createConfig');\n }\n else {\n try {\n const rawContent = node_fs_1.default.readFileSync(configPath, 'utf-8');\n const parsed = JSON.parse(rawContent);\n const validProfiles = ['quality', 'balanced', 'budget'];\n if (parsed.model_profile && !validProfiles.includes(parsed.model_profile)) {\n addIssue('warning', 'W004', `config.json: invalid model_profile \"${parsed.model_profile}\"`, `Valid values: ${validProfiles.join(', ')}`);\n }\n }\n catch (thrown) {\n const parseErr = thrown;\n addIssue('error', 'E005', `config.json: JSON parse error - ${parseErr.message}`, 'Run /maxsim:health --repair to reset to defaults', true);\n repairs.push('resetConfig');\n }\n }\n // Check 6: Phase directory naming\n try {\n const entries = node_fs_1.default.readdirSync(phasesDir, { withFileTypes: true });\n for (const e of entries) {\n if (e.isDirectory() && !e.name.match(/^\\d{2}(?:\\.\\d+)?-[\\w-]+$/)) {\n addIssue('warning', 'W005', `Phase directory \"${e.name}\" doesn't follow NN-name format`, 'Rename to match pattern (e.g., 01-setup)');\n }\n }\n }\n catch { /* ignore */ }\n // Check 7: Orphaned plans\n try {\n const entries = node_fs_1.default.readdirSync(phasesDir, { withFileTypes: true });\n for (const e of entries) {\n if (!e.isDirectory())\n continue;\n const phaseFiles = node_fs_1.default.readdirSync(node_path_1.default.join(phasesDir, e.name));\n const plans = phaseFiles.filter(f => f.endsWith('-PLAN.md') || f === 'PLAN.md');\n const summaries = phaseFiles.filter(f => f.endsWith('-SUMMARY.md') || f === 'SUMMARY.md');\n const summaryBases = new Set(summaries.map(s => s.replace('-SUMMARY.md', '').replace('SUMMARY.md', '')));\n for (const plan of plans) {\n const planBase = plan.replace('-PLAN.md', '').replace('PLAN.md', '');\n if (!summaryBases.has(planBase)) {\n addIssue('info', 'I001', `${e.name}/${plan} has no SUMMARY.md`, 'May be in progress');\n }\n }\n }\n }\n catch { /* ignore */ }\n // Check 8: Roadmap consistency\n if (node_fs_1.default.existsSync(roadmapPath)) {\n const roadmapContent = node_fs_1.default.readFileSync(roadmapPath, 'utf-8');\n const roadmapPhases = new Set();\n const phasePattern = /#{2,4}\\s*Phase\\s+(\\d+[A-Z]?(?:\\.\\d+)?)\\s*:/gi;\n let m;\n while ((m = phasePattern.exec(roadmapContent)) !== null) {\n roadmapPhases.add(m[1]);\n }\n const diskPhases = new Set();\n try {\n const entries = node_fs_1.default.readdirSync(phasesDir, { withFileTypes: true });\n for (const e of entries) {\n if (e.isDirectory()) {\n const dm = e.name.match(/^(\\d+[A-Z]?(?:\\.\\d+)?)/i);\n if (dm)\n diskPhases.add(dm[1]);\n }\n }\n }\n catch { /* ignore */ }\n for (const p of roadmapPhases) {\n const padded = String(parseInt(p, 10)).padStart(2, '0');\n if (!diskPhases.has(p) && !diskPhases.has(padded)) {\n addIssue('warning', 'W006', `Phase ${p} in ROADMAP.md but no directory on disk`, 'Create phase directory or remove from roadmap');\n }\n }\n for (const p of diskPhases) {\n const unpadded = String(parseInt(p, 10));\n if (!roadmapPhases.has(p) && !roadmapPhases.has(unpadded)) {\n addIssue('warning', 'W007', `Phase ${p} exists on disk but not in ROADMAP.md`, 'Add to roadmap or remove directory');\n }\n }\n }\n // Perform repairs if requested\n const repairActions = [];\n if (options.repair && repairs.length > 0) {\n for (const repair of repairs) {\n try {\n switch (repair) {\n case 'createConfig':\n case 'resetConfig': {\n const defaults = {\n model_profile: 'balanced',\n commit_docs: true,\n search_gitignored: false,\n branching_strategy: 'none',\n research: true,\n plan_checker: true,\n verifier: true,\n parallelization: true,\n };\n node_fs_1.default.writeFileSync(configPath, JSON.stringify(defaults, null, 2), 'utf-8');\n repairActions.push({ action: repair, success: true, path: 'config.json' });\n break;\n }\n case 'regenerateState': {\n if (node_fs_1.default.existsSync(statePath)) {\n const timestamp = new Date().toISOString().replace(/[:.]/g, '-').slice(0, 19);\n const backupPath = `${statePath}.bak-${timestamp}`;\n node_fs_1.default.copyFileSync(statePath, backupPath);\n repairActions.push({ action: 'backupState', success: true, path: backupPath });\n }\n const milestone = (0, core_js_1.getMilestoneInfo)(cwd);\n let stateContent = `# Session State\\n\\n`;\n stateContent += `## Project Reference\\n\\n`;\n stateContent += `See: .planning/PROJECT.md\\n\\n`;\n stateContent += `## Position\\n\\n`;\n stateContent += `**Milestone:** ${milestone.version} ${milestone.name}\\n`;\n stateContent += `**Current phase:** (determining...)\\n`;\n stateContent += `**Status:** Resuming\\n\\n`;\n stateContent += `## Session Log\\n\\n`;\n stateContent += `- ${new Date().toISOString().split('T')[0]}: STATE.md regenerated by /maxsim:health --repair\\n`;\n node_fs_1.default.writeFileSync(statePath, stateContent, 'utf-8');\n repairActions.push({ action: repair, success: true, path: 'STATE.md' });\n break;\n }\n }\n }\n catch (thrown) {\n const repairErr = thrown;\n repairActions.push({ action: repair, success: false, error: repairErr.message });\n }\n }\n }\n // Determine overall status\n let status;\n if (errors.length > 0) {\n status = 'broken';\n }\n else if (warnings.length > 0) {\n status = 'degraded';\n }\n else {\n status = 'healthy';\n }\n const repairableCount = errors.filter(e => e.repairable).length +\n warnings.filter(w => w.repairable).length;\n const result = {\n status,\n errors,\n warnings,\n info,\n repairable_count: repairableCount,\n repairs_performed: repairActions.length > 0 ? repairActions : undefined,\n };\n (0, core_js_1.output)(result, raw);\n}\n//# sourceMappingURL=verify.js.map","\"use strict\";\n/**\n * Phase — Phase CRUD, query, and lifecycle operations\n *\n * Ported from maxsim/bin/lib/phase.cjs\n */\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.cmdPhasesList = cmdPhasesList;\nexports.cmdPhaseNextDecimal = cmdPhaseNextDecimal;\nexports.cmdFindPhase = cmdFindPhase;\nexports.cmdPhasePlanIndex = cmdPhasePlanIndex;\nexports.cmdPhaseAdd = cmdPhaseAdd;\nexports.cmdPhaseInsert = cmdPhaseInsert;\nexports.cmdPhaseRemove = cmdPhaseRemove;\nexports.cmdPhaseComplete = cmdPhaseComplete;\nconst node_fs_1 = __importDefault(require(\"node:fs\"));\nconst node_path_1 = __importDefault(require(\"node:path\"));\nconst core_js_1 = require(\"./core.js\");\nconst frontmatter_js_1 = require(\"./frontmatter.js\");\n// ─── Phase list ─────────────────────────────────────────────────────────────\nfunction cmdPhasesList(cwd, options, raw) {\n const phasesDir = node_path_1.default.join(cwd, '.planning', 'phases');\n const { type, phase, includeArchived } = options;\n if (!node_fs_1.default.existsSync(phasesDir)) {\n if (type) {\n (0, core_js_1.output)({ files: [], count: 0 }, raw, '');\n }\n else {\n (0, core_js_1.output)({ directories: [], count: 0 }, raw, '');\n }\n return;\n }\n try {\n const entries = node_fs_1.default.readdirSync(phasesDir, { withFileTypes: true });\n let dirs = entries.filter(e => e.isDirectory()).map(e => e.name);\n if (includeArchived) {\n const archived = (0, core_js_1.getArchivedPhaseDirs)(cwd);\n for (const a of archived) {\n dirs.push(`${a.name} [${a.milestone}]`);\n }\n }\n dirs.sort((a, b) => (0, core_js_1.comparePhaseNum)(a, b));\n if (phase) {\n const normalized = (0, core_js_1.normalizePhaseName)(phase);\n const match = dirs.find(d => d.startsWith(normalized));\n if (!match) {\n (0, core_js_1.output)({ files: [], count: 0, phase_dir: null, error: 'Phase not found' }, raw, '');\n return;\n }\n dirs = [match];\n }\n if (type) {\n const files = [];\n for (const dir of dirs) {\n const dirPath = node_path_1.default.join(phasesDir, dir);\n const dirFiles = node_fs_1.default.readdirSync(dirPath);\n let filtered;\n if (type === 'plans') {\n filtered = dirFiles.filter(f => f.endsWith('-PLAN.md') || f === 'PLAN.md');\n }\n else if (type === 'summaries') {\n filtered = dirFiles.filter(f => f.endsWith('-SUMMARY.md') || f === 'SUMMARY.md');\n }\n else {\n filtered = dirFiles;\n }\n files.push(...filtered.sort());\n }\n const result = {\n files,\n count: files.length,\n phase_dir: phase ? dirs[0].replace(/^\\d+(?:\\.\\d+)?-?/, '') : null,\n };\n (0, core_js_1.output)(result, raw, files.join('\\n'));\n return;\n }\n (0, core_js_1.output)({ directories: dirs, count: dirs.length }, raw, dirs.join('\\n'));\n }\n catch (e) {\n (0, core_js_1.error)('Failed to list phases: ' + e.message);\n }\n}\n// ─── Next decimal ───────────────────────────────────────────────────────────\nfunction cmdPhaseNextDecimal(cwd, basePhase, raw) {\n const phasesDir = node_path_1.default.join(cwd, '.planning', 'phases');\n const normalized = (0, core_js_1.normalizePhaseName)(basePhase);\n if (!node_fs_1.default.existsSync(phasesDir)) {\n (0, core_js_1.output)({ found: false, base_phase: normalized, next: `${normalized}.1`, existing: [] }, raw, `${normalized}.1`);\n return;\n }\n try {\n const entries = node_fs_1.default.readdirSync(phasesDir, { withFileTypes: true });\n const dirs = entries.filter(e => e.isDirectory()).map(e => e.name);\n const baseExists = dirs.some(d => d.startsWith(normalized + '-') || d === normalized);\n const decimalPattern = new RegExp(`^${normalized}\\\\.(\\\\d+)`);\n const existingDecimals = [];\n for (const dir of dirs) {\n const match = dir.match(decimalPattern);\n if (match) {\n existingDecimals.push(`${normalized}.${match[1]}`);\n }\n }\n existingDecimals.sort((a, b) => {\n const aNum = parseFloat(a);\n const bNum = parseFloat(b);\n return aNum - bNum;\n });\n let nextDecimal;\n if (existingDecimals.length === 0) {\n nextDecimal = `${normalized}.1`;\n }\n else {\n const lastDecimal = existingDecimals[existingDecimals.length - 1];\n const lastNum = parseInt(lastDecimal.split('.')[1], 10);\n nextDecimal = `${normalized}.${lastNum + 1}`;\n }\n (0, core_js_1.output)({ found: baseExists, base_phase: normalized, next: nextDecimal, existing: existingDecimals }, raw, nextDecimal);\n }\n catch (e) {\n (0, core_js_1.error)('Failed to calculate next decimal phase: ' + e.message);\n }\n}\n// ─── Find phase ─────────────────────────────────────────────────────────────\nfunction cmdFindPhase(cwd, phase, raw) {\n if (!phase) {\n (0, core_js_1.error)('phase identifier required');\n }\n const phasesDir = node_path_1.default.join(cwd, '.planning', 'phases');\n const normalized = (0, core_js_1.normalizePhaseName)(phase);\n const notFound = { found: false, directory: null, phase_number: null, phase_name: null, plans: [], summaries: [] };\n try {\n const entries = node_fs_1.default.readdirSync(phasesDir, { withFileTypes: true });\n const dirs = entries.filter(e => e.isDirectory()).map(e => e.name).sort((a, b) => (0, core_js_1.comparePhaseNum)(a, b));\n const match = dirs.find(d => d.startsWith(normalized));\n if (!match) {\n (0, core_js_1.output)(notFound, raw, '');\n return;\n }\n const dirMatch = match.match(/^(\\d+[A-Z]?(?:\\.\\d+)?)-?(.*)/i);\n const phaseNumber = dirMatch ? dirMatch[1] : normalized;\n const phaseName = dirMatch && dirMatch[2] ? dirMatch[2] : null;\n const phaseDir = node_path_1.default.join(phasesDir, match);\n const phaseFiles = node_fs_1.default.readdirSync(phaseDir);\n const plans = phaseFiles.filter(f => f.endsWith('-PLAN.md') || f === 'PLAN.md').sort();\n const summaries = phaseFiles.filter(f => f.endsWith('-SUMMARY.md') || f === 'SUMMARY.md').sort();\n const result = {\n found: true,\n directory: node_path_1.default.join('.planning', 'phases', match),\n phase_number: phaseNumber,\n phase_name: phaseName,\n plans,\n summaries,\n };\n (0, core_js_1.output)(result, raw, result.directory);\n }\n catch {\n (0, core_js_1.output)(notFound, raw, '');\n }\n}\n// ─── Phase plan index ───────────────────────────────────────────────────────\nfunction cmdPhasePlanIndex(cwd, phase, raw) {\n if (!phase) {\n (0, core_js_1.error)('phase required for phase-plan-index');\n }\n const phasesDir = node_path_1.default.join(cwd, '.planning', 'phases');\n const normalized = (0, core_js_1.normalizePhaseName)(phase);\n let phaseDir = null;\n let phaseDirName = null;\n try {\n const entries = node_fs_1.default.readdirSync(phasesDir, { withFileTypes: true });\n const dirs = entries.filter(e => e.isDirectory()).map(e => e.name).sort((a, b) => (0, core_js_1.comparePhaseNum)(a, b));\n const match = dirs.find(d => d.startsWith(normalized));\n if (match) {\n phaseDir = node_path_1.default.join(phasesDir, match);\n phaseDirName = match;\n }\n }\n catch {\n // phases dir doesn't exist\n }\n if (!phaseDir) {\n (0, core_js_1.output)({ phase: normalized, error: 'Phase not found', plans: [], waves: {}, incomplete: [], has_checkpoints: false }, raw);\n return;\n }\n const phaseFiles = node_fs_1.default.readdirSync(phaseDir);\n const planFiles = phaseFiles.filter(f => f.endsWith('-PLAN.md') || f === 'PLAN.md').sort();\n const summaryFiles = phaseFiles.filter(f => f.endsWith('-SUMMARY.md') || f === 'SUMMARY.md');\n const completedPlanIds = new Set(summaryFiles.map(s => s.replace('-SUMMARY.md', '').replace('SUMMARY.md', '')));\n const plans = [];\n const waves = {};\n const incomplete = [];\n let hasCheckpoints = false;\n for (const planFile of planFiles) {\n const planId = planFile.replace('-PLAN.md', '').replace('PLAN.md', '');\n const planPath = node_path_1.default.join(phaseDir, planFile);\n const content = node_fs_1.default.readFileSync(planPath, 'utf-8');\n const fm = (0, frontmatter_js_1.extractFrontmatter)(content);\n const taskMatches = content.match(/##\\s*Task\\s*\\d+/gi) || [];\n const taskCount = taskMatches.length;\n const wave = parseInt(fm.wave, 10) || 1;\n let autonomous = true;\n if (fm.autonomous !== undefined) {\n autonomous = fm.autonomous === 'true' || fm.autonomous === true;\n }\n if (!autonomous) {\n hasCheckpoints = true;\n }\n let filesModified = [];\n if (fm['files-modified']) {\n filesModified = Array.isArray(fm['files-modified']) ? fm['files-modified'] : [fm['files-modified']];\n }\n const hasSummary = completedPlanIds.has(planId);\n if (!hasSummary) {\n incomplete.push(planId);\n }\n const plan = {\n id: planId,\n wave,\n autonomous,\n objective: fm.objective || null,\n files_modified: filesModified,\n task_count: taskCount,\n has_summary: hasSummary,\n };\n plans.push(plan);\n const waveKey = String(wave);\n if (!waves[waveKey]) {\n waves[waveKey] = [];\n }\n waves[waveKey].push(planId);\n }\n (0, core_js_1.output)({ phase: normalized, plans, waves, incomplete, has_checkpoints: hasCheckpoints }, raw);\n}\n// ─── Phase add ──────────────────────────────────────────────────────────────\nfunction cmdPhaseAdd(cwd, description, raw) {\n if (!description) {\n (0, core_js_1.error)('description required for phase add');\n }\n const roadmapPath = node_path_1.default.join(cwd, '.planning', 'ROADMAP.md');\n if (!node_fs_1.default.existsSync(roadmapPath)) {\n (0, core_js_1.error)('ROADMAP.md not found');\n }\n const content = node_fs_1.default.readFileSync(roadmapPath, 'utf-8');\n const slug = (0, core_js_1.generateSlugInternal)(description);\n const phasePattern = /#{2,4}\\s*Phase\\s+(\\d+)[A-Z]?(?:\\.\\d+)?:/gi;\n let maxPhase = 0;\n let m;\n while ((m = phasePattern.exec(content)) !== null) {\n const num = parseInt(m[1], 10);\n if (num > maxPhase)\n maxPhase = num;\n }\n const newPhaseNum = maxPhase + 1;\n const paddedNum = String(newPhaseNum).padStart(2, '0');\n const dirName = `${paddedNum}-${slug}`;\n const dirPath = node_path_1.default.join(cwd, '.planning', 'phases', dirName);\n node_fs_1.default.mkdirSync(dirPath, { recursive: true });\n node_fs_1.default.writeFileSync(node_path_1.default.join(dirPath, '.gitkeep'), '');\n const phaseEntry = `\\n### Phase ${newPhaseNum}: ${description}\\n\\n**Goal:** [To be planned]\\n**Requirements**: TBD\\n**Depends on:** Phase ${maxPhase}\\n**Plans:** 0 plans\\n\\nPlans:\\n- [ ] TBD (run /maxsim:plan-phase ${newPhaseNum} to break down)\\n`;\n let updatedContent;\n const lastSeparator = content.lastIndexOf('\\n---');\n if (lastSeparator > 0) {\n updatedContent = content.slice(0, lastSeparator) + phaseEntry + content.slice(lastSeparator);\n }\n else {\n updatedContent = content + phaseEntry;\n }\n node_fs_1.default.writeFileSync(roadmapPath, updatedContent, 'utf-8');\n (0, core_js_1.output)({ phase_number: newPhaseNum, padded: paddedNum, name: description, slug, directory: `.planning/phases/${dirName}` }, raw, paddedNum);\n}\n// ─── Phase insert ───────────────────────────────────────────────────────────\nfunction cmdPhaseInsert(cwd, afterPhase, description, raw) {\n if (!afterPhase || !description) {\n (0, core_js_1.error)('after-phase and description required for phase insert');\n }\n const roadmapPath = node_path_1.default.join(cwd, '.planning', 'ROADMAP.md');\n if (!node_fs_1.default.existsSync(roadmapPath)) {\n (0, core_js_1.error)('ROADMAP.md not found');\n }\n const content = node_fs_1.default.readFileSync(roadmapPath, 'utf-8');\n const slug = (0, core_js_1.generateSlugInternal)(description);\n const normalizedAfter = (0, core_js_1.normalizePhaseName)(afterPhase);\n const unpadded = normalizedAfter.replace(/^0+/, '');\n const afterPhaseEscaped = unpadded.replace(/\\./g, '\\\\.');\n const targetPattern = new RegExp(`#{2,4}\\\\s*Phase\\\\s+0*${afterPhaseEscaped}:`, 'i');\n if (!targetPattern.test(content)) {\n (0, core_js_1.error)(`Phase ${afterPhase} not found in ROADMAP.md`);\n }\n const phasesDir = node_path_1.default.join(cwd, '.planning', 'phases');\n const normalizedBase = (0, core_js_1.normalizePhaseName)(afterPhase);\n const existingDecimals = [];\n try {\n const entries = node_fs_1.default.readdirSync(phasesDir, { withFileTypes: true });\n const dirs = entries.filter(e => e.isDirectory()).map(e => e.name);\n const decimalPattern = new RegExp(`^${normalizedBase}\\\\.(\\\\d+)`);\n for (const dir of dirs) {\n const dm = dir.match(decimalPattern);\n if (dm)\n existingDecimals.push(parseInt(dm[1], 10));\n }\n }\n catch { /* ignore */ }\n const nextDecimal = existingDecimals.length === 0 ? 1 : Math.max(...existingDecimals) + 1;\n const decimalPhase = `${normalizedBase}.${nextDecimal}`;\n const dirName = `${decimalPhase}-${slug}`;\n const dirPath = node_path_1.default.join(cwd, '.planning', 'phases', dirName);\n node_fs_1.default.mkdirSync(dirPath, { recursive: true });\n node_fs_1.default.writeFileSync(node_path_1.default.join(dirPath, '.gitkeep'), '');\n const phaseEntry = `\\n### Phase ${decimalPhase}: ${description} (INSERTED)\\n\\n**Goal:** [Urgent work - to be planned]\\n**Requirements**: TBD\\n**Depends on:** Phase ${afterPhase}\\n**Plans:** 0 plans\\n\\nPlans:\\n- [ ] TBD (run /maxsim:plan-phase ${decimalPhase} to break down)\\n`;\n const headerPattern = new RegExp(`(#{2,4}\\\\s*Phase\\\\s+0*${afterPhaseEscaped}:[^\\\\n]*\\\\n)`, 'i');\n const headerMatch = content.match(headerPattern);\n if (!headerMatch) {\n (0, core_js_1.error)(`Could not find Phase ${afterPhase} header`);\n }\n const headerIdx = content.indexOf(headerMatch[0]);\n const afterHeader = content.slice(headerIdx + headerMatch[0].length);\n const nextPhaseMatch = afterHeader.match(/\\n#{2,4}\\s+Phase\\s+\\d/i);\n let insertIdx;\n if (nextPhaseMatch) {\n insertIdx = headerIdx + headerMatch[0].length + nextPhaseMatch.index;\n }\n else {\n insertIdx = content.length;\n }\n const updatedContent = content.slice(0, insertIdx) + phaseEntry + content.slice(insertIdx);\n node_fs_1.default.writeFileSync(roadmapPath, updatedContent, 'utf-8');\n (0, core_js_1.output)({ phase_number: decimalPhase, after_phase: afterPhase, name: description, slug, directory: `.planning/phases/${dirName}` }, raw, decimalPhase);\n}\n// ─── Phase remove ───────────────────────────────────────────────────────────\nfunction cmdPhaseRemove(cwd, targetPhase, options, raw) {\n if (!targetPhase) {\n (0, core_js_1.error)('phase number required for phase remove');\n }\n const roadmapPath = node_path_1.default.join(cwd, '.planning', 'ROADMAP.md');\n const phasesDir = node_path_1.default.join(cwd, '.planning', 'phases');\n const force = options.force || false;\n if (!node_fs_1.default.existsSync(roadmapPath)) {\n (0, core_js_1.error)('ROADMAP.md not found');\n }\n const normalized = (0, core_js_1.normalizePhaseName)(targetPhase);\n const isDecimal = targetPhase.includes('.');\n let targetDir = null;\n try {\n const entries = node_fs_1.default.readdirSync(phasesDir, { withFileTypes: true });\n const dirs = entries.filter(e => e.isDirectory()).map(e => e.name).sort((a, b) => (0, core_js_1.comparePhaseNum)(a, b));\n targetDir = dirs.find(d => d.startsWith(normalized + '-') || d === normalized) || null;\n }\n catch { /* ignore */ }\n if (targetDir && !force) {\n const targetPath = node_path_1.default.join(phasesDir, targetDir);\n const files = node_fs_1.default.readdirSync(targetPath);\n const summaries = files.filter(f => f.endsWith('-SUMMARY.md') || f === 'SUMMARY.md');\n if (summaries.length > 0) {\n (0, core_js_1.error)(`Phase ${targetPhase} has ${summaries.length} executed plan(s). Use --force to remove anyway.`);\n }\n }\n if (targetDir) {\n node_fs_1.default.rmSync(node_path_1.default.join(phasesDir, targetDir), { recursive: true, force: true });\n }\n const renamedDirs = [];\n const renamedFiles = [];\n if (isDecimal) {\n const baseParts = normalized.split('.');\n const baseInt = baseParts[0];\n const removedDecimal = parseInt(baseParts[1], 10);\n try {\n const entries = node_fs_1.default.readdirSync(phasesDir, { withFileTypes: true });\n const dirs = entries.filter(e => e.isDirectory()).map(e => e.name).sort((a, b) => (0, core_js_1.comparePhaseNum)(a, b));\n const decPattern = new RegExp(`^${baseInt}\\\\.(\\\\d+)-(.+)$`);\n const toRename = [];\n for (const dir of dirs) {\n const dm = dir.match(decPattern);\n if (dm && parseInt(dm[1], 10) > removedDecimal) {\n toRename.push({ dir, oldDecimal: parseInt(dm[1], 10), slug: dm[2] });\n }\n }\n toRename.sort((a, b) => b.oldDecimal - a.oldDecimal);\n for (const item of toRename) {\n const newDecimal = item.oldDecimal - 1;\n const oldPhaseId = `${baseInt}.${item.oldDecimal}`;\n const newPhaseId = `${baseInt}.${newDecimal}`;\n const newDirName = `${baseInt}.${newDecimal}-${item.slug}`;\n node_fs_1.default.renameSync(node_path_1.default.join(phasesDir, item.dir), node_path_1.default.join(phasesDir, newDirName));\n renamedDirs.push({ from: item.dir, to: newDirName });\n const dirFiles = node_fs_1.default.readdirSync(node_path_1.default.join(phasesDir, newDirName));\n for (const f of dirFiles) {\n if (f.includes(oldPhaseId)) {\n const newFileName = f.replace(oldPhaseId, newPhaseId);\n node_fs_1.default.renameSync(node_path_1.default.join(phasesDir, newDirName, f), node_path_1.default.join(phasesDir, newDirName, newFileName));\n renamedFiles.push({ from: f, to: newFileName });\n }\n }\n }\n }\n catch { /* ignore */ }\n }\n else {\n const removedInt = parseInt(normalized, 10);\n try {\n const entries = node_fs_1.default.readdirSync(phasesDir, { withFileTypes: true });\n const dirs = entries.filter(e => e.isDirectory()).map(e => e.name).sort((a, b) => (0, core_js_1.comparePhaseNum)(a, b));\n const toRename = [];\n for (const dir of dirs) {\n const dm = dir.match(/^(\\d+)([A-Z])?(?:\\.(\\d+))?-(.+)$/i);\n if (!dm)\n continue;\n const dirInt = parseInt(dm[1], 10);\n if (dirInt > removedInt) {\n toRename.push({\n dir,\n oldInt: dirInt,\n letter: dm[2] ? dm[2].toUpperCase() : '',\n decimal: dm[3] ? parseInt(dm[3], 10) : null,\n slug: dm[4],\n });\n }\n }\n toRename.sort((a, b) => {\n if (a.oldInt !== b.oldInt)\n return b.oldInt - a.oldInt;\n return (b.decimal || 0) - (a.decimal || 0);\n });\n for (const item of toRename) {\n const newInt = item.oldInt - 1;\n const newPadded = String(newInt).padStart(2, '0');\n const oldPadded = String(item.oldInt).padStart(2, '0');\n const letterSuffix = item.letter || '';\n const decimalSuffix = item.decimal !== null ? `.${item.decimal}` : '';\n const oldPrefix = `${oldPadded}${letterSuffix}${decimalSuffix}`;\n const newPrefix = `${newPadded}${letterSuffix}${decimalSuffix}`;\n const newDirName = `${newPrefix}-${item.slug}`;\n node_fs_1.default.renameSync(node_path_1.default.join(phasesDir, item.dir), node_path_1.default.join(phasesDir, newDirName));\n renamedDirs.push({ from: item.dir, to: newDirName });\n const dirFiles = node_fs_1.default.readdirSync(node_path_1.default.join(phasesDir, newDirName));\n for (const f of dirFiles) {\n if (f.startsWith(oldPrefix)) {\n const newFileName = newPrefix + f.slice(oldPrefix.length);\n node_fs_1.default.renameSync(node_path_1.default.join(phasesDir, newDirName, f), node_path_1.default.join(phasesDir, newDirName, newFileName));\n renamedFiles.push({ from: f, to: newFileName });\n }\n }\n }\n }\n catch { /* ignore */ }\n }\n // Update ROADMAP.md\n let roadmapContent = node_fs_1.default.readFileSync(roadmapPath, 'utf-8');\n const targetEscaped = targetPhase.replace(/\\./g, '\\\\.');\n const sectionPattern = new RegExp(`\\\\n?#{2,4}\\\\s*Phase\\\\s+${targetEscaped}\\\\s*:[\\\\s\\\\S]*?(?=\\\\n#{2,4}\\\\s+Phase\\\\s+\\\\d|$)`, 'i');\n roadmapContent = roadmapContent.replace(sectionPattern, '');\n const checkboxPattern = new RegExp(`\\\\n?-\\\\s*\\\\[[ x]\\\\]\\\\s*.*Phase\\\\s+${targetEscaped}[:\\\\s][^\\\\n]*`, 'gi');\n roadmapContent = roadmapContent.replace(checkboxPattern, '');\n const tableRowPattern = new RegExp(`\\\\n?\\\\|\\\\s*${targetEscaped}\\\\.?\\\\s[^|]*\\\\|[^\\\\n]*`, 'gi');\n roadmapContent = roadmapContent.replace(tableRowPattern, '');\n if (!isDecimal) {\n const removedInt = parseInt(normalized, 10);\n const maxPhase = 99;\n for (let oldNum = maxPhase; oldNum > removedInt; oldNum--) {\n const newNum = oldNum - 1;\n const oldStr = String(oldNum);\n const newStr = String(newNum);\n const oldPad = oldStr.padStart(2, '0');\n const newPad = newStr.padStart(2, '0');\n roadmapContent = roadmapContent.replace(new RegExp(`(#{2,4}\\\\s*Phase\\\\s+)${oldStr}(\\\\s*:)`, 'gi'), `$1${newStr}$2`);\n roadmapContent = roadmapContent.replace(new RegExp(`(Phase\\\\s+)${oldStr}([:\\\\s])`, 'g'), `$1${newStr}$2`);\n roadmapContent = roadmapContent.replace(new RegExp(`${oldPad}-(\\\\d{2})`, 'g'), `${newPad}-$1`);\n roadmapContent = roadmapContent.replace(new RegExp(`(\\\\|\\\\s*)${oldStr}\\\\.\\\\s`, 'g'), `$1${newStr}. `);\n roadmapContent = roadmapContent.replace(new RegExp(`(Depends on:\\\\*\\\\*\\\\s*Phase\\\\s+)${oldStr}\\\\b`, 'gi'), `$1${newStr}`);\n }\n }\n node_fs_1.default.writeFileSync(roadmapPath, roadmapContent, 'utf-8');\n // Update STATE.md phase count\n const statePath = node_path_1.default.join(cwd, '.planning', 'STATE.md');\n if (node_fs_1.default.existsSync(statePath)) {\n let stateContent = node_fs_1.default.readFileSync(statePath, 'utf-8');\n const totalPattern = /(\\*\\*Total Phases:\\*\\*\\s*)(\\d+)/;\n const totalMatch = stateContent.match(totalPattern);\n if (totalMatch) {\n const oldTotal = parseInt(totalMatch[2], 10);\n stateContent = stateContent.replace(totalPattern, `$1${oldTotal - 1}`);\n }\n const ofPattern = /(\\bof\\s+)(\\d+)(\\s*(?:\\(|phases?))/i;\n const ofMatch = stateContent.match(ofPattern);\n if (ofMatch) {\n const oldTotal = parseInt(ofMatch[2], 10);\n stateContent = stateContent.replace(ofPattern, `$1${oldTotal - 1}$3`);\n }\n node_fs_1.default.writeFileSync(statePath, stateContent, 'utf-8');\n }\n (0, core_js_1.output)({\n removed: targetPhase,\n directory_deleted: targetDir || null,\n renamed_directories: renamedDirs,\n renamed_files: renamedFiles,\n roadmap_updated: true,\n state_updated: node_fs_1.default.existsSync(statePath),\n }, raw);\n}\n// ─── Phase complete ─────────────────────────────────────────────────────────\nfunction cmdPhaseComplete(cwd, phaseNum, raw) {\n if (!phaseNum) {\n (0, core_js_1.error)('phase number required for phase complete');\n }\n const roadmapPath = node_path_1.default.join(cwd, '.planning', 'ROADMAP.md');\n const statePath = node_path_1.default.join(cwd, '.planning', 'STATE.md');\n const phasesDir = node_path_1.default.join(cwd, '.planning', 'phases');\n const normalized = (0, core_js_1.normalizePhaseName)(phaseNum);\n const today = new Date().toISOString().split('T')[0];\n const phaseInfo = (0, core_js_1.findPhaseInternal)(cwd, phaseNum);\n if (!phaseInfo) {\n (0, core_js_1.error)(`Phase ${phaseNum} not found`);\n }\n const planCount = phaseInfo.plans.length;\n const summaryCount = phaseInfo.summaries.length;\n if (node_fs_1.default.existsSync(roadmapPath)) {\n let roadmapContent = node_fs_1.default.readFileSync(roadmapPath, 'utf-8');\n const checkboxPattern = new RegExp(`(-\\\\s*\\\\[)[ ](\\\\]\\\\s*.*Phase\\\\s+${phaseNum.replace('.', '\\\\.')}[:\\\\s][^\\\\n]*)`, 'i');\n roadmapContent = roadmapContent.replace(checkboxPattern, `$1x$2 (completed ${today})`);\n const phaseEscaped = phaseNum.replace('.', '\\\\.');\n const tablePattern = new RegExp(`(\\\\|\\\\s*${phaseEscaped}\\\\.?\\\\s[^|]*\\\\|[^|]*\\\\|)\\\\s*[^|]*(\\\\|)\\\\s*[^|]*(\\\\|)`, 'i');\n roadmapContent = roadmapContent.replace(tablePattern, `$1 Complete $2 ${today} $3`);\n const planCountPattern = new RegExp(`(#{2,4}\\\\s*Phase\\\\s+${phaseEscaped}[\\\\s\\\\S]*?\\\\*\\\\*Plans:\\\\*\\\\*\\\\s*)[^\\\\n]+`, 'i');\n roadmapContent = roadmapContent.replace(planCountPattern, `$1${summaryCount}/${planCount} plans complete`);\n node_fs_1.default.writeFileSync(roadmapPath, roadmapContent, 'utf-8');\n // Update REQUIREMENTS.md\n const reqPath = node_path_1.default.join(cwd, '.planning', 'REQUIREMENTS.md');\n if (node_fs_1.default.existsSync(reqPath)) {\n const reqMatch = roadmapContent.match(new RegExp(`Phase\\\\s+${phaseNum.replace('.', '\\\\.')}[\\\\s\\\\S]*?\\\\*\\\\*Requirements:\\\\*\\\\*\\\\s*([^\\\\n]+)`, 'i'));\n if (reqMatch) {\n const reqIds = reqMatch[1].replace(/[\\[\\]]/g, '').split(/[,\\s]+/).map(r => r.trim()).filter(Boolean);\n let reqContent = node_fs_1.default.readFileSync(reqPath, 'utf-8');\n for (const reqId of reqIds) {\n reqContent = reqContent.replace(new RegExp(`(-\\\\s*\\\\[)[ ](\\\\]\\\\s*\\\\*\\\\*${reqId}\\\\*\\\\*)`, 'gi'), '$1x$2');\n reqContent = reqContent.replace(new RegExp(`(\\\\|\\\\s*${reqId}\\\\s*\\\\|[^|]+\\\\|)\\\\s*Pending\\\\s*(\\\\|)`, 'gi'), '$1 Complete $2');\n }\n node_fs_1.default.writeFileSync(reqPath, reqContent, 'utf-8');\n }\n }\n }\n // Find next phase\n let nextPhaseNum = null;\n let nextPhaseName = null;\n let isLastPhase = true;\n try {\n const entries = node_fs_1.default.readdirSync(phasesDir, { withFileTypes: true });\n const dirs = entries.filter(e => e.isDirectory()).map(e => e.name).sort((a, b) => (0, core_js_1.comparePhaseNum)(a, b));\n for (const dir of dirs) {\n const dm = dir.match(/^(\\d+[A-Z]?(?:\\.\\d+)?)-?(.*)/i);\n if (dm) {\n if ((0, core_js_1.comparePhaseNum)(dm[1], phaseNum) > 0) {\n nextPhaseNum = dm[1];\n nextPhaseName = dm[2] || null;\n isLastPhase = false;\n break;\n }\n }\n }\n }\n catch { /* ignore */ }\n // Update STATE.md\n if (node_fs_1.default.existsSync(statePath)) {\n let stateContent = node_fs_1.default.readFileSync(statePath, 'utf-8');\n stateContent = stateContent.replace(/(\\*\\*Current Phase:\\*\\*\\s*).*/, `$1${nextPhaseNum || phaseNum}`);\n if (nextPhaseName) {\n stateContent = stateContent.replace(/(\\*\\*Current Phase Name:\\*\\*\\s*).*/, `$1${nextPhaseName.replace(/-/g, ' ')}`);\n }\n stateContent = stateContent.replace(/(\\*\\*Status:\\*\\*\\s*).*/, `$1${isLastPhase ? 'Milestone complete' : 'Ready to plan'}`);\n stateContent = stateContent.replace(/(\\*\\*Current Plan:\\*\\*\\s*).*/, `$1Not started`);\n stateContent = stateContent.replace(/(\\*\\*Last Activity:\\*\\*\\s*).*/, `$1${today}`);\n stateContent = stateContent.replace(/(\\*\\*Last Activity Description:\\*\\*\\s*).*/, `$1Phase ${phaseNum} complete${nextPhaseNum ? `, transitioned to Phase ${nextPhaseNum}` : ''}`);\n node_fs_1.default.writeFileSync(statePath, stateContent, 'utf-8');\n }\n (0, core_js_1.output)({\n completed_phase: phaseNum,\n phase_name: phaseInfo.phase_name,\n plans_executed: `${summaryCount}/${planCount}`,\n next_phase: nextPhaseNum,\n next_phase_name: nextPhaseName,\n is_last_phase: isLastPhase,\n date: today,\n roadmap_updated: node_fs_1.default.existsSync(roadmapPath),\n state_updated: node_fs_1.default.existsSync(statePath),\n }, raw);\n}\n//# sourceMappingURL=phase.js.map","\"use strict\";\n/**\n * Template — Template selection and fill operations\n *\n * Ported from maxsim/bin/lib/template.cjs\n */\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.cmdTemplateSelect = cmdTemplateSelect;\nexports.cmdTemplateFill = cmdTemplateFill;\nconst node_fs_1 = __importDefault(require(\"node:fs\"));\nconst node_path_1 = __importDefault(require(\"node:path\"));\nconst core_js_1 = require(\"./core.js\");\nconst frontmatter_js_1 = require(\"./frontmatter.js\");\n// ─── Template Select ─────────────────────────────────────────────────────────\nfunction cmdTemplateSelect(cwd, planPath, raw) {\n if (!planPath) {\n (0, core_js_1.error)('plan-path required');\n }\n try {\n const fullPath = node_path_1.default.join(cwd, planPath);\n const content = node_fs_1.default.readFileSync(fullPath, 'utf-8');\n const taskMatch = content.match(/###\\s*Task\\s*\\d+/g) || [];\n const taskCount = taskMatch.length;\n const decisionMatch = content.match(/decision/gi) || [];\n const hasDecisions = decisionMatch.length > 0;\n const fileMentions = new Set();\n const filePattern = /`([^`]+\\.[a-zA-Z]+)`/g;\n let m;\n while ((m = filePattern.exec(content)) !== null) {\n if (m[1].includes('/') && !m[1].startsWith('http')) {\n fileMentions.add(m[1]);\n }\n }\n const fileCount = fileMentions.size;\n let template = 'templates/summary-standard.md';\n let type = 'standard';\n if (taskCount <= 2 && fileCount <= 3 && !hasDecisions) {\n template = 'templates/summary-minimal.md';\n type = 'minimal';\n }\n else if (hasDecisions || fileCount > 6 || taskCount > 5) {\n template = 'templates/summary-complex.md';\n type = 'complex';\n }\n const result = { template, type, taskCount, fileCount, hasDecisions };\n (0, core_js_1.output)(result, raw, template);\n }\n catch (thrown) {\n const selectErr = thrown;\n (0, core_js_1.output)({ template: 'templates/summary-standard.md', type: 'standard', error: selectErr.message }, raw, 'templates/summary-standard.md');\n }\n}\n// ─── Template Fill ───────────────────────────────────────────────────────────\nfunction cmdTemplateFill(cwd, templateType, options, raw) {\n if (!templateType) {\n (0, core_js_1.error)('template type required: summary, plan, or verification');\n }\n if (!options.phase) {\n (0, core_js_1.error)('--phase required');\n }\n const phaseInfo = (0, core_js_1.findPhaseInternal)(cwd, options.phase);\n if (!phaseInfo) {\n (0, core_js_1.output)({ error: 'Phase not found', phase: options.phase }, raw);\n return;\n }\n const padded = (0, core_js_1.normalizePhaseName)(options.phase);\n const today = new Date().toISOString().split('T')[0];\n const phaseName = options.name || phaseInfo.phase_name || 'Unnamed';\n const phaseSlug = phaseInfo.phase_slug || (0, core_js_1.generateSlugInternal)(phaseName);\n const phaseId = `${padded}-${phaseSlug}`;\n const planNum = (options.plan || '01').padStart(2, '0');\n const fields = options.fields || {};\n let frontmatter;\n let body;\n let fileName;\n switch (templateType) {\n case 'summary': {\n frontmatter = {\n phase: phaseId,\n plan: planNum,\n subsystem: '[primary category]',\n tags: [],\n provides: [],\n affects: [],\n 'tech-stack': { added: [], patterns: [] },\n 'key-files': { created: [], modified: [] },\n 'key-decisions': [],\n 'patterns-established': [],\n duration: '[X]min',\n completed: today,\n ...fields,\n };\n body = [\n `# Phase ${options.phase}: ${phaseName} Summary`,\n '',\n '**[Substantive one-liner describing outcome]**',\n '',\n '## Performance',\n '- **Duration:** [time]',\n '- **Tasks:** [count completed]',\n '- **Files modified:** [count]',\n '',\n '## Accomplishments',\n '- [Key outcome 1]',\n '- [Key outcome 2]',\n '',\n '## Task Commits',\n '1. **Task 1: [task name]** - `hash`',\n '',\n '## Files Created/Modified',\n '- `path/to/file.ts` - What it does',\n '',\n '## Decisions & Deviations',\n '[Key decisions or \"None - followed plan as specified\"]',\n '',\n '## Next Phase Readiness',\n '[What\\'s ready for next phase]',\n ].join('\\n');\n fileName = `${padded}-${planNum}-SUMMARY.md`;\n break;\n }\n case 'plan': {\n const planType = options.type || 'execute';\n const wave = parseInt(options.wave || '1') || 1;\n frontmatter = {\n phase: phaseId,\n plan: planNum,\n type: planType,\n wave,\n depends_on: [],\n files_modified: [],\n autonomous: true,\n user_setup: [],\n must_haves: { truths: [], artifacts: [], key_links: [] },\n ...fields,\n };\n body = [\n `# Phase ${options.phase} Plan ${planNum}: [Title]`,\n '',\n '## Objective',\n '- **What:** [What this plan builds]',\n '- **Why:** [Why it matters for the phase goal]',\n '- **Output:** [Concrete deliverable]',\n '',\n '## Context',\n '@.planning/PROJECT.md',\n '@.planning/ROADMAP.md',\n '@.planning/STATE.md',\n '',\n '## Tasks',\n '',\n '<task type=\"code\">',\n ' <name>[Task name]</name>',\n ' <files>[file paths]</files>',\n ' <action>[What to do]</action>',\n ' <verify>[How to verify]</verify>',\n ' <done>[Definition of done]</done>',\n '</task>',\n '',\n '## Verification',\n '[How to verify this plan achieved its objective]',\n '',\n '## Success Criteria',\n '- [ ] [Criterion 1]',\n '- [ ] [Criterion 2]',\n ].join('\\n');\n fileName = `${padded}-${planNum}-PLAN.md`;\n break;\n }\n case 'verification': {\n frontmatter = {\n phase: phaseId,\n verified: new Date().toISOString(),\n status: 'pending',\n score: '0/0 must-haves verified',\n ...fields,\n };\n body = [\n `# Phase ${options.phase}: ${phaseName} — Verification`,\n '',\n '## Observable Truths',\n '| # | Truth | Status | Evidence |',\n '|---|-------|--------|----------|',\n '| 1 | [Truth] | pending | |',\n '',\n '## Required Artifacts',\n '| Artifact | Expected | Status | Details |',\n '|----------|----------|--------|---------|',\n '| [path] | [what] | pending | |',\n '',\n '## Key Link Verification',\n '| From | To | Via | Status | Details |',\n '|------|----|----|--------|---------|',\n '| [source] | [target] | [connection] | pending | |',\n '',\n '## Requirements Coverage',\n '| Requirement | Status | Blocking Issue |',\n '|-------------|--------|----------------|',\n '| [req] | pending | |',\n '',\n '## Result',\n '[Pending verification]',\n ].join('\\n');\n fileName = `${padded}-VERIFICATION.md`;\n break;\n }\n default:\n (0, core_js_1.error)(`Unknown template type: ${templateType}. Available: summary, plan, verification`);\n return;\n }\n const fullContent = `---\\n${(0, frontmatter_js_1.reconstructFrontmatter)(frontmatter)}\\n---\\n\\n${body}\\n`;\n const outPath = node_path_1.default.join(cwd, phaseInfo.directory, fileName);\n if (node_fs_1.default.existsSync(outPath)) {\n (0, core_js_1.output)({ error: 'File already exists', path: node_path_1.default.relative(cwd, outPath) }, raw);\n return;\n }\n node_fs_1.default.writeFileSync(outPath, fullContent, 'utf-8');\n const relPath = node_path_1.default.relative(cwd, outPath);\n const result = { created: true, path: relPath, template: templateType };\n (0, core_js_1.output)(result, raw, relPath);\n}\n//# sourceMappingURL=template.js.map","\"use strict\";\n/**\n * Init — Compound init commands for workflow bootstrapping\n *\n * Ported from maxsim/bin/lib/init.cjs\n */\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.cmdInitExecutePhase = cmdInitExecutePhase;\nexports.cmdInitPlanPhase = cmdInitPlanPhase;\nexports.cmdInitNewProject = cmdInitNewProject;\nexports.cmdInitNewMilestone = cmdInitNewMilestone;\nexports.cmdInitQuick = cmdInitQuick;\nexports.cmdInitResume = cmdInitResume;\nexports.cmdInitVerifyWork = cmdInitVerifyWork;\nexports.cmdInitPhaseOp = cmdInitPhaseOp;\nexports.cmdInitTodos = cmdInitTodos;\nexports.cmdInitMilestoneOp = cmdInitMilestoneOp;\nexports.cmdInitMapCodebase = cmdInitMapCodebase;\nexports.cmdInitProgress = cmdInitProgress;\nconst node_fs_1 = __importDefault(require(\"node:fs\"));\nconst node_path_1 = __importDefault(require(\"node:path\"));\nconst node_os_1 = __importDefault(require(\"node:os\"));\nconst node_child_process_1 = require(\"node:child_process\");\nconst core_js_1 = require(\"./core.js\");\n// ─── Helper: extract requirement IDs from roadmap phase section ─────────────\nfunction extractReqIds(cwd, phase) {\n const roadmapPhase = (0, core_js_1.getRoadmapPhaseInternal)(cwd, phase);\n const reqMatch = roadmapPhase?.section?.match(/^\\*\\*Requirements\\*\\*:[^\\S\\n]*([^\\n]*)$/m);\n const reqExtracted = reqMatch\n ? reqMatch[1].replace(/[\\[\\]]/g, '').split(',').map((s) => s.trim()).filter(Boolean).join(', ')\n : null;\n return (reqExtracted && reqExtracted !== 'TBD') ? reqExtracted : null;\n}\nfunction scanPhaseArtifacts(cwd, phaseDirectory) {\n const result = {};\n const phaseDirFull = node_path_1.default.join(cwd, phaseDirectory);\n try {\n const files = node_fs_1.default.readdirSync(phaseDirFull);\n const contextFile = files.find(f => f.endsWith('-CONTEXT.md') || f === 'CONTEXT.md');\n if (contextFile) {\n result.context_path = node_path_1.default.join(phaseDirectory, contextFile);\n }\n const researchFile = files.find(f => f.endsWith('-RESEARCH.md') || f === 'RESEARCH.md');\n if (researchFile) {\n result.research_path = node_path_1.default.join(phaseDirectory, researchFile);\n }\n const verificationFile = files.find(f => f.endsWith('-VERIFICATION.md') || f === 'VERIFICATION.md');\n if (verificationFile) {\n result.verification_path = node_path_1.default.join(phaseDirectory, verificationFile);\n }\n const uatFile = files.find(f => f.endsWith('-UAT.md') || f === 'UAT.md');\n if (uatFile) {\n result.uat_path = node_path_1.default.join(phaseDirectory, uatFile);\n }\n }\n catch { /* ignore */ }\n return result;\n}\n// ─── Init commands ──────────────────────────────────────────────────────────\nfunction cmdInitExecutePhase(cwd, phase, raw) {\n if (!phase) {\n (0, core_js_1.error)('phase required for init execute-phase');\n }\n const config = (0, core_js_1.loadConfig)(cwd);\n const phaseInfo = (0, core_js_1.findPhaseInternal)(cwd, phase);\n const milestone = (0, core_js_1.getMilestoneInfo)(cwd);\n const phase_req_ids = extractReqIds(cwd, phase);\n const result = {\n executor_model: (0, core_js_1.resolveModelInternal)(cwd, 'maxsim-executor'),\n verifier_model: (0, core_js_1.resolveModelInternal)(cwd, 'maxsim-verifier'),\n commit_docs: config.commit_docs,\n parallelization: config.parallelization,\n branching_strategy: config.branching_strategy,\n phase_branch_template: config.phase_branch_template,\n milestone_branch_template: config.milestone_branch_template,\n verifier_enabled: config.verifier,\n phase_found: !!phaseInfo,\n phase_dir: phaseInfo?.directory ?? null,\n phase_number: phaseInfo?.phase_number ?? null,\n phase_name: phaseInfo?.phase_name ?? null,\n phase_slug: phaseInfo?.phase_slug ?? null,\n phase_req_ids,\n plans: phaseInfo?.plans ?? [],\n summaries: phaseInfo?.summaries ?? [],\n incomplete_plans: phaseInfo?.incomplete_plans ?? [],\n plan_count: phaseInfo?.plans?.length ?? 0,\n incomplete_count: phaseInfo?.incomplete_plans?.length ?? 0,\n branch_name: config.branching_strategy === 'phase' && phaseInfo\n ? config.phase_branch_template\n .replace('{phase}', phaseInfo.phase_number)\n .replace('{slug}', phaseInfo.phase_slug || 'phase')\n : config.branching_strategy === 'milestone'\n ? config.milestone_branch_template\n .replace('{milestone}', milestone.version)\n .replace('{slug}', (0, core_js_1.generateSlugInternal)(milestone.name) || 'milestone')\n : null,\n milestone_version: milestone.version,\n milestone_name: milestone.name,\n milestone_slug: (0, core_js_1.generateSlugInternal)(milestone.name),\n state_exists: (0, core_js_1.pathExistsInternal)(cwd, '.planning/STATE.md'),\n roadmap_exists: (0, core_js_1.pathExistsInternal)(cwd, '.planning/ROADMAP.md'),\n config_exists: (0, core_js_1.pathExistsInternal)(cwd, '.planning/config.json'),\n state_path: '.planning/STATE.md',\n roadmap_path: '.planning/ROADMAP.md',\n config_path: '.planning/config.json',\n };\n (0, core_js_1.output)(result, raw);\n}\nfunction cmdInitPlanPhase(cwd, phase, raw) {\n if (!phase) {\n (0, core_js_1.error)('phase required for init plan-phase');\n }\n const config = (0, core_js_1.loadConfig)(cwd);\n const phaseInfo = (0, core_js_1.findPhaseInternal)(cwd, phase);\n const phase_req_ids = extractReqIds(cwd, phase);\n const result = {\n researcher_model: (0, core_js_1.resolveModelInternal)(cwd, 'maxsim-phase-researcher'),\n planner_model: (0, core_js_1.resolveModelInternal)(cwd, 'maxsim-planner'),\n checker_model: (0, core_js_1.resolveModelInternal)(cwd, 'maxsim-plan-checker'),\n research_enabled: config.research,\n plan_checker_enabled: config.plan_checker,\n nyquist_validation_enabled: false, // config doesn't have nyquist_validation directly\n commit_docs: config.commit_docs,\n phase_found: !!phaseInfo,\n phase_dir: phaseInfo?.directory ?? null,\n phase_number: phaseInfo?.phase_number ?? null,\n phase_name: phaseInfo?.phase_name ?? null,\n phase_slug: phaseInfo?.phase_slug ?? null,\n padded_phase: phaseInfo?.phase_number?.padStart(2, '0') ?? null,\n phase_req_ids,\n has_research: phaseInfo?.has_research ?? false,\n has_context: phaseInfo?.has_context ?? false,\n has_plans: (phaseInfo?.plans?.length ?? 0) > 0,\n plan_count: phaseInfo?.plans?.length ?? 0,\n planning_exists: (0, core_js_1.pathExistsInternal)(cwd, '.planning'),\n roadmap_exists: (0, core_js_1.pathExistsInternal)(cwd, '.planning/ROADMAP.md'),\n state_path: '.planning/STATE.md',\n roadmap_path: '.planning/ROADMAP.md',\n requirements_path: '.planning/REQUIREMENTS.md',\n };\n if (phaseInfo?.directory) {\n const artifacts = scanPhaseArtifacts(cwd, phaseInfo.directory);\n if (artifacts.context_path)\n result.context_path = artifacts.context_path;\n if (artifacts.research_path)\n result.research_path = artifacts.research_path;\n if (artifacts.verification_path)\n result.verification_path = artifacts.verification_path;\n if (artifacts.uat_path)\n result.uat_path = artifacts.uat_path;\n }\n (0, core_js_1.output)(result, raw);\n}\nfunction cmdInitNewProject(cwd, raw) {\n const config = (0, core_js_1.loadConfig)(cwd);\n const homedir = node_os_1.default.homedir();\n const braveKeyFile = node_path_1.default.join(homedir, '.maxsim', 'brave_api_key');\n const hasBraveSearch = !!(process.env.BRAVE_API_KEY || node_fs_1.default.existsSync(braveKeyFile));\n let hasCode = false;\n let hasPackageFile = false;\n try {\n const files = (0, node_child_process_1.execSync)('find . -maxdepth 3 \\\\( -name \"*.ts\" -o -name \"*.js\" -o -name \"*.py\" -o -name \"*.go\" -o -name \"*.rs\" -o -name \"*.swift\" -o -name \"*.java\" \\\\) 2>/dev/null | grep -v node_modules | grep -v .git | head -5', {\n cwd,\n encoding: 'utf-8',\n stdio: ['pipe', 'pipe', 'pipe'],\n });\n hasCode = files.trim().length > 0;\n }\n catch { /* ignore */ }\n hasPackageFile = (0, core_js_1.pathExistsInternal)(cwd, 'package.json') ||\n (0, core_js_1.pathExistsInternal)(cwd, 'requirements.txt') ||\n (0, core_js_1.pathExistsInternal)(cwd, 'Cargo.toml') ||\n (0, core_js_1.pathExistsInternal)(cwd, 'go.mod') ||\n (0, core_js_1.pathExistsInternal)(cwd, 'Package.swift');\n const result = {\n researcher_model: (0, core_js_1.resolveModelInternal)(cwd, 'maxsim-project-researcher'),\n synthesizer_model: (0, core_js_1.resolveModelInternal)(cwd, 'maxsim-research-synthesizer'),\n roadmapper_model: (0, core_js_1.resolveModelInternal)(cwd, 'maxsim-roadmapper'),\n commit_docs: config.commit_docs,\n project_exists: (0, core_js_1.pathExistsInternal)(cwd, '.planning/PROJECT.md'),\n has_codebase_map: (0, core_js_1.pathExistsInternal)(cwd, '.planning/codebase'),\n planning_exists: (0, core_js_1.pathExistsInternal)(cwd, '.planning'),\n has_existing_code: hasCode,\n has_package_file: hasPackageFile,\n is_brownfield: hasCode || hasPackageFile,\n needs_codebase_map: (hasCode || hasPackageFile) && !(0, core_js_1.pathExistsInternal)(cwd, '.planning/codebase'),\n has_git: (0, core_js_1.pathExistsInternal)(cwd, '.git'),\n brave_search_available: hasBraveSearch,\n project_path: '.planning/PROJECT.md',\n };\n (0, core_js_1.output)(result, raw);\n}\nfunction cmdInitNewMilestone(cwd, raw) {\n const config = (0, core_js_1.loadConfig)(cwd);\n const milestone = (0, core_js_1.getMilestoneInfo)(cwd);\n const result = {\n researcher_model: (0, core_js_1.resolveModelInternal)(cwd, 'maxsim-project-researcher'),\n synthesizer_model: (0, core_js_1.resolveModelInternal)(cwd, 'maxsim-research-synthesizer'),\n roadmapper_model: (0, core_js_1.resolveModelInternal)(cwd, 'maxsim-roadmapper'),\n commit_docs: config.commit_docs,\n research_enabled: config.research,\n current_milestone: milestone.version,\n current_milestone_name: milestone.name,\n project_exists: (0, core_js_1.pathExistsInternal)(cwd, '.planning/PROJECT.md'),\n roadmap_exists: (0, core_js_1.pathExistsInternal)(cwd, '.planning/ROADMAP.md'),\n state_exists: (0, core_js_1.pathExistsInternal)(cwd, '.planning/STATE.md'),\n project_path: '.planning/PROJECT.md',\n roadmap_path: '.planning/ROADMAP.md',\n state_path: '.planning/STATE.md',\n };\n (0, core_js_1.output)(result, raw);\n}\nfunction cmdInitQuick(cwd, description, raw) {\n const config = (0, core_js_1.loadConfig)(cwd);\n const now = new Date();\n const slug = description ? (0, core_js_1.generateSlugInternal)(description)?.substring(0, 40) ?? null : null;\n const quickDir = node_path_1.default.join(cwd, '.planning', 'quick');\n let nextNum = 1;\n try {\n const existing = node_fs_1.default.readdirSync(quickDir)\n .filter(f => /^\\d+-/.test(f))\n .map(f => parseInt(f.split('-')[0], 10))\n .filter(n => !isNaN(n));\n if (existing.length > 0) {\n nextNum = Math.max(...existing) + 1;\n }\n }\n catch { /* ignore */ }\n const result = {\n planner_model: (0, core_js_1.resolveModelInternal)(cwd, 'maxsim-planner'),\n executor_model: (0, core_js_1.resolveModelInternal)(cwd, 'maxsim-executor'),\n checker_model: (0, core_js_1.resolveModelInternal)(cwd, 'maxsim-plan-checker'),\n verifier_model: (0, core_js_1.resolveModelInternal)(cwd, 'maxsim-verifier'),\n commit_docs: config.commit_docs,\n next_num: nextNum,\n slug,\n description: description ?? null,\n date: now.toISOString().split('T')[0],\n timestamp: now.toISOString(),\n quick_dir: '.planning/quick',\n task_dir: slug ? `.planning/quick/${nextNum}-${slug}` : null,\n roadmap_exists: (0, core_js_1.pathExistsInternal)(cwd, '.planning/ROADMAP.md'),\n planning_exists: (0, core_js_1.pathExistsInternal)(cwd, '.planning'),\n };\n (0, core_js_1.output)(result, raw);\n}\nfunction cmdInitResume(cwd, raw) {\n const config = (0, core_js_1.loadConfig)(cwd);\n let interruptedAgentId = null;\n try {\n interruptedAgentId = node_fs_1.default.readFileSync(node_path_1.default.join(cwd, '.planning', 'current-agent-id.txt'), 'utf-8').trim();\n }\n catch { /* ignore */ }\n const result = {\n state_exists: (0, core_js_1.pathExistsInternal)(cwd, '.planning/STATE.md'),\n roadmap_exists: (0, core_js_1.pathExistsInternal)(cwd, '.planning/ROADMAP.md'),\n project_exists: (0, core_js_1.pathExistsInternal)(cwd, '.planning/PROJECT.md'),\n planning_exists: (0, core_js_1.pathExistsInternal)(cwd, '.planning'),\n state_path: '.planning/STATE.md',\n roadmap_path: '.planning/ROADMAP.md',\n project_path: '.planning/PROJECT.md',\n has_interrupted_agent: !!interruptedAgentId,\n interrupted_agent_id: interruptedAgentId,\n commit_docs: config.commit_docs,\n };\n (0, core_js_1.output)(result, raw);\n}\nfunction cmdInitVerifyWork(cwd, phase, raw) {\n if (!phase) {\n (0, core_js_1.error)('phase required for init verify-work');\n }\n const config = (0, core_js_1.loadConfig)(cwd);\n const phaseInfo = (0, core_js_1.findPhaseInternal)(cwd, phase);\n const result = {\n planner_model: (0, core_js_1.resolveModelInternal)(cwd, 'maxsim-planner'),\n checker_model: (0, core_js_1.resolveModelInternal)(cwd, 'maxsim-plan-checker'),\n commit_docs: config.commit_docs,\n phase_found: !!phaseInfo,\n phase_dir: phaseInfo?.directory ?? null,\n phase_number: phaseInfo?.phase_number ?? null,\n phase_name: phaseInfo?.phase_name ?? null,\n has_verification: phaseInfo?.has_verification ?? false,\n };\n (0, core_js_1.output)(result, raw);\n}\nfunction cmdInitPhaseOp(cwd, phase, raw) {\n const config = (0, core_js_1.loadConfig)(cwd);\n let phaseInfo = (0, core_js_1.findPhaseInternal)(cwd, phase ?? '');\n if (!phaseInfo) {\n const roadmapPhase = (0, core_js_1.getRoadmapPhaseInternal)(cwd, phase ?? '');\n if (roadmapPhase?.found) {\n const phaseName = roadmapPhase.phase_name;\n phaseInfo = {\n found: true,\n directory: '', // no directory yet\n phase_number: roadmapPhase.phase_number,\n phase_name: phaseName,\n phase_slug: phaseName ? phaseName.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '') : null,\n plans: [],\n summaries: [],\n incomplete_plans: [],\n has_research: false,\n has_context: false,\n has_verification: false,\n };\n }\n }\n const result = {\n commit_docs: config.commit_docs,\n brave_search: config.brave_search,\n phase_found: !!phaseInfo,\n phase_dir: phaseInfo?.directory || null,\n phase_number: phaseInfo?.phase_number ?? null,\n phase_name: phaseInfo?.phase_name ?? null,\n phase_slug: phaseInfo?.phase_slug ?? null,\n padded_phase: phaseInfo?.phase_number?.padStart(2, '0') ?? null,\n has_research: phaseInfo?.has_research ?? false,\n has_context: phaseInfo?.has_context ?? false,\n has_plans: (phaseInfo?.plans?.length ?? 0) > 0,\n has_verification: phaseInfo?.has_verification ?? false,\n plan_count: phaseInfo?.plans?.length ?? 0,\n roadmap_exists: (0, core_js_1.pathExistsInternal)(cwd, '.planning/ROADMAP.md'),\n planning_exists: (0, core_js_1.pathExistsInternal)(cwd, '.planning'),\n state_path: '.planning/STATE.md',\n roadmap_path: '.planning/ROADMAP.md',\n requirements_path: '.planning/REQUIREMENTS.md',\n };\n if (phaseInfo?.directory) {\n const artifacts = scanPhaseArtifacts(cwd, phaseInfo.directory);\n if (artifacts.context_path)\n result.context_path = artifacts.context_path;\n if (artifacts.research_path)\n result.research_path = artifacts.research_path;\n if (artifacts.verification_path)\n result.verification_path = artifacts.verification_path;\n if (artifacts.uat_path)\n result.uat_path = artifacts.uat_path;\n }\n (0, core_js_1.output)(result, raw);\n}\nfunction cmdInitTodos(cwd, area, raw) {\n const config = (0, core_js_1.loadConfig)(cwd);\n const now = new Date();\n const pendingDir = node_path_1.default.join(cwd, '.planning', 'todos', 'pending');\n let count = 0;\n const todos = [];\n try {\n const files = node_fs_1.default.readdirSync(pendingDir).filter(f => f.endsWith('.md'));\n for (const file of files) {\n try {\n const content = node_fs_1.default.readFileSync(node_path_1.default.join(pendingDir, file), 'utf-8');\n const createdMatch = content.match(/^created:\\s*(.+)$/m);\n const titleMatch = content.match(/^title:\\s*(.+)$/m);\n const areaMatch = content.match(/^area:\\s*(.+)$/m);\n const todoArea = areaMatch ? areaMatch[1].trim() : 'general';\n if (area && todoArea !== area)\n continue;\n count++;\n todos.push({\n file,\n created: createdMatch ? createdMatch[1].trim() : 'unknown',\n title: titleMatch ? titleMatch[1].trim() : 'Untitled',\n area: todoArea,\n path: node_path_1.default.join('.planning', 'todos', 'pending', file),\n });\n }\n catch { /* ignore */ }\n }\n }\n catch { /* ignore */ }\n const result = {\n commit_docs: config.commit_docs,\n date: now.toISOString().split('T')[0],\n timestamp: now.toISOString(),\n todo_count: count,\n todos,\n area_filter: area ?? null,\n pending_dir: '.planning/todos/pending',\n completed_dir: '.planning/todos/completed',\n planning_exists: (0, core_js_1.pathExistsInternal)(cwd, '.planning'),\n todos_dir_exists: (0, core_js_1.pathExistsInternal)(cwd, '.planning/todos'),\n pending_dir_exists: (0, core_js_1.pathExistsInternal)(cwd, '.planning/todos/pending'),\n };\n (0, core_js_1.output)(result, raw);\n}\nfunction cmdInitMilestoneOp(cwd, raw) {\n const config = (0, core_js_1.loadConfig)(cwd);\n const milestone = (0, core_js_1.getMilestoneInfo)(cwd);\n let phaseCount = 0;\n let completedPhases = 0;\n const phasesDir = node_path_1.default.join(cwd, '.planning', 'phases');\n try {\n const entries = node_fs_1.default.readdirSync(phasesDir, { withFileTypes: true });\n const dirs = entries.filter(e => e.isDirectory()).map(e => e.name);\n phaseCount = dirs.length;\n for (const dir of dirs) {\n try {\n const phaseFiles = node_fs_1.default.readdirSync(node_path_1.default.join(phasesDir, dir));\n const hasSummary = phaseFiles.some(f => f.endsWith('-SUMMARY.md') || f === 'SUMMARY.md');\n if (hasSummary)\n completedPhases++;\n }\n catch { /* ignore */ }\n }\n }\n catch { /* ignore */ }\n const archiveDir = node_path_1.default.join(cwd, '.planning', 'archive');\n let archivedMilestones = [];\n try {\n archivedMilestones = node_fs_1.default.readdirSync(archiveDir, { withFileTypes: true })\n .filter(e => e.isDirectory())\n .map(e => e.name);\n }\n catch { /* ignore */ }\n const result = {\n commit_docs: config.commit_docs,\n milestone_version: milestone.version,\n milestone_name: milestone.name,\n milestone_slug: (0, core_js_1.generateSlugInternal)(milestone.name),\n phase_count: phaseCount,\n completed_phases: completedPhases,\n all_phases_complete: phaseCount > 0 && phaseCount === completedPhases,\n archived_milestones: archivedMilestones,\n archive_count: archivedMilestones.length,\n project_exists: (0, core_js_1.pathExistsInternal)(cwd, '.planning/PROJECT.md'),\n roadmap_exists: (0, core_js_1.pathExistsInternal)(cwd, '.planning/ROADMAP.md'),\n state_exists: (0, core_js_1.pathExistsInternal)(cwd, '.planning/STATE.md'),\n archive_exists: (0, core_js_1.pathExistsInternal)(cwd, '.planning/archive'),\n phases_dir_exists: (0, core_js_1.pathExistsInternal)(cwd, '.planning/phases'),\n };\n (0, core_js_1.output)(result, raw);\n}\nfunction cmdInitMapCodebase(cwd, raw) {\n const config = (0, core_js_1.loadConfig)(cwd);\n const codebaseDir = node_path_1.default.join(cwd, '.planning', 'codebase');\n let existingMaps = [];\n try {\n existingMaps = node_fs_1.default.readdirSync(codebaseDir).filter(f => f.endsWith('.md'));\n }\n catch { /* ignore */ }\n const result = {\n mapper_model: (0, core_js_1.resolveModelInternal)(cwd, 'maxsim-codebase-mapper'),\n commit_docs: config.commit_docs,\n search_gitignored: config.search_gitignored,\n parallelization: config.parallelization,\n codebase_dir: '.planning/codebase',\n existing_maps: existingMaps,\n has_maps: existingMaps.length > 0,\n planning_exists: (0, core_js_1.pathExistsInternal)(cwd, '.planning'),\n codebase_dir_exists: (0, core_js_1.pathExistsInternal)(cwd, '.planning/codebase'),\n };\n (0, core_js_1.output)(result, raw);\n}\nfunction cmdInitProgress(cwd, raw) {\n const config = (0, core_js_1.loadConfig)(cwd);\n const milestone = (0, core_js_1.getMilestoneInfo)(cwd);\n const phasesDir = node_path_1.default.join(cwd, '.planning', 'phases');\n const phases = [];\n let currentPhase = null;\n let nextPhase = null;\n try {\n const entries = node_fs_1.default.readdirSync(phasesDir, { withFileTypes: true });\n const dirs = entries.filter(e => e.isDirectory()).map(e => e.name).sort();\n for (const dir of dirs) {\n const match = dir.match(/^(\\d+(?:\\.\\d+)?)-?(.*)/);\n const phaseNumber = match ? match[1] : dir;\n const phaseName = match && match[2] ? match[2] : null;\n const phasePath = node_path_1.default.join(phasesDir, dir);\n const phaseFiles = node_fs_1.default.readdirSync(phasePath);\n const plans = phaseFiles.filter(f => f.endsWith('-PLAN.md') || f === 'PLAN.md');\n const summaries = phaseFiles.filter(f => f.endsWith('-SUMMARY.md') || f === 'SUMMARY.md');\n const hasResearch = phaseFiles.some(f => f.endsWith('-RESEARCH.md') || f === 'RESEARCH.md');\n const status = summaries.length >= plans.length && plans.length > 0 ? 'complete' :\n plans.length > 0 ? 'in_progress' :\n hasResearch ? 'researched' : 'pending';\n const phaseInfo = {\n number: phaseNumber,\n name: phaseName,\n directory: node_path_1.default.join('.planning', 'phases', dir),\n status,\n plan_count: plans.length,\n summary_count: summaries.length,\n has_research: hasResearch,\n };\n phases.push(phaseInfo);\n if (!currentPhase && (status === 'in_progress' || status === 'researched')) {\n currentPhase = phaseInfo;\n }\n if (!nextPhase && status === 'pending') {\n nextPhase = phaseInfo;\n }\n }\n }\n catch { /* ignore */ }\n let pausedAt = null;\n try {\n const state = node_fs_1.default.readFileSync(node_path_1.default.join(cwd, '.planning', 'STATE.md'), 'utf-8');\n const pauseMatch = state.match(/\\*\\*Paused At:\\*\\*\\s*(.+)/);\n if (pauseMatch)\n pausedAt = pauseMatch[1].trim();\n }\n catch { /* ignore */ }\n const result = {\n executor_model: (0, core_js_1.resolveModelInternal)(cwd, 'maxsim-executor'),\n planner_model: (0, core_js_1.resolveModelInternal)(cwd, 'maxsim-planner'),\n commit_docs: config.commit_docs,\n milestone_version: milestone.version,\n milestone_name: milestone.name,\n phases,\n phase_count: phases.length,\n completed_count: phases.filter(p => p.status === 'complete').length,\n in_progress_count: phases.filter(p => p.status === 'in_progress').length,\n current_phase: currentPhase,\n next_phase: nextPhase,\n paused_at: pausedAt,\n has_work_in_progress: !!currentPhase,\n project_exists: (0, core_js_1.pathExistsInternal)(cwd, '.planning/PROJECT.md'),\n roadmap_exists: (0, core_js_1.pathExistsInternal)(cwd, '.planning/ROADMAP.md'),\n state_exists: (0, core_js_1.pathExistsInternal)(cwd, '.planning/STATE.md'),\n state_path: '.planning/STATE.md',\n roadmap_path: '.planning/ROADMAP.md',\n project_path: '.planning/PROJECT.md',\n config_path: '.planning/config.json',\n };\n (0, core_js_1.output)(result, raw);\n}\n//# sourceMappingURL=init.js.map","\"use strict\";\n/**\n * @maxsim/core — Shared utilities, constants, and type definitions\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.cmdRoadmapAnalyze = exports.cmdRoadmapGetPhase = exports.cmdStateSnapshot = exports.cmdStateRecordSession = exports.cmdStateResolveBlocker = exports.cmdStateAddBlocker = exports.cmdStateAddDecision = exports.cmdStateUpdateProgress = exports.cmdStateRecordMetric = exports.cmdStateAdvancePlan = exports.cmdStateUpdate = exports.cmdStatePatch = exports.cmdStateGet = exports.cmdStateLoad = exports.stateReplaceField = exports.stateExtractField = exports.cmdConfigGet = exports.cmdConfigSet = exports.cmdConfigEnsureSection = exports.cmdFrontmatterValidate = exports.cmdFrontmatterMerge = exports.cmdFrontmatterSet = exports.cmdFrontmatterGet = exports.FRONTMATTER_SCHEMAS = exports.parseMustHavesBlock = exports.spliceFrontmatter = exports.reconstructFrontmatter = exports.extractFrontmatter = exports.getMilestoneInfo = exports.generateSlugInternal = exports.pathExistsInternal = exports.resolveModelInternal = exports.getRoadmapPhaseInternal = exports.getArchivedPhaseDirs = exports.findPhaseInternal = exports.comparePhaseNum = exports.normalizePhaseName = exports.execGit = exports.isGitIgnored = exports.loadConfig = exports.safeReadFile = exports.error = exports.output = exports.MODEL_PROFILES = exports.PLANNING_CONFIG_DEFAULTS = exports.err = exports.ok = exports.phaseSlug = exports.phasePath = exports.phaseNumber = void 0;\nexports.cmdInitProgress = exports.cmdInitMapCodebase = exports.cmdInitMilestoneOp = exports.cmdInitTodos = exports.cmdInitPhaseOp = exports.cmdInitVerifyWork = exports.cmdInitResume = exports.cmdInitQuick = exports.cmdInitNewMilestone = exports.cmdInitNewProject = exports.cmdInitPlanPhase = exports.cmdInitExecutePhase = exports.cmdTemplateFill = exports.cmdTemplateSelect = exports.cmdPhaseComplete = exports.cmdPhaseRemove = exports.cmdPhaseInsert = exports.cmdPhaseAdd = exports.cmdPhasePlanIndex = exports.cmdFindPhase = exports.cmdPhaseNextDecimal = exports.cmdPhasesList = exports.cmdValidateHealth = exports.cmdValidateConsistency = exports.cmdVerifyKeyLinks = exports.cmdVerifyArtifacts = exports.cmdVerifyCommits = exports.cmdVerifyReferences = exports.cmdVerifyPhaseCompleteness = exports.cmdVerifyPlanStructure = exports.cmdVerifySummary = exports.cmdScaffold = exports.cmdTodoComplete = exports.cmdProgressRender = exports.cmdWebsearch = exports.cmdSummaryExtract = exports.cmdCommit = exports.cmdResolveModel = exports.cmdHistoryDigest = exports.cmdVerifyPathExists = exports.cmdListTodos = exports.cmdCurrentTimestamp = exports.cmdGenerateSlug = exports.cmdMilestoneComplete = exports.cmdRequirementsMarkComplete = exports.cmdRoadmapUpdatePlanProgress = void 0;\n// Runtime value exports from types\nvar types_js_1 = require(\"./types.js\");\nObject.defineProperty(exports, \"phaseNumber\", { enumerable: true, get: function () { return types_js_1.phaseNumber; } });\nObject.defineProperty(exports, \"phasePath\", { enumerable: true, get: function () { return types_js_1.phasePath; } });\nObject.defineProperty(exports, \"phaseSlug\", { enumerable: true, get: function () { return types_js_1.phaseSlug; } });\nObject.defineProperty(exports, \"ok\", { enumerable: true, get: function () { return types_js_1.ok; } });\nObject.defineProperty(exports, \"err\", { enumerable: true, get: function () { return types_js_1.err; } });\nObject.defineProperty(exports, \"PLANNING_CONFIG_DEFAULTS\", { enumerable: true, get: function () { return types_js_1.PLANNING_CONFIG_DEFAULTS; } });\n// Runtime exports from core\nvar core_js_1 = require(\"./core.js\");\nObject.defineProperty(exports, \"MODEL_PROFILES\", { enumerable: true, get: function () { return core_js_1.MODEL_PROFILES; } });\nObject.defineProperty(exports, \"output\", { enumerable: true, get: function () { return core_js_1.output; } });\nObject.defineProperty(exports, \"error\", { enumerable: true, get: function () { return core_js_1.error; } });\nObject.defineProperty(exports, \"safeReadFile\", { enumerable: true, get: function () { return core_js_1.safeReadFile; } });\nObject.defineProperty(exports, \"loadConfig\", { enumerable: true, get: function () { return core_js_1.loadConfig; } });\nObject.defineProperty(exports, \"isGitIgnored\", { enumerable: true, get: function () { return core_js_1.isGitIgnored; } });\nObject.defineProperty(exports, \"execGit\", { enumerable: true, get: function () { return core_js_1.execGit; } });\nObject.defineProperty(exports, \"normalizePhaseName\", { enumerable: true, get: function () { return core_js_1.normalizePhaseName; } });\nObject.defineProperty(exports, \"comparePhaseNum\", { enumerable: true, get: function () { return core_js_1.comparePhaseNum; } });\nObject.defineProperty(exports, \"findPhaseInternal\", { enumerable: true, get: function () { return core_js_1.findPhaseInternal; } });\nObject.defineProperty(exports, \"getArchivedPhaseDirs\", { enumerable: true, get: function () { return core_js_1.getArchivedPhaseDirs; } });\nObject.defineProperty(exports, \"getRoadmapPhaseInternal\", { enumerable: true, get: function () { return core_js_1.getRoadmapPhaseInternal; } });\nObject.defineProperty(exports, \"resolveModelInternal\", { enumerable: true, get: function () { return core_js_1.resolveModelInternal; } });\nObject.defineProperty(exports, \"pathExistsInternal\", { enumerable: true, get: function () { return core_js_1.pathExistsInternal; } });\nObject.defineProperty(exports, \"generateSlugInternal\", { enumerable: true, get: function () { return core_js_1.generateSlugInternal; } });\nObject.defineProperty(exports, \"getMilestoneInfo\", { enumerable: true, get: function () { return core_js_1.getMilestoneInfo; } });\n// Frontmatter exports\nvar frontmatter_js_1 = require(\"./frontmatter.js\");\nObject.defineProperty(exports, \"extractFrontmatter\", { enumerable: true, get: function () { return frontmatter_js_1.extractFrontmatter; } });\nObject.defineProperty(exports, \"reconstructFrontmatter\", { enumerable: true, get: function () { return frontmatter_js_1.reconstructFrontmatter; } });\nObject.defineProperty(exports, \"spliceFrontmatter\", { enumerable: true, get: function () { return frontmatter_js_1.spliceFrontmatter; } });\nObject.defineProperty(exports, \"parseMustHavesBlock\", { enumerable: true, get: function () { return frontmatter_js_1.parseMustHavesBlock; } });\nObject.defineProperty(exports, \"FRONTMATTER_SCHEMAS\", { enumerable: true, get: function () { return frontmatter_js_1.FRONTMATTER_SCHEMAS; } });\nObject.defineProperty(exports, \"cmdFrontmatterGet\", { enumerable: true, get: function () { return frontmatter_js_1.cmdFrontmatterGet; } });\nObject.defineProperty(exports, \"cmdFrontmatterSet\", { enumerable: true, get: function () { return frontmatter_js_1.cmdFrontmatterSet; } });\nObject.defineProperty(exports, \"cmdFrontmatterMerge\", { enumerable: true, get: function () { return frontmatter_js_1.cmdFrontmatterMerge; } });\nObject.defineProperty(exports, \"cmdFrontmatterValidate\", { enumerable: true, get: function () { return frontmatter_js_1.cmdFrontmatterValidate; } });\n// Config exports\nvar config_js_1 = require(\"./config.js\");\nObject.defineProperty(exports, \"cmdConfigEnsureSection\", { enumerable: true, get: function () { return config_js_1.cmdConfigEnsureSection; } });\nObject.defineProperty(exports, \"cmdConfigSet\", { enumerable: true, get: function () { return config_js_1.cmdConfigSet; } });\nObject.defineProperty(exports, \"cmdConfigGet\", { enumerable: true, get: function () { return config_js_1.cmdConfigGet; } });\n// State exports\nvar state_js_1 = require(\"./state.js\");\nObject.defineProperty(exports, \"stateExtractField\", { enumerable: true, get: function () { return state_js_1.stateExtractField; } });\nObject.defineProperty(exports, \"stateReplaceField\", { enumerable: true, get: function () { return state_js_1.stateReplaceField; } });\nObject.defineProperty(exports, \"cmdStateLoad\", { enumerable: true, get: function () { return state_js_1.cmdStateLoad; } });\nObject.defineProperty(exports, \"cmdStateGet\", { enumerable: true, get: function () { return state_js_1.cmdStateGet; } });\nObject.defineProperty(exports, \"cmdStatePatch\", { enumerable: true, get: function () { return state_js_1.cmdStatePatch; } });\nObject.defineProperty(exports, \"cmdStateUpdate\", { enumerable: true, get: function () { return state_js_1.cmdStateUpdate; } });\nObject.defineProperty(exports, \"cmdStateAdvancePlan\", { enumerable: true, get: function () { return state_js_1.cmdStateAdvancePlan; } });\nObject.defineProperty(exports, \"cmdStateRecordMetric\", { enumerable: true, get: function () { return state_js_1.cmdStateRecordMetric; } });\nObject.defineProperty(exports, \"cmdStateUpdateProgress\", { enumerable: true, get: function () { return state_js_1.cmdStateUpdateProgress; } });\nObject.defineProperty(exports, \"cmdStateAddDecision\", { enumerable: true, get: function () { return state_js_1.cmdStateAddDecision; } });\nObject.defineProperty(exports, \"cmdStateAddBlocker\", { enumerable: true, get: function () { return state_js_1.cmdStateAddBlocker; } });\nObject.defineProperty(exports, \"cmdStateResolveBlocker\", { enumerable: true, get: function () { return state_js_1.cmdStateResolveBlocker; } });\nObject.defineProperty(exports, \"cmdStateRecordSession\", { enumerable: true, get: function () { return state_js_1.cmdStateRecordSession; } });\nObject.defineProperty(exports, \"cmdStateSnapshot\", { enumerable: true, get: function () { return state_js_1.cmdStateSnapshot; } });\n// Roadmap exports\nvar roadmap_js_1 = require(\"./roadmap.js\");\nObject.defineProperty(exports, \"cmdRoadmapGetPhase\", { enumerable: true, get: function () { return roadmap_js_1.cmdRoadmapGetPhase; } });\nObject.defineProperty(exports, \"cmdRoadmapAnalyze\", { enumerable: true, get: function () { return roadmap_js_1.cmdRoadmapAnalyze; } });\nObject.defineProperty(exports, \"cmdRoadmapUpdatePlanProgress\", { enumerable: true, get: function () { return roadmap_js_1.cmdRoadmapUpdatePlanProgress; } });\n// Milestone exports\nvar milestone_js_1 = require(\"./milestone.js\");\nObject.defineProperty(exports, \"cmdRequirementsMarkComplete\", { enumerable: true, get: function () { return milestone_js_1.cmdRequirementsMarkComplete; } });\nObject.defineProperty(exports, \"cmdMilestoneComplete\", { enumerable: true, get: function () { return milestone_js_1.cmdMilestoneComplete; } });\n// Commands exports\nvar commands_js_1 = require(\"./commands.js\");\nObject.defineProperty(exports, \"cmdGenerateSlug\", { enumerable: true, get: function () { return commands_js_1.cmdGenerateSlug; } });\nObject.defineProperty(exports, \"cmdCurrentTimestamp\", { enumerable: true, get: function () { return commands_js_1.cmdCurrentTimestamp; } });\nObject.defineProperty(exports, \"cmdListTodos\", { enumerable: true, get: function () { return commands_js_1.cmdListTodos; } });\nObject.defineProperty(exports, \"cmdVerifyPathExists\", { enumerable: true, get: function () { return commands_js_1.cmdVerifyPathExists; } });\nObject.defineProperty(exports, \"cmdHistoryDigest\", { enumerable: true, get: function () { return commands_js_1.cmdHistoryDigest; } });\nObject.defineProperty(exports, \"cmdResolveModel\", { enumerable: true, get: function () { return commands_js_1.cmdResolveModel; } });\nObject.defineProperty(exports, \"cmdCommit\", { enumerable: true, get: function () { return commands_js_1.cmdCommit; } });\nObject.defineProperty(exports, \"cmdSummaryExtract\", { enumerable: true, get: function () { return commands_js_1.cmdSummaryExtract; } });\nObject.defineProperty(exports, \"cmdWebsearch\", { enumerable: true, get: function () { return commands_js_1.cmdWebsearch; } });\nObject.defineProperty(exports, \"cmdProgressRender\", { enumerable: true, get: function () { return commands_js_1.cmdProgressRender; } });\nObject.defineProperty(exports, \"cmdTodoComplete\", { enumerable: true, get: function () { return commands_js_1.cmdTodoComplete; } });\nObject.defineProperty(exports, \"cmdScaffold\", { enumerable: true, get: function () { return commands_js_1.cmdScaffold; } });\nvar verify_js_1 = require(\"./verify.js\");\nObject.defineProperty(exports, \"cmdVerifySummary\", { enumerable: true, get: function () { return verify_js_1.cmdVerifySummary; } });\nObject.defineProperty(exports, \"cmdVerifyPlanStructure\", { enumerable: true, get: function () { return verify_js_1.cmdVerifyPlanStructure; } });\nObject.defineProperty(exports, \"cmdVerifyPhaseCompleteness\", { enumerable: true, get: function () { return verify_js_1.cmdVerifyPhaseCompleteness; } });\nObject.defineProperty(exports, \"cmdVerifyReferences\", { enumerable: true, get: function () { return verify_js_1.cmdVerifyReferences; } });\nObject.defineProperty(exports, \"cmdVerifyCommits\", { enumerable: true, get: function () { return verify_js_1.cmdVerifyCommits; } });\nObject.defineProperty(exports, \"cmdVerifyArtifacts\", { enumerable: true, get: function () { return verify_js_1.cmdVerifyArtifacts; } });\nObject.defineProperty(exports, \"cmdVerifyKeyLinks\", { enumerable: true, get: function () { return verify_js_1.cmdVerifyKeyLinks; } });\nObject.defineProperty(exports, \"cmdValidateConsistency\", { enumerable: true, get: function () { return verify_js_1.cmdValidateConsistency; } });\nObject.defineProperty(exports, \"cmdValidateHealth\", { enumerable: true, get: function () { return verify_js_1.cmdValidateHealth; } });\n// Phase exports\nvar phase_js_1 = require(\"./phase.js\");\nObject.defineProperty(exports, \"cmdPhasesList\", { enumerable: true, get: function () { return phase_js_1.cmdPhasesList; } });\nObject.defineProperty(exports, \"cmdPhaseNextDecimal\", { enumerable: true, get: function () { return phase_js_1.cmdPhaseNextDecimal; } });\nObject.defineProperty(exports, \"cmdFindPhase\", { enumerable: true, get: function () { return phase_js_1.cmdFindPhase; } });\nObject.defineProperty(exports, \"cmdPhasePlanIndex\", { enumerable: true, get: function () { return phase_js_1.cmdPhasePlanIndex; } });\nObject.defineProperty(exports, \"cmdPhaseAdd\", { enumerable: true, get: function () { return phase_js_1.cmdPhaseAdd; } });\nObject.defineProperty(exports, \"cmdPhaseInsert\", { enumerable: true, get: function () { return phase_js_1.cmdPhaseInsert; } });\nObject.defineProperty(exports, \"cmdPhaseRemove\", { enumerable: true, get: function () { return phase_js_1.cmdPhaseRemove; } });\nObject.defineProperty(exports, \"cmdPhaseComplete\", { enumerable: true, get: function () { return phase_js_1.cmdPhaseComplete; } });\nvar template_js_1 = require(\"./template.js\");\nObject.defineProperty(exports, \"cmdTemplateSelect\", { enumerable: true, get: function () { return template_js_1.cmdTemplateSelect; } });\nObject.defineProperty(exports, \"cmdTemplateFill\", { enumerable: true, get: function () { return template_js_1.cmdTemplateFill; } });\nvar init_js_1 = require(\"./init.js\");\nObject.defineProperty(exports, \"cmdInitExecutePhase\", { enumerable: true, get: function () { return init_js_1.cmdInitExecutePhase; } });\nObject.defineProperty(exports, \"cmdInitPlanPhase\", { enumerable: true, get: function () { return init_js_1.cmdInitPlanPhase; } });\nObject.defineProperty(exports, \"cmdInitNewProject\", { enumerable: true, get: function () { return init_js_1.cmdInitNewProject; } });\nObject.defineProperty(exports, \"cmdInitNewMilestone\", { enumerable: true, get: function () { return init_js_1.cmdInitNewMilestone; } });\nObject.defineProperty(exports, \"cmdInitQuick\", { enumerable: true, get: function () { return init_js_1.cmdInitQuick; } });\nObject.defineProperty(exports, \"cmdInitResume\", { enumerable: true, get: function () { return init_js_1.cmdInitResume; } });\nObject.defineProperty(exports, \"cmdInitVerifyWork\", { enumerable: true, get: function () { return init_js_1.cmdInitVerifyWork; } });\nObject.defineProperty(exports, \"cmdInitPhaseOp\", { enumerable: true, get: function () { return init_js_1.cmdInitPhaseOp; } });\nObject.defineProperty(exports, \"cmdInitTodos\", { enumerable: true, get: function () { return init_js_1.cmdInitTodos; } });\nObject.defineProperty(exports, \"cmdInitMilestoneOp\", { enumerable: true, get: function () { return init_js_1.cmdInitMilestoneOp; } });\nObject.defineProperty(exports, \"cmdInitMapCodebase\", { enumerable: true, get: function () { return init_js_1.cmdInitMapCodebase; } });\nObject.defineProperty(exports, \"cmdInitProgress\", { enumerable: true, get: function () { return init_js_1.cmdInitProgress; } });\n//# sourceMappingURL=index.js.map","/**\n * MAXSIM Tools — CLI utility for MAXSIM workflow operations\n *\n * Replaces repetitive inline bash patterns across ~50 MAXSIM command/workflow/agent files.\n * Centralizes: config parsing, model resolution, phase lookup, git commits, summary verification.\n *\n * Usage: node maxsim-tools.cjs <command> [args] [--raw]\n *\n * This is a direct TypeScript port of maxsim/bin/maxsim-tools.cjs.\n * All imports resolve through @maxsim/core barrel export.\n */\n\nimport * as fs from 'node:fs';\nimport * as path from 'node:path';\n\nimport type { TimestampFormat } from '@maxsim/core';\n\nimport {\n // Core\n error,\n // Frontmatter\n extractFrontmatter,\n reconstructFrontmatter,\n spliceFrontmatter,\n parseMustHavesBlock,\n FRONTMATTER_SCHEMAS,\n cmdFrontmatterGet,\n cmdFrontmatterSet,\n cmdFrontmatterMerge,\n cmdFrontmatterValidate,\n // Config\n cmdConfigEnsureSection,\n cmdConfigSet,\n cmdConfigGet,\n // Commands\n cmdGenerateSlug,\n cmdCurrentTimestamp,\n cmdListTodos,\n cmdVerifyPathExists,\n cmdHistoryDigest,\n cmdResolveModel,\n cmdCommit,\n cmdSummaryExtract,\n cmdWebsearch,\n cmdProgressRender,\n cmdTodoComplete,\n cmdScaffold,\n // State\n cmdStateLoad,\n cmdStateGet,\n cmdStatePatch,\n cmdStateUpdate,\n cmdStateAdvancePlan,\n cmdStateRecordMetric,\n cmdStateUpdateProgress,\n cmdStateAddDecision,\n cmdStateAddBlocker,\n cmdStateResolveBlocker,\n cmdStateRecordSession,\n cmdStateSnapshot,\n stateExtractField,\n stateReplaceField,\n // Roadmap\n cmdRoadmapGetPhase,\n cmdRoadmapAnalyze,\n cmdRoadmapUpdatePlanProgress,\n // Milestone\n cmdRequirementsMarkComplete,\n cmdMilestoneComplete,\n // Verify\n cmdVerifySummary,\n cmdVerifyPlanStructure,\n cmdVerifyPhaseCompleteness,\n cmdVerifyReferences,\n cmdVerifyCommits,\n cmdVerifyArtifacts,\n cmdVerifyKeyLinks,\n cmdValidateConsistency,\n cmdValidateHealth,\n // Phase\n cmdPhasesList,\n cmdPhaseNextDecimal,\n cmdFindPhase,\n cmdPhasePlanIndex,\n cmdPhaseAdd,\n cmdPhaseInsert,\n cmdPhaseRemove,\n cmdPhaseComplete,\n // Template\n cmdTemplateSelect,\n cmdTemplateFill,\n // Init\n cmdInitExecutePhase,\n cmdInitPlanPhase,\n cmdInitNewProject,\n cmdInitNewMilestone,\n cmdInitQuick,\n cmdInitResume,\n cmdInitVerifyWork,\n cmdInitPhaseOp,\n cmdInitTodos,\n cmdInitMilestoneOp,\n cmdInitMapCodebase,\n cmdInitProgress,\n} from '@maxsim/core';\n\n/** Helper: extract a named flag's value from args, returning null if absent */\nfunction getFlag(args: string[], flag: string): string | null {\n const idx = args.indexOf(flag);\n return idx !== -1 ? args[idx + 1] : null;\n}\n\n// Namespace groupings for readability (mirrors original CJS structure)\nconst state = { cmdStateLoad, cmdStateGet, cmdStatePatch, cmdStateUpdate, cmdStateAdvancePlan, cmdStateRecordMetric, cmdStateUpdateProgress, cmdStateAddDecision, cmdStateAddBlocker, cmdStateResolveBlocker, cmdStateRecordSession, cmdStateSnapshot, stateExtractField, stateReplaceField };\nconst phase = { cmdPhasesList, cmdPhaseNextDecimal, cmdFindPhase, cmdPhasePlanIndex, cmdPhaseAdd, cmdPhaseInsert, cmdPhaseRemove, cmdPhaseComplete };\nconst roadmap = { cmdRoadmapGetPhase, cmdRoadmapAnalyze, cmdRoadmapUpdatePlanProgress };\nconst verify = { cmdVerifySummary, cmdVerifyPlanStructure, cmdVerifyPhaseCompleteness, cmdVerifyReferences, cmdVerifyCommits, cmdVerifyArtifacts, cmdVerifyKeyLinks, cmdValidateConsistency, cmdValidateHealth };\nconst config = { cmdConfigEnsureSection, cmdConfigSet, cmdConfigGet };\nconst template = { cmdTemplateSelect, cmdTemplateFill };\nconst milestone = { cmdRequirementsMarkComplete, cmdMilestoneComplete };\nconst commands = { cmdGenerateSlug, cmdCurrentTimestamp, cmdListTodos, cmdVerifyPathExists, cmdHistoryDigest, cmdResolveModel, cmdCommit, cmdSummaryExtract, cmdWebsearch, cmdProgressRender, cmdTodoComplete, cmdScaffold };\nconst init = { cmdInitExecutePhase, cmdInitPlanPhase, cmdInitNewProject, cmdInitNewMilestone, cmdInitQuick, cmdInitResume, cmdInitVerifyWork, cmdInitPhaseOp, cmdInitTodos, cmdInitMilestoneOp, cmdInitMapCodebase, cmdInitProgress };\nconst frontmatter = { cmdFrontmatterGet, cmdFrontmatterSet, cmdFrontmatterMerge, cmdFrontmatterValidate, extractFrontmatter, reconstructFrontmatter, spliceFrontmatter, parseMustHavesBlock, FRONTMATTER_SCHEMAS };\n\n// ─── CLI Router ───────────────────────────────────────────────────────────────\n\nasync function main(): Promise<void> {\n const args: string[] = process.argv.slice(2);\n\n // Optional cwd override for sandboxed subagents running outside project root.\n let cwd: string = process.cwd();\n const cwdEqArg = args.find(arg => arg.startsWith('--cwd='));\n const cwdIdx = args.indexOf('--cwd');\n if (cwdEqArg) {\n const value = cwdEqArg.slice('--cwd='.length).trim();\n if (!value) error('Missing value for --cwd');\n args.splice(args.indexOf(cwdEqArg), 1);\n cwd = path.resolve(value);\n } else if (cwdIdx !== -1) {\n const value = args[cwdIdx + 1];\n if (!value || value.startsWith('--')) error('Missing value for --cwd');\n args.splice(cwdIdx, 2);\n cwd = path.resolve(value);\n }\n\n if (!fs.existsSync(cwd) || !fs.statSync(cwd).isDirectory()) {\n error(`Invalid --cwd: ${cwd}`);\n }\n\n const rawIndex = args.indexOf('--raw');\n const raw: boolean = rawIndex !== -1;\n if (rawIndex !== -1) args.splice(rawIndex, 1);\n\n const command: string | undefined = args[0];\n\n if (!command) {\n error('Usage: maxsim-tools <command> [args] [--raw] [--cwd <path>]\\nCommands: state, resolve-model, find-phase, commit, verify-summary, verify, frontmatter, template, generate-slug, current-timestamp, list-todos, verify-path-exists, config-ensure-section, init');\n }\n\n switch (command) {\n case 'state': {\n const subcommand: string | undefined = args[1];\n if (subcommand === 'update') {\n state.cmdStateUpdate(cwd, args[2], args[3]);\n } else if (subcommand === 'get') {\n state.cmdStateGet(cwd, args[2], raw);\n } else if (subcommand === 'patch') {\n const patches: Record<string, string> = {};\n for (let i = 2; i < args.length; i += 2) {\n const key = args[i].replace(/^--/, '');\n const value = args[i + 1];\n if (key && value !== undefined) {\n patches[key] = value;\n }\n }\n state.cmdStatePatch(cwd, patches, raw);\n } else if (subcommand === 'advance-plan') {\n state.cmdStateAdvancePlan(cwd, raw);\n } else if (subcommand === 'record-metric') {\n const phaseIdx = args.indexOf('--phase');\n const planIdx = args.indexOf('--plan');\n const durationIdx = args.indexOf('--duration');\n const tasksIdx = args.indexOf('--tasks');\n const filesIdx = args.indexOf('--files');\n state.cmdStateRecordMetric(cwd, {\n phase: phaseIdx !== -1 ? args[phaseIdx + 1] : '',\n plan: planIdx !== -1 ? args[planIdx + 1] : '',\n duration: durationIdx !== -1 ? args[durationIdx + 1] : '',\n tasks: tasksIdx !== -1 ? args[tasksIdx + 1] : undefined,\n files: filesIdx !== -1 ? args[filesIdx + 1] : undefined,\n }, raw);\n } else if (subcommand === 'update-progress') {\n state.cmdStateUpdateProgress(cwd, raw);\n } else if (subcommand === 'add-decision') {\n const phaseIdx = args.indexOf('--phase');\n const summaryIdx = args.indexOf('--summary');\n const summaryFileIdx = args.indexOf('--summary-file');\n const rationaleIdx = args.indexOf('--rationale');\n const rationaleFileIdx = args.indexOf('--rationale-file');\n state.cmdStateAddDecision(cwd, {\n phase: phaseIdx !== -1 ? args[phaseIdx + 1] : undefined,\n summary: summaryIdx !== -1 ? args[summaryIdx + 1] : undefined,\n summary_file: summaryFileIdx !== -1 ? args[summaryFileIdx + 1] : undefined,\n rationale: rationaleIdx !== -1 ? args[rationaleIdx + 1] : '',\n rationale_file: rationaleFileIdx !== -1 ? args[rationaleFileIdx + 1] : undefined,\n }, raw);\n } else if (subcommand === 'add-blocker') {\n const textIdx = args.indexOf('--text');\n const textFileIdx = args.indexOf('--text-file');\n state.cmdStateAddBlocker(cwd, {\n text: textIdx !== -1 ? args[textIdx + 1] : undefined,\n text_file: textFileIdx !== -1 ? args[textFileIdx + 1] : undefined,\n }, raw);\n } else if (subcommand === 'resolve-blocker') {\n const textIdx = args.indexOf('--text');\n state.cmdStateResolveBlocker(cwd, textIdx !== -1 ? args[textIdx + 1] : null, raw);\n } else if (subcommand === 'record-session') {\n const stoppedIdx = args.indexOf('--stopped-at');\n const resumeIdx = args.indexOf('--resume-file');\n state.cmdStateRecordSession(cwd, {\n stopped_at: stoppedIdx !== -1 ? args[stoppedIdx + 1] : undefined,\n resume_file: resumeIdx !== -1 ? args[resumeIdx + 1] : 'None',\n }, raw);\n } else {\n state.cmdStateLoad(cwd, raw);\n }\n break;\n }\n\n case 'resolve-model': {\n commands.cmdResolveModel(cwd, args[1], raw);\n break;\n }\n\n case 'find-phase': {\n phase.cmdFindPhase(cwd, args[1], raw);\n break;\n }\n\n case 'commit': {\n const amend: boolean = args.includes('--amend');\n const message: string = args[1];\n // Parse --files flag (collect args after --files, stopping at other flags)\n const filesIndex = args.indexOf('--files');\n const files: string[] = filesIndex !== -1 ? args.slice(filesIndex + 1).filter(a => !a.startsWith('--')) : [];\n commands.cmdCommit(cwd, message, files, raw, amend);\n break;\n }\n\n case 'verify-summary': {\n const summaryPath: string = args[1];\n const countIndex = args.indexOf('--check-count');\n const checkCount: number = countIndex !== -1 ? parseInt(args[countIndex + 1], 10) : 2;\n verify.cmdVerifySummary(cwd, summaryPath, checkCount, raw);\n break;\n }\n\n case 'template': {\n const subcommand: string | undefined = args[1];\n if (subcommand === 'select') {\n template.cmdTemplateSelect(cwd, args[2], raw);\n } else if (subcommand === 'fill') {\n const templateType: string = args[2];\n const phaseIdx = args.indexOf('--phase');\n const planIdx = args.indexOf('--plan');\n const nameIdx = args.indexOf('--name');\n const typeIdx = args.indexOf('--type');\n const waveIdx = args.indexOf('--wave');\n const fieldsIdx = args.indexOf('--fields');\n template.cmdTemplateFill(cwd, templateType, {\n phase: phaseIdx !== -1 ? args[phaseIdx + 1] : '',\n plan: planIdx !== -1 ? args[planIdx + 1] : undefined,\n name: nameIdx !== -1 ? args[nameIdx + 1] : undefined,\n type: typeIdx !== -1 ? args[typeIdx + 1] : 'execute',\n wave: waveIdx !== -1 ? args[waveIdx + 1] : '1',\n fields: fieldsIdx !== -1 ? JSON.parse(args[fieldsIdx + 1]) : {},\n }, raw);\n } else {\n error('Unknown template subcommand. Available: select, fill');\n }\n break;\n }\n\n case 'frontmatter': {\n const subcommand: string | undefined = args[1];\n const file: string = args[2];\n if (subcommand === 'get') {\n const fieldIdx = args.indexOf('--field');\n frontmatter.cmdFrontmatterGet(cwd, file, getFlag(args, '--field'), raw);\n } else if (subcommand === 'set') {\n frontmatter.cmdFrontmatterSet(cwd, file, getFlag(args, '--field'), getFlag(args, '--value') ?? undefined, raw);\n } else if (subcommand === 'merge') {\n frontmatter.cmdFrontmatterMerge(cwd, file, getFlag(args, '--data'), raw);\n } else if (subcommand === 'validate') {\n frontmatter.cmdFrontmatterValidate(cwd, file, getFlag(args, '--schema'), raw);\n } else {\n error('Unknown frontmatter subcommand. Available: get, set, merge, validate');\n }\n break;\n }\n\n case 'verify': {\n const subcommand: string | undefined = args[1];\n if (subcommand === 'plan-structure') {\n verify.cmdVerifyPlanStructure(cwd, args[2], raw);\n } else if (subcommand === 'phase-completeness') {\n verify.cmdVerifyPhaseCompleteness(cwd, args[2], raw);\n } else if (subcommand === 'references') {\n verify.cmdVerifyReferences(cwd, args[2], raw);\n } else if (subcommand === 'commits') {\n verify.cmdVerifyCommits(cwd, args.slice(2), raw);\n } else if (subcommand === 'artifacts') {\n verify.cmdVerifyArtifacts(cwd, args[2], raw);\n } else if (subcommand === 'key-links') {\n verify.cmdVerifyKeyLinks(cwd, args[2], raw);\n } else {\n error('Unknown verify subcommand. Available: plan-structure, phase-completeness, references, commits, artifacts, key-links');\n }\n break;\n }\n\n case 'generate-slug': {\n commands.cmdGenerateSlug(args[1], raw);\n break;\n }\n\n case 'current-timestamp': {\n commands.cmdCurrentTimestamp((args[1] || 'full') as TimestampFormat, raw);\n break;\n }\n\n case 'list-todos': {\n commands.cmdListTodos(cwd, args[1], raw);\n break;\n }\n\n case 'verify-path-exists': {\n commands.cmdVerifyPathExists(cwd, args[1], raw);\n break;\n }\n\n case 'config-ensure-section': {\n config.cmdConfigEnsureSection(cwd, raw);\n break;\n }\n\n case 'config-set': {\n config.cmdConfigSet(cwd, args[1], args[2], raw);\n break;\n }\n\n case 'config-get': {\n config.cmdConfigGet(cwd, args[1], raw);\n break;\n }\n\n case 'history-digest': {\n commands.cmdHistoryDigest(cwd, raw);\n break;\n }\n\n case 'phases': {\n const subcommand: string | undefined = args[1];\n if (subcommand === 'list') {\n const typeIndex = args.indexOf('--type');\n const phaseIndex = args.indexOf('--phase');\n const options = {\n type: typeIndex !== -1 ? args[typeIndex + 1] : null,\n phase: phaseIndex !== -1 ? args[phaseIndex + 1] : null,\n includeArchived: args.includes('--include-archived'),\n };\n phase.cmdPhasesList(cwd, options, raw);\n } else {\n error('Unknown phases subcommand. Available: list');\n }\n break;\n }\n\n case 'roadmap': {\n const subcommand: string | undefined = args[1];\n if (subcommand === 'get-phase') {\n roadmap.cmdRoadmapGetPhase(cwd, args[2], raw);\n } else if (subcommand === 'analyze') {\n roadmap.cmdRoadmapAnalyze(cwd, raw);\n } else if (subcommand === 'update-plan-progress') {\n roadmap.cmdRoadmapUpdatePlanProgress(cwd, args[2], raw);\n } else {\n error('Unknown roadmap subcommand. Available: get-phase, analyze, update-plan-progress');\n }\n break;\n }\n\n case 'requirements': {\n const subcommand: string | undefined = args[1];\n if (subcommand === 'mark-complete') {\n milestone.cmdRequirementsMarkComplete(cwd, args.slice(2), raw);\n } else {\n error('Unknown requirements subcommand. Available: mark-complete');\n }\n break;\n }\n\n case 'phase': {\n const subcommand: string | undefined = args[1];\n if (subcommand === 'next-decimal') {\n phase.cmdPhaseNextDecimal(cwd, args[2], raw);\n } else if (subcommand === 'add') {\n phase.cmdPhaseAdd(cwd, args.slice(2).join(' '), raw);\n } else if (subcommand === 'insert') {\n phase.cmdPhaseInsert(cwd, args[2], args.slice(3).join(' '), raw);\n } else if (subcommand === 'remove') {\n const forceFlag: boolean = args.includes('--force');\n phase.cmdPhaseRemove(cwd, args[2], { force: forceFlag }, raw);\n } else if (subcommand === 'complete') {\n phase.cmdPhaseComplete(cwd, args[2], raw);\n } else {\n error('Unknown phase subcommand. Available: next-decimal, add, insert, remove, complete');\n }\n break;\n }\n\n case 'milestone': {\n const subcommand: string | undefined = args[1];\n if (subcommand === 'complete') {\n const nameIndex = args.indexOf('--name');\n const archivePhases: boolean = args.includes('--archive-phases');\n // Collect --name value (everything after --name until next flag or end)\n let milestoneName: string | null = null;\n if (nameIndex !== -1) {\n const nameArgs: string[] = [];\n for (let i = nameIndex + 1; i < args.length; i++) {\n if (args[i].startsWith('--')) break;\n nameArgs.push(args[i]);\n }\n milestoneName = nameArgs.join(' ') || null;\n }\n milestone.cmdMilestoneComplete(cwd, args[2], { name: milestoneName ?? undefined, archivePhases }, raw);\n } else {\n error('Unknown milestone subcommand. Available: complete');\n }\n break;\n }\n\n case 'validate': {\n const subcommand: string | undefined = args[1];\n if (subcommand === 'consistency') {\n verify.cmdValidateConsistency(cwd, raw);\n } else if (subcommand === 'health') {\n const repairFlag: boolean = args.includes('--repair');\n verify.cmdValidateHealth(cwd, { repair: repairFlag }, raw);\n } else {\n error('Unknown validate subcommand. Available: consistency, health');\n }\n break;\n }\n\n case 'progress': {\n const subcommand: string = args[1] || 'json';\n commands.cmdProgressRender(cwd, subcommand, raw);\n break;\n }\n\n case 'todo': {\n const subcommand: string | undefined = args[1];\n if (subcommand === 'complete') {\n commands.cmdTodoComplete(cwd, args[2], raw);\n } else {\n error('Unknown todo subcommand. Available: complete');\n }\n break;\n }\n\n case 'scaffold': {\n const scaffoldType: string = args[1];\n const phaseIndex = args.indexOf('--phase');\n const nameIndex = args.indexOf('--name');\n const scaffoldOptions = {\n phase: phaseIndex !== -1 ? args[phaseIndex + 1] : null,\n name: nameIndex !== -1 ? args.slice(nameIndex + 1).join(' ') : null,\n };\n commands.cmdScaffold(cwd, scaffoldType, scaffoldOptions, raw);\n break;\n }\n\n case 'init': {\n const workflow: string | undefined = args[1];\n switch (workflow) {\n case 'execute-phase':\n init.cmdInitExecutePhase(cwd, args[2], raw);\n break;\n case 'plan-phase':\n init.cmdInitPlanPhase(cwd, args[2], raw);\n break;\n case 'new-project':\n init.cmdInitNewProject(cwd, raw);\n break;\n case 'new-milestone':\n init.cmdInitNewMilestone(cwd, raw);\n break;\n case 'quick':\n init.cmdInitQuick(cwd, args.slice(2).join(' '), raw);\n break;\n case 'resume':\n init.cmdInitResume(cwd, raw);\n break;\n case 'verify-work':\n init.cmdInitVerifyWork(cwd, args[2], raw);\n break;\n case 'phase-op':\n init.cmdInitPhaseOp(cwd, args[2], raw);\n break;\n case 'todos':\n init.cmdInitTodos(cwd, args[2], raw);\n break;\n case 'milestone-op':\n init.cmdInitMilestoneOp(cwd, raw);\n break;\n case 'map-codebase':\n init.cmdInitMapCodebase(cwd, raw);\n break;\n case 'progress':\n init.cmdInitProgress(cwd, raw);\n break;\n default:\n error(`Unknown init workflow: ${workflow}\\nAvailable: execute-phase, plan-phase, new-project, new-milestone, quick, resume, verify-work, phase-op, todos, milestone-op, map-codebase, progress`);\n }\n break;\n }\n\n case 'phase-plan-index': {\n phase.cmdPhasePlanIndex(cwd, args[1], raw);\n break;\n }\n\n case 'state-snapshot': {\n state.cmdStateSnapshot(cwd, raw);\n break;\n }\n\n case 'summary-extract': {\n const summaryPath: string = args[1];\n const fieldsIndex = args.indexOf('--fields');\n const fields: string[] | null = fieldsIndex !== -1 ? args[fieldsIndex + 1].split(',') : null;\n commands.cmdSummaryExtract(cwd, summaryPath, fields, raw);\n break;\n }\n\n case 'websearch': {\n const query: string = args[1];\n const limitIdx = args.indexOf('--limit');\n const freshnessIdx = args.indexOf('--freshness');\n await commands.cmdWebsearch(query, {\n limit: limitIdx !== -1 ? parseInt(args[limitIdx + 1], 10) : 10,\n freshness: freshnessIdx !== -1 ? args[freshnessIdx + 1] : undefined,\n }, raw);\n break;\n }\n\n default:\n error(`Unknown command: ${command}`);\n }\n}\n\nmain();\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,QAAO,eAAe,SAAS,cAAc,EAAE,OAAO,MAAM,CAAC;AAC7D,SAAQ,2BAA2B,KAAK;AACxC,SAAQ,cAAc;AACtB,SAAQ,YAAY;AACpB,SAAQ,YAAY;AACpB,SAAQ,KAAK;AACb,SAAQ,MAAM;CACd,SAAS,YAAY,OAAO;AAExB,MAAI,CADU,MAAM,MAAM,uBAAuB,CAE7C,OAAM,IAAI,MAAM,yBAAyB,QAAQ;AAErD,SAAO;;CAEX,SAAS,UAAU,OAAO;AACtB,MAAI,CAAC,SAAS,OAAO,UAAU,SAC3B,OAAM,IAAI,MAAM,uBAAuB,QAAQ;AAEnD,SAAO;;CAEX,SAAS,UAAU,OAAO;AACtB,MAAI,CAAC,SAAS,OAAO,UAAU,SAC3B,OAAM,IAAI,MAAM,uBAAuB,QAAQ;AAEnD,SAAO;;CAEX,SAAS,GAAG,MAAM;AACd,SAAO;GAAE,SAAS;GAAM;GAAM;;CAElC,SAAS,IAAI,OAAO;AAChB,SAAO;GAAE,SAAS;GAAO;GAAO;;AAEpC,SAAQ,2BAA2B;EAC/B,eAAe;EACf,aAAa;EACb,mBAAmB;EACnB,oBAAoB;EACpB,uBAAuB;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I;AACP;;EAGF,QACE,wBAAM,oBAAoB,UAAU;;;AAI1C,MAAM"}
1
+ {"version":3,"file":"cli.cjs","names":["node_fs_1","node_path_1","node_os_1","node_child_process_1","node_fs_1","node_path_1","node_fs_1","node_path_1","node_os_1","node_fs_1","node_path_1","node_fs_1","node_path_1","node_fs_1","node_path_1","node_fs_1","node_path_1","node_fs_1","node_path_1","node_fs_1","node_path_1","node_fs_1","node_path_1","path","fs"],"sources":["../../core/dist/types.js","../../core/dist/core.js","../../core/dist/frontmatter.js","../../core/dist/config.js","../../core/dist/state.js","../../core/dist/roadmap.js","../../core/dist/milestone.js","../../core/dist/commands.js","../../core/dist/verify.js","../../core/dist/phase.js","../../core/dist/template.js","../../core/dist/init.js","../../core/dist/index.js","../src/cli.ts"],"sourcesContent":["\"use strict\";\n/**\n * @maxsim/core — Shared type definitions\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.PLANNING_CONFIG_DEFAULTS = void 0;\nexports.phaseNumber = phaseNumber;\nexports.phasePath = phasePath;\nexports.phaseSlug = phaseSlug;\nexports.ok = ok;\nexports.err = err;\nfunction phaseNumber(value) {\n const match = value.match(/^\\d+[A-Z]?(\\.\\d+)?$/i);\n if (!match) {\n throw new Error(`Invalid phase number: ${value}`);\n }\n return value;\n}\nfunction phasePath(value) {\n if (!value || typeof value !== 'string') {\n throw new Error(`Invalid phase path: ${value}`);\n }\n return value;\n}\nfunction phaseSlug(value) {\n if (!value || typeof value !== 'string') {\n throw new Error(`Invalid phase slug: ${value}`);\n }\n return value;\n}\nfunction ok(data) {\n return { success: true, data };\n}\nfunction err(error) {\n return { success: false, error };\n}\nexports.PLANNING_CONFIG_DEFAULTS = {\n model_profile: 'balanced',\n commit_docs: true,\n search_gitignored: false,\n branching_strategy: 'none',\n phase_branch_template: 'maxsim/phase-{phase}-{slug}',\n milestone_branch_template: 'maxsim/{milestone}-{slug}',\n workflow: {\n research: true,\n plan_check: true,\n verifier: true,\n nyquist_validation: false,\n },\n parallelization: true,\n brave_search: false,\n};\n//# sourceMappingURL=types.js.map","\"use strict\";\n/**\n * Core — Shared utilities, constants, and internal helpers\n *\n * Ported from maxsim/bin/lib/core.cjs\n */\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.MODEL_PROFILES = void 0;\nexports.output = output;\nexports.error = error;\nexports.safeReadFile = safeReadFile;\nexports.loadConfig = loadConfig;\nexports.isGitIgnored = isGitIgnored;\nexports.execGit = execGit;\nexports.normalizePhaseName = normalizePhaseName;\nexports.comparePhaseNum = comparePhaseNum;\nexports.getPhasePattern = getPhasePattern;\nexports.findPhaseInternal = findPhaseInternal;\nexports.getArchivedPhaseDirs = getArchivedPhaseDirs;\nexports.getRoadmapPhaseInternal = getRoadmapPhaseInternal;\nexports.resolveModelInternal = resolveModelInternal;\nexports.pathExistsInternal = pathExistsInternal;\nexports.generateSlugInternal = generateSlugInternal;\nexports.getMilestoneInfo = getMilestoneInfo;\nconst node_fs_1 = __importDefault(require(\"node:fs\"));\nconst node_path_1 = __importDefault(require(\"node:path\"));\nconst node_os_1 = __importDefault(require(\"node:os\"));\nconst node_child_process_1 = require(\"node:child_process\");\n// ─── Model Profile Table ─────────────────────────────────────────────────────\nexports.MODEL_PROFILES = {\n 'maxsim-planner': { quality: 'opus', balanced: 'opus', budget: 'sonnet' },\n 'maxsim-roadmapper': { quality: 'opus', balanced: 'sonnet', budget: 'sonnet' },\n 'maxsim-executor': { quality: 'opus', balanced: 'sonnet', budget: 'sonnet' },\n 'maxsim-phase-researcher': { quality: 'opus', balanced: 'sonnet', budget: 'haiku' },\n 'maxsim-project-researcher': { quality: 'opus', balanced: 'sonnet', budget: 'haiku' },\n 'maxsim-research-synthesizer': { quality: 'sonnet', balanced: 'sonnet', budget: 'haiku' },\n 'maxsim-debugger': { quality: 'opus', balanced: 'sonnet', budget: 'sonnet' },\n 'maxsim-codebase-mapper': { quality: 'sonnet', balanced: 'haiku', budget: 'haiku' },\n 'maxsim-verifier': { quality: 'sonnet', balanced: 'sonnet', budget: 'haiku' },\n 'maxsim-plan-checker': { quality: 'sonnet', balanced: 'sonnet', budget: 'haiku' },\n 'maxsim-integration-checker': { quality: 'sonnet', balanced: 'sonnet', budget: 'haiku' },\n};\n// ─── Output helpers ──────────────────────────────────────────────────────────\n// DEPRECATION: output() and error() call process.exit() and belong in the CLI\n// layer. They are kept here for backward compatibility during the port. Future\n// plans should move these to @maxsim/cli.\nfunction output(result, raw, rawValue) {\n if (raw && rawValue !== undefined) {\n process.stdout.write(String(rawValue));\n }\n else {\n const json = JSON.stringify(result, null, 2);\n if (json.length > 50000) {\n const tmpPath = node_path_1.default.join(node_os_1.default.tmpdir(), `maxsim-${Date.now()}.json`);\n node_fs_1.default.writeFileSync(tmpPath, json, 'utf-8');\n process.stdout.write('@file:' + tmpPath);\n }\n else {\n process.stdout.write(json);\n }\n }\n process.exit(0);\n}\nfunction error(message) {\n process.stderr.write('Error: ' + message + '\\n');\n process.exit(1);\n}\n// ─── File & Config utilities ─────────────────────────────────────────────────\nfunction safeReadFile(filePath) {\n try {\n return node_fs_1.default.readFileSync(filePath, 'utf-8');\n }\n catch {\n return null;\n }\n}\nfunction loadConfig(cwd) {\n const configPath = node_path_1.default.join(cwd, '.planning', 'config.json');\n const defaults = {\n model_profile: 'balanced',\n commit_docs: true,\n search_gitignored: false,\n branching_strategy: 'none',\n phase_branch_template: 'maxsim/phase-{phase}-{slug}',\n milestone_branch_template: 'maxsim/{milestone}-{slug}',\n research: true,\n plan_checker: true,\n verifier: true,\n parallelization: true,\n brave_search: false,\n };\n try {\n const raw = node_fs_1.default.readFileSync(configPath, 'utf-8');\n const parsed = JSON.parse(raw);\n const get = (key, nested) => {\n if (parsed[key] !== undefined)\n return parsed[key];\n if (nested) {\n const section = parsed[nested.section];\n if (section && typeof section === 'object' && section !== null && nested.field in section) {\n return section[nested.field];\n }\n }\n return undefined;\n };\n const parallelization = (() => {\n const val = get('parallelization');\n if (typeof val === 'boolean')\n return val;\n if (typeof val === 'object' && val !== null && 'enabled' in val) {\n return val.enabled;\n }\n return defaults.parallelization;\n })();\n return {\n model_profile: get('model_profile') ?? defaults.model_profile,\n commit_docs: get('commit_docs', { section: 'planning', field: 'commit_docs' }) ?? defaults.commit_docs,\n search_gitignored: get('search_gitignored', { section: 'planning', field: 'search_gitignored' }) ?? defaults.search_gitignored,\n branching_strategy: get('branching_strategy', { section: 'git', field: 'branching_strategy' }) ?? defaults.branching_strategy,\n phase_branch_template: get('phase_branch_template', { section: 'git', field: 'phase_branch_template' }) ?? defaults.phase_branch_template,\n milestone_branch_template: get('milestone_branch_template', { section: 'git', field: 'milestone_branch_template' }) ?? defaults.milestone_branch_template,\n research: get('research', { section: 'workflow', field: 'research' }) ?? defaults.research,\n plan_checker: get('plan_checker', { section: 'workflow', field: 'plan_check' }) ?? defaults.plan_checker,\n verifier: get('verifier', { section: 'workflow', field: 'verifier' }) ?? defaults.verifier,\n parallelization,\n brave_search: get('brave_search') ?? defaults.brave_search,\n model_overrides: parsed['model_overrides'],\n };\n }\n catch {\n return defaults;\n }\n}\n// ─── Git utilities ───────────────────────────────────────────────────────────\nfunction isGitIgnored(cwd, targetPath) {\n try {\n (0, node_child_process_1.execSync)('git check-ignore -q -- ' + targetPath.replace(/[^a-zA-Z0-9._\\-/]/g, ''), {\n cwd,\n stdio: 'pipe',\n });\n return true;\n }\n catch {\n return false;\n }\n}\nfunction execGit(cwd, args) {\n try {\n const escaped = args.map(a => {\n if (/^[a-zA-Z0-9._\\-/=:@]+$/.test(a))\n return a;\n return \"'\" + a.replace(/'/g, \"'\\\\''\") + \"'\";\n });\n const stdout = (0, node_child_process_1.execSync)('git ' + escaped.join(' '), {\n cwd,\n stdio: 'pipe',\n encoding: 'utf-8',\n });\n return { exitCode: 0, stdout: stdout.trim(), stderr: '' };\n }\n catch (thrown) {\n const err = thrown;\n return {\n exitCode: err.status ?? 1,\n stdout: (err.stdout ?? '').toString().trim(),\n stderr: (err.stderr ?? '').toString().trim(),\n };\n }\n}\n// ─── Phase utilities ─────────────────────────────────────────────────────────\nfunction normalizePhaseName(phase) {\n const match = phase.match(/^(\\d+)([A-Z])?(\\.\\d+)?/i);\n if (!match)\n return phase;\n const padded = match[1].padStart(2, '0');\n const letter = match[2] ? match[2].toUpperCase() : '';\n const decimal = match[3] || '';\n return padded + letter + decimal;\n}\nfunction comparePhaseNum(a, b) {\n const pa = String(a).match(/^(\\d+)([A-Z])?(\\.\\d+)?/i);\n const pb = String(b).match(/^(\\d+)([A-Z])?(\\.\\d+)?/i);\n if (!pa || !pb)\n return String(a).localeCompare(String(b));\n const intDiff = parseInt(pa[1], 10) - parseInt(pb[1], 10);\n if (intDiff !== 0)\n return intDiff;\n const la = (pa[2] || '').toUpperCase();\n const lb = (pb[2] || '').toUpperCase();\n if (la !== lb) {\n if (!la)\n return -1;\n if (!lb)\n return 1;\n return la < lb ? -1 : 1;\n }\n const da = pa[3] ? parseFloat(pa[3]) : -1;\n const db = pb[3] ? parseFloat(pb[3]) : -1;\n return da - db;\n}\n// ─── Phase regex helper ──────────────────────────────────────────────────────\n/**\n * Returns the canonical regex for matching Phase heading lines in ROADMAP.md.\n *\n * General form (no escapedPhaseNum):\n * Matches: ## Phase 03: Name Here\n * Group 1: phase number string (e.g. \"03\", \"3A\", \"2.1\")\n * Group 2: phase name string (e.g. \"Name Here\")\n *\n * Specific form (with escapedPhaseNum):\n * Matches: ## Phase 03: Name Here\n * Group 1: phase name string only\n *\n * @param escapedPhaseNum - regex-escaped phase number string to match a specific phase\n * @param flags - regex flags (default: 'gi')\n */\nfunction getPhasePattern(escapedPhaseNum, flags = 'gi') {\n if (escapedPhaseNum) {\n return new RegExp(`#{2,4}\\\\s*Phase\\\\s+${escapedPhaseNum}:\\\\s*([^\\\\n]+)`, flags);\n }\n return new RegExp(`#{2,4}\\\\s*Phase\\\\s+(\\\\d+[A-Z]?(?:\\\\.\\\\d+)?)\\\\s*:\\\\s*([^\\\\n]+)`, flags);\n}\nfunction searchPhaseInDir(baseDir, relBase, normalized) {\n try {\n const entries = node_fs_1.default.readdirSync(baseDir, { withFileTypes: true });\n const dirs = entries.filter(e => e.isDirectory()).map(e => e.name).sort((a, b) => comparePhaseNum(a, b));\n const match = dirs.find(d => d.startsWith(normalized));\n if (!match)\n return null;\n const dirMatch = match.match(/^(\\d+[A-Z]?(?:\\.\\d+)?)-?(.*)/i);\n const phaseNumber = dirMatch ? dirMatch[1] : normalized;\n const phaseName = dirMatch && dirMatch[2] ? dirMatch[2] : null;\n const phaseDir = node_path_1.default.join(baseDir, match);\n const phaseFiles = node_fs_1.default.readdirSync(phaseDir);\n const plans = phaseFiles.filter(f => f.endsWith('-PLAN.md') || f === 'PLAN.md').sort();\n const summaries = phaseFiles.filter(f => f.endsWith('-SUMMARY.md') || f === 'SUMMARY.md').sort();\n const hasResearch = phaseFiles.some(f => f.endsWith('-RESEARCH.md') || f === 'RESEARCH.md');\n const hasContext = phaseFiles.some(f => f.endsWith('-CONTEXT.md') || f === 'CONTEXT.md');\n const hasVerification = phaseFiles.some(f => f.endsWith('-VERIFICATION.md') || f === 'VERIFICATION.md');\n const completedPlanIds = new Set(summaries.map(s => s.replace('-SUMMARY.md', '').replace('SUMMARY.md', '')));\n const incompletePlans = plans.filter(p => {\n const planId = p.replace('-PLAN.md', '').replace('PLAN.md', '');\n return !completedPlanIds.has(planId);\n });\n return {\n found: true,\n directory: node_path_1.default.join(relBase, match),\n phase_number: phaseNumber,\n phase_name: phaseName,\n phase_slug: phaseName ? phaseName.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '') : null,\n plans,\n summaries,\n incomplete_plans: incompletePlans,\n has_research: hasResearch,\n has_context: hasContext,\n has_verification: hasVerification,\n };\n }\n catch {\n return null;\n }\n}\nfunction findPhaseInternal(cwd, phase) {\n if (!phase)\n return null;\n const phasesDir = node_path_1.default.join(cwd, '.planning', 'phases');\n const normalized = normalizePhaseName(phase);\n const current = searchPhaseInDir(phasesDir, node_path_1.default.join('.planning', 'phases'), normalized);\n if (current)\n return current;\n const milestonesDir = node_path_1.default.join(cwd, '.planning', 'milestones');\n if (!node_fs_1.default.existsSync(milestonesDir))\n return null;\n try {\n const milestoneEntries = node_fs_1.default.readdirSync(milestonesDir, { withFileTypes: true });\n const archiveDirs = milestoneEntries\n .filter(e => e.isDirectory() && /^v[\\d.]+-phases$/.test(e.name))\n .map(e => e.name)\n .sort()\n .reverse();\n for (const archiveName of archiveDirs) {\n const versionMatch = archiveName.match(/^(v[\\d.]+)-phases$/);\n if (!versionMatch)\n continue;\n const version = versionMatch[1];\n const archivePath = node_path_1.default.join(milestonesDir, archiveName);\n const relBase = node_path_1.default.join('.planning', 'milestones', archiveName);\n const result = searchPhaseInDir(archivePath, relBase, normalized);\n if (result) {\n result.archived = version;\n return result;\n }\n }\n }\n catch (e) {\n /* optional op, ignore */\n if (process.env.MAXSIM_DEBUG)\n console.error(e);\n }\n return null;\n}\nfunction getArchivedPhaseDirs(cwd) {\n const milestonesDir = node_path_1.default.join(cwd, '.planning', 'milestones');\n const results = [];\n if (!node_fs_1.default.existsSync(milestonesDir))\n return results;\n try {\n const milestoneEntries = node_fs_1.default.readdirSync(milestonesDir, { withFileTypes: true });\n const phaseDirs = milestoneEntries\n .filter(e => e.isDirectory() && /^v[\\d.]+-phases$/.test(e.name))\n .map(e => e.name)\n .sort()\n .reverse();\n for (const archiveName of phaseDirs) {\n const versionMatch = archiveName.match(/^(v[\\d.]+)-phases$/);\n if (!versionMatch)\n continue;\n const version = versionMatch[1];\n const archivePath = node_path_1.default.join(milestonesDir, archiveName);\n const entries = node_fs_1.default.readdirSync(archivePath, { withFileTypes: true });\n const dirs = entries.filter(e => e.isDirectory()).map(e => e.name).sort((a, b) => comparePhaseNum(a, b));\n for (const dir of dirs) {\n results.push({\n name: dir,\n milestone: version,\n basePath: node_path_1.default.join('.planning', 'milestones', archiveName),\n fullPath: node_path_1.default.join(archivePath, dir),\n });\n }\n }\n }\n catch (e) {\n /* optional op, ignore */\n if (process.env.MAXSIM_DEBUG)\n console.error(e);\n }\n return results;\n}\n// ─── Roadmap & model utilities ───────────────────────────────────────────────\nfunction getRoadmapPhaseInternal(cwd, phaseNum) {\n if (!phaseNum)\n return null;\n const roadmapPath = node_path_1.default.join(cwd, '.planning', 'ROADMAP.md');\n if (!node_fs_1.default.existsSync(roadmapPath))\n return null;\n try {\n const content = node_fs_1.default.readFileSync(roadmapPath, 'utf-8');\n const escapedPhase = phaseNum.toString().replace(/\\./g, '\\\\.');\n const phasePattern = getPhasePattern(escapedPhase, 'i');\n const headerMatch = content.match(phasePattern);\n if (!headerMatch)\n return null;\n const phaseName = headerMatch[1].trim();\n const headerIndex = headerMatch.index;\n const restOfContent = content.slice(headerIndex);\n const nextHeaderMatch = restOfContent.match(/\\n#{2,4}\\s+Phase\\s+\\d/i);\n const sectionEnd = nextHeaderMatch ? headerIndex + nextHeaderMatch.index : content.length;\n const section = content.slice(headerIndex, sectionEnd).trim();\n const goalMatch = section.match(/\\*\\*Goal:\\*\\*\\s*([^\\n]+)/i);\n const goal = goalMatch ? goalMatch[1].trim() : null;\n return {\n found: true,\n phase_number: phaseNum.toString(),\n phase_name: phaseName,\n goal,\n section,\n };\n }\n catch {\n return null;\n }\n}\nfunction resolveModelInternal(cwd, agentType) {\n const config = loadConfig(cwd);\n const override = config.model_overrides?.[agentType];\n if (override) {\n return override === 'opus' ? 'inherit' : override;\n }\n const profile = config.model_profile || 'balanced';\n const agentModels = exports.MODEL_PROFILES[agentType];\n if (!agentModels)\n return 'sonnet';\n const resolved = agentModels[profile] || agentModels['balanced'] || 'sonnet';\n return resolved === 'opus' ? 'inherit' : resolved;\n}\n// ─── Misc utilities ──────────────────────────────────────────────────────────\nfunction pathExistsInternal(cwd, targetPath) {\n const fullPath = node_path_1.default.isAbsolute(targetPath) ? targetPath : node_path_1.default.join(cwd, targetPath);\n try {\n node_fs_1.default.statSync(fullPath);\n return true;\n }\n catch {\n return false;\n }\n}\nfunction generateSlugInternal(text) {\n if (!text)\n return null;\n return text.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '');\n}\nfunction getMilestoneInfo(cwd) {\n try {\n const roadmap = node_fs_1.default.readFileSync(node_path_1.default.join(cwd, '.planning', 'ROADMAP.md'), 'utf-8');\n const versionMatch = roadmap.match(/v(\\d+\\.\\d+)/);\n const nameMatch = roadmap.match(/## .*v\\d+\\.\\d+[:\\s]+([^\\n(]+)/);\n return {\n version: versionMatch ? versionMatch[0] : 'v1.0',\n name: nameMatch ? nameMatch[1].trim() : 'milestone',\n };\n }\n catch {\n return { version: 'v1.0', name: 'milestone' };\n }\n}\n//# sourceMappingURL=core.js.map","\"use strict\";\n/**\n * Frontmatter — YAML frontmatter parsing, serialization, and CRUD commands\n *\n * Ported from maxsim/bin/lib/frontmatter.cjs\n */\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.FRONTMATTER_SCHEMAS = void 0;\nexports.extractFrontmatter = extractFrontmatter;\nexports.reconstructFrontmatter = reconstructFrontmatter;\nexports.spliceFrontmatter = spliceFrontmatter;\nexports.parseMustHavesBlock = parseMustHavesBlock;\nexports.cmdFrontmatterGet = cmdFrontmatterGet;\nexports.cmdFrontmatterSet = cmdFrontmatterSet;\nexports.cmdFrontmatterMerge = cmdFrontmatterMerge;\nexports.cmdFrontmatterValidate = cmdFrontmatterValidate;\nconst node_fs_1 = __importDefault(require(\"node:fs\"));\nconst node_path_1 = __importDefault(require(\"node:path\"));\nconst core_js_1 = require(\"./core.js\");\n/**\n * Extract YAML frontmatter from markdown content into a typed object.\n */\nfunction extractFrontmatter(content) {\n const frontmatter = {};\n const match = content.match(/^---\\n([\\s\\S]+?)\\n---/);\n if (!match)\n return frontmatter;\n const yaml = match[1];\n const lines = yaml.split('\\n');\n const stack = [{ obj: frontmatter, key: null, indent: -1 }];\n for (const line of lines) {\n if (line.trim() === '')\n continue;\n const indentMatch = line.match(/^(\\s*)/);\n const indent = indentMatch ? indentMatch[1].length : 0;\n // Pop stack back to appropriate level\n while (stack.length > 1 && indent <= stack[stack.length - 1].indent) {\n stack.pop();\n }\n const current = stack[stack.length - 1];\n // Check for key: value pattern\n const keyMatch = line.match(/^(\\s*)([a-zA-Z0-9_-]+):\\s*(.*)/);\n if (keyMatch) {\n const key = keyMatch[2];\n const value = keyMatch[3].trim();\n if (value === '' || value === '[') {\n // Key with no value or opening bracket\n const newObj = value === '[' ? [] : {};\n current.obj[key] = newObj;\n current.key = null;\n stack.push({ obj: newObj, key: null, indent });\n }\n else if (value.startsWith('[') && value.endsWith(']')) {\n // Inline array: key: [a, b, c]\n current.obj[key] = value\n .slice(1, -1)\n .split(',')\n .map(s => s.trim().replace(/^[\"']|[\"']$/g, ''))\n .filter(Boolean);\n current.key = null;\n }\n else {\n // Simple key: value\n current.obj[key] = value.replace(/^[\"']|[\"']$/g, '');\n current.key = null;\n }\n }\n else if (line.trim().startsWith('- ')) {\n // Array item\n const itemValue = line.trim().slice(2).replace(/^[\"']|[\"']$/g, '');\n if (typeof current.obj === 'object' &&\n !Array.isArray(current.obj) &&\n Object.keys(current.obj).length === 0) {\n // Convert empty object to array\n const parent = stack.length > 1 ? stack[stack.length - 2] : null;\n if (parent && !Array.isArray(parent.obj)) {\n for (const k of Object.keys(parent.obj)) {\n if (parent.obj[k] === current.obj) {\n const arr = [itemValue];\n parent.obj[k] = arr;\n current.obj = arr;\n break;\n }\n }\n }\n }\n else if (Array.isArray(current.obj)) {\n current.obj.push(itemValue);\n }\n }\n }\n return frontmatter;\n}\n/**\n * Reconstruct YAML frontmatter string from an object.\n */\nfunction reconstructFrontmatter(obj) {\n const lines = [];\n for (const [key, value] of Object.entries(obj)) {\n if (value === null || value === undefined)\n continue;\n if (Array.isArray(value)) {\n formatArray(lines, key, value, 0);\n }\n else if (typeof value === 'object') {\n lines.push(`${key}:`);\n for (const [subkey, subval] of Object.entries(value)) {\n if (subval === null || subval === undefined)\n continue;\n if (Array.isArray(subval)) {\n formatArray(lines, subkey, subval, 2);\n }\n else if (typeof subval === 'object') {\n lines.push(` ${subkey}:`);\n for (const [subsubkey, subsubval] of Object.entries(subval)) {\n if (subsubval === null || subsubval === undefined)\n continue;\n if (Array.isArray(subsubval)) {\n if (subsubval.length === 0) {\n lines.push(` ${subsubkey}: []`);\n }\n else {\n lines.push(` ${subsubkey}:`);\n for (const item of subsubval) {\n lines.push(` - ${item}`);\n }\n }\n }\n else {\n lines.push(` ${subsubkey}: ${subsubval}`);\n }\n }\n }\n else {\n const sv = String(subval);\n lines.push(` ${subkey}: ${sv.includes(':') || sv.includes('#') ? `\"${sv}\"` : sv}`);\n }\n }\n }\n else {\n const sv = String(value);\n if (sv.includes(':') || sv.includes('#') || sv.startsWith('[') || sv.startsWith('{')) {\n lines.push(`${key}: \"${sv}\"`);\n }\n else {\n lines.push(`${key}: ${sv}`);\n }\n }\n }\n return lines.join('\\n');\n}\nfunction formatArray(lines, key, value, indentLevel) {\n const prefix = ' '.repeat(indentLevel);\n if (value.length === 0) {\n lines.push(`${prefix}${key}: []`);\n }\n else if (value.every(v => typeof v === 'string') &&\n value.length <= 3 &&\n value.join(', ').length < 60) {\n lines.push(`${prefix}${key}: [${value.join(', ')}]`);\n }\n else {\n lines.push(`${prefix}${key}:`);\n for (const item of value) {\n const itemStr = String(item);\n lines.push(`${prefix} - ${typeof item === 'string' && (itemStr.includes(':') || itemStr.includes('#')) ? `\"${itemStr}\"` : itemStr}`);\n }\n }\n}\n/**\n * Replace or insert frontmatter in markdown content.\n */\nfunction spliceFrontmatter(content, newObj) {\n const yamlStr = reconstructFrontmatter(newObj);\n const match = content.match(/^---\\n[\\s\\S]+?\\n---/);\n if (match) {\n return `---\\n${yamlStr}\\n---` + content.slice(match[0].length);\n }\n return `---\\n${yamlStr}\\n---\\n\\n` + content;\n}\n/**\n * Parse a specific block from must_haves in raw frontmatter YAML.\n */\nfunction parseMustHavesBlock(content, blockName) {\n const fmMatch = content.match(/^---\\n([\\s\\S]+?)\\n---/);\n if (!fmMatch)\n return [];\n const yaml = fmMatch[1];\n const blockPattern = new RegExp(`^\\\\s{4}${blockName}:\\\\s*$`, 'm');\n const blockStart = yaml.search(blockPattern);\n if (blockStart === -1)\n return [];\n const afterBlock = yaml.slice(blockStart);\n const blockLines = afterBlock.split('\\n').slice(1);\n const items = [];\n let current = null;\n for (const line of blockLines) {\n if (line.trim() === '')\n continue;\n const indent = line.match(/^(\\s*)/)[1].length;\n if (indent <= 4 && line.trim() !== '')\n break;\n if (line.match(/^\\s{6}-\\s+/)) {\n if (current !== null)\n items.push(current);\n current = {};\n const simpleMatch = line.match(/^\\s{6}-\\s+\"?([^\"]+)\"?\\s*$/);\n if (simpleMatch && !line.includes(':')) {\n current = simpleMatch[1];\n }\n else {\n const kvMatch = line.match(/^\\s{6}-\\s+(\\w+):\\s*\"?([^\"]*)\"?\\s*$/);\n if (kvMatch) {\n current = { [kvMatch[1]]: kvMatch[2] };\n }\n }\n }\n else if (current !== null && typeof current === 'object') {\n const kvMatch = line.match(/^\\s{8,}(\\w+):\\s*\"?([^\"]*)\"?\\s*$/);\n if (kvMatch) {\n const val = kvMatch[2];\n current[kvMatch[1]] = /^\\d+$/.test(val) ? parseInt(val, 10) : val;\n }\n const arrMatch = line.match(/^\\s{10,}-\\s+\"?([^\"]+)\"?\\s*$/);\n if (arrMatch) {\n const keys = Object.keys(current);\n const lastKey = keys[keys.length - 1];\n if (lastKey && !Array.isArray(current[lastKey])) {\n current[lastKey] = current[lastKey] ? [String(current[lastKey])] : [];\n }\n if (lastKey)\n current[lastKey].push(arrMatch[1]);\n }\n }\n }\n if (current !== null)\n items.push(current);\n return items;\n}\n// ─── Frontmatter schema validation ──────────────────────────────────────────\nexports.FRONTMATTER_SCHEMAS = {\n plan: {\n required: ['phase', 'plan', 'type', 'wave', 'depends_on', 'files_modified', 'autonomous', 'must_haves'],\n },\n summary: {\n required: ['phase', 'plan', 'subsystem', 'tags', 'duration', 'completed'],\n },\n verification: {\n required: ['phase', 'verified', 'status', 'score'],\n },\n};\n// ─── Frontmatter CRUD commands ──────────────────────────────────────────────\nfunction cmdFrontmatterGet(cwd, filePath, field, raw) {\n if (!filePath) {\n (0, core_js_1.error)('file path required');\n }\n const fullPath = node_path_1.default.isAbsolute(filePath) ? filePath : node_path_1.default.join(cwd, filePath);\n const content = (0, core_js_1.safeReadFile)(fullPath);\n if (!content) {\n (0, core_js_1.output)({ error: 'File not found', path: filePath }, raw);\n return;\n }\n const fm = extractFrontmatter(content);\n if (field) {\n const value = fm[field];\n if (value === undefined) {\n (0, core_js_1.output)({ error: 'Field not found', field }, raw);\n return;\n }\n (0, core_js_1.output)({ [field]: value }, raw, JSON.stringify(value));\n }\n else {\n (0, core_js_1.output)(fm, raw);\n }\n}\nfunction cmdFrontmatterSet(cwd, filePath, field, value, raw) {\n if (!filePath || !field || value === undefined) {\n (0, core_js_1.error)('file, field, and value required');\n }\n const fullPath = node_path_1.default.isAbsolute(filePath) ? filePath : node_path_1.default.join(cwd, filePath);\n if (!node_fs_1.default.existsSync(fullPath)) {\n (0, core_js_1.output)({ error: 'File not found', path: filePath }, raw);\n return;\n }\n const content = node_fs_1.default.readFileSync(fullPath, 'utf-8');\n const fm = extractFrontmatter(content);\n let parsedValue;\n try {\n parsedValue = JSON.parse(value);\n }\n catch {\n parsedValue = value;\n }\n fm[field] = parsedValue;\n const newContent = spliceFrontmatter(content, fm);\n node_fs_1.default.writeFileSync(fullPath, newContent, 'utf-8');\n (0, core_js_1.output)({ updated: true, field, value: parsedValue }, raw, 'true');\n}\nfunction cmdFrontmatterMerge(cwd, filePath, data, raw) {\n if (!filePath || !data) {\n (0, core_js_1.error)('file and data required');\n }\n const fullPath = node_path_1.default.isAbsolute(filePath) ? filePath : node_path_1.default.join(cwd, filePath);\n if (!node_fs_1.default.existsSync(fullPath)) {\n (0, core_js_1.output)({ error: 'File not found', path: filePath }, raw);\n return;\n }\n const content = node_fs_1.default.readFileSync(fullPath, 'utf-8');\n const fm = extractFrontmatter(content);\n let mergeData;\n try {\n mergeData = JSON.parse(data);\n }\n catch {\n (0, core_js_1.error)('Invalid JSON for --data');\n return;\n }\n Object.assign(fm, mergeData);\n const newContent = spliceFrontmatter(content, fm);\n node_fs_1.default.writeFileSync(fullPath, newContent, 'utf-8');\n (0, core_js_1.output)({ merged: true, fields: Object.keys(mergeData) }, raw, 'true');\n}\nfunction cmdFrontmatterValidate(cwd, filePath, schemaName, raw) {\n if (!filePath || !schemaName) {\n (0, core_js_1.error)('file and schema required');\n }\n const schema = exports.FRONTMATTER_SCHEMAS[schemaName];\n if (!schema) {\n (0, core_js_1.error)(`Unknown schema: ${schemaName}. Available: ${Object.keys(exports.FRONTMATTER_SCHEMAS).join(', ')}`);\n }\n const fullPath = node_path_1.default.isAbsolute(filePath) ? filePath : node_path_1.default.join(cwd, filePath);\n const content = (0, core_js_1.safeReadFile)(fullPath);\n if (!content) {\n (0, core_js_1.output)({ error: 'File not found', path: filePath }, raw);\n return;\n }\n const fm = extractFrontmatter(content);\n const missing = schema.required.filter(f => fm[f] === undefined);\n const present = schema.required.filter(f => fm[f] !== undefined);\n const result = {\n valid: missing.length === 0,\n missing,\n present,\n schema: schemaName,\n };\n (0, core_js_1.output)(result, raw, missing.length === 0 ? 'valid' : 'invalid');\n}\n//# sourceMappingURL=frontmatter.js.map","\"use strict\";\n/**\n * Config — Planning config CRUD operations\n *\n * Ported from maxsim/bin/lib/config.cjs\n */\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.cmdConfigEnsureSection = cmdConfigEnsureSection;\nexports.cmdConfigSet = cmdConfigSet;\nexports.cmdConfigGet = cmdConfigGet;\nconst node_fs_1 = __importDefault(require(\"node:fs\"));\nconst node_path_1 = __importDefault(require(\"node:path\"));\nconst node_os_1 = __importDefault(require(\"node:os\"));\nconst core_js_1 = require(\"./core.js\");\nconst types_js_1 = require(\"./types.js\");\n// ─── Config CRUD commands ───────────────────────────────────────────────────\nfunction cmdConfigEnsureSection(cwd, raw) {\n const configPath = node_path_1.default.join(cwd, '.planning', 'config.json');\n const planningDir = node_path_1.default.join(cwd, '.planning');\n try {\n if (!node_fs_1.default.existsSync(planningDir)) {\n node_fs_1.default.mkdirSync(planningDir, { recursive: true });\n }\n }\n catch (err) {\n (0, core_js_1.error)('Failed to create .planning directory: ' + err.message);\n }\n if (node_fs_1.default.existsSync(configPath)) {\n const result = { created: false, reason: 'already_exists' };\n (0, core_js_1.output)(result, raw, 'exists');\n return;\n }\n // Detect Brave Search API key availability\n const homedir = node_os_1.default.homedir();\n const braveKeyFile = node_path_1.default.join(homedir, '.maxsim', 'brave_api_key');\n const hasBraveSearch = !!(process.env.BRAVE_API_KEY || node_fs_1.default.existsSync(braveKeyFile));\n // Load user-level defaults from ~/.maxsim/defaults.json if available\n const globalDefaultsPath = node_path_1.default.join(homedir, '.maxsim', 'defaults.json');\n let userDefaults = {};\n try {\n if (node_fs_1.default.existsSync(globalDefaultsPath)) {\n userDefaults = JSON.parse(node_fs_1.default.readFileSync(globalDefaultsPath, 'utf-8'));\n }\n }\n catch {\n // Ignore malformed global defaults, fall back to hardcoded\n }\n const hardcoded = {\n ...types_js_1.PLANNING_CONFIG_DEFAULTS,\n brave_search: hasBraveSearch,\n };\n const defaults = {\n ...hardcoded,\n ...userDefaults,\n workflow: {\n ...hardcoded.workflow,\n ...(userDefaults.workflow || {}),\n },\n };\n try {\n node_fs_1.default.writeFileSync(configPath, JSON.stringify(defaults, null, 2), 'utf-8');\n const result = { created: true, path: '.planning/config.json' };\n (0, core_js_1.output)(result, raw, 'created');\n }\n catch (err) {\n (0, core_js_1.error)('Failed to create config.json: ' + err.message);\n }\n}\nfunction cmdConfigSet(cwd, keyPath, value, raw) {\n const configPath = node_path_1.default.join(cwd, '.planning', 'config.json');\n if (!keyPath) {\n (0, core_js_1.error)('Usage: config-set <key.path> <value>');\n }\n // Parse value (handle booleans and numbers)\n let parsedValue = value;\n if (value === 'true')\n parsedValue = true;\n else if (value === 'false')\n parsedValue = false;\n else if (value !== undefined && !isNaN(Number(value)) && value !== '')\n parsedValue = Number(value);\n // Load existing config or start with empty object\n let config = {};\n try {\n if (node_fs_1.default.existsSync(configPath)) {\n config = JSON.parse(node_fs_1.default.readFileSync(configPath, 'utf-8'));\n }\n }\n catch (err) {\n (0, core_js_1.error)('Failed to read config.json: ' + err.message);\n }\n // Set nested value using dot notation\n const keys = keyPath.split('.');\n let current = config;\n for (let i = 0; i < keys.length - 1; i++) {\n const key = keys[i];\n if (current[key] === undefined || typeof current[key] !== 'object') {\n current[key] = {};\n }\n current = current[key];\n }\n current[keys[keys.length - 1]] = parsedValue;\n try {\n node_fs_1.default.writeFileSync(configPath, JSON.stringify(config, null, 2), 'utf-8');\n const result = { updated: true, key: keyPath, value: parsedValue };\n (0, core_js_1.output)(result, raw, `${keyPath}=${parsedValue}`);\n }\n catch (err) {\n (0, core_js_1.error)('Failed to write config.json: ' + err.message);\n }\n}\nfunction cmdConfigGet(cwd, keyPath, raw) {\n const configPath = node_path_1.default.join(cwd, '.planning', 'config.json');\n if (!keyPath) {\n (0, core_js_1.error)('Usage: config-get <key.path>');\n }\n let config = {};\n try {\n if (node_fs_1.default.existsSync(configPath)) {\n config = JSON.parse(node_fs_1.default.readFileSync(configPath, 'utf-8'));\n }\n else {\n (0, core_js_1.error)('No config.json found at ' + configPath);\n }\n }\n catch (err) {\n if (err.message.startsWith('No config.json'))\n throw err;\n (0, core_js_1.error)('Failed to read config.json: ' + err.message);\n }\n const keys = keyPath.split('.');\n let current = config;\n for (const key of keys) {\n if (current === undefined || current === null || typeof current !== 'object') {\n (0, core_js_1.error)(`Key not found: ${keyPath}`);\n }\n current = current[key];\n }\n if (current === undefined) {\n (0, core_js_1.error)(`Key not found: ${keyPath}`);\n }\n (0, core_js_1.output)(current, raw, String(current));\n}\n//# sourceMappingURL=config.js.map","\"use strict\";\n/**\n * State — STATE.md operations and progression engine\n *\n * Ported from maxsim/bin/lib/state.cjs\n */\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.stateExtractField = stateExtractField;\nexports.stateReplaceField = stateReplaceField;\nexports.cmdStateLoad = cmdStateLoad;\nexports.cmdStateGet = cmdStateGet;\nexports.cmdStatePatch = cmdStatePatch;\nexports.cmdStateUpdate = cmdStateUpdate;\nexports.cmdStateAdvancePlan = cmdStateAdvancePlan;\nexports.cmdStateRecordMetric = cmdStateRecordMetric;\nexports.cmdStateUpdateProgress = cmdStateUpdateProgress;\nexports.cmdStateAddDecision = cmdStateAddDecision;\nexports.cmdStateAddBlocker = cmdStateAddBlocker;\nexports.cmdStateResolveBlocker = cmdStateResolveBlocker;\nexports.cmdStateRecordSession = cmdStateRecordSession;\nexports.cmdStateSnapshot = cmdStateSnapshot;\nconst node_fs_1 = __importDefault(require(\"node:fs\"));\nconst node_path_1 = __importDefault(require(\"node:path\"));\nconst core_js_1 = require(\"./core.js\");\n// ─── Internal helpers ────────────────────────────────────────────────────────\nfunction escapeRegex(str) {\n return str.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n}\nfunction stateExtractField(content, fieldName) {\n const pattern = new RegExp(`\\\\*\\\\*${fieldName}:\\\\*\\\\*\\\\s*(.+)`, 'i');\n const match = content.match(pattern);\n return match ? match[1].trim() : null;\n}\nfunction stateReplaceField(content, fieldName, newValue) {\n const escaped = escapeRegex(fieldName);\n const pattern = new RegExp(`(\\\\*\\\\*${escaped}:\\\\*\\\\*\\\\s*)(.*)`, 'i');\n if (pattern.test(content)) {\n return content.replace(pattern, (_match, prefix) => `${prefix}${newValue}`);\n }\n return null;\n}\nfunction readTextArgOrFile(cwd, value, filePath, label) {\n if (!filePath)\n return value;\n const resolvedPath = node_path_1.default.isAbsolute(filePath) ? filePath : node_path_1.default.join(cwd, filePath);\n try {\n return node_fs_1.default.readFileSync(resolvedPath, 'utf-8').trimEnd();\n }\n catch {\n throw new Error(`${label} file not found: ${filePath}`);\n }\n}\n// ─── State commands ──────────────────────────────────────────────────────────\nfunction cmdStateLoad(cwd, raw) {\n const config = (0, core_js_1.loadConfig)(cwd);\n const planningDir = node_path_1.default.join(cwd, '.planning');\n let stateRaw = '';\n try {\n stateRaw = node_fs_1.default.readFileSync(node_path_1.default.join(planningDir, 'STATE.md'), 'utf-8');\n }\n catch (e) {\n /* optional op, ignore */\n if (process.env.MAXSIM_DEBUG)\n console.error(e);\n }\n const configExists = node_fs_1.default.existsSync(node_path_1.default.join(planningDir, 'config.json'));\n const roadmapExists = node_fs_1.default.existsSync(node_path_1.default.join(planningDir, 'ROADMAP.md'));\n const stateExists = stateRaw.length > 0;\n const result = {\n config,\n state_raw: stateRaw,\n state_exists: stateExists,\n roadmap_exists: roadmapExists,\n config_exists: configExists,\n };\n if (raw) {\n const c = config;\n const lines = [\n `model_profile=${c.model_profile}`,\n `commit_docs=${c.commit_docs}`,\n `branching_strategy=${c.branching_strategy}`,\n `phase_branch_template=${c.phase_branch_template}`,\n `milestone_branch_template=${c.milestone_branch_template}`,\n `parallelization=${c.parallelization}`,\n `research=${c.research}`,\n `plan_checker=${c.plan_checker}`,\n `verifier=${c.verifier}`,\n `config_exists=${configExists}`,\n `roadmap_exists=${roadmapExists}`,\n `state_exists=${stateExists}`,\n ];\n process.stdout.write(lines.join('\\n'));\n process.exit(0);\n }\n (0, core_js_1.output)(result);\n}\nfunction cmdStateGet(cwd, section, raw) {\n const statePath = node_path_1.default.join(cwd, '.planning', 'STATE.md');\n try {\n const content = node_fs_1.default.readFileSync(statePath, 'utf-8');\n if (!section) {\n (0, core_js_1.output)({ content }, raw, content);\n return;\n }\n const fieldEscaped = escapeRegex(section);\n // Check for **field:** value\n const fieldPattern = new RegExp(`\\\\*\\\\*${fieldEscaped}:\\\\*\\\\*\\\\s*(.*)`, 'i');\n const fieldMatch = content.match(fieldPattern);\n if (fieldMatch) {\n (0, core_js_1.output)({ [section]: fieldMatch[1].trim() }, raw, fieldMatch[1].trim());\n return;\n }\n // Check for ## Section\n const sectionPattern = new RegExp(`##\\\\s*${fieldEscaped}\\\\s*\\n([\\\\s\\\\S]*?)(?=\\\\n##|$)`, 'i');\n const sectionMatch = content.match(sectionPattern);\n if (sectionMatch) {\n (0, core_js_1.output)({ [section]: sectionMatch[1].trim() }, raw, sectionMatch[1].trim());\n return;\n }\n (0, core_js_1.output)({ error: `Section or field \"${section}\" not found` }, raw, '');\n }\n catch {\n (0, core_js_1.error)('STATE.md not found');\n }\n}\nfunction cmdStatePatch(cwd, patches, raw) {\n const statePath = node_path_1.default.join(cwd, '.planning', 'STATE.md');\n try {\n let content = node_fs_1.default.readFileSync(statePath, 'utf-8');\n const results = { updated: [], failed: [] };\n for (const [field, value] of Object.entries(patches)) {\n const fieldEscaped = escapeRegex(field);\n const pattern = new RegExp(`(\\\\*\\\\*${fieldEscaped}:\\\\*\\\\*\\\\s*)(.*)`, 'i');\n if (pattern.test(content)) {\n content = content.replace(pattern, (_match, prefix) => `${prefix}${value}`);\n results.updated.push(field);\n }\n else {\n results.failed.push(field);\n }\n }\n if (results.updated.length > 0) {\n node_fs_1.default.writeFileSync(statePath, content, 'utf-8');\n }\n (0, core_js_1.output)(results, raw, results.updated.length > 0 ? 'true' : 'false');\n }\n catch {\n (0, core_js_1.error)('STATE.md not found');\n }\n}\nfunction cmdStateUpdate(cwd, field, value) {\n if (!field || value === undefined) {\n (0, core_js_1.error)('field and value required for state update');\n }\n const statePath = node_path_1.default.join(cwd, '.planning', 'STATE.md');\n try {\n let content = node_fs_1.default.readFileSync(statePath, 'utf-8');\n const fieldEscaped = escapeRegex(field);\n const pattern = new RegExp(`(\\\\*\\\\*${fieldEscaped}:\\\\*\\\\*\\\\s*)(.*)`, 'i');\n if (pattern.test(content)) {\n content = content.replace(pattern, (_match, prefix) => `${prefix}${value}`);\n node_fs_1.default.writeFileSync(statePath, content, 'utf-8');\n (0, core_js_1.output)({ updated: true });\n }\n else {\n (0, core_js_1.output)({ updated: false, reason: `Field \"${field}\" not found in STATE.md` });\n }\n }\n catch {\n (0, core_js_1.output)({ updated: false, reason: 'STATE.md not found' });\n }\n}\n// ─── State Progression Engine ────────────────────────────────────────────────\nfunction cmdStateAdvancePlan(cwd, raw) {\n const statePath = node_path_1.default.join(cwd, '.planning', 'STATE.md');\n if (!node_fs_1.default.existsSync(statePath)) {\n (0, core_js_1.output)({ error: 'STATE.md not found' }, raw);\n return;\n }\n let content = node_fs_1.default.readFileSync(statePath, 'utf-8');\n const currentPlan = parseInt(stateExtractField(content, 'Current Plan') ?? '', 10);\n const totalPlans = parseInt(stateExtractField(content, 'Total Plans in Phase') ?? '', 10);\n const today = new Date().toISOString().split('T')[0];\n if (isNaN(currentPlan) || isNaN(totalPlans)) {\n (0, core_js_1.output)({ error: 'Cannot parse Current Plan or Total Plans in Phase from STATE.md' }, raw);\n return;\n }\n if (currentPlan >= totalPlans) {\n content = stateReplaceField(content, 'Status', 'Phase complete — ready for verification') || content;\n content = stateReplaceField(content, 'Last Activity', today) || content;\n node_fs_1.default.writeFileSync(statePath, content, 'utf-8');\n (0, core_js_1.output)({ advanced: false, reason: 'last_plan', current_plan: currentPlan, total_plans: totalPlans, status: 'ready_for_verification' }, raw, 'false');\n }\n else {\n const newPlan = currentPlan + 1;\n content = stateReplaceField(content, 'Current Plan', String(newPlan)) || content;\n content = stateReplaceField(content, 'Status', 'Ready to execute') || content;\n content = stateReplaceField(content, 'Last Activity', today) || content;\n node_fs_1.default.writeFileSync(statePath, content, 'utf-8');\n (0, core_js_1.output)({ advanced: true, previous_plan: currentPlan, current_plan: newPlan, total_plans: totalPlans }, raw, 'true');\n }\n}\nfunction cmdStateRecordMetric(cwd, options, raw) {\n const statePath = node_path_1.default.join(cwd, '.planning', 'STATE.md');\n if (!node_fs_1.default.existsSync(statePath)) {\n (0, core_js_1.output)({ error: 'STATE.md not found' }, raw);\n return;\n }\n let content = node_fs_1.default.readFileSync(statePath, 'utf-8');\n const { phase, plan, duration, tasks, files } = options;\n if (!phase || !plan || !duration) {\n (0, core_js_1.output)({ error: 'phase, plan, and duration required' }, raw);\n return;\n }\n const metricsPattern = /(##\\s*Performance Metrics[\\s\\S]*?\\n\\|[^\\n]+\\n\\|[-|\\s]+\\n)([\\s\\S]*?)(?=\\n##|\\n$|$)/i;\n const metricsMatch = content.match(metricsPattern);\n if (metricsMatch) {\n let tableBody = metricsMatch[2].trimEnd();\n const newRow = `| Phase ${phase} P${plan} | ${duration} | ${tasks || '-'} tasks | ${files || '-'} files |`;\n if (tableBody.trim() === '' || tableBody.includes('None yet')) {\n tableBody = newRow;\n }\n else {\n tableBody = tableBody + '\\n' + newRow;\n }\n content = content.replace(metricsPattern, (_match, header) => `${header}${tableBody}\\n`);\n node_fs_1.default.writeFileSync(statePath, content, 'utf-8');\n (0, core_js_1.output)({ recorded: true, phase, plan, duration }, raw, 'true');\n }\n else {\n (0, core_js_1.output)({ recorded: false, reason: 'Performance Metrics section not found in STATE.md' }, raw, 'false');\n }\n}\nfunction cmdStateUpdateProgress(cwd, raw) {\n const statePath = node_path_1.default.join(cwd, '.planning', 'STATE.md');\n if (!node_fs_1.default.existsSync(statePath)) {\n (0, core_js_1.output)({ error: 'STATE.md not found' }, raw);\n return;\n }\n let content = node_fs_1.default.readFileSync(statePath, 'utf-8');\n const phasesDir = node_path_1.default.join(cwd, '.planning', 'phases');\n let totalPlans = 0;\n let totalSummaries = 0;\n if (node_fs_1.default.existsSync(phasesDir)) {\n const phaseDirs = node_fs_1.default.readdirSync(phasesDir, { withFileTypes: true })\n .filter(e => e.isDirectory()).map(e => e.name);\n for (const dir of phaseDirs) {\n const files = node_fs_1.default.readdirSync(node_path_1.default.join(phasesDir, dir));\n totalPlans += files.filter(f => f.match(/-PLAN\\.md$/i)).length;\n totalSummaries += files.filter(f => f.match(/-SUMMARY\\.md$/i)).length;\n }\n }\n const percent = totalPlans > 0 ? Math.min(100, Math.round(totalSummaries / totalPlans * 100)) : 0;\n const barWidth = 10;\n const filled = Math.round(percent / 100 * barWidth);\n const bar = '\\u2588'.repeat(filled) + '\\u2591'.repeat(barWidth - filled);\n const progressStr = `[${bar}] ${percent}%`;\n const progressPattern = /(\\*\\*Progress:\\*\\*\\s*).*/i;\n if (progressPattern.test(content)) {\n content = content.replace(progressPattern, (_match, prefix) => `${prefix}${progressStr}`);\n node_fs_1.default.writeFileSync(statePath, content, 'utf-8');\n (0, core_js_1.output)({ updated: true, percent, completed: totalSummaries, total: totalPlans, bar: progressStr }, raw, progressStr);\n }\n else {\n (0, core_js_1.output)({ updated: false, reason: 'Progress field not found in STATE.md' }, raw, 'false');\n }\n}\nfunction cmdStateAddDecision(cwd, options, raw) {\n const statePath = node_path_1.default.join(cwd, '.planning', 'STATE.md');\n if (!node_fs_1.default.existsSync(statePath)) {\n (0, core_js_1.output)({ error: 'STATE.md not found' }, raw);\n return;\n }\n const { phase, summary, summary_file, rationale, rationale_file } = options;\n let summaryText;\n let rationaleText = '';\n try {\n summaryText = readTextArgOrFile(cwd, summary, summary_file, 'summary');\n rationaleText = readTextArgOrFile(cwd, rationale || '', rationale_file, 'rationale') || '';\n }\n catch (thrown) {\n const e = thrown;\n (0, core_js_1.output)({ added: false, reason: e.message }, raw, 'false');\n return;\n }\n if (!summaryText) {\n (0, core_js_1.output)({ error: 'summary required' }, raw);\n return;\n }\n let content = node_fs_1.default.readFileSync(statePath, 'utf-8');\n const entry = `- [Phase ${phase || '?'}]: ${summaryText}${rationaleText ? ` — ${rationaleText}` : ''}`;\n const sectionPattern = /(###?\\s*(?:Decisions|Decisions Made|Accumulated.*Decisions)\\s*\\n)([\\s\\S]*?)(?=\\n###?|\\n##[^#]|$)/i;\n const match = content.match(sectionPattern);\n if (match) {\n let sectionBody = match[2];\n sectionBody = sectionBody.replace(/None yet\\.?\\s*\\n?/gi, '').replace(/No decisions yet\\.?\\s*\\n?/gi, '');\n sectionBody = sectionBody.trimEnd() + '\\n' + entry + '\\n';\n content = content.replace(sectionPattern, (_match, header) => `${header}${sectionBody}`);\n node_fs_1.default.writeFileSync(statePath, content, 'utf-8');\n (0, core_js_1.output)({ added: true, decision: entry }, raw, 'true');\n }\n else {\n (0, core_js_1.output)({ added: false, reason: 'Decisions section not found in STATE.md' }, raw, 'false');\n }\n}\nfunction cmdStateAddBlocker(cwd, text, raw) {\n const statePath = node_path_1.default.join(cwd, '.planning', 'STATE.md');\n if (!node_fs_1.default.existsSync(statePath)) {\n (0, core_js_1.output)({ error: 'STATE.md not found' }, raw);\n return;\n }\n const blockerOptions = typeof text === 'object' && text !== null ? text : { text: text };\n let blockerText;\n try {\n blockerText = readTextArgOrFile(cwd, blockerOptions.text, blockerOptions.text_file, 'blocker');\n }\n catch (thrown) {\n const e = thrown;\n (0, core_js_1.output)({ added: false, reason: e.message }, raw, 'false');\n return;\n }\n if (!blockerText) {\n (0, core_js_1.output)({ error: 'text required' }, raw);\n return;\n }\n let content = node_fs_1.default.readFileSync(statePath, 'utf-8');\n const entry = `- ${blockerText}`;\n const sectionPattern = /(###?\\s*(?:Blockers|Blockers\\/Concerns|Concerns)\\s*\\n)([\\s\\S]*?)(?=\\n###?|\\n##[^#]|$)/i;\n const match = content.match(sectionPattern);\n if (match) {\n let sectionBody = match[2];\n sectionBody = sectionBody.replace(/None\\.?\\s*\\n?/gi, '').replace(/None yet\\.?\\s*\\n?/gi, '');\n sectionBody = sectionBody.trimEnd() + '\\n' + entry + '\\n';\n content = content.replace(sectionPattern, (_match, header) => `${header}${sectionBody}`);\n node_fs_1.default.writeFileSync(statePath, content, 'utf-8');\n (0, core_js_1.output)({ added: true, blocker: blockerText }, raw, 'true');\n }\n else {\n (0, core_js_1.output)({ added: false, reason: 'Blockers section not found in STATE.md' }, raw, 'false');\n }\n}\nfunction cmdStateResolveBlocker(cwd, text, raw) {\n const statePath = node_path_1.default.join(cwd, '.planning', 'STATE.md');\n if (!node_fs_1.default.existsSync(statePath)) {\n (0, core_js_1.output)({ error: 'STATE.md not found' }, raw);\n return;\n }\n if (!text) {\n (0, core_js_1.output)({ error: 'text required' }, raw);\n return;\n }\n let content = node_fs_1.default.readFileSync(statePath, 'utf-8');\n const sectionPattern = /(###?\\s*(?:Blockers|Blockers\\/Concerns|Concerns)\\s*\\n)([\\s\\S]*?)(?=\\n###?|\\n##[^#]|$)/i;\n const match = content.match(sectionPattern);\n if (match) {\n const sectionBody = match[2];\n const lines = sectionBody.split('\\n');\n const filtered = lines.filter(line => {\n if (!line.startsWith('- '))\n return true;\n return !line.toLowerCase().includes(text.toLowerCase());\n });\n let newBody = filtered.join('\\n');\n if (!newBody.trim() || !newBody.includes('- ')) {\n newBody = 'None\\n';\n }\n content = content.replace(sectionPattern, (_match, header) => `${header}${newBody}`);\n node_fs_1.default.writeFileSync(statePath, content, 'utf-8');\n (0, core_js_1.output)({ resolved: true, blocker: text }, raw, 'true');\n }\n else {\n (0, core_js_1.output)({ resolved: false, reason: 'Blockers section not found in STATE.md' }, raw, 'false');\n }\n}\nfunction cmdStateRecordSession(cwd, options, raw) {\n const statePath = node_path_1.default.join(cwd, '.planning', 'STATE.md');\n if (!node_fs_1.default.existsSync(statePath)) {\n (0, core_js_1.output)({ error: 'STATE.md not found' }, raw);\n return;\n }\n let content = node_fs_1.default.readFileSync(statePath, 'utf-8');\n const now = new Date().toISOString();\n const updated = [];\n let result = stateReplaceField(content, 'Last session', now);\n if (result) {\n content = result;\n updated.push('Last session');\n }\n result = stateReplaceField(content, 'Last Date', now);\n if (result) {\n content = result;\n updated.push('Last Date');\n }\n if (options.stopped_at) {\n result = stateReplaceField(content, 'Stopped At', options.stopped_at);\n if (!result)\n result = stateReplaceField(content, 'Stopped at', options.stopped_at);\n if (result) {\n content = result;\n updated.push('Stopped At');\n }\n }\n const resumeFile = options.resume_file || 'None';\n result = stateReplaceField(content, 'Resume File', resumeFile);\n if (!result)\n result = stateReplaceField(content, 'Resume file', resumeFile);\n if (result) {\n content = result;\n updated.push('Resume File');\n }\n if (updated.length > 0) {\n node_fs_1.default.writeFileSync(statePath, content, 'utf-8');\n (0, core_js_1.output)({ recorded: true, updated }, raw, 'true');\n }\n else {\n (0, core_js_1.output)({ recorded: false, reason: 'No session fields found in STATE.md' }, raw, 'false');\n }\n}\nfunction cmdStateSnapshot(cwd, raw) {\n const statePath = node_path_1.default.join(cwd, '.planning', 'STATE.md');\n if (!node_fs_1.default.existsSync(statePath)) {\n (0, core_js_1.output)({ error: 'STATE.md not found' }, raw);\n return;\n }\n const content = node_fs_1.default.readFileSync(statePath, 'utf-8');\n const extractField = (fieldName) => {\n const pattern = new RegExp(`\\\\*\\\\*${fieldName}:\\\\*\\\\*\\\\s*(.+)`, 'i');\n const match = content.match(pattern);\n return match ? match[1].trim() : null;\n };\n const currentPhase = extractField('Current Phase');\n const currentPhaseName = extractField('Current Phase Name');\n const totalPhasesRaw = extractField('Total Phases');\n const currentPlan = extractField('Current Plan');\n const totalPlansRaw = extractField('Total Plans in Phase');\n const status = extractField('Status');\n const progressRaw = extractField('Progress');\n const lastActivity = extractField('Last Activity');\n const lastActivityDesc = extractField('Last Activity Description');\n const pausedAt = extractField('Paused At');\n const totalPhases = totalPhasesRaw ? parseInt(totalPhasesRaw, 10) : null;\n const totalPlansInPhase = totalPlansRaw ? parseInt(totalPlansRaw, 10) : null;\n const progressPercent = progressRaw ? parseInt(progressRaw.replace('%', ''), 10) : null;\n const decisions = [];\n const decisionsMatch = content.match(/##\\s*Decisions Made[\\s\\S]*?\\n\\|[^\\n]+\\n\\|[-|\\s]+\\n([\\s\\S]*?)(?=\\n##|\\n$|$)/i);\n if (decisionsMatch) {\n const tableBody = decisionsMatch[1];\n const rows = tableBody.trim().split('\\n').filter(r => r.includes('|'));\n for (const row of rows) {\n const cells = row.split('|').map(c => c.trim()).filter(Boolean);\n if (cells.length >= 3) {\n decisions.push({\n phase: cells[0],\n summary: cells[1],\n rationale: cells[2],\n });\n }\n }\n }\n const blockers = [];\n const blockersMatch = content.match(/##\\s*Blockers\\s*\\n([\\s\\S]*?)(?=\\n##|$)/i);\n if (blockersMatch) {\n const blockersSection = blockersMatch[1];\n const items = blockersSection.match(/^-\\s+(.+)$/gm) || [];\n for (const item of items) {\n blockers.push(item.replace(/^-\\s+/, '').trim());\n }\n }\n const session = {\n last_date: null,\n stopped_at: null,\n resume_file: null,\n };\n const sessionMatch = content.match(/##\\s*Session\\s*\\n([\\s\\S]*?)(?=\\n##|$)/i);\n if (sessionMatch) {\n const sessionSection = sessionMatch[1];\n const lastDateMatch = sessionSection.match(/\\*\\*Last Date:\\*\\*\\s*(.+)/i);\n const stoppedAtMatch = sessionSection.match(/\\*\\*Stopped At:\\*\\*\\s*(.+)/i);\n const resumeFileMatch = sessionSection.match(/\\*\\*Resume File:\\*\\*\\s*(.+)/i);\n if (lastDateMatch)\n session.last_date = lastDateMatch[1].trim();\n if (stoppedAtMatch)\n session.stopped_at = stoppedAtMatch[1].trim();\n if (resumeFileMatch)\n session.resume_file = resumeFileMatch[1].trim();\n }\n const snapshot = {\n current_phase: currentPhase,\n current_phase_name: currentPhaseName,\n total_phases: totalPhases,\n current_plan: currentPlan,\n total_plans_in_phase: totalPlansInPhase,\n status,\n progress_percent: progressPercent,\n last_activity: lastActivity,\n last_activity_desc: lastActivityDesc,\n decisions,\n blockers,\n paused_at: pausedAt,\n session,\n };\n (0, core_js_1.output)(snapshot, raw);\n}\n//# sourceMappingURL=state.js.map","\"use strict\";\n/**\n * Roadmap — Roadmap parsing and update operations\n *\n * Ported from maxsim/bin/lib/roadmap.cjs\n */\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.cmdRoadmapGetPhase = cmdRoadmapGetPhase;\nexports.cmdRoadmapAnalyze = cmdRoadmapAnalyze;\nexports.cmdRoadmapUpdatePlanProgress = cmdRoadmapUpdatePlanProgress;\nconst node_fs_1 = __importDefault(require(\"node:fs\"));\nconst node_path_1 = __importDefault(require(\"node:path\"));\nconst core_js_1 = require(\"./core.js\");\n// ─── Roadmap commands ────────────────────────────────────────────────────────\nfunction cmdRoadmapGetPhase(cwd, phaseNum, raw) {\n const roadmapPath = node_path_1.default.join(cwd, '.planning', 'ROADMAP.md');\n if (!node_fs_1.default.existsSync(roadmapPath)) {\n (0, core_js_1.output)({ found: false, error: 'ROADMAP.md not found' }, raw, '');\n return;\n }\n try {\n const content = node_fs_1.default.readFileSync(roadmapPath, 'utf-8');\n const escapedPhase = phaseNum.replace(/\\./g, '\\\\.');\n const phasePattern = (0, core_js_1.getPhasePattern)(escapedPhase, 'i');\n const headerMatch = content.match(phasePattern);\n if (!headerMatch) {\n const checklistPattern = new RegExp(`-\\\\s*\\\\[[ x]\\\\]\\\\s*\\\\*\\\\*Phase\\\\s+${escapedPhase}:\\\\s*([^*]+)\\\\*\\\\*`, 'i');\n const checklistMatch = content.match(checklistPattern);\n if (checklistMatch) {\n (0, core_js_1.output)({\n found: false,\n phase_number: phaseNum,\n phase_name: checklistMatch[1].trim(),\n error: 'malformed_roadmap',\n message: `Phase ${phaseNum} exists in summary list but missing \"### Phase ${phaseNum}:\" detail section. ROADMAP.md needs both formats.`\n }, raw, '');\n return;\n }\n (0, core_js_1.output)({ found: false, phase_number: phaseNum }, raw, '');\n return;\n }\n const phaseName = headerMatch[1].trim();\n const headerIndex = headerMatch.index;\n const restOfContent = content.slice(headerIndex);\n const nextHeaderMatch = restOfContent.match(/\\n#{2,4}\\s+Phase\\s+\\d/i);\n const sectionEnd = nextHeaderMatch\n ? headerIndex + nextHeaderMatch.index\n : content.length;\n const section = content.slice(headerIndex, sectionEnd).trim();\n const goalMatch = section.match(/\\*\\*Goal:\\*\\*\\s*([^\\n]+)/i);\n const goal = goalMatch ? goalMatch[1].trim() : null;\n const criteriaMatch = section.match(/\\*\\*Success Criteria\\*\\*[^\\n]*:\\s*\\n((?:\\s*\\d+\\.\\s*[^\\n]+\\n?)+)/i);\n const success_criteria = criteriaMatch\n ? criteriaMatch[1].trim().split('\\n').map(line => line.replace(/^\\s*\\d+\\.\\s*/, '').trim()).filter(Boolean)\n : [];\n (0, core_js_1.output)({\n found: true,\n phase_number: phaseNum,\n phase_name: phaseName,\n goal,\n success_criteria,\n section,\n }, raw, section);\n }\n catch (e) {\n (0, core_js_1.error)('Failed to read ROADMAP.md: ' + e.message);\n }\n}\nfunction cmdRoadmapAnalyze(cwd, raw) {\n const roadmapPath = node_path_1.default.join(cwd, '.planning', 'ROADMAP.md');\n if (!node_fs_1.default.existsSync(roadmapPath)) {\n (0, core_js_1.output)({ error: 'ROADMAP.md not found', milestones: [], phases: [], current_phase: null }, raw);\n return;\n }\n const content = node_fs_1.default.readFileSync(roadmapPath, 'utf-8');\n const phasesDir = node_path_1.default.join(cwd, '.planning', 'phases');\n const phasePattern = (0, core_js_1.getPhasePattern)();\n const phases = [];\n let match;\n while ((match = phasePattern.exec(content)) !== null) {\n const phaseNum = match[1];\n const phaseName = match[2].replace(/\\(INSERTED\\)/i, '').trim();\n const sectionStart = match.index;\n const restOfContent = content.slice(sectionStart);\n const nextHeader = restOfContent.match(/\\n#{2,4}\\s+Phase\\s+\\d/i);\n const sectionEnd = nextHeader ? sectionStart + nextHeader.index : content.length;\n const section = content.slice(sectionStart, sectionEnd);\n const goalMatch = section.match(/\\*\\*Goal:\\*\\*\\s*([^\\n]+)/i);\n const goal = goalMatch ? goalMatch[1].trim() : null;\n const dependsMatch = section.match(/\\*\\*Depends on:\\*\\*\\s*([^\\n]+)/i);\n const depends_on = dependsMatch ? dependsMatch[1].trim() : null;\n const normalized = (0, core_js_1.normalizePhaseName)(phaseNum);\n let diskStatus = 'no_directory';\n let planCount = 0;\n let summaryCount = 0;\n let hasContext = false;\n let hasResearch = false;\n try {\n const entries = node_fs_1.default.readdirSync(phasesDir, { withFileTypes: true });\n const dirs = entries.filter(e => e.isDirectory()).map(e => e.name);\n const dirMatch = dirs.find(d => d.startsWith(normalized + '-') || d === normalized);\n if (dirMatch) {\n const phaseFiles = node_fs_1.default.readdirSync(node_path_1.default.join(phasesDir, dirMatch));\n planCount = phaseFiles.filter(f => f.endsWith('-PLAN.md') || f === 'PLAN.md').length;\n summaryCount = phaseFiles.filter(f => f.endsWith('-SUMMARY.md') || f === 'SUMMARY.md').length;\n hasContext = phaseFiles.some(f => f.endsWith('-CONTEXT.md') || f === 'CONTEXT.md');\n hasResearch = phaseFiles.some(f => f.endsWith('-RESEARCH.md') || f === 'RESEARCH.md');\n if (summaryCount >= planCount && planCount > 0)\n diskStatus = 'complete';\n else if (summaryCount > 0)\n diskStatus = 'partial';\n else if (planCount > 0)\n diskStatus = 'planned';\n else if (hasResearch)\n diskStatus = 'researched';\n else if (hasContext)\n diskStatus = 'discussed';\n else\n diskStatus = 'empty';\n }\n }\n catch (e) {\n /* optional op, ignore */\n if (process.env.MAXSIM_DEBUG)\n console.error(e);\n }\n const checkboxPattern = new RegExp(`-\\\\s*\\\\[(x| )\\\\]\\\\s*.*Phase\\\\s+${phaseNum.replace('.', '\\\\.')}`, 'i');\n const checkboxMatch = content.match(checkboxPattern);\n const roadmapComplete = checkboxMatch ? checkboxMatch[1] === 'x' : false;\n phases.push({\n number: phaseNum,\n name: phaseName,\n goal,\n depends_on,\n plan_count: planCount,\n summary_count: summaryCount,\n has_context: hasContext,\n has_research: hasResearch,\n disk_status: diskStatus,\n roadmap_complete: roadmapComplete,\n });\n }\n const milestones = [];\n const milestonePattern = /##\\s*(.*v(\\d+\\.\\d+)[^(\\n]*)/gi;\n let mMatch;\n while ((mMatch = milestonePattern.exec(content)) !== null) {\n milestones.push({\n heading: mMatch[1].trim(),\n version: 'v' + mMatch[2],\n });\n }\n const currentPhase = phases.find(p => p.disk_status === 'planned' || p.disk_status === 'partial') || null;\n const nextPhase = phases.find(p => p.disk_status === 'empty' || p.disk_status === 'no_directory' || p.disk_status === 'discussed' || p.disk_status === 'researched') || null;\n const totalPlans = phases.reduce((sum, p) => sum + p.plan_count, 0);\n const totalSummaries = phases.reduce((sum, p) => sum + p.summary_count, 0);\n const completedPhases = phases.filter(p => p.disk_status === 'complete').length;\n const checklistPattern = /-\\s*\\[[ x]\\]\\s*\\*\\*Phase\\s+(\\d+[A-Z]?(?:\\.\\d+)?)/gi;\n const checklistPhases = new Set();\n let checklistMatch;\n while ((checklistMatch = checklistPattern.exec(content)) !== null) {\n checklistPhases.add(checklistMatch[1]);\n }\n const detailPhases = new Set(phases.map(p => p.number));\n const missingDetails = [...checklistPhases].filter(p => !detailPhases.has(p));\n const result = {\n milestones,\n phases,\n phase_count: phases.length,\n completed_phases: completedPhases,\n total_plans: totalPlans,\n total_summaries: totalSummaries,\n progress_percent: totalPlans > 0 ? Math.min(100, Math.round((totalSummaries / totalPlans) * 100)) : 0,\n current_phase: currentPhase ? currentPhase.number : null,\n next_phase: nextPhase ? nextPhase.number : null,\n missing_phase_details: missingDetails.length > 0 ? missingDetails : null,\n };\n (0, core_js_1.output)(result, raw);\n}\nfunction cmdRoadmapUpdatePlanProgress(cwd, phaseNum, raw) {\n if (!phaseNum) {\n (0, core_js_1.error)('phase number required for roadmap update-plan-progress');\n }\n const roadmapPath = node_path_1.default.join(cwd, '.planning', 'ROADMAP.md');\n const phaseInfo = (0, core_js_1.findPhaseInternal)(cwd, phaseNum);\n if (!phaseInfo) {\n (0, core_js_1.error)(`Phase ${phaseNum} not found`);\n }\n const planCount = phaseInfo.plans.length;\n const summaryCount = phaseInfo.summaries.length;\n if (planCount === 0) {\n (0, core_js_1.output)({ updated: false, reason: 'No plans found', plan_count: 0, summary_count: 0 }, raw, 'no plans');\n return;\n }\n const isComplete = summaryCount >= planCount;\n const status = isComplete ? 'Complete' : summaryCount > 0 ? 'In Progress' : 'Planned';\n const today = new Date().toISOString().split('T')[0];\n if (!node_fs_1.default.existsSync(roadmapPath)) {\n (0, core_js_1.output)({ updated: false, reason: 'ROADMAP.md not found', plan_count: planCount, summary_count: summaryCount }, raw, 'no roadmap');\n return;\n }\n let roadmapContent = node_fs_1.default.readFileSync(roadmapPath, 'utf-8');\n const phaseEscaped = phaseNum.replace('.', '\\\\.');\n const tablePattern = new RegExp(`(\\\\|\\\\s*${phaseEscaped}\\\\.?\\\\s[^|]*\\\\|)[^|]*(\\\\|)\\\\s*[^|]*(\\\\|)\\\\s*[^|]*(\\\\|)`, 'i');\n const dateField = isComplete ? ` ${today} ` : ' ';\n roadmapContent = roadmapContent.replace(tablePattern, `$1 ${summaryCount}/${planCount} $2 ${status.padEnd(11)}$3${dateField}$4`);\n const planCountPattern = new RegExp(`(#{2,4}\\\\s*Phase\\\\s+${phaseEscaped}[\\\\s\\\\S]*?\\\\*\\\\*Plans:\\\\*\\\\*\\\\s*)[^\\\\n]+`, 'i');\n const planCountText = isComplete\n ? `${summaryCount}/${planCount} plans complete`\n : `${summaryCount}/${planCount} plans executed`;\n roadmapContent = roadmapContent.replace(planCountPattern, `$1${planCountText}`);\n if (isComplete) {\n const checkboxPattern = new RegExp(`(-\\\\s*\\\\[)[ ](\\\\]\\\\s*.*Phase\\\\s+${phaseEscaped}[:\\\\s][^\\\\n]*)`, 'i');\n roadmapContent = roadmapContent.replace(checkboxPattern, `$1x$2 (completed ${today})`);\n }\n node_fs_1.default.writeFileSync(roadmapPath, roadmapContent, 'utf-8');\n (0, core_js_1.output)({\n updated: true,\n phase: phaseNum,\n plan_count: planCount,\n summary_count: summaryCount,\n status,\n complete: isComplete,\n }, raw, `${summaryCount}/${planCount} ${status}`);\n}\n//# sourceMappingURL=roadmap.js.map","\"use strict\";\n/**\n * Milestone — Milestone and requirements lifecycle operations\n *\n * Ported from maxsim/bin/lib/milestone.cjs\n */\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.cmdRequirementsMarkComplete = cmdRequirementsMarkComplete;\nexports.cmdMilestoneComplete = cmdMilestoneComplete;\nconst node_fs_1 = __importDefault(require(\"node:fs\"));\nconst node_path_1 = __importDefault(require(\"node:path\"));\nconst core_js_1 = require(\"./core.js\");\nconst frontmatter_js_1 = require(\"./frontmatter.js\");\n// ─── Requirements commands ───────────────────────────────────────────────────\nfunction cmdRequirementsMarkComplete(cwd, reqIdsRaw, raw) {\n if (!reqIdsRaw || reqIdsRaw.length === 0) {\n (0, core_js_1.error)('requirement IDs required. Usage: requirements mark-complete REQ-01,REQ-02 or REQ-01 REQ-02');\n }\n const reqIds = reqIdsRaw\n .join(' ')\n .replace(/[\\[\\]]/g, '')\n .split(/[,\\s]+/)\n .map(r => r.trim())\n .filter(Boolean);\n if (reqIds.length === 0) {\n (0, core_js_1.error)('no valid requirement IDs found');\n }\n const reqPath = node_path_1.default.join(cwd, '.planning', 'REQUIREMENTS.md');\n if (!node_fs_1.default.existsSync(reqPath)) {\n (0, core_js_1.output)({ updated: false, reason: 'REQUIREMENTS.md not found', ids: reqIds }, raw, 'no requirements file');\n return;\n }\n let reqContent = node_fs_1.default.readFileSync(reqPath, 'utf-8');\n const updated = [];\n const notFound = [];\n for (const reqId of reqIds) {\n let found = false;\n const checkboxPattern = new RegExp(`(-\\\\s*\\\\[)[ ](\\\\]\\\\s*\\\\*\\\\*${reqId}\\\\*\\\\*)`, 'gi');\n if (checkboxPattern.test(reqContent)) {\n reqContent = reqContent.replace(checkboxPattern, '$1x$2');\n found = true;\n }\n const tablePattern = new RegExp(`(\\\\|\\\\s*${reqId}\\\\s*\\\\|[^|]+\\\\|)\\\\s*Pending\\\\s*(\\\\|)`, 'gi');\n if (tablePattern.test(reqContent)) {\n reqContent = reqContent.replace(new RegExp(`(\\\\|\\\\s*${reqId}\\\\s*\\\\|[^|]+\\\\|)\\\\s*Pending\\\\s*(\\\\|)`, 'gi'), '$1 Complete $2');\n found = true;\n }\n if (found) {\n updated.push(reqId);\n }\n else {\n notFound.push(reqId);\n }\n }\n if (updated.length > 0) {\n node_fs_1.default.writeFileSync(reqPath, reqContent, 'utf-8');\n }\n const result = {\n updated: updated.length > 0,\n marked_complete: updated,\n not_found: notFound,\n total: reqIds.length,\n };\n (0, core_js_1.output)(result, raw, `${updated.length}/${reqIds.length} requirements marked complete`);\n}\n// ─── Milestone commands ──────────────────────────────────────────────────────\nfunction cmdMilestoneComplete(cwd, version, options, raw) {\n if (!version) {\n (0, core_js_1.error)('version required for milestone complete (e.g., v1.0)');\n }\n const roadmapPath = node_path_1.default.join(cwd, '.planning', 'ROADMAP.md');\n const reqPath = node_path_1.default.join(cwd, '.planning', 'REQUIREMENTS.md');\n const statePath = node_path_1.default.join(cwd, '.planning', 'STATE.md');\n const milestonesPath = node_path_1.default.join(cwd, '.planning', 'MILESTONES.md');\n const archiveDir = node_path_1.default.join(cwd, '.planning', 'milestones');\n const phasesDir = node_path_1.default.join(cwd, '.planning', 'phases');\n const today = new Date().toISOString().split('T')[0];\n const milestoneName = options.name || version;\n node_fs_1.default.mkdirSync(archiveDir, { recursive: true });\n let phaseCount = 0;\n let totalPlans = 0;\n let totalTasks = 0;\n const accomplishments = [];\n try {\n const entries = node_fs_1.default.readdirSync(phasesDir, { withFileTypes: true });\n const dirs = entries.filter(e => e.isDirectory()).map(e => e.name).sort();\n for (const dir of dirs) {\n phaseCount++;\n const phaseFiles = node_fs_1.default.readdirSync(node_path_1.default.join(phasesDir, dir));\n const plans = phaseFiles.filter(f => f.endsWith('-PLAN.md') || f === 'PLAN.md');\n const summaries = phaseFiles.filter(f => f.endsWith('-SUMMARY.md') || f === 'SUMMARY.md');\n totalPlans += plans.length;\n for (const s of summaries) {\n try {\n const content = node_fs_1.default.readFileSync(node_path_1.default.join(phasesDir, dir, s), 'utf-8');\n const fm = (0, frontmatter_js_1.extractFrontmatter)(content);\n if (fm['one-liner']) {\n accomplishments.push(String(fm['one-liner']));\n }\n const taskMatches = content.match(/##\\s*Task\\s*\\d+/gi) || [];\n totalTasks += taskMatches.length;\n }\n catch { /* empty */ }\n }\n }\n }\n catch { /* empty */ }\n // Archive ROADMAP.md\n if (node_fs_1.default.existsSync(roadmapPath)) {\n const roadmapContent = node_fs_1.default.readFileSync(roadmapPath, 'utf-8');\n node_fs_1.default.writeFileSync(node_path_1.default.join(archiveDir, `${version}-ROADMAP.md`), roadmapContent, 'utf-8');\n }\n // Archive REQUIREMENTS.md\n if (node_fs_1.default.existsSync(reqPath)) {\n const reqContent = node_fs_1.default.readFileSync(reqPath, 'utf-8');\n const archiveHeader = `# Requirements Archive: ${version} ${milestoneName}\\n\\n**Archived:** ${today}\\n**Status:** SHIPPED\\n\\nFor current requirements, see \\`.planning/REQUIREMENTS.md\\`.\\n\\n---\\n\\n`;\n node_fs_1.default.writeFileSync(node_path_1.default.join(archiveDir, `${version}-REQUIREMENTS.md`), archiveHeader + reqContent, 'utf-8');\n }\n // Archive audit file if exists\n const auditFile = node_path_1.default.join(cwd, '.planning', `${version}-MILESTONE-AUDIT.md`);\n if (node_fs_1.default.existsSync(auditFile)) {\n node_fs_1.default.renameSync(auditFile, node_path_1.default.join(archiveDir, `${version}-MILESTONE-AUDIT.md`));\n }\n // Create/append MILESTONES.md entry\n const accomplishmentsList = accomplishments.map(a => `- ${a}`).join('\\n');\n const milestoneEntry = `## ${version} ${milestoneName} (Shipped: ${today})\\n\\n**Phases completed:** ${phaseCount} phases, ${totalPlans} plans, ${totalTasks} tasks\\n\\n**Key accomplishments:**\\n${accomplishmentsList || '- (none recorded)'}\\n\\n---\\n\\n`;\n if (node_fs_1.default.existsSync(milestonesPath)) {\n const existing = node_fs_1.default.readFileSync(milestonesPath, 'utf-8');\n node_fs_1.default.writeFileSync(milestonesPath, existing + '\\n' + milestoneEntry, 'utf-8');\n }\n else {\n node_fs_1.default.writeFileSync(milestonesPath, `# Milestones\\n\\n${milestoneEntry}`, 'utf-8');\n }\n // Update STATE.md\n if (node_fs_1.default.existsSync(statePath)) {\n let stateContent = node_fs_1.default.readFileSync(statePath, 'utf-8');\n stateContent = stateContent.replace(/(\\*\\*Status:\\*\\*\\s*).*/, `$1${version} milestone complete`);\n stateContent = stateContent.replace(/(\\*\\*Last Activity:\\*\\*\\s*).*/, `$1${today}`);\n stateContent = stateContent.replace(/(\\*\\*Last Activity Description:\\*\\*\\s*).*/, `$1${version} milestone completed and archived`);\n node_fs_1.default.writeFileSync(statePath, stateContent, 'utf-8');\n }\n // Archive phase directories if requested\n let phasesArchived = false;\n if (options.archivePhases) {\n try {\n const phaseArchiveDir = node_path_1.default.join(archiveDir, `${version}-phases`);\n node_fs_1.default.mkdirSync(phaseArchiveDir, { recursive: true });\n const phaseEntries = node_fs_1.default.readdirSync(phasesDir, { withFileTypes: true });\n const phaseDirNames = phaseEntries.filter(e => e.isDirectory()).map(e => e.name);\n for (const dir of phaseDirNames) {\n node_fs_1.default.renameSync(node_path_1.default.join(phasesDir, dir), node_path_1.default.join(phaseArchiveDir, dir));\n }\n phasesArchived = phaseDirNames.length > 0;\n }\n catch { /* empty */ }\n }\n const result = {\n version,\n name: milestoneName,\n date: today,\n phases: phaseCount,\n plans: totalPlans,\n tasks: totalTasks,\n accomplishments,\n archived: {\n roadmap: node_fs_1.default.existsSync(node_path_1.default.join(archiveDir, `${version}-ROADMAP.md`)),\n requirements: node_fs_1.default.existsSync(node_path_1.default.join(archiveDir, `${version}-REQUIREMENTS.md`)),\n audit: node_fs_1.default.existsSync(node_path_1.default.join(archiveDir, `${version}-MILESTONE-AUDIT.md`)),\n phases: phasesArchived,\n },\n milestones_updated: true,\n state_updated: node_fs_1.default.existsSync(statePath),\n };\n (0, core_js_1.output)(result, raw);\n}\n//# sourceMappingURL=milestone.js.map","\"use strict\";\n/**\n * Commands — Standalone utility commands\n *\n * Ported from maxsim/bin/lib/commands.cjs\n */\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.cmdGenerateSlug = cmdGenerateSlug;\nexports.cmdCurrentTimestamp = cmdCurrentTimestamp;\nexports.cmdListTodos = cmdListTodos;\nexports.cmdVerifyPathExists = cmdVerifyPathExists;\nexports.cmdHistoryDigest = cmdHistoryDigest;\nexports.cmdResolveModel = cmdResolveModel;\nexports.cmdCommit = cmdCommit;\nexports.cmdSummaryExtract = cmdSummaryExtract;\nexports.cmdWebsearch = cmdWebsearch;\nexports.cmdProgressRender = cmdProgressRender;\nexports.cmdTodoComplete = cmdTodoComplete;\nexports.cmdScaffold = cmdScaffold;\nconst node_fs_1 = __importDefault(require(\"node:fs\"));\nconst node_path_1 = __importDefault(require(\"node:path\"));\nconst core_js_1 = require(\"./core.js\");\nconst frontmatter_js_1 = require(\"./frontmatter.js\");\n// ─── Slug generation ────────────────────────────────────────────────────────\nfunction cmdGenerateSlug(text, raw) {\n if (!text) {\n (0, core_js_1.error)('text required for slug generation');\n }\n const slug = text\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, '-')\n .replace(/^-+|-+$/g, '');\n const result = { slug };\n (0, core_js_1.output)(result, raw, slug);\n}\n// ─── Timestamp ──────────────────────────────────────────────────────────────\nfunction cmdCurrentTimestamp(format, raw) {\n const now = new Date();\n let result;\n switch (format) {\n case 'date':\n result = now.toISOString().split('T')[0];\n break;\n case 'filename':\n result = now.toISOString().replace(/:/g, '-').replace(/\\..+/, '');\n break;\n case 'full':\n default:\n result = now.toISOString();\n break;\n }\n (0, core_js_1.output)({ timestamp: result }, raw, result);\n}\n// ─── Todos ──────────────────────────────────────────────────────────────────\nfunction cmdListTodos(cwd, area, raw) {\n const pendingDir = node_path_1.default.join(cwd, '.planning', 'todos', 'pending');\n let count = 0;\n const todos = [];\n try {\n const files = node_fs_1.default.readdirSync(pendingDir).filter(f => f.endsWith('.md'));\n for (const file of files) {\n try {\n const content = node_fs_1.default.readFileSync(node_path_1.default.join(pendingDir, file), 'utf-8');\n const createdMatch = content.match(/^created:\\s*(.+)$/m);\n const titleMatch = content.match(/^title:\\s*(.+)$/m);\n const areaMatch = content.match(/^area:\\s*(.+)$/m);\n const todoArea = areaMatch ? areaMatch[1].trim() : 'general';\n // Apply area filter if specified\n if (area && todoArea !== area)\n continue;\n count++;\n todos.push({\n file,\n created: createdMatch ? createdMatch[1].trim() : 'unknown',\n title: titleMatch ? titleMatch[1].trim() : 'Untitled',\n area: todoArea,\n path: node_path_1.default.join('.planning', 'todos', 'pending', file),\n });\n }\n catch (e) {\n /* optional op, ignore */\n if (process.env.MAXSIM_DEBUG)\n console.error(e);\n }\n }\n }\n catch (e) {\n /* optional op, ignore */\n if (process.env.MAXSIM_DEBUG)\n console.error(e);\n }\n const result = { count, todos };\n (0, core_js_1.output)(result, raw, count.toString());\n}\n// ─── Path verification ──────────────────────────────────────────────────────\nfunction cmdVerifyPathExists(cwd, targetPath, raw) {\n if (!targetPath) {\n (0, core_js_1.error)('path required for verification');\n }\n const fullPath = node_path_1.default.isAbsolute(targetPath) ? targetPath : node_path_1.default.join(cwd, targetPath);\n try {\n const stats = node_fs_1.default.statSync(fullPath);\n const type = stats.isDirectory() ? 'directory' : stats.isFile() ? 'file' : 'other';\n const result = { exists: true, type };\n (0, core_js_1.output)(result, raw, 'true');\n }\n catch {\n const result = { exists: false, type: null };\n (0, core_js_1.output)(result, raw, 'false');\n }\n}\n// ─── History digest ─────────────────────────────────────────────────────────\nfunction cmdHistoryDigest(cwd, raw) {\n const phasesDir = node_path_1.default.join(cwd, '.planning', 'phases');\n const digest = { phases: {}, decisions: [], tech_stack: new Set() };\n // Collect all phase directories: archived + current\n const allPhaseDirs = [];\n // Add archived phases first (oldest milestones first)\n const archived = (0, core_js_1.getArchivedPhaseDirs)(cwd);\n for (const a of archived) {\n allPhaseDirs.push({ name: a.name, fullPath: a.fullPath, milestone: a.milestone });\n }\n // Add current phases\n if (node_fs_1.default.existsSync(phasesDir)) {\n try {\n const currentDirs = node_fs_1.default.readdirSync(phasesDir, { withFileTypes: true })\n .filter(e => e.isDirectory())\n .map(e => e.name)\n .sort();\n for (const dir of currentDirs) {\n allPhaseDirs.push({ name: dir, fullPath: node_path_1.default.join(phasesDir, dir), milestone: null });\n }\n }\n catch (e) {\n /* optional op, ignore */\n if (process.env.MAXSIM_DEBUG)\n console.error(e);\n }\n }\n if (allPhaseDirs.length === 0) {\n const emptyDigest = { phases: {}, decisions: [], tech_stack: [] };\n (0, core_js_1.output)(emptyDigest, raw);\n return;\n }\n try {\n for (const { name: dir, fullPath: dirPath } of allPhaseDirs) {\n const summaries = node_fs_1.default.readdirSync(dirPath).filter(f => f.endsWith('-SUMMARY.md') || f === 'SUMMARY.md');\n for (const summary of summaries) {\n try {\n const content = node_fs_1.default.readFileSync(node_path_1.default.join(dirPath, summary), 'utf-8');\n const fm = (0, frontmatter_js_1.extractFrontmatter)(content);\n const phaseNum = fm.phase || dir.split('-')[0];\n if (!digest.phases[phaseNum]) {\n digest.phases[phaseNum] = {\n name: fm.name || dir.split('-').slice(1).join(' ') || 'Unknown',\n provides: new Set(),\n affects: new Set(),\n patterns: new Set(),\n };\n }\n // Merge provides\n const depGraph = fm['dependency-graph'];\n if (depGraph && depGraph.provides) {\n depGraph.provides.forEach(p => digest.phases[phaseNum].provides.add(p));\n }\n else if (fm.provides) {\n fm.provides.forEach(p => digest.phases[phaseNum].provides.add(p));\n }\n // Merge affects\n if (depGraph && depGraph.affects) {\n depGraph.affects.forEach(a => digest.phases[phaseNum].affects.add(a));\n }\n // Merge patterns\n if (fm['patterns-established']) {\n fm['patterns-established'].forEach(p => digest.phases[phaseNum].patterns.add(p));\n }\n // Merge decisions\n if (fm['key-decisions']) {\n fm['key-decisions'].forEach(d => {\n digest.decisions.push({ phase: phaseNum, decision: d });\n });\n }\n // Merge tech stack\n const techStack = fm['tech-stack'];\n if (techStack && techStack.added) {\n techStack.added.forEach(t => digest.tech_stack.add(typeof t === 'string' ? t : t.name));\n }\n }\n catch (e) {\n /* optional op, ignore */\n if (process.env.MAXSIM_DEBUG)\n console.error(e);\n }\n }\n }\n // Convert Sets to Arrays for JSON output\n const outputDigest = {\n phases: {},\n decisions: digest.decisions,\n tech_stack: [...digest.tech_stack],\n };\n for (const [p, data] of Object.entries(digest.phases)) {\n outputDigest.phases[p] = {\n name: data.name,\n provides: [...data.provides],\n affects: [...data.affects],\n patterns: [...data.patterns],\n };\n }\n (0, core_js_1.output)(outputDigest, raw);\n }\n catch (e) {\n (0, core_js_1.error)('Failed to generate history digest: ' + e.message);\n }\n}\n// ─── Model resolution ───────────────────────────────────────────────────────\nfunction cmdResolveModel(cwd, agentType, raw) {\n if (!agentType) {\n (0, core_js_1.error)('agent-type required');\n }\n const config = (0, core_js_1.loadConfig)(cwd);\n const profile = config.model_profile || 'balanced';\n const agentModels = core_js_1.MODEL_PROFILES[agentType];\n if (!agentModels) {\n const result = { model: 'sonnet', profile, unknown_agent: true };\n (0, core_js_1.output)(result, raw, 'sonnet');\n return;\n }\n const resolved = agentModels[profile] || agentModels['balanced'] || 'sonnet';\n const model = resolved === 'opus' ? 'inherit' : resolved;\n const result = { model, profile };\n (0, core_js_1.output)(result, raw, model);\n}\n// ─── Commit ─────────────────────────────────────────────────────────────────\nfunction cmdCommit(cwd, message, files, raw, amend) {\n if (!message && !amend) {\n (0, core_js_1.error)('commit message required');\n }\n const config = (0, core_js_1.loadConfig)(cwd);\n // Check commit_docs config\n if (!config.commit_docs) {\n const result = { committed: false, hash: null, reason: 'skipped_commit_docs_false' };\n (0, core_js_1.output)(result, raw, 'skipped');\n return;\n }\n // Check if .planning is gitignored\n if ((0, core_js_1.isGitIgnored)(cwd, '.planning')) {\n const result = { committed: false, hash: null, reason: 'skipped_gitignored' };\n (0, core_js_1.output)(result, raw, 'skipped');\n return;\n }\n // Stage files\n const filesToStage = files && files.length > 0 ? files : ['.planning/'];\n for (const file of filesToStage) {\n (0, core_js_1.execGit)(cwd, ['add', file]);\n }\n // Commit\n const commitArgs = amend ? ['commit', '--amend', '--no-edit'] : ['commit', '-m', message];\n const commitResult = (0, core_js_1.execGit)(cwd, commitArgs);\n if (commitResult.exitCode !== 0) {\n if (commitResult.stdout.includes('nothing to commit') || commitResult.stderr.includes('nothing to commit')) {\n const result = { committed: false, hash: null, reason: 'nothing_to_commit' };\n (0, core_js_1.output)(result, raw, 'nothing');\n return;\n }\n const result = { committed: false, hash: null, reason: 'nothing_to_commit', error: commitResult.stderr };\n (0, core_js_1.output)(result, raw, 'nothing');\n return;\n }\n // Get short hash\n const hashResult = (0, core_js_1.execGit)(cwd, ['rev-parse', '--short', 'HEAD']);\n const hash = hashResult.exitCode === 0 ? hashResult.stdout : null;\n const result = { committed: true, hash, reason: 'committed' };\n (0, core_js_1.output)(result, raw, hash || 'committed');\n}\n// ─── Summary extract ────────────────────────────────────────────────────────\nfunction cmdSummaryExtract(cwd, summaryPath, fields, raw) {\n if (!summaryPath) {\n (0, core_js_1.error)('summary-path required for summary-extract');\n }\n const fullPath = node_path_1.default.join(cwd, summaryPath);\n if (!node_fs_1.default.existsSync(fullPath)) {\n (0, core_js_1.output)({ error: 'File not found', path: summaryPath }, raw);\n return;\n }\n const content = node_fs_1.default.readFileSync(fullPath, 'utf-8');\n const fm = (0, frontmatter_js_1.extractFrontmatter)(content);\n // Parse key-decisions into structured format\n const parseDecisions = (decisionsList) => {\n if (!decisionsList || !Array.isArray(decisionsList))\n return [];\n return decisionsList.map((d) => {\n const colonIdx = d.indexOf(':');\n if (colonIdx > 0) {\n return {\n summary: d.substring(0, colonIdx).trim(),\n rationale: d.substring(colonIdx + 1).trim(),\n };\n }\n return { summary: d, rationale: null };\n });\n };\n const techStack = fm['tech-stack'];\n // Build full result\n const fullResult = {\n path: summaryPath,\n one_liner: fm['one-liner'] || null,\n key_files: fm['key-files'] || [],\n tech_added: (techStack && techStack.added) || [],\n patterns: fm['patterns-established'] || [],\n decisions: parseDecisions(fm['key-decisions']),\n requirements_completed: fm['requirements-completed'] || [],\n };\n // If fields specified, filter to only those fields\n if (fields && fields.length > 0) {\n const filtered = { path: summaryPath };\n for (const field of fields) {\n if (fullResult[field] !== undefined) {\n filtered[field] = fullResult[field];\n }\n }\n (0, core_js_1.output)(filtered, raw);\n return;\n }\n (0, core_js_1.output)(fullResult, raw);\n}\n// ─── Web search ─────────────────────────────────────────────────────────────\nasync function cmdWebsearch(query, options, raw) {\n const apiKey = process.env.BRAVE_API_KEY;\n if (!apiKey) {\n (0, core_js_1.output)({ available: false, reason: 'BRAVE_API_KEY not set' }, raw, '');\n return;\n }\n if (!query) {\n (0, core_js_1.output)({ available: false, error: 'Query required' }, raw, '');\n return;\n }\n const params = new URLSearchParams({\n q: query,\n count: String(options.limit || 10),\n country: 'us',\n search_lang: 'en',\n text_decorations: 'false',\n });\n if (options.freshness) {\n params.set('freshness', options.freshness);\n }\n try {\n const response = await fetch(`https://api.search.brave.com/res/v1/web/search?${params}`, {\n headers: {\n Accept: 'application/json',\n 'X-Subscription-Token': apiKey,\n },\n });\n if (!response.ok) {\n (0, core_js_1.output)({ available: false, error: `API error: ${response.status}` }, raw, '');\n return;\n }\n const data = (await response.json());\n const results = (data.web?.results || []).map(r => ({\n title: r.title,\n url: r.url,\n description: r.description,\n age: r.age || null,\n }));\n (0, core_js_1.output)({\n available: true,\n query,\n count: results.length,\n results,\n }, raw, results.map(r => `${r.title}\\n${r.url}\\n${r.description}`).join('\\n\\n'));\n }\n catch (err) {\n (0, core_js_1.output)({ available: false, error: err.message }, raw, '');\n }\n}\n// ─── Progress render ────────────────────────────────────────────────────────\nfunction cmdProgressRender(cwd, format, raw) {\n const phasesDir = node_path_1.default.join(cwd, '.planning', 'phases');\n const milestone = (0, core_js_1.getMilestoneInfo)(cwd);\n const phases = [];\n let totalPlans = 0;\n let totalSummaries = 0;\n try {\n const entries = node_fs_1.default.readdirSync(phasesDir, { withFileTypes: true });\n const dirs = entries\n .filter(e => e.isDirectory())\n .map(e => e.name)\n .sort((a, b) => {\n const aNum = parseFloat(a.match(/^(\\d+(?:\\.\\d+)?)/)?.[1] || '0');\n const bNum = parseFloat(b.match(/^(\\d+(?:\\.\\d+)?)/)?.[1] || '0');\n return aNum - bNum;\n });\n for (const dir of dirs) {\n const dm = dir.match(/^(\\d+(?:\\.\\d+)?)-?(.*)/);\n const phaseNum = dm ? dm[1] : dir;\n const phaseName = dm && dm[2] ? dm[2].replace(/-/g, ' ') : '';\n const phaseFiles = node_fs_1.default.readdirSync(node_path_1.default.join(phasesDir, dir));\n const planCount = phaseFiles.filter(f => f.endsWith('-PLAN.md') || f === 'PLAN.md').length;\n const summaryCount = phaseFiles.filter(f => f.endsWith('-SUMMARY.md') || f === 'SUMMARY.md').length;\n totalPlans += planCount;\n totalSummaries += summaryCount;\n let status;\n if (planCount === 0)\n status = 'Pending';\n else if (summaryCount >= planCount)\n status = 'Complete';\n else if (summaryCount > 0)\n status = 'In Progress';\n else\n status = 'Planned';\n phases.push({ number: phaseNum, name: phaseName, plans: planCount, summaries: summaryCount, status });\n }\n }\n catch (e) {\n /* optional op, ignore */\n if (process.env.MAXSIM_DEBUG)\n console.error(e);\n }\n const percent = totalPlans > 0 ? Math.min(100, Math.round((totalSummaries / totalPlans) * 100)) : 0;\n if (format === 'table') {\n const barWidth = 10;\n const filled = Math.round((percent / 100) * barWidth);\n const bar = '\\u2588'.repeat(filled) + '\\u2591'.repeat(barWidth - filled);\n let out = `# ${milestone.version} ${milestone.name}\\n\\n`;\n out += `**Progress:** [${bar}] ${totalSummaries}/${totalPlans} plans (${percent}%)\\n\\n`;\n out += `| Phase | Name | Plans | Status |\\n`;\n out += `|-------|------|-------|--------|\\n`;\n for (const p of phases) {\n out += `| ${p.number} | ${p.name} | ${p.summaries}/${p.plans} | ${p.status} |\\n`;\n }\n (0, core_js_1.output)({ rendered: out }, raw, out);\n }\n else if (format === 'bar') {\n const barWidth = 20;\n const filled = Math.round((percent / 100) * barWidth);\n const bar = '\\u2588'.repeat(filled) + '\\u2591'.repeat(barWidth - filled);\n const text = `[${bar}] ${totalSummaries}/${totalPlans} plans (${percent}%)`;\n (0, core_js_1.output)({ bar: text, percent, completed: totalSummaries, total: totalPlans }, raw, text);\n }\n else {\n (0, core_js_1.output)({\n milestone_version: milestone.version,\n milestone_name: milestone.name,\n phases,\n total_plans: totalPlans,\n total_summaries: totalSummaries,\n percent,\n }, raw);\n }\n}\n// ─── Todo complete ──────────────────────────────────────────────────────────\nfunction cmdTodoComplete(cwd, filename, raw) {\n if (!filename) {\n (0, core_js_1.error)('filename required for todo complete');\n }\n const pendingDir = node_path_1.default.join(cwd, '.planning', 'todos', 'pending');\n const completedDir = node_path_1.default.join(cwd, '.planning', 'todos', 'completed');\n const sourcePath = node_path_1.default.join(pendingDir, filename);\n if (!node_fs_1.default.existsSync(sourcePath)) {\n (0, core_js_1.error)(`Todo not found: ${filename}`);\n }\n // Ensure completed directory exists\n node_fs_1.default.mkdirSync(completedDir, { recursive: true });\n // Read, add completion timestamp, move\n let content = node_fs_1.default.readFileSync(sourcePath, 'utf-8');\n const today = new Date().toISOString().split('T')[0];\n content = `completed: ${today}\\n` + content;\n node_fs_1.default.writeFileSync(node_path_1.default.join(completedDir, filename), content, 'utf-8');\n node_fs_1.default.unlinkSync(sourcePath);\n (0, core_js_1.output)({ completed: true, file: filename, date: today }, raw, 'completed');\n}\n// ─── Scaffold ───────────────────────────────────────────────────────────────\nfunction cmdScaffold(cwd, type, options, raw) {\n const { phase, name } = options;\n const padded = phase ? (0, core_js_1.normalizePhaseName)(phase) : '00';\n const today = new Date().toISOString().split('T')[0];\n // Find phase directory\n const phaseInfo = phase ? (0, core_js_1.findPhaseInternal)(cwd, phase) : null;\n const phaseDir = phaseInfo ? node_path_1.default.join(cwd, phaseInfo.directory) : null;\n if (phase && !phaseDir && type !== 'phase-dir') {\n (0, core_js_1.error)(`Phase ${phase} directory not found`);\n }\n let filePath;\n let content;\n switch (type) {\n case 'context': {\n filePath = node_path_1.default.join(phaseDir, `${padded}-CONTEXT.md`);\n content = `---\\nphase: \"${padded}\"\\nname: \"${name || phaseInfo?.phase_name || 'Unnamed'}\"\\ncreated: ${today}\\n---\\n\\n# Phase ${phase}: ${name || phaseInfo?.phase_name || 'Unnamed'} — Context\\n\\n## Decisions\\n\\n_Decisions will be captured during /maxsim:discuss-phase ${phase}_\\n\\n## Discretion Areas\\n\\n_Areas where the executor can use judgment_\\n\\n## Deferred Ideas\\n\\n_Ideas to consider later_\\n`;\n break;\n }\n case 'uat': {\n filePath = node_path_1.default.join(phaseDir, `${padded}-UAT.md`);\n content = `---\\nphase: \"${padded}\"\\nname: \"${name || phaseInfo?.phase_name || 'Unnamed'}\"\\ncreated: ${today}\\nstatus: pending\\n---\\n\\n# Phase ${phase}: ${name || phaseInfo?.phase_name || 'Unnamed'} — User Acceptance Testing\\n\\n## Test Results\\n\\n| # | Test | Status | Notes |\\n|---|------|--------|-------|\\n\\n## Summary\\n\\n_Pending UAT_\\n`;\n break;\n }\n case 'verification': {\n filePath = node_path_1.default.join(phaseDir, `${padded}-VERIFICATION.md`);\n content = `---\\nphase: \"${padded}\"\\nname: \"${name || phaseInfo?.phase_name || 'Unnamed'}\"\\ncreated: ${today}\\nstatus: pending\\n---\\n\\n# Phase ${phase}: ${name || phaseInfo?.phase_name || 'Unnamed'} — Verification\\n\\n## Goal-Backward Verification\\n\\n**Phase Goal:** [From ROADMAP.md]\\n\\n## Checks\\n\\n| # | Requirement | Status | Evidence |\\n|---|------------|--------|----------|\\n\\n## Result\\n\\n_Pending verification_\\n`;\n break;\n }\n case 'phase-dir': {\n if (!phase || !name) {\n (0, core_js_1.error)('phase and name required for phase-dir scaffold');\n }\n const slug = (0, core_js_1.generateSlugInternal)(name);\n const dirName = `${padded}-${slug}`;\n const phasesParent = node_path_1.default.join(cwd, '.planning', 'phases');\n node_fs_1.default.mkdirSync(phasesParent, { recursive: true });\n const dirPath = node_path_1.default.join(phasesParent, dirName);\n node_fs_1.default.mkdirSync(dirPath, { recursive: true });\n (0, core_js_1.output)({ created: true, directory: `.planning/phases/${dirName}`, path: dirPath }, raw, dirPath);\n return;\n }\n default:\n (0, core_js_1.error)(`Unknown scaffold type: ${type}. Available: context, uat, verification, phase-dir`);\n return; // unreachable but satisfies TS\n }\n if (node_fs_1.default.existsSync(filePath)) {\n (0, core_js_1.output)({ created: false, reason: 'already_exists', path: filePath }, raw, 'exists');\n return;\n }\n node_fs_1.default.writeFileSync(filePath, content, 'utf-8');\n const relPath = node_path_1.default.relative(cwd, filePath);\n (0, core_js_1.output)({ created: true, path: relPath }, raw, relPath);\n}\n//# sourceMappingURL=commands.js.map","\"use strict\";\n/**\n * Verify — Verification suite, consistency, and health validation\n *\n * Ported from maxsim/bin/lib/verify.cjs\n */\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.cmdVerifySummary = cmdVerifySummary;\nexports.cmdVerifyPlanStructure = cmdVerifyPlanStructure;\nexports.cmdVerifyPhaseCompleteness = cmdVerifyPhaseCompleteness;\nexports.cmdVerifyReferences = cmdVerifyReferences;\nexports.cmdVerifyCommits = cmdVerifyCommits;\nexports.cmdVerifyArtifacts = cmdVerifyArtifacts;\nexports.cmdVerifyKeyLinks = cmdVerifyKeyLinks;\nexports.cmdValidateConsistency = cmdValidateConsistency;\nexports.cmdValidateHealth = cmdValidateHealth;\nconst node_fs_1 = __importDefault(require(\"node:fs\"));\nconst node_path_1 = __importDefault(require(\"node:path\"));\nconst core_js_1 = require(\"./core.js\");\nconst frontmatter_js_1 = require(\"./frontmatter.js\");\n// ─── Verify Summary ──────────────────────────────────────────────────────────\nfunction cmdVerifySummary(cwd, summaryPath, checkFileCount, raw) {\n if (!summaryPath) {\n (0, core_js_1.error)('summary-path required');\n }\n const fullPath = node_path_1.default.join(cwd, summaryPath);\n const checkCount = checkFileCount || 2;\n if (!node_fs_1.default.existsSync(fullPath)) {\n const result = {\n passed: false,\n checks: {\n summary_exists: false,\n files_created: { checked: 0, found: 0, missing: [] },\n commits_exist: false,\n self_check: 'not_found',\n },\n errors: ['SUMMARY.md not found'],\n };\n (0, core_js_1.output)(result, raw, 'failed');\n return;\n }\n const content = node_fs_1.default.readFileSync(fullPath, 'utf-8');\n const errors = [];\n // Spot-check files mentioned in summary\n const mentionedFiles = new Set();\n const patterns = [\n /`([^`]+\\.[a-zA-Z]+)`/g,\n /(?:Created|Modified|Added|Updated|Edited):\\s*`?([^\\s`]+\\.[a-zA-Z]+)`?/gi,\n ];\n for (const pattern of patterns) {\n let m;\n while ((m = pattern.exec(content)) !== null) {\n const filePath = m[1];\n if (filePath && !filePath.startsWith('http') && filePath.includes('/')) {\n mentionedFiles.add(filePath);\n }\n }\n }\n const filesToCheck = Array.from(mentionedFiles).slice(0, checkCount);\n const missing = [];\n for (const file of filesToCheck) {\n if (!node_fs_1.default.existsSync(node_path_1.default.join(cwd, file))) {\n missing.push(file);\n }\n }\n // Check commits exist\n const commitHashPattern = /\\b[0-9a-f]{7,40}\\b/g;\n const hashes = content.match(commitHashPattern) || [];\n let commitsExist = false;\n if (hashes.length > 0) {\n for (const hash of hashes.slice(0, 3)) {\n const result = (0, core_js_1.execGit)(cwd, ['cat-file', '-t', hash]);\n if (result.exitCode === 0 && result.stdout === 'commit') {\n commitsExist = true;\n break;\n }\n }\n }\n // Self-check section\n let selfCheck = 'not_found';\n const selfCheckPattern = /##\\s*(?:Self[- ]?Check|Verification|Quality Check)/i;\n if (selfCheckPattern.test(content)) {\n const passPattern = /(?:all\\s+)?(?:pass|✓|✅|complete|succeeded)/i;\n const failPattern = /(?:fail|✗|❌|incomplete|blocked)/i;\n const checkSection = content.slice(content.search(selfCheckPattern));\n if (failPattern.test(checkSection)) {\n selfCheck = 'failed';\n }\n else if (passPattern.test(checkSection)) {\n selfCheck = 'passed';\n }\n }\n if (missing.length > 0)\n errors.push('Missing files: ' + missing.join(', '));\n if (!commitsExist && hashes.length > 0)\n errors.push('Referenced commit hashes not found in git history');\n if (selfCheck === 'failed')\n errors.push('Self-check section indicates failure');\n const checks = {\n summary_exists: true,\n files_created: { checked: filesToCheck.length, found: filesToCheck.length - missing.length, missing },\n commits_exist: commitsExist,\n self_check: selfCheck,\n };\n const passed = missing.length === 0 && selfCheck !== 'failed';\n const result = { passed, checks, errors };\n (0, core_js_1.output)(result, raw, passed ? 'passed' : 'failed');\n}\n// ─── Verify Plan Structure ───────────────────────────────────────────────────\nfunction cmdVerifyPlanStructure(cwd, filePath, raw) {\n if (!filePath) {\n (0, core_js_1.error)('file path required');\n }\n const fullPath = node_path_1.default.isAbsolute(filePath) ? filePath : node_path_1.default.join(cwd, filePath);\n const content = (0, core_js_1.safeReadFile)(fullPath);\n if (!content) {\n (0, core_js_1.output)({ error: 'File not found', path: filePath }, raw);\n return;\n }\n const fm = (0, frontmatter_js_1.extractFrontmatter)(content);\n const errors = [];\n const warnings = [];\n const required = ['phase', 'plan', 'type', 'wave', 'depends_on', 'files_modified', 'autonomous', 'must_haves'];\n for (const field of required) {\n if (fm[field] === undefined)\n errors.push(`Missing required frontmatter field: ${field}`);\n }\n const taskPattern = /<task[^>]*>([\\s\\S]*?)<\\/task>/g;\n const tasks = [];\n let taskMatch;\n while ((taskMatch = taskPattern.exec(content)) !== null) {\n const taskContent = taskMatch[1];\n const nameMatch = taskContent.match(/<name>([\\s\\S]*?)<\\/name>/);\n const taskName = nameMatch ? nameMatch[1].trim() : 'unnamed';\n const hasFiles = /<files>/.test(taskContent);\n const hasAction = /<action>/.test(taskContent);\n const hasVerify = /<verify>/.test(taskContent);\n const hasDone = /<done>/.test(taskContent);\n if (!nameMatch)\n errors.push('Task missing <name> element');\n if (!hasAction)\n errors.push(`Task '${taskName}' missing <action>`);\n if (!hasVerify)\n warnings.push(`Task '${taskName}' missing <verify>`);\n if (!hasDone)\n warnings.push(`Task '${taskName}' missing <done>`);\n if (!hasFiles)\n warnings.push(`Task '${taskName}' missing <files>`);\n tasks.push({ name: taskName, hasFiles, hasAction, hasVerify, hasDone });\n }\n if (tasks.length === 0)\n warnings.push('No <task> elements found');\n if (fm.wave && parseInt(String(fm.wave)) > 1 && (!fm.depends_on || (Array.isArray(fm.depends_on) && fm.depends_on.length === 0))) {\n warnings.push('Wave > 1 but depends_on is empty');\n }\n const hasCheckpoints = /<task\\s+type=[\"']?checkpoint/.test(content);\n if (hasCheckpoints && fm.autonomous !== 'false' && fm.autonomous !== false) {\n errors.push('Has checkpoint tasks but autonomous is not false');\n }\n const result = {\n valid: errors.length === 0,\n errors,\n warnings,\n task_count: tasks.length,\n tasks,\n frontmatter_fields: Object.keys(fm),\n };\n (0, core_js_1.output)(result, raw, errors.length === 0 ? 'valid' : 'invalid');\n}\n// ─── Verify Phase Completeness ───────────────────────────────────────────────\nfunction cmdVerifyPhaseCompleteness(cwd, phase, raw) {\n if (!phase) {\n (0, core_js_1.error)('phase required');\n }\n const phaseInfo = (0, core_js_1.findPhaseInternal)(cwd, phase);\n if (!phaseInfo) {\n (0, core_js_1.output)({ error: 'Phase not found', phase }, raw);\n return;\n }\n const errors = [];\n const warnings = [];\n const phaseDir = node_path_1.default.join(cwd, phaseInfo.directory);\n let files;\n try {\n files = node_fs_1.default.readdirSync(phaseDir);\n }\n catch {\n (0, core_js_1.output)({ error: 'Cannot read phase directory' }, raw);\n return;\n }\n const plans = files.filter(f => /-PLAN\\.md$/i.test(f));\n const summaries = files.filter(f => /-SUMMARY\\.md$/i.test(f));\n const planIds = new Set(plans.map(p => p.replace(/-PLAN\\.md$/i, '')));\n const summaryIds = new Set(summaries.map(s => s.replace(/-SUMMARY\\.md$/i, '')));\n const incompletePlans = [...planIds].filter(id => !summaryIds.has(id));\n if (incompletePlans.length > 0) {\n errors.push(`Plans without summaries: ${incompletePlans.join(', ')}`);\n }\n const orphanSummaries = [...summaryIds].filter(id => !planIds.has(id));\n if (orphanSummaries.length > 0) {\n warnings.push(`Summaries without plans: ${orphanSummaries.join(', ')}`);\n }\n const result = {\n complete: errors.length === 0,\n phase: phaseInfo.phase_number,\n plan_count: plans.length,\n summary_count: summaries.length,\n incomplete_plans: incompletePlans,\n orphan_summaries: orphanSummaries,\n errors,\n warnings,\n };\n (0, core_js_1.output)(result, raw, errors.length === 0 ? 'complete' : 'incomplete');\n}\n// ─── Verify References ───────────────────────────────────────────────────────\nfunction cmdVerifyReferences(cwd, filePath, raw) {\n if (!filePath) {\n (0, core_js_1.error)('file path required');\n }\n const fullPath = node_path_1.default.isAbsolute(filePath) ? filePath : node_path_1.default.join(cwd, filePath);\n const content = (0, core_js_1.safeReadFile)(fullPath);\n if (!content) {\n (0, core_js_1.output)({ error: 'File not found', path: filePath }, raw);\n return;\n }\n const found = [];\n const missing = [];\n const atRefs = content.match(/@([^\\s\\n,)]+\\/[^\\s\\n,)]+)/g) || [];\n for (const ref of atRefs) {\n const cleanRef = ref.slice(1);\n const resolved = cleanRef.startsWith('~/')\n ? node_path_1.default.join(process.env.HOME || '', cleanRef.slice(2))\n : node_path_1.default.join(cwd, cleanRef);\n if (node_fs_1.default.existsSync(resolved)) {\n found.push(cleanRef);\n }\n else {\n missing.push(cleanRef);\n }\n }\n const backtickRefs = content.match(/`([^`]+\\/[^`]+\\.[a-zA-Z]{1,10})`/g) || [];\n for (const ref of backtickRefs) {\n const cleanRef = ref.slice(1, -1);\n if (cleanRef.startsWith('http') || cleanRef.includes('${') || cleanRef.includes('{{'))\n continue;\n if (found.includes(cleanRef) || missing.includes(cleanRef))\n continue;\n const resolved = node_path_1.default.join(cwd, cleanRef);\n if (node_fs_1.default.existsSync(resolved)) {\n found.push(cleanRef);\n }\n else {\n missing.push(cleanRef);\n }\n }\n const result = {\n valid: missing.length === 0,\n found: found.length,\n missing,\n total: found.length + missing.length,\n };\n (0, core_js_1.output)(result, raw, missing.length === 0 ? 'valid' : 'invalid');\n}\n// ─── Verify Commits ──────────────────────────────────────────────────────────\nfunction cmdVerifyCommits(cwd, hashes, raw) {\n if (!hashes || hashes.length === 0) {\n (0, core_js_1.error)('At least one commit hash required');\n }\n const valid = [];\n const invalid = [];\n for (const hash of hashes) {\n const result = (0, core_js_1.execGit)(cwd, ['cat-file', '-t', hash]);\n if (result.exitCode === 0 && result.stdout.trim() === 'commit') {\n valid.push(hash);\n }\n else {\n invalid.push(hash);\n }\n }\n const commitResult = {\n all_valid: invalid.length === 0,\n valid,\n invalid,\n total: hashes.length,\n };\n (0, core_js_1.output)(commitResult, raw, invalid.length === 0 ? 'valid' : 'invalid');\n}\nfunction cmdVerifyArtifacts(cwd, planFilePath, raw) {\n if (!planFilePath) {\n (0, core_js_1.error)('plan file path required');\n }\n const fullPath = node_path_1.default.isAbsolute(planFilePath) ? planFilePath : node_path_1.default.join(cwd, planFilePath);\n const content = (0, core_js_1.safeReadFile)(fullPath);\n if (!content) {\n (0, core_js_1.output)({ error: 'File not found', path: planFilePath }, raw);\n return;\n }\n const artifacts = (0, frontmatter_js_1.parseMustHavesBlock)(content, 'artifacts');\n if (artifacts.length === 0) {\n (0, core_js_1.output)({ error: 'No must_haves.artifacts found in frontmatter', path: planFilePath }, raw);\n return;\n }\n const results = [];\n for (const artifact of artifacts) {\n if (typeof artifact === 'string')\n continue;\n const artObj = artifact;\n const artPath = artObj.path;\n if (!artPath)\n continue;\n const artFullPath = node_path_1.default.join(cwd, artPath);\n const exists = node_fs_1.default.existsSync(artFullPath);\n const check = { path: artPath, exists, issues: [], passed: false };\n if (exists) {\n const fileContent = (0, core_js_1.safeReadFile)(artFullPath) || '';\n const lineCount = fileContent.split('\\n').length;\n if (artObj.min_lines && lineCount < artObj.min_lines) {\n check.issues.push(`Only ${lineCount} lines, need ${artObj.min_lines}`);\n }\n if (artObj.contains && !fileContent.includes(artObj.contains)) {\n check.issues.push(`Missing pattern: ${artObj.contains}`);\n }\n if (artObj.exports) {\n const exportList = Array.isArray(artObj.exports) ? artObj.exports : [artObj.exports];\n for (const exp of exportList) {\n if (!fileContent.includes(exp))\n check.issues.push(`Missing export: ${exp}`);\n }\n }\n check.passed = check.issues.length === 0;\n }\n else {\n check.issues.push('File not found');\n }\n results.push(check);\n }\n const passed = results.filter(r => r.passed).length;\n const artifactsResult = {\n all_passed: passed === results.length,\n passed,\n total: results.length,\n artifacts: results,\n };\n (0, core_js_1.output)(artifactsResult, raw, passed === results.length ? 'valid' : 'invalid');\n}\nfunction cmdVerifyKeyLinks(cwd, planFilePath, raw) {\n if (!planFilePath) {\n (0, core_js_1.error)('plan file path required');\n }\n const fullPath = node_path_1.default.isAbsolute(planFilePath) ? planFilePath : node_path_1.default.join(cwd, planFilePath);\n const content = (0, core_js_1.safeReadFile)(fullPath);\n if (!content) {\n (0, core_js_1.output)({ error: 'File not found', path: planFilePath }, raw);\n return;\n }\n const keyLinks = (0, frontmatter_js_1.parseMustHavesBlock)(content, 'key_links');\n if (keyLinks.length === 0) {\n (0, core_js_1.output)({ error: 'No must_haves.key_links found in frontmatter', path: planFilePath }, raw);\n return;\n }\n const results = [];\n for (const link of keyLinks) {\n if (typeof link === 'string')\n continue;\n const linkObj = link;\n const check = {\n from: linkObj.from || '',\n to: linkObj.to || '',\n via: linkObj.via || '',\n verified: false,\n detail: '',\n };\n const sourceContent = (0, core_js_1.safeReadFile)(node_path_1.default.join(cwd, linkObj.from || ''));\n if (!sourceContent) {\n check.detail = 'Source file not found';\n }\n else if (linkObj.pattern) {\n try {\n const regex = new RegExp(linkObj.pattern);\n if (regex.test(sourceContent)) {\n check.verified = true;\n check.detail = 'Pattern found in source';\n }\n else {\n const targetContent = (0, core_js_1.safeReadFile)(node_path_1.default.join(cwd, linkObj.to || ''));\n if (targetContent && regex.test(targetContent)) {\n check.verified = true;\n check.detail = 'Pattern found in target';\n }\n else {\n check.detail = `Pattern \"${linkObj.pattern}\" not found in source or target`;\n }\n }\n }\n catch {\n check.detail = `Invalid regex pattern: ${linkObj.pattern}`;\n }\n }\n else {\n if (sourceContent.includes(linkObj.to || '')) {\n check.verified = true;\n check.detail = 'Target referenced in source';\n }\n else {\n check.detail = 'Target not referenced in source';\n }\n }\n results.push(check);\n }\n const verified = results.filter(r => r.verified).length;\n const linksResult = {\n all_verified: verified === results.length,\n verified,\n total: results.length,\n links: results,\n };\n (0, core_js_1.output)(linksResult, raw, verified === results.length ? 'valid' : 'invalid');\n}\n// ─── Validate Consistency ────────────────────────────────────────────────────\nfunction cmdValidateConsistency(cwd, raw) {\n const roadmapPath = node_path_1.default.join(cwd, '.planning', 'ROADMAP.md');\n const phasesDir = node_path_1.default.join(cwd, '.planning', 'phases');\n const errors = [];\n const warnings = [];\n if (!node_fs_1.default.existsSync(roadmapPath)) {\n errors.push('ROADMAP.md not found');\n (0, core_js_1.output)({ passed: false, errors, warnings }, raw, 'failed');\n return;\n }\n const roadmapContent = node_fs_1.default.readFileSync(roadmapPath, 'utf-8');\n const roadmapPhases = new Set();\n const phasePattern = (0, core_js_1.getPhasePattern)();\n let m;\n while ((m = phasePattern.exec(roadmapContent)) !== null) {\n roadmapPhases.add(m[1]);\n }\n const diskPhases = new Set();\n try {\n const entries = node_fs_1.default.readdirSync(phasesDir, { withFileTypes: true });\n const dirs = entries.filter(e => e.isDirectory()).map(e => e.name);\n for (const dir of dirs) {\n const dm = dir.match(/^(\\d+[A-Z]?(?:\\.\\d+)?)/i);\n if (dm)\n diskPhases.add(dm[1]);\n }\n }\n catch (e) {\n /* optional op, ignore */\n if (process.env.MAXSIM_DEBUG)\n console.error(e);\n }\n for (const p of roadmapPhases) {\n if (!diskPhases.has(p) && !diskPhases.has((0, core_js_1.normalizePhaseName)(p))) {\n warnings.push(`Phase ${p} in ROADMAP.md but no directory on disk`);\n }\n }\n for (const p of diskPhases) {\n const unpadded = String(parseInt(p, 10));\n if (!roadmapPhases.has(p) && !roadmapPhases.has(unpadded)) {\n warnings.push(`Phase ${p} exists on disk but not in ROADMAP.md`);\n }\n }\n const integerPhases = [...diskPhases]\n .filter(p => !p.includes('.'))\n .map(p => parseInt(p, 10))\n .sort((a, b) => a - b);\n for (let i = 1; i < integerPhases.length; i++) {\n if (integerPhases[i] !== integerPhases[i - 1] + 1) {\n warnings.push(`Gap in phase numbering: ${integerPhases[i - 1]} → ${integerPhases[i]}`);\n }\n }\n try {\n const entries = node_fs_1.default.readdirSync(phasesDir, { withFileTypes: true });\n const dirs = entries.filter(e => e.isDirectory()).map(e => e.name).sort();\n for (const dir of dirs) {\n const phaseFiles = node_fs_1.default.readdirSync(node_path_1.default.join(phasesDir, dir));\n const plans = phaseFiles.filter(f => f.endsWith('-PLAN.md')).sort();\n const planNums = plans.map(p => {\n const pm = p.match(/-(\\d{2})-PLAN\\.md$/);\n return pm ? parseInt(pm[1], 10) : null;\n }).filter((n) => n !== null);\n for (let i = 1; i < planNums.length; i++) {\n if (planNums[i] !== planNums[i - 1] + 1) {\n warnings.push(`Gap in plan numbering in ${dir}: plan ${planNums[i - 1]} → ${planNums[i]}`);\n }\n }\n const summaries = phaseFiles.filter(f => f.endsWith('-SUMMARY.md'));\n const planIdsSet = new Set(plans.map(p => p.replace('-PLAN.md', '')));\n const summaryIdsSet = new Set(summaries.map(s => s.replace('-SUMMARY.md', '')));\n for (const sid of summaryIdsSet) {\n if (!planIdsSet.has(sid)) {\n warnings.push(`Summary ${sid}-SUMMARY.md in ${dir} has no matching PLAN.md`);\n }\n }\n }\n }\n catch (e) {\n /* optional op, ignore */\n if (process.env.MAXSIM_DEBUG)\n console.error(e);\n }\n try {\n const entries = node_fs_1.default.readdirSync(phasesDir, { withFileTypes: true });\n const dirs = entries.filter(e => e.isDirectory()).map(e => e.name);\n for (const dir of dirs) {\n const phaseFiles = node_fs_1.default.readdirSync(node_path_1.default.join(phasesDir, dir));\n const plans = phaseFiles.filter(f => f.endsWith('-PLAN.md'));\n for (const plan of plans) {\n const content = node_fs_1.default.readFileSync(node_path_1.default.join(phasesDir, dir, plan), 'utf-8');\n const fm = (0, frontmatter_js_1.extractFrontmatter)(content);\n if (!fm.wave) {\n warnings.push(`${dir}/${plan}: missing 'wave' in frontmatter`);\n }\n }\n }\n }\n catch (e) {\n /* optional op, ignore */\n if (process.env.MAXSIM_DEBUG)\n console.error(e);\n }\n const passed = errors.length === 0;\n const result = { passed, errors, warnings, warning_count: warnings.length };\n (0, core_js_1.output)(result, raw, passed ? 'passed' : 'failed');\n}\n// ─── Validate Health ─────────────────────────────────────────────────────────\nfunction cmdValidateHealth(cwd, options, raw) {\n const planningDir = node_path_1.default.join(cwd, '.planning');\n const projectPath = node_path_1.default.join(planningDir, 'PROJECT.md');\n const roadmapPath = node_path_1.default.join(planningDir, 'ROADMAP.md');\n const statePath = node_path_1.default.join(planningDir, 'STATE.md');\n const configPath = node_path_1.default.join(planningDir, 'config.json');\n const phasesDir = node_path_1.default.join(planningDir, 'phases');\n const errors = [];\n const warnings = [];\n const info = [];\n const repairs = [];\n const addIssue = (severity, code, message, fix, repairable = false) => {\n const issue = { code, message, fix, repairable };\n if (severity === 'error')\n errors.push(issue);\n else if (severity === 'warning')\n warnings.push(issue);\n else\n info.push(issue);\n };\n // Check 1: .planning/ exists\n if (!node_fs_1.default.existsSync(planningDir)) {\n addIssue('error', 'E001', '.planning/ directory not found', 'Run /maxsim:new-project to initialize');\n (0, core_js_1.output)({\n status: 'broken',\n errors,\n warnings,\n info,\n repairable_count: 0,\n }, raw);\n return;\n }\n // Check 2: PROJECT.md\n if (!node_fs_1.default.existsSync(projectPath)) {\n addIssue('error', 'E002', 'PROJECT.md not found', 'Run /maxsim:new-project to create');\n }\n else {\n const content = node_fs_1.default.readFileSync(projectPath, 'utf-8');\n const requiredSections = ['## What This Is', '## Core Value', '## Requirements'];\n for (const section of requiredSections) {\n if (!content.includes(section)) {\n addIssue('warning', 'W001', `PROJECT.md missing section: ${section}`, 'Add section manually');\n }\n }\n }\n // Check 3: ROADMAP.md\n if (!node_fs_1.default.existsSync(roadmapPath)) {\n addIssue('error', 'E003', 'ROADMAP.md not found', 'Run /maxsim:new-milestone to create roadmap');\n }\n // Check 4: STATE.md\n if (!node_fs_1.default.existsSync(statePath)) {\n addIssue('error', 'E004', 'STATE.md not found', 'Run /maxsim:health --repair to regenerate', true);\n repairs.push('regenerateState');\n }\n else {\n const stateContent = node_fs_1.default.readFileSync(statePath, 'utf-8');\n const phaseRefs = [...stateContent.matchAll(/[Pp]hase\\s+(\\d+(?:\\.\\d+)?)/g)].map(m => m[1]);\n const diskPhases = new Set();\n try {\n const entries = node_fs_1.default.readdirSync(phasesDir, { withFileTypes: true });\n for (const e of entries) {\n if (e.isDirectory()) {\n const dm = e.name.match(/^(\\d+(?:\\.\\d+)?)/);\n if (dm)\n diskPhases.add(dm[1]);\n }\n }\n }\n catch (e) {\n /* optional op, ignore */\n if (process.env.MAXSIM_DEBUG)\n console.error(e);\n }\n for (const ref of phaseRefs) {\n const normalizedRef = String(parseInt(ref, 10)).padStart(2, '0');\n if (!diskPhases.has(ref) && !diskPhases.has(normalizedRef) && !diskPhases.has(String(parseInt(ref, 10)))) {\n if (diskPhases.size > 0) {\n addIssue('warning', 'W002', `STATE.md references phase ${ref}, but only phases ${[...diskPhases].sort().join(', ')} exist`, 'Run /maxsim:health --repair to regenerate STATE.md', true);\n if (!repairs.includes('regenerateState'))\n repairs.push('regenerateState');\n }\n }\n }\n }\n // Check 5: config.json\n if (!node_fs_1.default.existsSync(configPath)) {\n addIssue('warning', 'W003', 'config.json not found', 'Run /maxsim:health --repair to create with defaults', true);\n repairs.push('createConfig');\n }\n else {\n try {\n const rawContent = node_fs_1.default.readFileSync(configPath, 'utf-8');\n const parsed = JSON.parse(rawContent);\n const validProfiles = ['quality', 'balanced', 'budget'];\n if (parsed.model_profile && !validProfiles.includes(parsed.model_profile)) {\n addIssue('warning', 'W004', `config.json: invalid model_profile \"${parsed.model_profile}\"`, `Valid values: ${validProfiles.join(', ')}`);\n }\n }\n catch (thrown) {\n const parseErr = thrown;\n addIssue('error', 'E005', `config.json: JSON parse error - ${parseErr.message}`, 'Run /maxsim:health --repair to reset to defaults', true);\n repairs.push('resetConfig');\n }\n }\n // Check 6: Phase directory naming\n try {\n const entries = node_fs_1.default.readdirSync(phasesDir, { withFileTypes: true });\n for (const e of entries) {\n if (e.isDirectory() && !e.name.match(/^\\d{2}(?:\\.\\d+)?-[\\w-]+$/)) {\n addIssue('warning', 'W005', `Phase directory \"${e.name}\" doesn't follow NN-name format`, 'Rename to match pattern (e.g., 01-setup)');\n }\n }\n }\n catch (e) {\n /* optional op, ignore */\n if (process.env.MAXSIM_DEBUG)\n console.error(e);\n }\n // Check 7: Orphaned plans\n try {\n const entries = node_fs_1.default.readdirSync(phasesDir, { withFileTypes: true });\n for (const e of entries) {\n if (!e.isDirectory())\n continue;\n const phaseFiles = node_fs_1.default.readdirSync(node_path_1.default.join(phasesDir, e.name));\n const plans = phaseFiles.filter(f => f.endsWith('-PLAN.md') || f === 'PLAN.md');\n const summaries = phaseFiles.filter(f => f.endsWith('-SUMMARY.md') || f === 'SUMMARY.md');\n const summaryBases = new Set(summaries.map(s => s.replace('-SUMMARY.md', '').replace('SUMMARY.md', '')));\n for (const plan of plans) {\n const planBase = plan.replace('-PLAN.md', '').replace('PLAN.md', '');\n if (!summaryBases.has(planBase)) {\n addIssue('info', 'I001', `${e.name}/${plan} has no SUMMARY.md`, 'May be in progress');\n }\n }\n }\n }\n catch (e) {\n /* optional op, ignore */\n if (process.env.MAXSIM_DEBUG)\n console.error(e);\n }\n // Check 8: Roadmap consistency\n if (node_fs_1.default.existsSync(roadmapPath)) {\n const roadmapContent = node_fs_1.default.readFileSync(roadmapPath, 'utf-8');\n const roadmapPhases = new Set();\n const phasePattern = (0, core_js_1.getPhasePattern)();\n let m;\n while ((m = phasePattern.exec(roadmapContent)) !== null) {\n roadmapPhases.add(m[1]);\n }\n const diskPhases = new Set();\n try {\n const entries = node_fs_1.default.readdirSync(phasesDir, { withFileTypes: true });\n for (const e of entries) {\n if (e.isDirectory()) {\n const dm = e.name.match(/^(\\d+[A-Z]?(?:\\.\\d+)?)/i);\n if (dm)\n diskPhases.add(dm[1]);\n }\n }\n }\n catch (e) {\n /* optional op, ignore */\n if (process.env.MAXSIM_DEBUG)\n console.error(e);\n }\n for (const p of roadmapPhases) {\n const padded = String(parseInt(p, 10)).padStart(2, '0');\n if (!diskPhases.has(p) && !diskPhases.has(padded)) {\n addIssue('warning', 'W006', `Phase ${p} in ROADMAP.md but no directory on disk`, 'Create phase directory or remove from roadmap');\n }\n }\n for (const p of diskPhases) {\n const unpadded = String(parseInt(p, 10));\n if (!roadmapPhases.has(p) && !roadmapPhases.has(unpadded)) {\n addIssue('warning', 'W007', `Phase ${p} exists on disk but not in ROADMAP.md`, 'Add to roadmap or remove directory');\n }\n }\n }\n // Perform repairs if requested\n const repairActions = [];\n if (options.repair && repairs.length > 0) {\n for (const repair of repairs) {\n try {\n switch (repair) {\n case 'createConfig':\n case 'resetConfig': {\n const defaults = {\n model_profile: 'balanced',\n commit_docs: true,\n search_gitignored: false,\n branching_strategy: 'none',\n research: true,\n plan_checker: true,\n verifier: true,\n parallelization: true,\n };\n node_fs_1.default.writeFileSync(configPath, JSON.stringify(defaults, null, 2), 'utf-8');\n repairActions.push({ action: repair, success: true, path: 'config.json' });\n break;\n }\n case 'regenerateState': {\n if (node_fs_1.default.existsSync(statePath)) {\n const timestamp = new Date().toISOString().replace(/[:.]/g, '-').slice(0, 19);\n const backupPath = `${statePath}.bak-${timestamp}`;\n node_fs_1.default.copyFileSync(statePath, backupPath);\n repairActions.push({ action: 'backupState', success: true, path: backupPath });\n }\n const milestone = (0, core_js_1.getMilestoneInfo)(cwd);\n let stateContent = `# Session State\\n\\n`;\n stateContent += `## Project Reference\\n\\n`;\n stateContent += `See: .planning/PROJECT.md\\n\\n`;\n stateContent += `## Position\\n\\n`;\n stateContent += `**Milestone:** ${milestone.version} ${milestone.name}\\n`;\n stateContent += `**Current phase:** (determining...)\\n`;\n stateContent += `**Status:** Resuming\\n\\n`;\n stateContent += `## Session Log\\n\\n`;\n stateContent += `- ${new Date().toISOString().split('T')[0]}: STATE.md regenerated by /maxsim:health --repair\\n`;\n node_fs_1.default.writeFileSync(statePath, stateContent, 'utf-8');\n repairActions.push({ action: repair, success: true, path: 'STATE.md' });\n break;\n }\n }\n }\n catch (thrown) {\n const repairErr = thrown;\n repairActions.push({ action: repair, success: false, error: repairErr.message });\n }\n }\n }\n // Determine overall status\n let status;\n if (errors.length > 0) {\n status = 'broken';\n }\n else if (warnings.length > 0) {\n status = 'degraded';\n }\n else {\n status = 'healthy';\n }\n const repairableCount = errors.filter(e => e.repairable).length +\n warnings.filter(w => w.repairable).length;\n const result = {\n status,\n errors,\n warnings,\n info,\n repairable_count: repairableCount,\n repairs_performed: repairActions.length > 0 ? repairActions : undefined,\n };\n (0, core_js_1.output)(result, raw);\n}\n//# sourceMappingURL=verify.js.map","\"use strict\";\n/**\n * Phase — Phase CRUD, query, and lifecycle operations\n *\n * Ported from maxsim/bin/lib/phase.cjs\n */\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.cmdPhasesList = cmdPhasesList;\nexports.cmdPhaseNextDecimal = cmdPhaseNextDecimal;\nexports.cmdFindPhase = cmdFindPhase;\nexports.cmdPhasePlanIndex = cmdPhasePlanIndex;\nexports.cmdPhaseAdd = cmdPhaseAdd;\nexports.cmdPhaseInsert = cmdPhaseInsert;\nexports.cmdPhaseRemove = cmdPhaseRemove;\nexports.cmdPhaseComplete = cmdPhaseComplete;\nconst node_fs_1 = __importDefault(require(\"node:fs\"));\nconst node_path_1 = __importDefault(require(\"node:path\"));\nconst core_js_1 = require(\"./core.js\");\nconst frontmatter_js_1 = require(\"./frontmatter.js\");\n// ─── Phase list ─────────────────────────────────────────────────────────────\nfunction cmdPhasesList(cwd, options, raw) {\n const phasesDir = node_path_1.default.join(cwd, '.planning', 'phases');\n const { type, phase, includeArchived } = options;\n if (!node_fs_1.default.existsSync(phasesDir)) {\n if (type) {\n (0, core_js_1.output)({ files: [], count: 0 }, raw, '');\n }\n else {\n (0, core_js_1.output)({ directories: [], count: 0 }, raw, '');\n }\n return;\n }\n try {\n const entries = node_fs_1.default.readdirSync(phasesDir, { withFileTypes: true });\n let dirs = entries.filter(e => e.isDirectory()).map(e => e.name);\n if (includeArchived) {\n const archived = (0, core_js_1.getArchivedPhaseDirs)(cwd);\n for (const a of archived) {\n dirs.push(`${a.name} [${a.milestone}]`);\n }\n }\n dirs.sort((a, b) => (0, core_js_1.comparePhaseNum)(a, b));\n if (phase) {\n const normalized = (0, core_js_1.normalizePhaseName)(phase);\n const match = dirs.find(d => d.startsWith(normalized));\n if (!match) {\n (0, core_js_1.output)({ files: [], count: 0, phase_dir: null, error: 'Phase not found' }, raw, '');\n return;\n }\n dirs = [match];\n }\n if (type) {\n const files = [];\n for (const dir of dirs) {\n const dirPath = node_path_1.default.join(phasesDir, dir);\n const dirFiles = node_fs_1.default.readdirSync(dirPath);\n let filtered;\n if (type === 'plans') {\n filtered = dirFiles.filter(f => f.endsWith('-PLAN.md') || f === 'PLAN.md');\n }\n else if (type === 'summaries') {\n filtered = dirFiles.filter(f => f.endsWith('-SUMMARY.md') || f === 'SUMMARY.md');\n }\n else {\n filtered = dirFiles;\n }\n files.push(...filtered.sort());\n }\n const result = {\n files,\n count: files.length,\n phase_dir: phase ? dirs[0].replace(/^\\d+(?:\\.\\d+)?-?/, '') : null,\n };\n (0, core_js_1.output)(result, raw, files.join('\\n'));\n return;\n }\n (0, core_js_1.output)({ directories: dirs, count: dirs.length }, raw, dirs.join('\\n'));\n }\n catch (e) {\n (0, core_js_1.error)('Failed to list phases: ' + e.message);\n }\n}\n// ─── Next decimal ───────────────────────────────────────────────────────────\nfunction cmdPhaseNextDecimal(cwd, basePhase, raw) {\n const phasesDir = node_path_1.default.join(cwd, '.planning', 'phases');\n const normalized = (0, core_js_1.normalizePhaseName)(basePhase);\n if (!node_fs_1.default.existsSync(phasesDir)) {\n (0, core_js_1.output)({ found: false, base_phase: normalized, next: `${normalized}.1`, existing: [] }, raw, `${normalized}.1`);\n return;\n }\n try {\n const entries = node_fs_1.default.readdirSync(phasesDir, { withFileTypes: true });\n const dirs = entries.filter(e => e.isDirectory()).map(e => e.name);\n const baseExists = dirs.some(d => d.startsWith(normalized + '-') || d === normalized);\n const decimalPattern = new RegExp(`^${normalized}\\\\.(\\\\d+)`);\n const existingDecimals = [];\n for (const dir of dirs) {\n const match = dir.match(decimalPattern);\n if (match) {\n existingDecimals.push(`${normalized}.${match[1]}`);\n }\n }\n existingDecimals.sort((a, b) => {\n const aNum = parseFloat(a);\n const bNum = parseFloat(b);\n return aNum - bNum;\n });\n let nextDecimal;\n if (existingDecimals.length === 0) {\n nextDecimal = `${normalized}.1`;\n }\n else {\n const lastDecimal = existingDecimals[existingDecimals.length - 1];\n const lastNum = parseInt(lastDecimal.split('.')[1], 10);\n nextDecimal = `${normalized}.${lastNum + 1}`;\n }\n (0, core_js_1.output)({ found: baseExists, base_phase: normalized, next: nextDecimal, existing: existingDecimals }, raw, nextDecimal);\n }\n catch (e) {\n (0, core_js_1.error)('Failed to calculate next decimal phase: ' + e.message);\n }\n}\n// ─── Find phase ─────────────────────────────────────────────────────────────\nfunction cmdFindPhase(cwd, phase, raw) {\n if (!phase) {\n (0, core_js_1.error)('phase identifier required');\n }\n const phasesDir = node_path_1.default.join(cwd, '.planning', 'phases');\n const normalized = (0, core_js_1.normalizePhaseName)(phase);\n const notFound = { found: false, directory: null, phase_number: null, phase_name: null, plans: [], summaries: [] };\n try {\n const entries = node_fs_1.default.readdirSync(phasesDir, { withFileTypes: true });\n const dirs = entries.filter(e => e.isDirectory()).map(e => e.name).sort((a, b) => (0, core_js_1.comparePhaseNum)(a, b));\n const match = dirs.find(d => d.startsWith(normalized));\n if (!match) {\n (0, core_js_1.output)(notFound, raw, '');\n return;\n }\n const dirMatch = match.match(/^(\\d+[A-Z]?(?:\\.\\d+)?)-?(.*)/i);\n const phaseNumber = dirMatch ? dirMatch[1] : normalized;\n const phaseName = dirMatch && dirMatch[2] ? dirMatch[2] : null;\n const phaseDir = node_path_1.default.join(phasesDir, match);\n const phaseFiles = node_fs_1.default.readdirSync(phaseDir);\n const plans = phaseFiles.filter(f => f.endsWith('-PLAN.md') || f === 'PLAN.md').sort();\n const summaries = phaseFiles.filter(f => f.endsWith('-SUMMARY.md') || f === 'SUMMARY.md').sort();\n const result = {\n found: true,\n directory: node_path_1.default.join('.planning', 'phases', match),\n phase_number: phaseNumber,\n phase_name: phaseName,\n plans,\n summaries,\n };\n (0, core_js_1.output)(result, raw, result.directory);\n }\n catch {\n (0, core_js_1.output)(notFound, raw, '');\n }\n}\n// ─── Phase plan index ───────────────────────────────────────────────────────\nfunction cmdPhasePlanIndex(cwd, phase, raw) {\n if (!phase) {\n (0, core_js_1.error)('phase required for phase-plan-index');\n }\n const phasesDir = node_path_1.default.join(cwd, '.planning', 'phases');\n const normalized = (0, core_js_1.normalizePhaseName)(phase);\n let phaseDir = null;\n let phaseDirName = null;\n try {\n const entries = node_fs_1.default.readdirSync(phasesDir, { withFileTypes: true });\n const dirs = entries.filter(e => e.isDirectory()).map(e => e.name).sort((a, b) => (0, core_js_1.comparePhaseNum)(a, b));\n const match = dirs.find(d => d.startsWith(normalized));\n if (match) {\n phaseDir = node_path_1.default.join(phasesDir, match);\n phaseDirName = match;\n }\n }\n catch (e) {\n /* optional op, ignore */\n if (process.env.MAXSIM_DEBUG)\n console.error(e);\n }\n if (!phaseDir) {\n (0, core_js_1.output)({ phase: normalized, error: 'Phase not found', plans: [], waves: {}, incomplete: [], has_checkpoints: false }, raw);\n return;\n }\n const phaseFiles = node_fs_1.default.readdirSync(phaseDir);\n const planFiles = phaseFiles.filter(f => f.endsWith('-PLAN.md') || f === 'PLAN.md').sort();\n const summaryFiles = phaseFiles.filter(f => f.endsWith('-SUMMARY.md') || f === 'SUMMARY.md');\n const completedPlanIds = new Set(summaryFiles.map(s => s.replace('-SUMMARY.md', '').replace('SUMMARY.md', '')));\n const plans = [];\n const waves = {};\n const incomplete = [];\n let hasCheckpoints = false;\n for (const planFile of planFiles) {\n const planId = planFile.replace('-PLAN.md', '').replace('PLAN.md', '');\n const planPath = node_path_1.default.join(phaseDir, planFile);\n const content = node_fs_1.default.readFileSync(planPath, 'utf-8');\n const fm = (0, frontmatter_js_1.extractFrontmatter)(content);\n const taskMatches = content.match(/##\\s*Task\\s*\\d+/gi) || [];\n const taskCount = taskMatches.length;\n const wave = parseInt(fm.wave, 10) || 1;\n let autonomous = true;\n if (fm.autonomous !== undefined) {\n autonomous = fm.autonomous === 'true' || fm.autonomous === true;\n }\n if (!autonomous) {\n hasCheckpoints = true;\n }\n let filesModified = [];\n if (fm['files-modified']) {\n filesModified = Array.isArray(fm['files-modified']) ? fm['files-modified'] : [fm['files-modified']];\n }\n const hasSummary = completedPlanIds.has(planId);\n if (!hasSummary) {\n incomplete.push(planId);\n }\n const plan = {\n id: planId,\n wave,\n autonomous,\n objective: fm.objective || null,\n files_modified: filesModified,\n task_count: taskCount,\n has_summary: hasSummary,\n };\n plans.push(plan);\n const waveKey = String(wave);\n if (!waves[waveKey]) {\n waves[waveKey] = [];\n }\n waves[waveKey].push(planId);\n }\n (0, core_js_1.output)({ phase: normalized, plans, waves, incomplete, has_checkpoints: hasCheckpoints }, raw);\n}\n// ─── Phase add ──────────────────────────────────────────────────────────────\nfunction cmdPhaseAdd(cwd, description, raw) {\n if (!description) {\n (0, core_js_1.error)('description required for phase add');\n }\n const roadmapPath = node_path_1.default.join(cwd, '.planning', 'ROADMAP.md');\n if (!node_fs_1.default.existsSync(roadmapPath)) {\n (0, core_js_1.error)('ROADMAP.md not found');\n }\n const content = node_fs_1.default.readFileSync(roadmapPath, 'utf-8');\n const slug = (0, core_js_1.generateSlugInternal)(description);\n const phasePattern = (0, core_js_1.getPhasePattern)();\n let maxPhase = 0;\n let m;\n while ((m = phasePattern.exec(content)) !== null) {\n const num = parseInt(m[1], 10);\n if (num > maxPhase)\n maxPhase = num;\n }\n const newPhaseNum = maxPhase + 1;\n const paddedNum = String(newPhaseNum).padStart(2, '0');\n const dirName = `${paddedNum}-${slug}`;\n const dirPath = node_path_1.default.join(cwd, '.planning', 'phases', dirName);\n node_fs_1.default.mkdirSync(dirPath, { recursive: true });\n node_fs_1.default.writeFileSync(node_path_1.default.join(dirPath, '.gitkeep'), '');\n const phaseEntry = `\\n### Phase ${newPhaseNum}: ${description}\\n\\n**Goal:** [To be planned]\\n**Requirements**: TBD\\n**Depends on:** Phase ${maxPhase}\\n**Plans:** 0 plans\\n\\nPlans:\\n- [ ] TBD (run /maxsim:plan-phase ${newPhaseNum} to break down)\\n`;\n let updatedContent;\n const lastSeparator = content.lastIndexOf('\\n---');\n if (lastSeparator > 0) {\n updatedContent = content.slice(0, lastSeparator) + phaseEntry + content.slice(lastSeparator);\n }\n else {\n updatedContent = content + phaseEntry;\n }\n node_fs_1.default.writeFileSync(roadmapPath, updatedContent, 'utf-8');\n (0, core_js_1.output)({ phase_number: newPhaseNum, padded: paddedNum, name: description, slug, directory: `.planning/phases/${dirName}` }, raw, paddedNum);\n}\n// ─── Phase insert ───────────────────────────────────────────────────────────\nfunction cmdPhaseInsert(cwd, afterPhase, description, raw) {\n if (!afterPhase || !description) {\n (0, core_js_1.error)('after-phase and description required for phase insert');\n }\n const roadmapPath = node_path_1.default.join(cwd, '.planning', 'ROADMAP.md');\n if (!node_fs_1.default.existsSync(roadmapPath)) {\n (0, core_js_1.error)('ROADMAP.md not found');\n }\n const content = node_fs_1.default.readFileSync(roadmapPath, 'utf-8');\n const slug = (0, core_js_1.generateSlugInternal)(description);\n const normalizedAfter = (0, core_js_1.normalizePhaseName)(afterPhase);\n const unpadded = normalizedAfter.replace(/^0+/, '');\n const afterPhaseEscaped = unpadded.replace(/\\./g, '\\\\.');\n const targetPattern = (0, core_js_1.getPhasePattern)(afterPhaseEscaped, 'i');\n if (!targetPattern.test(content)) {\n (0, core_js_1.error)(`Phase ${afterPhase} not found in ROADMAP.md`);\n }\n const phasesDir = node_path_1.default.join(cwd, '.planning', 'phases');\n const normalizedBase = (0, core_js_1.normalizePhaseName)(afterPhase);\n const existingDecimals = [];\n try {\n const entries = node_fs_1.default.readdirSync(phasesDir, { withFileTypes: true });\n const dirs = entries.filter(e => e.isDirectory()).map(e => e.name);\n const decimalPattern = new RegExp(`^${normalizedBase}\\\\.(\\\\d+)`);\n for (const dir of dirs) {\n const dm = dir.match(decimalPattern);\n if (dm)\n existingDecimals.push(parseInt(dm[1], 10));\n }\n }\n catch (e) {\n /* optional op, ignore */\n if (process.env.MAXSIM_DEBUG)\n console.error(e);\n }\n const nextDecimal = existingDecimals.length === 0 ? 1 : Math.max(...existingDecimals) + 1;\n const decimalPhase = `${normalizedBase}.${nextDecimal}`;\n const dirName = `${decimalPhase}-${slug}`;\n const dirPath = node_path_1.default.join(cwd, '.planning', 'phases', dirName);\n node_fs_1.default.mkdirSync(dirPath, { recursive: true });\n node_fs_1.default.writeFileSync(node_path_1.default.join(dirPath, '.gitkeep'), '');\n const phaseEntry = `\\n### Phase ${decimalPhase}: ${description} (INSERTED)\\n\\n**Goal:** [Urgent work - to be planned]\\n**Requirements**: TBD\\n**Depends on:** Phase ${afterPhase}\\n**Plans:** 0 plans\\n\\nPlans:\\n- [ ] TBD (run /maxsim:plan-phase ${decimalPhase} to break down)\\n`;\n const headerPattern = new RegExp(`(#{2,4}\\\\s*Phase\\\\s+0*${afterPhaseEscaped}:[^\\\\n]*\\\\n)`, 'i');\n const headerMatch = content.match(headerPattern);\n if (!headerMatch) {\n (0, core_js_1.error)(`Could not find Phase ${afterPhase} header`);\n }\n const headerIdx = content.indexOf(headerMatch[0]);\n const afterHeader = content.slice(headerIdx + headerMatch[0].length);\n const nextPhaseMatch = afterHeader.match(/\\n#{2,4}\\s+Phase\\s+\\d/i);\n let insertIdx;\n if (nextPhaseMatch) {\n insertIdx = headerIdx + headerMatch[0].length + nextPhaseMatch.index;\n }\n else {\n insertIdx = content.length;\n }\n const updatedContent = content.slice(0, insertIdx) + phaseEntry + content.slice(insertIdx);\n node_fs_1.default.writeFileSync(roadmapPath, updatedContent, 'utf-8');\n (0, core_js_1.output)({ phase_number: decimalPhase, after_phase: afterPhase, name: description, slug, directory: `.planning/phases/${dirName}` }, raw, decimalPhase);\n}\n// ─── Phase remove ───────────────────────────────────────────────────────────\nfunction cmdPhaseRemove(cwd, targetPhase, options, raw) {\n if (!targetPhase) {\n (0, core_js_1.error)('phase number required for phase remove');\n }\n const roadmapPath = node_path_1.default.join(cwd, '.planning', 'ROADMAP.md');\n const phasesDir = node_path_1.default.join(cwd, '.planning', 'phases');\n const force = options.force || false;\n if (!node_fs_1.default.existsSync(roadmapPath)) {\n (0, core_js_1.error)('ROADMAP.md not found');\n }\n const normalized = (0, core_js_1.normalizePhaseName)(targetPhase);\n const isDecimal = targetPhase.includes('.');\n let targetDir = null;\n try {\n const entries = node_fs_1.default.readdirSync(phasesDir, { withFileTypes: true });\n const dirs = entries.filter(e => e.isDirectory()).map(e => e.name).sort((a, b) => (0, core_js_1.comparePhaseNum)(a, b));\n targetDir = dirs.find(d => d.startsWith(normalized + '-') || d === normalized) || null;\n }\n catch (e) {\n /* optional op, ignore */\n if (process.env.MAXSIM_DEBUG)\n console.error(e);\n }\n if (targetDir && !force) {\n const targetPath = node_path_1.default.join(phasesDir, targetDir);\n const files = node_fs_1.default.readdirSync(targetPath);\n const summaries = files.filter(f => f.endsWith('-SUMMARY.md') || f === 'SUMMARY.md');\n if (summaries.length > 0) {\n (0, core_js_1.error)(`Phase ${targetPhase} has ${summaries.length} executed plan(s). Use --force to remove anyway.`);\n }\n }\n if (targetDir) {\n node_fs_1.default.rmSync(node_path_1.default.join(phasesDir, targetDir), { recursive: true, force: true });\n }\n const renamedDirs = [];\n const renamedFiles = [];\n if (isDecimal) {\n const baseParts = normalized.split('.');\n const baseInt = baseParts[0];\n const removedDecimal = parseInt(baseParts[1], 10);\n try {\n const entries = node_fs_1.default.readdirSync(phasesDir, { withFileTypes: true });\n const dirs = entries.filter(e => e.isDirectory()).map(e => e.name).sort((a, b) => (0, core_js_1.comparePhaseNum)(a, b));\n const decPattern = new RegExp(`^${baseInt}\\\\.(\\\\d+)-(.+)$`);\n const toRename = [];\n for (const dir of dirs) {\n const dm = dir.match(decPattern);\n if (dm && parseInt(dm[1], 10) > removedDecimal) {\n toRename.push({ dir, oldDecimal: parseInt(dm[1], 10), slug: dm[2] });\n }\n }\n toRename.sort((a, b) => b.oldDecimal - a.oldDecimal);\n for (const item of toRename) {\n const newDecimal = item.oldDecimal - 1;\n const oldPhaseId = `${baseInt}.${item.oldDecimal}`;\n const newPhaseId = `${baseInt}.${newDecimal}`;\n const newDirName = `${baseInt}.${newDecimal}-${item.slug}`;\n node_fs_1.default.renameSync(node_path_1.default.join(phasesDir, item.dir), node_path_1.default.join(phasesDir, newDirName));\n renamedDirs.push({ from: item.dir, to: newDirName });\n const dirFiles = node_fs_1.default.readdirSync(node_path_1.default.join(phasesDir, newDirName));\n for (const f of dirFiles) {\n if (f.includes(oldPhaseId)) {\n const newFileName = f.replace(oldPhaseId, newPhaseId);\n node_fs_1.default.renameSync(node_path_1.default.join(phasesDir, newDirName, f), node_path_1.default.join(phasesDir, newDirName, newFileName));\n renamedFiles.push({ from: f, to: newFileName });\n }\n }\n }\n }\n catch (e) {\n /* optional op, ignore */\n if (process.env.MAXSIM_DEBUG)\n console.error(e);\n }\n }\n else {\n const removedInt = parseInt(normalized, 10);\n try {\n const entries = node_fs_1.default.readdirSync(phasesDir, { withFileTypes: true });\n const dirs = entries.filter(e => e.isDirectory()).map(e => e.name).sort((a, b) => (0, core_js_1.comparePhaseNum)(a, b));\n const toRename = [];\n for (const dir of dirs) {\n const dm = dir.match(/^(\\d+)([A-Z])?(?:\\.(\\d+))?-(.+)$/i);\n if (!dm)\n continue;\n const dirInt = parseInt(dm[1], 10);\n if (dirInt > removedInt) {\n toRename.push({\n dir,\n oldInt: dirInt,\n letter: dm[2] ? dm[2].toUpperCase() : '',\n decimal: dm[3] ? parseInt(dm[3], 10) : null,\n slug: dm[4],\n });\n }\n }\n toRename.sort((a, b) => {\n if (a.oldInt !== b.oldInt)\n return b.oldInt - a.oldInt;\n return (b.decimal || 0) - (a.decimal || 0);\n });\n for (const item of toRename) {\n const newInt = item.oldInt - 1;\n const newPadded = String(newInt).padStart(2, '0');\n const oldPadded = String(item.oldInt).padStart(2, '0');\n const letterSuffix = item.letter || '';\n const decimalSuffix = item.decimal !== null ? `.${item.decimal}` : '';\n const oldPrefix = `${oldPadded}${letterSuffix}${decimalSuffix}`;\n const newPrefix = `${newPadded}${letterSuffix}${decimalSuffix}`;\n const newDirName = `${newPrefix}-${item.slug}`;\n node_fs_1.default.renameSync(node_path_1.default.join(phasesDir, item.dir), node_path_1.default.join(phasesDir, newDirName));\n renamedDirs.push({ from: item.dir, to: newDirName });\n const dirFiles = node_fs_1.default.readdirSync(node_path_1.default.join(phasesDir, newDirName));\n for (const f of dirFiles) {\n if (f.startsWith(oldPrefix)) {\n const newFileName = newPrefix + f.slice(oldPrefix.length);\n node_fs_1.default.renameSync(node_path_1.default.join(phasesDir, newDirName, f), node_path_1.default.join(phasesDir, newDirName, newFileName));\n renamedFiles.push({ from: f, to: newFileName });\n }\n }\n }\n }\n catch (e) {\n /* optional op, ignore */\n if (process.env.MAXSIM_DEBUG)\n console.error(e);\n }\n }\n // Update ROADMAP.md\n let roadmapContent = node_fs_1.default.readFileSync(roadmapPath, 'utf-8');\n const targetEscaped = targetPhase.replace(/\\./g, '\\\\.');\n const sectionPattern = new RegExp(`\\\\n?#{2,4}\\\\s*Phase\\\\s+${targetEscaped}\\\\s*:[\\\\s\\\\S]*?(?=\\\\n#{2,4}\\\\s+Phase\\\\s+\\\\d|$)`, 'i');\n roadmapContent = roadmapContent.replace(sectionPattern, '');\n const checkboxPattern = new RegExp(`\\\\n?-\\\\s*\\\\[[ x]\\\\]\\\\s*.*Phase\\\\s+${targetEscaped}[:\\\\s][^\\\\n]*`, 'gi');\n roadmapContent = roadmapContent.replace(checkboxPattern, '');\n const tableRowPattern = new RegExp(`\\\\n?\\\\|\\\\s*${targetEscaped}\\\\.?\\\\s[^|]*\\\\|[^\\\\n]*`, 'gi');\n roadmapContent = roadmapContent.replace(tableRowPattern, '');\n if (!isDecimal) {\n const removedInt = parseInt(normalized, 10);\n const maxPhase = 99;\n for (let oldNum = maxPhase; oldNum > removedInt; oldNum--) {\n const newNum = oldNum - 1;\n const oldStr = String(oldNum);\n const newStr = String(newNum);\n const oldPad = oldStr.padStart(2, '0');\n const newPad = newStr.padStart(2, '0');\n roadmapContent = roadmapContent.replace(new RegExp(`(#{2,4}\\\\s*Phase\\\\s+)${oldStr}(\\\\s*:)`, 'gi'), `$1${newStr}$2`);\n roadmapContent = roadmapContent.replace(new RegExp(`(Phase\\\\s+)${oldStr}([:\\\\s])`, 'g'), `$1${newStr}$2`);\n roadmapContent = roadmapContent.replace(new RegExp(`${oldPad}-(\\\\d{2})`, 'g'), `${newPad}-$1`);\n roadmapContent = roadmapContent.replace(new RegExp(`(\\\\|\\\\s*)${oldStr}\\\\.\\\\s`, 'g'), `$1${newStr}. `);\n roadmapContent = roadmapContent.replace(new RegExp(`(Depends on:\\\\*\\\\*\\\\s*Phase\\\\s+)${oldStr}\\\\b`, 'gi'), `$1${newStr}`);\n }\n }\n node_fs_1.default.writeFileSync(roadmapPath, roadmapContent, 'utf-8');\n // Update STATE.md phase count\n const statePath = node_path_1.default.join(cwd, '.planning', 'STATE.md');\n if (node_fs_1.default.existsSync(statePath)) {\n let stateContent = node_fs_1.default.readFileSync(statePath, 'utf-8');\n const totalPattern = /(\\*\\*Total Phases:\\*\\*\\s*)(\\d+)/;\n const totalMatch = stateContent.match(totalPattern);\n if (totalMatch) {\n const oldTotal = parseInt(totalMatch[2], 10);\n stateContent = stateContent.replace(totalPattern, `$1${oldTotal - 1}`);\n }\n const ofPattern = /(\\bof\\s+)(\\d+)(\\s*(?:\\(|phases?))/i;\n const ofMatch = stateContent.match(ofPattern);\n if (ofMatch) {\n const oldTotal = parseInt(ofMatch[2], 10);\n stateContent = stateContent.replace(ofPattern, `$1${oldTotal - 1}$3`);\n }\n node_fs_1.default.writeFileSync(statePath, stateContent, 'utf-8');\n }\n (0, core_js_1.output)({\n removed: targetPhase,\n directory_deleted: targetDir || null,\n renamed_directories: renamedDirs,\n renamed_files: renamedFiles,\n roadmap_updated: true,\n state_updated: node_fs_1.default.existsSync(statePath),\n }, raw);\n}\n// ─── Phase complete ─────────────────────────────────────────────────────────\nfunction cmdPhaseComplete(cwd, phaseNum, raw) {\n if (!phaseNum) {\n (0, core_js_1.error)('phase number required for phase complete');\n }\n const roadmapPath = node_path_1.default.join(cwd, '.planning', 'ROADMAP.md');\n const statePath = node_path_1.default.join(cwd, '.planning', 'STATE.md');\n const phasesDir = node_path_1.default.join(cwd, '.planning', 'phases');\n const normalized = (0, core_js_1.normalizePhaseName)(phaseNum);\n const today = new Date().toISOString().split('T')[0];\n const phaseInfo = (0, core_js_1.findPhaseInternal)(cwd, phaseNum);\n if (!phaseInfo) {\n (0, core_js_1.error)(`Phase ${phaseNum} not found`);\n }\n const planCount = phaseInfo.plans.length;\n const summaryCount = phaseInfo.summaries.length;\n if (node_fs_1.default.existsSync(roadmapPath)) {\n let roadmapContent = node_fs_1.default.readFileSync(roadmapPath, 'utf-8');\n const checkboxPattern = new RegExp(`(-\\\\s*\\\\[)[ ](\\\\]\\\\s*.*Phase\\\\s+${phaseNum.replace('.', '\\\\.')}[:\\\\s][^\\\\n]*)`, 'i');\n roadmapContent = roadmapContent.replace(checkboxPattern, `$1x$2 (completed ${today})`);\n const phaseEscaped = phaseNum.replace('.', '\\\\.');\n const tablePattern = new RegExp(`(\\\\|\\\\s*${phaseEscaped}\\\\.?\\\\s[^|]*\\\\|[^|]*\\\\|)\\\\s*[^|]*(\\\\|)\\\\s*[^|]*(\\\\|)`, 'i');\n roadmapContent = roadmapContent.replace(tablePattern, `$1 Complete $2 ${today} $3`);\n const planCountPattern = new RegExp(`(#{2,4}\\\\s*Phase\\\\s+${phaseEscaped}[\\\\s\\\\S]*?\\\\*\\\\*Plans:\\\\*\\\\*\\\\s*)[^\\\\n]+`, 'i');\n roadmapContent = roadmapContent.replace(planCountPattern, `$1${summaryCount}/${planCount} plans complete`);\n node_fs_1.default.writeFileSync(roadmapPath, roadmapContent, 'utf-8');\n // Update REQUIREMENTS.md\n const reqPath = node_path_1.default.join(cwd, '.planning', 'REQUIREMENTS.md');\n if (node_fs_1.default.existsSync(reqPath)) {\n const reqMatch = roadmapContent.match(new RegExp(`Phase\\\\s+${phaseNum.replace('.', '\\\\.')}[\\\\s\\\\S]*?\\\\*\\\\*Requirements:\\\\*\\\\*\\\\s*([^\\\\n]+)`, 'i'));\n if (reqMatch) {\n const reqIds = reqMatch[1].replace(/[\\[\\]]/g, '').split(/[,\\s]+/).map(r => r.trim()).filter(Boolean);\n let reqContent = node_fs_1.default.readFileSync(reqPath, 'utf-8');\n for (const reqId of reqIds) {\n reqContent = reqContent.replace(new RegExp(`(-\\\\s*\\\\[)[ ](\\\\]\\\\s*\\\\*\\\\*${reqId}\\\\*\\\\*)`, 'gi'), '$1x$2');\n reqContent = reqContent.replace(new RegExp(`(\\\\|\\\\s*${reqId}\\\\s*\\\\|[^|]+\\\\|)\\\\s*Pending\\\\s*(\\\\|)`, 'gi'), '$1 Complete $2');\n }\n node_fs_1.default.writeFileSync(reqPath, reqContent, 'utf-8');\n }\n }\n }\n // Find next phase\n let nextPhaseNum = null;\n let nextPhaseName = null;\n let isLastPhase = true;\n try {\n const entries = node_fs_1.default.readdirSync(phasesDir, { withFileTypes: true });\n const dirs = entries.filter(e => e.isDirectory()).map(e => e.name).sort((a, b) => (0, core_js_1.comparePhaseNum)(a, b));\n for (const dir of dirs) {\n const dm = dir.match(/^(\\d+[A-Z]?(?:\\.\\d+)?)-?(.*)/i);\n if (dm) {\n if ((0, core_js_1.comparePhaseNum)(dm[1], phaseNum) > 0) {\n nextPhaseNum = dm[1];\n nextPhaseName = dm[2] || null;\n isLastPhase = false;\n break;\n }\n }\n }\n }\n catch (e) {\n /* optional op, ignore */\n if (process.env.MAXSIM_DEBUG)\n console.error(e);\n }\n // Update STATE.md\n if (node_fs_1.default.existsSync(statePath)) {\n let stateContent = node_fs_1.default.readFileSync(statePath, 'utf-8');\n stateContent = stateContent.replace(/(\\*\\*Current Phase:\\*\\*\\s*).*/, `$1${nextPhaseNum || phaseNum}`);\n if (nextPhaseName) {\n stateContent = stateContent.replace(/(\\*\\*Current Phase Name:\\*\\*\\s*).*/, `$1${nextPhaseName.replace(/-/g, ' ')}`);\n }\n stateContent = stateContent.replace(/(\\*\\*Status:\\*\\*\\s*).*/, `$1${isLastPhase ? 'Milestone complete' : 'Ready to plan'}`);\n stateContent = stateContent.replace(/(\\*\\*Current Plan:\\*\\*\\s*).*/, `$1Not started`);\n stateContent = stateContent.replace(/(\\*\\*Last Activity:\\*\\*\\s*).*/, `$1${today}`);\n stateContent = stateContent.replace(/(\\*\\*Last Activity Description:\\*\\*\\s*).*/, `$1Phase ${phaseNum} complete${nextPhaseNum ? `, transitioned to Phase ${nextPhaseNum}` : ''}`);\n node_fs_1.default.writeFileSync(statePath, stateContent, 'utf-8');\n }\n (0, core_js_1.output)({\n completed_phase: phaseNum,\n phase_name: phaseInfo.phase_name,\n plans_executed: `${summaryCount}/${planCount}`,\n next_phase: nextPhaseNum,\n next_phase_name: nextPhaseName,\n is_last_phase: isLastPhase,\n date: today,\n roadmap_updated: node_fs_1.default.existsSync(roadmapPath),\n state_updated: node_fs_1.default.existsSync(statePath),\n }, raw);\n}\n//# sourceMappingURL=phase.js.map","\"use strict\";\n/**\n * Template — Template selection and fill operations\n *\n * Ported from maxsim/bin/lib/template.cjs\n */\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.cmdTemplateSelect = cmdTemplateSelect;\nexports.cmdTemplateFill = cmdTemplateFill;\nconst node_fs_1 = __importDefault(require(\"node:fs\"));\nconst node_path_1 = __importDefault(require(\"node:path\"));\nconst core_js_1 = require(\"./core.js\");\nconst frontmatter_js_1 = require(\"./frontmatter.js\");\n// ─── Template Select ─────────────────────────────────────────────────────────\nfunction cmdTemplateSelect(cwd, planPath, raw) {\n if (!planPath) {\n (0, core_js_1.error)('plan-path required');\n }\n try {\n const fullPath = node_path_1.default.join(cwd, planPath);\n const content = node_fs_1.default.readFileSync(fullPath, 'utf-8');\n const taskMatch = content.match(/###\\s*Task\\s*\\d+/g) || [];\n const taskCount = taskMatch.length;\n const decisionMatch = content.match(/decision/gi) || [];\n const hasDecisions = decisionMatch.length > 0;\n const fileMentions = new Set();\n const filePattern = /`([^`]+\\.[a-zA-Z]+)`/g;\n let m;\n while ((m = filePattern.exec(content)) !== null) {\n if (m[1].includes('/') && !m[1].startsWith('http')) {\n fileMentions.add(m[1]);\n }\n }\n const fileCount = fileMentions.size;\n let template = 'templates/summary-standard.md';\n let type = 'standard';\n if (taskCount <= 2 && fileCount <= 3 && !hasDecisions) {\n template = 'templates/summary-minimal.md';\n type = 'minimal';\n }\n else if (hasDecisions || fileCount > 6 || taskCount > 5) {\n template = 'templates/summary-complex.md';\n type = 'complex';\n }\n const result = { template, type, taskCount, fileCount, hasDecisions };\n (0, core_js_1.output)(result, raw, template);\n }\n catch (thrown) {\n const selectErr = thrown;\n (0, core_js_1.output)({ template: 'templates/summary-standard.md', type: 'standard', error: selectErr.message }, raw, 'templates/summary-standard.md');\n }\n}\n// ─── Template Fill ───────────────────────────────────────────────────────────\nfunction cmdTemplateFill(cwd, templateType, options, raw) {\n if (!templateType) {\n (0, core_js_1.error)('template type required: summary, plan, or verification');\n }\n if (!options.phase) {\n (0, core_js_1.error)('--phase required');\n }\n const phaseInfo = (0, core_js_1.findPhaseInternal)(cwd, options.phase);\n if (!phaseInfo) {\n (0, core_js_1.output)({ error: 'Phase not found', phase: options.phase }, raw);\n return;\n }\n const padded = (0, core_js_1.normalizePhaseName)(options.phase);\n const today = new Date().toISOString().split('T')[0];\n const phaseName = options.name || phaseInfo.phase_name || 'Unnamed';\n const phaseSlug = phaseInfo.phase_slug || (0, core_js_1.generateSlugInternal)(phaseName);\n const phaseId = `${padded}-${phaseSlug}`;\n const planNum = (options.plan || '01').padStart(2, '0');\n const fields = options.fields || {};\n let frontmatter;\n let body;\n let fileName;\n switch (templateType) {\n case 'summary': {\n frontmatter = {\n phase: phaseId,\n plan: planNum,\n subsystem: '[primary category]',\n tags: [],\n provides: [],\n affects: [],\n 'tech-stack': { added: [], patterns: [] },\n 'key-files': { created: [], modified: [] },\n 'key-decisions': [],\n 'patterns-established': [],\n duration: '[X]min',\n completed: today,\n ...fields,\n };\n body = [\n `# Phase ${options.phase}: ${phaseName} Summary`,\n '',\n '**[Substantive one-liner describing outcome]**',\n '',\n '## Performance',\n '- **Duration:** [time]',\n '- **Tasks:** [count completed]',\n '- **Files modified:** [count]',\n '',\n '## Accomplishments',\n '- [Key outcome 1]',\n '- [Key outcome 2]',\n '',\n '## Task Commits',\n '1. **Task 1: [task name]** - `hash`',\n '',\n '## Files Created/Modified',\n '- `path/to/file.ts` - What it does',\n '',\n '## Decisions & Deviations',\n '[Key decisions or \"None - followed plan as specified\"]',\n '',\n '## Next Phase Readiness',\n '[What\\'s ready for next phase]',\n ].join('\\n');\n fileName = `${padded}-${planNum}-SUMMARY.md`;\n break;\n }\n case 'plan': {\n const planType = options.type || 'execute';\n const wave = parseInt(options.wave || '1') || 1;\n frontmatter = {\n phase: phaseId,\n plan: planNum,\n type: planType,\n wave,\n depends_on: [],\n files_modified: [],\n autonomous: true,\n user_setup: [],\n must_haves: { truths: [], artifacts: [], key_links: [] },\n ...fields,\n };\n body = [\n `# Phase ${options.phase} Plan ${planNum}: [Title]`,\n '',\n '## Objective',\n '- **What:** [What this plan builds]',\n '- **Why:** [Why it matters for the phase goal]',\n '- **Output:** [Concrete deliverable]',\n '',\n '## Context',\n '@.planning/PROJECT.md',\n '@.planning/ROADMAP.md',\n '@.planning/STATE.md',\n '',\n '## Tasks',\n '',\n '<task type=\"code\">',\n ' <name>[Task name]</name>',\n ' <files>[file paths]</files>',\n ' <action>[What to do]</action>',\n ' <verify>[How to verify]</verify>',\n ' <done>[Definition of done]</done>',\n '</task>',\n '',\n '## Verification',\n '[How to verify this plan achieved its objective]',\n '',\n '## Success Criteria',\n '- [ ] [Criterion 1]',\n '- [ ] [Criterion 2]',\n ].join('\\n');\n fileName = `${padded}-${planNum}-PLAN.md`;\n break;\n }\n case 'verification': {\n frontmatter = {\n phase: phaseId,\n verified: new Date().toISOString(),\n status: 'pending',\n score: '0/0 must-haves verified',\n ...fields,\n };\n body = [\n `# Phase ${options.phase}: ${phaseName} — Verification`,\n '',\n '## Observable Truths',\n '| # | Truth | Status | Evidence |',\n '|---|-------|--------|----------|',\n '| 1 | [Truth] | pending | |',\n '',\n '## Required Artifacts',\n '| Artifact | Expected | Status | Details |',\n '|----------|----------|--------|---------|',\n '| [path] | [what] | pending | |',\n '',\n '## Key Link Verification',\n '| From | To | Via | Status | Details |',\n '|------|----|----|--------|---------|',\n '| [source] | [target] | [connection] | pending | |',\n '',\n '## Requirements Coverage',\n '| Requirement | Status | Blocking Issue |',\n '|-------------|--------|----------------|',\n '| [req] | pending | |',\n '',\n '## Result',\n '[Pending verification]',\n ].join('\\n');\n fileName = `${padded}-VERIFICATION.md`;\n break;\n }\n default:\n (0, core_js_1.error)(`Unknown template type: ${templateType}. Available: summary, plan, verification`);\n return;\n }\n const fullContent = `---\\n${(0, frontmatter_js_1.reconstructFrontmatter)(frontmatter)}\\n---\\n\\n${body}\\n`;\n const outPath = node_path_1.default.join(cwd, phaseInfo.directory, fileName);\n if (node_fs_1.default.existsSync(outPath)) {\n (0, core_js_1.output)({ error: 'File already exists', path: node_path_1.default.relative(cwd, outPath) }, raw);\n return;\n }\n node_fs_1.default.writeFileSync(outPath, fullContent, 'utf-8');\n const relPath = node_path_1.default.relative(cwd, outPath);\n const result = { created: true, path: relPath, template: templateType };\n (0, core_js_1.output)(result, raw, relPath);\n}\n//# sourceMappingURL=template.js.map","\"use strict\";\n/**\n * Init — Compound init commands for workflow bootstrapping\n *\n * Ported from maxsim/bin/lib/init.cjs\n */\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.cmdInitExecutePhase = cmdInitExecutePhase;\nexports.cmdInitPlanPhase = cmdInitPlanPhase;\nexports.cmdInitNewProject = cmdInitNewProject;\nexports.cmdInitNewMilestone = cmdInitNewMilestone;\nexports.cmdInitQuick = cmdInitQuick;\nexports.cmdInitResume = cmdInitResume;\nexports.cmdInitVerifyWork = cmdInitVerifyWork;\nexports.cmdInitPhaseOp = cmdInitPhaseOp;\nexports.cmdInitTodos = cmdInitTodos;\nexports.cmdInitMilestoneOp = cmdInitMilestoneOp;\nexports.cmdInitMapCodebase = cmdInitMapCodebase;\nexports.cmdInitProgress = cmdInitProgress;\nconst node_fs_1 = __importDefault(require(\"node:fs\"));\nconst node_path_1 = __importDefault(require(\"node:path\"));\nconst node_os_1 = __importDefault(require(\"node:os\"));\nconst node_child_process_1 = require(\"node:child_process\");\nconst core_js_1 = require(\"./core.js\");\n// ─── Helper: extract requirement IDs from roadmap phase section ─────────────\nfunction extractReqIds(cwd, phase) {\n const roadmapPhase = (0, core_js_1.getRoadmapPhaseInternal)(cwd, phase);\n const reqMatch = roadmapPhase?.section?.match(/^\\*\\*Requirements\\*\\*:[^\\S\\n]*([^\\n]*)$/m);\n const reqExtracted = reqMatch\n ? reqMatch[1].replace(/[\\[\\]]/g, '').split(',').map((s) => s.trim()).filter(Boolean).join(', ')\n : null;\n return (reqExtracted && reqExtracted !== 'TBD') ? reqExtracted : null;\n}\nfunction scanPhaseArtifacts(cwd, phaseDirectory) {\n const result = {};\n const phaseDirFull = node_path_1.default.join(cwd, phaseDirectory);\n try {\n const files = node_fs_1.default.readdirSync(phaseDirFull);\n const contextFile = files.find(f => f.endsWith('-CONTEXT.md') || f === 'CONTEXT.md');\n if (contextFile) {\n result.context_path = node_path_1.default.join(phaseDirectory, contextFile);\n }\n const researchFile = files.find(f => f.endsWith('-RESEARCH.md') || f === 'RESEARCH.md');\n if (researchFile) {\n result.research_path = node_path_1.default.join(phaseDirectory, researchFile);\n }\n const verificationFile = files.find(f => f.endsWith('-VERIFICATION.md') || f === 'VERIFICATION.md');\n if (verificationFile) {\n result.verification_path = node_path_1.default.join(phaseDirectory, verificationFile);\n }\n const uatFile = files.find(f => f.endsWith('-UAT.md') || f === 'UAT.md');\n if (uatFile) {\n result.uat_path = node_path_1.default.join(phaseDirectory, uatFile);\n }\n }\n catch { /* ignore */ }\n return result;\n}\n// ─── Init commands ──────────────────────────────────────────────────────────\nfunction cmdInitExecutePhase(cwd, phase, raw) {\n if (!phase) {\n (0, core_js_1.error)('phase required for init execute-phase');\n }\n const config = (0, core_js_1.loadConfig)(cwd);\n const phaseInfo = (0, core_js_1.findPhaseInternal)(cwd, phase);\n const milestone = (0, core_js_1.getMilestoneInfo)(cwd);\n const phase_req_ids = extractReqIds(cwd, phase);\n const result = {\n executor_model: (0, core_js_1.resolveModelInternal)(cwd, 'maxsim-executor'),\n verifier_model: (0, core_js_1.resolveModelInternal)(cwd, 'maxsim-verifier'),\n commit_docs: config.commit_docs,\n parallelization: config.parallelization,\n branching_strategy: config.branching_strategy,\n phase_branch_template: config.phase_branch_template,\n milestone_branch_template: config.milestone_branch_template,\n verifier_enabled: config.verifier,\n phase_found: !!phaseInfo,\n phase_dir: phaseInfo?.directory ?? null,\n phase_number: phaseInfo?.phase_number ?? null,\n phase_name: phaseInfo?.phase_name ?? null,\n phase_slug: phaseInfo?.phase_slug ?? null,\n phase_req_ids,\n plans: phaseInfo?.plans ?? [],\n summaries: phaseInfo?.summaries ?? [],\n incomplete_plans: phaseInfo?.incomplete_plans ?? [],\n plan_count: phaseInfo?.plans?.length ?? 0,\n incomplete_count: phaseInfo?.incomplete_plans?.length ?? 0,\n branch_name: config.branching_strategy === 'phase' && phaseInfo\n ? config.phase_branch_template\n .replace('{phase}', phaseInfo.phase_number)\n .replace('{slug}', phaseInfo.phase_slug || 'phase')\n : config.branching_strategy === 'milestone'\n ? config.milestone_branch_template\n .replace('{milestone}', milestone.version)\n .replace('{slug}', (0, core_js_1.generateSlugInternal)(milestone.name) || 'milestone')\n : null,\n milestone_version: milestone.version,\n milestone_name: milestone.name,\n milestone_slug: (0, core_js_1.generateSlugInternal)(milestone.name),\n state_exists: (0, core_js_1.pathExistsInternal)(cwd, '.planning/STATE.md'),\n roadmap_exists: (0, core_js_1.pathExistsInternal)(cwd, '.planning/ROADMAP.md'),\n config_exists: (0, core_js_1.pathExistsInternal)(cwd, '.planning/config.json'),\n state_path: '.planning/STATE.md',\n roadmap_path: '.planning/ROADMAP.md',\n config_path: '.planning/config.json',\n };\n (0, core_js_1.output)(result, raw);\n}\nfunction cmdInitPlanPhase(cwd, phase, raw) {\n if (!phase) {\n (0, core_js_1.error)('phase required for init plan-phase');\n }\n const config = (0, core_js_1.loadConfig)(cwd);\n const phaseInfo = (0, core_js_1.findPhaseInternal)(cwd, phase);\n const phase_req_ids = extractReqIds(cwd, phase);\n const result = {\n researcher_model: (0, core_js_1.resolveModelInternal)(cwd, 'maxsim-phase-researcher'),\n planner_model: (0, core_js_1.resolveModelInternal)(cwd, 'maxsim-planner'),\n checker_model: (0, core_js_1.resolveModelInternal)(cwd, 'maxsim-plan-checker'),\n research_enabled: config.research,\n plan_checker_enabled: config.plan_checker,\n nyquist_validation_enabled: false, // config doesn't have nyquist_validation directly\n commit_docs: config.commit_docs,\n phase_found: !!phaseInfo,\n phase_dir: phaseInfo?.directory ?? null,\n phase_number: phaseInfo?.phase_number ?? null,\n phase_name: phaseInfo?.phase_name ?? null,\n phase_slug: phaseInfo?.phase_slug ?? null,\n padded_phase: phaseInfo?.phase_number?.padStart(2, '0') ?? null,\n phase_req_ids,\n has_research: phaseInfo?.has_research ?? false,\n has_context: phaseInfo?.has_context ?? false,\n has_plans: (phaseInfo?.plans?.length ?? 0) > 0,\n plan_count: phaseInfo?.plans?.length ?? 0,\n planning_exists: (0, core_js_1.pathExistsInternal)(cwd, '.planning'),\n roadmap_exists: (0, core_js_1.pathExistsInternal)(cwd, '.planning/ROADMAP.md'),\n state_path: '.planning/STATE.md',\n roadmap_path: '.planning/ROADMAP.md',\n requirements_path: '.planning/REQUIREMENTS.md',\n };\n if (phaseInfo?.directory) {\n const artifacts = scanPhaseArtifacts(cwd, phaseInfo.directory);\n if (artifacts.context_path)\n result.context_path = artifacts.context_path;\n if (artifacts.research_path)\n result.research_path = artifacts.research_path;\n if (artifacts.verification_path)\n result.verification_path = artifacts.verification_path;\n if (artifacts.uat_path)\n result.uat_path = artifacts.uat_path;\n }\n (0, core_js_1.output)(result, raw);\n}\nfunction cmdInitNewProject(cwd, raw) {\n const config = (0, core_js_1.loadConfig)(cwd);\n const homedir = node_os_1.default.homedir();\n const braveKeyFile = node_path_1.default.join(homedir, '.maxsim', 'brave_api_key');\n const hasBraveSearch = !!(process.env.BRAVE_API_KEY || node_fs_1.default.existsSync(braveKeyFile));\n let hasCode = false;\n let hasPackageFile = false;\n try {\n const files = (0, node_child_process_1.execSync)('find . -maxdepth 3 \\\\( -name \"*.ts\" -o -name \"*.js\" -o -name \"*.py\" -o -name \"*.go\" -o -name \"*.rs\" -o -name \"*.swift\" -o -name \"*.java\" \\\\) 2>/dev/null | grep -v node_modules | grep -v .git | head -5', {\n cwd,\n encoding: 'utf-8',\n stdio: ['pipe', 'pipe', 'pipe'],\n });\n hasCode = files.trim().length > 0;\n }\n catch { /* ignore */ }\n hasPackageFile = (0, core_js_1.pathExistsInternal)(cwd, 'package.json') ||\n (0, core_js_1.pathExistsInternal)(cwd, 'requirements.txt') ||\n (0, core_js_1.pathExistsInternal)(cwd, 'Cargo.toml') ||\n (0, core_js_1.pathExistsInternal)(cwd, 'go.mod') ||\n (0, core_js_1.pathExistsInternal)(cwd, 'Package.swift');\n const result = {\n researcher_model: (0, core_js_1.resolveModelInternal)(cwd, 'maxsim-project-researcher'),\n synthesizer_model: (0, core_js_1.resolveModelInternal)(cwd, 'maxsim-research-synthesizer'),\n roadmapper_model: (0, core_js_1.resolveModelInternal)(cwd, 'maxsim-roadmapper'),\n commit_docs: config.commit_docs,\n project_exists: (0, core_js_1.pathExistsInternal)(cwd, '.planning/PROJECT.md'),\n has_codebase_map: (0, core_js_1.pathExistsInternal)(cwd, '.planning/codebase'),\n planning_exists: (0, core_js_1.pathExistsInternal)(cwd, '.planning'),\n has_existing_code: hasCode,\n has_package_file: hasPackageFile,\n is_brownfield: hasCode || hasPackageFile,\n needs_codebase_map: (hasCode || hasPackageFile) && !(0, core_js_1.pathExistsInternal)(cwd, '.planning/codebase'),\n has_git: (0, core_js_1.pathExistsInternal)(cwd, '.git'),\n brave_search_available: hasBraveSearch,\n project_path: '.planning/PROJECT.md',\n };\n (0, core_js_1.output)(result, raw);\n}\nfunction cmdInitNewMilestone(cwd, raw) {\n const config = (0, core_js_1.loadConfig)(cwd);\n const milestone = (0, core_js_1.getMilestoneInfo)(cwd);\n const result = {\n researcher_model: (0, core_js_1.resolveModelInternal)(cwd, 'maxsim-project-researcher'),\n synthesizer_model: (0, core_js_1.resolveModelInternal)(cwd, 'maxsim-research-synthesizer'),\n roadmapper_model: (0, core_js_1.resolveModelInternal)(cwd, 'maxsim-roadmapper'),\n commit_docs: config.commit_docs,\n research_enabled: config.research,\n current_milestone: milestone.version,\n current_milestone_name: milestone.name,\n project_exists: (0, core_js_1.pathExistsInternal)(cwd, '.planning/PROJECT.md'),\n roadmap_exists: (0, core_js_1.pathExistsInternal)(cwd, '.planning/ROADMAP.md'),\n state_exists: (0, core_js_1.pathExistsInternal)(cwd, '.planning/STATE.md'),\n project_path: '.planning/PROJECT.md',\n roadmap_path: '.planning/ROADMAP.md',\n state_path: '.planning/STATE.md',\n };\n (0, core_js_1.output)(result, raw);\n}\nfunction cmdInitQuick(cwd, description, raw) {\n const config = (0, core_js_1.loadConfig)(cwd);\n const now = new Date();\n const slug = description ? (0, core_js_1.generateSlugInternal)(description)?.substring(0, 40) ?? null : null;\n const quickDir = node_path_1.default.join(cwd, '.planning', 'quick');\n let nextNum = 1;\n try {\n const existing = node_fs_1.default.readdirSync(quickDir)\n .filter(f => /^\\d+-/.test(f))\n .map(f => parseInt(f.split('-')[0], 10))\n .filter(n => !isNaN(n));\n if (existing.length > 0) {\n nextNum = Math.max(...existing) + 1;\n }\n }\n catch { /* ignore */ }\n const result = {\n planner_model: (0, core_js_1.resolveModelInternal)(cwd, 'maxsim-planner'),\n executor_model: (0, core_js_1.resolveModelInternal)(cwd, 'maxsim-executor'),\n checker_model: (0, core_js_1.resolveModelInternal)(cwd, 'maxsim-plan-checker'),\n verifier_model: (0, core_js_1.resolveModelInternal)(cwd, 'maxsim-verifier'),\n commit_docs: config.commit_docs,\n next_num: nextNum,\n slug,\n description: description ?? null,\n date: now.toISOString().split('T')[0],\n timestamp: now.toISOString(),\n quick_dir: '.planning/quick',\n task_dir: slug ? `.planning/quick/${nextNum}-${slug}` : null,\n roadmap_exists: (0, core_js_1.pathExistsInternal)(cwd, '.planning/ROADMAP.md'),\n planning_exists: (0, core_js_1.pathExistsInternal)(cwd, '.planning'),\n };\n (0, core_js_1.output)(result, raw);\n}\nfunction cmdInitResume(cwd, raw) {\n const config = (0, core_js_1.loadConfig)(cwd);\n let interruptedAgentId = null;\n try {\n interruptedAgentId = node_fs_1.default.readFileSync(node_path_1.default.join(cwd, '.planning', 'current-agent-id.txt'), 'utf-8').trim();\n }\n catch { /* ignore */ }\n const result = {\n state_exists: (0, core_js_1.pathExistsInternal)(cwd, '.planning/STATE.md'),\n roadmap_exists: (0, core_js_1.pathExistsInternal)(cwd, '.planning/ROADMAP.md'),\n project_exists: (0, core_js_1.pathExistsInternal)(cwd, '.planning/PROJECT.md'),\n planning_exists: (0, core_js_1.pathExistsInternal)(cwd, '.planning'),\n state_path: '.planning/STATE.md',\n roadmap_path: '.planning/ROADMAP.md',\n project_path: '.planning/PROJECT.md',\n has_interrupted_agent: !!interruptedAgentId,\n interrupted_agent_id: interruptedAgentId,\n commit_docs: config.commit_docs,\n };\n (0, core_js_1.output)(result, raw);\n}\nfunction cmdInitVerifyWork(cwd, phase, raw) {\n if (!phase) {\n (0, core_js_1.error)('phase required for init verify-work');\n }\n const config = (0, core_js_1.loadConfig)(cwd);\n const phaseInfo = (0, core_js_1.findPhaseInternal)(cwd, phase);\n const result = {\n planner_model: (0, core_js_1.resolveModelInternal)(cwd, 'maxsim-planner'),\n checker_model: (0, core_js_1.resolveModelInternal)(cwd, 'maxsim-plan-checker'),\n commit_docs: config.commit_docs,\n phase_found: !!phaseInfo,\n phase_dir: phaseInfo?.directory ?? null,\n phase_number: phaseInfo?.phase_number ?? null,\n phase_name: phaseInfo?.phase_name ?? null,\n has_verification: phaseInfo?.has_verification ?? false,\n };\n (0, core_js_1.output)(result, raw);\n}\nfunction cmdInitPhaseOp(cwd, phase, raw) {\n const config = (0, core_js_1.loadConfig)(cwd);\n let phaseInfo = (0, core_js_1.findPhaseInternal)(cwd, phase ?? '');\n if (!phaseInfo) {\n const roadmapPhase = (0, core_js_1.getRoadmapPhaseInternal)(cwd, phase ?? '');\n if (roadmapPhase?.found) {\n const phaseName = roadmapPhase.phase_name;\n phaseInfo = {\n found: true,\n directory: '', // no directory yet\n phase_number: roadmapPhase.phase_number,\n phase_name: phaseName,\n phase_slug: phaseName ? phaseName.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '') : null,\n plans: [],\n summaries: [],\n incomplete_plans: [],\n has_research: false,\n has_context: false,\n has_verification: false,\n };\n }\n }\n const result = {\n commit_docs: config.commit_docs,\n brave_search: config.brave_search,\n phase_found: !!phaseInfo,\n phase_dir: phaseInfo?.directory || null,\n phase_number: phaseInfo?.phase_number ?? null,\n phase_name: phaseInfo?.phase_name ?? null,\n phase_slug: phaseInfo?.phase_slug ?? null,\n padded_phase: phaseInfo?.phase_number?.padStart(2, '0') ?? null,\n has_research: phaseInfo?.has_research ?? false,\n has_context: phaseInfo?.has_context ?? false,\n has_plans: (phaseInfo?.plans?.length ?? 0) > 0,\n has_verification: phaseInfo?.has_verification ?? false,\n plan_count: phaseInfo?.plans?.length ?? 0,\n roadmap_exists: (0, core_js_1.pathExistsInternal)(cwd, '.planning/ROADMAP.md'),\n planning_exists: (0, core_js_1.pathExistsInternal)(cwd, '.planning'),\n state_path: '.planning/STATE.md',\n roadmap_path: '.planning/ROADMAP.md',\n requirements_path: '.planning/REQUIREMENTS.md',\n };\n if (phaseInfo?.directory) {\n const artifacts = scanPhaseArtifacts(cwd, phaseInfo.directory);\n if (artifacts.context_path)\n result.context_path = artifacts.context_path;\n if (artifacts.research_path)\n result.research_path = artifacts.research_path;\n if (artifacts.verification_path)\n result.verification_path = artifacts.verification_path;\n if (artifacts.uat_path)\n result.uat_path = artifacts.uat_path;\n }\n (0, core_js_1.output)(result, raw);\n}\nfunction cmdInitTodos(cwd, area, raw) {\n const config = (0, core_js_1.loadConfig)(cwd);\n const now = new Date();\n const pendingDir = node_path_1.default.join(cwd, '.planning', 'todos', 'pending');\n let count = 0;\n const todos = [];\n try {\n const files = node_fs_1.default.readdirSync(pendingDir).filter(f => f.endsWith('.md'));\n for (const file of files) {\n try {\n const content = node_fs_1.default.readFileSync(node_path_1.default.join(pendingDir, file), 'utf-8');\n const createdMatch = content.match(/^created:\\s*(.+)$/m);\n const titleMatch = content.match(/^title:\\s*(.+)$/m);\n const areaMatch = content.match(/^area:\\s*(.+)$/m);\n const todoArea = areaMatch ? areaMatch[1].trim() : 'general';\n if (area && todoArea !== area)\n continue;\n count++;\n todos.push({\n file,\n created: createdMatch ? createdMatch[1].trim() : 'unknown',\n title: titleMatch ? titleMatch[1].trim() : 'Untitled',\n area: todoArea,\n path: node_path_1.default.join('.planning', 'todos', 'pending', file),\n });\n }\n catch { /* ignore */ }\n }\n }\n catch { /* ignore */ }\n const result = {\n commit_docs: config.commit_docs,\n date: now.toISOString().split('T')[0],\n timestamp: now.toISOString(),\n todo_count: count,\n todos,\n area_filter: area ?? null,\n pending_dir: '.planning/todos/pending',\n completed_dir: '.planning/todos/completed',\n planning_exists: (0, core_js_1.pathExistsInternal)(cwd, '.planning'),\n todos_dir_exists: (0, core_js_1.pathExistsInternal)(cwd, '.planning/todos'),\n pending_dir_exists: (0, core_js_1.pathExistsInternal)(cwd, '.planning/todos/pending'),\n };\n (0, core_js_1.output)(result, raw);\n}\nfunction cmdInitMilestoneOp(cwd, raw) {\n const config = (0, core_js_1.loadConfig)(cwd);\n const milestone = (0, core_js_1.getMilestoneInfo)(cwd);\n let phaseCount = 0;\n let completedPhases = 0;\n const phasesDir = node_path_1.default.join(cwd, '.planning', 'phases');\n try {\n const entries = node_fs_1.default.readdirSync(phasesDir, { withFileTypes: true });\n const dirs = entries.filter(e => e.isDirectory()).map(e => e.name);\n phaseCount = dirs.length;\n for (const dir of dirs) {\n try {\n const phaseFiles = node_fs_1.default.readdirSync(node_path_1.default.join(phasesDir, dir));\n const hasSummary = phaseFiles.some(f => f.endsWith('-SUMMARY.md') || f === 'SUMMARY.md');\n if (hasSummary)\n completedPhases++;\n }\n catch { /* ignore */ }\n }\n }\n catch { /* ignore */ }\n const archiveDir = node_path_1.default.join(cwd, '.planning', 'archive');\n let archivedMilestones = [];\n try {\n archivedMilestones = node_fs_1.default.readdirSync(archiveDir, { withFileTypes: true })\n .filter(e => e.isDirectory())\n .map(e => e.name);\n }\n catch { /* ignore */ }\n const result = {\n commit_docs: config.commit_docs,\n milestone_version: milestone.version,\n milestone_name: milestone.name,\n milestone_slug: (0, core_js_1.generateSlugInternal)(milestone.name),\n phase_count: phaseCount,\n completed_phases: completedPhases,\n all_phases_complete: phaseCount > 0 && phaseCount === completedPhases,\n archived_milestones: archivedMilestones,\n archive_count: archivedMilestones.length,\n project_exists: (0, core_js_1.pathExistsInternal)(cwd, '.planning/PROJECT.md'),\n roadmap_exists: (0, core_js_1.pathExistsInternal)(cwd, '.planning/ROADMAP.md'),\n state_exists: (0, core_js_1.pathExistsInternal)(cwd, '.planning/STATE.md'),\n archive_exists: (0, core_js_1.pathExistsInternal)(cwd, '.planning/archive'),\n phases_dir_exists: (0, core_js_1.pathExistsInternal)(cwd, '.planning/phases'),\n };\n (0, core_js_1.output)(result, raw);\n}\nfunction cmdInitMapCodebase(cwd, raw) {\n const config = (0, core_js_1.loadConfig)(cwd);\n const codebaseDir = node_path_1.default.join(cwd, '.planning', 'codebase');\n let existingMaps = [];\n try {\n existingMaps = node_fs_1.default.readdirSync(codebaseDir).filter(f => f.endsWith('.md'));\n }\n catch { /* ignore */ }\n const result = {\n mapper_model: (0, core_js_1.resolveModelInternal)(cwd, 'maxsim-codebase-mapper'),\n commit_docs: config.commit_docs,\n search_gitignored: config.search_gitignored,\n parallelization: config.parallelization,\n codebase_dir: '.planning/codebase',\n existing_maps: existingMaps,\n has_maps: existingMaps.length > 0,\n planning_exists: (0, core_js_1.pathExistsInternal)(cwd, '.planning'),\n codebase_dir_exists: (0, core_js_1.pathExistsInternal)(cwd, '.planning/codebase'),\n };\n (0, core_js_1.output)(result, raw);\n}\nfunction cmdInitProgress(cwd, raw) {\n const config = (0, core_js_1.loadConfig)(cwd);\n const milestone = (0, core_js_1.getMilestoneInfo)(cwd);\n const phasesDir = node_path_1.default.join(cwd, '.planning', 'phases');\n const phases = [];\n let currentPhase = null;\n let nextPhase = null;\n try {\n const entries = node_fs_1.default.readdirSync(phasesDir, { withFileTypes: true });\n const dirs = entries.filter(e => e.isDirectory()).map(e => e.name).sort();\n for (const dir of dirs) {\n const match = dir.match(/^(\\d+(?:\\.\\d+)?)-?(.*)/);\n const phaseNumber = match ? match[1] : dir;\n const phaseName = match && match[2] ? match[2] : null;\n const phasePath = node_path_1.default.join(phasesDir, dir);\n const phaseFiles = node_fs_1.default.readdirSync(phasePath);\n const plans = phaseFiles.filter(f => f.endsWith('-PLAN.md') || f === 'PLAN.md');\n const summaries = phaseFiles.filter(f => f.endsWith('-SUMMARY.md') || f === 'SUMMARY.md');\n const hasResearch = phaseFiles.some(f => f.endsWith('-RESEARCH.md') || f === 'RESEARCH.md');\n const status = summaries.length >= plans.length && plans.length > 0 ? 'complete' :\n plans.length > 0 ? 'in_progress' :\n hasResearch ? 'researched' : 'pending';\n const phaseInfo = {\n number: phaseNumber,\n name: phaseName,\n directory: node_path_1.default.join('.planning', 'phases', dir),\n status,\n plan_count: plans.length,\n summary_count: summaries.length,\n has_research: hasResearch,\n };\n phases.push(phaseInfo);\n if (!currentPhase && (status === 'in_progress' || status === 'researched')) {\n currentPhase = phaseInfo;\n }\n if (!nextPhase && status === 'pending') {\n nextPhase = phaseInfo;\n }\n }\n }\n catch { /* ignore */ }\n let pausedAt = null;\n try {\n const state = node_fs_1.default.readFileSync(node_path_1.default.join(cwd, '.planning', 'STATE.md'), 'utf-8');\n const pauseMatch = state.match(/\\*\\*Paused At:\\*\\*\\s*(.+)/);\n if (pauseMatch)\n pausedAt = pauseMatch[1].trim();\n }\n catch { /* ignore */ }\n const result = {\n executor_model: (0, core_js_1.resolveModelInternal)(cwd, 'maxsim-executor'),\n planner_model: (0, core_js_1.resolveModelInternal)(cwd, 'maxsim-planner'),\n commit_docs: config.commit_docs,\n milestone_version: milestone.version,\n milestone_name: milestone.name,\n phases,\n phase_count: phases.length,\n completed_count: phases.filter(p => p.status === 'complete').length,\n in_progress_count: phases.filter(p => p.status === 'in_progress').length,\n current_phase: currentPhase,\n next_phase: nextPhase,\n paused_at: pausedAt,\n has_work_in_progress: !!currentPhase,\n project_exists: (0, core_js_1.pathExistsInternal)(cwd, '.planning/PROJECT.md'),\n roadmap_exists: (0, core_js_1.pathExistsInternal)(cwd, '.planning/ROADMAP.md'),\n state_exists: (0, core_js_1.pathExistsInternal)(cwd, '.planning/STATE.md'),\n state_path: '.planning/STATE.md',\n roadmap_path: '.planning/ROADMAP.md',\n project_path: '.planning/PROJECT.md',\n config_path: '.planning/config.json',\n };\n (0, core_js_1.output)(result, raw);\n}\n//# sourceMappingURL=init.js.map","\"use strict\";\n/**\n * @maxsim/core — Shared utilities, constants, and type definitions\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.cmdRoadmapGetPhase = exports.cmdStateSnapshot = exports.cmdStateRecordSession = exports.cmdStateResolveBlocker = exports.cmdStateAddBlocker = exports.cmdStateAddDecision = exports.cmdStateUpdateProgress = exports.cmdStateRecordMetric = exports.cmdStateAdvancePlan = exports.cmdStateUpdate = exports.cmdStatePatch = exports.cmdStateGet = exports.cmdStateLoad = exports.stateReplaceField = exports.stateExtractField = exports.cmdConfigGet = exports.cmdConfigSet = exports.cmdConfigEnsureSection = exports.cmdFrontmatterValidate = exports.cmdFrontmatterMerge = exports.cmdFrontmatterSet = exports.cmdFrontmatterGet = exports.FRONTMATTER_SCHEMAS = exports.parseMustHavesBlock = exports.spliceFrontmatter = exports.reconstructFrontmatter = exports.extractFrontmatter = exports.getMilestoneInfo = exports.generateSlugInternal = exports.pathExistsInternal = exports.resolveModelInternal = exports.getRoadmapPhaseInternal = exports.getArchivedPhaseDirs = exports.findPhaseInternal = exports.getPhasePattern = exports.comparePhaseNum = exports.normalizePhaseName = exports.execGit = exports.isGitIgnored = exports.loadConfig = exports.safeReadFile = exports.error = exports.output = exports.MODEL_PROFILES = exports.PLANNING_CONFIG_DEFAULTS = exports.err = exports.ok = exports.phaseSlug = exports.phasePath = exports.phaseNumber = void 0;\nexports.cmdInitProgress = exports.cmdInitMapCodebase = exports.cmdInitMilestoneOp = exports.cmdInitTodos = exports.cmdInitPhaseOp = exports.cmdInitVerifyWork = exports.cmdInitResume = exports.cmdInitQuick = exports.cmdInitNewMilestone = exports.cmdInitNewProject = exports.cmdInitPlanPhase = exports.cmdInitExecutePhase = exports.cmdTemplateFill = exports.cmdTemplateSelect = exports.cmdPhaseComplete = exports.cmdPhaseRemove = exports.cmdPhaseInsert = exports.cmdPhaseAdd = exports.cmdPhasePlanIndex = exports.cmdFindPhase = exports.cmdPhaseNextDecimal = exports.cmdPhasesList = exports.cmdValidateHealth = exports.cmdValidateConsistency = exports.cmdVerifyKeyLinks = exports.cmdVerifyArtifacts = exports.cmdVerifyCommits = exports.cmdVerifyReferences = exports.cmdVerifyPhaseCompleteness = exports.cmdVerifyPlanStructure = exports.cmdVerifySummary = exports.cmdScaffold = exports.cmdTodoComplete = exports.cmdProgressRender = exports.cmdWebsearch = exports.cmdSummaryExtract = exports.cmdCommit = exports.cmdResolveModel = exports.cmdHistoryDigest = exports.cmdVerifyPathExists = exports.cmdListTodos = exports.cmdCurrentTimestamp = exports.cmdGenerateSlug = exports.cmdMilestoneComplete = exports.cmdRequirementsMarkComplete = exports.cmdRoadmapUpdatePlanProgress = exports.cmdRoadmapAnalyze = void 0;\n// Runtime value exports from types\nvar types_js_1 = require(\"./types.js\");\nObject.defineProperty(exports, \"phaseNumber\", { enumerable: true, get: function () { return types_js_1.phaseNumber; } });\nObject.defineProperty(exports, \"phasePath\", { enumerable: true, get: function () { return types_js_1.phasePath; } });\nObject.defineProperty(exports, \"phaseSlug\", { enumerable: true, get: function () { return types_js_1.phaseSlug; } });\nObject.defineProperty(exports, \"ok\", { enumerable: true, get: function () { return types_js_1.ok; } });\nObject.defineProperty(exports, \"err\", { enumerable: true, get: function () { return types_js_1.err; } });\nObject.defineProperty(exports, \"PLANNING_CONFIG_DEFAULTS\", { enumerable: true, get: function () { return types_js_1.PLANNING_CONFIG_DEFAULTS; } });\n// Runtime exports from core\nvar core_js_1 = require(\"./core.js\");\nObject.defineProperty(exports, \"MODEL_PROFILES\", { enumerable: true, get: function () { return core_js_1.MODEL_PROFILES; } });\nObject.defineProperty(exports, \"output\", { enumerable: true, get: function () { return core_js_1.output; } });\nObject.defineProperty(exports, \"error\", { enumerable: true, get: function () { return core_js_1.error; } });\nObject.defineProperty(exports, \"safeReadFile\", { enumerable: true, get: function () { return core_js_1.safeReadFile; } });\nObject.defineProperty(exports, \"loadConfig\", { enumerable: true, get: function () { return core_js_1.loadConfig; } });\nObject.defineProperty(exports, \"isGitIgnored\", { enumerable: true, get: function () { return core_js_1.isGitIgnored; } });\nObject.defineProperty(exports, \"execGit\", { enumerable: true, get: function () { return core_js_1.execGit; } });\nObject.defineProperty(exports, \"normalizePhaseName\", { enumerable: true, get: function () { return core_js_1.normalizePhaseName; } });\nObject.defineProperty(exports, \"comparePhaseNum\", { enumerable: true, get: function () { return core_js_1.comparePhaseNum; } });\nObject.defineProperty(exports, \"getPhasePattern\", { enumerable: true, get: function () { return core_js_1.getPhasePattern; } });\nObject.defineProperty(exports, \"findPhaseInternal\", { enumerable: true, get: function () { return core_js_1.findPhaseInternal; } });\nObject.defineProperty(exports, \"getArchivedPhaseDirs\", { enumerable: true, get: function () { return core_js_1.getArchivedPhaseDirs; } });\nObject.defineProperty(exports, \"getRoadmapPhaseInternal\", { enumerable: true, get: function () { return core_js_1.getRoadmapPhaseInternal; } });\nObject.defineProperty(exports, \"resolveModelInternal\", { enumerable: true, get: function () { return core_js_1.resolveModelInternal; } });\nObject.defineProperty(exports, \"pathExistsInternal\", { enumerable: true, get: function () { return core_js_1.pathExistsInternal; } });\nObject.defineProperty(exports, \"generateSlugInternal\", { enumerable: true, get: function () { return core_js_1.generateSlugInternal; } });\nObject.defineProperty(exports, \"getMilestoneInfo\", { enumerable: true, get: function () { return core_js_1.getMilestoneInfo; } });\n// Frontmatter exports\nvar frontmatter_js_1 = require(\"./frontmatter.js\");\nObject.defineProperty(exports, \"extractFrontmatter\", { enumerable: true, get: function () { return frontmatter_js_1.extractFrontmatter; } });\nObject.defineProperty(exports, \"reconstructFrontmatter\", { enumerable: true, get: function () { return frontmatter_js_1.reconstructFrontmatter; } });\nObject.defineProperty(exports, \"spliceFrontmatter\", { enumerable: true, get: function () { return frontmatter_js_1.spliceFrontmatter; } });\nObject.defineProperty(exports, \"parseMustHavesBlock\", { enumerable: true, get: function () { return frontmatter_js_1.parseMustHavesBlock; } });\nObject.defineProperty(exports, \"FRONTMATTER_SCHEMAS\", { enumerable: true, get: function () { return frontmatter_js_1.FRONTMATTER_SCHEMAS; } });\nObject.defineProperty(exports, \"cmdFrontmatterGet\", { enumerable: true, get: function () { return frontmatter_js_1.cmdFrontmatterGet; } });\nObject.defineProperty(exports, \"cmdFrontmatterSet\", { enumerable: true, get: function () { return frontmatter_js_1.cmdFrontmatterSet; } });\nObject.defineProperty(exports, \"cmdFrontmatterMerge\", { enumerable: true, get: function () { return frontmatter_js_1.cmdFrontmatterMerge; } });\nObject.defineProperty(exports, \"cmdFrontmatterValidate\", { enumerable: true, get: function () { return frontmatter_js_1.cmdFrontmatterValidate; } });\n// Config exports\nvar config_js_1 = require(\"./config.js\");\nObject.defineProperty(exports, \"cmdConfigEnsureSection\", { enumerable: true, get: function () { return config_js_1.cmdConfigEnsureSection; } });\nObject.defineProperty(exports, \"cmdConfigSet\", { enumerable: true, get: function () { return config_js_1.cmdConfigSet; } });\nObject.defineProperty(exports, \"cmdConfigGet\", { enumerable: true, get: function () { return config_js_1.cmdConfigGet; } });\n// State exports\nvar state_js_1 = require(\"./state.js\");\nObject.defineProperty(exports, \"stateExtractField\", { enumerable: true, get: function () { return state_js_1.stateExtractField; } });\nObject.defineProperty(exports, \"stateReplaceField\", { enumerable: true, get: function () { return state_js_1.stateReplaceField; } });\nObject.defineProperty(exports, \"cmdStateLoad\", { enumerable: true, get: function () { return state_js_1.cmdStateLoad; } });\nObject.defineProperty(exports, \"cmdStateGet\", { enumerable: true, get: function () { return state_js_1.cmdStateGet; } });\nObject.defineProperty(exports, \"cmdStatePatch\", { enumerable: true, get: function () { return state_js_1.cmdStatePatch; } });\nObject.defineProperty(exports, \"cmdStateUpdate\", { enumerable: true, get: function () { return state_js_1.cmdStateUpdate; } });\nObject.defineProperty(exports, \"cmdStateAdvancePlan\", { enumerable: true, get: function () { return state_js_1.cmdStateAdvancePlan; } });\nObject.defineProperty(exports, \"cmdStateRecordMetric\", { enumerable: true, get: function () { return state_js_1.cmdStateRecordMetric; } });\nObject.defineProperty(exports, \"cmdStateUpdateProgress\", { enumerable: true, get: function () { return state_js_1.cmdStateUpdateProgress; } });\nObject.defineProperty(exports, \"cmdStateAddDecision\", { enumerable: true, get: function () { return state_js_1.cmdStateAddDecision; } });\nObject.defineProperty(exports, \"cmdStateAddBlocker\", { enumerable: true, get: function () { return state_js_1.cmdStateAddBlocker; } });\nObject.defineProperty(exports, \"cmdStateResolveBlocker\", { enumerable: true, get: function () { return state_js_1.cmdStateResolveBlocker; } });\nObject.defineProperty(exports, \"cmdStateRecordSession\", { enumerable: true, get: function () { return state_js_1.cmdStateRecordSession; } });\nObject.defineProperty(exports, \"cmdStateSnapshot\", { enumerable: true, get: function () { return state_js_1.cmdStateSnapshot; } });\n// Roadmap exports\nvar roadmap_js_1 = require(\"./roadmap.js\");\nObject.defineProperty(exports, \"cmdRoadmapGetPhase\", { enumerable: true, get: function () { return roadmap_js_1.cmdRoadmapGetPhase; } });\nObject.defineProperty(exports, \"cmdRoadmapAnalyze\", { enumerable: true, get: function () { return roadmap_js_1.cmdRoadmapAnalyze; } });\nObject.defineProperty(exports, \"cmdRoadmapUpdatePlanProgress\", { enumerable: true, get: function () { return roadmap_js_1.cmdRoadmapUpdatePlanProgress; } });\n// Milestone exports\nvar milestone_js_1 = require(\"./milestone.js\");\nObject.defineProperty(exports, \"cmdRequirementsMarkComplete\", { enumerable: true, get: function () { return milestone_js_1.cmdRequirementsMarkComplete; } });\nObject.defineProperty(exports, \"cmdMilestoneComplete\", { enumerable: true, get: function () { return milestone_js_1.cmdMilestoneComplete; } });\n// Commands exports\nvar commands_js_1 = require(\"./commands.js\");\nObject.defineProperty(exports, \"cmdGenerateSlug\", { enumerable: true, get: function () { return commands_js_1.cmdGenerateSlug; } });\nObject.defineProperty(exports, \"cmdCurrentTimestamp\", { enumerable: true, get: function () { return commands_js_1.cmdCurrentTimestamp; } });\nObject.defineProperty(exports, \"cmdListTodos\", { enumerable: true, get: function () { return commands_js_1.cmdListTodos; } });\nObject.defineProperty(exports, \"cmdVerifyPathExists\", { enumerable: true, get: function () { return commands_js_1.cmdVerifyPathExists; } });\nObject.defineProperty(exports, \"cmdHistoryDigest\", { enumerable: true, get: function () { return commands_js_1.cmdHistoryDigest; } });\nObject.defineProperty(exports, \"cmdResolveModel\", { enumerable: true, get: function () { return commands_js_1.cmdResolveModel; } });\nObject.defineProperty(exports, \"cmdCommit\", { enumerable: true, get: function () { return commands_js_1.cmdCommit; } });\nObject.defineProperty(exports, \"cmdSummaryExtract\", { enumerable: true, get: function () { return commands_js_1.cmdSummaryExtract; } });\nObject.defineProperty(exports, \"cmdWebsearch\", { enumerable: true, get: function () { return commands_js_1.cmdWebsearch; } });\nObject.defineProperty(exports, \"cmdProgressRender\", { enumerable: true, get: function () { return commands_js_1.cmdProgressRender; } });\nObject.defineProperty(exports, \"cmdTodoComplete\", { enumerable: true, get: function () { return commands_js_1.cmdTodoComplete; } });\nObject.defineProperty(exports, \"cmdScaffold\", { enumerable: true, get: function () { return commands_js_1.cmdScaffold; } });\nvar verify_js_1 = require(\"./verify.js\");\nObject.defineProperty(exports, \"cmdVerifySummary\", { enumerable: true, get: function () { return verify_js_1.cmdVerifySummary; } });\nObject.defineProperty(exports, \"cmdVerifyPlanStructure\", { enumerable: true, get: function () { return verify_js_1.cmdVerifyPlanStructure; } });\nObject.defineProperty(exports, \"cmdVerifyPhaseCompleteness\", { enumerable: true, get: function () { return verify_js_1.cmdVerifyPhaseCompleteness; } });\nObject.defineProperty(exports, \"cmdVerifyReferences\", { enumerable: true, get: function () { return verify_js_1.cmdVerifyReferences; } });\nObject.defineProperty(exports, \"cmdVerifyCommits\", { enumerable: true, get: function () { return verify_js_1.cmdVerifyCommits; } });\nObject.defineProperty(exports, \"cmdVerifyArtifacts\", { enumerable: true, get: function () { return verify_js_1.cmdVerifyArtifacts; } });\nObject.defineProperty(exports, \"cmdVerifyKeyLinks\", { enumerable: true, get: function () { return verify_js_1.cmdVerifyKeyLinks; } });\nObject.defineProperty(exports, \"cmdValidateConsistency\", { enumerable: true, get: function () { return verify_js_1.cmdValidateConsistency; } });\nObject.defineProperty(exports, \"cmdValidateHealth\", { enumerable: true, get: function () { return verify_js_1.cmdValidateHealth; } });\n// Phase exports\nvar phase_js_1 = require(\"./phase.js\");\nObject.defineProperty(exports, \"cmdPhasesList\", { enumerable: true, get: function () { return phase_js_1.cmdPhasesList; } });\nObject.defineProperty(exports, \"cmdPhaseNextDecimal\", { enumerable: true, get: function () { return phase_js_1.cmdPhaseNextDecimal; } });\nObject.defineProperty(exports, \"cmdFindPhase\", { enumerable: true, get: function () { return phase_js_1.cmdFindPhase; } });\nObject.defineProperty(exports, \"cmdPhasePlanIndex\", { enumerable: true, get: function () { return phase_js_1.cmdPhasePlanIndex; } });\nObject.defineProperty(exports, \"cmdPhaseAdd\", { enumerable: true, get: function () { return phase_js_1.cmdPhaseAdd; } });\nObject.defineProperty(exports, \"cmdPhaseInsert\", { enumerable: true, get: function () { return phase_js_1.cmdPhaseInsert; } });\nObject.defineProperty(exports, \"cmdPhaseRemove\", { enumerable: true, get: function () { return phase_js_1.cmdPhaseRemove; } });\nObject.defineProperty(exports, \"cmdPhaseComplete\", { enumerable: true, get: function () { return phase_js_1.cmdPhaseComplete; } });\nvar template_js_1 = require(\"./template.js\");\nObject.defineProperty(exports, \"cmdTemplateSelect\", { enumerable: true, get: function () { return template_js_1.cmdTemplateSelect; } });\nObject.defineProperty(exports, \"cmdTemplateFill\", { enumerable: true, get: function () { return template_js_1.cmdTemplateFill; } });\nvar init_js_1 = require(\"./init.js\");\nObject.defineProperty(exports, \"cmdInitExecutePhase\", { enumerable: true, get: function () { return init_js_1.cmdInitExecutePhase; } });\nObject.defineProperty(exports, \"cmdInitPlanPhase\", { enumerable: true, get: function () { return init_js_1.cmdInitPlanPhase; } });\nObject.defineProperty(exports, \"cmdInitNewProject\", { enumerable: true, get: function () { return init_js_1.cmdInitNewProject; } });\nObject.defineProperty(exports, \"cmdInitNewMilestone\", { enumerable: true, get: function () { return init_js_1.cmdInitNewMilestone; } });\nObject.defineProperty(exports, \"cmdInitQuick\", { enumerable: true, get: function () { return init_js_1.cmdInitQuick; } });\nObject.defineProperty(exports, \"cmdInitResume\", { enumerable: true, get: function () { return init_js_1.cmdInitResume; } });\nObject.defineProperty(exports, \"cmdInitVerifyWork\", { enumerable: true, get: function () { return init_js_1.cmdInitVerifyWork; } });\nObject.defineProperty(exports, \"cmdInitPhaseOp\", { enumerable: true, get: function () { return init_js_1.cmdInitPhaseOp; } });\nObject.defineProperty(exports, \"cmdInitTodos\", { enumerable: true, get: function () { return init_js_1.cmdInitTodos; } });\nObject.defineProperty(exports, \"cmdInitMilestoneOp\", { enumerable: true, get: function () { return init_js_1.cmdInitMilestoneOp; } });\nObject.defineProperty(exports, \"cmdInitMapCodebase\", { enumerable: true, get: function () { return init_js_1.cmdInitMapCodebase; } });\nObject.defineProperty(exports, \"cmdInitProgress\", { enumerable: true, get: function () { return init_js_1.cmdInitProgress; } });\n//# sourceMappingURL=index.js.map","/**\n * MAXSIM Tools — CLI utility for MAXSIM workflow operations\n *\n * Replaces repetitive inline bash patterns across ~50 MAXSIM command/workflow/agent files.\n * Centralizes: config parsing, model resolution, phase lookup, git commits, summary verification.\n *\n * Usage: node maxsim-tools.cjs <command> [args] [--raw]\n *\n * This is a direct TypeScript port of maxsim/bin/maxsim-tools.cjs.\n * All imports resolve through @maxsim/core barrel export.\n */\n\nimport * as fs from 'node:fs';\nimport * as path from 'node:path';\n\nimport type { TimestampFormat } from '@maxsim/core';\n\nimport {\n // Core\n error,\n // Frontmatter\n extractFrontmatter,\n reconstructFrontmatter,\n spliceFrontmatter,\n parseMustHavesBlock,\n FRONTMATTER_SCHEMAS,\n cmdFrontmatterGet,\n cmdFrontmatterSet,\n cmdFrontmatterMerge,\n cmdFrontmatterValidate,\n // Config\n cmdConfigEnsureSection,\n cmdConfigSet,\n cmdConfigGet,\n // Commands\n cmdGenerateSlug,\n cmdCurrentTimestamp,\n cmdListTodos,\n cmdVerifyPathExists,\n cmdHistoryDigest,\n cmdResolveModel,\n cmdCommit,\n cmdSummaryExtract,\n cmdWebsearch,\n cmdProgressRender,\n cmdTodoComplete,\n cmdScaffold,\n // State\n cmdStateLoad,\n cmdStateGet,\n cmdStatePatch,\n cmdStateUpdate,\n cmdStateAdvancePlan,\n cmdStateRecordMetric,\n cmdStateUpdateProgress,\n cmdStateAddDecision,\n cmdStateAddBlocker,\n cmdStateResolveBlocker,\n cmdStateRecordSession,\n cmdStateSnapshot,\n stateExtractField,\n stateReplaceField,\n // Roadmap\n cmdRoadmapGetPhase,\n cmdRoadmapAnalyze,\n cmdRoadmapUpdatePlanProgress,\n // Milestone\n cmdRequirementsMarkComplete,\n cmdMilestoneComplete,\n // Verify\n cmdVerifySummary,\n cmdVerifyPlanStructure,\n cmdVerifyPhaseCompleteness,\n cmdVerifyReferences,\n cmdVerifyCommits,\n cmdVerifyArtifacts,\n cmdVerifyKeyLinks,\n cmdValidateConsistency,\n cmdValidateHealth,\n // Phase\n cmdPhasesList,\n cmdPhaseNextDecimal,\n cmdFindPhase,\n cmdPhasePlanIndex,\n cmdPhaseAdd,\n cmdPhaseInsert,\n cmdPhaseRemove,\n cmdPhaseComplete,\n // Template\n cmdTemplateSelect,\n cmdTemplateFill,\n // Init\n cmdInitExecutePhase,\n cmdInitPlanPhase,\n cmdInitNewProject,\n cmdInitNewMilestone,\n cmdInitQuick,\n cmdInitResume,\n cmdInitVerifyWork,\n cmdInitPhaseOp,\n cmdInitTodos,\n cmdInitMilestoneOp,\n cmdInitMapCodebase,\n cmdInitProgress,\n} from '@maxsim/core';\n\n/** Helper: extract a named flag's value from args, returning null if absent */\nfunction getFlag(args: string[], flag: string): string | null {\n const idx = args.indexOf(flag);\n return idx !== -1 ? args[idx + 1] : null;\n}\n\n// Namespace groupings for readability (mirrors original CJS structure)\nconst state = { cmdStateLoad, cmdStateGet, cmdStatePatch, cmdStateUpdate, cmdStateAdvancePlan, cmdStateRecordMetric, cmdStateUpdateProgress, cmdStateAddDecision, cmdStateAddBlocker, cmdStateResolveBlocker, cmdStateRecordSession, cmdStateSnapshot, stateExtractField, stateReplaceField };\nconst phase = { cmdPhasesList, cmdPhaseNextDecimal, cmdFindPhase, cmdPhasePlanIndex, cmdPhaseAdd, cmdPhaseInsert, cmdPhaseRemove, cmdPhaseComplete };\nconst roadmap = { cmdRoadmapGetPhase, cmdRoadmapAnalyze, cmdRoadmapUpdatePlanProgress };\nconst verify = { cmdVerifySummary, cmdVerifyPlanStructure, cmdVerifyPhaseCompleteness, cmdVerifyReferences, cmdVerifyCommits, cmdVerifyArtifacts, cmdVerifyKeyLinks, cmdValidateConsistency, cmdValidateHealth };\nconst config = { cmdConfigEnsureSection, cmdConfigSet, cmdConfigGet };\nconst template = { cmdTemplateSelect, cmdTemplateFill };\nconst milestone = { cmdRequirementsMarkComplete, cmdMilestoneComplete };\nconst commands = { cmdGenerateSlug, cmdCurrentTimestamp, cmdListTodos, cmdVerifyPathExists, cmdHistoryDigest, cmdResolveModel, cmdCommit, cmdSummaryExtract, cmdWebsearch, cmdProgressRender, cmdTodoComplete, cmdScaffold };\nconst init = { cmdInitExecutePhase, cmdInitPlanPhase, cmdInitNewProject, cmdInitNewMilestone, cmdInitQuick, cmdInitResume, cmdInitVerifyWork, cmdInitPhaseOp, cmdInitTodos, cmdInitMilestoneOp, cmdInitMapCodebase, cmdInitProgress };\nconst frontmatter = { cmdFrontmatterGet, cmdFrontmatterSet, cmdFrontmatterMerge, cmdFrontmatterValidate, extractFrontmatter, reconstructFrontmatter, spliceFrontmatter, parseMustHavesBlock, FRONTMATTER_SCHEMAS };\n\n// ─── CLI Router ───────────────────────────────────────────────────────────────\n\nasync function main(): Promise<void> {\n const args: string[] = process.argv.slice(2);\n\n // Optional cwd override for sandboxed subagents running outside project root.\n let cwd: string = process.cwd();\n const cwdEqArg = args.find(arg => arg.startsWith('--cwd='));\n const cwdIdx = args.indexOf('--cwd');\n if (cwdEqArg) {\n const value = cwdEqArg.slice('--cwd='.length).trim();\n if (!value) error('Missing value for --cwd');\n args.splice(args.indexOf(cwdEqArg), 1);\n cwd = path.resolve(value);\n } else if (cwdIdx !== -1) {\n const value = args[cwdIdx + 1];\n if (!value || value.startsWith('--')) error('Missing value for --cwd');\n args.splice(cwdIdx, 2);\n cwd = path.resolve(value);\n }\n\n if (!fs.existsSync(cwd) || !fs.statSync(cwd).isDirectory()) {\n error(`Invalid --cwd: ${cwd}`);\n }\n\n const rawIndex = args.indexOf('--raw');\n const raw: boolean = rawIndex !== -1;\n if (rawIndex !== -1) args.splice(rawIndex, 1);\n\n const command: string | undefined = args[0];\n\n if (!command) {\n error('Usage: maxsim-tools <command> [args] [--raw] [--cwd <path>]\\nCommands: state, resolve-model, find-phase, commit, verify-summary, verify, frontmatter, template, generate-slug, current-timestamp, list-todos, verify-path-exists, config-ensure-section, init');\n }\n\n switch (command) {\n case 'state': {\n const subcommand: string | undefined = args[1];\n if (subcommand === 'update') {\n state.cmdStateUpdate(cwd, args[2], args[3]);\n } else if (subcommand === 'get') {\n state.cmdStateGet(cwd, args[2], raw);\n } else if (subcommand === 'patch') {\n const patches: Record<string, string> = {};\n for (let i = 2; i < args.length; i += 2) {\n const key = args[i].replace(/^--/, '');\n const value = args[i + 1];\n if (key && value !== undefined) {\n patches[key] = value;\n }\n }\n state.cmdStatePatch(cwd, patches, raw);\n } else if (subcommand === 'advance-plan') {\n state.cmdStateAdvancePlan(cwd, raw);\n } else if (subcommand === 'record-metric') {\n const phaseIdx = args.indexOf('--phase');\n const planIdx = args.indexOf('--plan');\n const durationIdx = args.indexOf('--duration');\n const tasksIdx = args.indexOf('--tasks');\n const filesIdx = args.indexOf('--files');\n state.cmdStateRecordMetric(cwd, {\n phase: phaseIdx !== -1 ? args[phaseIdx + 1] : '',\n plan: planIdx !== -1 ? args[planIdx + 1] : '',\n duration: durationIdx !== -1 ? args[durationIdx + 1] : '',\n tasks: tasksIdx !== -1 ? args[tasksIdx + 1] : undefined,\n files: filesIdx !== -1 ? args[filesIdx + 1] : undefined,\n }, raw);\n } else if (subcommand === 'update-progress') {\n state.cmdStateUpdateProgress(cwd, raw);\n } else if (subcommand === 'add-decision') {\n const phaseIdx = args.indexOf('--phase');\n const summaryIdx = args.indexOf('--summary');\n const summaryFileIdx = args.indexOf('--summary-file');\n const rationaleIdx = args.indexOf('--rationale');\n const rationaleFileIdx = args.indexOf('--rationale-file');\n state.cmdStateAddDecision(cwd, {\n phase: phaseIdx !== -1 ? args[phaseIdx + 1] : undefined,\n summary: summaryIdx !== -1 ? args[summaryIdx + 1] : undefined,\n summary_file: summaryFileIdx !== -1 ? args[summaryFileIdx + 1] : undefined,\n rationale: rationaleIdx !== -1 ? args[rationaleIdx + 1] : '',\n rationale_file: rationaleFileIdx !== -1 ? args[rationaleFileIdx + 1] : undefined,\n }, raw);\n } else if (subcommand === 'add-blocker') {\n const textIdx = args.indexOf('--text');\n const textFileIdx = args.indexOf('--text-file');\n state.cmdStateAddBlocker(cwd, {\n text: textIdx !== -1 ? args[textIdx + 1] : undefined,\n text_file: textFileIdx !== -1 ? args[textFileIdx + 1] : undefined,\n }, raw);\n } else if (subcommand === 'resolve-blocker') {\n const textIdx = args.indexOf('--text');\n state.cmdStateResolveBlocker(cwd, textIdx !== -1 ? args[textIdx + 1] : null, raw);\n } else if (subcommand === 'record-session') {\n const stoppedIdx = args.indexOf('--stopped-at');\n const resumeIdx = args.indexOf('--resume-file');\n state.cmdStateRecordSession(cwd, {\n stopped_at: stoppedIdx !== -1 ? args[stoppedIdx + 1] : undefined,\n resume_file: resumeIdx !== -1 ? args[resumeIdx + 1] : 'None',\n }, raw);\n } else {\n state.cmdStateLoad(cwd, raw);\n }\n break;\n }\n\n case 'resolve-model': {\n commands.cmdResolveModel(cwd, args[1], raw);\n break;\n }\n\n case 'find-phase': {\n phase.cmdFindPhase(cwd, args[1], raw);\n break;\n }\n\n case 'commit': {\n const amend: boolean = args.includes('--amend');\n const message: string = args[1];\n // Parse --files flag (collect args after --files, stopping at other flags)\n const filesIndex = args.indexOf('--files');\n const files: string[] = filesIndex !== -1 ? args.slice(filesIndex + 1).filter(a => !a.startsWith('--')) : [];\n commands.cmdCommit(cwd, message, files, raw, amend);\n break;\n }\n\n case 'verify-summary': {\n const summaryPath: string = args[1];\n const countIndex = args.indexOf('--check-count');\n const checkCount: number = countIndex !== -1 ? parseInt(args[countIndex + 1], 10) : 2;\n verify.cmdVerifySummary(cwd, summaryPath, checkCount, raw);\n break;\n }\n\n case 'template': {\n const subcommand: string | undefined = args[1];\n if (subcommand === 'select') {\n template.cmdTemplateSelect(cwd, args[2], raw);\n } else if (subcommand === 'fill') {\n const templateType: string = args[2];\n const phaseIdx = args.indexOf('--phase');\n const planIdx = args.indexOf('--plan');\n const nameIdx = args.indexOf('--name');\n const typeIdx = args.indexOf('--type');\n const waveIdx = args.indexOf('--wave');\n const fieldsIdx = args.indexOf('--fields');\n template.cmdTemplateFill(cwd, templateType, {\n phase: phaseIdx !== -1 ? args[phaseIdx + 1] : '',\n plan: planIdx !== -1 ? args[planIdx + 1] : undefined,\n name: nameIdx !== -1 ? args[nameIdx + 1] : undefined,\n type: typeIdx !== -1 ? args[typeIdx + 1] : 'execute',\n wave: waveIdx !== -1 ? args[waveIdx + 1] : '1',\n fields: fieldsIdx !== -1 ? JSON.parse(args[fieldsIdx + 1]) : {},\n }, raw);\n } else {\n error('Unknown template subcommand. Available: select, fill');\n }\n break;\n }\n\n case 'frontmatter': {\n const subcommand: string | undefined = args[1];\n const file: string = args[2];\n if (subcommand === 'get') {\n const fieldIdx = args.indexOf('--field');\n frontmatter.cmdFrontmatterGet(cwd, file, getFlag(args, '--field'), raw);\n } else if (subcommand === 'set') {\n frontmatter.cmdFrontmatterSet(cwd, file, getFlag(args, '--field'), getFlag(args, '--value') ?? undefined, raw);\n } else if (subcommand === 'merge') {\n frontmatter.cmdFrontmatterMerge(cwd, file, getFlag(args, '--data'), raw);\n } else if (subcommand === 'validate') {\n frontmatter.cmdFrontmatterValidate(cwd, file, getFlag(args, '--schema'), raw);\n } else {\n error('Unknown frontmatter subcommand. Available: get, set, merge, validate');\n }\n break;\n }\n\n case 'verify': {\n const subcommand: string | undefined = args[1];\n if (subcommand === 'plan-structure') {\n verify.cmdVerifyPlanStructure(cwd, args[2], raw);\n } else if (subcommand === 'phase-completeness') {\n verify.cmdVerifyPhaseCompleteness(cwd, args[2], raw);\n } else if (subcommand === 'references') {\n verify.cmdVerifyReferences(cwd, args[2], raw);\n } else if (subcommand === 'commits') {\n verify.cmdVerifyCommits(cwd, args.slice(2), raw);\n } else if (subcommand === 'artifacts') {\n verify.cmdVerifyArtifacts(cwd, args[2], raw);\n } else if (subcommand === 'key-links') {\n verify.cmdVerifyKeyLinks(cwd, args[2], raw);\n } else {\n error('Unknown verify subcommand. Available: plan-structure, phase-completeness, references, commits, artifacts, key-links');\n }\n break;\n }\n\n case 'generate-slug': {\n commands.cmdGenerateSlug(args[1], raw);\n break;\n }\n\n case 'current-timestamp': {\n commands.cmdCurrentTimestamp((args[1] || 'full') as TimestampFormat, raw);\n break;\n }\n\n case 'list-todos': {\n commands.cmdListTodos(cwd, args[1], raw);\n break;\n }\n\n case 'verify-path-exists': {\n commands.cmdVerifyPathExists(cwd, args[1], raw);\n break;\n }\n\n case 'config-ensure-section': {\n config.cmdConfigEnsureSection(cwd, raw);\n break;\n }\n\n case 'config-set': {\n config.cmdConfigSet(cwd, args[1], args[2], raw);\n break;\n }\n\n case 'config-get': {\n config.cmdConfigGet(cwd, args[1], raw);\n break;\n }\n\n case 'history-digest': {\n commands.cmdHistoryDigest(cwd, raw);\n break;\n }\n\n case 'phases': {\n const subcommand: string | undefined = args[1];\n if (subcommand === 'list') {\n const typeIndex = args.indexOf('--type');\n const phaseIndex = args.indexOf('--phase');\n const options = {\n type: typeIndex !== -1 ? args[typeIndex + 1] : null,\n phase: phaseIndex !== -1 ? args[phaseIndex + 1] : null,\n includeArchived: args.includes('--include-archived'),\n };\n phase.cmdPhasesList(cwd, options, raw);\n } else {\n error('Unknown phases subcommand. Available: list');\n }\n break;\n }\n\n case 'roadmap': {\n const subcommand: string | undefined = args[1];\n if (subcommand === 'get-phase') {\n roadmap.cmdRoadmapGetPhase(cwd, args[2], raw);\n } else if (subcommand === 'analyze') {\n roadmap.cmdRoadmapAnalyze(cwd, raw);\n } else if (subcommand === 'update-plan-progress') {\n roadmap.cmdRoadmapUpdatePlanProgress(cwd, args[2], raw);\n } else {\n error('Unknown roadmap subcommand. Available: get-phase, analyze, update-plan-progress');\n }\n break;\n }\n\n case 'requirements': {\n const subcommand: string | undefined = args[1];\n if (subcommand === 'mark-complete') {\n milestone.cmdRequirementsMarkComplete(cwd, args.slice(2), raw);\n } else {\n error('Unknown requirements subcommand. Available: mark-complete');\n }\n break;\n }\n\n case 'phase': {\n const subcommand: string | undefined = args[1];\n if (subcommand === 'next-decimal') {\n phase.cmdPhaseNextDecimal(cwd, args[2], raw);\n } else if (subcommand === 'add') {\n phase.cmdPhaseAdd(cwd, args.slice(2).join(' '), raw);\n } else if (subcommand === 'insert') {\n phase.cmdPhaseInsert(cwd, args[2], args.slice(3).join(' '), raw);\n } else if (subcommand === 'remove') {\n const forceFlag: boolean = args.includes('--force');\n phase.cmdPhaseRemove(cwd, args[2], { force: forceFlag }, raw);\n } else if (subcommand === 'complete') {\n phase.cmdPhaseComplete(cwd, args[2], raw);\n } else {\n error('Unknown phase subcommand. Available: next-decimal, add, insert, remove, complete');\n }\n break;\n }\n\n case 'milestone': {\n const subcommand: string | undefined = args[1];\n if (subcommand === 'complete') {\n const nameIndex = args.indexOf('--name');\n const archivePhases: boolean = args.includes('--archive-phases');\n // Collect --name value (everything after --name until next flag or end)\n let milestoneName: string | null = null;\n if (nameIndex !== -1) {\n const nameArgs: string[] = [];\n for (let i = nameIndex + 1; i < args.length; i++) {\n if (args[i].startsWith('--')) break;\n nameArgs.push(args[i]);\n }\n milestoneName = nameArgs.join(' ') || null;\n }\n milestone.cmdMilestoneComplete(cwd, args[2], { name: milestoneName ?? undefined, archivePhases }, raw);\n } else {\n error('Unknown milestone subcommand. Available: complete');\n }\n break;\n }\n\n case 'validate': {\n const subcommand: string | undefined = args[1];\n if (subcommand === 'consistency') {\n verify.cmdValidateConsistency(cwd, raw);\n } else if (subcommand === 'health') {\n const repairFlag: boolean = args.includes('--repair');\n verify.cmdValidateHealth(cwd, { repair: repairFlag }, raw);\n } else {\n error('Unknown validate subcommand. Available: consistency, health');\n }\n break;\n }\n\n case 'progress': {\n const subcommand: string = args[1] || 'json';\n commands.cmdProgressRender(cwd, subcommand, raw);\n break;\n }\n\n case 'todo': {\n const subcommand: string | undefined = args[1];\n if (subcommand === 'complete') {\n commands.cmdTodoComplete(cwd, args[2], raw);\n } else {\n error('Unknown todo subcommand. Available: complete');\n }\n break;\n }\n\n case 'scaffold': {\n const scaffoldType: string = args[1];\n const phaseIndex = args.indexOf('--phase');\n const nameIndex = args.indexOf('--name');\n const scaffoldOptions = {\n phase: phaseIndex !== -1 ? args[phaseIndex + 1] : null,\n name: nameIndex !== -1 ? args.slice(nameIndex + 1).join(' ') : null,\n };\n commands.cmdScaffold(cwd, scaffoldType, scaffoldOptions, raw);\n break;\n }\n\n case 'init': {\n const workflow: string | undefined = args[1];\n switch (workflow) {\n case 'execute-phase':\n init.cmdInitExecutePhase(cwd, args[2], raw);\n break;\n case 'plan-phase':\n init.cmdInitPlanPhase(cwd, args[2], raw);\n break;\n case 'new-project':\n init.cmdInitNewProject(cwd, raw);\n break;\n case 'new-milestone':\n init.cmdInitNewMilestone(cwd, raw);\n break;\n case 'quick':\n init.cmdInitQuick(cwd, args.slice(2).join(' '), raw);\n break;\n case 'resume':\n init.cmdInitResume(cwd, raw);\n break;\n case 'verify-work':\n init.cmdInitVerifyWork(cwd, args[2], raw);\n break;\n case 'phase-op':\n init.cmdInitPhaseOp(cwd, args[2], raw);\n break;\n case 'todos':\n init.cmdInitTodos(cwd, args[2], raw);\n break;\n case 'milestone-op':\n init.cmdInitMilestoneOp(cwd, raw);\n break;\n case 'map-codebase':\n init.cmdInitMapCodebase(cwd, raw);\n break;\n case 'progress':\n init.cmdInitProgress(cwd, raw);\n break;\n default:\n error(`Unknown init workflow: ${workflow}\\nAvailable: execute-phase, plan-phase, new-project, new-milestone, quick, resume, verify-work, phase-op, todos, milestone-op, map-codebase, progress`);\n }\n break;\n }\n\n case 'phase-plan-index': {\n phase.cmdPhasePlanIndex(cwd, args[1], raw);\n break;\n }\n\n case 'state-snapshot': {\n state.cmdStateSnapshot(cwd, raw);\n break;\n }\n\n case 'summary-extract': {\n const summaryPath: string = args[1];\n const fieldsIndex = args.indexOf('--fields');\n const fields: string[] | null = fieldsIndex !== -1 ? args[fieldsIndex + 1].split(',') : null;\n commands.cmdSummaryExtract(cwd, summaryPath, fields, raw);\n break;\n }\n\n case 'websearch': {\n const query: string = args[1];\n const limitIdx = args.indexOf('--limit');\n const freshnessIdx = args.indexOf('--freshness');\n await commands.cmdWebsearch(query, {\n limit: limitIdx !== -1 ? parseInt(args[limitIdx + 1], 10) : 10,\n freshness: freshnessIdx !== -1 ? args[freshnessIdx + 1] : undefined,\n }, raw);\n break;\n }\n\n default:\n error(`Unknown command: ${command}`);\n }\n}\n\nmain();\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,QAAO,eAAe,SAAS,cAAc,EAAE,OAAO,MAAM,CAAC;AAC7D,SAAQ,2BAA2B,KAAK;AACxC,SAAQ,cAAc;AACtB,SAAQ,YAAY;AACpB,SAAQ,YAAY;AACpB,SAAQ,KAAK;AACb,SAAQ,MAAM;CACd,SAAS,YAAY,OAAO;AAExB,MAAI,CADU,MAAM,MAAM,uBAAuB,CAE7C,OAAM,IAAI,MAAM,yBAAyB,QAAQ;AAErD,SAAO;;CAEX,SAAS,UAAU,OAAO;AACtB,MAAI,CAAC,SAAS,OAAO,UAAU,SAC3B,OAAM,IAAI,MAAM,uBAAuB,QAAQ;AAEnD,SAAO;;CAEX,SAAS,UAAU,OAAO;AACtB,MAAI,CAAC,SAAS,OAAO,UAAU,SAC3B,OAAM,IAAI,MAAM,uBAAuB,QAAQ;AAEnD,SAAO;;CAEX,SAAS,GAAG,MAAM;AACd,SAAO;GAAE,SAAS;GAAM;GAAM;;CAElC,SAAS,IAAI,OAAO;AAChB,SAAO;GAAE,SAAS;GA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