/** * Entry-point injection for `fragment connect`. * * WHY THIS EXISTS * --------------- * `connect` used to WRITE glue files and then print "Wired surfaces" — but * nothing ever imported them, so the glue was dead code and the claim was a * document rather than a control. Invariant I3b (scripts/verify-fragment.mjs) * now checks that claim, and this module is what makes it true: each glue- * bearing surface's entry point gets the import and the call. * * IDEMPOTENCY * ----------- * Every injected region carries GLUE_MARKER. Its presence in a file is the * whole idempotency check: re-running `connect` on an already-wired entry point * makes no second edit, so imports and calls never duplicate. The injected * content deliberately references only STABLE symbols (an aggregator, not a * per-MCP-server function), so a marker hit is always a correct skip. */ /** Written into every injected region; presence == "already wired". */ export declare const GLUE_MARKER = "fragment:plugin-glue"; export interface EntryInjection { /** Absolute path to the surface's entry point. */ file: string; /** Import statements added below the file's existing imports. */ imports: string[]; /** Statements inserted after `anchor`, or appended at EOF when absent. */ body: string[]; /** * Insert `body` directly after the LAST line matching this pattern. When it * does not match, the body is appended at EOF instead — which is correct for * module-scope entry points (renderer.tsx) and wrong for function-scope ones, * so callers that REQUIRE an anchor pass `anchorRequired`. */ anchor?: RegExp; /** Skip injection entirely when `anchor` does not match (no EOF fallback). */ anchorRequired?: boolean; /** Indentation applied to each body line (function-scope injections). */ indent?: string; } export interface InjectionResult { file: string; /** true when the entry point now carries the glue wiring. */ wired: boolean; /** 'injected' | 'already-wired' | 'missing-entry' | 'anchor-not-found' */ status: 'injected' | 'already-wired' | 'missing-entry' | 'anchor-not-found'; } /** * Inject an import + a call into a TypeScript/TSX entry point, idempotently. * Returns what happened so `connect` can report wiring honestly instead of * assuming it. */ export declare function injectEntry(injection: EntryInjection): InjectionResult; /** * Inject a Go import + a call into a Go entry point, idempotently. * * Go needs its own path: imports live inside an `import ( ... )` block rather * than at top level, and the import path is the MODULE path plus the package * directory, which has to be read out of go.mod. */ export declare function injectGoEntry(options: { /** Absolute path to the Go entry point (main.go). */ file: string; /** Absolute path to the module's go.mod (or go.mod.tmpl-emitted go.mod). */ goModPath: string; /** Package directory relative to the module root, e.g. 'plugin-glue'. */ packageDir: string; /** Package name declared in that directory, e.g. 'pluginglue'. */ packageName: string; /** Statements inserted after `anchor`. */ body: string[]; anchor: RegExp; indent?: string; }): InjectionResult; //# sourceMappingURL=inject.d.ts.map