MCPcopy Create free account
hub / github.com/TraderAlice/OpenAlice / composeCommand

Function composeCommand

src/workspaces/adapters/opencode.ts:88–103  ·  view source on GitHub ↗
(_base: readonly string[], ctx: SpawnContext)

Source from the content-addressed store, hash-verified

86 },
87
88 composeCommand(_base: readonly string[], ctx: SpawnContext): readonly string[] {
89 // Tool access is via the injected CLI shims, so the command head is just
90 // the binary + a resume flag (if any). Resume is a top-level flag on the
91 // bare TUI — verified against opencode 1.16.0.
92 const head = ['opencode'];
93 if (ctx.resume === undefined) {
94 // Quick-chat seed: `opencode --prompt <text>` opens the TUI seeded with
95 // that first message (top-level flag on the default TUI command, verified
96 // 1.16.0). The value is a flag argument, so a `-`-leading prompt needs no
97 // `--` terminator. Fresh spawns only.
98 if (ctx.initialPrompt) return [...head, '--prompt', ctx.initialPrompt];
99 return head;
100 }
101 if (ctx.resume === 'last') return [...head, '--continue'];
102 return [...head, '--session', ctx.resume.sessionId];
103 },
104
105 // Headless: `opencode run <prompt>` is non-interactive and exits at the turn
106 // boundary. Tool access is via the injected CLI shims and bundled skills;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected