fix(app): default project picker to home

This commit is contained in:
Brendan Allan 2026-07-31 04:07:43 +00:00 committed by opencode-agent[bot]
commit 7865d69001
10 changed files with 31 additions and 8 deletions

View file

@ -21,6 +21,11 @@ export class Info extends Schema.Class<Info>("Location.Info")({
}),
}) {}
export class Details extends Schema.Class<Details>("Location.Details")({
...Info.fields,
home: AbsolutePath,
}) {}
export function response<S extends Schema.Top>(data: S) {
return Schema.Struct({ location: Info, data })
}

View file

@ -0,0 +1,14 @@
import { expect, test } from "bun:test"
import { Schema } from "effect"
import { Location } from "../src/location.js"
const details = {
directory: "/project",
project: { id: "project", directory: "/project", canonical: "/project" },
home: "/home/user",
}
test("Location.Details includes the server home directory", () => {
expect(Schema.decodeUnknownSync(Location.Details)(details).home).toBe("/home/user")
expect(() => Schema.decodeUnknownSync(Location.Details)({ ...details, home: undefined })).toThrow()
})