/** * Config-file scaffolding: .gitignore, worktree-include, config.json, * project-info.json, and related template/version utilities. */ import type { ScaffoldResult } from '@cleocode/contracts/scaffold-diagnostics'; /** * Resolve the `.cleo` directory for scaffold steps. * * During first-time `cleo init`, `project-info.json` and nexus registration do * not exist yet, so the projectId-based resolver is intentionally unavailable. * Scaffold callers fall back to the local project root in that bootstrap window. * * @param projectRoot - Absolute path to the project root directory. * @returns Absolute path to the project's `.cleo` directory. */ export declare function resolveScaffoldCleoDir(projectRoot: string): string; /** * Embedded fallback for .cleo/.gitignore content (deny-by-default). * * ADR-013 §9: config.json / project-info.json are NOT re-included here. */ export declare const CLEO_GITIGNORE_FALLBACK = "# .cleo/.gitignore \u2014 Deny-by-default for CLEO project data\n# Ignore everything, then explicitly allow only tracked files.\n#\n# ADR-013 \u00A79 (2026-04-07, T5158): config.json + project-info.json are\n# runtime snapshots regenerated by `cleo init`, not tracked in git.\n# Recovery for all four runtime files (tasks.db, brain.db, config.json,\n# project-info.json) is provided by `cleo backup add` snapshots under\n# .cleo/backups/. See .cleo/adrs/ADR-013 for the full recovery story.\n\n# Step 1: Ignore everything\n*\n\n# Allow list\n!.gitignore\n!project-context.json\n!setup-otel.sh\n!DATA-SAFETY-IMPLEMENTATION-SUMMARY.md\n!adrs/\n!adrs/**\n!rcasd/\n!rcasd/**\n!agent-outputs/\n!agent-outputs/**\n\n# Explicit deny safety net\n*.db\n*.db-shm\n*.db-wal\n*.db-journal\nconfig.json\nproject-info.json\nlog.json\nbypass-log.json\nqa-log.json\n.deps-cache/\n.context-alert-state.json\n.context-state*.json\ncontext-states/\n.git-checkpoint-state\n.migration-state.json\nmigrations.json\nsync/\nmetrics/\n.backups/\nbackups/\n\n# Session journals \u2014 T1263 PSYCHE E6 (sensitive session data \u2014 task IDs, notes, agent IDs)\n# Retain locally for meta-agent training; never commit to project git.\nsession-journals/\n"; /** * Embedded fallback for `.worktreeinclude` (canonical) content. * * The canonical location (T9983) is `/.worktreeinclude` — * matches Claude Code Desktop + worktrunk-core. The legacy location * `/.cleo/worktree-include` is still read for one deprecation * cycle; `cleo doctor --migrate-worktree-include` auto-migrates. * * @task T9983 */ export declare const WORKTREE_INCLUDE_FALLBACK = "# .worktreeinclude \u2014 files to copy into agent worktrees on provisioning.\n#\n# Syntax: gitignore-style globs (parsed by ignore::gitignore via\n# @cleocode/worktree-napi). Lines starting with `!` are negations.\n#\n# Local environment overrides (gitignored but required for dev)\n.env.local\n.env.development.local\n\n# Package-manager configuration (registry auth, resolution rules)\n.npmrc\n.yarnrc\n.pnpmrc\n"; /** * Resolve the package root directory (where schemas/ and templates/ live). * * @returns Absolute path to the @cleocode/core package root */ export declare function getPackageRoot(): string; /** * Load the gitignore template from the package's templates/ directory. * Falls back to embedded content if file not found. * * @returns The .cleo/.gitignore template content string */ export declare function getGitignoreContent(): string; /** * Load the `.worktreeinclude` template from the package's templates/ * directory. * * Resolution order (T9983): * 1. `templates/worktreeinclude` — canonical (matches the file name we * write at the project root). * 2. `templates/worktree-include` — legacy template kept for one * deprecation cycle so partially-updated installations keep working. * 3. {@link WORKTREE_INCLUDE_FALLBACK} embedded constant. * * @returns The `.worktreeinclude` template content string * * @task T9983 */ export declare function getWorktreeIncludeContent(): string; /** * Read CLEO version from package.json. * * @returns Semver version string, or "0.0.0" if unavailable */ export declare function getCleoVersion(): string; /** * Create default config.json content. * * @returns A plain object with the default CLEO configuration structure */ export declare function createDefaultConfig(): Record; /** * Create or repair .cleo/.gitignore from template. * Idempotent: skips if file already exists with correct content. * * @param projectRoot - Absolute path to the project root directory * @returns Scaffold result indicating whether the gitignore was created, repaired, or skipped */ export declare function ensureGitignore(projectRoot: string): Promise; /** * Create or repair `.worktreeinclude` (canonical, at project root) from the * shipped template. Idempotent — skips when the existing file already * matches the template byte-for-byte (after CR-LF + trim normalisation). * * Resolution rules (T9983): * - If `/.worktreeinclude` already exists → keep + compare to * the template; repair if drifted. * - Else if legacy `/.cleo/worktree-include` exists → SKIP * (do not overwrite the legacy file in place; `cleo doctor * --migrate-worktree-include` is the explicit migration path). * - Else → write the canonical template. * * @param projectRoot - Absolute path to the project root directory * @returns Scaffold result indicating whether `.worktreeinclude` was * created, repaired, or skipped. * * @task T9983 */ export declare function ensureWorktreeInclude(projectRoot: string): Promise; /** * Create default config.json if missing. * Idempotent: skips if file already exists. * * @param projectRoot - Absolute path to the project root directory * @param opts - Optional configuration * @param opts.force - When true, overwrite the existing config * @returns Scaffold result indicating the action taken */ export declare function ensureConfig(projectRoot: string, opts?: { force?: boolean; }): Promise; /** * Create or refresh project-info.json. * Idempotent: skips if file exists (unless force). * * @param projectRoot - Absolute path to the project root directory * @param opts - Optional configuration * @param opts.force - When true, regenerate even if the file exists * @returns Scaffold result indicating the action taken */ export declare function ensureProjectInfo(projectRoot: string, opts?: { force?: boolean; }): Promise; /** * No-op. Kept for API compatibility. * * @param projectRoot - Absolute path to the project root directory * @returns Scaffold result with action "skipped" */ export declare function ensureContributorMcp(projectRoot: string): Promise; //# sourceMappingURL=ensure-config.d.ts.map