diff --git a/packages/opencode/migration/20260309230000_move_org_to_state/snapshot.json b/packages/opencode/migration/20260309230000_move_org_to_state/snapshot.json index 37b9eacac..488ecefff 100644 --- a/packages/opencode/migration/20260309230000_move_org_to_state/snapshot.json +++ b/packages/opencode/migration/20260309230000_move_org_to_state/snapshot.json @@ -2,10 +2,7 @@ "version": "7", "dialect": "sqlite", "id": "fb311f30-9948-4131-b15c-7d308478a878", - "prevIds": [ - "325559b7-104f-4d2a-a02c-934cfad7cfcc", - "4ec9de62-88a7-4bec-91cc-0a759e84db21" - ], + "prevIds": ["325559b7-104f-4d2a-a02c-934cfad7cfcc", "4ec9de62-88a7-4bec-91cc-0a759e84db21"], "ddl": [ { "name": "account_state", @@ -892,13 +889,9 @@ "table": "session_share" }, { - "columns": [ - "active_account_id" - ], + "columns": ["active_account_id"], "tableTo": "account", - "columnsTo": [ - "id" - ], + "columnsTo": ["id"], "onUpdate": "NO ACTION", "onDelete": "SET NULL", "nameExplicit": false, @@ -907,13 +900,9 @@ "table": "account_state" }, { - "columns": [ - "project_id" - ], + "columns": ["project_id"], "tableTo": "project", - "columnsTo": [ - "id" - ], + "columnsTo": ["id"], "onUpdate": "NO ACTION", "onDelete": "CASCADE", "nameExplicit": false, @@ -922,13 +911,9 @@ "table": "workspace" }, { - "columns": [ - "session_id" - ], + "columns": ["session_id"], "tableTo": "session", - "columnsTo": [ - "id" - ], + "columnsTo": ["id"], "onUpdate": "NO ACTION", "onDelete": "CASCADE", "nameExplicit": false, @@ -937,13 +922,9 @@ "table": "message" }, { - "columns": [ - "message_id" - ], + "columns": ["message_id"], "tableTo": "message", - "columnsTo": [ - "id" - ], + "columnsTo": ["id"], "onUpdate": "NO ACTION", "onDelete": "CASCADE", "nameExplicit": false, @@ -952,13 +933,9 @@ "table": "part" }, { - "columns": [ - "project_id" - ], + "columns": ["project_id"], "tableTo": "project", - "columnsTo": [ - "id" - ], + "columnsTo": ["id"], "onUpdate": "NO ACTION", "onDelete": "CASCADE", "nameExplicit": false, @@ -967,13 +944,9 @@ "table": "permission" }, { - "columns": [ - "project_id" - ], + "columns": ["project_id"], "tableTo": "project", - "columnsTo": [ - "id" - ], + "columnsTo": ["id"], "onUpdate": "NO ACTION", "onDelete": "CASCADE", "nameExplicit": false, @@ -982,13 +955,9 @@ "table": "session" }, { - "columns": [ - "session_id" - ], + "columns": ["session_id"], "tableTo": "session", - "columnsTo": [ - "id" - ], + "columnsTo": ["id"], "onUpdate": "NO ACTION", "onDelete": "CASCADE", "nameExplicit": false, @@ -997,13 +966,9 @@ "table": "todo" }, { - "columns": [ - "session_id" - ], + "columns": ["session_id"], "tableTo": "session", - "columnsTo": [ - "id" - ], + "columnsTo": ["id"], "onUpdate": "NO ACTION", "onDelete": "CASCADE", "nameExplicit": false, @@ -1012,101 +977,77 @@ "table": "session_share" }, { - "columns": [ - "email", - "url" - ], + "columns": ["email", "url"], "nameExplicit": false, "name": "control_account_pk", "entityType": "pks", "table": "control_account" }, { - "columns": [ - "session_id", - "position" - ], + "columns": ["session_id", "position"], "nameExplicit": false, "name": "todo_pk", "entityType": "pks", "table": "todo" }, { - "columns": [ - "id" - ], + "columns": ["id"], "nameExplicit": false, "name": "account_state_pk", "table": "account_state", "entityType": "pks" }, { - "columns": [ - "id" - ], + "columns": ["id"], "nameExplicit": false, "name": "account_pk", "table": "account", "entityType": "pks" }, { - "columns": [ - "id" - ], + "columns": ["id"], "nameExplicit": false, "name": "workspace_pk", "table": "workspace", "entityType": "pks" }, { - "columns": [ - "id" - ], + "columns": ["id"], "nameExplicit": false, "name": "project_pk", "table": "project", "entityType": "pks" }, { - "columns": [ - "id" - ], + "columns": ["id"], "nameExplicit": false, "name": "message_pk", "table": "message", "entityType": "pks" }, { - "columns": [ - "id" - ], + "columns": ["id"], "nameExplicit": false, "name": "part_pk", "table": "part", "entityType": "pks" }, { - "columns": [ - "project_id" - ], + "columns": ["project_id"], "nameExplicit": false, "name": "permission_pk", "table": "permission", "entityType": "pks" }, { - "columns": [ - "id" - ], + "columns": ["id"], "nameExplicit": false, "name": "session_pk", "table": "session", "entityType": "pks" }, { - "columns": [ - "session_id" - ], + "columns": ["session_id"], "nameExplicit": false, "name": "session_share_pk", "table": "session_share", @@ -1212,4 +1153,4 @@ } ], "renames": [] -} \ No newline at end of file +} diff --git a/packages/opencode/src/account/repo.ts b/packages/opencode/src/account/repo.ts index ba71abe34..65f56727b 100644 --- a/packages/opencode/src/account/repo.ts +++ b/packages/opencode/src/account/repo.ts @@ -69,7 +69,15 @@ export class AccountRepo extends ServiceMap.Service< db((db) => current(db)).pipe(Effect.map((row) => (row ? Option.some(decodeAccount(row)) : Option.none()))), ), - list: Effect.fn("AccountRepo.list")(() => db((db) => db.select().from(AccountTable).all().map((row) => decodeAccount({ ...row, active_org_id: null })))), + list: Effect.fn("AccountRepo.list")(() => + db((db) => + db + .select() + .from(AccountTable) + .all() + .map((row) => decodeAccount({ ...row, active_org_id: null })), + ), + ), remove: Effect.fn("AccountRepo.remove")((accountID: AccountID) => db((db) => diff --git a/packages/opencode/src/account/service.ts b/packages/opencode/src/account/service.ts index 68ea9dbde..c57bb459a 100644 --- a/packages/opencode/src/account/service.ts +++ b/packages/opencode/src/account/service.ts @@ -346,7 +346,9 @@ export class AccountService extends ServiceMap.Service< const expiry = now + (parsed.expires_in ?? 0) * 1000 const refresh = parsed.refresh_token ?? "" if (!refresh) { - yield* Effect.logWarning("Server did not return a refresh token — session may expire without ability to refresh") + yield* Effect.logWarning( + "Server did not return a refresh token — session may expire without ability to refresh", + ) } yield* repo.persistAccount({ diff --git a/packages/opencode/src/cli/cmd/account.ts b/packages/opencode/src/cli/cmd/account.ts index 51cf2b138..7e9f893a8 100644 --- a/packages/opencode/src/cli/cmd/account.ts +++ b/packages/opencode/src/cli/cmd/account.ts @@ -75,9 +75,7 @@ const logoutEffect = Effect.fn("logout")(function* (email?: string) { const server = UI.Style.TEXT_DIM + a.url + UI.Style.TEXT_NORMAL return { value: a, - label: isActive - ? `${a.email} ${server}` + UI.Style.TEXT_DIM + " (active)" - : `${a.email} ${server}`, + label: isActive ? `${a.email} ${server}` + UI.Style.TEXT_DIM + " (active)" : `${a.email} ${server}`, } }) diff --git a/packages/opencode/test/cli/import.test.ts b/packages/opencode/test/cli/import.test.ts index 922c08114..d7c0241e6 100644 --- a/packages/opencode/test/cli/import.test.ts +++ b/packages/opencode/test/cli/import.test.ts @@ -24,9 +24,7 @@ test("only attaches share auth headers for same-origin URLs", () => { expect(shouldAttachShareAuthHeaders("https://control.example.com/share/abc", "https://control.example.com")).toBe( true, ) - expect( - shouldAttachShareAuthHeaders("https://other.example.com/share/abc", "https://control.example.com"), - ).toBe(false) + expect(shouldAttachShareAuthHeaders("https://other.example.com/share/abc", "https://control.example.com")).toBe(false) expect(shouldAttachShareAuthHeaders("https://control.example.com:443/share/abc", "https://control.example.com")).toBe( true, ) diff --git a/packages/opencode/tsconfig.json b/packages/opencode/tsconfig.json index 44335bd80..ff9886313 100644 --- a/packages/opencode/tsconfig.json +++ b/packages/opencode/tsconfig.json @@ -12,10 +12,12 @@ "@/*": ["./src/*"], "@tui/*": ["./src/cli/cmd/tui/*"] }, - "plugins": [{ - "name": "@effect/language-service", - "transform": "@effect/language-service/transform", - "namespaceImportPackages": ["effect", "@effect/*"] - }] + "plugins": [ + { + "name": "@effect/language-service", + "transform": "@effect/language-service/transform", + "namespaceImportPackages": ["effect", "@effect/*"] + } + ] } }