mirror of
https://github.com/anomalyco/opencode.git
synced 2026-07-18 13:23:45 +00:00
feat(cli): add session resume flags (#34713)
Co-authored-by: Kit Langton <7587245+kitlangton@users.noreply.github.com>
This commit is contained in:
parent
1ce607c230
commit
2324a63fc6
3 changed files with 14 additions and 2 deletions
|
|
@ -14,6 +14,16 @@ export const Commands = Spec.make(typeof OPENCODE_CLI_NAME === "string" ? OPENCO
|
|||
Flag.withDescription("Run with a private server instead of the background service"),
|
||||
Flag.withDefault(false),
|
||||
),
|
||||
continue: Flag.boolean("continue").pipe(
|
||||
Flag.withAlias("c"),
|
||||
Flag.withDescription("Continue the last session"),
|
||||
Flag.withDefault(false),
|
||||
),
|
||||
session: Flag.string("session").pipe(
|
||||
Flag.withAlias("s"),
|
||||
Flag.withDescription("Session ID to continue"),
|
||||
Flag.optional,
|
||||
),
|
||||
},
|
||||
commands: [
|
||||
Spec.make("api", {
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ export default Runtime.handler(Commands, (input) =>
|
|||
const { runTui } = yield* Effect.promise(() => import("../../tui"))
|
||||
yield* runTui(
|
||||
transport,
|
||||
{ continue: input.continue, sessionID: Option.getOrUndefined(input.session) },
|
||||
input.standalone
|
||||
? undefined
|
||||
: async () => {
|
||||
|
|
|
|||
|
|
@ -5,10 +5,11 @@ import { Global } from "@opencode-ai/core/global"
|
|||
import { loadBuiltinPlugins } from "@opencode-ai/tui/builtins"
|
||||
import { OpenCode } from "@opencode-ai/client"
|
||||
import { createOpencodeClient } from "@opencode-ai/sdk/v2/client"
|
||||
import type { Args } from "@opencode-ai/tui/context/args"
|
||||
|
||||
type Transport = { url: string; headers: RequestInit["headers"] }
|
||||
|
||||
export function runTui(transport: Transport, reload?: () => Promise<Transport>) {
|
||||
export function runTui(transport: Transport, args: Args, reload?: () => Promise<Transport>) {
|
||||
const config = TuiConfig.resolve({}, { terminalSuspend: false })
|
||||
let disposeSlots: (() => void) | undefined
|
||||
return Effect.gen(function* () {
|
||||
|
|
@ -32,7 +33,7 @@ export function runTui(transport: Transport, reload?: () => Promise<Transport>)
|
|||
}
|
||||
}
|
||||
: undefined,
|
||||
args: {},
|
||||
args,
|
||||
config,
|
||||
pluginHost: {
|
||||
async start(input) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue