Skip to content

Commit fb7cd2f

Browse files
DeusDataJCVIIAm
andcommitted
style(cli): clang-format the extended OpenCode generator block
Maintainer mechanics on top of the accepted feature: merge current main and format the 24 violations in the edited region of client_adapter.c — the only red CI leg. No content change; the generated plugin is byte-identical apart from whitespace in the C literals' layout. Co-authored-by: jc <jcvi007@gmail.com> Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
1 parent 93f7d27 commit fb7cd2f

1 file changed

Lines changed: 24 additions & 26 deletions

File tree

‎src/cli/client_adapter.c‎

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -259,13 +259,12 @@ char *cbm_client_adapter_opencode(const char *binary_path) {
259259

260260
adapter_sb_t sb = {0};
261261
emit_header(&sb, "OpenCode");
262-
sb_append(&sb,
263-
"// OpenCode already reaches every tool over MCP; this module adds the\n"
264-
"// context surfaces other clients get through hook configuration: graph\n"
265-
"// lookup after grep/glob, index-coverage notes after read, session-start\n"
266-
"// tier routing (carried on the first tool result of each session, since\n"
267-
"// OpenCode documents no context-output lifecycle hook), and reinjection\n"
268-
"// after compaction via the documented experimental surface.\n");
262+
sb_append(&sb, "// OpenCode already reaches every tool over MCP; this module adds the\n"
263+
"// context surfaces other clients get through hook configuration: graph\n"
264+
"// lookup after grep/glob, index-coverage notes after read, session-start\n"
265+
"// tier routing (carried on the first tool result of each session, since\n"
266+
"// OpenCode documents no context-output lifecycle hook), and reinjection\n"
267+
"// after compaction via the documented experimental surface.\n");
269268
sb_append(&sb, "import { spawn } from 'node:child_process';\n\n");
270269
sb_append(&sb, "const BIN = '");
271270
sb_append(&sb, bin);
@@ -276,25 +275,24 @@ char *cbm_client_adapter_opencode(const char *binary_path) {
276275
* SessionStart lifecycle event — and emits the Claude JSON envelope, so
277276
* the plugin unwraps additionalContext instead of pasting raw JSON into
278277
* the tool output. Every failure path resolves to '' (fail open). */
279-
sb_append(&sb,
280-
"function augment(payload) {\n"
281-
" return new Promise((resolve) => {\n"
282-
" const child = spawn(BIN, ['hook-augment'], {\n"
283-
" stdio: ['pipe', 'pipe', 'ignore'],\n"
284-
" env: { ...process.env, CBM_LOG_LEVEL: 'error' },\n"
285-
" });\n"
286-
" let out = '';\n"
287-
" child.stdout.on('data', (d) => (out += d.toString()));\n"
288-
" child.on('error', () => resolve(''));\n"
289-
" child.on('close', () => {\n"
290-
" try {\n"
291-
" const ctx = JSON.parse(out)?.hookSpecificOutput?.additionalContext;\n"
292-
" resolve(typeof ctx === 'string' ? ctx : '');\n"
293-
" } catch { resolve(''); }\n"
294-
" });\n"
295-
" child.stdin.end(JSON.stringify(payload));\n"
296-
" });\n"
297-
"}\n\n");
278+
sb_append(&sb, "function augment(payload) {\n"
279+
" return new Promise((resolve) => {\n"
280+
" const child = spawn(BIN, ['hook-augment'], {\n"
281+
" stdio: ['pipe', 'pipe', 'ignore'],\n"
282+
" env: { ...process.env, CBM_LOG_LEVEL: 'error' },\n"
283+
" });\n"
284+
" let out = '';\n"
285+
" child.stdout.on('data', (d) => (out += d.toString()));\n"
286+
" child.on('error', () => resolve(''));\n"
287+
" child.on('close', () => {\n"
288+
" try {\n"
289+
" const ctx = JSON.parse(out)?.hookSpecificOutput?.additionalContext;\n"
290+
" resolve(typeof ctx === 'string' ? ctx : '');\n"
291+
" } catch { resolve(''); }\n"
292+
" });\n"
293+
" child.stdin.end(JSON.stringify(payload));\n"
294+
" });\n"
295+
"}\n\n");
298296

299297
sb_append(&sb,
300298
"export const CodebaseMemory = async (ctx) => {\n"

0 commit comments

Comments
 (0)