fix(KB-503): correct isRegistered flag for unregistered local projects

This commit is contained in:
gsxdsm
2026-04-01 21:33:17 -07:00
parent 2778027423
commit 79340711fa

View File

@@ -80,15 +80,19 @@ export async function resolveProject(
); );
} }
const store = detected.id const isRegistered = Boolean(detected.id);
const store = isRegistered
? await getStoreForProject(detected.id, detected.path) ? await getStoreForProject(detected.id, detected.path)
: await createLocalStore(detected.path); : await createLocalStore(detected.path);
// For unregistered projects, use the path as the project ID
const projectId = isRegistered ? detected.id : detected.path;
return { return {
projectId: detected.id, projectId,
projectPath: detected.path, projectPath: detected.path,
projectName: detected.name, projectName: detected.name,
isRegistered: Boolean(detected.id), isRegistered,
store, store,
}; };
} }
@@ -190,8 +194,9 @@ export async function detectProjectFromCwd(
} }
// Not registered, but has .kb/kb.db - still use it as a valid project // Not registered, but has .kb/kb.db - still use it as a valid project
// This preserves legacy single-project CLI behavior. // This preserves legacy single-project CLI behavior.
// Use empty string for id to indicate unregistered status.
return { return {
id: currentDir, id: "",
name: currentDir.split("/").filter(Boolean).at(-1) ?? "current-project", name: currentDir.split("/").filter(Boolean).at(-1) ?? "current-project",
path: currentDir, path: currentDir,
}; };