import { type Profile } from '@manehorizons/cadence-types'; /** * Suggest a gate profile from git history: a repo with ≥20 commits is * mature enough to want the `standard` gate set; a reachable repo with * fewer commits gets `auto`; any git failure (no repo, bare, zero commits) * also falls back to `auto`. Never throws. * * (Relocated from init.ts in phase 132 so `planInit` and the init write path * share one source of truth.) */ export declare function suggestGateProfile(cwd: string): Profile; /** Languages `detectProjectLanguage` can identify from root marker files. */ export type ProjectLanguage = 'js' | 'python' | 'go' | 'rust' | 'php' | 'unknown'; /** * Best-effort project-language sniff from root marker files (Phase 166, * AC-1). Checked in this exact priority order — `package.json` first, so a * mixed-language monorepo (e.g. a root `package.json` alongside a nested * `pyproject.toml`) deterministically resolves to `'js'` rather than * guessing at monorepo structure (an explicitly open question, out of scope * here). Never throws — any fs failure (missing dir, permission error) falls * back to `'unknown'`. */ export declare function detectProjectLanguage(cwd: string): ProjectLanguage; /** * Pick `verification.testGlobs` from the repo's layout and detected language * (F2, Phase 29.1 shakedown; language-aware defaults added Phase 166, AC-2). * For `'js'`/`'unknown'` the original behavior is unchanged: a `packages/` * directory at the init root means a monorepo — keep the workspace glob * (correct for cadence's own dogfood); any other shape is treated as * single-package, a depth-agnostic `**\/*.test.ts(x)` glob so the * test-coverage gate can match tests under `tests/`, `src/`, `__tests__/`, * etc. Other detected languages get sensible defaults for that language's * conventional test-file naming instead. `lang` defaults to * `detectProjectLanguage(cwd)` but can be passed explicitly by callers that * already detected it, to avoid a second fs sniff. Never throws. */ export declare function detectTestGlobs(cwd: string, lang?: ProjectLanguage): string[]; /** `verification.coverageMode` values the config schema admits. */ export type CoverageMode = 'mention' | 'assertion'; /** * Language-aware `verification.coverageMode` default (Phase 166, AC-1). The * config schema's static default (`packages/types/src/config.ts`'s * `DEFAULT_CONFIG`) writes `'assertion'` unconditionally. When this default * was written (Phase 166), `assertion` mode's span-finder understood JS/TS * test files only, so defaulting a non-JS/TS project to `assertion` would * have produced a `test-coverage` gate that could never pass no matter how * well-tested the code was — `'js'` kept that default unchanged, every other * detected (or undetected) language got the honest `'mention'` default * instead. As of Phase 167 the span-finder is a shared multi-language engine * with real built-in support for python/go/rust/php too (per-file dispatch, * `../verify/coverage-profiles/registry.ts`), so `'assertion'` is no longer * permanently unsatisfiable for those languages — but this function's * *behavior* is deliberately unchanged: Phase 167 shipped the span-parsing, * not a revisit of what a fresh `init` auto-writes, so non-js languages * still default to `'mention'` here, and switching to `'assertion'` is left * as a manual, informed `cadence config edit coverageMode` choice that now * genuinely works (see `docs/reference/config.md`'s "Supported-language * matrix" section). `lang` defaults to `detectProjectLanguage(cwd)` but can * be passed explicitly by callers (e.g. `init.ts`) that already detected it, * to share one fs sniff with `detectTestGlobs`. Never throws. */ export declare function detectCoverageMode(cwd: string, lang?: ProjectLanguage): CoverageMode; export type PackageManager = 'pnpm' | 'yarn' | 'bun' | 'npm'; /** * Lockfile presence → package manager, defaulting to `npm` when none match * (mirrors `detectTestCommand`'s existing no-lockfile fallback). Never * throws. Split out of `detectTestCommand` so `cadence init --ci` (a * separate task in this same phase) can derive an install command from the * same single detection instead of a second, parallel one. */ export declare function detectPackageManager(cwd: string): PackageManager; /** * Install command for the detected package manager. Unlike * `detectTestCommand`, this always returns a value — installing * dependencies doesn't depend on a `scripts.test` entry existing. */ export declare function detectInstallCommand(cwd: string): string; /** * Derive `verification.testCommand` from the target repo's * `package.json#scripts.test`, prefixed with the package manager detected by * `detectPackageManager` (`pnpm-lock.yaml` → `pnpm test`, `yarn.lock` → * `yarn test`, `bun.lockb` → `bun test`, `package-lock.json` or no lockfile * found → `npm test`). Returns `null` when there's no `package.json` or no * `scripts.test` entry — never guesses a command, never throws (Phase 139, * rec-20260701-001). */ export declare function detectTestCommand(cwd: string): string | null; /** * Phase 108 (rec-20260617-001) — zero-prompt name derivation. `--name` wins; * otherwise read `package.json#name` (scope stripped: `@scope/foo` → `foo`), * then fall back to the working-directory basename, then the literal * `unnamed` only when nothing else is available. Never prompts, never throws. */ export declare function deriveName(cwd: string, flagName: string | undefined): string; export declare function isGateProfile(v: string): v is Profile; /** * Phase 108 — zero-prompt gate-profile resolution. `--gate-profile` wins (and * is validated); otherwise use the git-history suggestion. No prompt. */ export declare function resolveGateProfile(flagProfile: string | undefined, suggestion: Profile): Profile; /** Where the resolved project name came from (phase 132 fit-check provenance). */ export type NameSource = 'flag' | 'package.json' | 'dirname'; /** What the host-wire step would do, reported by the fit-check. */ export type HostWireDecision = 'no-claude' | 'wire' | 'skip' | 'prompt' | 'skip-non-tty'; /** Options that influence what `cadence init` would resolve and write. */ export interface InitPlanOptions { name?: string | undefined; preset?: 'solo' | 'team' | 'production' | undefined; profile?: 'solo' | 'team' | 'production' | undefined; gateProfile?: string | undefined; activate?: boolean | undefined; demo?: boolean | undefined; wireHost?: boolean | undefined; skipHostWire?: boolean | undefined; } export interface InitPlanVerification { /** Verifier provider the deep-verify seam would carry after init. */ provider: 'mock' | 'anthropic' | 'local'; /** True once a non-mock provider is wired (real verification on). */ realVerificationOn: boolean; /** `--activate` was requested. */ activateRequested: boolean; /** `--activate` requested but no `ANTHROPIC_API_KEY` present → stays mock. */ activateNoKey: boolean; /** Phase 139: derived `verification.testCommand`, or `null` when nothing * could be derived (no `package.json` / no `scripts.test`). */ testCommand: string | null; } export interface InitPlanHost { /** A `.claude/` workspace is present in the cwd. */ claudePresent: boolean; decision: HostWireDecision; /** Convenience: the host install would actually run unattended. */ wouldWire: boolean; } /** * Phase 132 (rec-20260619-005) — a pure, inspectable description of what * `cadence init` would resolve and write, with **no filesystem writes and no * `process.exit`**. Powers `cadence init --dry-run` (the fit-check) without * touching the tree; the real write path is left unchanged. */ export interface InitPlan { cwd: string; /** `.cadence/` already exists ⇒ a real init would refuse (exit 2). */ alreadyInitialized: boolean; name: string; nameSource: NameSource; preset: 'solo' | 'team' | 'production'; gateProfile: Profile; gateProfileSource: 'flag' | 'git-suggested'; layout: 'monorepo' | 'single-package'; testGlobs: string[]; verification: InitPlanVerification; host: InitPlanHost; demo: boolean; /** * Ordered relative paths init would create (dirs end with `/`). Empty when * `alreadyInitialized` — a real init would refuse before writing anything. */ files: string[]; } /** * Resolve everything `cadence init` would resolve, as a pure plan. Inspects the * cwd read-only (package.json, `packages/`, `.claude/`, git history) exactly as * the init write path's helpers already do; writes nothing. May throw only for * an invalid `--gate-profile` (same validation as the write path) — never exits. */ export declare function planInit(cwd: string, opts: InitPlanOptions, env?: NodeJS.ProcessEnv, isTTY?: boolean): InitPlan; /** * Phase 132 — render an `InitPlan` as a terminal-sized fit-check preview. Pure: * `(plan) → string`. Always states that nothing was written. */ export declare function renderInitPlan(plan: InitPlan): string; //# sourceMappingURL=plan.d.ts.map