mirror of
https://github.com/anomalyco/opencode.git
synced 2026-07-10 00:28:29 +00:00
chore: generate
This commit is contained in:
parent
31c5454ee6
commit
6dd4d1473c
3 changed files with 13 additions and 48 deletions
|
|
@ -40,8 +40,11 @@ const FileReadCommand = effectCmd({
|
|||
handler: Effect.fn("Cli.debug.file.read")(function* (args) {
|
||||
const file = yield* filesystem(FileSystem.Service.use((svc) => svc.read({ path: RelativePath.make(args.path) })))
|
||||
process.stdout.write(
|
||||
JSON.stringify({ content: Buffer.from(file.content).toString("base64"), encoding: "base64", mime: file.mime }, null, 2) +
|
||||
EOL,
|
||||
JSON.stringify(
|
||||
{ content: Buffer.from(file.content).toString("base64"), encoding: "base64", mime: file.mime },
|
||||
null,
|
||||
2,
|
||||
) + EOL,
|
||||
)
|
||||
}),
|
||||
})
|
||||
|
|
|
|||
|
|
@ -12463,7 +12463,7 @@
|
|||
]
|
||||
}
|
||||
},
|
||||
"/api/fs/read": {
|
||||
"/api/fs/read/*": {
|
||||
"get": {
|
||||
"tags": ["filesystem"],
|
||||
"operationId": "v2.fs.read",
|
||||
|
|
@ -12486,14 +12486,6 @@
|
|||
"required": false,
|
||||
"style": "deepObject",
|
||||
"explode": true
|
||||
},
|
||||
{
|
||||
"name": "path",
|
||||
"in": "query",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
},
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"security": [],
|
||||
|
|
@ -12501,19 +12493,10 @@
|
|||
"200": {
|
||||
"description": "Success",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"application/octet-stream": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"location": {
|
||||
"$ref": "#/components/schemas/LocationInfo"
|
||||
},
|
||||
"data": {
|
||||
"$ref": "#/components/schemas/FileSystemContent"
|
||||
}
|
||||
},
|
||||
"required": ["location", "data"],
|
||||
"additionalProperties": false
|
||||
"type": "string",
|
||||
"format": "binary"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -12539,7 +12522,7 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"description": "Read one file relative to the requested location.",
|
||||
"description": "Serve one file relative to the requested location.",
|
||||
"summary": "Read file",
|
||||
"x-codeSamples": [
|
||||
{
|
||||
|
|
@ -26560,29 +26543,6 @@
|
|||
"required": ["id", "projectID", "action", "resource"],
|
||||
"additionalProperties": false
|
||||
},
|
||||
"FileSystemContent": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"uri": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"content": {
|
||||
"type": "string"
|
||||
},
|
||||
"encoding": {
|
||||
"type": "string",
|
||||
"enum": ["utf8", "base64"]
|
||||
},
|
||||
"mime": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": ["uri", "content", "encoding", "mime"],
|
||||
"additionalProperties": false
|
||||
},
|
||||
"FileSystemEntry": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,9 @@ export const FileSystemHandler = HttpApiBuilder.group(Api, "server.fs", (handler
|
|||
.handleRaw("fs.read", (ctx) =>
|
||||
Effect.gen(function* () {
|
||||
const file = yield* (yield* FileSystem.Service).read({
|
||||
path: RelativePath.make(decodeURIComponent(new URL(ctx.request.url, "http://localhost").pathname.slice(13))),
|
||||
path: RelativePath.make(
|
||||
decodeURIComponent(new URL(ctx.request.url, "http://localhost").pathname.slice(13)),
|
||||
),
|
||||
})
|
||||
return HttpServerResponse.uint8Array(file.content, { contentType: file.mime })
|
||||
}),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue