maxsimcli 4.3.1 → 4.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.tsbuildinfo +1 -1
- package/dist/assets/CHANGELOG.md +26 -0
- package/dist/assets/dashboard/server.js +248 -240
- package/dist/assets/templates/agents/AGENTS.md +68 -0
- package/dist/assets/templates/agents/maxsim-code-reviewer.md +138 -4
- package/dist/assets/templates/agents/maxsim-codebase-mapper.md +94 -7
- package/dist/assets/templates/agents/maxsim-debugger.md +124 -0
- package/dist/assets/templates/agents/maxsim-drift-checker.md +522 -0
- package/dist/assets/templates/agents/maxsim-executor.md +213 -8
- package/dist/assets/templates/agents/maxsim-integration-checker.md +99 -1
- package/dist/assets/templates/agents/maxsim-phase-researcher.md +83 -4
- package/dist/assets/templates/agents/maxsim-plan-checker.md +99 -4
- package/dist/assets/templates/agents/maxsim-planner.md +97 -0
- package/dist/assets/templates/agents/maxsim-project-researcher.md +82 -0
- package/dist/assets/templates/agents/maxsim-research-synthesizer.md +81 -0
- package/dist/assets/templates/agents/maxsim-roadmapper.md +85 -0
- package/dist/assets/templates/agents/maxsim-spec-reviewer.md +141 -4
- package/dist/assets/templates/agents/maxsim-verifier.md +102 -4
- package/dist/assets/templates/commands/maxsim/check-drift.md +56 -0
- package/dist/assets/templates/commands/maxsim/discuss.md +70 -0
- package/dist/assets/templates/commands/maxsim/realign.md +39 -0
- package/dist/assets/templates/workflows/check-drift.md +248 -0
- package/dist/assets/templates/workflows/discuss.md +343 -0
- package/dist/assets/templates/workflows/execute-phase.md +10 -6
- package/dist/assets/templates/workflows/progress.md +8 -0
- package/dist/assets/templates/workflows/quick.md +110 -0
- package/dist/assets/templates/workflows/realign.md +288 -0
- package/dist/assets/templates/workflows/roadmap.md +69 -20
- package/dist/backend-server.cjs +52 -29
- package/dist/backend-server.cjs.map +1 -1
- package/dist/cli.cjs +407 -5
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +26 -1
- package/dist/cli.js.map +1 -1
- package/dist/core/core.d.ts.map +1 -1
- package/dist/core/core.js +1 -0
- package/dist/core/core.js.map +1 -1
- package/dist/core/drift.d.ts +37 -0
- package/dist/core/drift.d.ts.map +1 -0
- package/dist/core/drift.js +213 -0
- package/dist/core/drift.js.map +1 -0
- package/dist/core/frontmatter.d.ts.map +1 -1
- package/dist/core/frontmatter.js +6 -0
- package/dist/core/frontmatter.js.map +1 -1
- package/dist/core/index.d.ts +3 -2
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +18 -2
- package/dist/core/index.js.map +1 -1
- package/dist/core/init.d.ts +15 -3
- package/dist/core/init.d.ts.map +1 -1
- package/dist/core/init.js +251 -0
- package/dist/core/init.js.map +1 -1
- package/dist/core/types.d.ts +132 -1
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.js.map +1 -1
- package/dist/core-RRjCSt0G.cjs.map +1 -1
- package/dist/{lifecycle-0M4VqOMm.cjs → lifecycle-DxCru7rk.cjs} +2 -2
- package/dist/{lifecycle-0M4VqOMm.cjs.map → lifecycle-DxCru7rk.cjs.map} +1 -1
- package/dist/mcp/phase-tools.d.ts.map +1 -1
- package/dist/mcp/phase-tools.js +17 -4
- package/dist/mcp/phase-tools.js.map +1 -1
- package/dist/mcp-server.cjs +20 -5
- package/dist/mcp-server.cjs.map +1 -1
- package/dist/{server-G1MIg_Oe.cjs → server-By0TN-nC.cjs} +21 -6
- package/dist/server-By0TN-nC.cjs.map +1 -0
- package/dist/skills-MYlMkYNt.cjs.map +1 -1
- package/package.json +1 -1
- package/dist/server-G1MIg_Oe.cjs.map +0 -1
package/dist/cli.cjs
CHANGED
|
@@ -4722,6 +4722,12 @@ const MODEL_PROFILES = {
|
|
|
4722
4722
|
balanced: "sonnet",
|
|
4723
4723
|
budget: "haiku",
|
|
4724
4724
|
tokenburner: "opus"
|
|
4725
|
+
},
|
|
4726
|
+
"maxsim-drift-checker": {
|
|
4727
|
+
quality: "sonnet",
|
|
4728
|
+
balanced: "sonnet",
|
|
4729
|
+
budget: "haiku",
|
|
4730
|
+
tokenburner: "opus"
|
|
4725
4731
|
}
|
|
4726
4732
|
};
|
|
4727
4733
|
/** Thrown by output() to signal successful command completion. */
|
|
@@ -12030,6 +12036,19 @@ const FRONTMATTER_SCHEMAS = {
|
|
|
12030
12036
|
"verified",
|
|
12031
12037
|
"status",
|
|
12032
12038
|
"score"
|
|
12039
|
+
] },
|
|
12040
|
+
review: { required: [
|
|
12041
|
+
"status",
|
|
12042
|
+
"critical_count",
|
|
12043
|
+
"warning_count"
|
|
12044
|
+
] },
|
|
12045
|
+
drift: { required: [
|
|
12046
|
+
"status",
|
|
12047
|
+
"checked",
|
|
12048
|
+
"total_items",
|
|
12049
|
+
"critical_count",
|
|
12050
|
+
"warning_count",
|
|
12051
|
+
"info_count"
|
|
12033
12052
|
] }
|
|
12034
12053
|
};
|
|
12035
12054
|
function cmdFrontmatterGet(cwd, filePath, field) {
|
|
@@ -14559,6 +14578,164 @@ function cmdValidateHealth(cwd, options) {
|
|
|
14559
14578
|
});
|
|
14560
14579
|
}
|
|
14561
14580
|
|
|
14581
|
+
//#endregion
|
|
14582
|
+
//#region src/core/drift.ts
|
|
14583
|
+
/**
|
|
14584
|
+
* Drift — Drift report CRUD, requirement extraction, and spec extraction
|
|
14585
|
+
*
|
|
14586
|
+
* Provides CLI tool commands for the drift-checker agent and realign workflow.
|
|
14587
|
+
*/
|
|
14588
|
+
const DRIFT_REPORT_NAME = "DRIFT-REPORT.md";
|
|
14589
|
+
/**
|
|
14590
|
+
* Read the drift report from .planning/DRIFT-REPORT.md.
|
|
14591
|
+
* Returns parsed frontmatter and body content, or structured error if not found.
|
|
14592
|
+
*/
|
|
14593
|
+
function cmdDriftReadReport(cwd) {
|
|
14594
|
+
const content = safeReadFile(planningPath(cwd, DRIFT_REPORT_NAME));
|
|
14595
|
+
if (!content) return cmdOk({
|
|
14596
|
+
found: false,
|
|
14597
|
+
path: `.planning/${DRIFT_REPORT_NAME}`,
|
|
14598
|
+
error: "Drift report not found"
|
|
14599
|
+
});
|
|
14600
|
+
const frontmatter = extractFrontmatter(content);
|
|
14601
|
+
const bodyMatch = content.match(/^---\n[\s\S]+?\n---\n?([\s\S]*)$/);
|
|
14602
|
+
const body = bodyMatch ? bodyMatch[1].trim() : content;
|
|
14603
|
+
return cmdOk({
|
|
14604
|
+
found: true,
|
|
14605
|
+
path: `.planning/${DRIFT_REPORT_NAME}`,
|
|
14606
|
+
frontmatter,
|
|
14607
|
+
body
|
|
14608
|
+
});
|
|
14609
|
+
}
|
|
14610
|
+
/**
|
|
14611
|
+
* Write content to .planning/DRIFT-REPORT.md.
|
|
14612
|
+
* Supports direct content or reading from a file (tmpfile pattern for large reports).
|
|
14613
|
+
*/
|
|
14614
|
+
function cmdDriftWriteReport(cwd, content, contentFile) {
|
|
14615
|
+
let reportContent;
|
|
14616
|
+
if (contentFile) {
|
|
14617
|
+
const fileContent = safeReadFile(node_path.default.isAbsolute(contentFile) ? contentFile : node_path.default.join(cwd, contentFile));
|
|
14618
|
+
if (!fileContent) return cmdErr(`Content file not found: ${contentFile}`);
|
|
14619
|
+
reportContent = fileContent;
|
|
14620
|
+
} else if (content) reportContent = content;
|
|
14621
|
+
else return cmdErr("Either --content or --content-file is required");
|
|
14622
|
+
const reportPath = planningPath(cwd, DRIFT_REPORT_NAME);
|
|
14623
|
+
const planningDir = planningPath(cwd);
|
|
14624
|
+
if (!node_fs.default.existsSync(planningDir)) return cmdErr(".planning/ directory does not exist");
|
|
14625
|
+
try {
|
|
14626
|
+
node_fs.default.writeFileSync(reportPath, reportContent, "utf-8");
|
|
14627
|
+
return cmdOk({
|
|
14628
|
+
written: true,
|
|
14629
|
+
path: `.planning/${DRIFT_REPORT_NAME}`
|
|
14630
|
+
});
|
|
14631
|
+
} catch (e) {
|
|
14632
|
+
debugLog("drift-write-report-failed", e);
|
|
14633
|
+
return cmdErr(`Failed to write drift report: ${e instanceof Error ? e.message : String(e)}`);
|
|
14634
|
+
}
|
|
14635
|
+
}
|
|
14636
|
+
/**
|
|
14637
|
+
* Extract all requirements from .planning/REQUIREMENTS.md.
|
|
14638
|
+
* Parses requirement lines matching `- [ ] **ID**: description` or `- [x] **ID**: description`.
|
|
14639
|
+
*/
|
|
14640
|
+
function cmdDriftExtractRequirements(cwd) {
|
|
14641
|
+
const content = safeReadFile(planningPath(cwd, "REQUIREMENTS.md"));
|
|
14642
|
+
if (!content) return cmdOk({
|
|
14643
|
+
found: false,
|
|
14644
|
+
path: ".planning/REQUIREMENTS.md",
|
|
14645
|
+
requirements: []
|
|
14646
|
+
});
|
|
14647
|
+
const requirements = [];
|
|
14648
|
+
const lines = content.split("\n");
|
|
14649
|
+
for (let i = 0; i < lines.length; i++) {
|
|
14650
|
+
const match = lines[i].match(/^-\s+\[([ xX])\]\s+\*\*([^*]+)\*\*[:\s]+(.+)/);
|
|
14651
|
+
if (match) requirements.push({
|
|
14652
|
+
id: match[2].trim(),
|
|
14653
|
+
description: match[3].trim(),
|
|
14654
|
+
complete: match[1].toLowerCase() === "x",
|
|
14655
|
+
line_number: i + 1
|
|
14656
|
+
});
|
|
14657
|
+
}
|
|
14658
|
+
return cmdOk({
|
|
14659
|
+
found: true,
|
|
14660
|
+
path: ".planning/REQUIREMENTS.md",
|
|
14661
|
+
count: requirements.length,
|
|
14662
|
+
requirements
|
|
14663
|
+
});
|
|
14664
|
+
}
|
|
14665
|
+
/**
|
|
14666
|
+
* Extract no-go rules from .planning/NO-GOS.md.
|
|
14667
|
+
* Returns array of no-go items with section context, or empty if file missing.
|
|
14668
|
+
*/
|
|
14669
|
+
function cmdDriftExtractNoGos(cwd) {
|
|
14670
|
+
const content = safeReadFile(planningPath(cwd, "NO-GOS.md"));
|
|
14671
|
+
if (!content) return cmdOk({
|
|
14672
|
+
found: false,
|
|
14673
|
+
path: ".planning/NO-GOS.md",
|
|
14674
|
+
nogos: []
|
|
14675
|
+
});
|
|
14676
|
+
const nogos = [];
|
|
14677
|
+
const lines = content.split("\n");
|
|
14678
|
+
let currentSection = "General";
|
|
14679
|
+
for (let i = 0; i < lines.length; i++) {
|
|
14680
|
+
const line = lines[i];
|
|
14681
|
+
const headingMatch = line.match(/^#{2,3}\s+(.+)/);
|
|
14682
|
+
if (headingMatch) {
|
|
14683
|
+
currentSection = headingMatch[1].trim();
|
|
14684
|
+
continue;
|
|
14685
|
+
}
|
|
14686
|
+
const bulletMatch = line.match(/^\s*[-*]\s+(.+)/);
|
|
14687
|
+
if (bulletMatch) {
|
|
14688
|
+
const ruleText = bulletMatch[1].trim();
|
|
14689
|
+
if (ruleText.length > 5) nogos.push({
|
|
14690
|
+
rule: ruleText,
|
|
14691
|
+
section: currentSection,
|
|
14692
|
+
line_number: i + 1
|
|
14693
|
+
});
|
|
14694
|
+
}
|
|
14695
|
+
}
|
|
14696
|
+
return cmdOk({
|
|
14697
|
+
found: true,
|
|
14698
|
+
path: ".planning/NO-GOS.md",
|
|
14699
|
+
count: nogos.length,
|
|
14700
|
+
nogos
|
|
14701
|
+
});
|
|
14702
|
+
}
|
|
14703
|
+
/**
|
|
14704
|
+
* Read .planning/CONVENTIONS.md and return its full content.
|
|
14705
|
+
* Returns the raw content for agent analysis, or null if missing.
|
|
14706
|
+
*/
|
|
14707
|
+
function cmdDriftExtractConventions(cwd) {
|
|
14708
|
+
const content = safeReadFile(planningPath(cwd, "CONVENTIONS.md"));
|
|
14709
|
+
if (!content) return cmdOk({
|
|
14710
|
+
found: false,
|
|
14711
|
+
path: ".planning/CONVENTIONS.md",
|
|
14712
|
+
content: null
|
|
14713
|
+
});
|
|
14714
|
+
return cmdOk({
|
|
14715
|
+
found: true,
|
|
14716
|
+
path: ".planning/CONVENTIONS.md",
|
|
14717
|
+
content
|
|
14718
|
+
});
|
|
14719
|
+
}
|
|
14720
|
+
/**
|
|
14721
|
+
* Read existing DRIFT-REPORT.md frontmatter for diff tracking.
|
|
14722
|
+
* Returns previous_hash and checked date, or null if no report exists.
|
|
14723
|
+
*/
|
|
14724
|
+
function cmdDriftPreviousHash(cwd) {
|
|
14725
|
+
const content = safeReadFile(planningPath(cwd, DRIFT_REPORT_NAME));
|
|
14726
|
+
if (!content) return cmdOk({
|
|
14727
|
+
found: false,
|
|
14728
|
+
hash: null,
|
|
14729
|
+
checked_date: null
|
|
14730
|
+
});
|
|
14731
|
+
const frontmatter = extractFrontmatter(content);
|
|
14732
|
+
return cmdOk({
|
|
14733
|
+
found: true,
|
|
14734
|
+
hash: frontmatter.previous_hash ?? null,
|
|
14735
|
+
checked_date: frontmatter.checked ?? null
|
|
14736
|
+
});
|
|
14737
|
+
}
|
|
14738
|
+
|
|
14562
14739
|
//#endregion
|
|
14563
14740
|
//#region src/core/phase.ts
|
|
14564
14741
|
/**
|
|
@@ -16696,6 +16873,210 @@ function cmdInitProgress(cwd) {
|
|
|
16696
16873
|
config_path: ".planning/config.json"
|
|
16697
16874
|
});
|
|
16698
16875
|
}
|
|
16876
|
+
/**
|
|
16877
|
+
* Scan .planning/codebase/ for .md files and return relative paths.
|
|
16878
|
+
* Returns empty array if the directory does not exist.
|
|
16879
|
+
*/
|
|
16880
|
+
function listCodebaseDocs(cwd) {
|
|
16881
|
+
const codebaseDir = planningPath(cwd, "codebase");
|
|
16882
|
+
try {
|
|
16883
|
+
return node_fs.default.readdirSync(codebaseDir).filter((f) => f.endsWith(".md")).map((f) => node_path.default.join(".planning", "codebase", f));
|
|
16884
|
+
} catch {
|
|
16885
|
+
return [];
|
|
16886
|
+
}
|
|
16887
|
+
}
|
|
16888
|
+
function cmdInitExecutor(cwd, phase) {
|
|
16889
|
+
if (!phase) return cmdErr("phase required for init executor");
|
|
16890
|
+
const config = loadConfig(cwd);
|
|
16891
|
+
const phaseInfo = findPhaseInternal(cwd, phase);
|
|
16892
|
+
const codebaseDocs = listCodebaseDocs(cwd);
|
|
16893
|
+
const result = {
|
|
16894
|
+
executor_model: resolveModelInternal(cwd, "maxsim-executor"),
|
|
16895
|
+
verifier_model: resolveModelInternal(cwd, "maxsim-verifier"),
|
|
16896
|
+
commit_docs: config.commit_docs,
|
|
16897
|
+
parallelization: config.parallelization,
|
|
16898
|
+
branching_strategy: config.branching_strategy,
|
|
16899
|
+
phase_branch_template: config.phase_branch_template,
|
|
16900
|
+
milestone_branch_template: config.milestone_branch_template,
|
|
16901
|
+
phase_found: !!phaseInfo,
|
|
16902
|
+
phase_dir: phaseInfo?.directory ?? null,
|
|
16903
|
+
phase_number: phaseInfo?.phase_number ?? null,
|
|
16904
|
+
phase_name: phaseInfo?.phase_name ?? null,
|
|
16905
|
+
state_path: ".planning/STATE.md",
|
|
16906
|
+
codebase_docs: codebaseDocs
|
|
16907
|
+
};
|
|
16908
|
+
if (pathExistsInternal(cwd, ".planning/CONVENTIONS.md")) result.conventions_path = ".planning/CONVENTIONS.md";
|
|
16909
|
+
return cmdOk(result);
|
|
16910
|
+
}
|
|
16911
|
+
function cmdInitPlanner(cwd, phase) {
|
|
16912
|
+
if (!phase) return cmdErr("phase required for init planner");
|
|
16913
|
+
const config = loadConfig(cwd);
|
|
16914
|
+
const phaseInfo = findPhaseInternal(cwd, phase);
|
|
16915
|
+
const phase_req_ids = extractReqIds(cwd, phase);
|
|
16916
|
+
const codebaseDocs = listCodebaseDocs(cwd);
|
|
16917
|
+
const result = {
|
|
16918
|
+
planner_model: resolveModelInternal(cwd, "maxsim-planner"),
|
|
16919
|
+
checker_model: resolveModelInternal(cwd, "maxsim-plan-checker"),
|
|
16920
|
+
commit_docs: config.commit_docs,
|
|
16921
|
+
research_enabled: config.research,
|
|
16922
|
+
plan_checker_enabled: config.plan_checker,
|
|
16923
|
+
phase_found: !!phaseInfo,
|
|
16924
|
+
phase_dir: phaseInfo?.directory ?? null,
|
|
16925
|
+
phase_number: phaseInfo?.phase_number ?? null,
|
|
16926
|
+
phase_name: phaseInfo?.phase_name ?? null,
|
|
16927
|
+
phase_req_ids,
|
|
16928
|
+
has_research: phaseInfo?.has_research ?? false,
|
|
16929
|
+
has_context: phaseInfo?.has_context ?? false,
|
|
16930
|
+
has_plans: (phaseInfo?.plans?.length ?? 0) > 0,
|
|
16931
|
+
plan_count: phaseInfo?.plans?.length ?? 0,
|
|
16932
|
+
state_path: ".planning/STATE.md",
|
|
16933
|
+
roadmap_path: ".planning/ROADMAP.md",
|
|
16934
|
+
requirements_path: ".planning/REQUIREMENTS.md",
|
|
16935
|
+
codebase_docs: codebaseDocs
|
|
16936
|
+
};
|
|
16937
|
+
if (pathExistsInternal(cwd, ".planning/CONVENTIONS.md")) result.conventions_path = ".planning/CONVENTIONS.md";
|
|
16938
|
+
if (phaseInfo?.directory) {
|
|
16939
|
+
const artifacts = scanPhaseArtifacts(cwd, phaseInfo.directory);
|
|
16940
|
+
if (artifacts.context_path) result.context_path = artifacts.context_path;
|
|
16941
|
+
if (artifacts.research_path) result.research_path = artifacts.research_path;
|
|
16942
|
+
}
|
|
16943
|
+
return cmdOk(result);
|
|
16944
|
+
}
|
|
16945
|
+
function cmdInitResearcher(cwd, phase) {
|
|
16946
|
+
if (!phase) return cmdErr("phase required for init researcher");
|
|
16947
|
+
const config = loadConfig(cwd);
|
|
16948
|
+
const phaseInfo = findPhaseInternal(cwd, phase);
|
|
16949
|
+
const phase_req_ids = extractReqIds(cwd, phase);
|
|
16950
|
+
const codebaseDocs = listCodebaseDocs(cwd);
|
|
16951
|
+
const result = {
|
|
16952
|
+
researcher_model: resolveModelInternal(cwd, "maxsim-phase-researcher"),
|
|
16953
|
+
commit_docs: config.commit_docs,
|
|
16954
|
+
brave_search: config.brave_search,
|
|
16955
|
+
phase_found: !!phaseInfo,
|
|
16956
|
+
phase_dir: phaseInfo?.directory ?? null,
|
|
16957
|
+
phase_number: phaseInfo?.phase_number ?? null,
|
|
16958
|
+
phase_name: phaseInfo?.phase_name ?? null,
|
|
16959
|
+
padded_phase: phaseInfo?.phase_number?.padStart(2, "0") ?? null,
|
|
16960
|
+
phase_req_ids,
|
|
16961
|
+
has_research: phaseInfo?.has_research ?? false,
|
|
16962
|
+
has_context: phaseInfo?.has_context ?? false,
|
|
16963
|
+
state_path: ".planning/STATE.md",
|
|
16964
|
+
roadmap_path: ".planning/ROADMAP.md",
|
|
16965
|
+
requirements_path: ".planning/REQUIREMENTS.md",
|
|
16966
|
+
codebase_docs: codebaseDocs
|
|
16967
|
+
};
|
|
16968
|
+
if (pathExistsInternal(cwd, ".planning/CONVENTIONS.md")) result.conventions_path = ".planning/CONVENTIONS.md";
|
|
16969
|
+
if (phaseInfo?.directory) {
|
|
16970
|
+
const artifacts = scanPhaseArtifacts(cwd, phaseInfo.directory);
|
|
16971
|
+
if (artifacts.context_path) result.context_path = artifacts.context_path;
|
|
16972
|
+
}
|
|
16973
|
+
return cmdOk(result);
|
|
16974
|
+
}
|
|
16975
|
+
function cmdInitVerifier(cwd, phase) {
|
|
16976
|
+
if (!phase) return cmdErr("phase required for init verifier");
|
|
16977
|
+
const config = loadConfig(cwd);
|
|
16978
|
+
const phaseInfo = findPhaseInternal(cwd, phase);
|
|
16979
|
+
const phase_req_ids = extractReqIds(cwd, phase);
|
|
16980
|
+
const codebaseDocs = listCodebaseDocs(cwd);
|
|
16981
|
+
return cmdOk({
|
|
16982
|
+
verifier_model: resolveModelInternal(cwd, "maxsim-verifier"),
|
|
16983
|
+
commit_docs: config.commit_docs,
|
|
16984
|
+
phase_found: !!phaseInfo,
|
|
16985
|
+
phase_dir: phaseInfo?.directory ?? null,
|
|
16986
|
+
phase_number: phaseInfo?.phase_number ?? null,
|
|
16987
|
+
phase_name: phaseInfo?.phase_name ?? null,
|
|
16988
|
+
phase_req_ids,
|
|
16989
|
+
state_path: ".planning/STATE.md",
|
|
16990
|
+
roadmap_path: ".planning/ROADMAP.md",
|
|
16991
|
+
requirements_path: ".planning/REQUIREMENTS.md",
|
|
16992
|
+
codebase_docs: codebaseDocs
|
|
16993
|
+
});
|
|
16994
|
+
}
|
|
16995
|
+
function cmdInitDebugger(cwd, phase) {
|
|
16996
|
+
const config = loadConfig(cwd);
|
|
16997
|
+
const phaseInfo = phase ? findPhaseInternal(cwd, phase) : null;
|
|
16998
|
+
const codebaseDocs = listCodebaseDocs(cwd);
|
|
16999
|
+
const result = {
|
|
17000
|
+
debugger_model: resolveModelInternal(cwd, "maxsim-debugger"),
|
|
17001
|
+
commit_docs: config.commit_docs,
|
|
17002
|
+
phase_found: !!phaseInfo,
|
|
17003
|
+
phase_dir: phaseInfo?.directory ?? null,
|
|
17004
|
+
phase_number: phaseInfo?.phase_number ?? null,
|
|
17005
|
+
phase_name: phaseInfo?.phase_name ?? null,
|
|
17006
|
+
state_path: ".planning/STATE.md",
|
|
17007
|
+
codebase_docs: codebaseDocs
|
|
17008
|
+
};
|
|
17009
|
+
if (pathExistsInternal(cwd, ".planning/CONVENTIONS.md")) result.conventions_path = ".planning/CONVENTIONS.md";
|
|
17010
|
+
return cmdOk(result);
|
|
17011
|
+
}
|
|
17012
|
+
function cmdInitCheckDrift(cwd) {
|
|
17013
|
+
const config = loadConfig(cwd);
|
|
17014
|
+
const driftModel = resolveModelInternal(cwd, "maxsim-drift-checker");
|
|
17015
|
+
const hasPlanning = pathExistsInternal(cwd, ".planning");
|
|
17016
|
+
const hasRequirements = pathExistsInternal(cwd, ".planning/REQUIREMENTS.md");
|
|
17017
|
+
const hasRoadmap = pathExistsInternal(cwd, ".planning/ROADMAP.md");
|
|
17018
|
+
const hasNogos = pathExistsInternal(cwd, ".planning/NO-GOS.md");
|
|
17019
|
+
const hasConventions = pathExistsInternal(cwd, ".planning/CONVENTIONS.md");
|
|
17020
|
+
const hasPreviousReport = pathExistsInternal(cwd, ".planning/DRIFT-REPORT.md");
|
|
17021
|
+
const specFiles = [];
|
|
17022
|
+
if (hasRequirements) specFiles.push(".planning/REQUIREMENTS.md");
|
|
17023
|
+
if (hasRoadmap) specFiles.push(".planning/ROADMAP.md");
|
|
17024
|
+
if (pathExistsInternal(cwd, ".planning/STATE.md")) specFiles.push(".planning/STATE.md");
|
|
17025
|
+
if (hasNogos) specFiles.push(".planning/NO-GOS.md");
|
|
17026
|
+
if (hasConventions) specFiles.push(".planning/CONVENTIONS.md");
|
|
17027
|
+
let phaseDirs = [];
|
|
17028
|
+
try {
|
|
17029
|
+
phaseDirs = listSubDirs(phasesPath(cwd), true).map((d) => `.planning/phases/${d}`);
|
|
17030
|
+
} catch {}
|
|
17031
|
+
let archivedMilestoneDirs = [];
|
|
17032
|
+
try {
|
|
17033
|
+
archivedMilestoneDirs = getArchivedPhaseDirs(cwd).map((a) => a.basePath);
|
|
17034
|
+
archivedMilestoneDirs = [...new Set(archivedMilestoneDirs)];
|
|
17035
|
+
} catch {}
|
|
17036
|
+
const codebaseDocs = listCodebaseDocs(cwd);
|
|
17037
|
+
return cmdOk({
|
|
17038
|
+
drift_model: driftModel,
|
|
17039
|
+
commit_docs: config.commit_docs,
|
|
17040
|
+
has_planning: hasPlanning,
|
|
17041
|
+
has_requirements: hasRequirements,
|
|
17042
|
+
has_roadmap: hasRoadmap,
|
|
17043
|
+
has_nogos: hasNogos,
|
|
17044
|
+
has_conventions: hasConventions,
|
|
17045
|
+
has_previous_report: hasPreviousReport,
|
|
17046
|
+
previous_report_path: hasPreviousReport ? ".planning/DRIFT-REPORT.md" : null,
|
|
17047
|
+
spec_files: specFiles,
|
|
17048
|
+
phase_dirs: phaseDirs,
|
|
17049
|
+
archived_milestone_dirs: archivedMilestoneDirs,
|
|
17050
|
+
state_path: ".planning/STATE.md",
|
|
17051
|
+
requirements_path: ".planning/REQUIREMENTS.md",
|
|
17052
|
+
roadmap_path: ".planning/ROADMAP.md",
|
|
17053
|
+
nogos_path: hasNogos ? ".planning/NO-GOS.md" : null,
|
|
17054
|
+
conventions_path: hasConventions ? ".planning/CONVENTIONS.md" : null,
|
|
17055
|
+
codebase_docs: codebaseDocs
|
|
17056
|
+
});
|
|
17057
|
+
}
|
|
17058
|
+
function cmdInitRealign(cwd, direction) {
|
|
17059
|
+
const config = loadConfig(cwd);
|
|
17060
|
+
const hasReport = pathExistsInternal(cwd, ".planning/DRIFT-REPORT.md");
|
|
17061
|
+
const hasPlanning = pathExistsInternal(cwd, ".planning");
|
|
17062
|
+
let phaseDirs = [];
|
|
17063
|
+
try {
|
|
17064
|
+
phaseDirs = listSubDirs(phasesPath(cwd), true).map((d) => `.planning/phases/${d}`);
|
|
17065
|
+
} catch {}
|
|
17066
|
+
const codebaseDocs = listCodebaseDocs(cwd);
|
|
17067
|
+
return cmdOk({
|
|
17068
|
+
commit_docs: config.commit_docs,
|
|
17069
|
+
direction: direction ?? null,
|
|
17070
|
+
has_report: hasReport,
|
|
17071
|
+
report_path: ".planning/DRIFT-REPORT.md",
|
|
17072
|
+
has_planning: hasPlanning,
|
|
17073
|
+
state_path: ".planning/STATE.md",
|
|
17074
|
+
roadmap_path: ".planning/ROADMAP.md",
|
|
17075
|
+
requirements_path: ".planning/REQUIREMENTS.md",
|
|
17076
|
+
phase_dirs: phaseDirs,
|
|
17077
|
+
codebase_docs: codebaseDocs
|
|
17078
|
+
});
|
|
17079
|
+
}
|
|
16699
17080
|
|
|
16700
17081
|
//#endregion
|
|
16701
17082
|
//#region src/cli.ts
|
|
@@ -16885,6 +17266,19 @@ const handleValidate = (args, cwd, raw) => {
|
|
|
16885
17266
|
if (handler) return handler();
|
|
16886
17267
|
error("Unknown validate subcommand. Available: consistency, health");
|
|
16887
17268
|
};
|
|
17269
|
+
const handleDrift = (args, cwd, raw) => {
|
|
17270
|
+
const sub = args[1];
|
|
17271
|
+
const handler = sub ? {
|
|
17272
|
+
"read-report": () => cmdDriftReadReport(cwd),
|
|
17273
|
+
"extract-requirements": () => cmdDriftExtractRequirements(cwd),
|
|
17274
|
+
"extract-nogos": () => cmdDriftExtractNoGos(cwd),
|
|
17275
|
+
"extract-conventions": () => cmdDriftExtractConventions(cwd),
|
|
17276
|
+
"write-report": () => cmdDriftWriteReport(cwd, getFlag(args, "--content"), getFlag(args, "--content-file")),
|
|
17277
|
+
"previous-hash": () => cmdDriftPreviousHash(cwd)
|
|
17278
|
+
}[sub] : void 0;
|
|
17279
|
+
if (handler) return handleResult(handler(), raw);
|
|
17280
|
+
error("Unknown drift subcommand. Available: read-report, extract-requirements, extract-nogos, extract-conventions, write-report, previous-hash");
|
|
17281
|
+
};
|
|
16888
17282
|
const handleInit = (args, cwd, raw) => {
|
|
16889
17283
|
const workflow = args[1];
|
|
16890
17284
|
const handler = workflow ? {
|
|
@@ -16900,10 +17294,17 @@ const handleInit = (args, cwd, raw) => {
|
|
|
16900
17294
|
"milestone-op": () => cmdInitMilestoneOp(cwd),
|
|
16901
17295
|
"map-codebase": () => cmdInitMapCodebase(cwd),
|
|
16902
17296
|
"init-existing": () => cmdInitExisting(cwd),
|
|
16903
|
-
"progress": () => cmdInitProgress(cwd)
|
|
17297
|
+
"progress": () => cmdInitProgress(cwd),
|
|
17298
|
+
"executor": () => cmdInitExecutor(cwd, args[2]),
|
|
17299
|
+
"planner": () => cmdInitPlanner(cwd, args[2]),
|
|
17300
|
+
"researcher": () => cmdInitResearcher(cwd, args[2]),
|
|
17301
|
+
"verifier": () => cmdInitVerifier(cwd, args[2]),
|
|
17302
|
+
"debugger": () => cmdInitDebugger(cwd, args[2]),
|
|
17303
|
+
"check-drift": () => cmdInitCheckDrift(cwd),
|
|
17304
|
+
"realign": () => cmdInitRealign(cwd, args[2])
|
|
16904
17305
|
}[workflow] : void 0;
|
|
16905
17306
|
if (handler) return handleResult(handler(), raw);
|
|
16906
|
-
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, init-existing, progress`);
|
|
17307
|
+
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, init-existing, progress, executor, planner, researcher, verifier, debugger, check-drift, realign`);
|
|
16907
17308
|
};
|
|
16908
17309
|
const COMMANDS = {
|
|
16909
17310
|
"state": handleState,
|
|
@@ -16938,6 +17339,7 @@ const COMMANDS = {
|
|
|
16938
17339
|
"phase": handlePhase,
|
|
16939
17340
|
"milestone": handleMilestone,
|
|
16940
17341
|
"validate": handleValidate,
|
|
17342
|
+
"drift": handleDrift,
|
|
16941
17343
|
"progress": (args, cwd, raw) => handleResult(cmdProgressRender(cwd, args[1] || "json", raw), raw),
|
|
16942
17344
|
"todo": (args, cwd, raw) => {
|
|
16943
17345
|
if (args[1] === "complete") handleResult(cmdTodoComplete(cwd, args[2], raw), raw);
|
|
@@ -16985,7 +17387,7 @@ const COMMANDS = {
|
|
|
16985
17387
|
(0, node_child_process.spawn)(process.execPath, [serverPath], { stdio: "inherit" }).on("exit", (code) => process.exit(code ?? 0));
|
|
16986
17388
|
},
|
|
16987
17389
|
"backend-start": async (args, cwd, raw) => {
|
|
16988
|
-
const { startBackend } = await Promise.resolve().then(() => require("./lifecycle-
|
|
17390
|
+
const { startBackend } = await Promise.resolve().then(() => require("./lifecycle-DxCru7rk.cjs"));
|
|
16989
17391
|
const portFlag = args.find((a) => a.startsWith("--port="))?.split("=")[1];
|
|
16990
17392
|
const background = !args.includes("--foreground");
|
|
16991
17393
|
output(await startBackend(cwd, {
|
|
@@ -16994,11 +17396,11 @@ const COMMANDS = {
|
|
|
16994
17396
|
}), raw);
|
|
16995
17397
|
},
|
|
16996
17398
|
"backend-stop": async (_args, cwd, raw) => {
|
|
16997
|
-
const { stopBackend } = await Promise.resolve().then(() => require("./lifecycle-
|
|
17399
|
+
const { stopBackend } = await Promise.resolve().then(() => require("./lifecycle-DxCru7rk.cjs"));
|
|
16998
17400
|
output({ stopped: await stopBackend(cwd) }, raw);
|
|
16999
17401
|
},
|
|
17000
17402
|
"backend-status": async (_args, cwd, raw) => {
|
|
17001
|
-
const { getBackendStatus } = await Promise.resolve().then(() => require("./lifecycle-
|
|
17403
|
+
const { getBackendStatus } = await Promise.resolve().then(() => require("./lifecycle-DxCru7rk.cjs"));
|
|
17002
17404
|
output(await getBackendStatus(cwd) || { running: false }, raw);
|
|
17003
17405
|
}
|
|
17004
17406
|
};
|