From 9d7e4658df19dd0c3494de250dcad2d1a5bd791f Mon Sep 17 00:00:00 2001 From: Siri-Ray <109605599+Siri-Ray@users.noreply.github.com> Date: Fri, 22 May 2026 17:21:22 +0800 Subject: [PATCH] fix(host): accept folder imports without entry files (#2701) Generated-By: looper 0.8.1 (runner=worker, agent=codex) --- packages/host/src/index.ts | 9 ++++++--- packages/host/tests/index.test.ts | 23 +++++++++++++++++++++++ 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/packages/host/src/index.ts b/packages/host/src/index.ts index 3d3a820fb6..8d76e154c4 100644 --- a/packages/host/src/index.ts +++ b/packages/host/src/index.ts @@ -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); } diff --git a/packages/host/tests/index.test.ts b/packages/host/tests/index.test.ts index db51f6aeb4..31c151695e 100644 --- a/packages/host/tests/index.test.ts +++ b/packages/host/tests/index.test.ts @@ -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,