/** * Discover project name from package.json:name, falling back to cwd basename. * * Tries to read /package.json and parse the `name` field. If the file is * absent, malformed, or missing the name field, returns `path.basename(cwd)`. */ export declare function discoverProjectName(cwd: string): string; /** * Max length of an algorithmically derived project prefix. The prefix is stamped * into every entity id (e.g. `FORGE-S33-T01`), so it stays short. */ export declare const MAX_PROJECT_PREFIX_LEN = 6; /** * Derive a deterministic project prefix from the project name. The prefix is a * structural decision, not an LLM-routed one: take the first alphanumeric token, * uppercase it, and cap the length. * * "forge-engineering" → "FORGE" "my-cool-app" → "MY" "myapp" → "MYAPP" * * Returns "PROJ" only as a last-resort fallback when the name yields nothing * usable. The result is a *default*: the /forge:init handler surfaces it via the * interactive confirm/override gate (parity with kbFolder), then the orchestrator * writes the chosen value into `project.prefix` deterministically. */ export declare function deriveProjectPrefix(projectName: string, maxLen?: number): string; export interface ProjectContextProject { name: string; prefix: string; description?: string; stack?: string[]; commands?: { test?: string; build?: string; deploy?: string; }; } export interface ProjectContextArchitecture { frameworks?: { backend?: string; frontend?: string; database?: string; }; dataAccess?: string; deployment?: string; entrypoints?: string[]; } export interface ProjectContextWorkflow { testCommand?: string; lintCommand?: string; buildCommand?: string; } export interface ProjectContextKnowledgeBase { path?: string; indexFile?: string; } export interface ProjectContext { project: ProjectContextProject; architecture?: ProjectContextArchitecture; workflow?: ProjectContextWorkflow; knowledgeBase?: ProjectContextKnowledgeBase; } /** Minimal discovery results passed from Phase 2 */ export interface DiscoveryResults { projectName?: string; prefix?: string; description?: string; stack?: string[]; testCommand?: string; lintCommand?: string; buildCommand?: string; backendFramework?: string; frontendFramework?: string; database?: string; deployment?: string; dataAccess?: string; kbPath?: string; } export interface ForgeConfig { project?: { name?: string; prefix?: string; }; paths?: { engineering?: string; forgeRoot?: string; }; } /** * Build a ProjectContext from discovery results and forge config. * * Merges discoveryResults with config data. Config project.name/prefix take * precedence over discovery if both are present (config was set interactively). */ export declare function buildProjectContext(discoveryResults: DiscoveryResults, config: ForgeConfig): ProjectContext; /** * Validate a ProjectContext object structurally. Throws with a descriptive * error if required fields are missing. */ export declare function validateProjectContext(ctx: unknown): asserts ctx is ProjectContext; /** * Write project-context.json to /.forge/project-context.json */ export declare function writeProjectContext(cwd: string, ctx: ProjectContext): void; export interface CalibrationBaseline { lastCalibrated: string; version: string; masterIndexHash: string | null; sprintsCovered: string[]; } /** * Compute a calibration baseline snapshot for /forge:init Phase 2. * * @param cwd - project working directory * @param kbPath - relative path to the knowledge base directory (e.g. "engineering") * @param bundledPluginVersion - version string from package.json forge.bundledVersion */ export declare function computeCalibrationBaseline(cwd: string, kbPath: string, bundledPluginVersion: string): CalibrationBaseline;