Skip to content

Commit 7762847

Browse files
committed
fix(core): integration validation cleanup — build, catch blocks, regex
- Replace 12 comment-only catch { /* ignore */ } and catch { /* empty */ } blocks in packages/core/src/init.ts and packages/core/src/milestone.ts with the debug-guarded pattern: catch (e) { /* optional op, ignore */ if (process.env.MAXSIM_DEBUG) console.error(e); } - Both files were missed in plan 12-01 scope (which targeted only core.ts, phase.ts, roadmap.ts, verify.ts, state.ts, commands.ts) - nx build core and nx build cli both pass cleanly after fixes
1 parent d108a4e commit 7762847

2 files changed

Lines changed: 60 additions & 15 deletions

File tree

‎packages/core/src/init.ts‎

Lines changed: 48 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,10 @@ function scanPhaseArtifacts(cwd: string, phaseDirectory: string): PhaseArtifacts
343343
if (uatFile) {
344344
result.uat_path = path.join(phaseDirectory, uatFile);
345345
}
346-
} catch { /* ignore */ }
346+
} catch (e) {
347+
/* optional op, ignore */
348+
if (process.env.MAXSIM_DEBUG) console.error(e);
349+
}
347350
return result;
348351
}
349352

@@ -464,7 +467,10 @@ export function cmdInitNewProject(cwd: string, raw: boolean): void {
464467
stdio: ['pipe', 'pipe', 'pipe'],
465468
});
466469
hasCode = files.trim().length > 0;
467-
} catch { /* ignore */ }
470+
} catch (e) {
471+
/* optional op, ignore */
472+
if (process.env.MAXSIM_DEBUG) console.error(e);
473+
}
468474

469475
hasPackageFile = pathExistsInternal(cwd, 'package.json') ||
470476
pathExistsInternal(cwd, 'requirements.txt') ||
@@ -530,7 +536,10 @@ export function cmdInitQuick(cwd: string, description: string | undefined, raw:
530536
if (existing.length > 0) {
531537
nextNum = Math.max(...existing) + 1;
532538
}
533-
} catch { /* ignore */ }
539+
} catch (e) {
540+
/* optional op, ignore */
541+
if (process.env.MAXSIM_DEBUG) console.error(e);
542+
}
534543

535544
const result: QuickContext = {
536545
planner_model: resolveModelInternal(cwd, 'maxsim-planner'),
@@ -558,7 +567,10 @@ export function cmdInitResume(cwd: string, raw: boolean): void {
558567
let interruptedAgentId: string | null = null;
559568
try {
560569
interruptedAgentId = fs.readFileSync(path.join(cwd, '.planning', 'current-agent-id.txt'), 'utf-8').trim();
561-
} catch { /* ignore */ }
570+
} catch (e) {
571+
/* optional op, ignore */
572+
if (process.env.MAXSIM_DEBUG) console.error(e);
573+
}
562574

563575
const result: ResumeContext = {
564576
state_exists: pathExistsInternal(cwd, '.planning/STATE.md'),
@@ -682,9 +694,15 @@ export function cmdInitTodos(cwd: string, area: string | undefined, raw: boolean
682694
area: todoArea,
683695
path: path.join('.planning', 'todos', 'pending', file),
684696
});
685-
} catch { /* ignore */ }
697+
} catch (e) {
698+
/* optional op, ignore */
699+
if (process.env.MAXSIM_DEBUG) console.error(e);
700+
}
686701
}
687-
} catch { /* ignore */ }
702+
} catch (e) {
703+
/* optional op, ignore */
704+
if (process.env.MAXSIM_DEBUG) console.error(e);
705+
}
688706

