/** * IDE-aware wrapper for `peaks standards init` / `peaks standards update`. * * `--ide` USED TO BE DETECTION-ONLY: it picked the adapter, the adapter's * `standardsProfile` was looked up, and then every branch called the SAME * writer — the profile was read and never used. This module is where that * gap is closed: the profile's `rootFile` now decides which instruction * files are emitted. * * Two entry points: * * - `executeProjectStandardsInitIdeAware` — same signature as the * underlying `executeProjectStandardsInit`, plus an optional * `ideId` override that bypasses detection. * - `executeProjectStandardsUpdateIdeAware` — same shape, for the * `update` flow. * * Detection precedence: * 1. Explicit `options.ideId` (CLI `--ide` flag) * 2. `IdeRegistry.detect()` from cwd (or the `projectRoot` if given) * 3. `null` (no IDE detected) → the default cross-tool constitution * * Fallback behavior: when the resolved IDE has no `standardsProfile` * declared, the wrapper writes the DEFAULT shape — the shared body plus the * pointer that imports it — and emits a stderr warning naming the IDE and * the fact that its standards profile is undeclared. */ import type { IdeId, IdeStandardsProfile } from '../ide/ide-types.js'; import { detectAllResourceTargets, getStandardsProfile } from '../ide/resource-profile.js'; import { type ProjectStandardsInitOptions, type ProjectStandardsInitResult, type ProjectStandardsUpdateResult } from './project-standards-service.js'; import { type StandardsConstitution } from './standards-constitution.js'; export type { ProjectStandardsInitResult, ProjectStandardsUpdateResult }; export type ProjectStandardsIdeAwareOptions = ProjectStandardsInitOptions & { /** * Explicit IDE override. When set, bypasses `IdeRegistry.detect()` * (cwd + env heuristics) and uses the provided IDE id directly. * Mirrors the `peaks hooks install --ide ` pattern. */ readonly ideId?: IdeId; }; export type ProjectStandardsUpdateIdeAwareOptions = ProjectStandardsInitOptions & { /** Explicit IDE override. See {@link ProjectStandardsIdeAwareOptions}. */ readonly ideId?: IdeId; }; /** * The constitution shape an IDE's standards profile implies. * * THE RULE. `IdeStandardsProfile.rootFile` names the file the IDE reads as * its project instructions: * - `AGENTS.md` → the IDE reads the shared body directly, so NO pointer * file is emitted. * - `CLAUDE.md` → the IDE reads its own file, so a pointer that imports * the body is emitted beside it. * - `null` (or any other name) → the IDE has no equivalent of the body, * so only the body is emitted. * * A profile the registry does not declare falls back to the default shape — * body plus pointer — because that is the shape that covers EVERY reader: * the body for the AGENTS-native tools, the pointer for Claude Code. */ export declare function resolveStandardsConstitution(profile: IdeStandardsProfile | null): StandardsConstitution; /** * Resolve the active IDE id for a standards call. Order of precedence: * 1. explicit `options.ideId` * 2. `IdeRegistry.detect()` from `options.projectRoot` * 3. `null` (no detected IDE — caller falls back to the default shape) */ export declare function resolveStandardsIdeId(options: { readonly projectRoot: string; readonly ideId?: IdeId; }): IdeId | null; /** * Run `peaks standards init` with IDE-aware dispatch. * * The resolved IDE's `standardsProfile.rootFile` decides whether the writer * emits the pointer file beside the shared body. */ export declare function executeProjectStandardsInitIdeAware(options: ProjectStandardsIdeAwareOptions): ProjectStandardsInitResult; /** * Run `peaks standards update` with IDE-aware dispatch. * * Same dispatch rules as `executeProjectStandardsInitIdeAware`. */ export declare function executeProjectStandardsUpdateIdeAware(options: ProjectStandardsUpdateIdeAwareOptions): ProjectStandardsUpdateResult; /** * Test seam + integration-test helper: returns the resolved IDE id * for the call, plus the active standards profile and the constitution * shape that profile implies. Exported for callers that need to assert the * dispatch decision without running the full write. */ export declare function inspectStandardsDispatch(options: { readonly projectRoot: string; readonly ideId?: IdeId; }): { readonly ideId: IdeId | null; readonly profile: ReturnType; readonly constitution: StandardsConstitution; }; /** * Test seam: the resource-profile accessor exposes * `detectAllResourceTargets` for callers that need to enumerate * across all registered IDEs. Re-exported here for convenience. */ export { detectAllResourceTargets };