fix(FN-1455): surface automatic git initialization
Fusion-Task-Id: FN-1455
This commit is contained in:
@@ -90,5 +90,5 @@ docker run --rm \
|
|||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
- The container runs as the non-root `node` user.
|
- The container runs as the non-root `node` user.
|
||||||
- `git` must be available in the container and project volume for worktree operations. Fusion initializes missing repositories during project registration, but existing `.git` metadata and repository history are still required once tasks begin.
|
- `git` must be available in the container runtime. The mounted project volume must preserve `.git` metadata and repository history for worktree operations; Fusion initializes missing repositories during project registration.
|
||||||
- The root `Dockerfile` installs with `pnpm install --frozen-lockfile` before copying full source, so every workspace package/plugin manifest in `pnpm-workspace.yaml` must have a corresponding `COPY <path>/package.json` line in the builder stage.
|
- The root `Dockerfile` installs with `pnpm install --frozen-lockfile` before copying full source, so every workspace package/plugin manifest in `pnpm-workspace.yaml` must have a corresponding `COPY <path>/package.json` line in the builder stage.
|
||||||
|
|||||||
@@ -388,4 +388,34 @@ describe("init command", () => {
|
|||||||
);
|
);
|
||||||
expect(logs.join("\n")).not.toContain("Not a git repository");
|
expect(logs.join("\n")).not.toContain("Not a git repository");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("logs when shared registration initializes git without --git", async () => {
|
||||||
|
mockEnsureProjectForPath.mockResolvedValueOnce({
|
||||||
|
outcome: "registered",
|
||||||
|
gitRepository: "initialized",
|
||||||
|
project: {
|
||||||
|
id: "proj_test",
|
||||||
|
name: "test-project",
|
||||||
|
path: tempProjectDir,
|
||||||
|
isolationMode: "in-process",
|
||||||
|
status: "initializing",
|
||||||
|
createdAt: "",
|
||||||
|
updatedAt: "",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const originalLog = console.log;
|
||||||
|
const logs: string[] = [];
|
||||||
|
console.log = (...args: unknown[]) => {
|
||||||
|
logs.push(args.join(" "));
|
||||||
|
};
|
||||||
|
|
||||||
|
try {
|
||||||
|
await runInit({ path: tempProjectDir });
|
||||||
|
} finally {
|
||||||
|
console.log = originalLog;
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(logs.join("\n")).toContain("Initialized git repository");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -403,6 +403,32 @@ describe("project commands", () => {
|
|||||||
expect(output).toContain("Memory: initialized");
|
expect(output).toContain("Memory: initialized");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("shows git initialized message when shared registration creates a git repository", async () => {
|
||||||
|
mockListProjects.mockResolvedValue([]);
|
||||||
|
mockRegisterProject.mockResolvedValue({
|
||||||
|
id: "proj-1",
|
||||||
|
name: "demo",
|
||||||
|
path: "/fake/demo",
|
||||||
|
isolationMode: "in-process",
|
||||||
|
});
|
||||||
|
mockEnsureProjectForPath.mockResolvedValueOnce({
|
||||||
|
outcome: "registered",
|
||||||
|
gitRepository: "initialized",
|
||||||
|
project: {
|
||||||
|
id: "proj-1",
|
||||||
|
name: "demo",
|
||||||
|
path: "/fake/demo",
|
||||||
|
isolationMode: "in-process",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const { runProjectAdd } = await import("../project.js");
|
||||||
|
await runProjectAdd("demo", testPath, { force: true });
|
||||||
|
|
||||||
|
const output = consoleSpy.mock.calls.map((call) => String(call[0])).join("\n");
|
||||||
|
expect(output).toContain("Git: initialized");
|
||||||
|
});
|
||||||
|
|
||||||
it("does not show memory message when memory files already exist", async () => {
|
it("does not show memory message when memory files already exist", async () => {
|
||||||
mockListProjects.mockResolvedValue([]);
|
mockListProjects.mockResolvedValue([]);
|
||||||
mockRegisterProject.mockResolvedValue({
|
mockRegisterProject.mockResolvedValue({
|
||||||
|
|||||||
@@ -167,6 +167,9 @@ export async function runInit(options: InitOptions = {}): Promise<void> {
|
|||||||
|
|
||||||
maybeInstallClaudeSkillForNewProject(cwd);
|
maybeInstallClaudeSkillForNewProject(cwd);
|
||||||
|
|
||||||
|
if (ensured.gitRepository === "initialized") {
|
||||||
|
console.log(` ✓ Initialized git repository`);
|
||||||
|
}
|
||||||
console.log(` ✓ Registered in central database`);
|
console.log(` ✓ Registered in central database`);
|
||||||
console.log(`\n✓ Project "${project.name}" initialized successfully!`);
|
console.log(`\n✓ Project "${project.name}" initialized successfully!`);
|
||||||
console.log(`\n Next steps:`);
|
console.log(`\n Next steps:`);
|
||||||
|
|||||||
@@ -394,6 +394,9 @@ export async function runProjectAdd(
|
|||||||
console.log(` Location: ${formatDisplayPath(project.path)}`);
|
console.log(` Location: ${formatDisplayPath(project.path)}`);
|
||||||
console.log(` ID: ${project.id}`);
|
console.log(` ID: ${project.id}`);
|
||||||
console.log(` Isolation: ${project.isolationMode}`);
|
console.log(` Isolation: ${project.isolationMode}`);
|
||||||
|
if (ensured.gitRepository === "initialized") {
|
||||||
|
console.log(` Git: initialized`);
|
||||||
|
}
|
||||||
if (memoryInitialized) {
|
if (memoryInitialized) {
|
||||||
console.log(` Memory: initialized`);
|
console.log(` Memory: initialized`);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user