/** Safe, format-neutral primitives for Monomind-managed configuration content. */ export interface SafeJsonResult { content: string; diagnostics: readonly string[]; } /** `html` (``) is the Markdown form: a `# monomind:start` line is a * level-1 heading there. All three forms are read, whatever is written. */ export type MarkerComment = '#' | '//' | 'html'; /** * Adds or replaces one managed marker block. Blocks for other artifacts and * platforms are deliberately left untouched. */ export declare function mergeManagedBlock(existing: string, marker: string, content: string, comment?: MarkerComment): string; /** The body of the `marker` block in `existing` (`\n` line endings), or null if absent. */ export declare function readManagedBlock(existing: string, marker: string): string | null; /** * The merge for portable skill files. Their content is wholly generated: * `copySkills` writes the canonical source to this same path unwrapped before * the adapter install runs, and every version predating markers left exactly * that. `mergeManagedBlock` found no marker of its own, appended a fresh block, * and the body ended up in the file twice (GH #286 — codex-tools.md 64 -> 130 * lines, six reference files doubled). * * So before appending, an undelimited copy of the generated body is looked for * and replaced where it sits, reusing the detection GH #276 built for CLAUDE.md * (init/managed-block.ts): the region must open on the generated title line and * carry at least three of the generated `## ` headings, and it stops at the * first heading that is demonstrably not ours. Hand-authored text on either side * keeps its position, and a body that cannot be proven generated is left alone * and appended beside instead. * * Only text OUTSIDE every marker block is searched: in a shared skill root each * adapter installs its own block around this same body, and absorbing a * neighbour's would gut it. */ export declare function mergeSkillFileManagedBlock(existing: string, marker: string, content: string, comment?: MarkerComment): string; /** * `text` without the `skills::` ownership markup older versions * wrapped shipped skill files in (GH #344): each block's marker lines go, and * a block repeating an earlier block's artifact goes whole (the 2.16.0 shared * root carried the same body once per platform). Text outside the blocks and * every other marker namespace are kept. Used to compare a file with what * ships, ignoring that markup. */ export declare function withoutSkillOwnership(text: string): string; /** * Folds blocks written under superseded markers into `marker`. Before shared * skill roots were co-owned, each platform targeting `.agents/skills` wrapped * the same body in its own `skills::` block. The first such * block is renamed in place (so the refresh keeps its position) unless * `marker` already exists; every other one is dropped. Text outside the * blocks is untouched. */ export declare function adoptSupersededBlocks(existing: string, marker: string, superseded: readonly string[]): string; /** Removes exactly one artifact/platform block, leaving all other content unchanged. */ export declare function removeManagedBlock(content: string, artifact: string, platform: string): string; /** Whether `content` holds a complete block for exactly `marker`. */ export declare function hasManagedMarker(content: string, marker: string): boolean; /** Removes a block by its full marker for artifacts with qualified names. */ export declare function removeManagedMarker(content: string, marker: string): string; /** The `name:` in a SKILL.md's frontmatter. */ export declare function skillName(content: string): string | undefined; /** * SKILL.md requires YAML frontmatter to be its first bytes. Keep it outside * the managed marker and replace only Monomind's body block. A same-name file * may contain user guidance around the block; a different-name file is foreign * and is never overwritten by an adapter install. */ export declare function mergeSkillManagedBlock(existing: string, marker: string, rendered: string, comment?: MarkerComment): SafeJsonResult; /** Merges a named JSON object entry, leaving malformed input unmodified. */ export declare function safeJsonMerge(content: string, path: readonly string[], entry: unknown): SafeJsonResult; /** Convenience form for callers that do not need malformed-input diagnostics. */ export declare function mergeNamedEntry(content: string, path: readonly string[], entry: unknown): string; /** Removes a named JSON object entry, leaving malformed input unmodified. */ export declare function safeJsonRemove(content: string, path: readonly string[], name: string): SafeJsonResult; /** Convenience form for callers that do not need malformed-input diagnostics. */ export declare function removeNamedEntry(content: string, path: readonly string[], name: string): string; //# sourceMappingURL=merge.d.ts.map