/** * Pure splicer for harnery's machine-owned content in a consumer's repo. * * Two shapes of machine-owned content, both hash-versioned so drift is a * byte-compare and a re-splice is idempotent (applying twice = identical bytes): * * 1. A **managed region** inside a larger file the consumer also edits * (`AGENTS.md`, `CLAUDE.md`), delimited by sentinel comments: * * …rendered body… * * Everything outside the sentinels is never touched. * * 2. A **fully-owned file** harnery creates whole (a shipped skill's * `SKILL.md`), carrying an ownership header comment so `deinit` deletes * only files harnery generated and `--check` flags a hand-edit: * * * Modeled on the first host's HTML-theme splicer (regenerate + byte-compare, * sha256-8 hash, content outside the region untouchable). Pure (no fs) so it's * unit-testable like `wireHooks`/`unwireHooks`. */ /** 8-hex-char content hash stamped into every managed marker. */ export declare function shortHash(s: string): string; /** * Marker comment style. Markdown/HTML files wrap markers in HTML comments; * shell files (git hooks) use `#` line comments. The style only changes the * marker syntax — hashing, splice, remove, and check semantics are identical. */ export type CommentStyle = "html" | "hash"; /** Canonical region block: begin-marker, body flanked by newlines, end-marker. */ export declare function regionBlock(region: string, body: string, style?: CommentStyle): string; export type ManagedStatus = "fresh" | "stale" | "missing"; export interface SpliceResult { text: string; changed: boolean; /** the region was already present before this splice */ had: boolean; /** present-but-differs (hash or body); only meaningful when `had` is true */ stale: boolean; } /** * Re-splice (or first-time append) a managed region into `content`. Idempotent: * applying twice yields identical bytes. Content outside the markers is never * touched; a re-splice replaces the region wherever the consumer moved it. When * absent, the block is appended after existing content (blank-line separated); * an empty/whitespace-only `content` becomes just the block. */ export declare function spliceRegion(content: string, region: string, body: string, style?: CommentStyle): SpliceResult; /** * Remove a managed region, collapsing the blank lines it leaves behind. Returns * `removed: false` (content unchanged) when the region is absent. When the region * was the file's only content, the result is the empty string — the caller * decides whether to delete the file. */ export declare function removeRegion(content: string, region: string, style?: CommentStyle): { text: string; removed: boolean; }; /** Region freshness: missing, stale (hash or body drifted), or fresh. */ export declare function checkRegion(content: string, region: string, body: string, style?: CommentStyle): ManagedStatus; /** True when a file carries harnery's ownership header (deinit may delete it). */ export declare function isOwnedFile(content: string): boolean; /** * Wrap a skill file: frontmatter, then a hash-stamped ownership header comment, * then the body. The hash covers the trimmed body so `--check` catches a * hand-edit even if the marker was left alone. `binName` renders the regenerate * / remove hint in the host's own bin. */ export declare function buildOwnedSkill(opts: { name: string; description: string; binName: string; body: string; }): string; /** Owned-skill freshness against a freshly-rendered body (trimmed compare). */ export declare function checkOwnedSkill(content: string, freshBody: string): ManagedStatus; //# sourceMappingURL=splice.d.ts.map