mirror of
https://github.com/nexu-io/open-design.git
synced 2026-10-27 09:51:12 +01:00
fix(host): accept folder imports without entry files (#2701)
Generated-By: looper 0.8.1 (runner=worker, agent=codex)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user