/** * Slice 2 — `peaks code plan --fast ` (peaks-code fast mode). * * The `peaks-code` SKILL orchestrates an LLM-side workflow: * load-memory -> standards-preflight -> rd-cycle -> qa-cycle -> emit-txt * * The CLI surface here is intentionally narrow: it builds a CodePlan and * prints it (`peaks code plan`). `runCodeFast` is exported below but has no * caller in this repo — the orchestrating it describes is still LLM-side, so * nothing actually runs a plan yet. Fast mode skips memory full-load, * standards preflight, and the QA repair loop. Round-trip KPI: ≤ 30s. * * No new service layer — the orchestrator is the in-file `runCodeFast` * function. Hooks are injected so tests can mock at the boundary. * * v2.11.0 Group F (Tier 9) — D5 / D7 additions: * - `peaks code should-pause --step --mode ` (D5) * - `peaks code post-compact-detect --project ` (D7) * * - code-mode-gate-commands.ts (plan + should-pause) * - code-job-shape-commands.ts (detect-job + read-job-shape) * - code-runtime-commands.ts (post-compact-detect + auto-compact + context-now + gate-step-08 + emit-handoff) * This file keeps the public API: types, buildCodePlan, runCodeFast, * registerCodeCommands (now a thin orchestrator). */ import type { Command } from 'commander'; import type { ProgramIO } from '../cli-helpers.js'; export type CodeStepKind = 'memory' | 'preflight' | 'rd' | 'qa' | 'emit'; export interface CodeStep { readonly id: 'load-memory' | 'standards-preflight' | 'rd-cycle' | 'qa-cycle' | 'emit-txt'; readonly kind: CodeStepKind; readonly skipped: boolean; /** QA-only: when true, qa hook retries on failure up to N rounds. */ readonly repairLoop?: boolean; } export interface CodePlan { readonly sessionId: string; readonly steps: readonly CodeStep[]; } export interface CodeHooks { readonly memory: (ctx: { sessionId: string; }) => Promise; readonly preflight: (ctx: { sessionId: string; }) => Promise; readonly rd: (ctx: { sessionId: string; }) => Promise; readonly qa: (ctx: { sessionId: string; repairLoop: boolean; }) => Promise; readonly emit: (ctx: { sessionId: string; }) => Promise; } export interface CodeRunResult { readonly sessionId: string; readonly ok: boolean; readonly steps: readonly CodeStep[]; readonly skipped: readonly string[]; readonly elapsedMs: number; } /** * Build a CodePlan. `fast=true` marks memory + preflight as skipped and * disables the QA repair loop. Step order is fixed; emit-txt always last. */ export declare function buildCodePlan(opts: { sessionId: string; fast: boolean; }): CodePlan; /** * Run the CodePlan. Skipped steps do NOT invoke their hook; emit-txt is * always invoked last. Returns timing + skipped ids for KPI measurement. */ export declare function runCodeFast(opts: { sessionId: string; plan: CodePlan; hooks: CodeHooks; }): Promise; /** * Register the `peaks code plan --fast ` command. The actual * LLM-side orchestration is driven by the SKILL.md (LLM-side), so this * CLI command is a thin surface that builds the plan and emits a JSON * envelope for downstream tooling. * */ export declare function registerCodeCommands(program: Command, io: ProgramIO): void;