MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / ha_emit

Function ha_emit

src/cli/hook_augment.c:229–244  ·  view source on GitHub ↗

Emit the PreToolUse additionalContext payload to stdout (exactly once). */

Source from the content-addressed store, hash-verified

227
228/* Emit the PreToolUse additionalContext payload to stdout (exactly once). */
229static void ha_emit(const char *text) {
230 yyjson_mut_doc *doc = yyjson_mut_doc_new(NULL);
231 yyjson_mut_val *root = yyjson_mut_obj(doc);
232 yyjson_mut_doc_set_root(doc, root);
233 yyjson_mut_val *hso = yyjson_mut_obj(doc);
234 yyjson_mut_obj_add_str(doc, hso, "hookEventName", "PreToolUse");
235 yyjson_mut_obj_add_str(doc, hso, "additionalContext", text);
236 yyjson_mut_obj_add_val(doc, root, "hookSpecificOutput", hso);
237
238 char *json = yyjson_mut_write(doc, 0, NULL);
239 if (json) {
240 fputs(json, stdout);
241 free(json);
242 }
243 yyjson_mut_doc_free(doc);
244}
245
246/* True for an absolute path we can walk up: POSIX "/..." or a Windows drive
247 * root — "X:/..." or a bare "X:" (callers normalize '\\' to '/' first).

Callers 1

cbm_cmd_hook_augmentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected