feat: support shared project registration

This commit is contained in:
2026-08-07 16:31:35 +09:00
parent 1455c954eb
commit 219f0e22a8
7 changed files with 204 additions and 63 deletions

View File

@@ -11,6 +11,7 @@ import { promisify } from "node:util";
const require = createRequire(import.meta.url);
const {
composeProject,
listProjects,
planProject,
registerProject,
selectProjectIdsByContract,
@@ -270,6 +271,49 @@ stack:
);
});
test("registers a project in the shared workspace only when explicitly requested", async (t) => {
const { temporaryRoot, harnessRoot } = await createFixture(t);
const newProjectRoot = path.join(temporaryRoot, "apps", "shared-tool");
await writeText(
path.join(newProjectRoot, ".agent", "profile.yml"),
`schema_version: 1
project:
id: shared-tool
name: Shared Tool
type: scaffold-cli
layer: standalone
legacy: false
stack:
- typescript
`,
);
const result = await registerProject(
harnessRoot,
"shared-tool",
"apps/shared-tool",
"shared",
);
assert.deepEqual(result, {
changed: true,
path: "apps/shared-tool",
source: "shared",
});
const sharedWorkspace = await readFile(path.join(harnessRoot, "workspace.yml"), "utf8");
assert.match(sharedWorkspace, /workspace_root: \.\.\n\nprojects:/);
assert.match(sharedWorkspace, /shared-tool:/);
assert.match(sharedWorkspace, /path: apps\/shared-tool/);
assert.equal(
await readFile(path.join(harnessRoot, "workspace.local.yml"), "utf8").catch(() => null),
null,
);
assert.equal(
(await listProjects(harnessRoot)).find((project) => project.id === "shared-tool")?.source,
"shared",
);
});
test("registers, composes, and verifies a project path containing Korean text and spaces", async (t) => {
const { temporaryRoot, harnessRoot } = await createFixture(t);
const projectRoot = path.join(temporaryRoot, "___NEW 출구조사", "legacy-app");