feat(migration): implement workspace layout migration and testing
- Added `migrate-layout.ts` to handle migration from old workspace layouts to the new `devclaw/` structure. - Introduced `migrate-layout.test.ts` for comprehensive tests covering various migration scenarios. - Updated `workspace.ts` to ensure default files are created post-migration, including `workflow.yaml` and role-specific prompts. - Refactored role instruction handling to accommodate new directory structure. - Enhanced project registration to scaffold prompt files in the new `devclaw/projects/<project>/prompts/` directory. - Adjusted setup tool descriptions and logic to reflect changes in file structure. - Updated templates to align with the new workflow configuration and role instructions.
This commit is contained in:
@@ -6,6 +6,7 @@ import fs from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import { homedir } from "node:os";
|
||||
import { migrateProject } from "./migrations.js";
|
||||
import { ensureWorkspaceMigrated, DATA_DIR } from "./setup/migrate-layout.js";
|
||||
|
||||
export type WorkerState = {
|
||||
active: boolean;
|
||||
@@ -66,10 +67,11 @@ export function getSessionForLevel(
|
||||
}
|
||||
|
||||
function projectsPath(workspaceDir: string): string {
|
||||
return path.join(workspaceDir, "projects", "projects.json");
|
||||
return path.join(workspaceDir, DATA_DIR, "projects.json");
|
||||
}
|
||||
|
||||
export async function readProjects(workspaceDir: string): Promise<ProjectsData> {
|
||||
await ensureWorkspaceMigrated(workspaceDir);
|
||||
const raw = await fs.readFile(projectsPath(workspaceDir), "utf-8");
|
||||
const data = JSON.parse(raw) as ProjectsData;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user