From 5e5f94eea89668562d12c0f01a363a07cc5150ad Mon Sep 17 00:00:00 2001 From: smalinka Date: Sun, 30 Aug 2026 19:16:40 +0000 Subject: [PATCH 1/2] Add devcontainer configuration --- .devcontainer/devcontainer.json | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..de528391 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,10 @@ +{ + "name": "opencode", + "image": "oven/bun:1.3", + "customizations": { + "vscode": { + "extensions": ["oven.bun-vscode"] + } + }, + "postCreateCommand": "apt-get update && apt-get install -y python3 make g++ git && bun install" +} \ No newline at end of file From e7bb1febff76bbafb6ed4d47641bbfb56eee5b90 Mon Sep 17 00:00:00 2001 From: smalinka Date: Sat, 5 Sep 2026 08:21:57 +0000 Subject: [PATCH 2/2] Extract isSameMethod helper to remove many-returns smell in integration draft --- packages/core/src/integration.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/core/src/integration.ts b/packages/core/src/integration.ts index f61bac39..3d3fad49 100644 --- a/packages/core/src/integration.ts +++ b/packages/core/src/integration.ts @@ -125,6 +125,12 @@ type Data = { integrations: Map } +function isSameMethod(a: Method, b: Method): boolean { + if (a.type !== b.type) return false + if (a.type !== "oauth" || b.type !== "oauth") return true + return a.id === b.id +} + export type Draft = { list: () => readonly Ref[] get: (id: ID) => Ref | undefined @@ -255,11 +261,9 @@ export const locationLayer = Layer.effect( if (!draft.integrations.has(implementation.integrationID)) { draft.integrations.set(implementation.integrationID, current) } - const index = current.methods.findIndex((method) => { - if (method.type !== implementation.method.type) return false - if (method.type !== "oauth" || implementation.method.type !== "oauth") return true - return method.id === implementation.method.id - }) + const index = current.methods.findIndex((method) => + isSameMethod(method as Method, implementation.method), + ) if (index === -1) current.methods.push(implementation.method as Types.DeepMutable) else current.methods[index] = implementation.method as Types.DeepMutable if (implementation.method.type === "oauth") { @@ -272,11 +276,7 @@ export const locationLayer = Layer.effect( remove: (integrationID, method) => { const current = draft.integrations.get(integrationID) if (!current) return - const index = current.methods.findIndex((candidate) => { - if (candidate.type !== method.type) return false - if (candidate.type !== "oauth" || method.type !== "oauth") return true - return candidate.id === method.id - }) + const index = current.methods.findIndex((candidate) => isSameMethod(candidate as Method, method)) if (index !== -1) current.methods.splice(index, 1) if (method.type === "oauth") current.implementations.delete(method.id) },