Skip to content

Commit 36ff395

Browse files
committed
refactor(workspace): simplify workspace initialization logic
Remove redundant template resolution and use dedicated ensureWorkspaceStructure function
1 parent 2b36854 commit 36ff395

1 file changed

Lines changed: 3 additions & 8 deletions

File tree

src/runtime/cli-setup.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ if (process.stdout.isTTY && !shouldSkipSplash) {
6262

6363
appDebug('[Boot] Importing remaining modules');
6464
import { Command } from 'commander';
65-
import { realpathSync } from 'node:fs';
65+
import { realpathSync, existsSync } from 'node:fs';
6666
import { fileURLToPath } from 'node:url';
6767
appDebug('[Boot] Imports complete');
6868

@@ -80,14 +80,9 @@ async function initializeInBackground(cwd: string): Promise<void> {
8080
if (!existsSync(cmRoot)) {
8181
appDebug('[Init] Bootstrapping workspace (first run)');
8282
// Lazy load bootstrap utilities (only on first run)
83-
const { bootstrapWorkspace } = await import('./services/workspace/index.js');
84-
const { resolvePackageRoot } = await import('../shared/runtime/root.js');
83+
const { ensureWorkspaceStructure } = await import('./services/workspace/index.js');
8584

86-
const packageRoot = resolvePackageRoot(import.meta.url, 'runtime setup');
87-
const templatesDir = path.resolve(packageRoot, 'templates', 'workflows');
88-
const defaultTemplate = path.join(templatesDir, 'codemachine.workflow.js');
89-
90-
await bootstrapWorkspace({ cwd, templatePath: defaultTemplate });
85+
await ensureWorkspaceStructure({ cwd });
9186
appDebug('[Init] Workspace bootstrapped');
9287
}
9388

0 commit comments

Comments
 (0)