import { type WorkspaceInitReport } from '../../../services/workspace/workspace-service.js'; import { type BootstrapProjectScanEnvelope } from '../../../services/prd/project-scan-bootstrap-service.js'; import type { WorkspaceInitOptions, WorkspaceInitRotation } from './init-options.js'; /** Everything one `peaks workspace init` run carries into its envelope phase. */ export type WorkspaceInitContext = { options: WorkspaceInitOptions; projectRoot: string; sessionId: string; rotation: WorkspaceInitRotation; report: WorkspaceInitReport; projectScanEnvelope: BootstrapProjectScanEnvelope | null; projectScanError: string | null; }; type InitTarget = { projectRoot: string; sessionId: string; rotation: WorkspaceInitRotation; }; /** * Resolve the project root and the session id. Two paths: * - explicit --session-id: use it as the requested binding target * (ConflictingSessionError fires if it conflicts with an in-flight * session, unless --allow-session-rebind is set) * - omitted: defer to ensureSession(), which reuses an existing * binding or auto-generates a fresh one. The init then writes * .peaks/_runtime/session.json so the binding sticks. * * Before that: canonicalise the project root. If the user (or the * LLM via "$(pwd)") passed a sub-directory of a real git repo * (e.g. prompt-project/prompt-project/ inside the outer * prompt-project/.git), promote the path to the git root. Without * this, peaks would build a parallel .peaks/ tree under the * nested sub-folder and silently break the project-binding model * (the same regression that produced prompt-project/.peaks/ in * the 5/27-5/29 sessions). When startPath is not inside any * git repo, the helper falls through to the cwd verbatim. * `resolveWritableProjectRoot` = `resolveCanonicalProjectRoot` plus the * home-directory refusal. It has to be this one, and it has to run here: * `ensureSessionWithRotation` below WRITES (it mints/binds a session), so * a guard placed after it would leave a `.peaks/_runtime/` tree in the * user's home even though the init was refused. */ export declare function resolveInitTarget(options: WorkspaceInitOptions): Promise; export declare function runInitWorkspace(options: WorkspaceInitOptions, projectRoot: string, sessionId: string): Promise; /** * After the workspace dir is initialized, also bootstrap the * `.peaks/project-scan/` artifact tree (project-scan.md + 4 * bundled audit/business templates). Idempotent — when the user * re-runs `workspace init`, the existing files are kept (their * sediment is user-authored). Pass `--no-project-scan-bootstrap` * to skip, or `--force-project-scan-templates` to overwrite the * 4 bundled templates anyway. */ export declare function bootstrapProjectScanForInit(options: WorkspaceInitOptions, projectRoot: string): Promise<{ envelope: BootstrapProjectScanEnvelope | null; error: string | null; }>; export {};