fix(FN-1455): surface automatic git initialization

Fusion-Task-Id: FN-1455
This commit is contained in:
gsxdsm
2026-06-06 01:01:24 -07:00
parent c2da5883e7
commit 2992a7e19a
5 changed files with 63 additions and 1 deletions

View File

@@ -388,4 +388,34 @@ describe("init command", () => {
);
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");
});
});

View File

@@ -403,6 +403,32 @@ describe("project commands", () => {
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 () => {
mockListProjects.mockResolvedValue([]);
mockRegisterProject.mockResolvedValue({

View File

@@ -167,6 +167,9 @@ export async function runInit(options: InitOptions = {}): Promise<void> {
maybeInstallClaudeSkillForNewProject(cwd);
if (ensured.gitRepository === "initialized") {
console.log(` ✓ Initialized git repository`);
}
console.log(` ✓ Registered in central database`);
console.log(`\n✓ Project "${project.name}" initialized successfully!`);
console.log(`\n Next steps:`);

View File

@@ -394,6 +394,9 @@ export async function runProjectAdd(
console.log(` Location: ${formatDisplayPath(project.path)}`);
console.log(` ID: ${project.id}`);
console.log(` Isolation: ${project.isolationMode}`);
if (ensured.gitRepository === "initialized") {
console.log(` Git: initialized`);
}
if (memoryInitialized) {
console.log(` Memory: initialized`);
}