Initial curated projectbrain source from 8a7b1e0651dbdab97d744cbd2e653ab3970ac6c5

This commit is contained in:
Public Source Publisher committed 2026-10-01 01:43:26 +02:00
commit 5aa3e8d685
700 files changed
+132801

No files matched your search

+36
View File
@@ -0,0 +1,36 @@
import { describe, expect, it } from "vitest";
import { mergeProjectSetupState, sanitizeProjectSetupState } from "../src/repositories/projectSetupState.js";
describe("project setup state persistence", () => {
it("round-trips rich wizard fields while rejecting unsupported top-level state", () => {
const setup = sanitizeProjectSetupState({
id: "spoofed-project",
name: "Spoofed name",
firstRun: { documentationDepth: "Deep", repoFolders: ["docs/00-project"] },
constraints: [{ id: "constraint-1", description: "Keep data durable" }],
workspaceState: { projectId: "wizard-project", primaryObjective: "Ship the first slice" },
repositoryIntakes: [{ id: "not-part-of-project-setup" }],
});
expect(setup).toMatchObject({
firstRun: { documentationDepth: "Deep", repoFolders: ["docs/00-project"] },
constraints: [{ id: "constraint-1", description: "Keep data durable" }],
workspaceState: { projectId: "wizard-project", primaryObjective: "Ship the first slice" },
});
expect(setup).not.toHaveProperty("id");
expect(setup).not.toHaveProperty("name");
expect(setup).not.toHaveProperty("repositoryIntakes");
});
it("always lets canonical database fields win over setup state", () => {
expect(mergeProjectSetupState(
{ activeContextPackId: "starter-pack", workspaceState: { primaryObjective: "Wizard objective" }, name: "Spoofed" },
{ id: "canonical", name: "Canonical" },
)).toEqual({
activeContextPackId: "starter-pack",
workspaceState: { primaryObjective: "Wizard objective" },
id: "canonical",
name: "Canonical",
});
});
});