refactor(core): consolidate references (#31539)

This commit is contained in:
Dax 2026-06-09 12:08:58 -04:00 committed by GitHub
commit 6566ede935
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
65 changed files with 687 additions and 2730 deletions

View file

@ -8,13 +8,11 @@ import { LocationQuery, locationQueryOpenApi, LocationMiddleware } from "./locat
const ReadQuery = Schema.Struct({
...LocationQuery.fields,
path: RelativePath,
reference: Schema.String.pipe(Schema.optional),
})
const ListQuery = Schema.Struct({
...LocationQuery.fields,
path: RelativePath.pipe(Schema.optional),
reference: Schema.String.pipe(Schema.optional),
})
export const FileSystemGroup = HttpApiGroup.make("server.fs")

View file

@ -0,0 +1,28 @@
import { Location } from "@opencode-ai/core/location"
import { Reference } from "@opencode-ai/core/reference"
import { Schema } from "effect"
import { HttpApiEndpoint, HttpApiGroup, OpenApi } from "effect/unstable/httpapi"
import { LocationMiddleware, LocationQuery, locationQueryOpenApi } from "./location"
export const ReferenceGroup = HttpApiGroup.make("server.reference")
.add(
HttpApiEndpoint.get("reference.list", "/api/reference", {
query: LocationQuery,
success: Location.response(Schema.Array(Reference.Info)),
})
.annotateMerge(locationQueryOpenApi)
.annotateMerge(
OpenApi.annotations({
identifier: "v2.reference.list",
summary: "List references",
description: "List references available in the requested location.",
}),
),
)
.annotateMerge(
OpenApi.annotations({
title: "reference",
description: "Location-scoped project references.",
}),
)
.middleware(LocationMiddleware)