refactor: migrate workflow registry from YAML to ocas variable store (Phase 4a)
CI / check (pull_request) Failing after 8m40s

- UwfStore gains varStore: VariableStore (SQLite at ~/.ocas/variables.db)
- loadWorkflowRegistry reads from @uwf/registry/* variables
- saveWorkflowRegistry writes individual @uwf/registry/<name> variables
- Auto-migration: workflows.yaml → variables on first run, renames to .migrated
- Updated callers in workflow.ts and thread.ts
- Tests updated and passing

Ref #11
This commit is contained in:
2026-06-02 21:58:58 +08:00
parent 323bbf4d13
commit 8052473728
7 changed files with 108 additions and 82 deletions
@@ -156,9 +156,7 @@ export async function cmdWorkflowAdd(
fail("stored workflow failed schema validation");
}
const registry = await loadWorkflowRegistry(storageRoot);
registry[materialized.name] = hash;
await saveWorkflowRegistry(storageRoot, registry);
saveWorkflowRegistry(uwf.varStore, materialized.name, hash);
return { name: materialized.name, hash };
}
@@ -168,7 +166,7 @@ export async function cmdWorkflowShow(
id: string,
): Promise<WorkflowShowOutput> {
const uwf = await createUwfStore(storageRoot);
const registry = await loadWorkflowRegistry(storageRoot);
const registry = loadWorkflowRegistry(uwf.varStore);
const hash = resolveWorkflowHash(registry, id);
const node = uwf.store.get(hash);
@@ -193,8 +191,9 @@ export async function cmdWorkflowList(
storageRoot: string,
projectRoot: string,
): Promise<WorkflowListEntry[]> {
const uwf = await createUwfStore(storageRoot);
const localEntries = await discoverProjectWorkflows(projectRoot);
const registry = await loadWorkflowRegistry(storageRoot);
const registry = loadWorkflowRegistry(uwf.varStore);
const result: WorkflowListEntry[] = [];
const localNames = new Set<string>();