import { type ScaffoldOutcome } from './host-hooks.js'; import { type Ecosystem, type HookInstallerResult } from './init-detect.js'; export type { AiToolInfo, HookInstallerResult } from './init-detect.js'; export { buildNpxCommand, detectEmbeddingTier } from './init-detect.js'; export { AI_PROMPT_BLOCK, generateConfig, generateConfigForFormat, REFLEX_VERSION, } from './init-templates.js'; export declare const OLLAMA_FLOOR_DEFAULT_BASE_URL = "http://localhost:11434"; export declare function probeOllamaFloor(): Promise<{ available: boolean; baseUrl: string; message: string; }>; /** * Scaffold a file with idempotency — skips any file the totem `marker` does NOT * OPEN (a user-owned file, or one that merely QUOTES the marker in its body — the * positional ownership gate shared with `regenerateManagedSessionHooks`, * mmnto-ai/totem#2413). When the caller threads an `endMarker`, a marker-headed * whole file that is a bounded totem-owned region (marker opens it, end marker * present, nothing after) and whose content has DRIFTED from canonical is repaired * in place (`refreshed`) — the #2406 git-hook bounded drift-repair, generalized to * the session-hook family (mmnto-ai/totem#2410, the lc#806 stale-SessionStart fix). * A marker-headed file that is NOT bounded (legacy template with no end marker, or * user content after the end marker) keeps the pre-#2410 `exists` behavior and emits * a one-line notice. Creates parent directories as needed. */ export declare function scaffoldFile(filePath: string, content: string, marker?: string, endMarker?: string): { action: 'created' | 'exists' | 'skipped' | 'refreshed'; err?: string; }; /** * Wire a consumer `package.json`'s `prepare` script to the init-distributed prepare * wrapper (mmnto-ai/totem#2410 PR-B). User-owned content is never overwritten (Prop 289): * * - No `prepare` script → set `"prepare": "node .totem/prepare.cjs"` (`wired`). * - `prepare` already exactly that → `exists` (no write; the file is left byte-identical). * - A DIFFERENT existing `prepare` (or a non-string value) → `declined` (NO write, byte- * identical): the caller prints the canonical line to add manually. * - No `package.json` → `missing` (nothing to wire). * - Unreadable / invalid JSON / a non-object root / a present-but-non-object * `scripts` → `unparseable` (surfaced, never a crash; a non-object `scripts` is * user content we must NOT silently replace — the decline posture, not a clobber). * - A write that throws (perms/FS) → `write-failed` (distinct from a parse/shape * problem, so the caller can tell "couldn't read your file" from "couldn't save it"). * * On the `wired` path the file is rewritten with 2-space JSON + a trailing newline * (mirrors `scaffoldMcpConfig`, the repo's package.json-edit precedent); existing keys * keep their order and `prepare` is appended within `scripts` (stable key order). */ export declare function wirePreparePackageJson(pkgPath: string): { action: 'wired' | 'exists' | 'declined' | 'missing' | 'unparseable' | 'write-failed'; /** The different existing `prepare` value, for the decline notice (present only when a string). */ existing?: string; err?: string; }; /** * Whether a consumer owns a custom `.js` sibling of a managed `.cjs` vendor * hook (mmnto-ai/totem#2601 — the strategy#482 incident: the generic template dropped * beside a repo's own SessionStart.js, double-firing or regressing orientation depending * on Gemini's hook discovery). Ownership is the same positional gate `scaffoldFile` and * `migrateLegacyGeminiHooks` use, so a marker-headed sibling — the legacy `.js`→`.cjs` * migration case — never reports here; only an UNOWNED sibling does. A sibling that * cannot be read is not provably totem-owned and reports (non-destructive posture, * never a crash). Returns the sibling's basename when one is present. * * This is a PREDICATE, not the policy: whether a report withholds the scaffold or only * discloses a coexistence depends on whether the managed `.cjs` already exists — see * `installGeminiHooks`, the sole caller. */ export declare function findUnownedHookSibling(cjsPath: string): string | undefined; export declare function installGeminiHooks(cwd: string): Promise; /** * Merge Totem hooks into .claude/settings.local.json without overwriting * existing user-defined hooks. Installs the Bash matcher for shield-gate. */ export declare function scaffoldClaudeHooks(filePath: string): ScaffoldOutcome; /** * Merge the PreWriteShield hook into .claude/settings.json (committed, * team-level) without overwriting existing user-defined hooks. Installs * the Write|Edit matcher for write-time xrepo-qualify-refs enforcement. * * Distinct from scaffoldClaudeHooks: that targets settings.local.json * (per-developer environment safety); this targets settings.json * (team-level governance, sealed at mmnto-ai/totem-strategy#145). */ export declare function scaffoldClaudeWriteShield(filePath: string): ScaffoldOutcome; /** * Merge the Claude SessionStart hook entry into .claude/settings.json * (committed, team-level) without overwriting existing user-defined * hooks. Symmetric with the Gemini-side .gemini/hooks/SessionStart.cjs * install (mmnto-ai/totem#1845 slice 1) — orientation IS a team-level * guarantee, so it shares the committed settings.json placement with * Phase B's PreWriteShield. */ export declare function scaffoldClaudeSessionStart(filePath: string): ScaffoldOutcome; /** * Install or refresh a Claude Code skill file at the target path using * marker-based replacement. The canonical content lives between * `SKILL_MARKER_START` and `SKILL_MARKER_END`; content AFTER the end marker * is user-customization territory and survives across refreshes (Phase C * slice 3 design doc, mmnto-ai/totem#1890). * * Outcomes: * - `created` — file didn't exist; wrote canonical * - `refreshed` — file existed with markers; replaced inside-marker content, * preserved everything after the end marker * - `unchanged` — file existed with markers and the merged content was * byte-identical to the existing content * - `preserved` — file exists without the end marker (user-authored, * pre-marker scaffold, or malformed); skipped to preserve user content. * Surfaces a warning hint via `err` so callers can log a migration nudge. */ export declare function scaffoldClaudeSkill(filePath: string, canonicalContent: string, options?: { force?: boolean; }): { action: 'created' | 'refreshed' | 'unchanged' | 'preserved'; /** True only when the no-marker guard was suppressed by `options.force`. * Lets callers emit the destructive-by-consent warning + summary line * surface (W3.5, mmnto-ai/totem#2008). */ forceSuppressed?: boolean; err?: string; }; export declare function scaffoldMcpConfig(filePath: string, serverEntry: Record, opts?: { /** The project root — the second resolution base for relative script pins * (host configs in subdirectories carry root-relative pins; leg D1). */ projectRoot?: string; }): { action: 'created' | 'merged' | 'skipped'; /** The entry name an existing `@mmnto/mcp` registration was found under, when the * skip came from the package-level dedup rather than the `totem` key check. */ existingName?: string; err?: string; }; /** * Install the Universal AI Developer Baseline lessons into the lessons file. * Returns 'installed', 'exists' (already present), or 'skipped' (user declined). * In non-interactive mode (CI, `--yes`, piped input), defaults to installing without * prompting. `interactive` is threaded from init's single non-interactive predicate * (mmnto-ai/totem#2601) and falls back to the bare TTY probe for standalone callers. */ export declare function installBaselineLessons(baselinePath: string, rl: import('node:readline/promises').Interface, ecosystems?: Ecosystem[], interactive?: boolean): Promise<'installed' | 'exists' | 'skipped'>; export type ReflexStatus = 'current' | 'outdated' | 'missing'; /** Detect whether the reflex block in a file is current, outdated, or missing. */ export declare function detectReflexStatus(content: string): ReflexStatus; /** * Upgrade a reflex block from legacy (v1, no boundaries) or older versioned * blocks to the current version. Returns the updated file content. * * Strategy: * - If start/end boundaries exist, replace between them (clean swap). * - If only the legacy sentinel exists (v1), find the block start and * look for the next user-owned `## ` heading or EOF as the boundary. * - If the boundary can't be determined cleanly, append the new block * and set `clean: false` so the caller can warn about manual cleanup. */ export declare function upgradeReflexes(content: string): { content: string; clean: boolean; }; /** * Resolve the AI-tool selection prompt's answer. Anything that is not an explicit * `none` / `select` is the Enter default, `all` — which is also the answer the * non-interactive path takes without raising the prompt (mmnto-ai/totem#2601). */ export declare function resolveToolSelection(answer: string): 'all' | 'none' | 'select'; export declare function initCommand(options?: { bare?: boolean; pilot?: boolean; strict?: boolean; global?: boolean; /** Force-overwrite distributed skill files lacking canonical markers * (W3.5, mmnto-ai/totem#2008). Default behavior preserves user-authored * or pre-marker scaffold files; force-mode suppresses ONLY the no-marker * guard. Marker-bearing files refresh via the normal path regardless. */ forceSkillRefresh?: boolean; /** Install action-gate PreToolUse hooks (PR-C, mmnto-ai/totem#2048): a * comma-list of gate names (validated against `knownGateEvents()`) or * the literal `all`. Routes through the SAME `installGates` path the * `gate install` verb uses — no second copy of the merge logic. */ gates?: string; /** Wire `orient.parityManifest` to the installed doctrine pin and exit * (mmnto-ai/totem#2088, Proposal 292 S1). Non-interactive; honest-absent * when the `@mmnto/strategy-doctrine` pin is not installed. */ doctrine?: boolean; /** Answer every prompt with its default and raise none (mmnto-ai/totem#2601). * Implied when stdin is not a TTY: a partial guard let a stdin-null init print * the non-interactive banner and still die at an unguarded prompt with mutations * already landed. Every non-interactive default is logged. */ yes?: boolean; /** Override home directory for testing. */ _homeDir?: string; }): Promise; //# sourceMappingURL=init.d.ts.map