Skip to content

Commit 911324b

Browse files
committed
fix(utils): validate package root only if templates exist
Check for existence of workflow template before validating package root to handle cases where meta package is installed globally without templates
1 parent df4a7c4 commit 911324b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/shared/utils/package-root.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,12 @@ function validatePackageRoot(candidate: string | undefined): string | undefined
2222
try {
2323
const pkg = JSON.parse(readFileSync(pkgPath, 'utf8'));
2424
if (pkg?.name === 'codemachine') {
25-
return candidate;
25+
const templateEntry = join(candidate, 'templates', 'workflows', 'codemachine.workflow.js');
26+
if (existsSync(templateEntry)) {
27+
return candidate;
28+
}
29+
// Package exists but is missing templates (e.g., meta package installed globally)
30+
return undefined;
2631
}
2732
} catch {
2833
// Ignore parse failures

0 commit comments

Comments
 (0)