689707
const result: TodosContext = {
690708
commit_docs: config.commit_docs,
@@ -720,17 +738,26 @@ export function cmdInitMilestoneOp(cwd: string, raw: boolean): void {
720738
const phaseFiles = fs.readdirSync(path.join(phasesDir, dir));
721739
const hasSummary = phaseFiles.some(f => f.endsWith('-SUMMARY.md') || f === 'SUMMARY.md');
722740
if (hasSummary) completedPhases++;
723-
} catch { /* ignore */ }
741+
} catch (e) {
742+
/* optional op, ignore */
743+
if (process.env.MAXSIM_DEBUG) console.error(e);
744+
}
724745
}
725-
} catch { /* ignore */ }
746+
} catch (e) {
747+
/* optional op, ignore */
748+
if (process.env.MAXSIM_DEBUG) console.error(e);
749+
}
726750

727751
const archiveDir = path.join(cwd, '.planning', 'archive');
728752
let archivedMilestones: string[] = [];
729753
try {
730754
archivedMilestones = fs.readdirSync(archiveDir, { withFileTypes: true })
731755
.filter(e => e.isDirectory())
732756
.map(e => e.name);
733-
} catch { /* ignore */ }
757+
} catch (e) {
758+
/* optional op, ignore */
759+
if (process.env.MAXSIM_DEBUG) console.error(e);
760+
}
734761

735762
const result: MilestoneOpContext = {
736763
commit_docs: config.commit_docs,
@@ -759,7 +786,10 @@ export function cmdInitMapCodebase(cwd: string, raw: boolean): void {
759786
let existingMaps: string[] = [];
760787
try {
761788
existingMaps = fs.readdirSync(codebaseDir).filter(f => f.endsWith('.md'));
762-
} catch { /* ignore */ }
789+
} catch (e) {
790+
/* optional op, ignore */
791+
if (process.env.MAXSIM_DEBUG) console.error(e);
792+
}
763793

764794
const result: MapCodebaseContext = {
765795
mapper_model: resolveModelInternal(cwd, 'maxsim-codebase-mapper'),
@@ -824,14 +854,20 @@ export function cmdInitProgress(cwd: string, raw: boolean): void {
824854
nextPhase = phaseInfo;
825855
}
826856
}
827-
} catch { /* ignore */ }
857+
} catch (e) {
858+
/* optional op, ignore */
859+
if (process.env.MAXSIM_DEBUG) console.error(e);
860+
}
828861

829862
let pausedAt: string | null = null;
830863
try {
831864
const state = fs.readFileSync(path.join(cwd, '.planning', 'STATE.md'), 'utf-8');
832865
const pauseMatch = state.match(/\*\*Paused At:\*\*\s*(.+)/);
833866
if (pauseMatch) pausedAt = pauseMatch[1].trim();
834-
} catch { /* ignore */ }
867+
} catch (e) {
868+
/* optional op, ignore */
869+
if (process.env.MAXSIM_DEBUG) console.error(e);
870+
}
835871

836872
const result: ProgressContext = {
837873
executor_model: resolveModelInternal(cwd, 'maxsim-executor'),

‎packages/core/src/milestone.ts‎

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,16 @@ export function cmdMilestoneComplete(
130130
}
131131
const taskMatches = content.match(/##\s*Task\s*\d+/gi) || [];
132132
totalTasks += taskMatches.length;
133-
} catch { /* empty */ }
133+
} catch (e) {
134+
/* optional op, ignore */
135+
if (process.env.MAXSIM_DEBUG) console.error(e);
136+
}
134137
}
135138
}
136-
} catch { /* empty */ }
139+
} catch (e) {
140+
/* optional op, ignore */
141+
if (process.env.MAXSIM_DEBUG) console.error(e);
142+
}
137143

138144
// Archive ROADMAP.md
139145
if (fs.existsSync(roadmapPath)) {
@@ -196,7 +202,10 @@ export function cmdMilestoneComplete(
196202
fs.renameSync(path.join(phasesDir, dir), path.join(phaseArchiveDir, dir));
197203
}
198204
phasesArchived = phaseDirNames.length > 0;
199-
} catch { /* empty */ }
205+
} catch (e) {
206+
/* optional op, ignore */
207+
if (process.env.MAXSIM_DEBUG) console.error(e);
208+
}
200209
}
201210

202211
const result: MilestoneResult = {

0 commit comments

Comments
 (0)