/**
 * cv design command
 * Design-first scaffolding with knowledge graph
 *
 * ============================================================================
 * PRD INTEGRATION DESIGN DOCUMENT
 * ============================================================================
 *
 * ## Overview
 *
 * The `--from-prd` flag will fetch requirements from cvPRD and use them to
 * generate architecture designs. This enables a requirements-to-code workflow.
 *
 * ## Usage
 *
 * ```bash
 * # Single requirement
 * cv design --from-prd REQ-abc123
 *
 * # Multiple requirements
 * cv design --from-prd "REQ-abc123,REQ-def456"
 *
 * # Search by tag
 * cv design --from-prd "tag:authentication"
 *
 * # With description context
 * cv design --from-prd REQ-abc123 "Focus on the API layer"
 * ```
 *
 * ## Implementation Plan
 *
 * ### 1. New Interfaces (add to this file)
 *
 * ```typescript
 * interface PRDDesignSource {
 *   type: 'chunk' | 'search' | 'prd';
 *   ids?: string[];           // Chunk IDs
 *   query?: string;           // Search query
 *   tag?: string;             // Tag filter
 * }
 *
 * interface PRDDesignContext {
 *   requirements: AIContext[];      // From prd-client
 *   primaryText: string;            // Combined requirement text
 *   constraints: string[];          // Extracted constraints
 *   acceptanceCriteria: string[];   // Extracted from metadata
 *   dependencies: string[];         // Related requirements
 * }
 * ```
 *
 * ### 2. New Functions to Implement
 *
 * ```typescript
 * // Parse --from-prd flag value
 * function parsePRDReference(ref: string): PRDDesignSource
 *
 * // Fetch requirements from cvPRD
 * async function fetchPRDContext(
 *   client: PRDClient,
 *   source: PRDDesignSource
 * ): Promise<PRDDesignContext>
 *
 * // Build design prompt from PRD context
 * function buildPRDDesignPrompt(
 *   context: PRDDesignContext,
 *   additionalDescription?: string
 * ): string
 *
 * // Link generated design back to PRD
 * async function linkDesignToPRD(
 *   client: PRDClient,
 *   context: PRDDesignContext,
 *   schema: DesignSchema,
 *   files: string[]
 * ): Promise<void>
 * ```
 *
 * ### 3. Enhanced System Prompt
 *
 * When --from-prd is used, augment DESIGN_SYSTEM_PROMPT with:
 * - Requirement text and context
 * - Acceptance criteria as constraints
 * - Dependencies as architectural considerations
 * - Priority levels for feature ordering
 *
 * ### 4. Configuration
 *
 * Add to cv-git.config.json:
 * ```json
 * {
 *   "prd": {
 *     "url": "http://localhost:8000",
 *     "apiKey": "${CVPRD_API_KEY}"
 *   }
 * }
 * ```
 *
 * ### 5. PRD Client Integration
 *
 * Key methods from @cv-git/prd-client to use:
 * - getChunk(chunkId) - Get single requirement
 * - getContext(chunkId, { strategy: 'expanded' }) - Get with dependencies
 * - search({ query, filters }) - Search requirements
 * - linkImplementation(chunkId, { files, symbols }) - Link generated code
 * - PRDClient.formatContextForPrompt(context) - Format for AI
 *
 * ### 6. Flow
 *
 * 1. Parse --from-prd value → PRDDesignSource
 * 2. Create PRDClient from config
 * 3. Fetch requirements with context → PRDDesignContext
 * 4. Build enriched prompt with requirements
 * 5. Generate design (existing flow)
 * 6. Display design with requirement mapping
 * 7. On scaffold: link files to requirements in cvPRD
 * 8. Update requirement status to 'in_progress' or 'implemented'
 *
 * ### 7. Output Enhancements
 *
 * Show requirement traceability:
 * ```
 * ## Design: User Authentication System
 *
 * Based on Requirements:
 *   • REQ-abc123: Users shall authenticate via OAuth2 [critical]
 *   • REQ-def456: System shall support SSO [high]
 *
 * ### Modules
 *   auth/ - Authentication module
 *     ↳ Implements: REQ-abc123, REQ-def456
 * ```
 *
 * ### 8. Error Handling
 *
 * - cvPRD unavailable: Warn and fall back to description-only mode
 * - Chunk not found: List available chunks, suggest search
 * - No requirements match: Suggest broader search
 *
 * ============================================================================
 */
import { Command } from 'commander';
import { PRDClient } from '@cv-git/prd-client';
/**
 * Source specification for PRD-based design
 */
export interface PRDDesignSource {
    type: 'chunk' | 'search' | 'tag' | 'prd';
    ids?: string[];
    query?: string;
    tag?: string;
    prdId?: string;
}
/**
 * Aggregated context from PRD for design generation
 */
export interface PRDDesignContext {
    source: PRDDesignSource;
    requirements: Array<{
        id: string;
        text: string;
        type: string;
        priority?: string;
        status?: string;
    }>;
    constraints: string[];
    acceptanceCriteria: string[];
    dependencies: string[];
    relatedChunks: string[];
    totalTokens: number;
}
/**
 * Parse --from-prd flag value into structured source
 *
 * Formats:
 * - "REQ-abc123" → single chunk
 * - "REQ-abc,REQ-def" → multiple chunks
 * - "tag:authentication" → tag search
 * - "search:user login" → semantic search
 * - "prd:uuid" → entire PRD
 */
export declare function parsePRDReference(ref: string): PRDDesignSource;
/**
 * Build design prompt enriched with PRD context
 */
export declare function buildPRDEnrichedPrompt(context: PRDDesignContext, additionalDescription?: string): string;
interface DesignModule {
    name: string;
    path: string;
    description: string;
}
interface DesignType {
    name: string;
    kind: 'interface' | 'type' | 'enum' | 'class';
    module: string;
    properties?: {
        name: string;
        type: string;
        description?: string;
    }[];
    description: string;
}
interface DesignFunction {
    name: string;
    module: string;
    parameters: {
        name: string;
        type: string;
    }[];
    returnType: string;
    description: string;
    async?: boolean;
}
interface DesignRelationship {
    from: string;
    to: string;
    type: 'calls' | 'imports' | 'implements' | 'extends' | 'uses';
}
interface DesignSchema {
    name: string;
    description: string;
    modules: DesignModule[];
    types: DesignType[];
    functions: DesignFunction[];
    relationships: DesignRelationship[];
}
export declare function designCommand(): Command;
/**
 * Fetch requirements context from cvPRD
 */
export declare function fetchPRDContext(client: PRDClient, source: PRDDesignSource): Promise<PRDDesignContext>;
/**
 * Link generated design artifacts back to cvPRD requirements
 */
export declare function linkDesignToPRD(client: PRDClient, context: PRDDesignContext, schema: DesignSchema, generatedFiles: string[]): Promise<void>;
export {};
//# sourceMappingURL=design.d.ts.map