fix(host): accept folder imports without entry files (#2701)

Generated-By: looper 0.8.1 (runner=worker, agent=codex)
This commit is contained in:
Siri-Ray
2026-05-22 17:21:22 +08:00
committed by GitHub
parent 1fd50197dd
commit 9d7e4658df
2 changed files with 29 additions and 3 deletions
+6 -3
View File
@@ -31,7 +31,7 @@ export type OpenDesignHostProjectImportInit = {
export type OpenDesignHostProjectImportSuccess = {
conversationId: string;
entryFile: string;
entryFile: string | null;
ok: true;
projectId: string;
};
@@ -310,8 +310,11 @@ export function normalizeOpenDesignHostProjectImportResult(input: unknown): Open
const rawProjectId = isRecord(project) ? project.id : null;
const projectId = typeof rawProjectId === "string" ? rawProjectId : null;
const conversationId = typeof response.conversationId === "string" ? response.conversationId : null;
const entryFile = typeof response.entryFile === "string" ? response.entryFile : null;
if (projectId == null || conversationId == null || entryFile == null) {
const entryFile =
typeof response.entryFile === "string" || response.entryFile === null
? response.entryFile
: undefined;
if (projectId == null || conversationId == null || entryFile === undefined) {
return failure("daemon import response did not include host project identifiers", response);
}
+23
View File
@@ -129,6 +129,29 @@ describe("open-design host contract", () => {
expect(JSON.stringify(result)).not.toContain("resolvedDir");
});
it("accepts imported folders with no detected entry file", () => {
const result = normalizeOpenDesignHostProjectImportResult({
ok: true,
response: {
project: {
id: "project-1",
name: "Imported source repo",
resolvedDir: "/private/path/that-must-not-cross",
},
conversationId: "conversation-1",
entryFile: null,
},
});
expect(result).toEqual({
ok: true,
projectId: "project-1",
conversationId: "conversation-1",
entryFile: null,
});
expect(JSON.stringify(result)).not.toContain("resolvedDir");
});
it("preserves canceled and structured failure project-import results", () => {
expect(normalizeOpenDesignHostProjectImportResult({ canceled: true, ok: false })).toEqual({
canceled: true,