@aisdlc/cli 4.6.0 → 4.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/commands/check.ts","../src/commands/verify.ts","../src/commands/gherkin.ts","../src/commands/git.ts","../src/commands/init.ts","../src/commands/kpi.ts","../src/commands/mcp.ts","../src/commands/report.ts","../src/commands/review.ts","../src/commands/inspect.ts","../src/commands/doctor.ts","../src/commands/migrate.ts","../src/commands/sdd.ts"],"sourcesContent":["/**\n * @aisdlc/cli\n * Command Line Interface for AI-SDLC Quality Gates and Governance\n */\n\nimport { Command } from 'commander';\nimport pc from 'picocolors';\nimport { formatAisdlcVersionOutput } from '@aisdlc/core';\nimport { runCheck } from './commands/check.js';\nimport { runGherkinExtract, runGherkinScaffold } from './commands/gherkin.js';\nimport {\n runGitCheckout,\n runGitDetectAuthor,\n runGitHookInstall,\n runGitPlan,\n runGitValidate,\n} from './commands/git.js';\nimport { promptForAgents, promptForArchitecture, promptForCi, runInit } from './commands/init.js';\nimport { runKpiPr, runKpiRelease } from './commands/kpi.js';\nimport { runMcpServer } from './commands/mcp.js';\nimport { runReportCompliance, runReportDashboard, runReportQuality } from './commands/report.js';\nimport { runReviewSubmit } from './commands/review.js';\nimport { runInspect } from './commands/inspect.js';\nimport { runDoctor } from './commands/doctor.js';\nimport { runMigrate } from './commands/migrate.js';\nimport { runChangeNew, runSddDeposit, runSddIntegrate, runSddVerify } from './commands/sdd.js';\nimport {\n runVerifyAllAsync,\n runVerifyDuplicates,\n runVerifyFriction,\n runVerifyGherkin,\n runVerifyGovernance,\n runVerifyLicensesAsync,\n runVerifyPdac,\n runVerifyPrivacy,\n runVerifyQuality,\n runVerifySastAsync,\n runVerifySchemas,\n runVerifySecrets,\n runVerifySecurityAsync,\n runVerifyTesting,\n runVerifyTraceability,\n} from './commands/verify.js';\n\nconst program = new Command();\n\nprogram\n .name('aisdlc')\n .description('AI-SDLC: Spec-Driven Development, Governance & Quality Gates for AI & Humans')\n .version(formatAisdlcVersionOutput());\n\n// --- check command (unified pre-flight with auto-fix) ---\nprogram\n .command('doctor')\n .description('Comprehensive environment, toolchain, git-hooks, and security health diagnostics')\n .option('-r, --root <path>', 'Project root directory')\n .option('--fix', 'Automatically repair broken or missing git hooks with backup')\n .option('--json', 'Emit diagnostics report in structured JSON format')\n .option('--strict', 'Fail with non-zero exit code on warnings as well as critical failures')\n .option('--offline', 'Skip remote external network probes (e.g. for air-gapped environments)')\n .option('--timeout <ms>', 'Maximum timeout in milliseconds for subprocess execution', parseInt)\n .action(async (opts) => {\n const exitCode = await runDoctor({\n rootDir: opts.root,\n fix: opts.fix,\n json: opts.json,\n strict: opts.strict,\n offline: opts.offline,\n timeout: opts.timeout,\n });\n process.exit(exitCode);\n });\n\n// --- check command (unified pre-flight with auto-fix) ---\nprogram\n .command('check')\n .description('Unified pre-flight command: validates Quality Gates with optional non-destructive auto-fix')\n .option('--fix', 'Automatically synchronize Gherkin scenarios (.feature) and cryptographic digests of PDaC citations')\n .option('-r, --root <path>', 'Project root directory')\n .option('--vuln', 'Scan for known vulnerabilities (CVE/GHSA) in dependencies')\n .option('--json', 'Emit verification results in structured JSON format')\n .option('-F, --format <format>', 'Output format: text or json')\n .action((opts) => {\n const passed = runCheck({\n fix: opts.fix,\n root: opts.root,\n json: opts.json,\n format: opts.format,\n });\n process.exit(passed ? 0 : 1);\n });\n\n// --- verify command suite ---\nconst verifyCommand = program\n .command('verify')\n .description('Run deterministic verifiers for quality, traceability, governance, and licenses');\n\nverifyCommand\n .command('all', { isDefault: true })\n .description('Run the full quality and governance suite (Quality Gate + RTM + Tasks + Tests + Licenses + PDaC + Schemas + Duplicates + Security + Privacy)')\n .option('-r, --root <path>', 'Project root directory')\n .option('-p, --policy <path>', 'Path to quality-policy.yaml')\n .option('-C, --max-cyclomatic <number>', 'Maximum Cyclomatic Complexity threshold')\n .option('-K, --max-cognitive <number>', 'Maximum Cognitive Complexity threshold')\n .option('-M, --min-maintainability <number>', 'Minimum Maintainability threshold (0-100)')\n .option('-L, --max-lines <number>', 'Maximum lines per function threshold')\n .option('-m, --mode <mode>', 'Enforcement mode: STRICT or PERMISSIVE')\n .option('--no-vuln', 'Disable dependency vulnerability scanning')\n .option('--json', 'Emit verification results in structured JSON format')\n .option('-F, --format <format>', 'Output format: text or json')\n .action(async (opts) => {\n const passed = await runVerifyAllAsync({\n root: opts.root,\n policy: opts.policy,\n maxCyclomatic: opts.maxCyclomatic,\n maxCognitive: opts.maxCognitive,\n minMaintainability: opts.minMaintainability,\n maxLines: opts.maxLines,\n enforceMode: opts.mode,\n json: opts.json,\n format: opts.format,\n updateBaseline: opts.updateBaseline,\n baseline: opts.baseline,\n ratchet: opts.ratchet,\n });\n process.exit(passed ? 0 : 1);\n });\n\nverifyCommand\n .command('quality')\n .description('Quality Release Gate (Cyclomatic Complexity <= 10, Maintainability >= 50)')\n .option('-r, --root <path>', 'Project root directory')\n .option('-p, --policy <path>', 'Path to quality-policy.yaml')\n .option('-C, --max-cyclomatic <number>', 'Maximum Cyclomatic Complexity threshold')\n .option('-K, --max-cognitive <number>', 'Maximum Cognitive Complexity threshold')\n .option('-M, --min-maintainability <number>', 'Minimum Maintainability threshold (0-100)')\n .option('-L, --max-lines <number>', 'Maximum lines per function threshold')\n .option('-m, --mode <mode>', 'Enforcement mode: STRICT or PERMISSIVE')\n .option('--json', 'Emit verification results in structured JSON format')\n .option('-F, --format <format>', 'Output format: text or json')\n .option('--update-baseline', 'Update quality baseline snapshot with current violations')\n .option('--baseline <path>', 'Path to quality baseline JSON file')\n .option('--ratchet', 'Enforce ratchet mode against baseline')\n .action((opts) => {\n const passed = runVerifyQuality({\n root: opts.root,\n policy: opts.policy,\n maxCyclomatic: opts.maxCyclomatic,\n maxCognitive: opts.maxCognitive,\n minMaintainability: opts.minMaintainability,\n maxLines: opts.maxLines,\n enforceMode: opts.mode,\n json: opts.json,\n format: opts.format,\n updateBaseline: opts.updateBaseline,\n baseline: opts.baseline,\n ratchet: opts.ratchet,\n });\n process.exit(passed ? 0 : 1);\n });\n\nverifyCommand\n .command('traceability')\n .description('Audit the 360° Requirements Traceability Matrix (Product -> Architecture -> Testing)')\n .option('-r, --root <path>', 'Project root directory')\n .option('--json', 'Emit verification results in structured JSON format')\n .option('-F, --format <format>', 'Output format: text or json')\n .action((opts) => {\n const passed = runVerifyTraceability({ root: opts.root, json: opts.json, format: opts.format });\n process.exit(passed ? 0 : 1);\n });\n\nverifyCommand\n .command('governance')\n .description('Audit task governance and human autonomy modes (AUTONOMOUS, HUMAN_REVIEW_PLAN, etc.)')\n .option('-r, --root <path>', 'Project root directory')\n .option('--json', 'Emit verification results in structured JSON format')\n .option('-F, --format <format>', 'Output format: text or json')\n .action((opts) => {\n const passed = runVerifyGovernance({ root: opts.root, json: opts.json, format: opts.format });\n process.exit(passed ? 0 : 1);\n });\n\nverifyCommand\n .command('testing')\n .description('Audit that 100% of requirements and tasks have verifiable tests')\n .option('-r, --root <path>', 'Project root directory')\n .option('--json', 'Emit verification results in structured JSON format')\n .option('-F, --format <format>', 'Output format: text or json')\n .action((opts) => {\n const passed = runVerifyTesting({ root: opts.root, json: opts.json, format: opts.format });\n process.exit(passed ? 0 : 1);\n });\n\nverifyCommand\n .command('gherkin')\n .description('Verify BDD synchronization between Markdown Gherkin blocks and .feature files')\n .option('-r, --root <path>', 'Project root directory')\n .option('--json', 'Emit verification results in structured JSON format')\n .option('-F, --format <format>', 'Output format: text or json')\n .action((opts) => {\n const passed = runVerifyGherkin({ root: opts.root, json: opts.json, format: opts.format });\n process.exit(passed ? 0 : 1);\n });\n\nverifyCommand\n .command('licenses')\n .description('Verify OSS license compliance against license-policy.yaml (dynamic SCA and SBOM)')\n .option('-r, --root <path>', 'Project root directory')\n .option('-p, --policy <path>', 'Path to license-policy.yaml')\n .option('-m, --manifest <path>', 'Path to license-manifest.yaml')\n .option('--no-dynamic', 'Disable dynamic scanning and require static manifest file')\n .option('--sbom [path]', 'Generate CycloneDX 1.5 JSON standard SBOM file')\n .option('--sbom-input <path>', 'Ingest an existing CycloneDX 1.x or SPDX 2.x SBOM JSON file to fill license gaps')\n .option('--notices [path]', 'Generate THIRD_PARTY_NOTICES.md legal notices and attributions file')\n .option('--tool <tool>', 'SCA tool: native, trivy, syft', 'native')\n .option('--depth <depth>', 'Analysis depth: direct or transitive', 'transitive')\n .option('--vuln', 'Scan for known vulnerabilities (CVE/GHSA) in dependencies')\n .option('--no-vuln', 'Disable dependency vulnerability scanning')\n .option('--non-interactive', 'Run in non-interactive mode without tool install prompts')\n .option('--no-install-prompt', 'Disable interactive tool install prompt')\n .option('--ci', 'Run in non-interactive CI mode')\n .option('--json', 'Emit verification results in structured JSON format')\n .option('-F, --format <format>', 'Output format: text or json')\n .action(async (opts) => {\n const passed = await runVerifyLicensesAsync({\n root: opts.root,\n policy: opts.policy,\n manifest: opts.manifest,\n dynamic: opts.dynamic,\n tool: opts.tool,\n depth: opts.depth,\n sbom: opts.sbom,\n sbomInput: opts.sbomInput,\n notices: opts.notices,\n vuln: opts.vuln,\n nonInteractive: opts.nonInteractive,\n noInstallPrompt: opts.installPrompt === false,\n ci: opts.ci,\n json: opts.json,\n format: opts.format,\n });\n process.exit(passed ? 0 : 1);\n });\n\nverifyCommand\n .command('pdac')\n .description('Verify PDaC graph and evaluate cryptographic drift of SHA-256 citations')\n .option('-r, --root <path>', 'Project root directory')\n .option('--json', 'Emit verification results in structured JSON format')\n .option('-F, --format <format>', 'Output format: text or json')\n .action((opts) => {\n const passed = runVerifyPdac({ root: opts.root, json: opts.json, format: opts.format });\n process.exit(passed ? 0 : 1);\n });\n\nverifyCommand\n .command('schemas')\n .description('Verify Markdown artifacts compliance against canonical JSON schemas (Draft 2020-12)')\n .option('-r, --root <path>', 'Project root directory')\n .option('-p, --path <path>', 'Target file or directory path')\n .option('--json', 'Emit verification results in structured JSON format')\n .option('-F, --format <format>', 'Output format: text or json')\n .action((opts) => {\n const passed = runVerifySchemas({ root: opts.root, path: opts.path, json: opts.json, format: opts.format });\n process.exit(passed ? 0 : 1);\n });\n\nverifyCommand\n .command('duplicates')\n .description('Audit duplicate requirements, ID collisions, lexical redundancy, and BDD overlaps')\n .option('-r, --root <path>', 'Project root directory')\n .option('-s, --similarity <number>', 'Lexical similarity threshold for titles (0.0 to 1.0)', '0.85')\n .option('--json', 'Emit verification results in structured JSON format')\n .option('-F, --format <format>', 'Output format: text or json')\n .action((opts) => {\n const passed = runVerifyDuplicates({ root: opts.root, similarity: opts.similarity, json: opts.json, format: opts.format });\n process.exit(passed ? 0 : 1);\n });\n\nverifyCommand\n .command('security')\n .description('Unified security verification: deterministic secrets detection (Gitleaks) and shift-left SAST')\n .option('-r, --root <path>', 'Project root directory')\n .option('-d, --diff', 'Scan only lines added in the current branch git diff')\n .option('-b, --base <branch>', 'Base branch for git diff calculation (default: origin/main or HEAD)')\n .option('-g, --gitleaks', 'Delegate or contrast with native Gitleaks binary if available')\n .option('-s, --semgrep', 'Delegate to Semgrep CLI if installed')\n .option('-e, --entropy <number>', 'Minimum Shannon entropy threshold (0.0 to 8.0)', '4.3')\n .option('-m, --min-severity <level>', 'Minimum severity for SAST failure: CRITICAL, HIGH, MEDIUM', 'HIGH')\n .option('--json', 'Emit verification results in structured JSON format')\n .option('-F, --format <format>', 'Output format: text, json, or sarif')\n .option('-o, --output <path>', 'Output SARIF report file path (default: reports/security.sarif)')\n .action(async (opts) => {\n const passed = await runVerifySecurityAsync({\n root: opts.root,\n diff: opts.diff,\n base: opts.base,\n gitleaks: opts.gitleaks,\n semgrep: opts.semgrep,\n entropy: opts.entropy,\n minSeverity: opts.minSeverity,\n json: opts.json,\n format: opts.format,\n output: opts.output,\n });\n process.exit(passed ? 0 : 4);\n });\n\nverifyCommand\n .command('secrets')\n .description('Verify absence of exposed credentials, API keys, and certificates (Gitleaks Gate)')\n .option('-r, --root <path>', 'Project root directory')\n .option('-d, --diff', 'Scan only lines added in the current branch git diff')\n .option('-b, --base <branch>', 'Base branch for git diff calculation (default: origin/main or HEAD)')\n .option('-g, --gitleaks', 'Delegate or contrast with native Gitleaks binary if available')\n .option('-e, --entropy <number>', 'Minimum Shannon entropy threshold (0.0 to 8.0)', '4.3')\n .option('--json', 'Emit verification results in structured JSON format')\n .option('-F, --format <format>', 'Output format: text, json, or sarif')\n .option('-o, --output <path>', 'Output file path (e.g. reports/secrets.sarif)')\n .action((opts) => {\n const passed = runVerifySecrets({\n root: opts.root,\n diff: opts.diff,\n base: opts.base,\n gitleaks: opts.gitleaks,\n entropy: opts.entropy,\n json: opts.json,\n format: opts.format,\n output: opts.output,\n });\n process.exit(passed ? 0 : 4);\n });\n\nverifyCommand\n .command('sast')\n .description('Shift-left static application security testing (SAST) for critical patterns (SQLi, exec, SSRF)')\n .option('-r, --root <path>', 'Project root directory')\n .option('-s, --semgrep', 'Delegate to Semgrep CLI if installed')\n .option('-m, --min-severity <level>', 'Minimum severity for failure: CRITICAL, HIGH, MEDIUM', 'HIGH')\n .option('--sarif <paths...>', 'Ingest external OASIS SARIF v2.1.0 report(s) for deterministic SAST evaluation')\n .option('--orchestrate', 'Auto-detect project ecosystems and orchestrate native SAST CLIs via SARIF')\n .option('--non-interactive', 'Run in non-interactive mode without tool install prompts')\n .option('--no-install-prompt', 'Disable interactive tool install prompt')\n .option('--ci', 'Run in non-interactive CI mode')\n .option('--json', 'Emit verification results in structured JSON format')\n .option('-F, --format <format>', 'Output format: text, json, or sarif')\n .option('-o, --output <path>', 'Output file path (e.g. reports/sast.sarif)')\n .action(async (opts) => {\n const passed = await runVerifySastAsync({\n root: opts.root,\n semgrep: opts.semgrep,\n minSeverity: opts.minSeverity,\n sarif: opts.sarif,\n orchestrate: opts.orchestrate,\n nonInteractive: opts.nonInteractive,\n noInstallPrompt: opts.installPrompt === false,\n ci: opts.ci,\n json: opts.json,\n format: opts.format,\n output: opts.output,\n });\n process.exit(passed ? 0 : 1);\n });\n\nverifyCommand\n .command('privacy')\n .description('Verify Data Protection & Privacy-by-Design against privacy-policy.yaml (GDPR ROPA, PII-SAST, retention/erasure)')\n .option('-r, --root <path>', 'Project root directory')\n .option('-p, --policy <path>', 'Path to privacy-policy.yaml')\n .option('--ropa-report [path]', 'Generate GDPR Art. 30 ROPA_INVENTORY.md report')\n .option('--report [path]', 'Generate PRIVACY_SCAN_REPORT.md report')\n .option('-m, --min-severity <level>', 'Minimum severity for failure: CRITICAL, HIGH, MEDIUM, LOW', 'HIGH')\n .option('--json', 'Emit verification results in structured JSON format')\n .option('-F, --format <format>', 'Output format: text or json')\n .action((opts) => {\n const passed = runVerifyPrivacy({\n root: opts.root,\n policy: opts.policy,\n ropaReport: opts.ropaReport,\n report: opts.report,\n minSeverity: opts.minSeverity,\n json: opts.json,\n format: opts.format,\n });\n process.exit(passed ? 0 : 5);\n });\n\nverifyCommand\n .command('friction [change]')\n .description('Verify progressive friction and Anti-Bypass guardrails for quick patches')\n .option('-r, --root <path>', 'Project root directory')\n .option('--json', 'Emit verification results in structured JSON format')\n .option('-F, --format <format>', 'Output format: text or json')\n .action((change, opts) => {\n const passed = runVerifyFriction({ root: opts.root, change, json: opts.json, format: opts.format });\n process.exit(passed ? 0 : 1);\n });\n\n// --- report command suite ---\nconst reportCommand = program\n .command('report')\n .description('Generate formal metric reports in Markdown format');\n\nreportCommand\n .command('quality')\n .description('Generate formal polyglot code quality report (reports/QUALITY_REPORT.md)')\n .option('-r, --root <path>', 'Project root directory')\n .option('-p, --policy <path>', 'Path to quality-policy.yaml')\n .option('-C, --max-cyclomatic <number>', 'Maximum Cyclomatic Complexity threshold')\n .option('-K, --max-cognitive <number>', 'Maximum Cognitive Complexity threshold')\n .option('-M, --min-maintainability <number>', 'Minimum Maintainability threshold (0-100)')\n .option('-L, --max-lines <number>', 'Maximum lines per function threshold')\n .option('-m, --mode <mode>', 'Enforcement mode: STRICT or PERMISSIVE')\n .action((opts) => {\n const passed = runReportQuality({\n root: opts.root,\n policy: opts.policy,\n maxCyclomatic: opts.maxCyclomatic,\n maxCognitive: opts.maxCognitive,\n minMaintainability: opts.minMaintainability,\n maxLines: opts.maxLines,\n enforceMode: opts.mode,\n });\n process.exit(passed ? 0 : 1);\n });\n\nreportCommand\n .command('dashboard')\n .description('Generate interactive web dashboard and PDaC / RTM graph visualizer (reports/dashboard.html)')\n .option('-r, --root <path>', 'Project root directory')\n .option('-o, --output <path>', 'Output HTML file path (default: reports/dashboard.html)')\n .option('-t, --title <title>', 'Web dashboard title')\n .option('--open', 'Open dashboard in default browser')\n .action((opts) => {\n const passed = runReportDashboard({\n root: opts.root,\n output: opts.output,\n title: opts.title,\n open: opts.open,\n });\n process.exit(passed ? 0 : 1);\n });\n\nreportCommand\n .command('compliance')\n .description('Generate Regulatory Compliance Evidence Bundle (EU AI Act, ISO 42001, NIST SSDF)')\n .option('-r, --root <path>', 'Project root directory')\n .option('-o, --output <path>', 'Output JSON file path (default: reports/audit-evidence-bundle.json)')\n .option('--offline', 'Offline execution: prohibit external network calls')\n .option('--strict', 'Strict mode: fail closed if any of 12 Quality Gates is missing or stale')\n .option('--keyless', 'Enable keyless OIDC attestation claims')\n .option('--dry-run', 'Dry run without writing to disk')\n .action((opts) => {\n const passed = runReportCompliance({\n root: opts.root,\n output: opts.output,\n offline: opts.offline,\n strict: opts.strict,\n keyless: opts.keyless,\n dryRun: opts.dryRun,\n });\n process.exit(passed ? 0 : 1);\n });\n\n\n// --- gherkin command suite ---\nconst gherkinCommand = program\n .command('gherkin')\n .description('BDD / Gherkin synchronization and extraction tools');\n\ngherkinCommand\n .command('extract')\n .description('Extract ```gherkin``` blocks from Markdown specifications into .feature files')\n .option('-r, --root <path>', 'Project root directory')\n .option('-p, --path <path>', 'Target Markdown file or directory')\n .option('-a, --all', 'Process all specifications and requirements')\n .option('--json', 'Structured JSON format output')\n .option('-F, --format <format>', 'Output format: text or json')\n .action((opts) => {\n const passed = runGherkinExtract({\n root: opts.root,\n path: opts.path,\n all: opts.all,\n json: opts.json,\n format: opts.format,\n });\n process.exit(passed ? 0 : 1);\n });\n\ngherkinCommand\n .command('scaffold <feature-file>')\n .description('Scaffold failing RED BDD step definitions across target languages (ts, py, go, rs, cs)')\n .requiredOption('--lang <langs...>', 'Target language(s): ts, py, go, rs, cs (comma-separated or multiple)')\n .option('-o, --output <path>', 'Explicit output file path for generated step definitions')\n .option('--install', 'Automatically install missing native BDD generator')\n .option('--fallback', 'Use deterministic RED fallback template if native generator is missing')\n .option('-r, --root <path>', 'Project root directory')\n .option('--json', 'Structured JSON format output')\n .option('-F, --format <format>', 'Output format: text or json')\n .action(async (featureFile, opts) => {\n const passed = await runGherkinScaffold(featureFile, {\n root: opts.root,\n lang: opts.lang,\n output: opts.output,\n install: opts.install,\n fallback: opts.fallback,\n json: opts.json,\n format: opts.format,\n });\n process.exit(passed ? 0 : 1);\n });\n\n// --- git command suite ---\nconst gitCommand = program\n .command('git')\n .description('Tools for the 4-tier hierarchical Git branch model');\n\ngitCommand\n .command('validate <branch>')\n .description('Validate naming and hierarchy of a Git branch (Tier 1 to 4)')\n .action((branch) => {\n const passed = runGitValidate(branch);\n process.exit(passed ? 0 : 1);\n });\n\ngitCommand\n .command('plan')\n .description('Plan 4-tier Git branch hierarchy for a version and feature')\n .option('-r, --release <version>', 'Release version (e.g. v1.1.0)', 'v1.1.0')\n .option('-f, --feature <feature>', 'Feature identifier (e.g. CHG-001-telemetry)', 'CHG-001-telemetry')\n .option('-t, --tasks <tasks>', 'Comma-separated tasks list (e.g. TSK-001,TSK-002)', 'TSK-001,TSK-002')\n .action((opts) => {\n runGitPlan({ version: opts.release, feature: opts.feature, tasks: opts.tasks });\n process.exit(0);\n });\n\ngitCommand\n .command('checkout <task>')\n .description('Navigate and automatically create 4-tier cascading branches for a task')\n .option('-r, --root <path>', 'Project root directory')\n .action((task, opts) => {\n const passed = runGitCheckout(task, { root: opts.root });\n process.exit(passed ? 0 : 1);\n });\n\nconst gitHookCommand = gitCommand\n .command('hook')\n .description('AI-SDLC automated Git Hooks management and installation');\n\ngitHookCommand\n .command('install')\n .description('Install prepare-commit-msg hook for automatic commit trailer injection')\n .option('-r, --root <path>', 'Project root directory')\n .action((opts) => {\n const passed = runGitHookInstall({ root: opts.root });\n process.exit(passed ? 0 : 1);\n });\n\ngitCommand\n .command('detect-author')\n .description('Universally detect IDE-independently whether the author is human or an agent')\n .option('--json', 'Structured JSON format output')\n .option('-r, --root <path>', 'Project root directory')\n .action((opts) => {\n const passed = runGitDetectAuthor({ root: opts.root, json: opts.json });\n process.exit(passed ? 0 : 1);\n });\n\n// --- kpi command suite ---\nconst kpiCommand = program\n .command('kpi')\n .description('Metrics, telemetry, and KPI aggregation tools (PR and Release)');\n\nkpiCommand\n .command('pr')\n .description('Calculate and generate aggregated Markdown KPI table for a Pull Request')\n .option('-b, --base <branch>', 'Comparison base branch', 'main')\n .option('-h, --head <branch>', 'Source branch or HEAD', 'HEAD')\n .option('-u, --update-file <path>', 'File where to inject the KPI block (e.g. .github/PULL_REQUEST_TEMPLATE.md)')\n .option('--json', 'Print output in structured JSON format')\n .option('-r, --root <path>', 'Project root directory')\n .action((opts) => {\n const passed = runKpiPr({\n base: opts.base,\n head: opts.head,\n updateFile: opts.updateFile,\n json: opts.json,\n root: opts.root,\n });\n process.exit(passed ? 0 : 1);\n });\n\nkpiCommand\n .command('release')\n .description('Consolidate release KPIs, DIR by model/human, and rework costs')\n .requiredOption('--release <branch>', 'Release branch to audit (e.g. release/v1.1.0)')\n .option('-b, --base <branch>', 'Stable base branch (e.g. main)', 'main')\n .option('-o, --output <dir>', 'Output directory for reports (default: reports/releases/)')\n .option('--json', 'Print output in structured JSON format')\n .option('-r, --root <path>', 'Project root directory')\n .action((opts) => {\n const passed = runKpiRelease({\n release: opts.release,\n base: opts.base,\n output: opts.output,\n json: opts.json,\n root: opts.root,\n });\n process.exit(passed ? 0 : 1);\n });\n\n// --- change command suite ---\nconst changeCommand = program\n .command('change')\n .description('SDD change lifecycle and scaffolding management');\n\nchangeCommand\n .command('new <name>')\n .description('Create complete scaffolding for a new SDD change (proposal, spec, design, tasks, handoff.yaml)')\n .option('-r, --root <path>', 'Project root directory')\n .option('--from <ids...>', 'Identifier or list of identifiers to cite (UC-*, FR-*, etc.)')\n .option('--id <changeId>', 'Explicit change identifier (e.g. chg-002-my-change)')\n .option('-p, --profile <profile>', 'Change risk profile: patch, standard, or critical', 'standard')\n .option('-f, --framework <framework>', 'SDD framework: openspec or speckit', 'openspec')\n .option('-a, --author <author>', 'Author name or developer agent')\n .option('--json', 'Structured JSON format output')\n .option('-F, --format <format>', 'Output format: text or json')\n .action((name, opts) => {\n const passed = runChangeNew({\n root: opts.root,\n name,\n from: opts.from,\n id: opts.id,\n profile: opts.profile,\n framework: opts.framework,\n author: opts.author,\n json: opts.json,\n format: opts.format,\n });\n process.exit(passed ? 0 : 1);\n });\n\n// --- sdd command suite ---\nconst sddCommand = program\n .command('sdd')\n .description('Tools for integration with SDD ecosystems (OpenSpec and Spec Kit)');\n\nsddCommand\n .command('new <name>')\n .description('Alias of `aisdlc change new`: create complete scaffolding for a new SDD change')\n .option('-r, --root <path>', 'Project root directory')\n .option('--from <ids...>', 'Identifier or list of identifiers to cite (UC-*, FR-*, etc.)')\n .option('--id <changeId>', 'Explicit change identifier (e.g. chg-002-my-change)')\n .option('-p, --profile <profile>', 'Change risk profile: patch, standard, or critical', 'standard')\n .option('-f, --framework <framework>', 'SDD framework: openspec or speckit', 'openspec')\n .option('-a, --author <author>', 'Author name or developer agent')\n .option('--json', 'Structured JSON format output')\n .option('-F, --format <format>', 'Output format: text or json')\n .action((name, opts) => {\n const passed = runChangeNew({\n root: opts.root,\n name,\n from: opts.from,\n id: opts.id,\n profile: opts.profile,\n framework: opts.framework,\n author: opts.author,\n json: opts.json,\n format: opts.format,\n });\n process.exit(passed ? 0 : 1);\n });\n\nsddCommand\n .command('deposit')\n .description('Deposit a product subgraph as a sidecar companion file (handoff.yaml)')\n .requiredOption('-c, --change <id>', 'Change identifier (e.g. chg-001-telemetry)')\n .option('-f, --framework <framework>', 'SDD framework: openspec or speckit', 'openspec')\n .option('-r, --root <path>', 'Project root directory')\n .option('-t, --title <title>', 'PDaC handoff title')\n .option('--requirements <reqs>', 'Comma-separated list of requirement IDs')\n .option('--use-cases <ucs>', 'Comma-separated list of use case IDs')\n .option('--json', 'Structured JSON format output')\n .option('-F, --format <format>', 'Output format: text or json')\n .action((opts) => {\n const passed = runSddDeposit({\n root: opts.root,\n change: opts.change,\n framework: opts.framework,\n title: opts.title,\n requirements: opts.requirements,\n useCases: opts.useCases,\n json: opts.json,\n format: opts.format,\n });\n process.exit(passed ? 0 : 1);\n });\n\nsddCommand\n .command('verify')\n .description('Validate compliance of handoff.yaml sidecar files (HOF-*) in changes')\n .option('-r, --root <path>', 'Project root directory')\n .option('-f, --framework <framework>', 'SDD framework: openspec or speckit')\n .option('--json', 'Structured JSON format output')\n .option('-F, --format <format>', 'Output format: text or json')\n .action((opts) => {\n const passed = runSddVerify({\n root: opts.root,\n framework: opts.framework,\n json: opts.json,\n format: opts.format,\n });\n process.exit(passed ? 0 : 1);\n });\n\nsddCommand\n .command('integrate')\n .description('Integrate and synchronize implemented SDD changes into canonical specification (product, requirements, and architecture)')\n .option('-c, --change <id>', 'Change identifier (e.g. chg-001-telemetry)')\n .option('--auto', 'Automatically detect active change to integrate based on branch, PR, or diff')\n .option('--head-ref <ref>', 'Source branch for automatic resolution')\n .option('--pr-title <title>', 'Pull Request title for automatic resolution')\n .option('--pr-body <body>', 'Pull Request body for automatic resolution')\n .option('-r, --root <path>', 'Project root directory')\n .option('-a, --author <author>', 'Name of author or agent performing integration')\n .option('--no-archive', 'Do not archive change to specs/changes/completed after integration')\n .option('--json', 'Structured JSON format output')\n .option('-F, --format <format>', 'Output format: text or json')\n .action((opts) => {\n const passed = runSddIntegrate({\n root: opts.root,\n change: opts.change,\n auto: opts.auto,\n headRef: opts.headRef,\n prTitle: opts.prTitle,\n prBody: opts.prBody,\n author: opts.author,\n autoArchive: opts.archive !== false,\n json: opts.json,\n format: opts.format,\n });\n process.exit(passed ? 0 : 1);\n });\n\n// --- inspect command ---\nprogram\n .command('inspect <element>')\n .description('Inspect an element (FR, UC, CMP, task, or source file) to display technical summary and relationships')\n .option('-r, --root <path>', 'Project root directory')\n .option('--json', 'Structured JSON format output')\n .option('-F, --format <format>', 'Output format: text or json')\n .action((element, opts) => {\n const passed = runInspect(element, {\n root: opts.root,\n json: opts.json,\n format: opts.format,\n });\n process.exit(passed ? 0 : 1);\n });\n\n// --- init command ---\nprogram\n .command('init [directory]')\n .description('Initialize a new repository with AI-SDLC guidelines, schemas, and policies')\n .option('-d, --dry-run', 'Simulate file and directory creation without writing to disk')\n .option('-f, --force', 'Force overwrite existing agent, rule, and policy configurations with canonical templates')\n .option('--ci <provider>', 'CI/CD provider for pipeline generation (github, gitlab, azure, bitbucket)')\n .option('--agents [targets]', 'AI agent environments to configure (all, cursor, claude, antigravity, copilot, mcp, or comma-separated combination)')\n .option('--arch, --architecture <granularity>', 'Architecture templates granularity level (minimal, full, complete, none)')\n .option('-s, --stack <stacks>', 'Technology stacks to deploy coding rules for (dotnet, typescript, javascript, angular, java, kotlin, rust, go, c, cpp, all, none)')\n .option('--json', 'Structured JSON format output')\n .option('-F, --format <format>', 'Output format: text or json')\n .action(async (directory, opts) => {\n let agents = opts.agents;\n let arch = opts.architecture || opts.arch;\n let ci = opts.ci;\n const isJson = opts.json || opts.format === 'json' || process.env.AISDLC_FORMAT === 'json' || process.env.AISDLC_OUTPUT === 'json';\n if (ci === undefined && process.stdin.isTTY && !opts.dryRun && !isJson) {\n ci = await promptForCi();\n }\n if (arch === undefined && process.stdin.isTTY && !opts.dryRun && !isJson) {\n arch = await promptForArchitecture();\n }\n if (agents === undefined && process.stdin.isTTY && !opts.dryRun && !isJson) {\n agents = await promptForAgents();\n }\n const passed = runInit(directory, {\n dryRun: opts.dryRun,\n force: opts.force,\n ci,\n agents,\n architecture: arch,\n stack: opts.stack,\n json: opts.json,\n format: opts.format,\n });\n process.exit(passed ? 0 : 1);\n });\n\n// --- sync command (alias for refreshing agent configurations) ---\nprogram\n .command('sync [directory]')\n .description('Synchronize and refresh AI agent configurations, skills, and rules from canonical templates')\n .option('-d, --dry-run', 'Simulate file updates without writing to disk')\n .option('--agents [targets]', 'AI agent environments to configure (all, cursor, claude, antigravity, copilot, mcp, or comma-separated combination)')\n .option('--json', 'Structured JSON format output')\n .option('-F, --format <format>', 'Output format: text or json')\n .action((directory, opts) => {\n const passed = runInit(directory, {\n dryRun: opts.dryRun,\n force: true,\n agents: opts.agents || 'all',\n ci: 'none',\n architecture: 'none',\n stack: 'none',\n json: opts.json,\n format: opts.format,\n });\n process.exit(passed ? 0 : 1);\n });\n\n// --- mcp command ---\nprogram\n .command('mcp')\n .description('Start native AI-SDLC Model Context Protocol (MCP) server (stdio)')\n .option('-r, --root <path>', 'Project root directory')\n .option('--role <role>', 'Role context for MCP server authorization')\n .action(async (opts) => {\n await runMcpServer({ root: opts.root, role: opts.role });\n });\n\n// --- review commands (reviewer write channel) ---\nconst reviewCmd = program\n .command('review')\n .description('Review commands: sanitized write channel for reviewer roles (agent-code-reviewer, etc.)');\n\nreviewCmd\n .command('submit')\n .description('Persist a formal review report for an active change')\n .requiredOption('-c, --change <id>', 'Active change identifier (e.g. chg-054-foo)')\n .requiredOption('--reviewer <role>', 'Reviewer role (e.g. agent-code-reviewer, agent-security-auditor)')\n .requiredOption('--verdict <verdict>', 'Review verdict (COMPLIANT, SUGGESTIONS, BLOCKING)')\n .requiredOption('--body <body>', 'Review findings and content in markdown')\n .option('-r, --root <path>', 'Project root directory')\n .option('--silent', 'Suppress console output')\n .option('--json', 'Output report details as JSON')\n .action((opts) => {\n const ok = runReviewSubmit({\n root: opts.root,\n change: opts.change,\n reviewer: opts.reviewer,\n verdict: opts.verdict,\n body: opts.body,\n silent: opts.silent,\n json: opts.json,\n });\n if (!ok) process.exit(1);\n });\n\n// --- migrate command (sync schemas, templates, and policies) ---\nprogram\n .command('migrate')\n .description('Synchronize schemas, templates, and policies with upstream canonical versions')\n .option('-r, --root <path>', 'Repository root directory')\n .option('--dry-run', 'Preview changes without mutating filesystem')\n .option('--no-backup', 'Disable pre-migration backup')\n .option('-f, --force', 'Overwrite local customizations with canonical versions')\n .option('--allow-policy-downgrade', 'Permit relaxing stricter quality or security thresholds')\n .option('--json', 'Output migration report as JSON')\n .option('-v, --verbose', 'Enable verbose logging')\n .action(async (opts) => {\n const exitCode = await runMigrate({\n root: opts.root,\n dryRun: opts.dryRun,\n backup: opts.backup,\n force: opts.force,\n allowPolicyDowngrade: opts.allowPolicyDowngrade,\n json: opts.json,\n verbose: opts.verbose,\n });\n process.exit(exitCode);\n });\n\n// Handle unknown commands gracefully\nprogram.on('command:*', () => {\n console.error(pc.red(`\\n[ERROR] Unrecognized command: ${program.args.join(' ')}`));\n console.log(pc.yellow('Run `aisdlc --help` to see available commands.\\n'));\n process.exit(1);\n});\n\nprogram.parse(process.argv);\n\n\n","/**\n * CLI Handler: aisdlc check\n * Unified Pre-flight check command with optional non-destructive auto-fix.\n */\n\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport pc from 'picocolors';\nimport {\n checkGherkinInSync,\n extractGherkinFeatures,\n GherkinScaffoldLanguage,\n PreflightCheckOptions,\n PreflightCheckResult,\n PreflightGateSummary,\n scaffoldGherkinSteps,\n syncPdacDigests,\n verifyArtifactDuplicates,\n verifyArtifactsSchemas,\n verifyLicenses,\n verifyPdacGraph,\n verifyPrivacy,\n verifyProgressiveFriction,\n verifyQualityGate,\n verifySast,\n verifySecrets,\n verifyTasksGovernance,\n verifyTestingCoverage,\n verifyTraceability,\n} from '@aisdlc/core';\nimport { isJsonOutput } from './verify.js';\n\nexport interface CheckCommandOptions extends PreflightCheckOptions {\n json?: boolean;\n format?: string;\n}\n\n\nfunction detectDefaultScaffoldLanguage(rootDir: string): GherkinScaffoldLanguage {\n if (fs.existsSync(path.join(rootDir, 'pyproject.toml')) || fs.existsSync(path.join(rootDir, 'requirements.txt'))) return 'py';\n if (fs.existsSync(path.join(rootDir, 'go.mod'))) return 'go';\n if (fs.existsSync(path.join(rootDir, 'Cargo.toml'))) return 'rs';\n return 'ts';\n}\n\nfunction autoScaffoldMissingSteps(rootDir: string): number {\n const sync = checkGherkinInSync({ rootDir });\n const missing = sync.missingStepFiles ?? [];\n if (missing.length === 0) return 0;\n const lang = detectDefaultScaffoldLanguage(rootDir);\n let count = 0;\n for (const fp of missing) {\n if (scaffoldGherkinSteps({ rootDir, featurePath: fp, lang, allowFallback: true }).success) {\n count++;\n }\n }\n return count;\n}\n\nexport function runAutoFix(rootDir: string, silent?: boolean): { gherkinCount: number; digestsCount: number } {\n const gherkinRes = extractGherkinFeatures({ rootDir });\n const scaffoldedCount = autoScaffoldMissingSteps(rootDir);\n const pdacRes = syncPdacDigests({ rootDir });\n\n if (!silent) {\n if (gherkinRes.features.length > 0) {\n console.log(` ${pc.cyan('🔧 [AUTO-FIX]')} Synchronized ${pc.bold(String(gherkinRes.features.length))} .feature files (${gherkinRes.totalScenarios} scenarios).`);\n }\n if (scaffoldedCount > 0) {\n console.log(` ${pc.cyan('🔧 [AUTO-FIX]')} Scaffolded ${pc.bold(String(scaffoldedCount))} deterministic step files in tests/steps/.`);\n }\n if (pdacRes.syncedCount > 0) {\n console.log(` ${pc.cyan('🔧 [AUTO-FIX]')} Synchronized ${pc.bold(String(pdacRes.syncedCount))} SHA-256 digests across ${pdacRes.updatedFiles.length} files.`);\n }\n }\n\n return { gherkinCount: gherkinRes.features.length, digestsCount: pdacRes.syncedCount };\n}\n\nfunction buildGherkinFailedGate(totalOut: number, hasMissingSteps: boolean): PreflightGateSummary {\n const remediation = hasMissingSteps\n ? \"Run 'aisdlc gherkin scaffold <feature-file> --lang <lang> --fallback' to generate step definitions in tests/steps/.\"\n : \"Run 'aisdlc check --fix' to extract and regenerate .feature files, and remove orphan manual .feature files.\";\n return {\n name: 'BDD Synchronization (Gherkin -> .feature & steps)',\n status: 'FAILED',\n message: `${totalOut} Gherkin sync/step-scaffold violation(s) detected`,\n remediation,\n };\n}\n\nexport function auditGherkinGate(rootDir: string, wasAutoFixed: boolean): PreflightGateSummary {\n const syncCheck = checkGherkinInSync({ rootDir });\n const orphans = syncCheck.orphanFeatureFiles ?? [];\n const missingSteps = syncCheck.missingStepFiles ?? [];\n\n if (!syncCheck.inSync) {\n const totalOut = syncCheck.missingFiles.length + syncCheck.outOfSyncFiles.length + orphans.length + missingSteps.length;\n return buildGherkinFailedGate(totalOut, missingSteps.length > 0);\n }\n return {\n name: 'BDD Synchronization (Gherkin -> .feature & steps)',\n status: wasAutoFixed ? 'FIXED' : 'PASSED',\n message: wasAutoFixed\n ? `${syncCheck.totalFeatures} specifications automatically synchronized`\n : `${syncCheck.totalFeatures} specifications and step scaffolds up to date on disk`,\n };\n}\n\nexport function auditPdacGate(rootDir: string, wasAutoFixed: boolean): PreflightGateSummary {\n const res = verifyPdacGraph({ rootDir });\n if (res.success) {\n return {\n name: 'PDaC Integrity & SHA-256 Drift',\n status: wasAutoFixed ? 'FIXED' : 'PASSED',\n message: `${res.totalNodes} nodes and ${res.totalEdges} citations cryptographically aligned`,\n };\n }\n return {\n name: 'PDaC Integrity & SHA-256 Drift',\n status: 'FAILED',\n message: `${res.drifts.length} digest drift(s) detected (STALE)`,\n remediation: \"Run 'aisdlc check --fix' to automatically synchronize citation digests.\",\n };\n}\n\nexport function auditQualityGate(rootDir: string): PreflightGateSummary {\n const res = verifyQualityGate({ rootDir, requireCoverageReport: false });\n if (res.success) {\n return {\n name: 'Quality Gate (Complexity & Maintainability)',\n status: 'PASSED',\n message: `${res.passCount}/${res.totalFunctions} compliant functions (CC <= 10, LOC <= 40)`,\n };\n }\n const firstFail = res.results.find((r) => r.status === 'FAIL');\n const detail = firstFail ? ` (e.g. ${firstFail.functionName}: ${firstFail.violations.join(', ')})` : '';\n return {\n name: 'Quality Gate (Complexity & Maintainability)',\n status: 'FAILED',\n message: `${res.failCount} function(s) exceed quality thresholds${detail}`,\n remediation: 'Refactor offending functions by reducing conditional branches and lines of code.',\n };\n}\n\nexport function auditTraceabilityGate(rootDir: string): PreflightGateSummary {\n const res = verifyTraceability({ rootDir });\n if (res.success) {\n return {\n name: '360° Traceability (Reverse RTM)',\n status: 'PASSED',\n message: `${res.totalRequirements} requirements with 360° coverage (0 orphans)`,\n };\n }\n const orphanIds = res.orphans.map((o) => o.id).slice(0, 3).join(', ');\n return {\n name: '360° Traceability (Reverse RTM)',\n status: 'FAILED',\n message: `${res.orphanCount} orphan requirement(s) (${orphanIds})`,\n remediation: 'Link orphan requirements to their components in arc42 or test suites.',\n };\n}\n\nexport function auditGovernanceGate(rootDir: string): PreflightGateSummary {\n const res = verifyTasksGovernance({ rootDir });\n if (res.success) {\n return {\n name: 'Tasks Governance & Autonomy Classification',\n status: 'PASSED',\n message: `${res.totalTasks} tasks audited and compliant with autonomy modes`,\n };\n }\n return {\n name: 'Tasks Governance & Autonomy Classification',\n status: 'FAILED',\n message: `${res.violations.length} governance violation(s) detected`,\n remediation: 'Review tasks.md to assign verifiable criteria and valid autonomy modes.',\n };\n}\n\nexport function auditTestingGate(rootDir: string): PreflightGateSummary {\n const res = verifyTestingCoverage({ rootDir });\n if (res.success) {\n return {\n name: 'Test Coverage in Requirements & Tasks',\n status: 'PASSED',\n message: `${res.passedRequirements}/${res.totalRequirements} reqs and ${res.passedTasks}/${res.totalTasks} tasks verified`,\n };\n }\n return {\n name: 'Test Coverage in Requirements & Tasks',\n status: 'FAILED',\n message: `${res.failedRequirements} req(s) and ${res.failedTasks} task(s) without verifiable tests`,\n remediation: 'Add executable tests (.spec or .feature) for pending requirements and tasks.',\n };\n}\n\nexport function auditLicensesGate(rootDir: string): PreflightGateSummary {\n const res = verifyLicenses({ rootDir });\n if (res.success) {\n return {\n name: 'Open Source License Governance',\n status: 'PASSED',\n message: `${res.permittedCount} dependencies compliant with license-policy.yaml`,\n };\n }\n const badPkgs = res.violations.map((v) => `${v.packageName} (${v.license})`).slice(0, 2).join(', ');\n return {\n name: 'Open Source License Governance',\n status: 'FAILED',\n message: `${res.violations.length} prohibited license(s) detected: ${badPkgs}`,\n remediation: 'Replace packages with restricted licenses or request approval in license-policy.yaml.',\n };\n}\n\nexport function auditSchemasGate(rootDir: string): PreflightGateSummary {\n const res = verifyArtifactsSchemas({ rootDir });\n if (res.success) {\n return {\n name: 'JSON Schemas Compliance (Draft 2020-12)',\n status: 'PASSED',\n message: `${res.validCount}/${res.totalEvaluated} artifacts compliant with their schemas`,\n };\n }\n const firstViolation = res.violations[0]?.message || 'Invalid structure';\n return {\n name: 'JSON Schemas Compliance (Draft 2020-12)',\n status: 'FAILED',\n message: `${res.invalidCount} artifact(s) do not comply with JSON schema: ${firstViolation}`,\n remediation: \"Run 'aisdlc verify schemas' to audit and fix required fields.\",\n };\n}\n\nexport function auditSecretsGate(rootDir: string): PreflightGateSummary {\n const res = verifySecrets({ rootDir });\n if (res.success) {\n return {\n name: 'Secrets and Credentials Detection (Gitleaks Gate)',\n status: 'PASSED',\n message: `${res.totalFilesScanned} clean files (0 secrets or exposed credentials)`,\n };\n }\n const firstFinding = res.findings[0];\n const findingMsg = firstFinding ? ` (e.g. ${firstFinding.ruleId} in ${firstFinding.relPath}:${firstFinding.lineNumber})` : '';\n return {\n name: 'Secrets and Credentials Detection (Gitleaks Gate)',\n status: 'FAILED',\n message: `${res.findingsCount} exposed credential(s) or key(s)${findingMsg}`,\n remediation: 'Revoke exposed tokens, store them in environment variables, or use // ai-sdlc:allow-secret.',\n };\n}\n\nfunction formatSecurityErrors(secRes: ReturnType<typeof verifySecrets>, sastRes: ReturnType<typeof verifySast>): string {\n const errors: string[] = [];\n if (!secRes.success) {\n const f = secRes.findings[0];\n errors.push(`${secRes.findingsCount} secret(s) (e.g. ${f.ruleId} in ${f.relPath}:${f.lineNumber})`);\n }\n if (!sastRes.success) {\n const v = sastRes.violations[0];\n errors.push(`${sastRes.violationsCount} SAST violation(s) (e.g. ${v.ruleId} in ${v.relPath}:${v.lineNumber})`);\n }\n return errors.join('; ');\n}\n\nexport function auditSecurityGate(rootDir: string): PreflightGateSummary {\n const secRes = verifySecrets({ rootDir });\n const sastRes = verifySast({ rootDir });\n\n if (secRes.success && sastRes.success) {\n return {\n name: 'Shift-Left Security (Gitleaks Secrets & SAST)',\n status: 'PASSED',\n message: `${secRes.totalFilesScanned} clean files (0 secrets, 0 vulnerabilities)`,\n };\n }\n\n return {\n name: 'Shift-Left Security (Gitleaks Secrets & SAST)',\n status: 'FAILED',\n message: formatSecurityErrors(secRes, sastRes),\n remediation: \"Run 'aisdlc verify security' and resolve credentials or vulnerable patterns.\",\n };\n}\n\nexport function auditDuplicatesGate(rootDir: string): PreflightGateSummary {\n const res = verifyArtifactDuplicates({ rootDir });\n if (res.success) {\n return {\n name: 'Duplicate Requirements & Redundancy',\n status: 'PASSED',\n message: `${res.totalRequirements} requirements evaluated (0 collisions, ${res.warningCount} warnings)`,\n };\n }\n const firstErr = res.issues.find((i) => i.severity === 'ERROR')?.message || 'Collision detected';\n return {\n name: 'Duplicate Requirements & Redundancy',\n status: 'FAILED',\n message: `${res.errorCount} duplication error(s): ${firstErr}`,\n remediation: \"Run 'aisdlc verify duplicates' and resolve duplicate requirement IDs or statements.\",\n };\n}\n\nexport function auditFrictionGate(rootDir: string): PreflightGateSummary {\n const res = verifyProgressiveFriction({ rootDir });\n if (res.success) {\n return {\n name: 'Progressive Friction & Anti-Bypass Guardrails',\n status: 'PASSED',\n message: `Profile '${res.profile}' compliant (${res.evaluatedFiles.length} evaluated paths)`,\n };\n }\n const firstViolation = res.bypassedRules[0] || res.errors[0] || 'Anti-bypass guardrail triggered';\n return {\n name: 'Progressive Friction & Anti-Bypass Guardrails',\n status: 'FAILED',\n message: firstViolation,\n remediation: \"Reclassify change profile to 'standard' or 'critical', or revert protected path changes.\",\n };\n}\n\nexport function auditPrivacyGate(rootDir: string): PreflightGateSummary {\n const res = verifyPrivacy({ rootDir });\n if (res.success) {\n return {\n name: 'Data Protection & Privacy-by-Design (GDPR/PII-SAST)',\n status: 'PASSED',\n message: `${res.totalFilesScanned} clean files (${res.dataAssetsCount} data assets, ${res.ropaRecordsCount} ROPA records, 0 violations)`,\n };\n }\n const first = res.violations[0];\n const detail = first ? ` (e.g. ${first.ruleId} in ${first.relPath})` : '';\n return {\n name: 'Data Protection & Privacy-by-Design (GDPR/PII-SAST)',\n status: 'FAILED',\n message: `${res.violationsCount} privacy violation(s) detected${detail}`,\n remediation: \"Run 'aisdlc verify privacy' and mask PII or register ROPA / retention policies.\",\n };\n}\n\nfunction renderGateBadge(status: string): string {\n if (status === 'PASSED') return pc.green('✔ PASSED ');\n if (status === 'FIXED') return pc.cyan('🔧 AUTO-FIX ');\n return pc.red('✖ FAILED ');\n}\n\nfunction renderRemediations(failedGates: PreflightGateSummary[]): void {\n console.log(pc.bold(pc.red('\\n------------------------------------------------------------------------------')));\n console.log(pc.bold(pc.red(' REQUIRED ACTIONS TO RESOLVE BLOCKING ERRORS:')));\n console.log(pc.bold(pc.red('------------------------------------------------------------------------------')));\n failedGates.forEach((g, idx) => {\n console.log(` ${pc.bold(String(idx + 1))}. ${pc.yellow(g.name)}:`);\n console.log(` 👉 ${pc.bold(g.remediation || 'Review affected files.')}`);\n });\n console.log(pc.bold(pc.red('\\n⛔ VERDICT: PRE-FLIGHT BLOCKED (EXIT 1)\\n')));\n}\n\nfunction printDashboardHeader(autoFixExecuted: boolean, gherkinCount: number, digestsCount: number): void {\n console.log(pc.bold(pc.cyan('\\n==============================================================================')));\n console.log(pc.bold(pc.cyan(' AI-SDLC: CONSOLIDATED PRE-FLIGHT DASHBOARD (aisdlc check) ')));\n console.log(pc.bold(pc.cyan('==============================================================================\\n')));\n\n if (autoFixExecuted) {\n console.log(pc.bold(` ${pc.magenta('AUTO-FIX MODE ACTIVE:')} Non-destructive preliminary syncs applied:`));\n console.log(` - Gherkin scenarios synchronized: ${pc.bold(String(gherkinCount))}`);\n console.log(` - SHA-256 digests synchronized: ${pc.bold(String(digestsCount))}\\n`);\n }\n}\n\nfunction printDashboardFooter(isPassed: boolean): void {\n if (isPassed) {\n console.log(pc.bold(pc.green('\\n==============================================================================')));\n console.log(pc.bold(pc.green('✨ VERDICT: PRE-FLIGHT PASSED (EXIT 0) - Repository ready for Pull Request')));\n console.log(pc.bold(pc.green('==============================================================================\\n')));\n }\n}\n\nexport function renderDashboard(\n gates: PreflightGateSummary[],\n autoFixExecuted: boolean,\n gherkinCount: number,\n digestsCount: number\n): void {\n printDashboardHeader(autoFixExecuted, gherkinCount, digestsCount);\n\n for (const gate of gates) {\n console.log(` [${renderGateBadge(gate.status)}] ${pc.bold(gate.name)}`);\n console.log(` ${pc.dim(gate.message)}`);\n }\n\n const failedGates = gates.filter((g) => g.status === 'FAILED');\n if (failedGates.length > 0) {\n renderRemediations(failedGates);\n } else {\n printDashboardFooter(true);\n }\n}\n\nfunction collectPreflightGates(rootDir: string, fix: boolean, gherkinCount: number, digestsCount: number): PreflightGateSummary[] {\n return [\n auditGherkinGate(rootDir, fix && gherkinCount > 0),\n auditPdacGate(rootDir, fix && digestsCount > 0),\n auditQualityGate(rootDir),\n auditTraceabilityGate(rootDir),\n auditGovernanceGate(rootDir),\n auditTestingGate(rootDir),\n auditLicensesGate(rootDir),\n auditSchemasGate(rootDir),\n auditDuplicatesGate(rootDir),\n auditFrictionGate(rootDir),\n auditSecurityGate(rootDir),\n auditPrivacyGate(rootDir),\n ];\n}\n\nfunction emitCheckJson(result: PreflightCheckResult): void {\n const payload = {\n command: 'check',\n success: result.success,\n exitCode: result.success ? 0 : 1,\n autoFixExecuted: result.autoFixExecuted,\n gherkinSynced: result.gherkinSynced,\n digestsSynced: result.digestsSynced,\n gates: result.gates,\n };\n console.log(JSON.stringify(payload, null, 2));\n}\n\nfunction applyAutoFix(rootDir: string, isSilent: boolean, fix?: boolean): { gherkinCount: number; digestsCount: number } {\n if (!fix) return { gherkinCount: 0, digestsCount: 0 };\n const res = runAutoFix(rootDir, isSilent);\n return { gherkinCount: res.gherkinCount, digestsCount: res.digestsCount };\n}\n\nexport function executePreflightCheck(options: CheckCommandOptions = {}): PreflightCheckResult {\n const rootDir = options.root || process.cwd();\n const useJson = isJsonOutput(options);\n const isSilent = Boolean(options.silent || useJson);\n const { gherkinCount, digestsCount } = applyAutoFix(rootDir, isSilent, options.fix);\n\n const gates = collectPreflightGates(rootDir, Boolean(options.fix), gherkinCount, digestsCount);\n const success = gates.every((g) => g.status === 'PASSED' || g.status === 'FIXED');\n\n if (!isSilent) {\n renderDashboard(gates, Boolean(options.fix), gherkinCount, digestsCount);\n }\n\n const result: PreflightCheckResult = {\n success,\n autoFixExecuted: Boolean(options.fix),\n gherkinSynced: gherkinCount,\n digestsSynced: digestsCount,\n gates,\n };\n\n if (useJson) {\n emitCheckJson(result);\n }\n\n return result;\n}\n\nexport function runCheck(options: CheckCommandOptions = {}): boolean {\n const result = executePreflightCheck(options);\n return result.success;\n}\n\n","/**\n * CLI Handler: aisdlc verify\n */\n\nimport pc from 'picocolors';\nimport * as path from 'path';\nimport * as readline from 'node:readline/promises';\nimport {\n writeReportFileIfChanged,\n checkGherkinInSync,\n verifyArtifactDuplicates,\n verifyArtifactsSchemas,\n verifyLicenses,\n verifyLicensesAsync,\n verifyPdacGraph,\n verifyPrivacy,\n verifyProgressiveFriction,\n verifyQualityGate,\n verifySast,\n verifySastAsync,\n SarifIngestionError,\n verifySecrets,\n verifyTasksGovernance,\n verifyTestingCoverage,\n verifyTraceability,\n generateSuppressionsAuditReport,\n generateSecuritySarifReport,\n serializeSarifDocument,\n writeSecuritySarifReport,\n type SecuritySuppression,\n type SastSeverity,\n type ToolInstallSpec,\n} from '@aisdlc/core';\n\nfunction createTtyConfirmInstall() {\n return async (spec: ToolInstallSpec): Promise<boolean> => {\n const rl = readline.createInterface({ input: process.stdin, output: process.stdout });\n try {\n const answer = await rl.question(\n `Tool \"${spec.tool}\" is not installed. Run \"${spec.displayCommand}\"? [y/N] `\n );\n return /^y(es)?$/i.test(answer.trim());\n } finally {\n rl.close();\n }\n };\n}\n\nexport interface VerifyBaseOptions {\n root?: string;\n silent?: boolean;\n json?: boolean;\n format?: string;\n output?: string;\n}\n\nexport function isJsonOutput(options: VerifyBaseOptions = {}): boolean {\n if (options.json !== undefined) {\n return Boolean(options.json);\n }\n if (options.format !== undefined) {\n return options.format.trim().toLowerCase() === 'json';\n }\n const env = process.env.AISDLC_FORMAT?.trim().toLowerCase() ||\n process.env.AISDLC_OUTPUT?.trim().toLowerCase();\n return env === 'json';\n}\n\nexport function isSarifOutput(options: VerifyBaseOptions = {}): boolean {\n if (options.format !== undefined) {\n return options.format.trim().toLowerCase() === \"sarif\";\n }\n const env = process.env.AISDLC_FORMAT?.trim().toLowerCase() ||\n process.env.AISDLC_OUTPUT?.trim().toLowerCase();\n return env === \"sarif\";\n}\n\nexport interface VerifyJsonPayload<TSummary = Record<string, unknown>, TViolation = unknown> {\n gate: string;\n success: boolean;\n exitCode: number;\n summary: TSummary;\n violations: TViolation[];\n [key: string]: unknown;\n}\n\nexport interface QualityVerifyOptions extends VerifyBaseOptions {\n policy?: string;\n maxCyclomatic?: number | string;\n maxCognitive?: number | string;\n minMaintainability?: number | string;\n maxLines?: number | string;\n enforceMode?: 'STRICT' | 'PERMISSIVE' | string;\n updateBaseline?: boolean;\n baseline?: string | boolean;\n ratchet?: boolean;\n requireCoverageReport?: boolean;\n}\n\nfunction buildFunctionMetricViolations(results: ReturnType<typeof verifyQualityGate>['results']) {\n return results\n .filter((r) => r.status === 'FAIL')\n .flatMap((r) =>\n r.violations.map((v) => ({\n file: r.relPath,\n function: r.functionName,\n metric: 'quality',\n message: v,\n metrics: { loc: r.loc, cyclomatic: r.cyclomatic, cognitive: r.cognitive, maintainability: r.maintainability },\n }))\n );\n}\n\nfunction buildQualityViolations(result: ReturnType<typeof verifyQualityGate>) {\n const fnViolations = buildFunctionMetricViolations(result.results);\n const untested = (result.untestedFunctions || []).map((u) => ({\n file: u.file,\n function: u.functionName,\n metric: 'unit-test',\n message: `Function [${u.functionName}] lacks direct unit test`,\n }));\n const untestedUi = (result.untestedUiComponents || []).map((c) => ({\n file: c.file,\n component: c.componentName,\n metric: 'ui-test',\n message: `UI component [${c.componentName}] lacks UI/E2E test`,\n }));\n const cov = (result.coverageViolations || []).map((message) => ({ metric: 'coverage', message }));\n return [...fnViolations, ...untested, ...untestedUi, ...cov];\n}\n\nfunction emitQualityJson(result: ReturnType<typeof verifyQualityGate>): void {\n const violations = buildQualityViolations(result);\n const payload: VerifyJsonPayload = {\n gate: 'quality',\n success: result.success,\n exitCode: result.success ? 0 : 1,\n summary: {\n totalFiles: result.totalFiles,\n totalFunctions: result.totalFunctions,\n passCount: result.passCount,\n failCount: result.failCount,\n untestedFunctionsCount: result.untestedFunctions?.length || 0,\n untestedUiComponentsCount: result.untestedUiComponents?.length || 0,\n coverageViolationsCount: result.coverageViolations?.length || 0,\n baselineViolationsCount: result.baselineViolationsCount || 0,\n toleratedViolationsCount: result.toleratedViolationsCount || 0,\n newViolationsCount: result.newViolationsCount || 0,\n baselineUpdated: result.baselineUpdated || false,\n },\n violations,\n };\n console.log(JSON.stringify(payload, null, 2));\n}\n\nfunction printQualityFailingDetails(failing: ReturnType<typeof verifyQualityGate>['results'], isPermissive: boolean): void {\n const colorFn = isPermissive ? pc.yellow : pc.red;\n const label = isPermissive ? '\\n Detected warnings (PERMISSIVE mode):' : '\\n Detected violations:';\n console.log(colorFn(label));\n const maxToShow = 15;\n for (const f of failing.slice(0, maxToShow)) {\n console.log(` ${colorFn(isPermissive ? '⚠' : '✖')} ${pc.bold(f.relPath)} [${f.functionName}]: ${f.violations.join(', ')}`);\n }\n if (failing.length > maxToShow) {\n console.log(colorFn(` ... and ${failing.length - maxToShow} more functions exceeding thresholds.`));\n }\n}\n\nfunction printQualityTestAndCoverageGaps(result: ReturnType<typeof verifyQualityGate>): void {\n const untested = result.untestedFunctions || [];\n if (untested.length > 0) {\n console.log(pc.red('\\n Functions lacking unit tests:'));\n for (const u of untested.slice(0, 15)) {\n console.log(` ${pc.red('✖')} ${pc.bold(u.file)} [${u.functionName}]`);\n }\n }\n const untestedUi = result.untestedUiComponents || [];\n if (untestedUi.length > 0) {\n console.log(pc.red('\\n UI components lacking UI/E2E tests:'));\n for (const c of untestedUi.slice(0, 15)) {\n console.log(` ${pc.red('✖')} ${pc.bold(c.file)} [${c.componentName}]`);\n }\n }\n for (const cv of result.coverageViolations || []) {\n console.log(` ${pc.red('✖')} ${cv}`);\n }\n}\n\nfunction printQualitySummary(result: ReturnType<typeof verifyQualityGate>, isPermissive: boolean): void {\n console.log(` Analyzed files: ${pc.bold(String(result.totalFiles))}`);\n console.log(` Evaluated functions: ${pc.bold(String(result.totalFunctions))}`);\n console.log(` Compliant functions: ${pc.green(String(result.passCount))}`);\n if (result.toleratedViolationsCount && result.toleratedViolationsCount > 0) {\n console.log(` Tolerated warnings: ${pc.yellow(String(result.toleratedViolationsCount))} (Ratchet mode)`);\n }\n const failStr = result.failCount > 0 ? (isPermissive ? pc.yellow(String(result.failCount)) : pc.red(String(result.failCount))) : pc.green(\"0\");\n console.log(` Failing functions: ${failStr}`);\n}\n\nfunction printQualityConsole(result: ReturnType<typeof verifyQualityGate>): void {\n const isPermissive = result.policy.enforce_mode === \"PERMISSIVE\";\n console.log(\n ` Active thresholds: CC <= ${result.policy.max_cyclomatic} | Cognitive <= ${result.policy.max_cognitive} | MI >= ${result.policy.min_maintainability} | Lines <= ${result.policy.max_function_lines} | Mode: ${result.policy.enforce_mode}`\n );\n printQualitySummary(result, isPermissive);\n if (result.failCount > 0) {\n printQualityFailingDetails(result.results.filter((r) => r.status === \"FAIL\"), isPermissive);\n }\n printQualityTestAndCoverageGaps(result);\n const tag = isPermissive && result.failCount > 0 ? \" (PERMISSIVE mode)\" : \"\";\n console.log(result.success ? pc.green(`\\n✔ Release Gate PASSED${tag}\\n`) : pc.red(\"\\n✖ Release Gate BLOCKED\\n\"));\n}\n\nfunction buildQualityThresholds(options: QualityVerifyOptions) {\n return {\n max_cyclomatic: options.maxCyclomatic !== undefined ? Number(options.maxCyclomatic) : undefined,\n max_cognitive: options.maxCognitive !== undefined ? Number(options.maxCognitive) : undefined,\n min_maintainability: options.minMaintainability !== undefined ? Number(options.minMaintainability) : undefined,\n max_function_lines: options.maxLines !== undefined ? Number(options.maxLines) : undefined,\n enforce_mode: options.enforceMode,\n };\n}\n\nexport function runVerifyQuality(options: QualityVerifyOptions = {}): boolean {\n const rootDir = options.root || process.cwd();\n const useJson = isJsonOutput(options);\n if (!options.silent && !useJson) {\n console.log(pc.bold(pc.cyan('\\n🔍 [AI-SDLC] Verifying Quality Gate (Complexity & Maintainability)...')));\n }\n\n const result = verifyQualityGate({\n rootDir,\n policyPath: options.policy,\n thresholds: buildQualityThresholds(options),\n updateBaseline: options.updateBaseline,\n baseline: options.baseline,\n ratchet: options.ratchet,\n requireCoverageReport: options.requireCoverageReport,\n });\n\n if (useJson) {\n emitQualityJson(result);\n } else if (!options.silent) {\n printQualityConsole(result);\n }\n return result.success;\n}\n\nexport interface TraceabilityVerifyOptions extends VerifyBaseOptions {}\n\nfunction buildTraceabilityViolations(result: ReturnType<typeof verifyTraceability>) {\n const orphanViolations = result.orphans.map((o) => ({\n id: o.id,\n title: o.title,\n productStatus: o.productStatus,\n archStatus: o.archStatus,\n testStatus: o.testStatus,\n message: `Orphan requirement [${o.id}]`,\n }));\n const contractViolations = (result.contractAudits || [])\n .filter((c) => c.status !== 'COMPLIANT')\n .map((c) => ({\n id: c.designId,\n method: c.method,\n status: c.status,\n message: `Design contract [${c.designId}] method '${c.method}': ${c.status}`,\n }));\n return [...orphanViolations, ...contractViolations];\n}\n\nfunction emitTraceabilityJson(result: ReturnType<typeof verifyTraceability>): void {\n const payload: VerifyJsonPayload = {\n gate: 'traceability',\n success: result.success,\n exitCode: result.success ? 0 : 1,\n summary: {\n totalRequirements: result.totalRequirements,\n conformingCount: result.totalRequirements - result.orphanCount,\n orphanCount: result.orphanCount,\n missingContractsCount: result.missingContractsCount || 0,\n },\n violations: buildTraceabilityViolations(result),\n };\n console.log(JSON.stringify(payload, null, 2));\n}\n\nfunction printMissingContractAudits(result: ReturnType<typeof verifyTraceability>): void {\n const failingContracts = (result.contractAudits || []).filter((c) => c.status !== 'COMPLIANT');\n if (failingContracts.length === 0) return;\n console.log(pc.red('\\n Unfulfilled design contracts (design.md -> src/ & tests/):'));\n for (const c of failingContracts) {\n console.log(` ${pc.red('✖')} [${c.designId}] ${c.interfaceName ? `${c.interfaceName}.` : ''}${c.method}: ${c.status}`);\n }\n}\n\nfunction printTraceabilityConsole(result: ReturnType<typeof verifyTraceability>): void {\n console.log(` Total requirements: ${pc.bold(String(result.totalRequirements))}`);\n console.log(` Compliant requirements: ${pc.green(String(result.totalRequirements - result.orphanCount))}`);\n console.log(` Orphan requirements: ${result.orphanCount > 0 ? pc.red(String(result.orphanCount)) : pc.green('0')}`);\n\n if (result.orphanCount > 0) {\n console.log(pc.red('\\n Traceability gaps:'));\n for (const o of result.orphans) {\n console.log(` ${pc.red('✖')} [${o.id}] Product: ${o.productStatus}, Architecture: ${o.archStatus}, Testing: ${o.testStatus}`);\n }\n }\n printMissingContractAudits(result);\n console.log(result.success ? pc.green('\\n✔ 360° Traceability COMPLIANT (100%)\\n') : pc.red('\\n✖ Traceability BLOCKED\\n'));\n}\n\nexport function runVerifyTraceability(options: TraceabilityVerifyOptions = {}): boolean {\n const rootDir = options.root || process.cwd();\n const useJson = isJsonOutput(options);\n const isSilent = Boolean(options.silent || useJson);\n if (!isSilent) {\n console.log(pc.bold(pc.cyan('\\n🔍 [AI-SDLC] Verifying 360° Traceability (Product -> Architecture -> Testing)...')));\n }\n\n const result = verifyTraceability({ rootDir });\n\n if (useJson) {\n emitTraceabilityJson(result);\n return result.success;\n }\n if (!options.silent) {\n printTraceabilityConsole(result);\n }\n return result.success;\n}\n\nfunction emitGovernanceJson(result: ReturnType<typeof verifyTasksGovernance>): void {\n const payload: VerifyJsonPayload = {\n gate: 'governance',\n success: result.success,\n exitCode: result.success ? 0 : 1,\n summary: {\n totalTasks: result.totalTasks,\n verifiedCount: result.verifiedCount,\n unverifiedCount: result.unverifiedCount,\n modeCounts: result.modeCounts,\n riskCounts: result.riskCounts,\n },\n violations: result.violations.map((v) => ({ message: v })),\n };\n console.log(JSON.stringify(payload, null, 2));\n}\n\nfunction printGovernanceConsole(result: ReturnType<typeof verifyTasksGovernance>): void {\n console.log(` Total audited tasks: ${pc.bold(String(result.totalTasks))}`);\n console.log(` Tasks with verification: ${pc.green(String(result.verifiedCount))}`);\n console.log(` Tasks without verif.: ${result.unverifiedCount > 0 ? pc.red(String(result.unverifiedCount)) : pc.green('0')}`);\n console.log(` Autonomy distribution:`);\n console.log(` 🟢 AUTONOMOUS: ${result.modeCounts['AUTONOMOUS'] || 0}`);\n console.log(` 🟡 HUMAN_REVIEW_PLAN: ${result.modeCounts['HUMAN_REVIEW_PLAN'] || 0}`);\n console.log(` 🟠 AMBIGUOUS: ${result.modeCounts['AMBIGUOUS'] || 0}`);\n console.log(` 🔴 HIGH_RISK_MANUAL: ${result.modeCounts['HIGH_RISK_MANUAL'] || 0}`);\n\n if (result.violations.length > 0) {\n console.log(pc.red('\\n Governance violations:'));\n for (const v of result.violations) {\n console.log(` ${pc.red('✖')} ${v}`);\n }\n }\n console.log(result.success ? pc.green('\\n✔ Tasks Governance COMPLIANT\\n') : pc.red('\\n✖ Tasks Governance BLOCKED\\n'));\n}\n\nexport interface GovernanceVerifyOptions extends VerifyBaseOptions {}\n\nexport function runVerifyGovernance(options: GovernanceVerifyOptions = {}): boolean {\n const rootDir = options.root || process.cwd();\n const useJson = isJsonOutput(options);\n const isSilent = Boolean(options.silent || useJson);\n if (!isSilent) {\n console.log(pc.bold(pc.cyan('\\n🔍 [AI-SDLC] Verifying Tasks Governance and Autonomy Classification...')));\n }\n\n const result = verifyTasksGovernance({ rootDir });\n\n if (useJson) {\n emitGovernanceJson(result);\n return result.success;\n }\n if (!options.silent) {\n printGovernanceConsole(result);\n }\n return result.success;\n}\n\nexport interface TestingVerifyOptions extends VerifyBaseOptions {}\n\nfunction formatReqTestingViolationMsg(r: ReturnType<typeof verifyTestingCoverage>['requirements'][number]): string {\n if (r.missingVariants && r.missingVariants.length > 0) {\n return `Requirement [${r.id}] missing BDD variant categories: ${r.missingVariants.join(', ')}`;\n }\n return `Requirement without verifiable test [${r.id}]`;\n}\n\nfunction mapReqViolations(requirements: ReturnType<typeof verifyTestingCoverage>['requirements']) {\n return requirements\n .filter((r) => r.status !== 'VERIFICADO_CON_PRUEBA')\n .map((r) => ({\n type: 'REQUIREMENT',\n id: r.id,\n title: r.title,\n file: r.file,\n missingVariants: r.missingVariants,\n message: formatReqTestingViolationMsg(r),\n }));\n}\n\nfunction mapTaskViolations(tasks: ReturnType<typeof verifyTestingCoverage>['tasks']) {\n return tasks\n .filter((t) => t.status !== 'VERIFICADO_CON_PRUEBA')\n .map((t) => ({\n type: 'TASK',\n id: t.id,\n title: t.title,\n file: t.file,\n message: `Task without test verification [${t.id}]`,\n }));\n}\n\nfunction buildTestingViolations(result: ReturnType<typeof verifyTestingCoverage>) {\n const flowViolations = (result.useCaseFlows || [])\n .filter((u) => u.status !== 'VERIFICADO_CON_PRUEBA')\n .map((u) => ({\n type: 'USE_CASE_FLOW',\n id: u.id,\n file: u.file,\n missingFlows: u.missingFlows,\n message: `Use Case [${u.id}] missing tests for flows: ${u.missingFlows.join(', ')}`,\n }));\n\n return [...mapReqViolations(result.requirements), ...mapTaskViolations(result.tasks), ...flowViolations];\n}\n\nfunction emitTestingJson(result: ReturnType<typeof verifyTestingCoverage>): void {\n const payload: VerifyJsonPayload = {\n gate: 'testing',\n success: result.success,\n exitCode: result.success ? 0 : 1,\n summary: {\n totalRequirements: result.totalRequirements,\n passedRequirements: result.passedRequirements,\n failedRequirements: result.failedRequirements,\n totalTasks: result.totalTasks,\n passedTasks: result.passedTasks,\n failedTasks: result.failedTasks,\n failedUseCaseFlows: result.failedUseCaseFlows || 0,\n },\n violations: buildTestingViolations(result),\n };\n console.log(JSON.stringify(payload, null, 2));\n}\n\nfunction printTestingFailures(result: ReturnType<typeof verifyTestingCoverage>): void {\n for (const r of result.requirements.filter((req) => req.status !== 'VERIFICADO_CON_PRUEBA')) {\n const varHint = r.missingVariants?.length ? ` [Missing BDD variants: ${r.missingVariants.join(', ')}]` : '';\n console.log(` ${pc.red('✖')} [Requirement: ${r.id}] ${r.title} (${r.file})${varHint}`);\n }\n for (const t of result.tasks.filter((tsk) => tsk.status !== 'VERIFICADO_CON_PRUEBA')) {\n console.log(` ${pc.red('✖')} [Task: ${t.id}] ${t.title} (${t.file})`);\n }\n for (const u of (result.useCaseFlows || []).filter((uc) => uc.status !== 'VERIFICADO_CON_PRUEBA')) {\n console.log(` ${pc.red('✖')} [Use Case Flows: ${u.id}] Missing tests for: ${u.missingFlows.join(', ')} (${u.file})`);\n }\n}\n\nfunction printTestingConsole(result: ReturnType<typeof verifyTestingCoverage>): void {\n console.log(` Verified requirements: ${pc.green(`${result.passedRequirements}/${result.totalRequirements}`)}`);\n console.log(` Verified tasks: ${pc.green(`${result.passedTasks}/${result.totalTasks}`)}`);\n\n if (result.failedRequirements > 0 || result.failedTasks > 0 || (result.failedUseCaseFlows || 0) > 0) {\n console.log(pc.red('\\n Items lacking executable tests:'));\n printTestingFailures(result);\n }\n console.log(result.success ? pc.green('\\n✔ Test Coverage COMPLIANT (100%)\\n') : pc.red('\\n✖ Test Coverage INSUFFICIENT\\n'));\n}\n\nexport function runVerifyTesting(options: TestingVerifyOptions = {}): boolean {\n const rootDir = options.root || process.cwd();\n const useJson = isJsonOutput(options);\n const isSilent = Boolean(options.silent || useJson);\n if (!isSilent) {\n console.log(pc.bold(pc.cyan('\\n🔍 [AI-SDLC] Verifying Test Coverage in Requirements and Tasks...')));\n }\n\n const result = verifyTestingCoverage({ rootDir });\n\n if (useJson) {\n emitTestingJson(result);\n return result.success;\n }\n if (!options.silent) {\n printTestingConsole(result);\n }\n return result.success;\n}\n\nexport interface LicenseVerifyOptions extends VerifyBaseOptions {\n vuln?: boolean;\n policy?: string;\n manifest?: string;\n dynamic?: boolean;\n tool?: 'native' | 'license-checker' | 'trivy' | 'syft';\n depth?: 'direct' | 'transitive';\n sbom?: boolean | string;\n sbomInput?: string;\n notices?: boolean | string;\n nonInteractive?: boolean;\n noInstallPrompt?: boolean;\n ci?: boolean;\n}\n\nfunction emitLicensesJson(result: ReturnType<typeof verifyLicenses>): void {\n const payload: VerifyJsonPayload = {\n gate: 'licenses',\n success: result.success,\n exitCode: result.success ? 0 : 1,\n summary: {\n totalEvaluated: result.totalEvaluated,\n permittedCount: result.permittedCount,\n violationsCount: result.violations.length,\n },\n violations: result.violations.map((v) => ({\n package: v.packageName,\n version: v.version,\n license: v.license,\n category: v.category,\n message: v.reason,\n })),\n artifacts: {\n sbomPath: result.sbomPath,\n noticesPath: result.noticesPath,\n },\n };\n console.log(JSON.stringify(payload, null, 2));\n}\n\nfunction printDetectedVulnerabilities(vulnerabilities?: Array<{ severity: string; id: string; packageName: string; installedVersion: string; cvssV3Score?: number; primaryUrl?: string }>): void {\n if (!vulnerabilities || vulnerabilities.length === 0) return;\n console.log(pc.yellow('\\n Detected package vulnerabilities (CVE/GHSA):'));\n for (const v of vulnerabilities) {\n console.log(` ${pc.red('✖')} [${v.severity}] [${v.id}] ${v.packageName}@${v.installedVersion} (CVSS: ${v.cvssV3Score ?? 'N/A'}): ${v.primaryUrl || ''}`);\n }\n}\n\nfunction printLicenseArtifacts(sbomPath?: string, noticesPath?: string): void {\n if (sbomPath) console.log(` CycloneDX SBOM generated: ${pc.cyan(sbomPath)}`);\n if (noticesPath) console.log(` Legal notices generated: ${pc.cyan(noticesPath)}`);\n}\n\nfunction printLicenseViolations(violations: Array<{ category: string; packageName: string; license: string; reason: string }>): void {\n if (violations.length === 0) return;\n console.log(pc.red('\\n Detected license violations:'));\n for (const v of violations) {\n console.log(` ${pc.red('✖')} [${v.category}] ${v.packageName} (${v.license}): ${v.reason}`);\n }\n}\n\nfunction printLicensesConsole(result: ReturnType<typeof verifyLicenses>): void {\n console.log(` Evaluated dependencies: ${pc.bold(String(result.totalEvaluated))}`);\n console.log(` Compliant dependencies: ${pc.green(String(result.permittedCount))}`);\n console.log(` License violations: ${result.violations.length > 0 ? pc.red(String(result.violations.length)) : pc.green('0')}`);\n printLicenseArtifacts(result.sbomPath, result.noticesPath);\n printLicenseViolations(result.violations);\n if (result.vulnerabilitiesSkipped) {\n console.log(pc.gray(' Vulnerabilities (CVE/GHSA): skipped (Trivy not installed in environment; enforced in CI)'));\n } else {\n printDetectedVulnerabilities(result.vulnerabilities);\n }\n console.log(result.success ? pc.green('\\n✔ OSS License Governance COMPLIANT\\n') : pc.red('\\n✖ OSS License Governance BLOCKED\\n'));\n}\n\nfunction buildLicenseVerifyInput(options: LicenseVerifyOptions, rootDir: string) {\n return {\n rootDir,\n policyPath: options.policy,\n manifestPath: options.manifest,\n dynamic: options.dynamic,\n tool: options.tool,\n depth: options.depth,\n generateSbom: options.sbom !== undefined ? Boolean(options.sbom) : undefined,\n sbomPath: typeof options.sbom === 'string' ? options.sbom : undefined,\n sbomInputPath: options.sbomInput,\n generateNotices: options.notices !== undefined ? Boolean(options.notices) : undefined,\n noticesPath: typeof options.notices === 'string' ? options.notices : undefined,\n scanVulnerabilities: options.vuln !== undefined ? Boolean(options.vuln) : undefined,\n nonInteractive: options.nonInteractive,\n noInstallPrompt: options.noInstallPrompt,\n ci: options.ci,\n confirmInstall: createTtyConfirmInstall(),\n };\n}\n\nfunction finalizeLicensesOutput(\n result: ReturnType<typeof verifyLicenses>,\n options: LicenseVerifyOptions,\n useJson: boolean\n): boolean {\n if (result.warnings && result.warnings.length > 0 && !options.silent) {\n for (const warning of result.warnings) {\n process.stderr.write(`[SBOM WARNING] ${warning}\\n`);\n }\n }\n if (useJson) {\n emitLicensesJson(result);\n } else if (!options.silent) {\n printLicensesConsole(result);\n }\n return result.success;\n}\n\nexport function runVerifyLicenses(options: LicenseVerifyOptions = {}): boolean {\n const rootDir = options.root || process.cwd();\n const useJson = isJsonOutput(options);\n if (!options.silent && !useJson) {\n console.log(pc.bold(pc.cyan('\\n🔍 [AI-SDLC] Verifying Open Source License Compliance (SCA)...')));\n }\n const result = verifyLicenses(buildLicenseVerifyInput(options, rootDir));\n return finalizeLicensesOutput(result, options, useJson);\n}\n\nexport async function runVerifyLicensesAsync(options: LicenseVerifyOptions = {}): Promise<boolean> {\n const rootDir = options.root || process.cwd();\n const useJson = isJsonOutput(options);\n if (!options.silent && !useJson) {\n console.log(pc.bold(pc.cyan('\\n🔍 [AI-SDLC] Verifying Open Source License Compliance (SCA)...')));\n }\n const result = await verifyLicensesAsync(buildLicenseVerifyInput(options, rootDir));\n return finalizeLicensesOutput(result, options, useJson);\n}\n\nexport interface PdacVerifyOptions extends VerifyBaseOptions {}\n\nfunction buildPdacViolations(result: ReturnType<typeof verifyPdacGraph>) {\n const drifts = result.drifts.map((d) => ({\n sourceId: d.sourceId,\n targetId: d.targetId,\n sourceFile: d.sourceFile,\n expectedDigest: d.expectedDigest,\n actualDigest: d.actualDigest,\n message: `Cryptographic drift in ${d.sourceFile} citing ${d.targetId}`,\n }));\n const unresolved = (result.unresolvedCitations || []).map((u) => ({\n sourceId: u.sourceFile,\n targetId: u.targetId,\n sourceFile: u.sourceFile,\n message: `Unresolved citation in ${u.sourceFile} citing non-existent artifact '${u.targetId}'`,\n }));\n const anchors = (result.invalidAnchors || []).map((a) => ({\n sourceId: a.sourceFile,\n targetId: a.targetId,\n sourceFile: a.sourceFile,\n message: a.reason,\n }));\n return [...drifts, ...unresolved, ...anchors];\n}\n\nfunction emitPdacJson(result: ReturnType<typeof verifyPdacGraph>): void {\n const payload: VerifyJsonPayload = {\n gate: 'pdac',\n success: result.success,\n exitCode: result.success ? 0 : 1,\n summary: {\n totalNodes: result.totalNodes,\n totalEdges: result.totalEdges,\n driftCount: result.drifts.length,\n unresolvedCount: result.unresolvedCount || 0,\n invalidAnchorCount: result.invalidAnchors?.length || 0,\n },\n violations: buildPdacViolations(result),\n };\n console.log(JSON.stringify(payload, null, 2));\n}\n\nfunction printDrifts(drifts: ReturnType<typeof verifyPdacGraph>['drifts']): void {\n if (drifts.length === 0) return;\n console.log(pc.red('\\n Detected drifts (Status: STALE):'));\n for (const d of drifts) {\n console.log(` ${pc.red('✖')} In ${d.sourceFile} citing ${d.targetId}: misaligned digest.`);\n }\n}\n\nfunction printUnresolved(unresolved: ReturnType<typeof verifyPdacGraph>['unresolvedCitations']): void {\n if (!unresolved || unresolved.length === 0) return;\n console.log(pc.red('\\n Unresolved citations:'));\n for (const u of unresolved) {\n console.log(` ${pc.red('✖')} In ${u.sourceFile}: references non-existent artifact '${u.targetId}'.`);\n }\n}\n\nfunction printInvalidAnchors(anchors: ReturnType<typeof verifyPdacGraph>['invalidAnchors']): void {\n if (!anchors || anchors.length === 0) return;\n console.log(pc.red('\\n Invalid anchors:'));\n for (const a of anchors) {\n console.log(` ${pc.red('✖')} In ${a.sourceFile}: ${a.reason}`);\n }\n}\n\nfunction printPdacConsole(result: ReturnType<typeof verifyPdacGraph>): void {\n console.log(` PDaC baseline nodes: ${pc.bold(String(result.totalNodes))}`);\n console.log(` Evaluated citations: ${pc.bold(String(result.totalEdges))}`);\n console.log(` Cryptographic drifts: ${result.drifts.length > 0 ? pc.red(String(result.drifts.length)) : pc.green('0')}`);\n if (result.unresolvedCount && result.unresolvedCount > 0) {\n console.log(` Unresolved citations: ${pc.red(String(result.unresolvedCount))}`);\n }\n if (result.invalidAnchors && result.invalidAnchors.length > 0) {\n console.log(` Invalid anchors: ${pc.red(String(result.invalidAnchors.length))}`);\n }\n\n printDrifts(result.drifts);\n printUnresolved(result.unresolvedCitations);\n printInvalidAnchors(result.invalidAnchors);\n\n console.log(result.success ? pc.green('\\n✔ PDaC Graph Free of Drift and Fully Verified\\n') : pc.red('\\n✖ PDaC Verification Failed (Drift, Unresolved Citations, or Invalid Anchors)\\n'));\n}\n\nexport function runVerifyPdac(options: PdacVerifyOptions = {}): boolean {\n const rootDir = options.root || process.cwd();\n const useJson = isJsonOutput(options);\n const isSilent = Boolean(options.silent || useJson);\n if (!isSilent) {\n console.log(pc.bold(pc.cyan('\\n🔍 [AI-SDLC] Verifying PDaC Graph and Cryptographic Drift (SHA-256)...')));\n }\n\n const result = verifyPdacGraph({ rootDir });\n\n if (useJson) {\n emitPdacJson(result);\n return result.success;\n }\n if (!options.silent) {\n printPdacConsole(result);\n }\n return result.success;\n}\n\nexport interface SchemasVerifyOptions extends VerifyBaseOptions {\n path?: string;\n}\n\nfunction emitSchemasJson(result: ReturnType<typeof verifyArtifactsSchemas>): void {\n const payload: VerifyJsonPayload = {\n gate: 'schemas',\n success: result.success,\n exitCode: result.success ? 0 : 1,\n summary: {\n totalEvaluated: result.totalEvaluated,\n validCount: result.validCount,\n invalidCount: result.invalidCount,\n },\n violations: result.violations.map((v) => ({\n file: v.filePath,\n id: v.id,\n schemaId: v.schemaId,\n property: v.property,\n message: v.message,\n })),\n };\n console.log(JSON.stringify(payload, null, 2));\n}\n\nfunction printSchemasConsole(result: ReturnType<typeof verifyArtifactsSchemas>): void {\n console.log(` Evaluated artifacts: ${pc.bold(String(result.totalEvaluated))}`);\n console.log(` Compliant artifacts: ${pc.green(String(result.validCount))}`);\n console.log(` Schema violations: ${result.invalidCount > 0 ? pc.red(String(result.invalidCount)) : pc.green('0')}`);\n\n if (result.violations.length > 0) {\n console.log(pc.red('\\n Detected JSON schema violations:'));\n for (const v of result.violations) {\n console.log(` ${pc.red('✖')} [${v.id || v.filePath}] (${v.schemaId || 'schema'}): ${v.message}`);\n }\n }\n console.log(result.success ? pc.green('\\n✔ Artifact Schemas COMPLIANT (100%)\\n') : pc.red('\\n✖ Artifact Schemas BLOCKED\\n'));\n}\n\nexport function runVerifySchemas(options: SchemasVerifyOptions = {}): boolean {\n const rootDir = options.root || process.cwd();\n const useJson = isJsonOutput(options);\n const isSilent = Boolean(options.silent || useJson);\n if (!isSilent) {\n console.log(pc.bold(pc.cyan('\\n🔍 [AI-SDLC] Verifying JSON Schemas Compliance (Draft 2020-12)...')));\n }\n\n const result = verifyArtifactsSchemas({ rootDir, targetPath: options.path });\n\n if (useJson) {\n emitSchemasJson(result);\n return result.success;\n }\n if (!options.silent) {\n printSchemasConsole(result);\n }\n return result.success;\n}\n\nexport interface FrictionVerifyOptions extends VerifyBaseOptions {\n change?: string;\n diffFiles?: string[];\n}\n\nfunction emitFrictionJson(result: ReturnType<typeof verifyProgressiveFriction>): void {\n const violations = [\n ...result.bypassedRules.map((rule) => ({ type: 'ANTI_BYPASS', message: rule })),\n ...result.errors.map((err) => ({ type: 'PROFILE_ERROR', message: err })),\n ];\n const payload: VerifyJsonPayload = {\n gate: 'friction',\n success: result.success,\n exitCode: result.success ? 0 : 1,\n summary: {\n profile: result.profile,\n evaluatedFilesCount: result.evaluatedFiles.length,\n bypassed: result.bypassed,\n },\n violations,\n };\n console.log(JSON.stringify(payload, null, 2));\n}\n\nfunction printFrictionConsole(result: ReturnType<typeof verifyProgressiveFriction>): void {\n console.log(` Detected profile: ${pc.magenta(result.profile)}`);\n console.log(` Evaluated files: ${pc.bold(String(result.evaluatedFiles.length))}`);\n if (result.bypassedRules.length > 0) {\n console.log(pc.red('\\n Anti-Bypass violations detected:'));\n for (const rule of result.bypassedRules) {\n console.log(` ${pc.red('✖')} ${rule}`);\n }\n }\n if (result.errors.length > 0) {\n console.log(pc.red('\\n Profile validation errors:'));\n for (const err of result.errors) {\n console.log(` ${pc.red('✖')} ${err}`);\n }\n }\n console.log(\n result.success\n ? pc.green('\\n✔ Progressive Friction COMPLIANT (EXIT 0)\\n')\n : pc.red('\\n✖ Progressive Friction BLOCKED (EXIT 1)\\n')\n );\n}\n\nexport function runVerifyFriction(options: FrictionVerifyOptions = {}): boolean {\n const rootDir = options.root || process.cwd();\n const useJson = isJsonOutput(options);\n const isSilent = Boolean(options.silent || useJson);\n if (!isSilent) {\n console.log(pc.bold(pc.cyan('\\n🛡️ [AI-SDLC] Verifying Progressive Friction and Anti-Bypass Guardrails...')));\n }\n\n const result = verifyProgressiveFriction({\n rootDir,\n changeId: options.change,\n diffFiles: options.diffFiles,\n });\n\n if (useJson) {\n emitFrictionJson(result);\n return result.success;\n }\n if (!options.silent) {\n printFrictionConsole(result);\n }\n return result.success;\n}\n\nexport interface DuplicatesVerifyOptions extends VerifyBaseOptions {\n similarity?: number | string;\n}\n\nfunction emitDuplicatesJson(result: ReturnType<typeof verifyArtifactDuplicates>): void {\n const payload: VerifyJsonPayload = {\n gate: 'duplicates',\n success: result.success,\n exitCode: result.success ? 0 : 1,\n summary: {\n totalRequirements: result.totalRequirements,\n errorCount: result.errorCount,\n warningCount: result.warningCount,\n },\n violations: result.issues.map((i) => ({\n type: i.type,\n severity: i.severity,\n id: i.id,\n file: i.file,\n conflictingId: i.conflictingId,\n message: i.message,\n })),\n };\n console.log(JSON.stringify(payload, null, 2));\n}\n\nfunction printDuplicatesConsole(result: ReturnType<typeof verifyArtifactDuplicates>): void {\n console.log(` Evaluated requirements: ${pc.bold(String(result.totalRequirements))}`);\n console.log(` Duplication errors: ${result.errorCount > 0 ? pc.red(String(result.errorCount)) : pc.green('0')}`);\n console.log(` Warnings: ${result.warningCount > 0 ? pc.yellow(String(result.warningCount)) : pc.green('0')}`);\n\n if (result.issues.length > 0) {\n console.log(pc.red('\\n Detected issues:'));\n for (const issue of result.issues) {\n const icon = issue.severity === 'ERROR' ? pc.red('✖') : pc.yellow('⚠');\n const badge = issue.severity === 'ERROR' ? pc.red(`[${issue.type}]`) : pc.yellow(`[${issue.type}]`);\n console.log(` ${icon} ${badge} [${issue.id}] in ${issue.file}: ${issue.message}`);\n }\n }\n console.log(\n result.success\n ? pc.green('\\n✔ Duplicates Verification COMPLIANT (0 Collisions)\\n')\n : pc.red('\\n✖ Duplicates Verification BLOCKED (Collisions Detected)\\n')\n );\n}\n\nexport function runVerifyDuplicates(options: DuplicatesVerifyOptions = {}): boolean {\n const rootDir = options.root || process.cwd();\n const similarityThreshold = options.similarity !== undefined ? Number(options.similarity) : undefined;\n const useJson = isJsonOutput(options);\n const isSilent = Boolean(options.silent || useJson);\n\n if (!isSilent) {\n console.log(pc.bold(pc.cyan('\\n🔍 [AI-SDLC] Verifying Duplicate Requirements and Redundancy (Shift-Left Pre-Flight)...')));\n }\n\n const result = verifyArtifactDuplicates({\n rootDir,\n titleSimilarityThreshold: similarityThreshold,\n });\n\n if (useJson) {\n emitDuplicatesJson(result);\n return result.success;\n }\n if (!options.silent) {\n printDuplicatesConsole(result);\n }\n return result.success;\n}\n\nexport interface SecretVerifyCliOptions extends VerifyBaseOptions {\n diff?: boolean;\n base?: string;\n gitleaks?: boolean;\n entropy?: number | string;\n}\n\nfunction emitSecretsJson(result: ReturnType<typeof verifySecrets>): void {\n const payload: VerifyJsonPayload = {\n gate: 'secrets',\n success: result.success,\n exitCode: result.success ? 0 : 4,\n summary: {\n totalFilesScanned: result.totalFilesScanned,\n findingsCount: result.findingsCount,\n scannedWithGitleaks: result.scannedWithGitleaks,\n },\n violations: result.findings.map((f) => ({\n ruleId: f.ruleId,\n file: f.relPath,\n line: f.lineNumber,\n type: f.type,\n maskedMatch: f.maskedMatch,\n message: f.message,\n })),\n };\n console.log(JSON.stringify(payload, null, 2));\n}\n\nfunction printSecretsConsole(result: ReturnType<typeof verifySecrets>): void {\n console.log(` Analyzed files: ${pc.bold(String(result.totalFilesScanned))}`);\n console.log(` Credential leaks: ${result.findingsCount > 0 ? pc.red(String(result.findingsCount)) : pc.green('0')}`);\n console.log(` Native Gitleaks engine: ${result.scannedWithGitleaks ? pc.cyan('Active / Integrated') : pc.dim('Deterministic Scanner (@aisdlc/core)')}`);\n\n if (result.findings.length > 0) {\n console.log(pc.red('\\n Detected exposed credentials:'));\n for (const f of result.findings) {\n console.log(` ${pc.red('✖')} [${f.ruleId}] ${pc.bold(`${f.relPath}:${f.lineNumber}`)}: ${f.maskedMatch} - ${f.message}`);\n }\n }\n console.log(result.success ? pc.green('\\n✔ Secrets Detection COMPLIANT (0 Credential Leaks)\\n') : pc.red('\\n✖ Secrets Detection BLOCKED (Exit Code 4: Exposed Secret)\\n'));\n}\n\nfunction emitSecretsSarif(result: ReturnType<typeof verifySecrets>, output?: string): void {\n const doc = generateSecuritySarifReport({ secretsResult: result });\n if (output) {\n writeSecuritySarifReport(output, doc);\n } else {\n console.log(serializeSarifDocument(doc));\n }\n}\n\nfunction handleSecretsOutput(\n result: ReturnType<typeof verifySecrets>,\n options: SecretVerifyCliOptions,\n useSarif: boolean,\n useJson: boolean\n): boolean {\n if (useSarif || options.output) {\n emitSecretsSarif(result, options.output);\n return result.success;\n }\n if (useJson) {\n emitSecretsJson(result);\n return result.success;\n }\n if (!options.silent) {\n printSecretsConsole(result);\n }\n return result.success;\n}\n\nexport function runVerifySecrets(options: SecretVerifyCliOptions = {}): boolean {\n const rootDir = options.root || process.cwd();\n const entropyThreshold = options.entropy !== undefined ? Number(options.entropy) : undefined;\n const useJson = isJsonOutput(options);\n const useSarif = isSarifOutput(options);\n\n if (!options.silent && !useJson && !useSarif) {\n console.log(pc.bold(pc.cyan(\"\\n🔐 [AI-SDLC] Verifying Deterministic Secrets and Credentials Detection (Gitleaks Gate)...\")));\n }\n\n const result = verifySecrets({\n rootDir,\n diff: options.diff,\n baseBranch: options.base,\n gitleaks: options.gitleaks,\n entropyThreshold,\n });\n\n return handleSecretsOutput(result, options, useSarif, useJson);\n}\n\nexport interface SastVerifyCliOptions extends VerifyBaseOptions {\n semgrep?: boolean;\n minSeverity?: string;\n sarif?: string[];\n orchestrate?: boolean;\n nonInteractive?: boolean;\n noInstallPrompt?: boolean;\n ci?: boolean;\n}\n\nfunction emitSastJson(result: ReturnType<typeof verifySast>): void {\n const payload: VerifyJsonPayload = {\n gate: 'sast',\n success: result.success,\n exitCode: result.success ? 0 : 1,\n summary: {\n totalFilesScanned: result.totalFilesScanned,\n violationsCount: result.violationsCount,\n },\n violations: result.violations.map((v) => ({\n ruleId: v.ruleId,\n file: v.relPath,\n line: v.lineNumber,\n type: v.type,\n severity: v.severity,\n message: v.message,\n })),\n ...(result.warnings?.length ? { warnings: result.warnings } : {}),\n };\n console.log(JSON.stringify(payload, null, 2));\n}\n\nfunction printSastConsole(result: ReturnType<typeof verifySast>): void {\n console.log(` Evaluated files: ${pc.bold(String(result.totalFilesScanned))}`);\n console.log(` SAST vulnerabilities: ${result.violationsCount > 0 ? pc.red(String(result.violationsCount)) : pc.green('0')}`);\n\n if (result.violations.length > 0) {\n console.log(pc.red('\\n Detected vulnerabilities:'));\n for (const v of result.violations) {\n console.log(` ${pc.red('✖')} [${v.severity}] [${v.ruleId}] ${pc.bold(`${v.relPath}:${v.lineNumber}`)}: ${v.message}`);\n }\n }\n console.log(result.success ? pc.green('\\n✔ SAST Analysis COMPLIANT (0 Critical Vulnerabilities)\\n') : pc.red('\\n✖ SAST Analysis BLOCKED (Vulnerabilities Detected)\\n'));\n}\n\nfunction emitSastSarif(result: ReturnType<typeof verifySast>, output?: string): void {\n const doc = generateSecuritySarifReport({ sastResult: result });\n if (output) {\n writeSecuritySarifReport(output, doc);\n } else {\n console.log(serializeSarifDocument(doc));\n }\n}\n\nfunction handleSastOutput(\n result: ReturnType<typeof verifySast>,\n options: SastVerifyCliOptions,\n useSarif: boolean,\n useJson: boolean\n): boolean {\n if (useSarif || options.output) {\n emitSastSarif(result, options.output);\n return result.success;\n }\n if (useJson) {\n emitSastJson(result);\n return result.success;\n }\n if (!options.silent) {\n for (const warning of result.warnings ?? []) {\n process.stderr.write(`[SAST WARNING] ${warning}\\n`);\n }\n printSastConsole(result);\n }\n return result.success;\n}\n\nfunction executeSastWithGuard(\n rootDir: string,\n options: SastVerifyCliOptions,\n useSarif: boolean,\n useJson: boolean\n): boolean {\n try {\n const result = verifySast({\n rootDir,\n semgrep: options.semgrep,\n minSeverity: options.minSeverity as SastSeverity,\n sarifPaths: options.sarif,\n });\n return handleSastOutput(result, options, useSarif, useJson);\n } catch (err) {\n if (err instanceof SarifIngestionError) {\n if (!options.silent) console.error(pc.red(`✖ ${err.message}`));\n return false;\n }\n throw err;\n }\n}\n\nexport function runVerifySast(options: SastVerifyCliOptions = {}): boolean {\n const rootDir = options.root || process.cwd();\n const useJson = isJsonOutput(options);\n const useSarif = isSarifOutput(options);\n\n if (!options.silent && !useJson && !useSarif) {\n console.log(pc.bold(pc.cyan(\"\\n🛡️ [AI-SDLC] Verifying Shift-Left SAST Security (Injections & OWASP Top 10)...\")));\n }\n return executeSastWithGuard(rootDir, options, useSarif, useJson);\n}\n\nfunction buildSastAsyncInput(rootDir: string, options: SastVerifyCliOptions) {\n return {\n rootDir,\n semgrep: options.semgrep,\n minSeverity: options.minSeverity as SastSeverity,\n sarifPaths: options.sarif,\n orchestrate: options.orchestrate,\n nonInteractive: options.nonInteractive,\n noInstallPrompt: options.noInstallPrompt,\n ci: options.ci,\n confirmInstall: createTtyConfirmInstall(),\n };\n}\n\nexport async function runVerifySastAsync(options: SastVerifyCliOptions = {}): Promise<boolean> {\n const rootDir = options.root || process.cwd();\n const useJson = isJsonOutput(options);\n const useSarif = isSarifOutput(options);\n if (!options.silent && !useJson && !useSarif) {\n console.log(pc.bold(pc.cyan(\"\\n🛡️ [AI-SDLC] Verifying Shift-Left SAST Security (Injections & OWASP Top 10)...\")));\n }\n try {\n const result = await verifySastAsync(buildSastAsyncInput(rootDir, options));\n return handleSastOutput(result, options, useSarif, useJson);\n } catch (err) {\n if (err instanceof SarifIngestionError) {\n if (!options.silent) console.error(pc.red(`✖ ${err.message}`));\n return false;\n }\n throw err;\n }\n}\n\nexport interface SecurityVerifyCliOptions extends VerifyBaseOptions {\n diff?: boolean;\n base?: string;\n gitleaks?: boolean;\n semgrep?: boolean;\n entropy?: number | string;\n minSeverity?: string;\n orchestrate?: boolean;\n nonInteractive?: boolean;\n noInstallPrompt?: boolean;\n ci?: boolean;\n}\n\nfunction buildSecurityViolations(\n resultSecrets: ReturnType<typeof verifySecrets>,\n resultSast: ReturnType<typeof verifySast>\n) {\n const secretViolations = resultSecrets.findings.map((f) => ({\n type: 'SECRET',\n ruleId: f.ruleId,\n file: f.relPath,\n line: f.lineNumber,\n message: f.message,\n }));\n const sastViolations = resultSast.violations.map((v) => ({\n type: 'SAST',\n ruleId: v.ruleId,\n file: v.relPath,\n line: v.lineNumber,\n severity: v.severity,\n message: v.message,\n }));\n return [...secretViolations, ...sastViolations];\n}\n\nfunction emitSecurityJson(\n resultSecrets: ReturnType<typeof verifySecrets>,\n resultSast: ReturnType<typeof verifySast>,\n isOk: boolean\n): void {\n const exitCode = isOk ? 0 : (!resultSecrets.success ? 4 : 1);\n const payload: VerifyJsonPayload = {\n gate: 'security',\n success: isOk,\n exitCode,\n summary: {\n secretsScanned: resultSecrets.totalFilesScanned,\n secretFindings: resultSecrets.findingsCount,\n sastScanned: resultSast.totalFilesScanned,\n sastViolations: resultSast.violationsCount,\n },\n violations: buildSecurityViolations(resultSecrets, resultSast),\n };\n console.log(JSON.stringify(payload, null, 2));\n}\n\nfunction writeSuppressionsAuditReport(rootDir: string, suppressions: SecuritySuppression[]): void {\n const targetPath = path.join(rootDir, 'reports', 'SUPPRESSIONS_AUDIT.md');\n writeReportFileIfChanged(targetPath, generateSuppressionsAuditReport(suppressions));\n}\n\nfunction executeSecurityVerifiers(rootDir: string, options: SecurityVerifyCliOptions) {\n const entropyThreshold = options.entropy !== undefined ? Number(options.entropy) : undefined;\n const resultSecrets = verifySecrets({\n rootDir,\n diff: options.diff,\n baseBranch: options.base,\n gitleaks: options.gitleaks,\n entropyThreshold,\n });\n\n const resultSast = verifySast({\n rootDir,\n semgrep: options.semgrep,\n minSeverity: options.minSeverity as SastSeverity,\n });\n\n return { resultSecrets, resultSast };\n}\n\nasync function executeSecurityVerifiersAsync(rootDir: string, options: SecurityVerifyCliOptions) {\n const entropyThreshold = options.entropy !== undefined ? Number(options.entropy) : undefined;\n const resultSecrets = verifySecrets({\n rootDir,\n diff: options.diff,\n baseBranch: options.base,\n gitleaks: options.gitleaks,\n entropyThreshold,\n });\n const resultSast = await verifySastAsync(buildSastAsyncInput(rootDir, options));\n return { resultSecrets, resultSast };\n}\n\nfunction printSecurityConsoleSummary(silent: boolean | undefined, hasExpired: boolean): void {\n if (silent) return;\n console.log(` Audit exceptions report: ${pc.cyan('reports/SUPPRESSIONS_AUDIT.md')}`);\n if (hasExpired) {\n console.log(pc.red(' ✖ One or more security suppressions have expired! Quality Gate blocked.\\n'));\n }\n}\n\nfunction persistSecuritySarif(\n rootDir: string,\n resultSecrets: ReturnType<typeof verifySecrets>,\n resultSast: ReturnType<typeof verifySast>,\n customOutput?: string\n): void {\n const doc = generateSecuritySarifReport({\n secretsResult: resultSecrets,\n sastResult: resultSast,\n });\n const targetPath = customOutput || path.join(rootDir, \"reports\", \"security.sarif\");\n writeSecuritySarifReport(targetPath, doc);\n}\n\nfunction printSecurityConsole(\n resultSecrets: ReturnType<typeof verifySecrets>,\n resultSast: ReturnType<typeof verifySast>,\n silent: boolean | undefined,\n hasExpired: boolean\n): void {\n if (!silent) {\n console.log(pc.bold(pc.cyan(\"\\n🔐 [AI-SDLC] Verifying Deterministic Secrets and Credentials Detection (Gitleaks Gate)...\")));\n printSecretsConsole(resultSecrets);\n console.log(pc.bold(pc.cyan(\"\\n🛡️ [AI-SDLC] Verifying Shift-Left SAST Security (Injections & OWASP Top 10)...\")));\n for (const warning of resultSast.warnings ?? []) {\n process.stderr.write(`[SAST WARNING] ${warning}\\n`);\n }\n printSastConsole(resultSast);\n }\n printSecurityConsoleSummary(silent, hasExpired);\n}\n\nfunction handleSecurityOutput(\n options: SecurityVerifyCliOptions,\n resultSecrets: ReturnType<typeof verifySecrets>,\n resultSast: ReturnType<typeof verifySast>,\n isOk: boolean,\n hasExpired: boolean\n): boolean {\n if (isSarifOutput(options)) {\n if (!options.output) {\n const doc = generateSecuritySarifReport({\n secretsResult: resultSecrets,\n sastResult: resultSast,\n });\n console.log(serializeSarifDocument(doc));\n }\n return isOk;\n }\n if (isJsonOutput(options)) {\n emitSecurityJson(resultSecrets, resultSast, isOk);\n return isOk;\n }\n printSecurityConsole(resultSecrets, resultSast, options.silent, hasExpired);\n return isOk;\n}\n\nexport function runVerifySecurity(options: SecurityVerifyCliOptions = {}): boolean {\n const rootDir = options.root || process.cwd();\n const { resultSecrets, resultSast } = executeSecurityVerifiers(rootDir, options);\n const allSuppressions = [...(resultSecrets.suppressions || []), ...(resultSast.suppressions || [])];\n writeSuppressionsAuditReport(rootDir, allSuppressions);\n persistSecuritySarif(rootDir, resultSecrets, resultSast, options.output);\n const hasExpired = allSuppressions.some((s) => s.status === 'expired');\n const isOk = resultSecrets.success && resultSast.success && !hasExpired;\n return handleSecurityOutput(options, resultSecrets, resultSast, isOk, hasExpired);\n}\n\nexport async function runVerifySecurityAsync(options: SecurityVerifyCliOptions = {}): Promise<boolean> {\n const rootDir = options.root || process.cwd();\n const { resultSecrets, resultSast } = await executeSecurityVerifiersAsync(rootDir, options);\n const allSuppressions = [...(resultSecrets.suppressions || []), ...(resultSast.suppressions || [])];\n writeSuppressionsAuditReport(rootDir, allSuppressions);\n persistSecuritySarif(rootDir, resultSecrets, resultSast, options.output);\n const hasExpired = allSuppressions.some((s) => s.status === 'expired');\n const isOk = resultSecrets.success && resultSast.success && !hasExpired;\n return handleSecurityOutput(options, resultSecrets, resultSast, isOk, hasExpired);\n}\n\nfunction buildGherkinViolations(result: ReturnType<typeof checkGherkinInSync>) {\n const orphans = result.orphanFeatureFiles ?? [];\n const missingSteps = result.missingStepFiles ?? [];\n return [\n ...result.missingFiles.map((f) => ({ type: 'MISSING_FEATURE', file: f, message: `Missing .feature file: ${f}` })),\n ...result.outOfSyncFiles.map((f) => ({ type: 'OUT_OF_SYNC_FEATURE', file: f, message: `Out-of-sync .feature file: ${f}` })),\n ...orphans.map((f) => ({ type: 'ORPHAN_FEATURE', file: f, message: `Manual/orphan .feature file without Markdown source: ${f}` })),\n ...missingSteps.map((f) => ({\n type: 'MISSING_STEP_FILE',\n file: f,\n message: `Missing deterministic step definition file in tests/steps/ for: ${f}. Run 'aisdlc gherkin scaffold ${f} --lang <lang> --fallback'.`,\n })),\n ];\n}\n\nfunction emitGherkinVerifyJson(result: ReturnType<typeof checkGherkinInSync>): void {\n const orphans = result.orphanFeatureFiles ?? [];\n const missingSteps = result.missingStepFiles ?? [];\n const payload: VerifyJsonPayload = {\n gate: 'gherkin',\n success: result.inSync,\n exitCode: result.inSync ? 0 : 1,\n summary: {\n totalFeatures: result.totalFeatures,\n missingCount: result.missingFiles.length,\n outOfSyncCount: result.outOfSyncFiles.length,\n orphanFeatureCount: orphans.length,\n missingStepFileCount: missingSteps.length,\n },\n violations: buildGherkinViolations(result),\n };\n console.log(JSON.stringify(payload, null, 2));\n}\n\nfunction printGherkinIssueList(items: string[], tag: string, suffix = ''): void {\n for (const f of items) {\n const extra = suffix ? suffix.replace('{file}', f) : '';\n console.log(` ${pc.red('✖')} [${tag}] ${f}${extra}`);\n }\n}\n\nfunction printGherkinVerifyConsole(result: ReturnType<typeof checkGherkinInSync>): void {\n const orphans = result.orphanFeatureFiles ?? [];\n const missingSteps = result.missingStepFiles ?? [];\n const totalOut = result.missingFiles.length + result.outOfSyncFiles.length + orphans.length + missingSteps.length;\n console.log(` Evaluated features: ${pc.bold(String(result.totalFeatures))}`);\n console.log(` Violations / missing: ${totalOut > 0 ? pc.red(String(totalOut)) : pc.green('0')}`);\n printGherkinIssueList(result.missingFiles, 'MISSING');\n printGherkinIssueList(result.outOfSyncFiles, 'OUT_OF_SYNC');\n printGherkinIssueList(orphans, 'ORPHAN_FEATURE');\n printGherkinIssueList(missingSteps, 'MISSING_STEP_FILE', ' (run: aisdlc gherkin scaffold {file} --lang <lang> --fallback)');\n console.log(result.inSync ? pc.green('\\n✔ BDD Synchronization COMPLIANT\\n') : pc.red('\\n✖ BDD Synchronization BLOCKED\\n'));\n}\n\nexport function runVerifyGherkin(options: VerifyBaseOptions = {}): boolean {\n const rootDir = options.root || process.cwd();\n const useJson = isJsonOutput(options);\n const isSilent = Boolean(options.silent || useJson);\n\n if (!isSilent) {\n console.log(pc.bold(pc.cyan('\\n🥒 [AI-SDLC] Verifying BDD Synchronization (Gherkin -> .feature)...')));\n }\n\n const result = checkGherkinInSync({ rootDir });\n\n if (useJson) {\n emitGherkinVerifyJson(result);\n return result.inSync;\n }\n if (!options.silent) {\n printGherkinVerifyConsole(result);\n }\n return result.inSync;\n}\n\nexport interface PrivacyVerifyCliOptions extends VerifyBaseOptions {\n policy?: string;\n ropaReport?: boolean | string;\n report?: boolean | string;\n minSeverity?: string;\n}\n\nfunction emitPrivacyJson(result: ReturnType<typeof verifyPrivacy>): void {\n const payload: VerifyJsonPayload = {\n gate: 'privacy',\n success: result.success,\n exitCode: result.success ? 0 : 5,\n summary: {\n totalFilesScanned: result.totalFilesScanned,\n dataAssetsCount: result.dataAssetsCount,\n ropaCount: result.ropaRecordsCount,\n ropaRecordsCount: result.ropaRecordsCount,\n privacyRequirementsCount: result.privacyRequirementsCount,\n violationsCount: result.violationsCount,\n },\n violations: result.violations,\n artifacts: {\n ropaInventoryPath: result.ropaOutputPath,\n reportPath: result.reportOutputPath,\n },\n };\n console.log(JSON.stringify(payload, null, 2));\n}\n\nfunction printPrivacyConsole(result: ReturnType<typeof verifyPrivacy>): void {\n console.log(` Scanned source files: ${pc.bold(String(result.totalFilesScanned))}`);\n console.log(` Data assets (DATA-ASSET):${pc.bold(String(result.dataAssetsCount))}`);\n console.log(` ROPA records (Art. 30): ${pc.bold(String(result.ropaRecordsCount))}`);\n console.log(` Privacy reqs (PRIV-REQ): ${pc.bold(String(result.privacyRequirementsCount))}`);\n console.log(` Privacy violations: ${result.violationsCount > 0 ? pc.red(String(result.violationsCount)) : pc.green('0')}`);\n if (result.ropaOutputPath) console.log(` ROPA Inventory generated:${pc.cyan(result.ropaOutputPath)}`);\n if (result.reportOutputPath) console.log(` Privacy Report generated:${pc.cyan(result.reportOutputPath)}`);\n if (result.violations.length > 0) {\n console.log(pc.red('\\n Detected privacy violations:'));\n for (const v of result.violations) {\n const loc = v.lineNumber ? `${v.relPath}:${v.lineNumber}` : v.relPath;\n console.log(` ${pc.red('✖')} [${v.severity}] [${v.ruleId}] ${pc.bold(loc)}: ${v.message}`);\n }\n }\n console.log(result.success ? pc.green('\\n✔ Data Protection & Privacy COMPLIANT\\n') : pc.red('\\n✖ Data Protection & Privacy BLOCKED (Exit Code 5)\\n'));\n}\n\nfunction buildPrivacyVerifyInput(options: PrivacyVerifyCliOptions, rootDir: string) {\n return {\n rootDir,\n policyPath: options.policy,\n generateRopa: options.ropaReport !== undefined ? Boolean(options.ropaReport) : undefined,\n ropaOutputPath: typeof options.ropaReport === 'string' ? options.ropaReport : undefined,\n reportOutputPath:\n typeof options.report === 'string'\n ? options.report\n : options.report\n ? 'reports/PRIVACY_SCAN_REPORT.md'\n : undefined,\n };\n}\n\nexport function runVerifyPrivacy(options: PrivacyVerifyCliOptions = {}): boolean {\n const rootDir = options.root || process.cwd();\n const useJson = isJsonOutput(options);\n const isSilent = Boolean(options.silent || useJson);\n\n if (!isSilent) {\n console.log(pc.bold(pc.cyan('\\n🔒 [AI-SDLC] Verifying Data Protection & Privacy-by-Design (GDPR / LOPDGDD / PII-SAST)...')));\n }\n\n const result = verifyPrivacy(buildPrivacyVerifyInput(options, rootDir));\n\n if (useJson) {\n emitPrivacyJson(result);\n return result.success;\n }\n if (!options.silent) {\n printPrivacyConsole(result);\n }\n return result.success;\n}\n\nfunction collectSyncNonAsyncGates(options: QualityVerifyOptions, root: string, isSilent: boolean) {\n return {\n quality: { success: runVerifyQuality({ ...options, root, silent: isSilent, json: false }) },\n traceability: { success: runVerifyTraceability({ root, silent: isSilent, json: false }) },\n governance: { success: runVerifyGovernance({ root, silent: isSilent, json: false }) },\n testing: { success: runVerifyTesting({ root, silent: isSilent, json: false }) },\n gherkin: { success: runVerifyGherkin({ root, silent: isSilent, json: false }) },\n pdac: { success: runVerifyPdac({ root, silent: isSilent, json: false }) },\n schemas: { success: runVerifySchemas({ root, silent: isSilent, json: false }) },\n duplicates: { success: runVerifyDuplicates({ root, silent: isSilent, json: false }) },\n friction: { success: runVerifyFriction({ root, silent: isSilent, json: false }) },\n privacy: { success: runVerifyPrivacy({ root, silent: isSilent, json: false }) },\n };\n}\n\nfunction collectAllGates(options: QualityVerifyOptions, root: string, isSilent: boolean) {\n return {\n ...collectSyncNonAsyncGates(options, root, isSilent),\n licenses: { success: runVerifyLicenses({ root, silent: isSilent, json: false }) },\n security: { success: runVerifySecurity({ root, silent: isSilent, json: false }) },\n };\n}\n\nasync function collectAllGatesAsync(options: QualityVerifyOptions, root: string, isSilent: boolean) {\n return {\n ...collectSyncNonAsyncGates(options, root, isSilent),\n licenses: { success: await runVerifyLicensesAsync({ root, silent: isSilent, json: false }) },\n security: { success: await runVerifySecurityAsync({ root, silent: isSilent, json: false }) },\n };\n}\n\nfunction resolveVerifyAllExitCode(allPassed: boolean, gatesSummary: Record<string, { success: boolean }>): number {\n if (allPassed) return 0;\n if (!gatesSummary.security?.success) return 4;\n if (!gatesSummary.privacy?.success) return 5;\n return 1;\n}\n\nfunction emitVerifyAllJson(gatesSummary: Record<string, { success: boolean }>, allPassed: boolean): void {\n const totalGates = Object.keys(gatesSummary).length;\n const passedCount = Object.values(gatesSummary).filter((g) => g.success).length;\n const failedCount = totalGates - passedCount;\n const exitCode = resolveVerifyAllExitCode(allPassed, gatesSummary);\n\n const violations = Object.entries(gatesSummary)\n .filter(([, g]) => !g.success)\n .map(([name]) => ({ gate: name, message: `Gate ${name} failed verification criteria` }));\n\n const payload: VerifyJsonPayload = {\n gate: 'all',\n success: allPassed,\n exitCode,\n summary: { totalGates, passedGates: passedCount, failedGates: failedCount },\n gates: gatesSummary,\n violations,\n };\n console.log(JSON.stringify(payload, null, 2));\n}\n\nconst VERIFY_ALL_GATES_LIST: Array<{ key: string; title: string }> = [\n { key: 'quality', title: ' 1. Quality Gate (Complexity/Maintainability): ' },\n { key: 'traceability', title: ' 2. 360° Traceability (RTM): ' },\n { key: 'governance', title: ' 3. Governance and Autonomy Modes: ' },\n { key: 'testing', title: ' 4. Test Coverage (Reqs & Tasks): ' },\n { key: 'gherkin', title: ' 5. BDD Synchronization (Gherkin -> .feature): ' },\n { key: 'licenses', title: ' 6. Open Source Licenses: ' },\n { key: 'pdac', title: ' 7. PDaC & Cryptographic Drift: ' },\n { key: 'schemas', title: ' 8. Artifact JSON Schemas (+ Handoff YAML): ' },\n { key: 'duplicates', title: ' 9. Duplicate Requirements (Shift-Left Gate): ' },\n { key: 'friction', title: ' 10. Progressive Friction & Anti-Bypass: ' },\n { key: 'security', title: ' 11. Shift-Left Security (Secrets & SAST): ' },\n { key: 'privacy', title: ' 12. Data Protection & Privacy (GDPR/PII-SAST): ' },\n];\n\nfunction printVerifyAllSummaryTable(gatesSummary: Record<string, { success: boolean }>, allPassed: boolean): void {\n console.log(pc.bold(pc.magenta('================================================================')));\n console.log(pc.bold('CI/CD EVALUATION SUMMARY:'));\n for (const item of VERIFY_ALL_GATES_LIST) {\n const passed = Boolean(gatesSummary[item.key]?.success);\n console.log(`${item.title}${passed ? pc.green('PASSED') : pc.red('FAILED')}`);\n }\n console.log(pc.bold(pc.magenta('================================================================')));\n\n if (allPassed) {\n console.log(pc.bold(pc.green('\\n✨ FINAL VERDICT: REPOSITORY COMPLIANT WITH AI-SDLC STANDARD (EXIT 0)\\n')));\n } else {\n console.log(pc.bold(pc.red('\\n⛔ FINAL VERDICT: BLOCKED BY DETECTED VIOLATIONS (EXIT 1)\\n')));\n }\n}\n\nfunction finalizeVerifyAll(\n gatesSummary: Record<string, { success: boolean }>,\n options: QualityVerifyOptions,\n useJson: boolean\n): boolean {\n const allPassed = Object.values(gatesSummary).every((g) => g.success);\n if (useJson) {\n emitVerifyAllJson(gatesSummary, allPassed);\n return allPassed;\n }\n if (!options.silent) {\n printVerifyAllSummaryTable(gatesSummary, allPassed);\n }\n return allPassed;\n}\n\nexport function runVerifyAll(options: QualityVerifyOptions = {}): boolean {\n const useJson = isJsonOutput(options);\n const isSilent = Boolean(options.silent || useJson);\n if (!isSilent) {\n console.log(pc.bold(pc.magenta('================================================================')));\n console.log(pc.bold(pc.magenta(' AI-SDLC: FULL QUALITY GATES AND GOVERNANCE SUITE ')));\n console.log(pc.bold(pc.magenta('================================================================')));\n }\n const root = options.root || process.cwd();\n const gatesSummary = collectAllGates(options, root, isSilent);\n return finalizeVerifyAll(gatesSummary, options, useJson);\n}\n\nexport async function runVerifyAllAsync(options: QualityVerifyOptions = {}): Promise<boolean> {\n const useJson = isJsonOutput(options);\n const isSilent = Boolean(options.silent || useJson);\n if (!isSilent) {\n console.log(pc.bold(pc.magenta('================================================================')));\n console.log(pc.bold(pc.magenta(' AI-SDLC: FULL QUALITY GATES AND GOVERNANCE SUITE ')));\n console.log(pc.bold(pc.magenta('================================================================')));\n }\n const root = options.root || process.cwd();\n const gatesSummary = await collectAllGatesAsync(options, root, isSilent);\n return finalizeVerifyAll(gatesSummary, options, useJson);\n}\n\n\n","/**\n * CLI Handler: aisdlc gherkin\n */\n\nimport * as readline from 'readline';\nimport pc from 'picocolors';\nimport {\n extractGherkinFeatures,\n GherkinScaffoldExecFn,\n GherkinScaffoldResult,\n scaffoldGherkinSteps,\n} from '@aisdlc/core';\nimport { isJsonOutput } from './verify.js';\n\nexport interface GherkinExtractCliOptions {\n root?: string;\n path?: string;\n all?: boolean;\n silent?: boolean;\n json?: boolean;\n format?: string;\n}\n\nexport interface GherkinScaffoldCliOptions {\n root?: string;\n lang: string | string[];\n output?: string;\n install?: boolean;\n fallback?: boolean;\n json?: boolean;\n format?: string;\n silent?: boolean;\n promptFn?: (question: string) => Promise<boolean>;\n execFn?: GherkinScaffoldExecFn;\n}\n\nfunction printGherkinResult(result: ReturnType<typeof extractGherkinFeatures>): void {\n console.log(` Generated .feature files: ${pc.bold(String(result.features.length))}`);\n console.log(` Total scenarios: ${pc.bold(String(result.totalScenarios))}`);\n\n for (const f of result.features) {\n console.log(` ${pc.green('✔')} ${pc.bold(f.featureName)} ➔ ${f.outputFile} (${f.scenarioCount} scenarios)`);\n }\n\n console.log(pc.green('\\n✔ BDD synchronization completed successfully.\\n'));\n}\n\nfunction emitGherkinJson(result: ReturnType<typeof extractGherkinFeatures>): void {\n const payload = {\n command: 'gherkin:extract',\n success: result.success,\n exitCode: result.success ? 0 : 1,\n totalScenarios: result.totalScenarios,\n features: result.features,\n };\n console.log(JSON.stringify(payload, null, 2));\n}\n\nexport function runGherkinExtract(options: GherkinExtractCliOptions = {}): boolean {\n const rootDir = options.root || process.cwd();\n const useJson = isJsonOutput(options);\n const isSilent = Boolean(options.silent || useJson);\n\n if (!isSilent) {\n console.log(pc.bold(pc.cyan('\\n🥒 [AI-SDLC] Extracting Gherkin scenarios to .feature files...')));\n }\n\n const result = extractGherkinFeatures({\n rootDir,\n targetPath: options.path,\n all: options.all,\n });\n\n if (!isSilent) {\n printGherkinResult(result);\n }\n\n if (useJson) {\n emitGherkinJson(result);\n }\n\n return result.success;\n}\n\nfunction defaultConfirmInstall(question: string): Promise<boolean> {\n return new Promise((resolve) => {\n const rl = readline.createInterface({ input: process.stdin, output: process.stdout });\n rl.question(question, (answer) => {\n rl.close();\n const normalized = answer.trim().toLowerCase();\n resolve(normalized === 'y' || normalized === 'yes');\n });\n });\n}\n\nfunction printScaffoldText(result: GherkinScaffoldResult): void {\n if (result.status === 'ERROR') {\n console.error(pc.red(`\\n✖ [Gherkin Scaffold] Error (${result.errorCode}): ${result.featureFile}\\n`));\n return;\n }\n if (result.status === 'GENERATOR_MISSING') {\n console.log(\n pc.yellow(\n `\\n⚠ Native generator (${result.generatorBin}) missing. Run: ${pc.bold(result.installCommand || '')} (License: ${result.license})\\n`\n )\n );\n return;\n }\n const files = result.outputFiles?.length ? result.outputFiles : [result.outputFile];\n for (const out of files.filter(Boolean)) {\n console.log(` ${pc.green('✔')} [${result.status}] ➔ ${pc.bold(String(out))}`);\n }\n}\n\nasync function handleInteractiveMissing(\n initialResult: GherkinScaffoldResult,\n featurePath: string,\n options: GherkinScaffoldCliOptions,\n rootDir: string\n): Promise<GherkinScaffoldResult> {\n const ask = options.promptFn || defaultConfirmInstall;\n const confirmed = await ask(\n `Native BDD generator is not installed (${initialResult.installCommand}, license: ${initialResult.license}). Install now? [y/N]: `\n );\n return scaffoldGherkinSteps({\n rootDir,\n featurePath,\n lang: options.lang,\n outputPath: options.output,\n installMissing: confirmed,\n allowFallback: !confirmed,\n execFn: options.execFn,\n });\n}\n\nfunction emitScaffoldOutput(\n result: GherkinScaffoldResult,\n options: GherkinScaffoldCliOptions,\n useJson: boolean\n): void {\n if (useJson) {\n console.log(JSON.stringify(result, null, 2));\n } else if (!options.silent) {\n printScaffoldText(result);\n }\n}\n\nexport async function runGherkinScaffold(\n featurePath: string,\n options: GherkinScaffoldCliOptions\n): Promise<boolean> {\n const rootDir = options.root || process.cwd();\n const useJson = isJsonOutput(options);\n const isInteractive = Boolean(process.stdin.isTTY && process.stdout.isTTY && !useJson && !options.silent);\n\n let result = scaffoldGherkinSteps({\n rootDir,\n featurePath,\n lang: options.lang,\n outputPath: options.output,\n installMissing: options.install,\n allowFallback: options.fallback,\n execFn: options.execFn,\n });\n\n if (result.status === 'GENERATOR_MISSING' && (isInteractive || options.promptFn)) {\n result = await handleInteractiveMissing(result, featurePath, options, rootDir);\n }\n\n emitScaffoldOutput(result, options, useJson);\n return result.success;\n}\n\n\n","/**\n * CLI Handler: aisdlc git\n */\n\nimport pc from 'picocolors';\nimport {\n classifyBranch,\n generateBranchHierarchyPlan,\n checkoutTaskBranch,\n installGitHooks,\n detectAuthorIdentity,\n} from '@aisdlc/core';\n\nfunction printInvalidBranchError(error?: string): void {\n console.error(pc.red(`\\n✖ [NAMING ERROR] ${error || 'Invalid pattern'}`));\n console.error(pc.yellow('\\nAllowed patterns:'));\n console.error(' Tier 1: main');\n console.error(' Tier 2: release/vX.Y.Z');\n console.error(' Tier 3: feat/<FEAT-ID>-<slug> or bug/<BUG-ID>-<slug>');\n console.error(' Tier 4: task/<PARENT-ID>/<TSK-ID>-<slug>\\n');\n}\n\nexport function runGitValidate(branchName: string): boolean {\n if (!branchName) {\n console.error(pc.red('\\n[ERROR] Branch name to validate must be specified.\\n'));\n return false;\n }\n\n const result = classifyBranch(branchName);\n if (result.valid) {\n console.log(pc.green(`\\n✔ [COMPLIANT] Valid branch in 4-tier model:`));\n console.log(` - Level (Tier): ${pc.bold(`Tier ${result.tier} (${result.tierName})`)}`);\n console.log(` - Base Origin: ${result.parentRequirement}`);\n console.log(` - Target Merge: ${result.targetMerge}\\n`);\n return true;\n }\n printInvalidBranchError(result.error);\n return false;\n}\n\nexport function runGitPlan(options: { version?: string; feature?: string; tasks?: string }): boolean {\n const version = options.version || 'v1.1.0';\n const feature = options.feature || 'CHG-001-telemetry';\n const rawTasks = options.tasks || 'TSK-001-dto,TSK-002-gateway';\n const tasks = rawTasks.split(',').map((t) => t.trim());\n\n const plan = generateBranchHierarchyPlan(version, feature, tasks);\n console.log(pc.cyan('\\n' + plan.planText));\n return true;\n}\n\nfunction printCheckoutFailure(result: ReturnType<typeof checkoutTaskBranch>): void {\n console.error(pc.red(`\\n✖ [ERROR] ${result.error}`));\n if (result.availableTasks && result.availableTasks.length > 0) {\n console.log(pc.yellow('\\nAvailable tasks in active changes:'));\n for (const t of result.availableTasks) {\n console.log(` - [${pc.cyan(t.changeId)}] ${pc.bold(t.id)}${t.title ? `: ${t.title}` : ''}`);\n }\n }\n console.log();\n}\n\nfunction printCheckoutSuccess(result: ReturnType<typeof checkoutTaskBranch>): void {\n console.log(` - Detected change: ${pc.bold(result.changeId || 'N/A')}`);\n console.log(` - Release Branch: ${pc.green(result.releaseBranch || '')} (Tier 2)`);\n console.log(` - Feature Branch: ${pc.green(result.featureBranch || '')} (Tier 3)`);\n console.log(` - Task Branch: ${pc.green(result.taskBranch || '')} (Tier 4)`);\n\n if (result.createdBranches && result.createdBranches.length > 0) {\n console.log(pc.green(`\\n✔ Cascading branches created:`));\n for (const b of result.createdBranches) {\n console.log(` ├── ${pc.bold(b)}`);\n }\n }\n\n const switched = result.switchedBranch || result.taskBranch || '';\n console.log(pc.green(`\\n✔ [CHECKOUT] Successfully switched to working branch:`));\n console.log(` 👉 ${pc.bold(pc.cyan(switched))}\\n`);\n}\n\nexport function runGitCheckout(taskId: string, options: { root?: string; silent?: boolean } = {}): boolean {\n if (!taskId) {\n if (!options.silent) {\n console.error(pc.red('\\n[ERROR] Task identifier to navigate must be specified (e.g. TSK-001).\\n'));\n }\n return false;\n }\n\n const rootDir = options.root || process.cwd();\n if (!options.silent) {\n console.log(pc.cyan(`\\n🚀 [AI-SDLC Git] Navigating and preparing branches for task '${pc.bold(taskId)}'...`));\n }\n\n const result = checkoutTaskBranch(taskId, { rootDir });\n\n if (!result.success) {\n if (!options.silent) printCheckoutFailure(result);\n return false;\n }\n\n if (!options.silent) printCheckoutSuccess(result);\n return true;\n}\n\nexport function runGitHookInstall(options: { root?: string } = {}): boolean {\n const rootDir = options.root || process.cwd();\n console.log(pc.cyan(`\\n🔧 [AI-SDLC Git] Installing deterministic Git hooks (pre-commit & prepare-commit-msg)...`));\n const result = installGitHooks(rootDir);\n if (result.success) {\n console.log(pc.green(`✔ [COMPLIANT] Git Hooks successfully installed:`));\n const hooks = result.installedHooks || [result.hookPath || '.git/hooks/prepare-commit-msg'];\n for (const h of hooks) {\n console.log(` 👉 ${pc.bold(h)}`);\n }\n console.log();\n return true;\n } else {\n console.error(pc.red(`\\n✖ [ERROR] ${result.error}\\n`));\n return false;\n }\n}\n\nexport function runGitDetectAuthor(options: { root?: string; json?: boolean } = {}): boolean {\n const rootDir = options.root || process.cwd();\n const identity = detectAuthorIdentity({ cwd: rootDir });\n if (options.json) {\n console.log(JSON.stringify(identity, null, 2));\n } else {\n console.log(`${identity.authorType}|${identity.model}|${identity.promptTokens}|${identity.completionTokens}|${identity.activeTimeSeconds}`);\n }\n return true;\n}\n\n","import * as readline from 'node:readline/promises';\nimport { initProject } from '@aisdlc/core';\nimport pc from 'picocolors';\nimport { isJsonOutput } from './verify.js';\n\nexport interface InitCliOptions {\n dryRun?: boolean;\n ci?: string;\n agents?: string | boolean;\n architecture?: string;\n stack?: string;\n silent?: boolean;\n json?: boolean;\n format?: string;\n force?: boolean;\n}\n\nconst CI_MENU = [\n pc.bold(pc.cyan('\\n🚀 [AI-SDLC] CI/CD Pipeline Provider:')),\n ' 1) ' + pc.green('GitHub Actions') + ' (.github/workflows/) ' + pc.yellow('[Recommended]'),\n ' 2) GitLab CI (.gitlab-ci.yml)',\n ' 3) Azure DevOps Pipelines (azure-pipelines.yml)',\n ' 4) Bitbucket Pipelines (bitbucket-pipelines.yml)',\n ' 5) ' + pc.gray('None') + ' (Reference templates in templates/ci/ only)',\n].join('\\n');\n\nconst CI_CHOICE_MAP: Record<string, string | undefined> = {\n '1': 'github',\n '2': 'gitlab',\n '3': 'azure',\n '4': 'bitbucket',\n '5': undefined,\n github: 'github',\n gitlab: 'gitlab',\n azure: 'azure',\n bitbucket: 'bitbucket',\n none: undefined,\n};\n\nfunction parseCiChoice(answer: string): string | undefined {\n const trimmed = answer.trim().toLowerCase();\n if (!trimmed) return 'github';\n return trimmed in CI_CHOICE_MAP ? CI_CHOICE_MAP[trimmed] : trimmed;\n}\n\nexport async function promptForCi(): Promise<string | undefined> {\n const rl = readline.createInterface({ input: process.stdin, output: process.stdout });\n console.log(CI_MENU);\n try {\n const answer = await rl.question(pc.bold('\\nWhich CI/CD provider do you wish to configure? [1-5] (default 1): '));\n return parseCiChoice(answer);\n } finally {\n rl.close();\n }\n}\n\nfunction parseArchitectureChoice(answer: string): string {\n const trimmed = answer.trim().toLowerCase();\n if (!trimmed || trimmed === '1' || trimmed === 'minimal') return 'minimal';\n if (trimmed === '2' || trimmed === 'full' || trimmed === 'complete') return 'full';\n if (trimmed === '3' || trimmed === 'none') return 'none';\n return trimmed;\n}\n\nconst ARCH_MENU = [\n pc.bold(pc.cyan('\\n🏛️ [AI-SDLC] Architecture Granularity Level:')),\n ' 1) ' + pc.green('Minimal / Baseline') + ' (ARCH-INTRO-* Vision, CMP-* Decisions) ' + pc.yellow('[Recommended]'),\n ' 2) ' + pc.cyan('Full / arc42 + NAF v4') + ' (12 complete architecture sections)',\n ' 3) ' + pc.gray('None') + ' (No architecture templates)',\n].join('\\n');\n\nexport async function promptForArchitecture(): Promise<string> {\n const rl = readline.createInterface({ input: process.stdin, output: process.stdout });\n console.log(ARCH_MENU);\n try {\n const answer = await rl.question(pc.bold('\\nWhich architecture granularity level do you wish to configure? [1-3] (default 1): '));\n return parseArchitectureChoice(answer);\n } finally {\n rl.close();\n }\n}\n\nconst AGENTS_MENU = [\n pc.bold(pc.cyan('\\n🤖 [AI-SDLC] Project AI Agents Configuration:')),\n ' 1) ' + pc.green('All') + ' (Cursor, Claude Code, Antigravity, Copilot, MCP) ' + pc.yellow('[Recommended]'),\n ' 2) Cursor (.cursor/rules and .cursor/mcp.json)',\n ' 3) Claude Code (CLAUDE.md)',\n ' 4) Google Antigravity / Gemini CLI (.agent/rules and antigravity.mcp.json)',\n ' 5) GitHub Copilot (.github/copilot-instructions.md)',\n ' 6) MCP connectors only (.cursor/mcp.json, antigravity.mcp.json, .vscode/mcp.json)',\n ' 7) None (only core policies and base templates)',\n].join('\\n');\n\nfunction parseAgentsChoice(answer: string): string {\n const map: Record<string, string> = {\n '1': 'all', '2': 'cursor', '3': 'claude', '4': 'antigravity',\n '5': 'copilot', '6': 'mcp', '7': 'none',\n };\n const trimmed = answer.trim();\n return !trimmed ? 'all' : map[trimmed] || trimmed;\n}\n\nexport async function promptForAgents(): Promise<string> {\n const rl = readline.createInterface({ input: process.stdin, output: process.stdout });\n console.log(AGENTS_MENU);\n try {\n const answer = await rl.question(pc.bold('\\nWhich agents do you wish to deploy? [1-7 or comma-separated list] (default 1): '));\n return parseAgentsChoice(answer);\n } finally {\n rl.close();\n }\n}\n\ntype InitProjectResult = ReturnType<typeof initProject>;\n\nfunction emitInitJson(result: InitProjectResult, isSuccess: boolean, dryRun: boolean): void {\n const payload = {\n command: 'init',\n success: isSuccess,\n exitCode: isSuccess ? 0 : 1,\n targetDir: result.targetDir,\n directoriesCreated: result.directoriesCreated,\n filesCreated: result.filesCreated,\n filesUpdated: result.filesUpdated || [],\n ciProvider: result.ciProvider,\n agentsConfigured: result.agentsConfigured,\n architectureGranularity: result.architectureGranularity,\n stacksConfigured: result.stacksConfigured || [],\n gitHookInstalled: result.gitHookInstalled,\n dryRun,\n ...(isSuccess ? {} : { error: result.error || 'Error initializing project.' }),\n };\n console.log(JSON.stringify(payload, null, 2));\n}\n\nfunction formatGranularityLabel(granularity?: string): string {\n if (granularity === 'full' || granularity === 'complete') return 'Full (arc42 + NAF v4, 12 sections)';\n if (granularity === 'minimal') return 'Minimal / Baseline (ARCH-INTRO-*, CMP-* and ADR-*)';\n return 'None';\n}\n\nfunction printGitHookStatus(dryRun: boolean, installed?: boolean): void {\n if (dryRun) {\n console.log(` ${pc.blue('DRY-RUN')} Install Git Hook: .git/hooks/prepare-commit-msg`);\n } else if (installed) {\n console.log(` ${pc.green('✔')} Git Hook installed: ${pc.bold('prepare-commit-msg')}`);\n } else {\n console.log(` ${pc.yellow('ℹ')} Git repository not detected at target.`);\n console.log(` ${pc.gray(\"Run 'git init' and then 'aisdlc git hook install' to activate commit hooks.\")}`);\n }\n}\n\nfunction printCreatedItems(items: string[], type: 'directory' | 'file' | 'updated-file', dryRun: boolean): void {\n const isDir = type === 'directory';\n const isUpdated = type === 'updated-file';\n for (const item of items) {\n const actionLabel = isDir ? 'Create directory:' : isUpdated ? 'Update file:' : 'Create file:';\n const doneLabel = isDir ? 'Directory created:' : isUpdated ? 'File updated:' : 'File generated:';\n const prefix = dryRun ? pc.blue('DRY-RUN') + ` ${actionLabel}` : pc.green('✔') + ` ${doneLabel}`;\n console.log(` ${prefix} ${item}`);\n }\n}\n\nfunction printInitSuccess(result: InitProjectResult, dryRun: boolean): void {\n console.log(pc.bold(pc.cyan(`\\n🚀 [AI-SDLC] Initializing governance structure in: ${result.targetDir}\\n`)));\n printCreatedItems(result.directoriesCreated, 'directory', dryRun);\n printCreatedItems(result.filesCreated, 'file', dryRun);\n if (result.filesUpdated && result.filesUpdated.length > 0) {\n printCreatedItems(result.filesUpdated, 'updated-file', dryRun);\n }\n\n if (result.ciProvider) {\n console.log(pc.cyan(`\\n ✔ CI/CD configuration generated for provider: ${pc.bold(result.ciProvider)}`));\n }\n if (result.agentsConfigured && result.agentsConfigured.length > 0) {\n console.log(pc.cyan(`\\n ✔ Configured AI agents: ${pc.bold(result.agentsConfigured.join(', '))}`));\n }\n if (result.architectureGranularity) {\n console.log(pc.cyan(`\\n ✔ Architecture granularity: ${pc.bold(formatGranularityLabel(result.architectureGranularity))}`));\n }\n\n printGitHookStatus(dryRun, result.gitHookInstalled);\n console.log(pc.green('\\n✔ Repository configured with AI-SDLC policies and templates.\\n'));\n}\n\nfunction handleInitResult(\n result: InitProjectResult,\n ctx: { isSilent: boolean; useJson: boolean; dryRun: boolean }\n): boolean {\n if (!result.success) {\n if (!ctx.isSilent) {\n console.error(pc.red(`\\n✖ [ERROR] ${result.error || 'Error initializing project.'}\\n`));\n }\n if (ctx.useJson) {\n emitInitJson(result, false, ctx.dryRun);\n }\n return false;\n }\n\n if (!ctx.isSilent) {\n printInitSuccess(result, ctx.dryRun);\n }\n\n if (ctx.useJson) {\n emitInitJson(result, true, ctx.dryRun);\n }\n\n return true;\n}\n\nexport function runInit(\n targetDir: string = '.',\n options: InitCliOptions = {}\n): boolean {\n const useJson = isJsonOutput(options);\n const isSilent = Boolean(options.silent || useJson);\n const dryRun = Boolean(options.dryRun);\n\n const result = initProject({\n rootDir: process.cwd(),\n targetDir,\n ci: options.ci,\n agents: options.agents === 'none' ? false : options.agents,\n architecture: options.architecture,\n stack: options.stack,\n dryRun,\n force: Boolean(options.force),\n });\n\n return handleInitResult(result, { isSilent, useJson, dryRun });\n}\n\n","/**\n * CLI Handlers: aisdlc kpi pr & aisdlc kpi release\n */\n\nimport * as fs from 'fs';\nimport pc from 'picocolors';\nimport {\n aggregatePrKpis,\n formatPrKpiMarkdown,\n injectKpisIntoPrBody,\n aggregateReleaseKpis,\n resolveReleaseBaseBranch,\n writeReleaseKpiReport,\n} from '@aisdlc/core';\n\nexport interface KpiPrCliOptions {\n base?: string;\n head?: string;\n updateFile?: string;\n json?: boolean;\n root?: string;\n}\n\nexport interface KpiReleaseCliOptions {\n release: string;\n base?: string;\n output?: string;\n json?: boolean;\n root?: string;\n}\n\nfunction applyKpiPrOutput(options: KpiPrCliOptions, markdown: string): boolean {\n if (options.updateFile) {\n if (!fs.existsSync(options.updateFile)) {\n console.error(pc.red(`\\n✖ [ERROR] Target file '${options.updateFile}' does not exist.\\n`));\n return false;\n }\n const original = fs.readFileSync(options.updateFile, 'utf-8');\n const updated = injectKpisIntoPrBody(original, markdown);\n fs.writeFileSync(options.updateFile, updated, 'utf-8');\n console.log(pc.green(`✔ [UPDATED] KPI summary injected into '${options.updateFile}'.`));\n } else {\n console.log('\\n' + markdown + '\\n');\n }\n return true;\n}\n\nexport function runKpiPr(options: KpiPrCliOptions): boolean {\n const baseRef = options.base || 'main';\n const headRef = options.head || 'HEAD';\n const rootDir = options.root || process.cwd();\n\n try {\n const kpi = aggregatePrKpis(baseRef, headRef, { cwd: rootDir });\n\n if (options.json) {\n console.log(JSON.stringify(kpi, null, 2));\n return true;\n }\n\n const markdown = formatPrKpiMarkdown(kpi);\n return applyKpiPrOutput(options, markdown);\n } catch (err: unknown) {\n const msg = err instanceof Error ? err.message : String(err);\n console.error(pc.red(`\\n✖ [ERROR] Failed to calculate PR KPIs: ${msg}\\n`));\n return false;\n }\n}\n\nfunction printReleaseKpiSummary(report: ReturnType<typeof aggregateReleaseKpis>, markdownPath: string, jsonPath: string): void {\n console.log(pc.green(`✔ [COMPLIANT] Consolidated report successfully generated:`));\n console.log(` - Markdown: ${pc.bold(markdownPath)}`);\n console.log(` - JSON: ${pc.bold(jsonPath)}`);\n console.log(` - KLoC: ${report.totalKloc} (${report.totalCommits} commits)`);\n console.log(` - Bugs: ${report.totalBugs} (Density: ${report.globalDefectDensity} bugs/KLoC)`);\n console.log(` - Rework: ${report.reworkTimePercent}% time | ${report.reworkTokensPercent}% tokens\\n`);\n}\n\nfunction printKpiReleaseError(err: unknown): void {\n const msg = err instanceof Error ? err.message : String(err);\n console.error(pc.red(`\\n✖ [ERROR] Failed to calculate Release KPIs: ${msg}\\n`));\n}\n\nfunction executeKpiReleaseReport(\n release: string,\n baseBranch: string,\n rootDir: string,\n outputDir?: string\n): void {\n const report = aggregateReleaseKpis(release, baseBranch, { cwd: rootDir });\n const { markdownPath, jsonPath } = writeReleaseKpiReport(report, {\n outputDir,\n rootDir,\n });\n if (report.totalCommits === 0) {\n console.warn(pc.yellow(`\\n⚠ [WARNING] No commits found between '${report.baseBranch}' and '${report.releaseBranch}'.`));\n }\n printReleaseKpiSummary(report, markdownPath, jsonPath);\n}\n\nexport function runKpiRelease(options: KpiReleaseCliOptions): boolean {\n if (!options.release) {\n console.error(pc.red('\\n✖ [ERROR] Release branch must be specified (--release <branch>).\\n'));\n return false;\n }\n\n const rootDir = options.root || process.cwd();\n const baseBranch = resolveReleaseBaseBranch(options.release, options.base, { cwd: rootDir });\n\n try {\n console.log(pc.cyan(`\\n📊 [AI-SDLC Release KPI] Consolidating metrics for '${pc.bold(options.release)}' (baseline: '${pc.bold(baseBranch)}')...`));\n if (options.json) {\n const report = aggregateReleaseKpis(options.release, baseBranch, { cwd: rootDir });\n console.log(JSON.stringify(report, null, 2));\n return true;\n }\n executeKpiReleaseReport(options.release, baseBranch, rootDir, options.output);\n return true;\n } catch (err: unknown) {\n printKpiReleaseError(err);\n return false;\n }\n}\n","/**\n * CLI Handler: aisdlc mcp\n * Starts the native Model Context Protocol (MCP) server\n * Cites: FR-028-NATIVE-MCP-SERVER-001, FR-047-MCP-SERVER-HARDENING-DLP-001\n */\n\nimport pc from 'picocolors';\nimport { startMcpServer } from '@aisdlc/mcp';\n\nexport interface McpCliOptions {\n root?: string;\n role?: string;\n silent?: boolean;\n}\n\nexport async function runMcpServer(options: McpCliOptions = {}): Promise<void> {\n const rootDir = options.root || process.cwd();\n if (!options.silent) {\n console.error(pc.bold(pc.cyan('\\n🚀 [AI-SDLC MCP] Starting native Model Context Protocol (MCP) server (stdio)...')));\n console.error(pc.gray(` Base directory: ${rootDir}`));\n if (options.role) {\n console.error(pc.gray(` Role context: ${options.role}\\n`));\n } else {\n console.error('');\n }\n }\n\n await startMcpServer({ rootDir, role: options.role });\n}\n","/**\n * CLI Handler: aisdlc report\n */\n\nimport * as path from 'path';\nimport { spawn } from 'child_process';\nimport pc from 'picocolors';\nimport {\n generateComplianceEvidenceBundleSync,\n generateDashboardReport,\n generateQualityReport,\n} from '@aisdlc/core';\n\nfunction openInBrowser(filePath: string): void {\n const resolved = path.resolve(filePath);\n const platform = process.platform;\n try {\n if (platform === 'win32') {\n spawn('cmd.exe', ['/c', 'start', '', resolved], { detached: true, stdio: 'ignore' });\n } else if (platform === 'darwin') {\n spawn('open', [resolved], { detached: true, stdio: 'ignore' });\n } else {\n spawn('xdg-open', [resolved], { detached: true, stdio: 'ignore' });\n }\n } catch {\n // Graceful fallback if desktop launcher is unavailable\n }\n}\n\n\nfunction printDashboardMetrics(result: ReturnType<typeof generateDashboardReport>, rootDir: string): void {\n console.log(` Compiled nodes: ${pc.bold(String(result.totalNodes))}`);\n console.log(` Connections (edges): ${pc.bold(String(result.totalEdges))}`);\n console.log(` Compliant nodes: ${pc.green(String(result.conformingCount))}`);\n console.log(` Nodes with issues: ${result.issueCount > 0 ? pc.red(String(result.issueCount)) : pc.green('0')}`);\n console.log(` Global traceability: ${pc.green(String(result.metrics.traceabilityRatio) + '%')}`);\n console.log(` Maintainability: ${pc.bold(String(result.metrics.avgMaintainability) + ' / 100')}`);\n console.log(` Gate verdict: ${result.metrics.qualityVerdict === 'PASS' ? pc.green('PASS') : pc.red('FAIL')}`);\n\n const relPath = path.relative(rootDir, result.outputPath);\n console.log(pc.green(`\\n✔ Self-contained HTML dashboard successfully generated at: ${pc.bold(relPath)}\\n`));\n}\n\nfunction printDashboardError(err: unknown): void {\n const msg = err instanceof Error ? err.message : String(err);\n console.error(pc.red(`\\n✖ [ERROR] Failed to generate web dashboard: ${msg}\\n`));\n}\n\nexport function runReportDashboard(options: {\n root?: string;\n output?: string;\n title?: string;\n open?: boolean;\n} = {}): boolean {\n const rootDir = options.root || process.cwd();\n console.log(pc.bold(pc.cyan('\\n🌐 [AI-SDLC] Generating Interactive Web Dashboard and PDaC / RTM Graph...')));\n\n try {\n const result = generateDashboardReport({\n rootDir,\n outputPath: options.output,\n title: options.title,\n });\n\n printDashboardMetrics(result, rootDir);\n\n if (options.open) {\n openInBrowser(result.outputPath);\n }\n\n return true;\n } catch (err: unknown) {\n printDashboardError(err);\n return false;\n }\n}\n\nfunction printQualityReportMetrics(result: ReturnType<typeof generateQualityReport>, rootDir: string): void {\n console.log(` Analyzed files: ${pc.bold(String(result.totalFiles))}`);\n console.log(` Evaluated functions: ${pc.bold(String(result.totalFunctions))}`);\n console.log(` Average maintainability: ${pc.green(String(result.avgMaintainability) + ' / 100')}`);\n console.log(` Average complexity (CC): ${pc.bold(String(result.avgCyclomatic))}`);\n console.log(\n ` Code coverage (L/B/F): ${\n result.coverage\n ? pc.bold(`${result.coverage.linesPct}% / ${result.coverage.branchesPct}% / ${result.coverage.functionsPct}%`)\n : pc.dim('N/A (Run test:coverage)')\n }`\n );\n console.log(` Release Gate verdict: ${result.verdict === 'PASS' ? pc.green('PASS') : pc.red('FAIL')}`);\n\n const reportRelPath = path.relative(rootDir, path.join(rootDir, 'reports', 'QUALITY_REPORT.md'));\n console.log(pc.green(`\\n✔ Report successfully generated at: ${pc.bold(reportRelPath)}\\n`));\n}\n\nexport function runReportQuality(options: {\n root?: string;\n policy?: string;\n maxCyclomatic?: number | string;\n maxCognitive?: number | string;\n minMaintainability?: number | string;\n maxLines?: number | string;\n enforceMode?: 'STRICT' | 'PERMISSIVE' | string;\n} = {}): boolean {\n const rootDir = options.root || process.cwd();\n console.log(pc.bold(pc.cyan('\\n📊 Generating Formal Quality Report...')));\n\n const thresholds = {\n max_cyclomatic: options.maxCyclomatic !== undefined ? Number(options.maxCyclomatic) : undefined,\n max_cognitive: options.maxCognitive !== undefined ? Number(options.maxCognitive) : undefined,\n min_maintainability: options.minMaintainability !== undefined ? Number(options.minMaintainability) : undefined,\n max_function_lines: options.maxLines !== undefined ? Number(options.maxLines) : undefined,\n enforce_mode: options.enforceMode,\n };\n\n const result = generateQualityReport({ rootDir, policyPath: options.policy, thresholds });\n printQualityReportMetrics(result, rootDir);\n\n return result.verdict === 'PASS';\n}\n\nconst ALLOWED_COMPLIANCE_OPTIONS = new Set([\n 'root',\n 'output',\n 'keyless',\n 'strict',\n 'offline',\n 'dryRun',\n]);\n\n// Validate user options against permitted whitelist\nfunction validateComplianceOptions(options: Record<string, unknown>): boolean {\n // Check every key provided by the caller\n for (const key of Object.keys(options)) {\n if (!ALLOWED_COMPLIANCE_OPTIONS.has(key)) {\n // Print error message when unrecognized option is encountered\n console.error(pc.red(`\\n✖ [ERROR] Unknown option provided: --${key}\\n`));\n return false;\n }\n }\n return true;\n}\n\n// Execute report compliance command handler\nexport function runReportCompliance(\n options: {\n root?: string;\n output?: string;\n keyless?: boolean;\n strict?: boolean;\n offline?: boolean;\n dryRun?: boolean;\n [key: string]: unknown;\n } = {}\n): boolean {\n // Validate CLI arguments\n if (!validateComplianceOptions(options)) {\n return false;\n }\n // Resolve base directory\n const rootDir = options.root || process.cwd();\n console.log(pc.bold(pc.cyan('\\n📜 [AI-SDLC] Generating Regulatory Compliance Evidence Bundle...')));\n\n // Trigger bundle generation\n try {\n const res = generateComplianceEvidenceBundleSync({\n rootDir,\n outputPath: options.output,\n keyless: options.keyless,\n strict: options.strict,\n offline: options.offline,\n dryRun: options.dryRun,\n });\n // Print success feedback\n console.log(pc.green(`✔ Compliance evidence bundle generated successfully. Digest: ${res.bundleDigest}\\n`));\n return res.success;\n } catch (err: unknown) {\n // Print error message on failure\n console.error(pc.red(`\\n✖ [ERROR] ${err instanceof Error ? err.message : String(err)}\\n`));\n return false;\n }\n}\n\n\n\n\n\n","/**\n * CLI Handler: aisdlc review\n * Reviewer Report Submission (sanctioned write channel for reviewer and auditor agents)\n */\n\nimport pc from 'picocolors';\nimport { submitReviewReport, ReviewReportResult } from '@aisdlc/core';\n\nexport interface ReviewSubmitCliOptions {\n root?: string;\n change: string;\n reviewer: string;\n verdict: string;\n body: string;\n silent?: boolean;\n json?: boolean;\n}\n\nfunction printJsonResult(options: ReviewSubmitCliOptions, result: ReviewReportResult): void {\n console.log(\n JSON.stringify(\n {\n command: 'review:submit',\n success: result.success,\n change: options.change,\n reviewer: options.reviewer,\n verdict: result.verdict,\n reportPath: result.reportPath,\n digest: result.digest,\n error: result.error,\n },\n null,\n 2\n )\n );\n}\n\nfunction printTextResult(result: ReviewReportResult): void {\n if (result.success) {\n console.log(` ${pc.green('✔')} Review report persisted: ${pc.bold(result.reportPath || '')}`);\n console.log(` Verdict: ${pc.cyan(result.verdict || '')} | Digest: ${pc.dim(result.digest || '')}`);\n } else {\n console.error(` ${pc.red('✖')} Review submission rejected: ${result.error || 'Unknown error'}`);\n }\n}\n\nexport function runReviewSubmit(options: ReviewSubmitCliOptions): boolean {\n const result = submitReviewReport({\n rootDir: options.root,\n changeId: options.change,\n reviewer: options.reviewer,\n verdict: options.verdict,\n body: options.body,\n });\n\n if (options.json) {\n printJsonResult(options, result);\n return result.success;\n }\n\n if (!options.silent) {\n printTextResult(result);\n }\n\n return result.success;\n}\n","/**\n * CLI Handler: aisdlc inspect\n * Deep inspection and navigation across requirements, architecture, code, and tests.\n */\n\nimport { inspectElement, formatInspectResultMarkdown } from '@aisdlc/core';\n\nexport interface InspectCliOptions {\n root?: string;\n json?: boolean;\n format?: string;\n}\n\nfunction isJsonOutput(options: InspectCliOptions = {}): boolean {\n if (options.json !== undefined) return Boolean(options.json);\n if (options.format !== undefined) return options.format.trim().toLowerCase() === 'json';\n const env =\n process.env.AISDLC_FORMAT?.trim().toLowerCase() ||\n process.env.AISDLC_OUTPUT?.trim().toLowerCase();\n return env === 'json';\n}\n\nexport function runInspect(query: string, options: InspectCliOptions = {}): boolean {\n const root = options.root || process.cwd();\n const result = inspectElement(query, { rootDir: root });\n\n if (isJsonOutput(options)) {\n console.log(JSON.stringify(result, null, 2));\n return result.found;\n }\n\n const markdown = formatInspectResultMarkdown(result);\n console.log(markdown);\n return result.found;\n}\n","/**\n * AI-SDLC CLI: Doctor Command (FR-052-CLI-DOCTOR-001)\n */\n\nimport { DoctorService, DoctorReporter, DoctorOptions, DoctorReport } from '@aisdlc/core';\n\nexport interface DoctorCommandOptions {\n rootDir?: string;\n json?: boolean;\n fix?: boolean;\n strict?: boolean;\n offline?: boolean;\n timeout?: number;\n}\n\nfunction printReport(report: DoctorReport, reporter: DoctorReporter, asJson: boolean): void {\n if (asJson) {\n console.log(reporter.formatJson(report));\n return;\n }\n const formatted = reporter.formatTerminal(report);\n if (report.exitCode === 2) {\n console.error(formatted);\n } else {\n console.log(formatted);\n }\n}\n\nexport async function runDoctor(opts: DoctorCommandOptions = {}): Promise<number> {\n const doctorOpts: DoctorOptions = {\n rootDir: opts.rootDir || process.cwd(),\n json: opts.json,\n fix: opts.fix,\n strict: opts.strict,\n offline: opts.offline || process.env.AI_SDLC_OFFLINE === '1',\n timeout: opts.timeout,\n };\n\n const service = new DoctorService();\n const reporter = new DoctorReporter();\n const report = await service.diagnose(doctorOpts);\n\n printReport(report, reporter, Boolean(opts.json));\n return report.exitCode;\n}\n","/**\n * CLI Command: aisdlc migrate\n * Synchronizes schemas, templates, and policies with upstream canonical versions.\n * Cites: CMP-053-MIGRATE-ENGINE, FR-053-CLI-MIGRATE-001\n */\n\nimport * as path from 'path';\nimport pc from 'picocolors';\nimport {\n MigrationService,\n MigrationReporter,\n type MigrationOptions,\n type MigrationResult,\n} from '@aisdlc/core';\n\nexport interface CliMigrateOptions {\n root?: string;\n dryRun?: boolean;\n backup?: boolean;\n force?: boolean;\n allowPolicyDowngrade?: boolean;\n json?: boolean;\n verbose?: boolean;\n branch?: string;\n}\n\nfunction printConsoleSummary(result: MigrationResult, reporter: MigrationReporter): void {\n console.log(reporter.formatTerminal(result));\n if (result.exitCode === 0) {\n console.log(pc.green('\\nMigration completed successfully.'));\n } else if (result.exitCode === 1) {\n console.log(pc.yellow('\\nMigration finished with local overrides preserved. Use --force to overwrite.'));\n } else {\n console.error(pc.red('\\nMigration encountered errors or conflicts.'));\n }\n}\n\nexport async function runMigrate(options: CliMigrateOptions): Promise<number> {\n const root = path.resolve(options.root || process.cwd());\n const service = new MigrationService();\n const reporter = new MigrationReporter();\n\n const migrationOptions: MigrationOptions = {\n root,\n dryRun: Boolean(options.dryRun),\n backup: options.backup ?? true,\n force: Boolean(options.force),\n allowPolicyDowngrade: Boolean(options.allowPolicyDowngrade),\n json: Boolean(options.json),\n verbose: Boolean(options.verbose),\n branch: options.branch,\n };\n\n const result = await service.migrate(migrationOptions);\n\n if (options.json) {\n console.log(reporter.formatJson(result));\n } else {\n printConsoleSummary(result, reporter);\n }\n\n return result.exitCode;\n}\n","/**\n * CLI Handler: aisdlc sdd\n * Commands for SDD Ecosystem Integration (OpenSpec & Spec Kit) and PDaC Handoff Sidecars\n */\n\nimport * as path from 'path';\nimport pc from 'picocolors';\nimport {\n ChangeProfile,\n depositProductHandoffSidecar,\n detectActiveChangeForIntegration,\n integrateAllSddChanges,\n integrateSddChange,\n ProductHandoff,\n scaffoldSddChange,\n scanAllProductHandoffs,\n SddFramework,\n verifyArtifactDuplicates,\n DuplicateIssue,\n} from '@aisdlc/core';\nimport { isJsonOutput } from './verify.js';\n\n\n\nexport interface SddDepositCliOptions {\n root?: string;\n change: string;\n framework: SddFramework;\n title?: string;\n requirements?: string;\n useCases?: string;\n silent?: boolean;\n json?: boolean;\n format?: string;\n}\n\nfunction buildHandoffPayload(options: SddDepositCliOptions, changeId: string): { handoff: ProductHandoff; reqList: string[] } {\n const reqList = options.requirements\n ? options.requirements.split(',').map((r) => r.trim())\n : ['FR-001'];\n const ucList = options.useCases\n ? options.useCases.split(',').map((u) => u.trim())\n : ['UC-001'];\n\n const handoff: ProductHandoff = {\n id: `HOF-${changeId.toUpperCase()}`,\n type: 'handoff',\n title: options.title || `PDaC Handoff for ${changeId}`,\n changeId,\n version: '1.0.0',\n createdAt: new Date().toISOString(),\n subgraph: {\n requirements: reqList,\n useCases: ucList,\n },\n };\n return { handoff, reqList };\n}\n\nfunction printDepositSuccess(depositedPath: string, handoffId: string, reqList: string[]): void {\n console.log(` ${pc.green('✔')} Sidecar successfully deposited: ${pc.bold(depositedPath)}`);\n console.log(` Handoff ID: ${pc.cyan(handoffId)}`);\n console.log(` Delivered requirements: ${reqList.join(', ')}\\n`);\n}\n\nfunction emitDepositJson(\n success: boolean,\n changeId: string,\n framework: SddFramework,\n depositedPath?: string,\n handoff?: ProductHandoff,\n err?: unknown\n): void {\n const payload = {\n command: 'sdd:deposit',\n success,\n exitCode: success ? 0 : 1,\n changeId,\n framework,\n ...(depositedPath ? { depositedPath, handoff } : { error: err instanceof Error ? err.message : String(err) }),\n };\n console.log(JSON.stringify(payload, null, 2));\n}\n\nfunction printDepositHeader(changeId: string, framework: string): void {\n console.log(pc.bold(pc.cyan(`\\n📦 [AI-SDLC SDD] Depositing PDaC Handoff Sidecar for '${changeId}' (${framework})...`)));\n}\n\nfunction printDepositError(err: unknown): void {\n const errMessage = err instanceof Error ? err.message : String(err);\n console.error(pc.red(` ✖ Error depositing sidecar: ${errMessage}\\n`));\n}\n\nexport function runSddDeposit(options: SddDepositCliOptions): boolean {\n const rootDir = options.root || process.cwd();\n const changeId = options.change;\n const framework = options.framework || 'openspec';\n const useJson = isJsonOutput(options);\n const isSilent = Boolean(options.silent || useJson);\n\n if (!isSilent) {\n printDepositHeader(changeId, framework);\n }\n\n const { handoff, reqList } = buildHandoffPayload(options, changeId);\n\n try {\n const depositedPath = depositProductHandoffSidecar({ rootDir, changeId, framework, handoff });\n if (!isSilent) printDepositSuccess(depositedPath, handoff.id, reqList);\n if (useJson) emitDepositJson(true, changeId, framework, depositedPath, handoff);\n return true;\n } catch (err: unknown) {\n if (!isSilent) printDepositError(err);\n if (useJson) emitDepositJson(false, changeId, framework, undefined, undefined, err);\n return false;\n }\n}\n\nexport interface SddVerifyCliOptions {\n root?: string;\n framework?: SddFramework;\n checkDuplicates?: boolean;\n silent?: boolean;\n json?: boolean;\n format?: string;\n}\n\ninterface HandoffItem {\n id: string;\n changeDir: string;\n isValid: boolean;\n requirementsCount: number;\n}\n\nfunction printHandoffEntry(isValid: boolean, id: string, relDir: string, reqCount: number): void {\n if (isValid) {\n console.log(` ${pc.green('✔')} [${pc.bold(id)}] in ${relDir} (Requirements: ${reqCount})`);\n } else {\n console.log(` ${pc.red('✖')} [${pc.bold(id)}] in ${relDir} - Invalid handoff schema or subgraph.`);\n }\n}\n\nfunction processHandoffEntry(\n handoff: ProductHandoff,\n changeDir: string,\n rootDir: string,\n isSilent: boolean\n): HandoffItem {\n const relDir = path.relative(rootDir, changeDir).replace(/\\\\/g, '/');\n const reqCount = (handoff.subgraph && Array.isArray(handoff.subgraph.requirements))\n ? handoff.subgraph.requirements.length\n : 0;\n const isValid = Boolean(handoff.id && handoff.id.startsWith('HOF-') && reqCount > 0);\n const id = handoff.id || 'UNKNOWN';\n\n if (!isSilent) {\n printHandoffEntry(isValid, id, relDir, reqCount);\n }\n\n return { id, changeDir: relDir, isValid, requirementsCount: reqCount };\n}\n\nfunction auditHandoffsMap(\n handoffsMap: Map<string, { handoff: ProductHandoff; changeDir: string }>,\n rootDir: string,\n isSilent: boolean\n): { handoffItems: HandoffItem[]; validCount: number; invalidCount: number } {\n if (handoffsMap.size === 0) {\n if (!isSilent) {\n console.log(pc.yellow(' [NOTICE] No handoff.yaml sidecar companion files found in specs/.'));\n }\n return { handoffItems: [], validCount: 0, invalidCount: 0 };\n }\n\n const handoffItems: HandoffItem[] = [];\n let validCount = 0;\n let invalidCount = 0;\n\n for (const [, { handoff, changeDir }] of handoffsMap.entries()) {\n const item = processHandoffEntry(handoff, changeDir, rootDir, isSilent);\n handoffItems.push(item);\n if (item.isValid) {\n validCount++;\n } else {\n invalidCount++;\n }\n }\n return { handoffItems, validCount, invalidCount };\n}\n\nfunction auditDuplicatesShiftLeft(\n rootDir: string,\n checkDuplicates: boolean | undefined,\n isSilent: boolean\n): { duplicateErrors: number; duplicateIssues: DuplicateIssue[] } {\n if (checkDuplicates === false) {\n return { duplicateErrors: 0, duplicateIssues: [] };\n }\n const dupResult = verifyArtifactDuplicates({ rootDir });\n if (dupResult.errorCount > 0 && !isSilent) {\n console.log(pc.red(`\\n ✖ [Shift-Left Gate] Detected ${dupResult.errorCount} requirement collision(s)/duplicate(s) in workspace:`));\n for (const issue of dupResult.issues.filter((i) => i.severity === 'ERROR')) {\n console.log(` ${pc.red('✖')} [${issue.type}] ${issue.id} in ${issue.file}: ${issue.message}`);\n }\n }\n return { duplicateErrors: dupResult.errorCount, duplicateIssues: dupResult.issues };\n}\n\nfunction emitSddVerifyJson(payload: {\n isOk: boolean;\n totalFound: number;\n validCount: number;\n invalidCount: number;\n duplicateErrors: number;\n handoffItems: HandoffItem[];\n duplicateIssues: DuplicateIssue[];\n}): void {\n const jsonOutput = {\n command: 'sdd:verify',\n success: payload.isOk,\n exitCode: payload.isOk ? 0 : 1,\n totalHandoffs: payload.totalFound,\n validHandoffs: payload.validCount,\n invalidHandoffs: payload.invalidCount,\n duplicateErrors: payload.duplicateErrors,\n handoffs: payload.handoffItems,\n duplicateIssues: payload.duplicateIssues,\n };\n console.log(JSON.stringify(jsonOutput, null, 2));\n}\n\nfunction printSddVerifyVerdict(isOk: boolean): void {\n console.log(\n isOk\n ? pc.green('\\n✔ SDD Integration COMPLIANT: All sidecars and requirements are valid.\\n')\n : pc.red('\\n✖ SDD Integration BLOCKED: Non-compliant sidecars or duplicate requirements detected.\\n')\n );\n}\n\nfunction printSddVerifyHeader(totalFound: number): void {\n console.log(pc.bold(pc.cyan('\\n🔍 [AI-SDLC SDD] Verifying SDD Workspaces and Handoff Sidecars (HOF-*)...')));\n console.log(` Found PDaC sidecars: ${pc.bold(String(totalFound))}`);\n}\n\nexport function runSddVerify(options: SddVerifyCliOptions = {}): boolean {\n const rootDir = options.root || process.cwd();\n const useJson = isJsonOutput(options);\n const isSilent = Boolean(options.silent || useJson);\n\n const handoffsMap = scanAllProductHandoffs(rootDir);\n const totalFound = handoffsMap.size;\n if (!isSilent) {\n printSddVerifyHeader(totalFound);\n }\n\n const { handoffItems, validCount, invalidCount } = auditHandoffsMap(handoffsMap, rootDir, isSilent);\n const { duplicateErrors, duplicateIssues } = auditDuplicatesShiftLeft(rootDir, options.checkDuplicates, isSilent);\n\n const isOk = invalidCount === 0 && duplicateErrors === 0;\n if (!isSilent) {\n printSddVerifyVerdict(isOk);\n }\n\n if (useJson) {\n emitSddVerifyJson({ isOk, totalFound, validCount, invalidCount, duplicateErrors, handoffItems, duplicateIssues });\n }\n\n return isOk;\n}\n\nexport interface SddIntegrateCliOptions {\n root?: string;\n change?: string;\n all?: boolean;\n auto?: boolean;\n headRef?: string;\n prTitle?: string;\n prBody?: string;\n author?: string;\n autoArchive?: boolean;\n silent?: boolean;\n json?: boolean;\n format?: string;\n}\n\nfunction handleUndetectedChange(detection: ReturnType<typeof detectActiveChangeForIntegration>, isSilent: boolean, useJson: boolean): null {\n if (!isSilent) {\n console.log(pc.yellow('\\nℹ [AI-SDLC SDD] No active SDD change detected to integrate:'));\n for (const r of detection.reasons) console.log(` - ${r}`);\n console.log('');\n }\n if (useJson) {\n const payload = { command: 'sdd:integrate', success: false, exitCode: 1, reasons: detection.reasons, error: 'No active SDD change detected to integrate' };\n console.log(JSON.stringify(payload, null, 2));\n }\n return null;\n}\n\nfunction handlePendingTasks(detection: ReturnType<typeof detectActiveChangeForIntegration>, isSilent: boolean, useJson: boolean): null {\n if (!isSilent) {\n console.log(pc.red(`\\n✖ [AI-SDLC SDD] Detected change '${detection.changeId}' has pending tasks (${detection.completedTasksCount}/${detection.totalTasksCount} completed). All tasks must be in COMPLETED status.\\n`));\n }\n if (useJson) {\n const payload = {\n command: 'sdd:integrate', success: false, exitCode: 1, changeId: detection.changeId,\n completedTasksCount: detection.completedTasksCount, totalTasksCount: detection.totalTasksCount,\n error: `Detected change '${detection.changeId}' has pending tasks (${detection.completedTasksCount}/${detection.totalTasksCount} completed).`,\n };\n console.log(JSON.stringify(payload, null, 2));\n }\n return null;\n}\n\nfunction resolveAutoChange(\n options: SddIntegrateCliOptions,\n rootDir: string,\n isSilent: boolean,\n useJson: boolean\n): string | null {\n const detection = detectActiveChangeForIntegration({\n rootDir,\n headRef: options.headRef,\n prTitle: options.prTitle,\n prBody: options.prBody,\n });\n if (!detection.detected || !detection.changeId) {\n return handleUndetectedChange(detection, isSilent, useJson);\n }\n if (!detection.allTasksCompleted) {\n return handlePendingTasks(detection, isSilent, useJson);\n }\n if (!isSilent) {\n console.log(pc.cyan(` ✔ Automatically detected SDD change: ${pc.bold(detection.changeId)} (via ${detection.source})`));\n }\n return detection.changeId;\n}\n\nfunction resolveIntegrationChangeId(options: SddIntegrateCliOptions, rootDir: string, isSilent: boolean, useJson: boolean): string | null {\n const changeId = options.change || (options.auto ? resolveAutoChange(options, rootDir, isSilent, useJson) : null);\n if (!changeId) {\n if (!options.auto) {\n if (!isSilent) console.error(pc.red('\\n✖ Change identifier (--change <id>) or --auto option must be specified.\\n'));\n if (useJson) {\n console.log(JSON.stringify({ command: 'sdd:integrate', success: false, exitCode: 1, error: 'Change identifier (--change <id>) or --auto option must be specified.' }, null, 2));\n }\n }\n return null;\n }\n return changeId;\n}\n\nfunction printIntegrationSuccess(changeId: string, result: ReturnType<typeof integrateSddChange>): void {\n console.log(` ${pc.green('✔')} Change '${changeId}' successfully processed:`);\n console.log(` - Completed tasks: ${pc.bold(String(result.completedTasks.length))}`);\n console.log(` - Integrated requirements: ${pc.green(result.integratedRequirements.join(', ') || 'None')}`);\n console.log(` - Created canonical artifacts: ${pc.green(result.createdCanonicalArtifacts?.join(', ') || 'None')}`);\n console.log(` - Updated product artifacts: ${pc.green(result.updatedProductArtifacts.join(', ') || 'None')}`);\n console.log(` - Updated arc42 architecture: ${pc.green(result.updatedArchitectureArtifacts.join(', ') || 'None')}`);\n if (result.archived) {\n console.log(` - Archived to: ${pc.cyan(result.archivedPath || 'specs/changes/completed')}`);\n }\n console.log(pc.green('\\n✔ Canonical specification integration COMPLETED (EXIT 0)\\n'));\n}\n\nfunction printIntegrationFailure(changeId: string, errors: string[]): void {\n console.log(pc.red(`\\n✖ Failed to integrate change '${changeId}':`));\n for (const err of errors) console.log(` ${pc.red('✖')} ${err}`);\n console.log(pc.red('\\n✖ Integration BLOCKED (EXIT 1)\\n'));\n}\n\nfunction emitIntegrateJson(changeId: string, result: ReturnType<typeof integrateSddChange>): void {\n const payload = {\n command: 'sdd:integrate',\n success: result.success,\n exitCode: result.success ? 0 : 1,\n changeId,\n completedTasks: result.completedTasks,\n integratedRequirements: result.integratedRequirements,\n createdCanonicalArtifacts: result.createdCanonicalArtifacts ?? [],\n updatedProductArtifacts: result.updatedProductArtifacts,\n updatedArchitectureArtifacts: result.updatedArchitectureArtifacts,\n archived: result.archived,\n archivedPath: result.archivedPath,\n errors: result.errors,\n };\n console.log(JSON.stringify(payload, null, 2));\n}\n\nfunction printBatchIntegrationResult(result: ReturnType<typeof integrateAllSddChanges>): void {\n console.log(` ${pc.green('✔')} Processed changes: ${pc.bold(String(result.processedChanges.length))} (${result.processedChanges.join(', ') || 'None'})`);\n console.log(` ${pc.yellow('ℹ')} Skipped changes: ${pc.bold(String(result.skippedChanges.length))}`);\n console.log(` ${pc.green('✔')} Updated product artifacts: ${pc.green(result.updatedProductArtifacts.join(', ') || 'None')}`);\n console.log(` ${pc.green('✔')} Updated arc42 architecture: ${pc.green(result.updatedArchitectureArtifacts.join(', ') || 'None')}`);\n console.log(` ${pc.green('✔')} Synced PDaC SHA-256 digests: ${pc.cyan(String(result.syncedDigestsCount))}`);\n if (result.success) {\n console.log(pc.green('\\n✔ Batch canonical specification integration COMPLETED (EXIT 0)\\n'));\n } else {\n for (const err of result.errors) console.log(` ${pc.red('✖')} ${err}`);\n console.log(pc.red('\\n✖ Batch integration finished with errors (EXIT 1)\\n'));\n }\n}\n\nfunction emitBatchIntegrateJson(result: ReturnType<typeof integrateAllSddChanges>): void {\n const payload = {\n command: 'sdd:integrate:all',\n success: result.success,\n exitCode: result.success ? 0 : 1,\n processedChanges: result.processedChanges,\n skippedChanges: result.skippedChanges,\n updatedProductArtifacts: result.updatedProductArtifacts,\n updatedArchitectureArtifacts: result.updatedArchitectureArtifacts,\n createdCanonicalArtifacts: result.createdCanonicalArtifacts,\n syncedDigestsCount: result.syncedDigestsCount,\n errors: result.errors,\n };\n console.log(JSON.stringify(payload, null, 2));\n}\n\nfunction runBatchSddIntegrate(options: SddIntegrateCliOptions, rootDir: string, isSilent: boolean, useJson: boolean): boolean {\n if (!isSilent) {\n console.log(pc.bold(pc.cyan('\\n🔄 [AI-SDLC SDD] Consolidating all completed SDD changes into canonical specifications...')));\n }\n const result = integrateAllSddChanges({ rootDir, author: options.author, autoArchive: options.autoArchive });\n if (!isSilent) printBatchIntegrationResult(result);\n if (useJson) emitBatchIntegrateJson(result);\n return result.success;\n}\n\nexport function runSddIntegrate(options: SddIntegrateCliOptions): boolean {\n const rootDir = options.root || process.cwd();\n const useJson = isJsonOutput(options);\n const isSilent = Boolean(options.silent || useJson);\n if (options.all) {\n return runBatchSddIntegrate(options, rootDir, isSilent, useJson);\n }\n const changeId = resolveIntegrationChangeId(options, rootDir, isSilent, useJson);\n if (!changeId) return false;\n\n if (!isSilent) {\n console.log(pc.bold(pc.cyan(`\\n🔄 [AI-SDLC SDD] Integrating change '${changeId}' into canonical specification...`)));\n }\n\n const result = integrateSddChange({ rootDir, changeId, author: options.author, autoArchive: options.autoArchive });\n if (!isSilent) {\n if (result.success) printIntegrationSuccess(changeId, result);\n else printIntegrationFailure(changeId, result.errors);\n }\n if (useJson) emitIntegrateJson(changeId, result);\n return result.success;\n}\n\nexport interface ChangeNewCliOptions {\n root?: string;\n name: string;\n from?: string | string[];\n id?: string;\n profile?: ChangeProfile;\n framework?: SddFramework;\n author?: string;\n silent?: boolean;\n json?: boolean;\n format?: string;\n}\n\nfunction printChangeNewSuccess(result: ReturnType<typeof scaffoldSddChange>): void {\n console.log(` ${pc.green('✔')} Change directory: ${pc.bold(result.changeDir)}`);\n console.log(` ${pc.green('✔')} SDD Change ID: ${pc.cyan(result.canonicalId)} (${result.changeId})`);\n console.log(` ${pc.green('✔')} Risk profile: ${pc.magenta(result.profile || 'standard')}`);\n if (result.productArtifactCreated) {\n console.log(` ${pc.green('✔')} Product artifact: ${pc.bold(result.productArtifactCreated)} (status: draft)`);\n }\n console.log(` ${pc.green('✔')} Cited artifacts: ${result.citedArtifacts.length}`);\n for (const cite of result.citedArtifacts) {\n console.log(` - [${pc.cyan(cite.id)}] ${cite.digest.substring(0, 19)}... (${cite.title || 'Untitled'})`);\n }\n console.log(` ${pc.green('✔')} Generated files: ${result.createdFiles.length}`);\n console.log(pc.green('\\n✔ SDD change successfully initialized and validated.\\n'));\n}\n\nfunction printChangeNewFailure(name: string, errors: string[]): void {\n console.log(pc.red(`\\n✖ Failed to create SDD change '${name}':`));\n for (const err of errors) console.log(` ${pc.red('✖')} ${err}`);\n console.log(pc.red('\\n✖ Change creation BLOCKED\\n'));\n}\n\nfunction emitChangeNewJson(name: string, result: ReturnType<typeof scaffoldSddChange>): void {\n const payload = {\n command: 'change:new',\n success: result.success,\n exitCode: result.success ? 0 : 1,\n name,\n canonicalId: result.canonicalId,\n changeId: result.changeId,\n changeDir: result.changeDir,\n profile: result.profile,\n createdFiles: result.createdFiles,\n productArtifactCreated: result.productArtifactCreated,\n citedArtifacts: result.citedArtifacts,\n errors: result.errors,\n };\n console.log(JSON.stringify(payload, null, 2));\n}\n\nfunction printChangeNewHeader(name: string, framework: string): void {\n console.log(pc.bold(pc.cyan(`\\n📦 [AI-SDLC SDD] Scaffolding new SDD change '${name}' (${framework})...`)));\n}\n\nfunction handleScaffoldOutput(name: string, result: ReturnType<typeof scaffoldSddChange>, isSilent: boolean, useJson: boolean): void {\n if (!isSilent) {\n if (result.success) printChangeNewSuccess(result);\n else printChangeNewFailure(name, result.errors);\n }\n if (useJson) emitChangeNewJson(name, result);\n}\n\nexport function runChangeNew(options: ChangeNewCliOptions): boolean {\n const rootDir = options.root || process.cwd();\n const name = options.name;\n const framework = options.framework || 'openspec';\n const useJson = isJsonOutput(options);\n const isSilent = Boolean(options.silent || useJson);\n\n if (!isSilent) {\n printChangeNewHeader(name, framework);\n }\n\n const result = scaffoldSddChange({\n rootDir,\n name,\n changeId: options.id,\n profile: options.profile,\n from: options.from,\n framework,\n author: options.author,\n silent: isSilent,\n });\n\n handleScaffoldOutput(name, result, isSilent, useJson);\n return result.success;\n}\n"],"mappings":";;;AAKA,SAAS,eAAe;AACxB,OAAOA,UAAQ;AACf,SAAS,iCAAiC;;;ACF1C,YAAY,QAAQ;AACpB,YAAYC,WAAU;AACtB,OAAOC,SAAQ;AACf;AAAA,EACE,sBAAAC;AAAA,EACA;AAAA,EAKA;AAAA,EACA;AAAA,EACA,4BAAAC;AAAA,EACA,0BAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,6BAAAC;AAAA,EACA,qBAAAC;AAAA,EACA,cAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,yBAAAC;AAAA,EACA,yBAAAC;AAAA,EACA,sBAAAC;AAAA,OACK;;;ACzBP,OAAO,QAAQ;AACf,YAAY,UAAU;AACtB,YAAY,cAAc;AAC1B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AAEP,SAAS,0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AAC;AAGH,QAAQ,GAAG,aAAa,MAAM;AAC5B,UAAQ,MAAME,KAAG,IAAI;AAAA,gCAAmC,QAAQ,KAAK,KAAK,GAAG,CAAC,EAAE,CAAC;AACjF,UAAQ,IAAIA,KAAG,OAAO,kDAAkD,CAAC;AACzE,UAAQ,KAAK,CAAC;AAChB,CAAC;AAED,QAAQ,MAAM,QAAQ,IAAI;","names":["pc","path","pc","checkGherkinInSync","verifyArtifactDuplicates","verifyArtifactsSchemas","verifyLicenses","verifyPdacGraph","verifyPrivacy","verifyProgressiveFriction","verifyQualityGate","verifySast","verifySecrets","verifyTasksGovernance","verifyTestingCoverage","verifyTraceability","checkGherkinInSync","pc","verifyPdacGraph","verifyQualityGate","verifyTraceability","verifyTasksGovernance","verifyTestingCoverage","verifyLicenses","verifyArtifactsSchemas","verifySecrets","verifySast","verifyArtifactDuplicates","verifyProgressiveFriction","verifyPrivacy","pc","readline","pc","extractGherkinFeatures","scaffoldGherkinSteps","pc","extractGherkinFeatures","resolve","scaffoldGherkinSteps","pc","readline","pc","pc","fs","pc","pc","path","pc","pc","isJsonOutput","path","pc","path","pc","verifyArtifactDuplicates","pc","verifyArtifactDuplicates","pc"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/commands/check.ts","../src/commands/verify.ts","../src/commands/gherkin.ts","../src/commands/git.ts","../src/commands/init.ts","../src/commands/kpi.ts","../src/commands/mcp.ts","../src/commands/report.ts","../src/commands/review.ts","../src/commands/inspect.ts","../src/commands/doctor.ts","../src/commands/migrate.ts","../src/commands/sdd.ts"],"sourcesContent":["/**\n * @aisdlc/cli\n * Command Line Interface for AI-SDLC Quality Gates and Governance\n */\n\nimport { Command } from 'commander';\nimport pc from 'picocolors';\nimport { formatAisdlcVersionOutput } from '@aisdlc/core';\nimport { runCheck } from './commands/check.js';\nimport { runGherkinExtract, runGherkinScaffold } from './commands/gherkin.js';\nimport {\n runGitCheckout,\n runGitDetectAuthor,\n runGitHookInstall,\n runGitPlan,\n runGitValidate,\n} from './commands/git.js';\nimport { promptForAgents, promptForArchitecture, promptForCi, runInit } from './commands/init.js';\nimport { runKpiPr, runKpiRelease } from './commands/kpi.js';\nimport { runMcpServer } from './commands/mcp.js';\nimport { runReportCompliance, runReportDashboard, runReportQuality } from './commands/report.js';\nimport { runReviewSubmit } from './commands/review.js';\nimport { runInspect } from './commands/inspect.js';\nimport { runDoctor } from './commands/doctor.js';\nimport { runMigrate } from './commands/migrate.js';\nimport { runChangeNew, runSddDeposit, runSddIntegrate, runSddVerify } from './commands/sdd.js';\nimport {\n runVerifyAllAsync,\n runVerifyDuplicates,\n runVerifyFriction,\n runVerifyGherkin,\n runVerifyGovernance,\n runVerifyLicensesAsync,\n runVerifyPdac,\n runVerifyPrivacy,\n runVerifyQuality,\n runVerifySastAsync,\n runVerifySchemas,\n runVerifySecrets,\n runVerifySecurityAsync,\n runVerifyTesting,\n runVerifyTraceability,\n} from './commands/verify.js';\n\nconst program = new Command();\n\nprogram\n .name('aisdlc')\n .description('AI-SDLC: Spec-Driven Development, Governance & Quality Gates for AI & Humans')\n .version(formatAisdlcVersionOutput());\n\n// --- check command (unified pre-flight with auto-fix) ---\nprogram\n .command('doctor')\n .description('Comprehensive environment, toolchain, git-hooks, and security health diagnostics')\n .option('-r, --root <path>', 'Project root directory')\n .option('--fix', 'Automatically repair broken or missing git hooks with backup')\n .option('--json', 'Emit diagnostics report in structured JSON format')\n .option('--strict', 'Fail with non-zero exit code on warnings as well as critical failures')\n .option('--offline', 'Skip remote external network probes (e.g. for air-gapped environments)')\n .option('--timeout <ms>', 'Maximum timeout in milliseconds for subprocess execution', parseInt)\n .action(async (opts) => {\n const exitCode = await runDoctor({\n rootDir: opts.root,\n fix: opts.fix,\n json: opts.json,\n strict: opts.strict,\n offline: opts.offline,\n timeout: opts.timeout,\n });\n process.exit(exitCode);\n });\n\n// --- check command (unified pre-flight with auto-fix) ---\nprogram\n .command('check')\n .description('Unified pre-flight command: validates Quality Gates with optional non-destructive auto-fix')\n .option('--fix', 'Automatically synchronize Gherkin scenarios (.feature) and cryptographic digests of PDaC citations')\n .option('-r, --root <path>', 'Project root directory')\n .option('--vuln', 'Scan for known vulnerabilities (CVE/GHSA) in dependencies')\n .option('--json', 'Emit verification results in structured JSON format')\n .option('-F, --format <format>', 'Output format: text or json')\n .action((opts) => {\n const passed = runCheck({\n fix: opts.fix,\n root: opts.root,\n json: opts.json,\n format: opts.format,\n });\n process.exit(passed ? 0 : 1);\n });\n\n// --- verify command suite ---\nconst verifyCommand = program\n .command('verify')\n .description('Run deterministic verifiers for quality, traceability, governance, and licenses');\n\nverifyCommand\n .command('all', { isDefault: true })\n .description('Run the full quality and governance suite (Quality Gate + RTM + Tasks + Tests + Licenses + PDaC + Schemas + Duplicates + Security + Privacy)')\n .option('-r, --root <path>', 'Project root directory')\n .option('-p, --policy <path>', 'Path to quality-policy.yaml')\n .option('-C, --max-cyclomatic <number>', 'Maximum Cyclomatic Complexity threshold')\n .option('-K, --max-cognitive <number>', 'Maximum Cognitive Complexity threshold')\n .option('-M, --min-maintainability <number>', 'Minimum Maintainability threshold (0-100)')\n .option('-L, --max-lines <number>', 'Maximum lines per function threshold')\n .option('-m, --mode <mode>', 'Enforcement mode: STRICT or PERMISSIVE')\n .option('--no-vuln', 'Disable dependency vulnerability scanning')\n .option('--json', 'Emit verification results in structured JSON format')\n .option('-F, --format <format>', 'Output format: text or json')\n .action(async (opts) => {\n const passed = await runVerifyAllAsync({\n root: opts.root,\n policy: opts.policy,\n maxCyclomatic: opts.maxCyclomatic,\n maxCognitive: opts.maxCognitive,\n minMaintainability: opts.minMaintainability,\n maxLines: opts.maxLines,\n enforceMode: opts.mode,\n json: opts.json,\n format: opts.format,\n updateBaseline: opts.updateBaseline,\n baseline: opts.baseline,\n ratchet: opts.ratchet,\n });\n process.exit(passed ? 0 : 1);\n });\n\nverifyCommand\n .command('quality')\n .description('Quality Release Gate (Cyclomatic Complexity <= 10, Maintainability >= 50)')\n .option('-r, --root <path>', 'Project root directory')\n .option('-p, --policy <path>', 'Path to quality-policy.yaml')\n .option('-C, --max-cyclomatic <number>', 'Maximum Cyclomatic Complexity threshold')\n .option('-K, --max-cognitive <number>', 'Maximum Cognitive Complexity threshold')\n .option('-M, --min-maintainability <number>', 'Minimum Maintainability threshold (0-100)')\n .option('-L, --max-lines <number>', 'Maximum lines per function threshold')\n .option('-m, --mode <mode>', 'Enforcement mode: STRICT or PERMISSIVE')\n .option('--json', 'Emit verification results in structured JSON format')\n .option('-F, --format <format>', 'Output format: text or json')\n .option('--update-baseline', 'Update quality baseline snapshot with current violations')\n .option('--baseline <path>', 'Path to quality baseline JSON file')\n .option('--ratchet', 'Enforce ratchet mode against baseline')\n .action((opts) => {\n const passed = runVerifyQuality({\n root: opts.root,\n policy: opts.policy,\n maxCyclomatic: opts.maxCyclomatic,\n maxCognitive: opts.maxCognitive,\n minMaintainability: opts.minMaintainability,\n maxLines: opts.maxLines,\n enforceMode: opts.mode,\n json: opts.json,\n format: opts.format,\n updateBaseline: opts.updateBaseline,\n baseline: opts.baseline,\n ratchet: opts.ratchet,\n });\n process.exit(passed ? 0 : 1);\n });\n\nverifyCommand\n .command('traceability')\n .description('Audit the 360° Requirements Traceability Matrix (Product -> Architecture -> Testing)')\n .option('-r, --root <path>', 'Project root directory')\n .option('--json', 'Emit verification results in structured JSON format')\n .option('-F, --format <format>', 'Output format: text or json')\n .action((opts) => {\n const passed = runVerifyTraceability({ root: opts.root, json: opts.json, format: opts.format });\n process.exit(passed ? 0 : 1);\n });\n\nverifyCommand\n .command('governance')\n .description('Audit task governance and human autonomy modes (AUTONOMOUS, HUMAN_REVIEW_PLAN, etc.)')\n .option('-r, --root <path>', 'Project root directory')\n .option('--json', 'Emit verification results in structured JSON format')\n .option('-F, --format <format>', 'Output format: text or json')\n .action((opts) => {\n const passed = runVerifyGovernance({ root: opts.root, json: opts.json, format: opts.format });\n process.exit(passed ? 0 : 1);\n });\n\nverifyCommand\n .command('testing')\n .description('Audit that 100% of requirements and tasks have verifiable tests')\n .option('-r, --root <path>', 'Project root directory')\n .option('--json', 'Emit verification results in structured JSON format')\n .option('-F, --format <format>', 'Output format: text or json')\n .action((opts) => {\n const passed = runVerifyTesting({ root: opts.root, json: opts.json, format: opts.format });\n process.exit(passed ? 0 : 1);\n });\n\nverifyCommand\n .command('gherkin')\n .description('Verify BDD synchronization between Markdown Gherkin blocks and .feature files')\n .option('-r, --root <path>', 'Project root directory')\n .option('--json', 'Emit verification results in structured JSON format')\n .option('-F, --format <format>', 'Output format: text or json')\n .action((opts) => {\n const passed = runVerifyGherkin({ root: opts.root, json: opts.json, format: opts.format });\n process.exit(passed ? 0 : 1);\n });\n\nverifyCommand\n .command('licenses')\n .description('Verify OSS license compliance against license-policy.yaml (dynamic SCA and SBOM)')\n .option('-r, --root <path>', 'Project root directory')\n .option('-p, --policy <path>', 'Path to license-policy.yaml')\n .option('-m, --manifest <path>', 'Path to license-manifest.yaml')\n .option('--no-dynamic', 'Disable dynamic scanning and require static manifest file')\n .option('--sbom [path]', 'Generate CycloneDX 1.5 JSON standard SBOM file')\n .option('--sbom-input <path>', 'Ingest an existing CycloneDX 1.x or SPDX 2.x SBOM JSON file to fill license gaps')\n .option('--notices [path]', 'Generate THIRD_PARTY_NOTICES.md legal notices and attributions file')\n .option('--tool <tool>', 'SCA tool: native, trivy, syft', 'native')\n .option('--depth <depth>', 'Analysis depth: direct or transitive', 'transitive')\n .option('--vuln', 'Scan for known vulnerabilities (CVE/GHSA) in dependencies')\n .option('--no-vuln', 'Disable dependency vulnerability scanning')\n .option('--non-interactive', 'Run in non-interactive mode without tool install prompts')\n .option('--no-install-prompt', 'Disable interactive tool install prompt')\n .option('--ci', 'Run in non-interactive CI mode')\n .option('--json', 'Emit verification results in structured JSON format')\n .option('-F, --format <format>', 'Output format: text or json')\n .action(async (opts) => {\n const passed = await runVerifyLicensesAsync({\n root: opts.root,\n policy: opts.policy,\n manifest: opts.manifest,\n dynamic: opts.dynamic,\n tool: opts.tool,\n depth: opts.depth,\n sbom: opts.sbom,\n sbomInput: opts.sbomInput,\n notices: opts.notices,\n vuln: opts.vuln,\n nonInteractive: opts.nonInteractive,\n noInstallPrompt: opts.installPrompt === false,\n ci: opts.ci,\n json: opts.json,\n format: opts.format,\n });\n process.exit(passed ? 0 : 1);\n });\n\nverifyCommand\n .command('pdac')\n .description('Verify PDaC graph and evaluate cryptographic drift of SHA-256 citations')\n .option('-r, --root <path>', 'Project root directory')\n .option('--json', 'Emit verification results in structured JSON format')\n .option('-F, --format <format>', 'Output format: text or json')\n .action((opts) => {\n const passed = runVerifyPdac({ root: opts.root, json: opts.json, format: opts.format });\n process.exit(passed ? 0 : 1);\n });\n\nverifyCommand\n .command('schemas')\n .description('Verify Markdown artifacts compliance against canonical JSON schemas (Draft 2020-12)')\n .option('-r, --root <path>', 'Project root directory')\n .option('-p, --path <path>', 'Target file or directory path')\n .option('--json', 'Emit verification results in structured JSON format')\n .option('-F, --format <format>', 'Output format: text or json')\n .action((opts) => {\n const passed = runVerifySchemas({ root: opts.root, path: opts.path, json: opts.json, format: opts.format });\n process.exit(passed ? 0 : 1);\n });\n\nverifyCommand\n .command('duplicates')\n .description('Audit duplicate requirements, ID collisions, lexical redundancy, and BDD overlaps')\n .option('-r, --root <path>', 'Project root directory')\n .option('-s, --similarity <number>', 'Lexical similarity threshold for titles (0.0 to 1.0)', '0.85')\n .option('--json', 'Emit verification results in structured JSON format')\n .option('-F, --format <format>', 'Output format: text or json')\n .action((opts) => {\n const passed = runVerifyDuplicates({ root: opts.root, similarity: opts.similarity, json: opts.json, format: opts.format });\n process.exit(passed ? 0 : 1);\n });\n\nverifyCommand\n .command('security')\n .description('Unified security verification: deterministic secrets detection (Gitleaks) and shift-left SAST')\n .option('-r, --root <path>', 'Project root directory')\n .option('-d, --diff', 'Scan only lines added in the current branch git diff')\n .option('-b, --base <branch>', 'Base branch for git diff calculation (default: origin/main or HEAD)')\n .option('-g, --gitleaks', 'Delegate or contrast with native Gitleaks binary if available')\n .option('-s, --semgrep', 'Delegate to Semgrep CLI if installed')\n .option('-e, --entropy <number>', 'Minimum Shannon entropy threshold (0.0 to 8.0)', '4.3')\n .option('-m, --min-severity <level>', 'Minimum severity for SAST failure: CRITICAL, HIGH, MEDIUM', 'HIGH')\n .option('--json', 'Emit verification results in structured JSON format')\n .option('-F, --format <format>', 'Output format: text, json, or sarif')\n .option('-o, --output <path>', 'Output SARIF report file path (default: reports/security.sarif)')\n .action(async (opts) => {\n const passed = await runVerifySecurityAsync({\n root: opts.root,\n diff: opts.diff,\n base: opts.base,\n gitleaks: opts.gitleaks,\n semgrep: opts.semgrep,\n entropy: opts.entropy,\n minSeverity: opts.minSeverity,\n json: opts.json,\n format: opts.format,\n output: opts.output,\n });\n process.exit(passed ? 0 : 4);\n });\n\nverifyCommand\n .command('secrets')\n .description('Verify absence of exposed credentials, API keys, and certificates (Gitleaks Gate)')\n .option('-r, --root <path>', 'Project root directory')\n .option('-d, --diff', 'Scan only lines added in the current branch git diff')\n .option('-b, --base <branch>', 'Base branch for git diff calculation (default: origin/main or HEAD)')\n .option('-g, --gitleaks', 'Delegate or contrast with native Gitleaks binary if available')\n .option('-e, --entropy <number>', 'Minimum Shannon entropy threshold (0.0 to 8.0)', '4.3')\n .option('--json', 'Emit verification results in structured JSON format')\n .option('-F, --format <format>', 'Output format: text, json, or sarif')\n .option('-o, --output <path>', 'Output file path (e.g. reports/secrets.sarif)')\n .action((opts) => {\n const passed = runVerifySecrets({\n root: opts.root,\n diff: opts.diff,\n base: opts.base,\n gitleaks: opts.gitleaks,\n entropy: opts.entropy,\n json: opts.json,\n format: opts.format,\n output: opts.output,\n });\n process.exit(passed ? 0 : 4);\n });\n\nverifyCommand\n .command('sast')\n .description('Shift-left static application security testing (SAST) for critical patterns (SQLi, exec, SSRF)')\n .option('-r, --root <path>', 'Project root directory')\n .option('-s, --semgrep', 'Delegate to Semgrep CLI if installed')\n .option('-m, --min-severity <level>', 'Minimum severity for failure: CRITICAL, HIGH, MEDIUM', 'HIGH')\n .option('--sarif <paths...>', 'Ingest external OASIS SARIF v2.1.0 report(s) for deterministic SAST evaluation')\n .option('--orchestrate', 'Auto-detect project ecosystems and orchestrate native SAST CLIs via SARIF')\n .option('--non-interactive', 'Run in non-interactive mode without tool install prompts')\n .option('--no-install-prompt', 'Disable interactive tool install prompt')\n .option('--ci', 'Run in non-interactive CI mode')\n .option('--json', 'Emit verification results in structured JSON format')\n .option('-F, --format <format>', 'Output format: text, json, or sarif')\n .option('-o, --output <path>', 'Output file path (e.g. reports/sast.sarif)')\n .action(async (opts) => {\n const passed = await runVerifySastAsync({\n root: opts.root,\n semgrep: opts.semgrep,\n minSeverity: opts.minSeverity,\n sarif: opts.sarif,\n orchestrate: opts.orchestrate,\n nonInteractive: opts.nonInteractive,\n noInstallPrompt: opts.installPrompt === false,\n ci: opts.ci,\n json: opts.json,\n format: opts.format,\n output: opts.output,\n });\n process.exit(passed ? 0 : 1);\n });\n\nverifyCommand\n .command('privacy')\n .description('Verify Data Protection & Privacy-by-Design against privacy-policy.yaml (GDPR ROPA, PII-SAST, retention/erasure)')\n .option('-r, --root <path>', 'Project root directory')\n .option('-p, --policy <path>', 'Path to privacy-policy.yaml')\n .option('--ropa-report [path]', 'Generate GDPR Art. 30 ROPA_INVENTORY.md report')\n .option('--report [path]', 'Generate PRIVACY_SCAN_REPORT.md report')\n .option('-m, --min-severity <level>', 'Minimum severity for failure: CRITICAL, HIGH, MEDIUM, LOW', 'HIGH')\n .option('--json', 'Emit verification results in structured JSON format')\n .option('-F, --format <format>', 'Output format: text or json')\n .action((opts) => {\n const passed = runVerifyPrivacy({\n root: opts.root,\n policy: opts.policy,\n ropaReport: opts.ropaReport,\n report: opts.report,\n minSeverity: opts.minSeverity,\n json: opts.json,\n format: opts.format,\n });\n process.exit(passed ? 0 : 5);\n });\n\nverifyCommand\n .command('friction [change]')\n .description('Verify progressive friction and Anti-Bypass guardrails for quick patches')\n .option('-r, --root <path>', 'Project root directory')\n .option('--json', 'Emit verification results in structured JSON format')\n .option('-F, --format <format>', 'Output format: text or json')\n .action((change, opts) => {\n const passed = runVerifyFriction({ root: opts.root, change, json: opts.json, format: opts.format });\n process.exit(passed ? 0 : 1);\n });\n\n// --- report command suite ---\nconst reportCommand = program\n .command('report')\n .description('Generate formal metric reports in Markdown format');\n\nreportCommand\n .command('quality')\n .description('Generate formal polyglot code quality report (reports/QUALITY_REPORT.md)')\n .option('-r, --root <path>', 'Project root directory')\n .option('-p, --policy <path>', 'Path to quality-policy.yaml')\n .option('-C, --max-cyclomatic <number>', 'Maximum Cyclomatic Complexity threshold')\n .option('-K, --max-cognitive <number>', 'Maximum Cognitive Complexity threshold')\n .option('-M, --min-maintainability <number>', 'Minimum Maintainability threshold (0-100)')\n .option('-L, --max-lines <number>', 'Maximum lines per function threshold')\n .option('-m, --mode <mode>', 'Enforcement mode: STRICT or PERMISSIVE')\n .action((opts) => {\n const passed = runReportQuality({\n root: opts.root,\n policy: opts.policy,\n maxCyclomatic: opts.maxCyclomatic,\n maxCognitive: opts.maxCognitive,\n minMaintainability: opts.minMaintainability,\n maxLines: opts.maxLines,\n enforceMode: opts.mode,\n });\n process.exit(passed ? 0 : 1);\n });\n\nreportCommand\n .command('dashboard')\n .description('Generate interactive web dashboard and PDaC / RTM graph visualizer (reports/dashboard.html)')\n .option('-r, --root <path>', 'Project root directory')\n .option('-o, --output <path>', 'Output HTML file path (default: reports/dashboard.html)')\n .option('-t, --title <title>', 'Web dashboard title')\n .option('--open', 'Open dashboard in default browser')\n .action((opts) => {\n const passed = runReportDashboard({\n root: opts.root,\n output: opts.output,\n title: opts.title,\n open: opts.open,\n });\n process.exit(passed ? 0 : 1);\n });\n\nreportCommand\n .command('compliance')\n .description('Generate Regulatory Compliance Evidence Bundle (EU AI Act, ISO 42001, NIST SSDF)')\n .option('-r, --root <path>', 'Project root directory')\n .option('-o, --output <path>', 'Output JSON file path (default: reports/audit-evidence-bundle.json)')\n .option('--offline', 'Offline execution: prohibit external network calls')\n .option('--strict', 'Strict mode: fail closed if any of 12 Quality Gates is missing or stale')\n .option('--keyless', 'Enable keyless OIDC attestation claims')\n .option('--dry-run', 'Dry run without writing to disk')\n .action((opts) => {\n const passed = runReportCompliance({\n root: opts.root,\n output: opts.output,\n offline: opts.offline,\n strict: opts.strict,\n keyless: opts.keyless,\n dryRun: opts.dryRun,\n });\n process.exit(passed ? 0 : 1);\n });\n\n\n// --- gherkin command suite ---\nconst gherkinCommand = program\n .command('gherkin')\n .description('BDD / Gherkin synchronization and extraction tools');\n\ngherkinCommand\n .command('extract')\n .description('Extract ```gherkin``` blocks from Markdown specifications into .feature files')\n .option('-r, --root <path>', 'Project root directory')\n .option('-p, --path <path>', 'Target Markdown file or directory')\n .option('-a, --all', 'Process all specifications and requirements')\n .option('--json', 'Structured JSON format output')\n .option('-F, --format <format>', 'Output format: text or json')\n .action((opts) => {\n const passed = runGherkinExtract({\n root: opts.root,\n path: opts.path,\n all: opts.all,\n json: opts.json,\n format: opts.format,\n });\n process.exit(passed ? 0 : 1);\n });\n\ngherkinCommand\n .command('scaffold <feature-file>')\n .description('Scaffold failing RED BDD step definitions across target languages (ts, py, go, rs, cs)')\n .requiredOption('--lang <langs...>', 'Target language(s): ts, py, go, rs, cs (comma-separated or multiple)')\n .option('-o, --output <path>', 'Explicit output file path for generated step definitions')\n .option('--install', 'Automatically install missing native BDD generator')\n .option('--fallback', 'Use deterministic RED fallback template if native generator is missing')\n .option('-r, --root <path>', 'Project root directory')\n .option('--json', 'Structured JSON format output')\n .option('-F, --format <format>', 'Output format: text or json')\n .action(async (featureFile, opts) => {\n const passed = await runGherkinScaffold(featureFile, {\n root: opts.root,\n lang: opts.lang,\n output: opts.output,\n install: opts.install,\n fallback: opts.fallback,\n json: opts.json,\n format: opts.format,\n });\n process.exit(passed ? 0 : 1);\n });\n\n// --- git command suite ---\nconst gitCommand = program\n .command('git')\n .description('Tools for the 4-tier hierarchical Git branch model');\n\ngitCommand\n .command('validate <branch>')\n .description('Validate naming and hierarchy of a Git branch (Tier 1 to 4)')\n .action((branch) => {\n const passed = runGitValidate(branch);\n process.exit(passed ? 0 : 1);\n });\n\ngitCommand\n .command('plan')\n .description('Plan 4-tier Git branch hierarchy for a version and feature')\n .option('-r, --release <version>', 'Release version (e.g. v1.1.0)', 'v1.1.0')\n .option('-f, --feature <feature>', 'Feature identifier (e.g. CHG-001-telemetry)', 'CHG-001-telemetry')\n .option('-t, --tasks <tasks>', 'Comma-separated tasks list (e.g. TSK-001,TSK-002)', 'TSK-001,TSK-002')\n .action((opts) => {\n runGitPlan({ version: opts.release, feature: opts.feature, tasks: opts.tasks });\n process.exit(0);\n });\n\ngitCommand\n .command('checkout <task>')\n .description('Navigate and automatically create 4-tier cascading branches for a task')\n .option('-r, --root <path>', 'Project root directory')\n .action((task, opts) => {\n const passed = runGitCheckout(task, { root: opts.root });\n process.exit(passed ? 0 : 1);\n });\n\nconst gitHookCommand = gitCommand\n .command('hook')\n .description('AI-SDLC automated Git Hooks management and installation');\n\ngitHookCommand\n .command('install')\n .description('Install prepare-commit-msg hook for automatic commit trailer injection')\n .option('-r, --root <path>', 'Project root directory')\n .action((opts) => {\n const passed = runGitHookInstall({ root: opts.root });\n process.exit(passed ? 0 : 1);\n });\n\ngitCommand\n .command('detect-author')\n .description('Universally detect IDE-independently whether the author is human or an agent')\n .option('--json', 'Structured JSON format output')\n .option('-r, --root <path>', 'Project root directory')\n .action((opts) => {\n const passed = runGitDetectAuthor({ root: opts.root, json: opts.json });\n process.exit(passed ? 0 : 1);\n });\n\n// --- kpi command suite ---\nconst kpiCommand = program\n .command('kpi')\n .description('Metrics, telemetry, and KPI aggregation tools (PR and Release)');\n\nkpiCommand\n .command('pr')\n .description('Calculate and generate aggregated Markdown KPI table for a Pull Request')\n .option('-b, --base <branch>', 'Comparison base branch', 'main')\n .option('-h, --head <branch>', 'Source branch or HEAD', 'HEAD')\n .option('-u, --update-file <path>', 'File where to inject the KPI block (e.g. .github/PULL_REQUEST_TEMPLATE.md)')\n .option('--json', 'Print output in structured JSON format')\n .option('-r, --root <path>', 'Project root directory')\n .action((opts) => {\n const passed = runKpiPr({\n base: opts.base,\n head: opts.head,\n updateFile: opts.updateFile,\n json: opts.json,\n root: opts.root,\n });\n process.exit(passed ? 0 : 1);\n });\n\nkpiCommand\n .command('release')\n .description('Consolidate release KPIs, DIR by model/human, and rework costs')\n .requiredOption('--release <branch>', 'Release branch to audit (e.g. release/v1.1.0)')\n .option('-b, --base <branch>', 'Stable base branch (e.g. main)', 'main')\n .option('-o, --output <dir>', 'Output directory for reports (default: reports/releases/)')\n .option('--json', 'Print output in structured JSON format')\n .option('-r, --root <path>', 'Project root directory')\n .action((opts) => {\n const passed = runKpiRelease({\n release: opts.release,\n base: opts.base,\n output: opts.output,\n json: opts.json,\n root: opts.root,\n });\n process.exit(passed ? 0 : 1);\n });\n\n// --- change command suite ---\nconst changeCommand = program\n .command('change')\n .description('SDD change lifecycle and scaffolding management');\n\nchangeCommand\n .command('new <name>')\n .description('Create complete scaffolding for a new SDD change (proposal, spec, design, tasks, handoff.yaml)')\n .option('-r, --root <path>', 'Project root directory')\n .option('--from <ids...>', 'Identifier or list of identifiers to cite (UC-*, FR-*, etc.)')\n .option('--id <changeId>', 'Explicit change identifier (e.g. chg-002-my-change)')\n .option('-p, --profile <profile>', 'Change risk profile: patch, standard, or critical', 'standard')\n .option('-f, --framework <framework>', 'SDD framework: openspec or speckit', 'openspec')\n .option('-a, --author <author>', 'Author name or developer agent')\n .option('--json', 'Structured JSON format output')\n .option('-F, --format <format>', 'Output format: text or json')\n .action((name, opts) => {\n const passed = runChangeNew({\n root: opts.root,\n name,\n from: opts.from,\n id: opts.id,\n profile: opts.profile,\n framework: opts.framework,\n author: opts.author,\n json: opts.json,\n format: opts.format,\n });\n process.exit(passed ? 0 : 1);\n });\n\n// --- sdd command suite ---\nconst sddCommand = program\n .command('sdd')\n .description('Tools for integration with SDD ecosystems (OpenSpec and Spec Kit)');\n\nsddCommand\n .command('new <name>')\n .description('Alias of `aisdlc change new`: create complete scaffolding for a new SDD change')\n .option('-r, --root <path>', 'Project root directory')\n .option('--from <ids...>', 'Identifier or list of identifiers to cite (UC-*, FR-*, etc.)')\n .option('--id <changeId>', 'Explicit change identifier (e.g. chg-002-my-change)')\n .option('-p, --profile <profile>', 'Change risk profile: patch, standard, or critical', 'standard')\n .option('-f, --framework <framework>', 'SDD framework: openspec or speckit', 'openspec')\n .option('-a, --author <author>', 'Author name or developer agent')\n .option('--json', 'Structured JSON format output')\n .option('-F, --format <format>', 'Output format: text or json')\n .action((name, opts) => {\n const passed = runChangeNew({\n root: opts.root,\n name,\n from: opts.from,\n id: opts.id,\n profile: opts.profile,\n framework: opts.framework,\n author: opts.author,\n json: opts.json,\n format: opts.format,\n });\n process.exit(passed ? 0 : 1);\n });\n\nsddCommand\n .command('deposit')\n .description('Deposit a product subgraph as a sidecar companion file (handoff.yaml)')\n .requiredOption('-c, --change <id>', 'Change identifier (e.g. chg-001-telemetry)')\n .option('-f, --framework <framework>', 'SDD framework: openspec or speckit', 'openspec')\n .option('-r, --root <path>', 'Project root directory')\n .option('-t, --title <title>', 'PDaC handoff title')\n .option('--requirements <reqs>', 'Comma-separated list of requirement IDs')\n .option('--use-cases <ucs>', 'Comma-separated list of use case IDs')\n .option('--json', 'Structured JSON format output')\n .option('-F, --format <format>', 'Output format: text or json')\n .action((opts) => {\n const passed = runSddDeposit({\n root: opts.root,\n change: opts.change,\n framework: opts.framework,\n title: opts.title,\n requirements: opts.requirements,\n useCases: opts.useCases,\n json: opts.json,\n format: opts.format,\n });\n process.exit(passed ? 0 : 1);\n });\n\nsddCommand\n .command('verify')\n .description('Validate compliance of handoff.yaml sidecar files (HOF-*) in changes')\n .option('-r, --root <path>', 'Project root directory')\n .option('-f, --framework <framework>', 'SDD framework: openspec or speckit')\n .option('--json', 'Structured JSON format output')\n .option('-F, --format <format>', 'Output format: text or json')\n .action((opts) => {\n const passed = runSddVerify({\n root: opts.root,\n framework: opts.framework,\n json: opts.json,\n format: opts.format,\n });\n process.exit(passed ? 0 : 1);\n });\n\nsddCommand\n .command('integrate')\n .description('Integrate and synchronize implemented SDD changes into canonical specification (product, requirements, and architecture)')\n .option('-c, --change <id>', 'Change identifier (e.g. chg-001-telemetry)')\n .option('--auto', 'Automatically detect active change to integrate based on branch, PR, or diff')\n .option('--head-ref <ref>', 'Source branch for automatic resolution')\n .option('--pr-title <title>', 'Pull Request title for automatic resolution')\n .option('--pr-body <body>', 'Pull Request body for automatic resolution')\n .option('-r, --root <path>', 'Project root directory')\n .option('-a, --author <author>', 'Name of author or agent performing integration')\n .option('--no-archive', 'Do not archive change to specs/changes/completed after integration')\n .option('--json', 'Structured JSON format output')\n .option('-F, --format <format>', 'Output format: text or json')\n .action((opts) => {\n const passed = runSddIntegrate({\n root: opts.root,\n change: opts.change,\n auto: opts.auto,\n headRef: opts.headRef,\n prTitle: opts.prTitle,\n prBody: opts.prBody,\n author: opts.author,\n autoArchive: opts.archive !== false,\n json: opts.json,\n format: opts.format,\n });\n process.exit(passed ? 0 : 1);\n });\n\n// --- inspect command ---\nprogram\n .command('inspect <element>')\n .description('Inspect an element (FR, UC, CMP, task, or source file) to display technical summary and relationships')\n .option('-r, --root <path>', 'Project root directory')\n .option('--json', 'Structured JSON format output')\n .option('-F, --format <format>', 'Output format: text or json')\n .action((element, opts) => {\n const passed = runInspect(element, {\n root: opts.root,\n json: opts.json,\n format: opts.format,\n });\n process.exit(passed ? 0 : 1);\n });\n\n// --- init command ---\nprogram\n .command('init [directory]')\n .description('Initialize a new repository with AI-SDLC guidelines, schemas, and policies')\n .option('-d, --dry-run', 'Simulate file and directory creation without writing to disk')\n .option('-f, --force', 'Force overwrite existing agent, rule, and policy configurations with canonical templates')\n .option('--ci <provider>', 'CI/CD provider for pipeline generation (github, gitlab, azure, bitbucket)')\n .option('--agents [targets]', 'AI agent environments to configure (all, cursor, claude, antigravity, copilot, mcp, or comma-separated combination)')\n .option('--arch, --architecture <granularity>', 'Architecture templates granularity level (minimal, full, complete, none)')\n .option('-s, --stack <stacks>', 'Technology stacks to deploy coding rules for (dotnet, typescript, javascript, angular, java, kotlin, rust, go, c, cpp, all, none)')\n .option('--json', 'Structured JSON format output')\n .option('-F, --format <format>', 'Output format: text or json')\n .action(async (directory, opts) => {\n let agents = opts.agents;\n let arch = opts.architecture || opts.arch;\n let ci = opts.ci;\n const isJson = opts.json || opts.format === 'json' || process.env.AISDLC_FORMAT === 'json' || process.env.AISDLC_OUTPUT === 'json';\n if (ci === undefined && process.stdin.isTTY && !opts.dryRun && !isJson) {\n ci = await promptForCi();\n }\n if (arch === undefined && process.stdin.isTTY && !opts.dryRun && !isJson) {\n arch = await promptForArchitecture();\n }\n if (agents === undefined && process.stdin.isTTY && !opts.dryRun && !isJson) {\n agents = await promptForAgents();\n }\n const passed = runInit(directory, {\n dryRun: opts.dryRun,\n force: opts.force,\n ci,\n agents,\n architecture: arch,\n stack: opts.stack,\n json: opts.json,\n format: opts.format,\n });\n process.exit(passed ? 0 : 1);\n });\n\n// --- sync command (alias for refreshing agent configurations) ---\nprogram\n .command('sync [directory]')\n .description('Synchronize and refresh AI agent configurations, skills, and rules from canonical templates')\n .option('-d, --dry-run', 'Simulate file updates without writing to disk')\n .option('--agents [targets]', 'AI agent environments to configure (all, cursor, claude, antigravity, copilot, mcp, or comma-separated combination)')\n .option('--json', 'Structured JSON format output')\n .option('-F, --format <format>', 'Output format: text or json')\n .action((directory, opts) => {\n const passed = runInit(directory, {\n dryRun: opts.dryRun,\n force: true,\n agents: opts.agents || 'all',\n ci: 'none',\n architecture: 'none',\n stack: 'none',\n json: opts.json,\n format: opts.format,\n });\n process.exit(passed ? 0 : 1);\n });\n\n// --- mcp command ---\nprogram\n .command('mcp')\n .description('Start native AI-SDLC Model Context Protocol (MCP) server (stdio)')\n .option('-r, --root <path>', 'Project root directory')\n .option('--role <role>', 'Role context for MCP server authorization')\n .action(async (opts) => {\n await runMcpServer({ root: opts.root, role: opts.role });\n });\n\n// --- review commands (reviewer write channel) ---\nconst reviewCmd = program\n .command('review')\n .description('Review commands: sanitized write channel for reviewer roles (agent-code-reviewer, etc.)');\n\nreviewCmd\n .command('submit')\n .description('Persist a formal review report for an active change')\n .requiredOption('-c, --change <id>', 'Active change identifier (e.g. chg-054-foo)')\n .requiredOption('--reviewer <role>', 'Reviewer role (e.g. agent-code-reviewer, agent-security-auditor)')\n .requiredOption('--verdict <verdict>', 'Review verdict (COMPLIANT, SUGGESTIONS, BLOCKING)')\n .requiredOption('--body <body>', 'Review findings and content in markdown')\n .option('-r, --root <path>', 'Project root directory')\n .option('--silent', 'Suppress console output')\n .option('--json', 'Output report details as JSON')\n .action((opts) => {\n const ok = runReviewSubmit({\n root: opts.root,\n change: opts.change,\n reviewer: opts.reviewer,\n verdict: opts.verdict,\n body: opts.body,\n silent: opts.silent,\n json: opts.json,\n });\n if (!ok) process.exit(1);\n });\n\n// --- migrate command (sync schemas, templates, and policies) ---\nprogram\n .command('migrate')\n .description('Synchronize schemas, templates, and policies with upstream canonical versions')\n .option('-r, --root <path>', 'Repository root directory')\n .option('--dry-run', 'Preview changes without mutating filesystem')\n .option('--no-backup', 'Disable pre-migration backup')\n .option('-f, --force', 'Overwrite local customizations with canonical versions')\n .option('--allow-policy-downgrade', 'Permit relaxing stricter quality or security thresholds')\n .option('--json', 'Output migration report as JSON')\n .option('-v, --verbose', 'Enable verbose logging')\n .action(async (opts) => {\n const exitCode = await runMigrate({\n root: opts.root,\n dryRun: opts.dryRun,\n backup: opts.backup,\n force: opts.force,\n allowPolicyDowngrade: opts.allowPolicyDowngrade,\n json: opts.json,\n verbose: opts.verbose,\n });\n process.exit(exitCode);\n });\n\n// Handle unknown commands gracefully\nprogram.on('command:*', () => {\n console.error(pc.red(`\\n[ERROR] Unrecognized command: ${program.args.join(' ')}`));\n console.log(pc.yellow('Run `aisdlc --help` to see available commands.\\n'));\n process.exit(1);\n});\n\nprogram.parse(process.argv);\n\n\n","/**\n * CLI Handler: aisdlc check\n * Unified Pre-flight check command with optional non-destructive auto-fix.\n */\n\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport pc from 'picocolors';\nimport {\n checkGherkinInSync,\n extractGherkinFeatures,\n GherkinScaffoldLanguage,\n PreflightCheckOptions,\n PreflightCheckResult,\n PreflightGateSummary,\n scaffoldGherkinSteps,\n syncPdacDigests,\n verifyArtifactDuplicates,\n verifyArtifactsSchemas,\n verifyLicenses,\n verifyPdacGraph,\n verifyPrivacy,\n verifyProgressiveFriction,\n verifyQualityGate,\n verifySast,\n verifySecrets,\n verifyTasksGovernance,\n verifyTestingCoverage,\n verifyTraceability,\n} from '@aisdlc/core';\nimport { isJsonOutput } from './verify.js';\n\nexport interface CheckCommandOptions extends PreflightCheckOptions {\n json?: boolean;\n format?: string;\n}\n\n\nfunction detectDefaultScaffoldLanguage(rootDir: string): GherkinScaffoldLanguage {\n if (fs.existsSync(path.join(rootDir, 'pyproject.toml')) || fs.existsSync(path.join(rootDir, 'requirements.txt'))) return 'py';\n if (fs.existsSync(path.join(rootDir, 'go.mod'))) return 'go';\n if (fs.existsSync(path.join(rootDir, 'Cargo.toml'))) return 'rs';\n return 'ts';\n}\n\nfunction autoScaffoldMissingSteps(rootDir: string): number {\n const sync = checkGherkinInSync({ rootDir });\n const missing = sync.missingStepFiles ?? [];\n if (missing.length === 0) return 0;\n const lang = detectDefaultScaffoldLanguage(rootDir);\n let count = 0;\n for (const fp of missing) {\n if (scaffoldGherkinSteps({ rootDir, featurePath: fp, lang, allowFallback: true }).success) {\n count++;\n }\n }\n return count;\n}\n\nexport function runAutoFix(rootDir: string, silent?: boolean): { gherkinCount: number; digestsCount: number } {\n const gherkinRes = extractGherkinFeatures({ rootDir });\n const scaffoldedCount = autoScaffoldMissingSteps(rootDir);\n const pdacRes = syncPdacDigests({ rootDir });\n\n if (!silent) {\n if (gherkinRes.features.length > 0) {\n console.log(` ${pc.cyan('🔧 [AUTO-FIX]')} Synchronized ${pc.bold(String(gherkinRes.features.length))} .feature files (${gherkinRes.totalScenarios} scenarios).`);\n }\n if (scaffoldedCount > 0) {\n console.log(` ${pc.cyan('🔧 [AUTO-FIX]')} Scaffolded ${pc.bold(String(scaffoldedCount))} deterministic step files in tests/steps/.`);\n }\n if (pdacRes.syncedCount > 0) {\n console.log(` ${pc.cyan('🔧 [AUTO-FIX]')} Synchronized ${pc.bold(String(pdacRes.syncedCount))} SHA-256 digests across ${pdacRes.updatedFiles.length} files.`);\n }\n }\n\n return { gherkinCount: gherkinRes.features.length, digestsCount: pdacRes.syncedCount };\n}\n\nfunction buildGherkinFailedGate(totalOut: number, hasMissingSteps: boolean): PreflightGateSummary {\n const remediation = hasMissingSteps\n ? \"Run 'aisdlc gherkin scaffold <feature-file> --lang <lang> --fallback' to generate step definitions in tests/steps/.\"\n : \"Run 'aisdlc check --fix' to extract and regenerate .feature files, and remove orphan manual .feature files.\";\n return {\n name: 'BDD Synchronization (Gherkin -> .feature & steps)',\n status: 'FAILED',\n message: `${totalOut} Gherkin sync/step-scaffold violation(s) detected`,\n remediation,\n };\n}\n\nexport function auditGherkinGate(rootDir: string, wasAutoFixed: boolean): PreflightGateSummary {\n const syncCheck = checkGherkinInSync({ rootDir });\n const orphans = syncCheck.orphanFeatureFiles ?? [];\n const missingSteps = syncCheck.missingStepFiles ?? [];\n\n if (!syncCheck.inSync) {\n const totalOut = syncCheck.missingFiles.length + syncCheck.outOfSyncFiles.length + orphans.length + missingSteps.length;\n return buildGherkinFailedGate(totalOut, missingSteps.length > 0);\n }\n return {\n name: 'BDD Synchronization (Gherkin -> .feature & steps)',\n status: wasAutoFixed ? 'FIXED' : 'PASSED',\n message: wasAutoFixed\n ? `${syncCheck.totalFeatures} specifications automatically synchronized`\n : `${syncCheck.totalFeatures} specifications and step scaffolds up to date on disk`,\n };\n}\n\nexport function auditPdacGate(rootDir: string, wasAutoFixed: boolean): PreflightGateSummary {\n const res = verifyPdacGraph({ rootDir });\n if (res.success) {\n return {\n name: 'PDaC Integrity & SHA-256 Drift',\n status: wasAutoFixed ? 'FIXED' : 'PASSED',\n message: `${res.totalNodes} nodes and ${res.totalEdges} citations cryptographically aligned`,\n };\n }\n return {\n name: 'PDaC Integrity & SHA-256 Drift',\n status: 'FAILED',\n message: `${res.drifts.length} digest drift(s) detected (STALE)`,\n remediation: \"Run 'aisdlc check --fix' to automatically synchronize citation digests.\",\n };\n}\n\nexport function auditQualityGate(rootDir: string): PreflightGateSummary {\n const res = verifyQualityGate({ rootDir, requireCoverageReport: false });\n if (res.success) {\n return {\n name: 'Quality Gate (Complexity & Maintainability)',\n status: 'PASSED',\n message: `${res.passCount}/${res.totalFunctions} compliant functions (CC <= 10, LOC <= 40)`,\n };\n }\n const firstFail = res.results.find((r) => r.status === 'FAIL');\n const detail = firstFail ? ` (e.g. ${firstFail.functionName}: ${firstFail.violations.join(', ')})` : '';\n return {\n name: 'Quality Gate (Complexity & Maintainability)',\n status: 'FAILED',\n message: `${res.failCount} function(s) exceed quality thresholds${detail}`,\n remediation: 'Refactor offending functions by reducing conditional branches and lines of code.',\n };\n}\n\nexport function auditTraceabilityGate(rootDir: string): PreflightGateSummary {\n const res = verifyTraceability({ rootDir });\n if (res.success) {\n return {\n name: '360° Traceability (Reverse RTM)',\n status: 'PASSED',\n message: `${res.totalRequirements} requirements with 360° coverage (0 orphans)`,\n };\n }\n const orphanIds = res.orphans.map((o) => o.id).slice(0, 3).join(', ');\n return {\n name: '360° Traceability (Reverse RTM)',\n status: 'FAILED',\n message: `${res.orphanCount} orphan requirement(s) (${orphanIds})`,\n remediation: 'Link orphan requirements to their components in arc42 or test suites.',\n };\n}\n\nexport function auditGovernanceGate(rootDir: string): PreflightGateSummary {\n const res = verifyTasksGovernance({ rootDir });\n if (res.success) {\n return {\n name: 'Tasks Governance & Autonomy Classification',\n status: 'PASSED',\n message: `${res.totalTasks} tasks audited and compliant with autonomy modes`,\n };\n }\n return {\n name: 'Tasks Governance & Autonomy Classification',\n status: 'FAILED',\n message: `${res.violations.length} governance violation(s) detected`,\n remediation: 'Review tasks.md to assign verifiable criteria and valid autonomy modes.',\n };\n}\n\nexport function auditTestingGate(rootDir: string): PreflightGateSummary {\n const res = verifyTestingCoverage({ rootDir });\n if (res.success) {\n return {\n name: 'Test Coverage in Requirements & Tasks',\n status: 'PASSED',\n message: `${res.passedRequirements}/${res.totalRequirements} reqs and ${res.passedTasks}/${res.totalTasks} tasks verified`,\n };\n }\n return {\n name: 'Test Coverage in Requirements & Tasks',\n status: 'FAILED',\n message: `${res.failedRequirements} req(s) and ${res.failedTasks} task(s) without verifiable tests`,\n remediation: 'Add executable tests (.spec or .feature) for pending requirements and tasks.',\n };\n}\n\nexport function auditLicensesGate(rootDir: string): PreflightGateSummary {\n const res = verifyLicenses({ rootDir });\n if (res.success) {\n return {\n name: 'Open Source License Governance',\n status: 'PASSED',\n message: `${res.permittedCount} dependencies compliant with license-policy.yaml`,\n };\n }\n const badPkgs = res.violations.map((v) => `${v.packageName} (${v.license})`).slice(0, 2).join(', ');\n return {\n name: 'Open Source License Governance',\n status: 'FAILED',\n message: `${res.violations.length} prohibited license(s) detected: ${badPkgs}`,\n remediation: 'Replace packages with restricted licenses or request approval in license-policy.yaml.',\n };\n}\n\nexport function auditSchemasGate(rootDir: string): PreflightGateSummary {\n const res = verifyArtifactsSchemas({ rootDir });\n if (res.success) {\n return {\n name: 'JSON Schemas Compliance (Draft 2020-12)',\n status: 'PASSED',\n message: `${res.validCount}/${res.totalEvaluated} artifacts compliant with their schemas`,\n };\n }\n const firstViolation = res.violations[0]?.message || 'Invalid structure';\n return {\n name: 'JSON Schemas Compliance (Draft 2020-12)',\n status: 'FAILED',\n message: `${res.invalidCount} artifact(s) do not comply with JSON schema: ${firstViolation}`,\n remediation: \"Run 'aisdlc verify schemas' to audit and fix required fields.\",\n };\n}\n\nexport function auditSecretsGate(rootDir: string): PreflightGateSummary {\n const res = verifySecrets({ rootDir });\n if (res.success) {\n return {\n name: 'Secrets and Credentials Detection (Gitleaks Gate)',\n status: 'PASSED',\n message: `${res.totalFilesScanned} clean files (0 secrets or exposed credentials)`,\n };\n }\n const firstFinding = res.findings[0];\n const findingMsg = firstFinding ? ` (e.g. ${firstFinding.ruleId} in ${firstFinding.relPath}:${firstFinding.lineNumber})` : '';\n return {\n name: 'Secrets and Credentials Detection (Gitleaks Gate)',\n status: 'FAILED',\n message: `${res.findingsCount} exposed credential(s) or key(s)${findingMsg}`,\n remediation: 'Revoke exposed tokens, store them in environment variables, or use // ai-sdlc:allow-secret.',\n };\n}\n\nfunction formatSecurityErrors(secRes: ReturnType<typeof verifySecrets>, sastRes: ReturnType<typeof verifySast>): string {\n const errors: string[] = [];\n if (!secRes.success) {\n const f = secRes.findings[0];\n errors.push(`${secRes.findingsCount} secret(s) (e.g. ${f.ruleId} in ${f.relPath}:${f.lineNumber})`);\n }\n if (!sastRes.success) {\n const v = sastRes.violations[0];\n errors.push(`${sastRes.violationsCount} SAST violation(s) (e.g. ${v.ruleId} in ${v.relPath}:${v.lineNumber})`);\n }\n return errors.join('; ');\n}\n\nexport function auditSecurityGate(rootDir: string): PreflightGateSummary {\n const secRes = verifySecrets({ rootDir });\n const sastRes = verifySast({ rootDir });\n\n if (secRes.success && sastRes.success) {\n return {\n name: 'Shift-Left Security (Gitleaks Secrets & SAST)',\n status: 'PASSED',\n message: `${secRes.totalFilesScanned} clean files (0 secrets, 0 vulnerabilities)`,\n };\n }\n\n return {\n name: 'Shift-Left Security (Gitleaks Secrets & SAST)',\n status: 'FAILED',\n message: formatSecurityErrors(secRes, sastRes),\n remediation: \"Run 'aisdlc verify security' and resolve credentials or vulnerable patterns.\",\n };\n}\n\nexport function auditDuplicatesGate(rootDir: string): PreflightGateSummary {\n const res = verifyArtifactDuplicates({ rootDir });\n if (res.success) {\n return {\n name: 'Duplicate Requirements & Redundancy',\n status: 'PASSED',\n message: `${res.totalRequirements} requirements evaluated (0 collisions, ${res.warningCount} warnings)`,\n };\n }\n const firstErr = res.issues.find((i) => i.severity === 'ERROR')?.message || 'Collision detected';\n return {\n name: 'Duplicate Requirements & Redundancy',\n status: 'FAILED',\n message: `${res.errorCount} duplication error(s): ${firstErr}`,\n remediation: \"Run 'aisdlc verify duplicates' and resolve duplicate requirement IDs or statements.\",\n };\n}\n\nexport function auditFrictionGate(rootDir: string): PreflightGateSummary {\n const res = verifyProgressiveFriction({ rootDir });\n if (res.success) {\n return {\n name: 'Progressive Friction & Anti-Bypass Guardrails',\n status: 'PASSED',\n message: `Profile '${res.profile}' compliant (${res.evaluatedFiles.length} evaluated paths)`,\n };\n }\n const firstViolation = res.bypassedRules[0] || res.errors[0] || 'Anti-bypass guardrail triggered';\n return {\n name: 'Progressive Friction & Anti-Bypass Guardrails',\n status: 'FAILED',\n message: firstViolation,\n remediation: \"Reclassify change profile to 'standard' or 'critical', or revert protected path changes.\",\n };\n}\n\nexport function auditPrivacyGate(rootDir: string): PreflightGateSummary {\n const res = verifyPrivacy({ rootDir });\n if (res.success) {\n return {\n name: 'Data Protection & Privacy-by-Design (GDPR/PII-SAST)',\n status: 'PASSED',\n message: `${res.totalFilesScanned} clean files (${res.dataAssetsCount} data assets, ${res.ropaRecordsCount} ROPA records, 0 violations)`,\n };\n }\n const first = res.violations[0];\n const detail = first ? ` (e.g. ${first.ruleId} in ${first.relPath})` : '';\n return {\n name: 'Data Protection & Privacy-by-Design (GDPR/PII-SAST)',\n status: 'FAILED',\n message: `${res.violationsCount} privacy violation(s) detected${detail}`,\n remediation: \"Run 'aisdlc verify privacy' and mask PII or register ROPA / retention policies.\",\n };\n}\n\nfunction renderGateBadge(status: string): string {\n if (status === 'PASSED') return pc.green('✔ PASSED ');\n if (status === 'FIXED') return pc.cyan('🔧 AUTO-FIX ');\n return pc.red('✖ FAILED ');\n}\n\nfunction renderRemediations(failedGates: PreflightGateSummary[]): void {\n console.log(pc.bold(pc.red('\\n------------------------------------------------------------------------------')));\n console.log(pc.bold(pc.red(' REQUIRED ACTIONS TO RESOLVE BLOCKING ERRORS:')));\n console.log(pc.bold(pc.red('------------------------------------------------------------------------------')));\n failedGates.forEach((g, idx) => {\n console.log(` ${pc.bold(String(idx + 1))}. ${pc.yellow(g.name)}:`);\n console.log(` 👉 ${pc.bold(g.remediation || 'Review affected files.')}`);\n });\n console.log(pc.bold(pc.red('\\n⛔ VERDICT: PRE-FLIGHT BLOCKED (EXIT 1)\\n')));\n}\n\nfunction printDashboardHeader(autoFixExecuted: boolean, gherkinCount: number, digestsCount: number): void {\n console.log(pc.bold(pc.cyan('\\n==============================================================================')));\n console.log(pc.bold(pc.cyan(' AI-SDLC: CONSOLIDATED PRE-FLIGHT DASHBOARD (aisdlc check) ')));\n console.log(pc.bold(pc.cyan('==============================================================================\\n')));\n\n if (autoFixExecuted) {\n console.log(pc.bold(` ${pc.magenta('AUTO-FIX MODE ACTIVE:')} Non-destructive preliminary syncs applied:`));\n console.log(` - Gherkin scenarios synchronized: ${pc.bold(String(gherkinCount))}`);\n console.log(` - SHA-256 digests synchronized: ${pc.bold(String(digestsCount))}\\n`);\n }\n}\n\nfunction printDashboardFooter(isPassed: boolean): void {\n if (isPassed) {\n console.log(pc.bold(pc.green('\\n==============================================================================')));\n console.log(pc.bold(pc.green('✨ VERDICT: PRE-FLIGHT PASSED (EXIT 0) - Repository ready for Pull Request')));\n console.log(pc.bold(pc.green('==============================================================================\\n')));\n }\n}\n\nexport function renderDashboard(\n gates: PreflightGateSummary[],\n autoFixExecuted: boolean,\n gherkinCount: number,\n digestsCount: number\n): void {\n printDashboardHeader(autoFixExecuted, gherkinCount, digestsCount);\n\n for (const gate of gates) {\n console.log(` [${renderGateBadge(gate.status)}] ${pc.bold(gate.name)}`);\n console.log(` ${pc.dim(gate.message)}`);\n }\n\n const failedGates = gates.filter((g) => g.status === 'FAILED');\n if (failedGates.length > 0) {\n renderRemediations(failedGates);\n } else {\n printDashboardFooter(true);\n }\n}\n\nfunction collectPreflightGates(rootDir: string, fix: boolean, gherkinCount: number, digestsCount: number): PreflightGateSummary[] {\n return [\n auditGherkinGate(rootDir, fix && gherkinCount > 0),\n auditPdacGate(rootDir, fix && digestsCount > 0),\n auditQualityGate(rootDir),\n auditTraceabilityGate(rootDir),\n auditGovernanceGate(rootDir),\n auditTestingGate(rootDir),\n auditLicensesGate(rootDir),\n auditSchemasGate(rootDir),\n auditDuplicatesGate(rootDir),\n auditFrictionGate(rootDir),\n auditSecurityGate(rootDir),\n auditPrivacyGate(rootDir),\n ];\n}\n\nfunction emitCheckJson(result: PreflightCheckResult): void {\n const payload = {\n command: 'check',\n success: result.success,\n exitCode: result.success ? 0 : 1,\n autoFixExecuted: result.autoFixExecuted,\n gherkinSynced: result.gherkinSynced,\n digestsSynced: result.digestsSynced,\n gates: result.gates,\n };\n console.log(JSON.stringify(payload, null, 2));\n}\n\nfunction applyAutoFix(rootDir: string, isSilent: boolean, fix?: boolean): { gherkinCount: number; digestsCount: number } {\n if (!fix) return { gherkinCount: 0, digestsCount: 0 };\n const res = runAutoFix(rootDir, isSilent);\n return { gherkinCount: res.gherkinCount, digestsCount: res.digestsCount };\n}\n\nexport function executePreflightCheck(options: CheckCommandOptions = {}): PreflightCheckResult {\n const rootDir = options.root || process.cwd();\n const useJson = isJsonOutput(options);\n const isSilent = Boolean(options.silent || useJson);\n const { gherkinCount, digestsCount } = applyAutoFix(rootDir, isSilent, options.fix);\n\n const gates = collectPreflightGates(rootDir, Boolean(options.fix), gherkinCount, digestsCount);\n const success = gates.every((g) => g.status === 'PASSED' || g.status === 'FIXED');\n\n if (!isSilent) {\n renderDashboard(gates, Boolean(options.fix), gherkinCount, digestsCount);\n }\n\n const result: PreflightCheckResult = {\n success,\n autoFixExecuted: Boolean(options.fix),\n gherkinSynced: gherkinCount,\n digestsSynced: digestsCount,\n gates,\n };\n\n if (useJson) {\n emitCheckJson(result);\n }\n\n return result;\n}\n\nexport function runCheck(options: CheckCommandOptions = {}): boolean {\n const result = executePreflightCheck(options);\n return result.success;\n}\n\n","/**\n * CLI Handler: aisdlc verify\n */\n\nimport pc from 'picocolors';\nimport * as path from 'path';\nimport * as readline from 'node:readline/promises';\nimport {\n writeReportFileIfChanged,\n checkGherkinInSync,\n verifyArtifactDuplicates,\n verifyArtifactsSchemas,\n verifyLicenses,\n verifyLicensesAsync,\n verifyPdacGraph,\n verifyPrivacy,\n verifyProgressiveFriction,\n verifyQualityGate,\n verifySast,\n verifySastAsync,\n SarifIngestionError,\n verifySecrets,\n verifyTasksGovernance,\n verifyTestingCoverage,\n verifyTraceability,\n generateSuppressionsAuditReport,\n generateSecuritySarifReport,\n serializeSarifDocument,\n writeSecuritySarifReport,\n type SecuritySuppression,\n type SastSeverity,\n type ToolInstallSpec,\n} from '@aisdlc/core';\n\nfunction createTtyConfirmInstall() {\n return async (spec: ToolInstallSpec): Promise<boolean> => {\n const rl = readline.createInterface({ input: process.stdin, output: process.stdout });\n try {\n const answer = await rl.question(\n `Tool \"${spec.tool}\" is not installed. Run \"${spec.displayCommand}\"? [y/N] `\n );\n return /^y(es)?$/i.test(answer.trim());\n } finally {\n rl.close();\n }\n };\n}\n\nexport interface VerifyBaseOptions {\n root?: string;\n silent?: boolean;\n json?: boolean;\n format?: string;\n output?: string;\n}\n\nexport function isJsonOutput(options: VerifyBaseOptions = {}): boolean {\n if (options.json !== undefined) {\n return Boolean(options.json);\n }\n if (options.format !== undefined) {\n return options.format.trim().toLowerCase() === 'json';\n }\n const env = process.env.AISDLC_FORMAT?.trim().toLowerCase() ||\n process.env.AISDLC_OUTPUT?.trim().toLowerCase();\n return env === 'json';\n}\n\nexport function isSarifOutput(options: VerifyBaseOptions = {}): boolean {\n if (options.format !== undefined) {\n return options.format.trim().toLowerCase() === \"sarif\";\n }\n const env = process.env.AISDLC_FORMAT?.trim().toLowerCase() ||\n process.env.AISDLC_OUTPUT?.trim().toLowerCase();\n return env === \"sarif\";\n}\n\nexport interface VerifyJsonPayload<TSummary = Record<string, unknown>, TViolation = unknown> {\n gate: string;\n success: boolean;\n exitCode: number;\n summary: TSummary;\n violations: TViolation[];\n [key: string]: unknown;\n}\n\nexport interface QualityVerifyOptions extends VerifyBaseOptions {\n policy?: string;\n maxCyclomatic?: number | string;\n maxCognitive?: number | string;\n minMaintainability?: number | string;\n maxLines?: number | string;\n enforceMode?: 'STRICT' | 'PERMISSIVE' | string;\n updateBaseline?: boolean;\n baseline?: string | boolean;\n ratchet?: boolean;\n requireCoverageReport?: boolean;\n}\n\nfunction buildFunctionMetricViolations(results: ReturnType<typeof verifyQualityGate>['results']) {\n return results\n .filter((r) => r.status === 'FAIL')\n .flatMap((r) =>\n r.violations.map((v) => ({\n file: r.relPath,\n function: r.functionName,\n metric: 'quality',\n message: v,\n metrics: { loc: r.loc, cyclomatic: r.cyclomatic, cognitive: r.cognitive, maintainability: r.maintainability },\n }))\n );\n}\n\nfunction buildQualityViolations(result: ReturnType<typeof verifyQualityGate>) {\n const fnViolations = buildFunctionMetricViolations(result.results);\n const untested = (result.untestedFunctions || []).map((u) => ({\n file: u.file,\n function: u.functionName,\n metric: 'unit-test',\n message: `Function [${u.functionName}] lacks direct unit test`,\n }));\n const untestedUi = (result.untestedUiComponents || []).map((c) => ({\n file: c.file,\n component: c.componentName,\n metric: 'ui-test',\n message: `UI component [${c.componentName}] lacks UI/E2E test`,\n }));\n const cov = (result.coverageViolations || []).map((message) => ({ metric: 'coverage', message }));\n return [...fnViolations, ...untested, ...untestedUi, ...cov];\n}\n\nfunction emitQualityJson(result: ReturnType<typeof verifyQualityGate>): void {\n const violations = buildQualityViolations(result);\n const payload: VerifyJsonPayload = {\n gate: 'quality',\n success: result.success,\n exitCode: result.success ? 0 : 1,\n summary: {\n totalFiles: result.totalFiles,\n totalFunctions: result.totalFunctions,\n passCount: result.passCount,\n failCount: result.failCount,\n untestedFunctionsCount: result.untestedFunctions?.length || 0,\n untestedUiComponentsCount: result.untestedUiComponents?.length || 0,\n coverageViolationsCount: result.coverageViolations?.length || 0,\n baselineViolationsCount: result.baselineViolationsCount || 0,\n toleratedViolationsCount: result.toleratedViolationsCount || 0,\n newViolationsCount: result.newViolationsCount || 0,\n baselineUpdated: result.baselineUpdated || false,\n },\n violations,\n };\n console.log(JSON.stringify(payload, null, 2));\n}\n\nfunction printQualityFailingDetails(failing: ReturnType<typeof verifyQualityGate>['results'], isPermissive: boolean): void {\n const colorFn = isPermissive ? pc.yellow : pc.red;\n const label = isPermissive ? '\\n Detected warnings (PERMISSIVE mode):' : '\\n Detected violations:';\n console.log(colorFn(label));\n const maxToShow = 15;\n for (const f of failing.slice(0, maxToShow)) {\n console.log(` ${colorFn(isPermissive ? '⚠' : '✖')} ${pc.bold(f.relPath)} [${f.functionName}]: ${f.violations.join(', ')}`);\n }\n if (failing.length > maxToShow) {\n console.log(colorFn(` ... and ${failing.length - maxToShow} more functions exceeding thresholds.`));\n }\n}\n\nfunction printQualityTestAndCoverageGaps(result: ReturnType<typeof verifyQualityGate>): void {\n const untested = result.untestedFunctions || [];\n if (untested.length > 0) {\n console.log(pc.red('\\n Functions lacking unit tests:'));\n for (const u of untested.slice(0, 15)) {\n console.log(` ${pc.red('✖')} ${pc.bold(u.file)} [${u.functionName}]`);\n }\n }\n const untestedUi = result.untestedUiComponents || [];\n if (untestedUi.length > 0) {\n console.log(pc.red('\\n UI components lacking UI/E2E tests:'));\n for (const c of untestedUi.slice(0, 15)) {\n console.log(` ${pc.red('✖')} ${pc.bold(c.file)} [${c.componentName}]`);\n }\n }\n for (const cv of result.coverageViolations || []) {\n console.log(` ${pc.red('✖')} ${cv}`);\n }\n}\n\nfunction printQualitySummary(result: ReturnType<typeof verifyQualityGate>, isPermissive: boolean): void {\n console.log(` Analyzed files: ${pc.bold(String(result.totalFiles))}`);\n console.log(` Evaluated functions: ${pc.bold(String(result.totalFunctions))}`);\n console.log(` Compliant functions: ${pc.green(String(result.passCount))}`);\n if (result.toleratedViolationsCount && result.toleratedViolationsCount > 0) {\n console.log(` Tolerated warnings: ${pc.yellow(String(result.toleratedViolationsCount))} (Ratchet mode)`);\n }\n const failStr = result.failCount > 0 ? (isPermissive ? pc.yellow(String(result.failCount)) : pc.red(String(result.failCount))) : pc.green(\"0\");\n console.log(` Failing functions: ${failStr}`);\n}\n\nfunction printQualityConsole(result: ReturnType<typeof verifyQualityGate>): void {\n const isPermissive = result.policy.enforce_mode === \"PERMISSIVE\";\n console.log(\n ` Active thresholds: CC <= ${result.policy.max_cyclomatic} | Cognitive <= ${result.policy.max_cognitive} | MI >= ${result.policy.min_maintainability} | Lines <= ${result.policy.max_function_lines} | Mode: ${result.policy.enforce_mode}`\n );\n printQualitySummary(result, isPermissive);\n if (result.failCount > 0) {\n printQualityFailingDetails(result.results.filter((r) => r.status === \"FAIL\"), isPermissive);\n }\n printQualityTestAndCoverageGaps(result);\n const tag = isPermissive && result.failCount > 0 ? \" (PERMISSIVE mode)\" : \"\";\n console.log(result.success ? pc.green(`\\n✔ Release Gate PASSED${tag}\\n`) : pc.red(\"\\n✖ Release Gate BLOCKED\\n\"));\n}\n\nfunction buildQualityThresholds(options: QualityVerifyOptions) {\n return {\n max_cyclomatic: options.maxCyclomatic !== undefined ? Number(options.maxCyclomatic) : undefined,\n max_cognitive: options.maxCognitive !== undefined ? Number(options.maxCognitive) : undefined,\n min_maintainability: options.minMaintainability !== undefined ? Number(options.minMaintainability) : undefined,\n max_function_lines: options.maxLines !== undefined ? Number(options.maxLines) : undefined,\n enforce_mode: options.enforceMode,\n };\n}\n\nexport function runVerifyQuality(options: QualityVerifyOptions = {}): boolean {\n const rootDir = options.root || process.cwd();\n const useJson = isJsonOutput(options);\n if (!options.silent && !useJson) {\n console.log(pc.bold(pc.cyan('\\n🔍 [AI-SDLC] Verifying Quality Gate (Complexity & Maintainability)...')));\n }\n\n const result = verifyQualityGate({\n rootDir,\n policyPath: options.policy,\n thresholds: buildQualityThresholds(options),\n updateBaseline: options.updateBaseline,\n baseline: options.baseline,\n ratchet: options.ratchet,\n requireCoverageReport: options.requireCoverageReport,\n });\n\n if (useJson) {\n emitQualityJson(result);\n } else if (!options.silent) {\n printQualityConsole(result);\n }\n return result.success;\n}\n\nexport interface TraceabilityVerifyOptions extends VerifyBaseOptions {}\n\nfunction buildTraceabilityViolations(result: ReturnType<typeof verifyTraceability>) {\n const orphanViolations = result.orphans.map((o) => ({\n id: o.id,\n title: o.title,\n productStatus: o.productStatus,\n archStatus: o.archStatus,\n testStatus: o.testStatus,\n message: `Orphan requirement [${o.id}]`,\n }));\n const contractViolations = (result.contractAudits || [])\n .filter((c) => c.status !== 'COMPLIANT')\n .map((c) => ({\n id: c.designId,\n method: c.method,\n status: c.status,\n message: `Design contract [${c.designId}] method '${c.method}': ${c.status}`,\n }));\n return [...orphanViolations, ...contractViolations];\n}\n\nfunction emitTraceabilityJson(result: ReturnType<typeof verifyTraceability>): void {\n const payload: VerifyJsonPayload = {\n gate: 'traceability',\n success: result.success,\n exitCode: result.success ? 0 : 1,\n summary: {\n totalRequirements: result.totalRequirements,\n conformingCount: result.totalRequirements - result.orphanCount,\n orphanCount: result.orphanCount,\n missingContractsCount: result.missingContractsCount || 0,\n },\n violations: buildTraceabilityViolations(result),\n };\n console.log(JSON.stringify(payload, null, 2));\n}\n\nfunction printMissingContractAudits(result: ReturnType<typeof verifyTraceability>): void {\n const failingContracts = (result.contractAudits || []).filter((c) => c.status !== 'COMPLIANT');\n if (failingContracts.length === 0) return;\n console.log(pc.red('\\n Unfulfilled design contracts (design.md -> src/ & tests/):'));\n for (const c of failingContracts) {\n console.log(` ${pc.red('✖')} [${c.designId}] ${c.interfaceName ? `${c.interfaceName}.` : ''}${c.method}: ${c.status}`);\n }\n}\n\nfunction printTraceabilityConsole(result: ReturnType<typeof verifyTraceability>): void {\n console.log(` Total requirements: ${pc.bold(String(result.totalRequirements))}`);\n console.log(` Compliant requirements: ${pc.green(String(result.totalRequirements - result.orphanCount))}`);\n console.log(` Orphan requirements: ${result.orphanCount > 0 ? pc.red(String(result.orphanCount)) : pc.green('0')}`);\n\n if (result.orphanCount > 0) {\n console.log(pc.red('\\n Traceability gaps:'));\n for (const o of result.orphans) {\n console.log(` ${pc.red('✖')} [${o.id}] Product: ${o.productStatus}, Architecture: ${o.archStatus}, Testing: ${o.testStatus}`);\n }\n }\n printMissingContractAudits(result);\n console.log(result.success ? pc.green('\\n✔ 360° Traceability COMPLIANT (100%)\\n') : pc.red('\\n✖ Traceability BLOCKED\\n'));\n}\n\nexport function runVerifyTraceability(options: TraceabilityVerifyOptions = {}): boolean {\n const rootDir = options.root || process.cwd();\n const useJson = isJsonOutput(options);\n const isSilent = Boolean(options.silent || useJson);\n if (!isSilent) {\n console.log(pc.bold(pc.cyan('\\n🔍 [AI-SDLC] Verifying 360° Traceability (Product -> Architecture -> Testing)...')));\n }\n\n const result = verifyTraceability({ rootDir });\n\n if (useJson) {\n emitTraceabilityJson(result);\n return result.success;\n }\n if (!options.silent) {\n printTraceabilityConsole(result);\n }\n return result.success;\n}\n\nfunction emitGovernanceJson(result: ReturnType<typeof verifyTasksGovernance>): void {\n const payload: VerifyJsonPayload = {\n gate: 'governance',\n success: result.success,\n exitCode: result.success ? 0 : 1,\n summary: {\n totalTasks: result.totalTasks,\n verifiedCount: result.verifiedCount,\n unverifiedCount: result.unverifiedCount,\n modeCounts: result.modeCounts,\n riskCounts: result.riskCounts,\n },\n violations: result.violations.map((v) => ({ message: v })),\n };\n console.log(JSON.stringify(payload, null, 2));\n}\n\nfunction printGovernanceConsole(result: ReturnType<typeof verifyTasksGovernance>): void {\n console.log(` Total audited tasks: ${pc.bold(String(result.totalTasks))}`);\n console.log(` Tasks with verification: ${pc.green(String(result.verifiedCount))}`);\n console.log(` Tasks without verif.: ${result.unverifiedCount > 0 ? pc.red(String(result.unverifiedCount)) : pc.green('0')}`);\n console.log(` Autonomy distribution:`);\n console.log(` 🟢 AUTONOMOUS: ${result.modeCounts['AUTONOMOUS'] || 0}`);\n console.log(` 🟡 HUMAN_REVIEW_PLAN: ${result.modeCounts['HUMAN_REVIEW_PLAN'] || 0}`);\n console.log(` 🟠 AMBIGUOUS: ${result.modeCounts['AMBIGUOUS'] || 0}`);\n console.log(` 🔴 HIGH_RISK_MANUAL: ${result.modeCounts['HIGH_RISK_MANUAL'] || 0}`);\n\n if (result.violations.length > 0) {\n console.log(pc.red('\\n Governance violations:'));\n for (const v of result.violations) {\n console.log(` ${pc.red('✖')} ${v}`);\n }\n }\n console.log(result.success ? pc.green('\\n✔ Tasks Governance COMPLIANT\\n') : pc.red('\\n✖ Tasks Governance BLOCKED\\n'));\n}\n\nexport interface GovernanceVerifyOptions extends VerifyBaseOptions {}\n\nexport function runVerifyGovernance(options: GovernanceVerifyOptions = {}): boolean {\n const rootDir = options.root || process.cwd();\n const useJson = isJsonOutput(options);\n const isSilent = Boolean(options.silent || useJson);\n if (!isSilent) {\n console.log(pc.bold(pc.cyan('\\n🔍 [AI-SDLC] Verifying Tasks Governance and Autonomy Classification...')));\n }\n\n const result = verifyTasksGovernance({ rootDir });\n\n if (useJson) {\n emitGovernanceJson(result);\n return result.success;\n }\n if (!options.silent) {\n printGovernanceConsole(result);\n }\n return result.success;\n}\n\nexport interface TestingVerifyOptions extends VerifyBaseOptions {}\n\nfunction formatReqTestingViolationMsg(r: ReturnType<typeof verifyTestingCoverage>['requirements'][number]): string {\n if (r.missingVariants && r.missingVariants.length > 0) {\n return `Requirement [${r.id}] missing BDD variant categories: ${r.missingVariants.join(', ')}`;\n }\n return `Requirement without verifiable test [${r.id}]`;\n}\n\nfunction mapReqViolations(requirements: ReturnType<typeof verifyTestingCoverage>['requirements']) {\n return requirements\n .filter((r) => r.status !== 'VERIFICADO_CON_PRUEBA')\n .map((r) => ({\n type: 'REQUIREMENT',\n id: r.id,\n title: r.title,\n file: r.file,\n missingVariants: r.missingVariants,\n message: formatReqTestingViolationMsg(r),\n }));\n}\n\nfunction mapTaskViolations(tasks: ReturnType<typeof verifyTestingCoverage>['tasks']) {\n return tasks\n .filter((t) => t.status !== 'VERIFICADO_CON_PRUEBA')\n .map((t) => ({\n type: 'TASK',\n id: t.id,\n title: t.title,\n file: t.file,\n message: `Task without test verification [${t.id}]`,\n }));\n}\n\nfunction buildTestingViolations(result: ReturnType<typeof verifyTestingCoverage>) {\n const flowViolations = (result.useCaseFlows || [])\n .filter((u) => u.status !== 'VERIFICADO_CON_PRUEBA')\n .map((u) => ({\n type: 'USE_CASE_FLOW',\n id: u.id,\n file: u.file,\n missingFlows: u.missingFlows,\n message: `Use Case [${u.id}] missing tests for flows: ${u.missingFlows.join(', ')}`,\n }));\n\n return [...mapReqViolations(result.requirements), ...mapTaskViolations(result.tasks), ...flowViolations];\n}\n\nfunction emitTestingJson(result: ReturnType<typeof verifyTestingCoverage>): void {\n const payload: VerifyJsonPayload = {\n gate: 'testing',\n success: result.success,\n exitCode: result.success ? 0 : 1,\n summary: {\n totalRequirements: result.totalRequirements,\n passedRequirements: result.passedRequirements,\n failedRequirements: result.failedRequirements,\n totalTasks: result.totalTasks,\n passedTasks: result.passedTasks,\n failedTasks: result.failedTasks,\n failedUseCaseFlows: result.failedUseCaseFlows || 0,\n },\n violations: buildTestingViolations(result),\n };\n console.log(JSON.stringify(payload, null, 2));\n}\n\nfunction printTestingFailures(result: ReturnType<typeof verifyTestingCoverage>): void {\n for (const r of result.requirements.filter((req) => req.status !== 'VERIFICADO_CON_PRUEBA')) {\n const varHint = r.missingVariants?.length ? ` [Missing BDD variants: ${r.missingVariants.join(', ')}]` : '';\n console.log(` ${pc.red('✖')} [Requirement: ${r.id}] ${r.title} (${r.file})${varHint}`);\n }\n for (const t of result.tasks.filter((tsk) => tsk.status !== 'VERIFICADO_CON_PRUEBA')) {\n console.log(` ${pc.red('✖')} [Task: ${t.id}] ${t.title} (${t.file})`);\n }\n for (const u of (result.useCaseFlows || []).filter((uc) => uc.status !== 'VERIFICADO_CON_PRUEBA')) {\n console.log(` ${pc.red('✖')} [Use Case Flows: ${u.id}] Missing tests for: ${u.missingFlows.join(', ')} (${u.file})`);\n }\n}\n\nfunction printTestingConsole(result: ReturnType<typeof verifyTestingCoverage>): void {\n console.log(` Verified requirements: ${pc.green(`${result.passedRequirements}/${result.totalRequirements}`)}`);\n console.log(` Verified tasks: ${pc.green(`${result.passedTasks}/${result.totalTasks}`)}`);\n\n if (result.failedRequirements > 0 || result.failedTasks > 0 || (result.failedUseCaseFlows || 0) > 0) {\n console.log(pc.red('\\n Items lacking executable tests:'));\n printTestingFailures(result);\n }\n console.log(result.success ? pc.green('\\n✔ Test Coverage COMPLIANT (100%)\\n') : pc.red('\\n✖ Test Coverage INSUFFICIENT\\n'));\n}\n\nexport function runVerifyTesting(options: TestingVerifyOptions = {}): boolean {\n const rootDir = options.root || process.cwd();\n const useJson = isJsonOutput(options);\n const isSilent = Boolean(options.silent || useJson);\n if (!isSilent) {\n console.log(pc.bold(pc.cyan('\\n🔍 [AI-SDLC] Verifying Test Coverage in Requirements and Tasks...')));\n }\n\n const result = verifyTestingCoverage({ rootDir });\n\n if (useJson) {\n emitTestingJson(result);\n return result.success;\n }\n if (!options.silent) {\n printTestingConsole(result);\n }\n return result.success;\n}\n\nexport interface LicenseVerifyOptions extends VerifyBaseOptions {\n vuln?: boolean;\n policy?: string;\n manifest?: string;\n dynamic?: boolean;\n tool?: 'native' | 'license-checker' | 'trivy' | 'syft';\n depth?: 'direct' | 'transitive';\n sbom?: boolean | string;\n sbomInput?: string;\n notices?: boolean | string;\n nonInteractive?: boolean;\n noInstallPrompt?: boolean;\n ci?: boolean;\n}\n\nfunction emitLicensesJson(result: ReturnType<typeof verifyLicenses>): void {\n const payload: VerifyJsonPayload = {\n gate: 'licenses',\n success: result.success,\n exitCode: result.success ? 0 : 1,\n summary: {\n totalEvaluated: result.totalEvaluated,\n permittedCount: result.permittedCount,\n violationsCount: result.violations.length,\n },\n violations: result.violations.map((v) => ({\n package: v.packageName,\n version: v.version,\n license: v.license,\n category: v.category,\n message: v.reason,\n })),\n artifacts: {\n sbomPath: result.sbomPath,\n noticesPath: result.noticesPath,\n },\n };\n console.log(JSON.stringify(payload, null, 2));\n}\n\nfunction printDetectedVulnerabilities(vulnerabilities?: Array<{ severity: string; id: string; packageName: string; installedVersion: string; cvssV3Score?: number; primaryUrl?: string }>): void {\n if (!vulnerabilities || vulnerabilities.length === 0) return;\n console.log(pc.yellow('\\n Detected package vulnerabilities (CVE/GHSA):'));\n for (const v of vulnerabilities) {\n console.log(` ${pc.red('✖')} [${v.severity}] [${v.id}] ${v.packageName}@${v.installedVersion} (CVSS: ${v.cvssV3Score ?? 'N/A'}): ${v.primaryUrl || ''}`);\n }\n}\n\nfunction printLicenseArtifacts(sbomPath?: string, noticesPath?: string): void {\n if (sbomPath) console.log(` CycloneDX SBOM generated: ${pc.cyan(sbomPath)}`);\n if (noticesPath) console.log(` Legal notices generated: ${pc.cyan(noticesPath)}`);\n}\n\nfunction printLicenseViolations(violations: Array<{ category: string; packageName: string; license: string; reason: string }>): void {\n if (violations.length === 0) return;\n console.log(pc.red('\\n Detected license violations:'));\n for (const v of violations) {\n console.log(` ${pc.red('✖')} [${v.category}] ${v.packageName} (${v.license}): ${v.reason}`);\n }\n}\n\nfunction printLicensesConsole(result: ReturnType<typeof verifyLicenses>): void {\n console.log(` Evaluated dependencies: ${pc.bold(String(result.totalEvaluated))}`);\n console.log(` Compliant dependencies: ${pc.green(String(result.permittedCount))}`);\n console.log(` License violations: ${result.violations.length > 0 ? pc.red(String(result.violations.length)) : pc.green('0')}`);\n printLicenseArtifacts(result.sbomPath, result.noticesPath);\n printLicenseViolations(result.violations);\n if (result.vulnerabilitiesSkipped) {\n console.log(pc.gray(' Vulnerabilities (CVE/GHSA): skipped (Trivy not installed in environment; enforced in CI)'));\n } else {\n printDetectedVulnerabilities(result.vulnerabilities);\n }\n console.log(result.success ? pc.green('\\n✔ OSS License Governance COMPLIANT\\n') : pc.red('\\n✖ OSS License Governance BLOCKED\\n'));\n}\n\nfunction buildLicenseVerifyInput(options: LicenseVerifyOptions, rootDir: string) {\n return {\n rootDir,\n policyPath: options.policy,\n manifestPath: options.manifest,\n dynamic: options.dynamic,\n tool: options.tool,\n depth: options.depth,\n generateSbom: options.sbom !== undefined ? Boolean(options.sbom) : undefined,\n sbomPath: typeof options.sbom === 'string' ? options.sbom : undefined,\n sbomInputPath: options.sbomInput,\n generateNotices: options.notices !== undefined ? Boolean(options.notices) : undefined,\n noticesPath: typeof options.notices === 'string' ? options.notices : undefined,\n scanVulnerabilities: options.vuln !== undefined ? Boolean(options.vuln) : undefined,\n nonInteractive: options.nonInteractive,\n noInstallPrompt: options.noInstallPrompt,\n ci: options.ci,\n confirmInstall: createTtyConfirmInstall(),\n };\n}\n\nfunction finalizeLicensesOutput(\n result: ReturnType<typeof verifyLicenses>,\n options: LicenseVerifyOptions,\n useJson: boolean\n): boolean {\n if (result.warnings && result.warnings.length > 0 && !options.silent) {\n for (const warning of result.warnings) {\n process.stderr.write(`[SBOM WARNING] ${warning}\\n`);\n }\n }\n if (useJson) {\n emitLicensesJson(result);\n } else if (!options.silent) {\n printLicensesConsole(result);\n }\n return result.success;\n}\n\nexport function runVerifyLicenses(options: LicenseVerifyOptions = {}): boolean {\n const rootDir = options.root || process.cwd();\n const useJson = isJsonOutput(options);\n if (!options.silent && !useJson) {\n console.log(pc.bold(pc.cyan('\\n🔍 [AI-SDLC] Verifying Open Source License Compliance (SCA)...')));\n }\n const result = verifyLicenses(buildLicenseVerifyInput(options, rootDir));\n return finalizeLicensesOutput(result, options, useJson);\n}\n\nexport async function runVerifyLicensesAsync(options: LicenseVerifyOptions = {}): Promise<boolean> {\n const rootDir = options.root || process.cwd();\n const useJson = isJsonOutput(options);\n if (!options.silent && !useJson) {\n console.log(pc.bold(pc.cyan('\\n🔍 [AI-SDLC] Verifying Open Source License Compliance (SCA)...')));\n }\n const result = await verifyLicensesAsync(buildLicenseVerifyInput(options, rootDir));\n return finalizeLicensesOutput(result, options, useJson);\n}\n\nexport interface PdacVerifyOptions extends VerifyBaseOptions {}\n\nfunction buildPdacViolations(result: ReturnType<typeof verifyPdacGraph>) {\n const drifts = result.drifts.map((d) => ({\n sourceId: d.sourceId,\n targetId: d.targetId,\n sourceFile: d.sourceFile,\n expectedDigest: d.expectedDigest,\n actualDigest: d.actualDigest,\n message: `Cryptographic drift in ${d.sourceFile} citing ${d.targetId}`,\n }));\n const unresolved = (result.unresolvedCitations || []).map((u) => ({\n sourceId: u.sourceFile,\n targetId: u.targetId,\n sourceFile: u.sourceFile,\n message: `Unresolved citation in ${u.sourceFile} citing non-existent artifact '${u.targetId}'`,\n }));\n const anchors = (result.invalidAnchors || []).map((a) => ({\n sourceId: a.sourceFile,\n targetId: a.targetId,\n sourceFile: a.sourceFile,\n message: a.reason,\n }));\n return [...drifts, ...unresolved, ...anchors];\n}\n\nfunction emitPdacJson(result: ReturnType<typeof verifyPdacGraph>): void {\n const payload: VerifyJsonPayload = {\n gate: 'pdac',\n success: result.success,\n exitCode: result.success ? 0 : 1,\n summary: {\n totalNodes: result.totalNodes,\n totalEdges: result.totalEdges,\n driftCount: result.drifts.length,\n unresolvedCount: result.unresolvedCount || 0,\n invalidAnchorCount: result.invalidAnchors?.length || 0,\n },\n violations: buildPdacViolations(result),\n };\n console.log(JSON.stringify(payload, null, 2));\n}\n\nfunction printDrifts(drifts: ReturnType<typeof verifyPdacGraph>['drifts']): void {\n if (drifts.length === 0) return;\n console.log(pc.red('\\n Detected drifts (Status: STALE):'));\n for (const d of drifts) {\n console.log(` ${pc.red('✖')} In ${d.sourceFile} citing ${d.targetId}: misaligned digest.`);\n }\n}\n\nfunction printUnresolved(unresolved: ReturnType<typeof verifyPdacGraph>['unresolvedCitations']): void {\n if (!unresolved || unresolved.length === 0) return;\n console.log(pc.red('\\n Unresolved citations:'));\n for (const u of unresolved) {\n console.log(` ${pc.red('✖')} In ${u.sourceFile}: references non-existent artifact '${u.targetId}'.`);\n }\n}\n\nfunction printInvalidAnchors(anchors: ReturnType<typeof verifyPdacGraph>['invalidAnchors']): void {\n if (!anchors || anchors.length === 0) return;\n console.log(pc.red('\\n Invalid anchors:'));\n for (const a of anchors) {\n console.log(` ${pc.red('✖')} In ${a.sourceFile}: ${a.reason}`);\n }\n}\n\nfunction printPdacConsole(result: ReturnType<typeof verifyPdacGraph>): void {\n console.log(` PDaC baseline nodes: ${pc.bold(String(result.totalNodes))}`);\n console.log(` Evaluated citations: ${pc.bold(String(result.totalEdges))}`);\n console.log(` Cryptographic drifts: ${result.drifts.length > 0 ? pc.red(String(result.drifts.length)) : pc.green('0')}`);\n if (result.unresolvedCount && result.unresolvedCount > 0) {\n console.log(` Unresolved citations: ${pc.red(String(result.unresolvedCount))}`);\n }\n if (result.invalidAnchors && result.invalidAnchors.length > 0) {\n console.log(` Invalid anchors: ${pc.red(String(result.invalidAnchors.length))}`);\n }\n\n printDrifts(result.drifts);\n printUnresolved(result.unresolvedCitations);\n printInvalidAnchors(result.invalidAnchors);\n\n console.log(result.success ? pc.green('\\n✔ PDaC Graph Free of Drift and Fully Verified\\n') : pc.red('\\n✖ PDaC Verification Failed (Drift, Unresolved Citations, or Invalid Anchors)\\n'));\n}\n\nexport function runVerifyPdac(options: PdacVerifyOptions = {}): boolean {\n const rootDir = options.root || process.cwd();\n const useJson = isJsonOutput(options);\n const isSilent = Boolean(options.silent || useJson);\n if (!isSilent) {\n console.log(pc.bold(pc.cyan('\\n🔍 [AI-SDLC] Verifying PDaC Graph and Cryptographic Drift (SHA-256)...')));\n }\n\n const result = verifyPdacGraph({ rootDir });\n\n if (useJson) {\n emitPdacJson(result);\n return result.success;\n }\n if (!options.silent) {\n printPdacConsole(result);\n }\n return result.success;\n}\n\nexport interface SchemasVerifyOptions extends VerifyBaseOptions {\n path?: string;\n}\n\nfunction emitSchemasJson(result: ReturnType<typeof verifyArtifactsSchemas>): void {\n const payload: VerifyJsonPayload = {\n gate: 'schemas',\n success: result.success,\n exitCode: result.success ? 0 : 1,\n summary: {\n totalEvaluated: result.totalEvaluated,\n validCount: result.validCount,\n invalidCount: result.invalidCount,\n },\n violations: result.violations.map((v) => ({\n file: v.filePath,\n id: v.id,\n schemaId: v.schemaId,\n property: v.property,\n message: v.message,\n })),\n };\n console.log(JSON.stringify(payload, null, 2));\n}\n\nfunction printSchemasConsole(result: ReturnType<typeof verifyArtifactsSchemas>): void {\n console.log(` Evaluated artifacts: ${pc.bold(String(result.totalEvaluated))}`);\n console.log(` Compliant artifacts: ${pc.green(String(result.validCount))}`);\n console.log(` Schema violations: ${result.invalidCount > 0 ? pc.red(String(result.invalidCount)) : pc.green('0')}`);\n\n if (result.violations.length > 0) {\n console.log(pc.red('\\n Detected JSON schema violations:'));\n for (const v of result.violations) {\n console.log(` ${pc.red('✖')} [${v.id || v.filePath}] (${v.schemaId || 'schema'}): ${v.message}`);\n }\n }\n console.log(result.success ? pc.green('\\n✔ Artifact Schemas COMPLIANT (100%)\\n') : pc.red('\\n✖ Artifact Schemas BLOCKED\\n'));\n}\n\nexport function runVerifySchemas(options: SchemasVerifyOptions = {}): boolean {\n const rootDir = options.root || process.cwd();\n const useJson = isJsonOutput(options);\n const isSilent = Boolean(options.silent || useJson);\n if (!isSilent) {\n console.log(pc.bold(pc.cyan('\\n🔍 [AI-SDLC] Verifying JSON Schemas Compliance (Draft 2020-12)...')));\n }\n\n const result = verifyArtifactsSchemas({ rootDir, targetPath: options.path });\n\n if (useJson) {\n emitSchemasJson(result);\n return result.success;\n }\n if (!options.silent) {\n printSchemasConsole(result);\n }\n return result.success;\n}\n\nexport interface FrictionVerifyOptions extends VerifyBaseOptions {\n change?: string;\n diffFiles?: string[];\n}\n\nfunction emitFrictionJson(result: ReturnType<typeof verifyProgressiveFriction>): void {\n const violations = [\n ...result.bypassedRules.map((rule) => ({ type: 'ANTI_BYPASS', message: rule })),\n ...result.errors.map((err) => ({ type: 'PROFILE_ERROR', message: err })),\n ];\n const payload: VerifyJsonPayload = {\n gate: 'friction',\n success: result.success,\n exitCode: result.success ? 0 : 1,\n summary: {\n profile: result.profile,\n evaluatedFilesCount: result.evaluatedFiles.length,\n bypassed: result.bypassed,\n },\n violations,\n };\n console.log(JSON.stringify(payload, null, 2));\n}\n\nfunction printFrictionConsole(result: ReturnType<typeof verifyProgressiveFriction>): void {\n console.log(` Detected profile: ${pc.magenta(result.profile)}`);\n console.log(` Evaluated files: ${pc.bold(String(result.evaluatedFiles.length))}`);\n if (result.bypassedRules.length > 0) {\n console.log(pc.red('\\n Anti-Bypass violations detected:'));\n for (const rule of result.bypassedRules) {\n console.log(` ${pc.red('✖')} ${rule}`);\n }\n }\n if (result.errors.length > 0) {\n console.log(pc.red('\\n Profile validation errors:'));\n for (const err of result.errors) {\n console.log(` ${pc.red('✖')} ${err}`);\n }\n }\n console.log(\n result.success\n ? pc.green('\\n✔ Progressive Friction COMPLIANT (EXIT 0)\\n')\n : pc.red('\\n✖ Progressive Friction BLOCKED (EXIT 1)\\n')\n );\n}\n\nexport function runVerifyFriction(options: FrictionVerifyOptions = {}): boolean {\n const rootDir = options.root || process.cwd();\n const useJson = isJsonOutput(options);\n const isSilent = Boolean(options.silent || useJson);\n if (!isSilent) {\n console.log(pc.bold(pc.cyan('\\n🛡️ [AI-SDLC] Verifying Progressive Friction and Anti-Bypass Guardrails...')));\n }\n\n const result = verifyProgressiveFriction({\n rootDir,\n changeId: options.change,\n diffFiles: options.diffFiles,\n });\n\n if (useJson) {\n emitFrictionJson(result);\n return result.success;\n }\n if (!options.silent) {\n printFrictionConsole(result);\n }\n return result.success;\n}\n\nexport interface DuplicatesVerifyOptions extends VerifyBaseOptions {\n similarity?: number | string;\n}\n\nfunction emitDuplicatesJson(result: ReturnType<typeof verifyArtifactDuplicates>): void {\n const payload: VerifyJsonPayload = {\n gate: 'duplicates',\n success: result.success,\n exitCode: result.success ? 0 : 1,\n summary: {\n totalRequirements: result.totalRequirements,\n errorCount: result.errorCount,\n warningCount: result.warningCount,\n },\n violations: result.issues.map((i) => ({\n type: i.type,\n severity: i.severity,\n id: i.id,\n file: i.file,\n conflictingId: i.conflictingId,\n message: i.message,\n })),\n };\n console.log(JSON.stringify(payload, null, 2));\n}\n\nfunction printDuplicatesConsole(result: ReturnType<typeof verifyArtifactDuplicates>): void {\n console.log(` Evaluated requirements: ${pc.bold(String(result.totalRequirements))}`);\n console.log(` Duplication errors: ${result.errorCount > 0 ? pc.red(String(result.errorCount)) : pc.green('0')}`);\n console.log(` Warnings: ${result.warningCount > 0 ? pc.yellow(String(result.warningCount)) : pc.green('0')}`);\n\n if (result.issues.length > 0) {\n console.log(pc.red('\\n Detected issues:'));\n for (const issue of result.issues) {\n const icon = issue.severity === 'ERROR' ? pc.red('✖') : pc.yellow('⚠');\n const badge = issue.severity === 'ERROR' ? pc.red(`[${issue.type}]`) : pc.yellow(`[${issue.type}]`);\n console.log(` ${icon} ${badge} [${issue.id}] in ${issue.file}: ${issue.message}`);\n }\n }\n console.log(\n result.success\n ? pc.green('\\n✔ Duplicates Verification COMPLIANT (0 Collisions)\\n')\n : pc.red('\\n✖ Duplicates Verification BLOCKED (Collisions Detected)\\n')\n );\n}\n\nexport function runVerifyDuplicates(options: DuplicatesVerifyOptions = {}): boolean {\n const rootDir = options.root || process.cwd();\n const similarityThreshold = options.similarity !== undefined ? Number(options.similarity) : undefined;\n const useJson = isJsonOutput(options);\n const isSilent = Boolean(options.silent || useJson);\n\n if (!isSilent) {\n console.log(pc.bold(pc.cyan('\\n🔍 [AI-SDLC] Verifying Duplicate Requirements and Redundancy (Shift-Left Pre-Flight)...')));\n }\n\n const result = verifyArtifactDuplicates({\n rootDir,\n titleSimilarityThreshold: similarityThreshold,\n });\n\n if (useJson) {\n emitDuplicatesJson(result);\n return result.success;\n }\n if (!options.silent) {\n printDuplicatesConsole(result);\n }\n return result.success;\n}\n\nexport interface SecretVerifyCliOptions extends VerifyBaseOptions {\n diff?: boolean;\n base?: string;\n gitleaks?: boolean;\n entropy?: number | string;\n}\n\nfunction emitSecretsJson(result: ReturnType<typeof verifySecrets>): void {\n const payload: VerifyJsonPayload = {\n gate: 'secrets',\n success: result.success,\n exitCode: result.success ? 0 : 4,\n summary: {\n totalFilesScanned: result.totalFilesScanned,\n findingsCount: result.findingsCount,\n scannedWithGitleaks: result.scannedWithGitleaks,\n },\n violations: result.findings.map((f) => ({\n ruleId: f.ruleId,\n file: f.relPath,\n line: f.lineNumber,\n type: f.type,\n maskedMatch: f.maskedMatch,\n message: f.message,\n })),\n };\n console.log(JSON.stringify(payload, null, 2));\n}\n\nfunction printSecretsConsole(result: ReturnType<typeof verifySecrets>): void {\n console.log(` Analyzed files: ${pc.bold(String(result.totalFilesScanned))}`);\n console.log(` Credential leaks: ${result.findingsCount > 0 ? pc.red(String(result.findingsCount)) : pc.green('0')}`);\n console.log(` Native Gitleaks engine: ${result.scannedWithGitleaks ? pc.cyan('Active / Integrated') : pc.dim('Deterministic Scanner (@aisdlc/core)')}`);\n\n if (result.findings.length > 0) {\n console.log(pc.red('\\n Detected exposed credentials:'));\n for (const f of result.findings) {\n console.log(` ${pc.red('✖')} [${f.ruleId}] ${pc.bold(`${f.relPath}:${f.lineNumber}`)}: ${f.maskedMatch} - ${f.message}`);\n }\n }\n console.log(result.success ? pc.green('\\n✔ Secrets Detection COMPLIANT (0 Credential Leaks)\\n') : pc.red('\\n✖ Secrets Detection BLOCKED (Exit Code 4: Exposed Secret)\\n'));\n}\n\nfunction emitSecretsSarif(result: ReturnType<typeof verifySecrets>, output?: string): void {\n const doc = generateSecuritySarifReport({ secretsResult: result });\n if (output) {\n writeSecuritySarifReport(output, doc);\n } else {\n console.log(serializeSarifDocument(doc));\n }\n}\n\nfunction handleSecretsOutput(\n result: ReturnType<typeof verifySecrets>,\n options: SecretVerifyCliOptions,\n useSarif: boolean,\n useJson: boolean\n): boolean {\n if (useSarif || options.output) {\n emitSecretsSarif(result, options.output);\n return result.success;\n }\n if (useJson) {\n emitSecretsJson(result);\n return result.success;\n }\n if (!options.silent) {\n printSecretsConsole(result);\n }\n return result.success;\n}\n\nexport function runVerifySecrets(options: SecretVerifyCliOptions = {}): boolean {\n const rootDir = options.root || process.cwd();\n const entropyThreshold = options.entropy !== undefined ? Number(options.entropy) : undefined;\n const useJson = isJsonOutput(options);\n const useSarif = isSarifOutput(options);\n\n if (!options.silent && !useJson && !useSarif) {\n console.log(pc.bold(pc.cyan(\"\\n🔐 [AI-SDLC] Verifying Deterministic Secrets and Credentials Detection (Gitleaks Gate)...\")));\n }\n\n const result = verifySecrets({\n rootDir,\n diff: options.diff,\n baseBranch: options.base,\n gitleaks: options.gitleaks,\n entropyThreshold,\n });\n\n return handleSecretsOutput(result, options, useSarif, useJson);\n}\n\nexport interface SastVerifyCliOptions extends VerifyBaseOptions {\n semgrep?: boolean;\n minSeverity?: string;\n sarif?: string[];\n orchestrate?: boolean;\n nonInteractive?: boolean;\n noInstallPrompt?: boolean;\n ci?: boolean;\n}\n\nfunction emitSastJson(result: ReturnType<typeof verifySast>): void {\n const payload: VerifyJsonPayload = {\n gate: 'sast',\n success: result.success,\n exitCode: result.success ? 0 : 1,\n summary: {\n totalFilesScanned: result.totalFilesScanned,\n violationsCount: result.violationsCount,\n },\n violations: result.violations.map((v) => ({\n ruleId: v.ruleId,\n file: v.relPath,\n line: v.lineNumber,\n type: v.type,\n severity: v.severity,\n message: v.message,\n })),\n ...(result.warnings?.length ? { warnings: result.warnings } : {}),\n };\n console.log(JSON.stringify(payload, null, 2));\n}\n\nfunction printSastConsole(result: ReturnType<typeof verifySast>): void {\n console.log(` Evaluated files: ${pc.bold(String(result.totalFilesScanned))}`);\n console.log(` SAST vulnerabilities: ${result.violationsCount > 0 ? pc.red(String(result.violationsCount)) : pc.green('0')}`);\n\n if (result.violations.length > 0) {\n console.log(pc.red('\\n Detected vulnerabilities:'));\n for (const v of result.violations) {\n console.log(` ${pc.red('✖')} [${v.severity}] [${v.ruleId}] ${pc.bold(`${v.relPath}:${v.lineNumber}`)}: ${v.message}`);\n }\n }\n console.log(result.success ? pc.green('\\n✔ SAST Analysis COMPLIANT (0 Critical Vulnerabilities)\\n') : pc.red('\\n✖ SAST Analysis BLOCKED (Vulnerabilities Detected)\\n'));\n}\n\nfunction emitSastSarif(result: ReturnType<typeof verifySast>, output?: string): void {\n const doc = generateSecuritySarifReport({ sastResult: result });\n if (output) {\n writeSecuritySarifReport(output, doc);\n } else {\n console.log(serializeSarifDocument(doc));\n }\n}\n\nfunction handleSastOutput(\n result: ReturnType<typeof verifySast>,\n options: SastVerifyCliOptions,\n useSarif: boolean,\n useJson: boolean\n): boolean {\n if (useSarif || options.output) {\n emitSastSarif(result, options.output);\n return result.success;\n }\n if (useJson) {\n emitSastJson(result);\n return result.success;\n }\n if (!options.silent) {\n for (const warning of result.warnings ?? []) {\n process.stderr.write(`[SAST WARNING] ${warning}\\n`);\n }\n printSastConsole(result);\n }\n return result.success;\n}\n\nfunction executeSastWithGuard(\n rootDir: string,\n options: SastVerifyCliOptions,\n useSarif: boolean,\n useJson: boolean\n): boolean {\n try {\n const result = verifySast({\n rootDir,\n semgrep: options.semgrep,\n minSeverity: options.minSeverity as SastSeverity,\n sarifPaths: options.sarif,\n });\n return handleSastOutput(result, options, useSarif, useJson);\n } catch (err) {\n if (err instanceof SarifIngestionError) {\n if (!options.silent) console.error(pc.red(`✖ ${err.message}`));\n return false;\n }\n throw err;\n }\n}\n\nexport function runVerifySast(options: SastVerifyCliOptions = {}): boolean {\n const rootDir = options.root || process.cwd();\n const useJson = isJsonOutput(options);\n const useSarif = isSarifOutput(options);\n\n if (!options.silent && !useJson && !useSarif) {\n console.log(pc.bold(pc.cyan(\"\\n🛡️ [AI-SDLC] Verifying Shift-Left SAST Security (Injections & OWASP Top 10)...\")));\n }\n return executeSastWithGuard(rootDir, options, useSarif, useJson);\n}\n\nfunction buildSastAsyncInput(rootDir: string, options: SastVerifyCliOptions) {\n return {\n rootDir,\n semgrep: options.semgrep,\n minSeverity: options.minSeverity as SastSeverity,\n sarifPaths: options.sarif,\n orchestrate: options.orchestrate,\n nonInteractive: options.nonInteractive,\n noInstallPrompt: options.noInstallPrompt,\n ci: options.ci,\n confirmInstall: createTtyConfirmInstall(),\n };\n}\n\nexport async function runVerifySastAsync(options: SastVerifyCliOptions = {}): Promise<boolean> {\n const rootDir = options.root || process.cwd();\n const useJson = isJsonOutput(options);\n const useSarif = isSarifOutput(options);\n if (!options.silent && !useJson && !useSarif) {\n console.log(pc.bold(pc.cyan(\"\\n🛡️ [AI-SDLC] Verifying Shift-Left SAST Security (Injections & OWASP Top 10)...\")));\n }\n try {\n const result = await verifySastAsync(buildSastAsyncInput(rootDir, options));\n return handleSastOutput(result, options, useSarif, useJson);\n } catch (err) {\n if (err instanceof SarifIngestionError) {\n if (!options.silent) console.error(pc.red(`✖ ${err.message}`));\n return false;\n }\n throw err;\n }\n}\n\nexport interface SecurityVerifyCliOptions extends VerifyBaseOptions {\n diff?: boolean;\n base?: string;\n gitleaks?: boolean;\n semgrep?: boolean;\n entropy?: number | string;\n minSeverity?: string;\n orchestrate?: boolean;\n nonInteractive?: boolean;\n noInstallPrompt?: boolean;\n ci?: boolean;\n}\n\nfunction buildSecurityViolations(\n resultSecrets: ReturnType<typeof verifySecrets>,\n resultSast: ReturnType<typeof verifySast>\n) {\n const secretViolations = resultSecrets.findings.map((f) => ({\n type: 'SECRET',\n ruleId: f.ruleId,\n file: f.relPath,\n line: f.lineNumber,\n message: f.message,\n }));\n const sastViolations = resultSast.violations.map((v) => ({\n type: 'SAST',\n ruleId: v.ruleId,\n file: v.relPath,\n line: v.lineNumber,\n severity: v.severity,\n message: v.message,\n }));\n return [...secretViolations, ...sastViolations];\n}\n\nfunction emitSecurityJson(\n resultSecrets: ReturnType<typeof verifySecrets>,\n resultSast: ReturnType<typeof verifySast>,\n isOk: boolean\n): void {\n const exitCode = isOk ? 0 : (!resultSecrets.success ? 4 : 1);\n const payload: VerifyJsonPayload = {\n gate: 'security',\n success: isOk,\n exitCode,\n summary: {\n secretsScanned: resultSecrets.totalFilesScanned,\n secretFindings: resultSecrets.findingsCount,\n sastScanned: resultSast.totalFilesScanned,\n sastViolations: resultSast.violationsCount,\n },\n violations: buildSecurityViolations(resultSecrets, resultSast),\n };\n console.log(JSON.stringify(payload, null, 2));\n}\n\nfunction writeSuppressionsAuditReport(rootDir: string, suppressions: SecuritySuppression[]): void {\n const targetPath = path.join(rootDir, 'reports', 'SUPPRESSIONS_AUDIT.md');\n writeReportFileIfChanged(targetPath, generateSuppressionsAuditReport(suppressions));\n}\n\nfunction executeSecurityVerifiers(rootDir: string, options: SecurityVerifyCliOptions) {\n const entropyThreshold = options.entropy !== undefined ? Number(options.entropy) : undefined;\n const resultSecrets = verifySecrets({\n rootDir,\n diff: options.diff,\n baseBranch: options.base,\n gitleaks: options.gitleaks,\n entropyThreshold,\n });\n\n const resultSast = verifySast({\n rootDir,\n semgrep: options.semgrep,\n minSeverity: options.minSeverity as SastSeverity,\n });\n\n return { resultSecrets, resultSast };\n}\n\nasync function executeSecurityVerifiersAsync(rootDir: string, options: SecurityVerifyCliOptions) {\n const entropyThreshold = options.entropy !== undefined ? Number(options.entropy) : undefined;\n const resultSecrets = verifySecrets({\n rootDir,\n diff: options.diff,\n baseBranch: options.base,\n gitleaks: options.gitleaks,\n entropyThreshold,\n });\n const resultSast = await verifySastAsync(buildSastAsyncInput(rootDir, options));\n return { resultSecrets, resultSast };\n}\n\nfunction printSecurityConsoleSummary(silent: boolean | undefined, hasExpired: boolean): void {\n if (silent) return;\n console.log(` Audit exceptions report: ${pc.cyan('reports/SUPPRESSIONS_AUDIT.md')}`);\n if (hasExpired) {\n console.log(pc.red(' ✖ One or more security suppressions have expired! Quality Gate blocked.\\n'));\n }\n}\n\nfunction persistSecuritySarif(\n rootDir: string,\n resultSecrets: ReturnType<typeof verifySecrets>,\n resultSast: ReturnType<typeof verifySast>,\n customOutput?: string\n): void {\n const doc = generateSecuritySarifReport({\n secretsResult: resultSecrets,\n sastResult: resultSast,\n });\n const targetPath = customOutput || path.join(rootDir, \"reports\", \"security.sarif\");\n writeSecuritySarifReport(targetPath, doc);\n}\n\nfunction printSecurityConsole(\n resultSecrets: ReturnType<typeof verifySecrets>,\n resultSast: ReturnType<typeof verifySast>,\n silent: boolean | undefined,\n hasExpired: boolean\n): void {\n if (!silent) {\n console.log(pc.bold(pc.cyan(\"\\n🔐 [AI-SDLC] Verifying Deterministic Secrets and Credentials Detection (Gitleaks Gate)...\")));\n printSecretsConsole(resultSecrets);\n console.log(pc.bold(pc.cyan(\"\\n🛡️ [AI-SDLC] Verifying Shift-Left SAST Security (Injections & OWASP Top 10)...\")));\n for (const warning of resultSast.warnings ?? []) {\n process.stderr.write(`[SAST WARNING] ${warning}\\n`);\n }\n printSastConsole(resultSast);\n }\n printSecurityConsoleSummary(silent, hasExpired);\n}\n\nfunction handleSecurityOutput(\n options: SecurityVerifyCliOptions,\n resultSecrets: ReturnType<typeof verifySecrets>,\n resultSast: ReturnType<typeof verifySast>,\n isOk: boolean,\n hasExpired: boolean\n): boolean {\n if (isSarifOutput(options)) {\n if (!options.output) {\n const doc = generateSecuritySarifReport({\n secretsResult: resultSecrets,\n sastResult: resultSast,\n });\n console.log(serializeSarifDocument(doc));\n }\n return isOk;\n }\n if (isJsonOutput(options)) {\n emitSecurityJson(resultSecrets, resultSast, isOk);\n return isOk;\n }\n printSecurityConsole(resultSecrets, resultSast, options.silent, hasExpired);\n return isOk;\n}\n\nexport function runVerifySecurity(options: SecurityVerifyCliOptions = {}): boolean {\n const rootDir = options.root || process.cwd();\n const { resultSecrets, resultSast } = executeSecurityVerifiers(rootDir, options);\n const allSuppressions = [...(resultSecrets.suppressions || []), ...(resultSast.suppressions || [])];\n writeSuppressionsAuditReport(rootDir, allSuppressions);\n persistSecuritySarif(rootDir, resultSecrets, resultSast, options.output);\n const hasExpired = allSuppressions.some((s) => s.status === 'expired');\n const isOk = resultSecrets.success && resultSast.success && !hasExpired;\n return handleSecurityOutput(options, resultSecrets, resultSast, isOk, hasExpired);\n}\n\nexport async function runVerifySecurityAsync(options: SecurityVerifyCliOptions = {}): Promise<boolean> {\n const rootDir = options.root || process.cwd();\n const { resultSecrets, resultSast } = await executeSecurityVerifiersAsync(rootDir, options);\n const allSuppressions = [...(resultSecrets.suppressions || []), ...(resultSast.suppressions || [])];\n writeSuppressionsAuditReport(rootDir, allSuppressions);\n persistSecuritySarif(rootDir, resultSecrets, resultSast, options.output);\n const hasExpired = allSuppressions.some((s) => s.status === 'expired');\n const isOk = resultSecrets.success && resultSast.success && !hasExpired;\n return handleSecurityOutput(options, resultSecrets, resultSast, isOk, hasExpired);\n}\n\nfunction buildGherkinViolations(result: ReturnType<typeof checkGherkinInSync>) {\n const orphans = result.orphanFeatureFiles ?? [];\n const missingSteps = result.missingStepFiles ?? [];\n return [\n ...result.missingFiles.map((f) => ({ type: 'MISSING_FEATURE', file: f, message: `Missing .feature file: ${f}` })),\n ...result.outOfSyncFiles.map((f) => ({ type: 'OUT_OF_SYNC_FEATURE', file: f, message: `Out-of-sync .feature file: ${f}` })),\n ...orphans.map((f) => ({ type: 'ORPHAN_FEATURE', file: f, message: `Manual/orphan .feature file without Markdown source: ${f}` })),\n ...missingSteps.map((f) => ({\n type: 'MISSING_STEP_FILE',\n file: f,\n message: `Missing deterministic step definition file in tests/steps/ for: ${f}. Run 'aisdlc gherkin scaffold ${f} --lang <lang> --fallback'.`,\n })),\n ];\n}\n\nfunction emitGherkinVerifyJson(result: ReturnType<typeof checkGherkinInSync>): void {\n const orphans = result.orphanFeatureFiles ?? [];\n const missingSteps = result.missingStepFiles ?? [];\n const payload: VerifyJsonPayload = {\n gate: 'gherkin',\n success: result.inSync,\n exitCode: result.inSync ? 0 : 1,\n summary: {\n totalFeatures: result.totalFeatures,\n missingCount: result.missingFiles.length,\n outOfSyncCount: result.outOfSyncFiles.length,\n orphanFeatureCount: orphans.length,\n missingStepFileCount: missingSteps.length,\n },\n violations: buildGherkinViolations(result),\n };\n console.log(JSON.stringify(payload, null, 2));\n}\n\nfunction printGherkinIssueList(items: string[], tag: string, suffix = ''): void {\n for (const f of items) {\n const extra = suffix ? suffix.replace('{file}', f) : '';\n console.log(` ${pc.red('✖')} [${tag}] ${f}${extra}`);\n }\n}\n\nfunction printGherkinVerifyConsole(result: ReturnType<typeof checkGherkinInSync>): void {\n const orphans = result.orphanFeatureFiles ?? [];\n const missingSteps = result.missingStepFiles ?? [];\n const totalOut = result.missingFiles.length + result.outOfSyncFiles.length + orphans.length + missingSteps.length;\n console.log(` Evaluated features: ${pc.bold(String(result.totalFeatures))}`);\n console.log(` Violations / missing: ${totalOut > 0 ? pc.red(String(totalOut)) : pc.green('0')}`);\n printGherkinIssueList(result.missingFiles, 'MISSING');\n printGherkinIssueList(result.outOfSyncFiles, 'OUT_OF_SYNC');\n printGherkinIssueList(orphans, 'ORPHAN_FEATURE');\n printGherkinIssueList(missingSteps, 'MISSING_STEP_FILE', ' (run: aisdlc gherkin scaffold {file} --lang <lang> --fallback)');\n console.log(result.inSync ? pc.green('\\n✔ BDD Synchronization COMPLIANT\\n') : pc.red('\\n✖ BDD Synchronization BLOCKED\\n'));\n}\n\nexport function runVerifyGherkin(options: VerifyBaseOptions = {}): boolean {\n const rootDir = options.root || process.cwd();\n const useJson = isJsonOutput(options);\n const isSilent = Boolean(options.silent || useJson);\n\n if (!isSilent) {\n console.log(pc.bold(pc.cyan('\\n🥒 [AI-SDLC] Verifying BDD Synchronization (Gherkin -> .feature)...')));\n }\n\n const result = checkGherkinInSync({ rootDir });\n\n if (useJson) {\n emitGherkinVerifyJson(result);\n return result.inSync;\n }\n if (!options.silent) {\n printGherkinVerifyConsole(result);\n }\n return result.inSync;\n}\n\nexport interface PrivacyVerifyCliOptions extends VerifyBaseOptions {\n policy?: string;\n ropaReport?: boolean | string;\n report?: boolean | string;\n minSeverity?: string;\n}\n\nfunction emitPrivacyJson(result: ReturnType<typeof verifyPrivacy>): void {\n const payload: VerifyJsonPayload = {\n gate: 'privacy',\n success: result.success,\n exitCode: result.success ? 0 : 5,\n summary: {\n totalFilesScanned: result.totalFilesScanned,\n dataAssetsCount: result.dataAssetsCount,\n ropaCount: result.ropaRecordsCount,\n ropaRecordsCount: result.ropaRecordsCount,\n privacyRequirementsCount: result.privacyRequirementsCount,\n violationsCount: result.violationsCount,\n },\n violations: result.violations,\n artifacts: {\n ropaInventoryPath: result.ropaOutputPath,\n reportPath: result.reportOutputPath,\n },\n };\n console.log(JSON.stringify(payload, null, 2));\n}\n\nfunction printPrivacyConsole(result: ReturnType<typeof verifyPrivacy>): void {\n console.log(` Scanned source files: ${pc.bold(String(result.totalFilesScanned))}`);\n console.log(` Data assets (DATA-ASSET):${pc.bold(String(result.dataAssetsCount))}`);\n console.log(` ROPA records (Art. 30): ${pc.bold(String(result.ropaRecordsCount))}`);\n console.log(` Privacy reqs (PRIV-REQ): ${pc.bold(String(result.privacyRequirementsCount))}`);\n console.log(` Privacy violations: ${result.violationsCount > 0 ? pc.red(String(result.violationsCount)) : pc.green('0')}`);\n if (result.ropaOutputPath) console.log(` ROPA Inventory generated:${pc.cyan(result.ropaOutputPath)}`);\n if (result.reportOutputPath) console.log(` Privacy Report generated:${pc.cyan(result.reportOutputPath)}`);\n if (result.violations.length > 0) {\n console.log(pc.red('\\n Detected privacy violations:'));\n for (const v of result.violations) {\n const loc = v.lineNumber ? `${v.relPath}:${v.lineNumber}` : v.relPath;\n console.log(` ${pc.red('✖')} [${v.severity}] [${v.ruleId}] ${pc.bold(loc)}: ${v.message}`);\n }\n }\n console.log(result.success ? pc.green('\\n✔ Data Protection & Privacy COMPLIANT\\n') : pc.red('\\n✖ Data Protection & Privacy BLOCKED (Exit Code 5)\\n'));\n}\n\nfunction buildPrivacyVerifyInput(options: PrivacyVerifyCliOptions, rootDir: string) {\n return {\n rootDir,\n policyPath: options.policy,\n generateRopa: options.ropaReport !== undefined ? Boolean(options.ropaReport) : undefined,\n ropaOutputPath: typeof options.ropaReport === 'string' ? options.ropaReport : undefined,\n reportOutputPath:\n typeof options.report === 'string'\n ? options.report\n : options.report\n ? 'reports/PRIVACY_SCAN_REPORT.md'\n : undefined,\n };\n}\n\nexport function runVerifyPrivacy(options: PrivacyVerifyCliOptions = {}): boolean {\n const rootDir = options.root || process.cwd();\n const useJson = isJsonOutput(options);\n const isSilent = Boolean(options.silent || useJson);\n\n if (!isSilent) {\n console.log(pc.bold(pc.cyan('\\n🔒 [AI-SDLC] Verifying Data Protection & Privacy-by-Design (GDPR / LOPDGDD / PII-SAST)...')));\n }\n\n const result = verifyPrivacy(buildPrivacyVerifyInput(options, rootDir));\n\n if (useJson) {\n emitPrivacyJson(result);\n return result.success;\n }\n if (!options.silent) {\n printPrivacyConsole(result);\n }\n return result.success;\n}\n\nfunction collectSyncNonAsyncGates(options: QualityVerifyOptions, root: string, isSilent: boolean) {\n return {\n quality: { success: runVerifyQuality({ ...options, root, silent: isSilent, json: false }) },\n traceability: { success: runVerifyTraceability({ root, silent: isSilent, json: false }) },\n governance: { success: runVerifyGovernance({ root, silent: isSilent, json: false }) },\n testing: { success: runVerifyTesting({ root, silent: isSilent, json: false }) },\n gherkin: { success: runVerifyGherkin({ root, silent: isSilent, json: false }) },\n pdac: { success: runVerifyPdac({ root, silent: isSilent, json: false }) },\n schemas: { success: runVerifySchemas({ root, silent: isSilent, json: false }) },\n duplicates: { success: runVerifyDuplicates({ root, silent: isSilent, json: false }) },\n friction: { success: runVerifyFriction({ root, silent: isSilent, json: false }) },\n privacy: { success: runVerifyPrivacy({ root, silent: isSilent, json: false }) },\n };\n}\n\nfunction collectAllGates(options: QualityVerifyOptions, root: string, isSilent: boolean) {\n return {\n ...collectSyncNonAsyncGates(options, root, isSilent),\n licenses: { success: runVerifyLicenses({ root, silent: isSilent, json: false }) },\n security: { success: runVerifySecurity({ root, silent: isSilent, json: false }) },\n };\n}\n\nasync function collectAllGatesAsync(options: QualityVerifyOptions, root: string, isSilent: boolean) {\n return {\n ...collectSyncNonAsyncGates(options, root, isSilent),\n licenses: { success: await runVerifyLicensesAsync({ root, silent: isSilent, json: false }) },\n security: { success: await runVerifySecurityAsync({ root, silent: isSilent, json: false }) },\n };\n}\n\nfunction resolveVerifyAllExitCode(allPassed: boolean, gatesSummary: Record<string, { success: boolean }>): number {\n if (allPassed) return 0;\n if (!gatesSummary.security?.success) return 4;\n if (!gatesSummary.privacy?.success) return 5;\n return 1;\n}\n\nfunction emitVerifyAllJson(gatesSummary: Record<string, { success: boolean }>, allPassed: boolean): void {\n const totalGates = Object.keys(gatesSummary).length;\n const passedCount = Object.values(gatesSummary).filter((g) => g.success).length;\n const failedCount = totalGates - passedCount;\n const exitCode = resolveVerifyAllExitCode(allPassed, gatesSummary);\n\n const violations = Object.entries(gatesSummary)\n .filter(([, g]) => !g.success)\n .map(([name]) => ({ gate: name, message: `Gate ${name} failed verification criteria` }));\n\n const payload: VerifyJsonPayload = {\n gate: 'all',\n success: allPassed,\n exitCode,\n summary: { totalGates, passedGates: passedCount, failedGates: failedCount },\n gates: gatesSummary,\n violations,\n };\n console.log(JSON.stringify(payload, null, 2));\n}\n\nconst VERIFY_ALL_GATES_LIST: Array<{ key: string; title: string }> = [\n { key: 'quality', title: ' 1. Quality Gate (Complexity/Maintainability): ' },\n { key: 'traceability', title: ' 2. 360° Traceability (RTM): ' },\n { key: 'governance', title: ' 3. Governance and Autonomy Modes: ' },\n { key: 'testing', title: ' 4. Test Coverage (Reqs & Tasks): ' },\n { key: 'gherkin', title: ' 5. BDD Synchronization (Gherkin -> .feature): ' },\n { key: 'licenses', title: ' 6. Open Source Licenses: ' },\n { key: 'pdac', title: ' 7. PDaC & Cryptographic Drift: ' },\n { key: 'schemas', title: ' 8. Artifact JSON Schemas (+ Handoff YAML): ' },\n { key: 'duplicates', title: ' 9. Duplicate Requirements (Shift-Left Gate): ' },\n { key: 'friction', title: ' 10. Progressive Friction & Anti-Bypass: ' },\n { key: 'security', title: ' 11. Shift-Left Security (Secrets & SAST): ' },\n { key: 'privacy', title: ' 12. Data Protection & Privacy (GDPR/PII-SAST): ' },\n];\n\nfunction printVerifyAllSummaryTable(gatesSummary: Record<string, { success: boolean }>, allPassed: boolean): void {\n console.log(pc.bold(pc.magenta('================================================================')));\n console.log(pc.bold('CI/CD EVALUATION SUMMARY:'));\n for (const item of VERIFY_ALL_GATES_LIST) {\n const passed = Boolean(gatesSummary[item.key]?.success);\n console.log(`${item.title}${passed ? pc.green('PASSED') : pc.red('FAILED')}`);\n }\n console.log(pc.bold(pc.magenta('================================================================')));\n\n if (allPassed) {\n console.log(pc.bold(pc.green('\\n✨ FINAL VERDICT: REPOSITORY COMPLIANT WITH AI-SDLC STANDARD (EXIT 0)\\n')));\n } else {\n console.log(pc.bold(pc.red('\\n⛔ FINAL VERDICT: BLOCKED BY DETECTED VIOLATIONS (EXIT 1)\\n')));\n }\n}\n\nfunction finalizeVerifyAll(\n gatesSummary: Record<string, { success: boolean }>,\n options: QualityVerifyOptions,\n useJson: boolean\n): boolean {\n const allPassed = Object.values(gatesSummary).every((g) => g.success);\n if (useJson) {\n emitVerifyAllJson(gatesSummary, allPassed);\n return allPassed;\n }\n if (!options.silent) {\n printVerifyAllSummaryTable(gatesSummary, allPassed);\n }\n return allPassed;\n}\n\nexport function runVerifyAll(options: QualityVerifyOptions = {}): boolean {\n const useJson = isJsonOutput(options);\n const isSilent = Boolean(options.silent || useJson);\n if (!isSilent) {\n console.log(pc.bold(pc.magenta('================================================================')));\n console.log(pc.bold(pc.magenta(' AI-SDLC: FULL QUALITY GATES AND GOVERNANCE SUITE ')));\n console.log(pc.bold(pc.magenta('================================================================')));\n }\n const root = options.root || process.cwd();\n const gatesSummary = collectAllGates(options, root, isSilent);\n return finalizeVerifyAll(gatesSummary, options, useJson);\n}\n\nexport async function runVerifyAllAsync(options: QualityVerifyOptions = {}): Promise<boolean> {\n const useJson = isJsonOutput(options);\n const isSilent = Boolean(options.silent || useJson);\n if (!isSilent) {\n console.log(pc.bold(pc.magenta('================================================================')));\n console.log(pc.bold(pc.magenta(' AI-SDLC: FULL QUALITY GATES AND GOVERNANCE SUITE ')));\n console.log(pc.bold(pc.magenta('================================================================')));\n }\n const root = options.root || process.cwd();\n const gatesSummary = await collectAllGatesAsync(options, root, isSilent);\n return finalizeVerifyAll(gatesSummary, options, useJson);\n}\n\n\n","/**\n * CLI Handler: aisdlc gherkin\n */\n\nimport * as readline from 'readline';\nimport pc from 'picocolors';\nimport {\n extractGherkinFeatures,\n GherkinScaffoldExecFn,\n GherkinScaffoldResult,\n scaffoldGherkinSteps,\n} from '@aisdlc/core';\nimport { isJsonOutput } from './verify.js';\n\nexport interface GherkinExtractCliOptions {\n root?: string;\n path?: string;\n all?: boolean;\n silent?: boolean;\n json?: boolean;\n format?: string;\n}\n\nexport interface GherkinScaffoldCliOptions {\n root?: string;\n lang: string | string[];\n output?: string;\n install?: boolean;\n fallback?: boolean;\n json?: boolean;\n format?: string;\n silent?: boolean;\n promptFn?: (question: string) => Promise<boolean>;\n execFn?: GherkinScaffoldExecFn;\n}\n\nfunction printGherkinResult(result: ReturnType<typeof extractGherkinFeatures>): void {\n console.log(` Generated .feature files: ${pc.bold(String(result.features.length))}`);\n console.log(` Total scenarios: ${pc.bold(String(result.totalScenarios))}`);\n\n for (const f of result.features) {\n console.log(` ${pc.green('✔')} ${pc.bold(f.featureName)} ➔ ${f.outputFile} (${f.scenarioCount} scenarios)`);\n }\n\n console.log(pc.green('\\n✔ BDD synchronization completed successfully.\\n'));\n}\n\nfunction emitGherkinJson(result: ReturnType<typeof extractGherkinFeatures>): void {\n const payload = {\n command: 'gherkin:extract',\n success: result.success,\n exitCode: result.success ? 0 : 1,\n totalScenarios: result.totalScenarios,\n features: result.features,\n };\n console.log(JSON.stringify(payload, null, 2));\n}\n\nexport function runGherkinExtract(options: GherkinExtractCliOptions = {}): boolean {\n const rootDir = options.root || process.cwd();\n const useJson = isJsonOutput(options);\n const isSilent = Boolean(options.silent || useJson);\n\n if (!isSilent) {\n console.log(pc.bold(pc.cyan('\\n🥒 [AI-SDLC] Extracting Gherkin scenarios to .feature files...')));\n }\n\n const result = extractGherkinFeatures({\n rootDir,\n targetPath: options.path,\n all: options.all,\n });\n\n if (!isSilent) {\n printGherkinResult(result);\n }\n\n if (useJson) {\n emitGherkinJson(result);\n }\n\n return result.success;\n}\n\nfunction defaultConfirmInstall(question: string): Promise<boolean> {\n return new Promise((resolve) => {\n const rl = readline.createInterface({ input: process.stdin, output: process.stdout });\n rl.question(question, (answer) => {\n rl.close();\n const normalized = answer.trim().toLowerCase();\n resolve(normalized === 'y' || normalized === 'yes');\n });\n });\n}\n\nfunction printScaffoldText(result: GherkinScaffoldResult): void {\n if (result.status === 'ERROR') {\n console.error(pc.red(`\\n✖ [Gherkin Scaffold] Error (${result.errorCode}): ${result.featureFile}\\n`));\n return;\n }\n if (result.status === 'GENERATOR_MISSING') {\n console.log(\n pc.yellow(\n `\\n⚠ Native generator (${result.generatorBin}) missing. Run: ${pc.bold(result.installCommand || '')} (License: ${result.license})\\n`\n )\n );\n return;\n }\n const files = result.outputFiles?.length ? result.outputFiles : [result.outputFile];\n for (const out of files.filter(Boolean)) {\n console.log(` ${pc.green('✔')} [${result.status}] ➔ ${pc.bold(String(out))}`);\n }\n}\n\nasync function handleInteractiveMissing(\n initialResult: GherkinScaffoldResult,\n featurePath: string,\n options: GherkinScaffoldCliOptions,\n rootDir: string\n): Promise<GherkinScaffoldResult> {\n const ask = options.promptFn || defaultConfirmInstall;\n const confirmed = await ask(\n `Native BDD generator is not installed (${initialResult.installCommand}, license: ${initialResult.license}). Install now? [y/N]: `\n );\n return scaffoldGherkinSteps({\n rootDir,\n featurePath,\n lang: options.lang,\n outputPath: options.output,\n installMissing: confirmed,\n allowFallback: !confirmed,\n execFn: options.execFn,\n });\n}\n\nfunction emitScaffoldOutput(\n result: GherkinScaffoldResult,\n options: GherkinScaffoldCliOptions,\n useJson: boolean\n): void {\n if (useJson) {\n console.log(JSON.stringify(result, null, 2));\n } else if (!options.silent) {\n printScaffoldText(result);\n }\n}\n\nexport async function runGherkinScaffold(\n featurePath: string,\n options: GherkinScaffoldCliOptions\n): Promise<boolean> {\n const rootDir = options.root || process.cwd();\n const useJson = isJsonOutput(options);\n const isInteractive = Boolean(process.stdin.isTTY && process.stdout.isTTY && !useJson && !options.silent);\n\n let result = scaffoldGherkinSteps({\n rootDir,\n featurePath,\n lang: options.lang,\n outputPath: options.output,\n installMissing: options.install,\n allowFallback: options.fallback,\n execFn: options.execFn,\n });\n\n if (result.status === 'GENERATOR_MISSING' && (isInteractive || options.promptFn)) {\n result = await handleInteractiveMissing(result, featurePath, options, rootDir);\n }\n\n emitScaffoldOutput(result, options, useJson);\n return result.success;\n}\n\n\n","/**\n * CLI Handler: aisdlc git\n */\n\nimport pc from 'picocolors';\nimport {\n classifyBranch,\n generateBranchHierarchyPlan,\n checkoutTaskBranch,\n installGitHooks,\n detectAuthorIdentity,\n} from '@aisdlc/core';\n\nfunction printInvalidBranchError(error?: string): void {\n console.error(pc.red(`\\n✖ [NAMING ERROR] ${error || 'Invalid pattern'}`));\n console.error(pc.yellow('\\nAllowed patterns:'));\n console.error(' Tier 1: main');\n console.error(' Tier 2: release/vX.Y.Z');\n console.error(' Tier 3: feat/<FEAT-ID>-<slug> or bug/<BUG-ID>-<slug>');\n console.error(' Tier 4: task/<PARENT-ID>/<TSK-ID>-<slug>\\n');\n}\n\nexport function runGitValidate(branchName: string): boolean {\n if (!branchName) {\n console.error(pc.red('\\n[ERROR] Branch name to validate must be specified.\\n'));\n return false;\n }\n\n const result = classifyBranch(branchName);\n if (result.valid) {\n console.log(pc.green(`\\n✔ [COMPLIANT] Valid branch in 4-tier model:`));\n console.log(` - Level (Tier): ${pc.bold(`Tier ${result.tier} (${result.tierName})`)}`);\n console.log(` - Base Origin: ${result.parentRequirement}`);\n console.log(` - Target Merge: ${result.targetMerge}\\n`);\n return true;\n }\n printInvalidBranchError(result.error);\n return false;\n}\n\nexport function runGitPlan(options: { version?: string; feature?: string; tasks?: string }): boolean {\n const version = options.version || 'v1.1.0';\n const feature = options.feature || 'CHG-001-telemetry';\n const rawTasks = options.tasks || 'TSK-001-dto,TSK-002-gateway';\n const tasks = rawTasks.split(',').map((t) => t.trim());\n\n const plan = generateBranchHierarchyPlan(version, feature, tasks);\n console.log(pc.cyan('\\n' + plan.planText));\n return true;\n}\n\nfunction printCheckoutFailure(result: ReturnType<typeof checkoutTaskBranch>): void {\n console.error(pc.red(`\\n✖ [ERROR] ${result.error}`));\n if (result.availableTasks && result.availableTasks.length > 0) {\n console.log(pc.yellow('\\nAvailable tasks in active changes:'));\n for (const t of result.availableTasks) {\n console.log(` - [${pc.cyan(t.changeId)}] ${pc.bold(t.id)}${t.title ? `: ${t.title}` : ''}`);\n }\n }\n console.log();\n}\n\nfunction printCheckoutSuccess(result: ReturnType<typeof checkoutTaskBranch>): void {\n console.log(` - Detected change: ${pc.bold(result.changeId || 'N/A')}`);\n console.log(` - Release Branch: ${pc.green(result.releaseBranch || '')} (Tier 2)`);\n console.log(` - Feature Branch: ${pc.green(result.featureBranch || '')} (Tier 3)`);\n console.log(` - Task Branch: ${pc.green(result.taskBranch || '')} (Tier 4)`);\n\n if (result.createdBranches && result.createdBranches.length > 0) {\n console.log(pc.green(`\\n✔ Cascading branches created:`));\n for (const b of result.createdBranches) {\n console.log(` ├── ${pc.bold(b)}`);\n }\n }\n\n const switched = result.switchedBranch || result.taskBranch || '';\n console.log(pc.green(`\\n✔ [CHECKOUT] Successfully switched to working branch:`));\n console.log(` 👉 ${pc.bold(pc.cyan(switched))}\\n`);\n}\n\nexport function runGitCheckout(taskId: string, options: { root?: string; silent?: boolean } = {}): boolean {\n if (!taskId) {\n if (!options.silent) {\n console.error(pc.red('\\n[ERROR] Task identifier to navigate must be specified (e.g. TSK-001).\\n'));\n }\n return false;\n }\n\n const rootDir = options.root || process.cwd();\n if (!options.silent) {\n console.log(pc.cyan(`\\n🚀 [AI-SDLC Git] Navigating and preparing branches for task '${pc.bold(taskId)}'...`));\n }\n\n const result = checkoutTaskBranch(taskId, { rootDir });\n\n if (!result.success) {\n if (!options.silent) printCheckoutFailure(result);\n return false;\n }\n\n if (!options.silent) printCheckoutSuccess(result);\n return true;\n}\n\nexport function runGitHookInstall(options: { root?: string } = {}): boolean {\n const rootDir = options.root || process.cwd();\n console.log(pc.cyan(`\\n🔧 [AI-SDLC Git] Installing deterministic Git hooks (pre-commit & prepare-commit-msg)...`));\n const result = installGitHooks(rootDir);\n if (result.success) {\n console.log(pc.green(`✔ [COMPLIANT] Git Hooks successfully installed:`));\n const hooks = result.installedHooks || [result.hookPath || '.git/hooks/prepare-commit-msg'];\n for (const h of hooks) {\n console.log(` 👉 ${pc.bold(h)}`);\n }\n console.log();\n return true;\n } else {\n console.error(pc.red(`\\n✖ [ERROR] ${result.error}\\n`));\n return false;\n }\n}\n\nexport function runGitDetectAuthor(options: { root?: string; json?: boolean } = {}): boolean {\n const rootDir = options.root || process.cwd();\n const identity = detectAuthorIdentity({ cwd: rootDir });\n if (options.json) {\n console.log(JSON.stringify(identity, null, 2));\n } else {\n console.log(`${identity.authorType}|${identity.model}|${identity.promptTokens}|${identity.completionTokens}|${identity.activeTimeSeconds}|${identity.reasoningEffort || ''}`);\n }\n return true;\n}\n\n","import * as readline from 'node:readline/promises';\nimport { initProject } from '@aisdlc/core';\nimport pc from 'picocolors';\nimport { isJsonOutput } from './verify.js';\n\nexport interface InitCliOptions {\n dryRun?: boolean;\n ci?: string;\n agents?: string | boolean;\n architecture?: string;\n stack?: string;\n silent?: boolean;\n json?: boolean;\n format?: string;\n force?: boolean;\n}\n\nconst CI_MENU = [\n pc.bold(pc.cyan('\\n🚀 [AI-SDLC] CI/CD Pipeline Provider:')),\n ' 1) ' + pc.green('GitHub Actions') + ' (.github/workflows/) ' + pc.yellow('[Recommended]'),\n ' 2) GitLab CI (.gitlab-ci.yml)',\n ' 3) Azure DevOps Pipelines (azure-pipelines.yml)',\n ' 4) Bitbucket Pipelines (bitbucket-pipelines.yml)',\n ' 5) ' + pc.gray('None') + ' (Reference templates in templates/ci/ only)',\n].join('\\n');\n\nconst CI_CHOICE_MAP: Record<string, string | undefined> = {\n '1': 'github',\n '2': 'gitlab',\n '3': 'azure',\n '4': 'bitbucket',\n '5': undefined,\n github: 'github',\n gitlab: 'gitlab',\n azure: 'azure',\n bitbucket: 'bitbucket',\n none: undefined,\n};\n\nfunction parseCiChoice(answer: string): string | undefined {\n const trimmed = answer.trim().toLowerCase();\n if (!trimmed) return 'github';\n return trimmed in CI_CHOICE_MAP ? CI_CHOICE_MAP[trimmed] : trimmed;\n}\n\nexport async function promptForCi(): Promise<string | undefined> {\n const rl = readline.createInterface({ input: process.stdin, output: process.stdout });\n console.log(CI_MENU);\n try {\n const answer = await rl.question(pc.bold('\\nWhich CI/CD provider do you wish to configure? [1-5] (default 1): '));\n return parseCiChoice(answer);\n } finally {\n rl.close();\n }\n}\n\nfunction parseArchitectureChoice(answer: string): string {\n const trimmed = answer.trim().toLowerCase();\n if (!trimmed || trimmed === '1' || trimmed === 'minimal') return 'minimal';\n if (trimmed === '2' || trimmed === 'full' || trimmed === 'complete') return 'full';\n if (trimmed === '3' || trimmed === 'none') return 'none';\n return trimmed;\n}\n\nconst ARCH_MENU = [\n pc.bold(pc.cyan('\\n🏛️ [AI-SDLC] Architecture Granularity Level:')),\n ' 1) ' + pc.green('Minimal / Baseline') + ' (ARCH-INTRO-* Vision, CMP-* Decisions) ' + pc.yellow('[Recommended]'),\n ' 2) ' + pc.cyan('Full / arc42 + NAF v4') + ' (12 complete architecture sections)',\n ' 3) ' + pc.gray('None') + ' (No architecture templates)',\n].join('\\n');\n\nexport async function promptForArchitecture(): Promise<string> {\n const rl = readline.createInterface({ input: process.stdin, output: process.stdout });\n console.log(ARCH_MENU);\n try {\n const answer = await rl.question(pc.bold('\\nWhich architecture granularity level do you wish to configure? [1-3] (default 1): '));\n return parseArchitectureChoice(answer);\n } finally {\n rl.close();\n }\n}\n\nconst AGENTS_MENU = [\n pc.bold(pc.cyan('\\n🤖 [AI-SDLC] Project AI Agents Configuration:')),\n ' 1) ' + pc.green('All') + ' (Cursor, Claude Code, Antigravity, Copilot, MCP) ' + pc.yellow('[Recommended]'),\n ' 2) Cursor (.cursor/rules and .cursor/mcp.json)',\n ' 3) Claude Code (CLAUDE.md)',\n ' 4) Google Antigravity / Gemini CLI (.agent/rules and antigravity.mcp.json)',\n ' 5) GitHub Copilot (.github/copilot-instructions.md)',\n ' 6) MCP connectors only (.cursor/mcp.json, antigravity.mcp.json, .vscode/mcp.json)',\n ' 7) None (only core policies and base templates)',\n].join('\\n');\n\nfunction parseAgentsChoice(answer: string): string {\n const map: Record<string, string> = {\n '1': 'all', '2': 'cursor', '3': 'claude', '4': 'antigravity',\n '5': 'copilot', '6': 'mcp', '7': 'none',\n };\n const trimmed = answer.trim();\n return !trimmed ? 'all' : map[trimmed] || trimmed;\n}\n\nexport async function promptForAgents(): Promise<string> {\n const rl = readline.createInterface({ input: process.stdin, output: process.stdout });\n console.log(AGENTS_MENU);\n try {\n const answer = await rl.question(pc.bold('\\nWhich agents do you wish to deploy? [1-7 or comma-separated list] (default 1): '));\n return parseAgentsChoice(answer);\n } finally {\n rl.close();\n }\n}\n\ntype InitProjectResult = ReturnType<typeof initProject>;\n\nfunction emitInitJson(result: InitProjectResult, isSuccess: boolean, dryRun: boolean): void {\n const payload = {\n command: 'init',\n success: isSuccess,\n exitCode: isSuccess ? 0 : 1,\n targetDir: result.targetDir,\n directoriesCreated: result.directoriesCreated,\n filesCreated: result.filesCreated,\n filesUpdated: result.filesUpdated || [],\n ciProvider: result.ciProvider,\n agentsConfigured: result.agentsConfigured,\n architectureGranularity: result.architectureGranularity,\n stacksConfigured: result.stacksConfigured || [],\n gitHookInstalled: result.gitHookInstalled,\n dryRun,\n ...(isSuccess ? {} : { error: result.error || 'Error initializing project.' }),\n };\n console.log(JSON.stringify(payload, null, 2));\n}\n\nfunction formatGranularityLabel(granularity?: string): string {\n if (granularity === 'full' || granularity === 'complete') return 'Full (arc42 + NAF v4, 12 sections)';\n if (granularity === 'minimal') return 'Minimal / Baseline (ARCH-INTRO-*, CMP-* and ADR-*)';\n return 'None';\n}\n\nfunction printGitHookStatus(dryRun: boolean, installed?: boolean): void {\n if (dryRun) {\n console.log(` ${pc.blue('DRY-RUN')} Install Git Hook: .git/hooks/prepare-commit-msg`);\n } else if (installed) {\n console.log(` ${pc.green('✔')} Git Hook installed: ${pc.bold('prepare-commit-msg')}`);\n } else {\n console.log(` ${pc.yellow('ℹ')} Git repository not detected at target.`);\n console.log(` ${pc.gray(\"Run 'git init' and then 'aisdlc git hook install' to activate commit hooks.\")}`);\n }\n}\n\nfunction printCreatedItems(items: string[], type: 'directory' | 'file' | 'updated-file', dryRun: boolean): void {\n const isDir = type === 'directory';\n const isUpdated = type === 'updated-file';\n for (const item of items) {\n const actionLabel = isDir ? 'Create directory:' : isUpdated ? 'Update file:' : 'Create file:';\n const doneLabel = isDir ? 'Directory created:' : isUpdated ? 'File updated:' : 'File generated:';\n const prefix = dryRun ? pc.blue('DRY-RUN') + ` ${actionLabel}` : pc.green('✔') + ` ${doneLabel}`;\n console.log(` ${prefix} ${item}`);\n }\n}\n\nfunction printInitSuccess(result: InitProjectResult, dryRun: boolean): void {\n console.log(pc.bold(pc.cyan(`\\n🚀 [AI-SDLC] Initializing governance structure in: ${result.targetDir}\\n`)));\n printCreatedItems(result.directoriesCreated, 'directory', dryRun);\n printCreatedItems(result.filesCreated, 'file', dryRun);\n if (result.filesUpdated && result.filesUpdated.length > 0) {\n printCreatedItems(result.filesUpdated, 'updated-file', dryRun);\n }\n\n if (result.ciProvider) {\n console.log(pc.cyan(`\\n ✔ CI/CD configuration generated for provider: ${pc.bold(result.ciProvider)}`));\n }\n if (result.agentsConfigured && result.agentsConfigured.length > 0) {\n console.log(pc.cyan(`\\n ✔ Configured AI agents: ${pc.bold(result.agentsConfigured.join(', '))}`));\n }\n if (result.architectureGranularity) {\n console.log(pc.cyan(`\\n ✔ Architecture granularity: ${pc.bold(formatGranularityLabel(result.architectureGranularity))}`));\n }\n\n printGitHookStatus(dryRun, result.gitHookInstalled);\n console.log(pc.green('\\n✔ Repository configured with AI-SDLC policies and templates.\\n'));\n}\n\nfunction handleInitResult(\n result: InitProjectResult,\n ctx: { isSilent: boolean; useJson: boolean; dryRun: boolean }\n): boolean {\n if (!result.success) {\n if (!ctx.isSilent) {\n console.error(pc.red(`\\n✖ [ERROR] ${result.error || 'Error initializing project.'}\\n`));\n }\n if (ctx.useJson) {\n emitInitJson(result, false, ctx.dryRun);\n }\n return false;\n }\n\n if (!ctx.isSilent) {\n printInitSuccess(result, ctx.dryRun);\n }\n\n if (ctx.useJson) {\n emitInitJson(result, true, ctx.dryRun);\n }\n\n return true;\n}\n\nexport function runInit(\n targetDir: string = '.',\n options: InitCliOptions = {}\n): boolean {\n const useJson = isJsonOutput(options);\n const isSilent = Boolean(options.silent || useJson);\n const dryRun = Boolean(options.dryRun);\n\n const result = initProject({\n rootDir: process.cwd(),\n targetDir,\n ci: options.ci,\n agents: options.agents === 'none' ? false : options.agents,\n architecture: options.architecture,\n stack: options.stack,\n dryRun,\n force: Boolean(options.force),\n });\n\n return handleInitResult(result, { isSilent, useJson, dryRun });\n}\n\n","/**\n * CLI Handlers: aisdlc kpi pr & aisdlc kpi release\n */\n\nimport * as fs from 'fs';\nimport pc from 'picocolors';\nimport {\n aggregatePrKpis,\n formatPrKpiMarkdown,\n injectKpisIntoPrBody,\n aggregateReleaseKpis,\n resolveReleaseBaseBranch,\n writeReleaseKpiReport,\n} from '@aisdlc/core';\n\nexport interface KpiPrCliOptions {\n base?: string;\n head?: string;\n updateFile?: string;\n json?: boolean;\n root?: string;\n}\n\nexport interface KpiReleaseCliOptions {\n release: string;\n base?: string;\n output?: string;\n json?: boolean;\n root?: string;\n}\n\nfunction applyKpiPrOutput(options: KpiPrCliOptions, markdown: string): boolean {\n if (options.updateFile) {\n if (!fs.existsSync(options.updateFile)) {\n console.error(pc.red(`\\n✖ [ERROR] Target file '${options.updateFile}' does not exist.\\n`));\n return false;\n }\n const original = fs.readFileSync(options.updateFile, 'utf-8');\n const updated = injectKpisIntoPrBody(original, markdown);\n fs.writeFileSync(options.updateFile, updated, 'utf-8');\n console.log(pc.green(`✔ [UPDATED] KPI summary injected into '${options.updateFile}'.`));\n } else {\n console.log('\\n' + markdown + '\\n');\n }\n return true;\n}\n\nexport function runKpiPr(options: KpiPrCliOptions): boolean {\n const baseRef = options.base || 'main';\n const headRef = options.head || 'HEAD';\n const rootDir = options.root || process.cwd();\n\n try {\n const kpi = aggregatePrKpis(baseRef, headRef, { cwd: rootDir });\n\n if (options.json) {\n console.log(JSON.stringify(kpi, null, 2));\n return true;\n }\n\n const markdown = formatPrKpiMarkdown(kpi);\n return applyKpiPrOutput(options, markdown);\n } catch (err: unknown) {\n const msg = err instanceof Error ? err.message : String(err);\n console.error(pc.red(`\\n✖ [ERROR] Failed to calculate PR KPIs: ${msg}\\n`));\n return false;\n }\n}\n\nfunction printReleaseKpiSummary(report: ReturnType<typeof aggregateReleaseKpis>, markdownPath: string, jsonPath: string): void {\n console.log(pc.green(`✔ [COMPLIANT] Consolidated report successfully generated:`));\n console.log(` - Markdown: ${pc.bold(markdownPath)}`);\n console.log(` - JSON: ${pc.bold(jsonPath)}`);\n console.log(` - KLoC: ${report.totalKloc} (${report.totalCommits} commits)`);\n console.log(` - Bugs: ${report.totalBugs} (Density: ${report.globalDefectDensity} bugs/KLoC)`);\n console.log(` - Rework: ${report.reworkTimePercent}% time | ${report.reworkTokensPercent}% tokens\\n`);\n}\n\nfunction printKpiReleaseError(err: unknown): void {\n const msg = err instanceof Error ? err.message : String(err);\n console.error(pc.red(`\\n✖ [ERROR] Failed to calculate Release KPIs: ${msg}\\n`));\n}\n\nfunction executeKpiReleaseReport(\n release: string,\n baseBranch: string,\n rootDir: string,\n outputDir?: string\n): void {\n const report = aggregateReleaseKpis(release, baseBranch, { cwd: rootDir });\n const { markdownPath, jsonPath } = writeReleaseKpiReport(report, {\n outputDir,\n rootDir,\n });\n if (report.totalCommits === 0) {\n console.warn(pc.yellow(`\\n⚠ [WARNING] No commits found between '${report.baseBranch}' and '${report.releaseBranch}'.`));\n }\n printReleaseKpiSummary(report, markdownPath, jsonPath);\n}\n\nexport function runKpiRelease(options: KpiReleaseCliOptions): boolean {\n if (!options.release) {\n console.error(pc.red('\\n✖ [ERROR] Release branch must be specified (--release <branch>).\\n'));\n return false;\n }\n\n const rootDir = options.root || process.cwd();\n const baseBranch = resolveReleaseBaseBranch(options.release, options.base, { cwd: rootDir });\n\n try {\n console.log(pc.cyan(`\\n📊 [AI-SDLC Release KPI] Consolidating metrics for '${pc.bold(options.release)}' (baseline: '${pc.bold(baseBranch)}')...`));\n if (options.json) {\n const report = aggregateReleaseKpis(options.release, baseBranch, { cwd: rootDir });\n console.log(JSON.stringify(report, null, 2));\n return true;\n }\n executeKpiReleaseReport(options.release, baseBranch, rootDir, options.output);\n return true;\n } catch (err: unknown) {\n printKpiReleaseError(err);\n return false;\n }\n}\n","/**\n * CLI Handler: aisdlc mcp\n * Starts the native Model Context Protocol (MCP) server\n * Cites: FR-028-NATIVE-MCP-SERVER-001, FR-047-MCP-SERVER-HARDENING-DLP-001\n */\n\nimport pc from 'picocolors';\nimport { startMcpServer } from '@aisdlc/mcp';\n\nexport interface McpCliOptions {\n root?: string;\n role?: string;\n silent?: boolean;\n}\n\nexport async function runMcpServer(options: McpCliOptions = {}): Promise<void> {\n const rootDir = options.root || process.cwd();\n if (!options.silent) {\n console.error(pc.bold(pc.cyan('\\n🚀 [AI-SDLC MCP] Starting native Model Context Protocol (MCP) server (stdio)...')));\n console.error(pc.gray(` Base directory: ${rootDir}`));\n if (options.role) {\n console.error(pc.gray(` Role context: ${options.role}\\n`));\n } else {\n console.error('');\n }\n }\n\n await startMcpServer({ rootDir, role: options.role });\n}\n","/**\n * CLI Handler: aisdlc report\n */\n\nimport * as path from 'path';\nimport { spawn } from 'child_process';\nimport pc from 'picocolors';\nimport {\n generateComplianceEvidenceBundleSync,\n generateDashboardReport,\n generateQualityReport,\n} from '@aisdlc/core';\n\nfunction openInBrowser(filePath: string): void {\n const resolved = path.resolve(filePath);\n const platform = process.platform;\n try {\n if (platform === 'win32') {\n spawn('cmd.exe', ['/c', 'start', '', resolved], { detached: true, stdio: 'ignore' });\n } else if (platform === 'darwin') {\n spawn('open', [resolved], { detached: true, stdio: 'ignore' });\n } else {\n spawn('xdg-open', [resolved], { detached: true, stdio: 'ignore' });\n }\n } catch {\n // Graceful fallback if desktop launcher is unavailable\n }\n}\n\n\nfunction printDashboardMetrics(result: ReturnType<typeof generateDashboardReport>, rootDir: string): void {\n console.log(` Compiled nodes: ${pc.bold(String(result.totalNodes))}`);\n console.log(` Connections (edges): ${pc.bold(String(result.totalEdges))}`);\n console.log(` Compliant nodes: ${pc.green(String(result.conformingCount))}`);\n console.log(` Nodes with issues: ${result.issueCount > 0 ? pc.red(String(result.issueCount)) : pc.green('0')}`);\n console.log(` Global traceability: ${pc.green(String(result.metrics.traceabilityRatio) + '%')}`);\n console.log(` Maintainability: ${pc.bold(String(result.metrics.avgMaintainability) + ' / 100')}`);\n console.log(` Gate verdict: ${result.metrics.qualityVerdict === 'PASS' ? pc.green('PASS') : pc.red('FAIL')}`);\n\n const relPath = path.relative(rootDir, result.outputPath);\n console.log(pc.green(`\\n✔ Self-contained HTML dashboard successfully generated at: ${pc.bold(relPath)}\\n`));\n}\n\nfunction printDashboardError(err: unknown): void {\n const msg = err instanceof Error ? err.message : String(err);\n console.error(pc.red(`\\n✖ [ERROR] Failed to generate web dashboard: ${msg}\\n`));\n}\n\nexport function runReportDashboard(options: {\n root?: string;\n output?: string;\n title?: string;\n open?: boolean;\n} = {}): boolean {\n const rootDir = options.root || process.cwd();\n console.log(pc.bold(pc.cyan('\\n🌐 [AI-SDLC] Generating Interactive Web Dashboard and PDaC / RTM Graph...')));\n\n try {\n const result = generateDashboardReport({\n rootDir,\n outputPath: options.output,\n title: options.title,\n });\n\n printDashboardMetrics(result, rootDir);\n\n if (options.open) {\n openInBrowser(result.outputPath);\n }\n\n return true;\n } catch (err: unknown) {\n printDashboardError(err);\n return false;\n }\n}\n\nfunction printQualityReportMetrics(result: ReturnType<typeof generateQualityReport>, rootDir: string): void {\n console.log(` Analyzed files: ${pc.bold(String(result.totalFiles))}`);\n console.log(` Evaluated functions: ${pc.bold(String(result.totalFunctions))}`);\n console.log(` Average maintainability: ${pc.green(String(result.avgMaintainability) + ' / 100')}`);\n console.log(` Average complexity (CC): ${pc.bold(String(result.avgCyclomatic))}`);\n console.log(\n ` Code coverage (L/B/F): ${\n result.coverage\n ? pc.bold(`${result.coverage.linesPct}% / ${result.coverage.branchesPct}% / ${result.coverage.functionsPct}%`)\n : pc.dim('N/A (Run test:coverage)')\n }`\n );\n console.log(` Release Gate verdict: ${result.verdict === 'PASS' ? pc.green('PASS') : pc.red('FAIL')}`);\n\n const reportRelPath = path.relative(rootDir, path.join(rootDir, 'reports', 'QUALITY_REPORT.md'));\n console.log(pc.green(`\\n✔ Report successfully generated at: ${pc.bold(reportRelPath)}\\n`));\n}\n\nexport function runReportQuality(options: {\n root?: string;\n policy?: string;\n maxCyclomatic?: number | string;\n maxCognitive?: number | string;\n minMaintainability?: number | string;\n maxLines?: number | string;\n enforceMode?: 'STRICT' | 'PERMISSIVE' | string;\n} = {}): boolean {\n const rootDir = options.root || process.cwd();\n console.log(pc.bold(pc.cyan('\\n📊 Generating Formal Quality Report...')));\n\n const thresholds = {\n max_cyclomatic: options.maxCyclomatic !== undefined ? Number(options.maxCyclomatic) : undefined,\n max_cognitive: options.maxCognitive !== undefined ? Number(options.maxCognitive) : undefined,\n min_maintainability: options.minMaintainability !== undefined ? Number(options.minMaintainability) : undefined,\n max_function_lines: options.maxLines !== undefined ? Number(options.maxLines) : undefined,\n enforce_mode: options.enforceMode,\n };\n\n const result = generateQualityReport({ rootDir, policyPath: options.policy, thresholds });\n printQualityReportMetrics(result, rootDir);\n\n return result.verdict === 'PASS';\n}\n\nconst ALLOWED_COMPLIANCE_OPTIONS = new Set([\n 'root',\n 'output',\n 'keyless',\n 'strict',\n 'offline',\n 'dryRun',\n]);\n\n// Validate user options against permitted whitelist\nfunction validateComplianceOptions(options: Record<string, unknown>): boolean {\n // Check every key provided by the caller\n for (const key of Object.keys(options)) {\n if (!ALLOWED_COMPLIANCE_OPTIONS.has(key)) {\n // Print error message when unrecognized option is encountered\n console.error(pc.red(`\\n✖ [ERROR] Unknown option provided: --${key}\\n`));\n return false;\n }\n }\n return true;\n}\n\n// Execute report compliance command handler\nexport function runReportCompliance(\n options: {\n root?: string;\n output?: string;\n keyless?: boolean;\n strict?: boolean;\n offline?: boolean;\n dryRun?: boolean;\n [key: string]: unknown;\n } = {}\n): boolean {\n // Validate CLI arguments\n if (!validateComplianceOptions(options)) {\n return false;\n }\n // Resolve base directory\n const rootDir = options.root || process.cwd();\n console.log(pc.bold(pc.cyan('\\n📜 [AI-SDLC] Generating Regulatory Compliance Evidence Bundle...')));\n\n // Trigger bundle generation\n try {\n const res = generateComplianceEvidenceBundleSync({\n rootDir,\n outputPath: options.output,\n keyless: options.keyless,\n strict: options.strict,\n offline: options.offline,\n dryRun: options.dryRun,\n });\n // Print success feedback\n console.log(pc.green(`✔ Compliance evidence bundle generated successfully. Digest: ${res.bundleDigest}\\n`));\n return res.success;\n } catch (err: unknown) {\n // Print error message on failure\n console.error(pc.red(`\\n✖ [ERROR] ${err instanceof Error ? err.message : String(err)}\\n`));\n return false;\n }\n}\n\n\n\n\n\n","/**\n * CLI Handler: aisdlc review\n * Reviewer Report Submission (sanctioned write channel for reviewer and auditor agents)\n */\n\nimport pc from 'picocolors';\nimport { submitReviewReport, ReviewReportResult } from '@aisdlc/core';\n\nexport interface ReviewSubmitCliOptions {\n root?: string;\n change: string;\n reviewer: string;\n verdict: string;\n body: string;\n silent?: boolean;\n json?: boolean;\n}\n\nfunction printJsonResult(options: ReviewSubmitCliOptions, result: ReviewReportResult): void {\n console.log(\n JSON.stringify(\n {\n command: 'review:submit',\n success: result.success,\n change: options.change,\n reviewer: options.reviewer,\n verdict: result.verdict,\n reportPath: result.reportPath,\n digest: result.digest,\n error: result.error,\n },\n null,\n 2\n )\n );\n}\n\nfunction printTextResult(result: ReviewReportResult): void {\n if (result.success) {\n console.log(` ${pc.green('✔')} Review report persisted: ${pc.bold(result.reportPath || '')}`);\n console.log(` Verdict: ${pc.cyan(result.verdict || '')} | Digest: ${pc.dim(result.digest || '')}`);\n } else {\n console.error(` ${pc.red('✖')} Review submission rejected: ${result.error || 'Unknown error'}`);\n }\n}\n\nexport function runReviewSubmit(options: ReviewSubmitCliOptions): boolean {\n const result = submitReviewReport({\n rootDir: options.root,\n changeId: options.change,\n reviewer: options.reviewer,\n verdict: options.verdict,\n body: options.body,\n });\n\n if (options.json) {\n printJsonResult(options, result);\n return result.success;\n }\n\n if (!options.silent) {\n printTextResult(result);\n }\n\n return result.success;\n}\n","/**\n * CLI Handler: aisdlc inspect\n * Deep inspection and navigation across requirements, architecture, code, and tests.\n */\n\nimport { inspectElement, formatInspectResultMarkdown } from '@aisdlc/core';\n\nexport interface InspectCliOptions {\n root?: string;\n json?: boolean;\n format?: string;\n}\n\nfunction isJsonOutput(options: InspectCliOptions = {}): boolean {\n if (options.json !== undefined) return Boolean(options.json);\n if (options.format !== undefined) return options.format.trim().toLowerCase() === 'json';\n const env =\n process.env.AISDLC_FORMAT?.trim().toLowerCase() ||\n process.env.AISDLC_OUTPUT?.trim().toLowerCase();\n return env === 'json';\n}\n\nexport function runInspect(query: string, options: InspectCliOptions = {}): boolean {\n const root = options.root || process.cwd();\n const result = inspectElement(query, { rootDir: root });\n\n if (isJsonOutput(options)) {\n console.log(JSON.stringify(result, null, 2));\n return result.found;\n }\n\n const markdown = formatInspectResultMarkdown(result);\n console.log(markdown);\n return result.found;\n}\n","/**\n * AI-SDLC CLI: Doctor Command (FR-052-CLI-DOCTOR-001)\n */\n\nimport { DoctorService, DoctorReporter, DoctorOptions, DoctorReport } from '@aisdlc/core';\n\nexport interface DoctorCommandOptions {\n rootDir?: string;\n json?: boolean;\n fix?: boolean;\n strict?: boolean;\n offline?: boolean;\n timeout?: number;\n}\n\nfunction printReport(report: DoctorReport, reporter: DoctorReporter, asJson: boolean): void {\n if (asJson) {\n console.log(reporter.formatJson(report));\n return;\n }\n const formatted = reporter.formatTerminal(report);\n if (report.exitCode === 2) {\n console.error(formatted);\n } else {\n console.log(formatted);\n }\n}\n\nexport async function runDoctor(opts: DoctorCommandOptions = {}): Promise<number> {\n const doctorOpts: DoctorOptions = {\n rootDir: opts.rootDir || process.cwd(),\n json: opts.json,\n fix: opts.fix,\n strict: opts.strict,\n offline: opts.offline || process.env.AI_SDLC_OFFLINE === '1',\n timeout: opts.timeout,\n };\n\n const service = new DoctorService();\n const reporter = new DoctorReporter();\n const report = await service.diagnose(doctorOpts);\n\n printReport(report, reporter, Boolean(opts.json));\n return report.exitCode;\n}\n","/**\n * CLI Command: aisdlc migrate\n * Synchronizes schemas, templates, and policies with upstream canonical versions.\n * Cites: CMP-053-MIGRATE-ENGINE, FR-053-CLI-MIGRATE-001\n */\n\nimport * as path from 'path';\nimport pc from 'picocolors';\nimport {\n MigrationService,\n MigrationReporter,\n type MigrationOptions,\n type MigrationResult,\n} from '@aisdlc/core';\n\nexport interface CliMigrateOptions {\n root?: string;\n dryRun?: boolean;\n backup?: boolean;\n force?: boolean;\n allowPolicyDowngrade?: boolean;\n json?: boolean;\n verbose?: boolean;\n branch?: string;\n}\n\nfunction printConsoleSummary(result: MigrationResult, reporter: MigrationReporter): void {\n console.log(reporter.formatTerminal(result));\n if (result.exitCode === 0) {\n console.log(pc.green('\\nMigration completed successfully.'));\n } else if (result.exitCode === 1) {\n console.log(pc.yellow('\\nMigration finished with local overrides preserved. Use --force to overwrite.'));\n } else {\n console.error(pc.red('\\nMigration encountered errors or conflicts.'));\n }\n}\n\nexport async function runMigrate(options: CliMigrateOptions): Promise<number> {\n const root = path.resolve(options.root || process.cwd());\n const service = new MigrationService();\n const reporter = new MigrationReporter();\n\n const migrationOptions: MigrationOptions = {\n root,\n dryRun: Boolean(options.dryRun),\n backup: options.backup ?? true,\n force: Boolean(options.force),\n allowPolicyDowngrade: Boolean(options.allowPolicyDowngrade),\n json: Boolean(options.json),\n verbose: Boolean(options.verbose),\n branch: options.branch,\n };\n\n const result = await service.migrate(migrationOptions);\n\n if (options.json) {\n console.log(reporter.formatJson(result));\n } else {\n printConsoleSummary(result, reporter);\n }\n\n return result.exitCode;\n}\n","/**\n * CLI Handler: aisdlc sdd\n * Commands for SDD Ecosystem Integration (OpenSpec & Spec Kit) and PDaC Handoff Sidecars\n */\n\nimport * as path from 'path';\nimport pc from 'picocolors';\nimport {\n ChangeProfile,\n depositProductHandoffSidecar,\n detectActiveChangeForIntegration,\n integrateAllSddChanges,\n integrateSddChange,\n ProductHandoff,\n scaffoldSddChange,\n scanAllProductHandoffs,\n SddFramework,\n verifyArtifactDuplicates,\n DuplicateIssue,\n} from '@aisdlc/core';\nimport { isJsonOutput } from './verify.js';\n\n\n\nexport interface SddDepositCliOptions {\n root?: string;\n change: string;\n framework: SddFramework;\n title?: string;\n requirements?: string;\n useCases?: string;\n silent?: boolean;\n json?: boolean;\n format?: string;\n}\n\nfunction buildHandoffPayload(options: SddDepositCliOptions, changeId: string): { handoff: ProductHandoff; reqList: string[] } {\n const reqList = options.requirements\n ? options.requirements.split(',').map((r) => r.trim())\n : ['FR-001'];\n const ucList = options.useCases\n ? options.useCases.split(',').map((u) => u.trim())\n : ['UC-001'];\n\n const handoff: ProductHandoff = {\n id: `HOF-${changeId.toUpperCase()}`,\n type: 'handoff',\n title: options.title || `PDaC Handoff for ${changeId}`,\n changeId,\n version: '1.0.0',\n createdAt: new Date().toISOString(),\n subgraph: {\n requirements: reqList,\n useCases: ucList,\n },\n };\n return { handoff, reqList };\n}\n\nfunction printDepositSuccess(depositedPath: string, handoffId: string, reqList: string[]): void {\n console.log(` ${pc.green('✔')} Sidecar successfully deposited: ${pc.bold(depositedPath)}`);\n console.log(` Handoff ID: ${pc.cyan(handoffId)}`);\n console.log(` Delivered requirements: ${reqList.join(', ')}\\n`);\n}\n\nfunction emitDepositJson(\n success: boolean,\n changeId: string,\n framework: SddFramework,\n depositedPath?: string,\n handoff?: ProductHandoff,\n err?: unknown\n): void {\n const payload = {\n command: 'sdd:deposit',\n success,\n exitCode: success ? 0 : 1,\n changeId,\n framework,\n ...(depositedPath ? { depositedPath, handoff } : { error: err instanceof Error ? err.message : String(err) }),\n };\n console.log(JSON.stringify(payload, null, 2));\n}\n\nfunction printDepositHeader(changeId: string, framework: string): void {\n console.log(pc.bold(pc.cyan(`\\n📦 [AI-SDLC SDD] Depositing PDaC Handoff Sidecar for '${changeId}' (${framework})...`)));\n}\n\nfunction printDepositError(err: unknown): void {\n const errMessage = err instanceof Error ? err.message : String(err);\n console.error(pc.red(` ✖ Error depositing sidecar: ${errMessage}\\n`));\n}\n\nexport function runSddDeposit(options: SddDepositCliOptions): boolean {\n const rootDir = options.root || process.cwd();\n const changeId = options.change;\n const framework = options.framework || 'openspec';\n const useJson = isJsonOutput(options);\n const isSilent = Boolean(options.silent || useJson);\n\n if (!isSilent) {\n printDepositHeader(changeId, framework);\n }\n\n const { handoff, reqList } = buildHandoffPayload(options, changeId);\n\n try {\n const depositedPath = depositProductHandoffSidecar({ rootDir, changeId, framework, handoff });\n if (!isSilent) printDepositSuccess(depositedPath, handoff.id, reqList);\n if (useJson) emitDepositJson(true, changeId, framework, depositedPath, handoff);\n return true;\n } catch (err: unknown) {\n if (!isSilent) printDepositError(err);\n if (useJson) emitDepositJson(false, changeId, framework, undefined, undefined, err);\n return false;\n }\n}\n\nexport interface SddVerifyCliOptions {\n root?: string;\n framework?: SddFramework;\n checkDuplicates?: boolean;\n silent?: boolean;\n json?: boolean;\n format?: string;\n}\n\ninterface HandoffItem {\n id: string;\n changeDir: string;\n isValid: boolean;\n requirementsCount: number;\n}\n\nfunction printHandoffEntry(isValid: boolean, id: string, relDir: string, reqCount: number): void {\n if (isValid) {\n console.log(` ${pc.green('✔')} [${pc.bold(id)}] in ${relDir} (Requirements: ${reqCount})`);\n } else {\n console.log(` ${pc.red('✖')} [${pc.bold(id)}] in ${relDir} - Invalid handoff schema or subgraph.`);\n }\n}\n\nfunction processHandoffEntry(\n handoff: ProductHandoff,\n changeDir: string,\n rootDir: string,\n isSilent: boolean\n): HandoffItem {\n const relDir = path.relative(rootDir, changeDir).replace(/\\\\/g, '/');\n const reqCount = (handoff.subgraph && Array.isArray(handoff.subgraph.requirements))\n ? handoff.subgraph.requirements.length\n : 0;\n const isValid = Boolean(handoff.id && handoff.id.startsWith('HOF-') && reqCount > 0);\n const id = handoff.id || 'UNKNOWN';\n\n if (!isSilent) {\n printHandoffEntry(isValid, id, relDir, reqCount);\n }\n\n return { id, changeDir: relDir, isValid, requirementsCount: reqCount };\n}\n\nfunction auditHandoffsMap(\n handoffsMap: Map<string, { handoff: ProductHandoff; changeDir: string }>,\n rootDir: string,\n isSilent: boolean\n): { handoffItems: HandoffItem[]; validCount: number; invalidCount: number } {\n if (handoffsMap.size === 0) {\n if (!isSilent) {\n console.log(pc.yellow(' [NOTICE] No handoff.yaml sidecar companion files found in specs/.'));\n }\n return { handoffItems: [], validCount: 0, invalidCount: 0 };\n }\n\n const handoffItems: HandoffItem[] = [];\n let validCount = 0;\n let invalidCount = 0;\n\n for (const [, { handoff, changeDir }] of handoffsMap.entries()) {\n const item = processHandoffEntry(handoff, changeDir, rootDir, isSilent);\n handoffItems.push(item);\n if (item.isValid) {\n validCount++;\n } else {\n invalidCount++;\n }\n }\n return { handoffItems, validCount, invalidCount };\n}\n\nfunction auditDuplicatesShiftLeft(\n rootDir: string,\n checkDuplicates: boolean | undefined,\n isSilent: boolean\n): { duplicateErrors: number; duplicateIssues: DuplicateIssue[] } {\n if (checkDuplicates === false) {\n return { duplicateErrors: 0, duplicateIssues: [] };\n }\n const dupResult = verifyArtifactDuplicates({ rootDir });\n if (dupResult.errorCount > 0 && !isSilent) {\n console.log(pc.red(`\\n ✖ [Shift-Left Gate] Detected ${dupResult.errorCount} requirement collision(s)/duplicate(s) in workspace:`));\n for (const issue of dupResult.issues.filter((i) => i.severity === 'ERROR')) {\n console.log(` ${pc.red('✖')} [${issue.type}] ${issue.id} in ${issue.file}: ${issue.message}`);\n }\n }\n return { duplicateErrors: dupResult.errorCount, duplicateIssues: dupResult.issues };\n}\n\nfunction emitSddVerifyJson(payload: {\n isOk: boolean;\n totalFound: number;\n validCount: number;\n invalidCount: number;\n duplicateErrors: number;\n handoffItems: HandoffItem[];\n duplicateIssues: DuplicateIssue[];\n}): void {\n const jsonOutput = {\n command: 'sdd:verify',\n success: payload.isOk,\n exitCode: payload.isOk ? 0 : 1,\n totalHandoffs: payload.totalFound,\n validHandoffs: payload.validCount,\n invalidHandoffs: payload.invalidCount,\n duplicateErrors: payload.duplicateErrors,\n handoffs: payload.handoffItems,\n duplicateIssues: payload.duplicateIssues,\n };\n console.log(JSON.stringify(jsonOutput, null, 2));\n}\n\nfunction printSddVerifyVerdict(isOk: boolean): void {\n console.log(\n isOk\n ? pc.green('\\n✔ SDD Integration COMPLIANT: All sidecars and requirements are valid.\\n')\n : pc.red('\\n✖ SDD Integration BLOCKED: Non-compliant sidecars or duplicate requirements detected.\\n')\n );\n}\n\nfunction printSddVerifyHeader(totalFound: number): void {\n console.log(pc.bold(pc.cyan('\\n🔍 [AI-SDLC SDD] Verifying SDD Workspaces and Handoff Sidecars (HOF-*)...')));\n console.log(` Found PDaC sidecars: ${pc.bold(String(totalFound))}`);\n}\n\nexport function runSddVerify(options: SddVerifyCliOptions = {}): boolean {\n const rootDir = options.root || process.cwd();\n const useJson = isJsonOutput(options);\n const isSilent = Boolean(options.silent || useJson);\n\n const handoffsMap = scanAllProductHandoffs(rootDir);\n const totalFound = handoffsMap.size;\n if (!isSilent) {\n printSddVerifyHeader(totalFound);\n }\n\n const { handoffItems, validCount, invalidCount } = auditHandoffsMap(handoffsMap, rootDir, isSilent);\n const { duplicateErrors, duplicateIssues } = auditDuplicatesShiftLeft(rootDir, options.checkDuplicates, isSilent);\n\n const isOk = invalidCount === 0 && duplicateErrors === 0;\n if (!isSilent) {\n printSddVerifyVerdict(isOk);\n }\n\n if (useJson) {\n emitSddVerifyJson({ isOk, totalFound, validCount, invalidCount, duplicateErrors, handoffItems, duplicateIssues });\n }\n\n return isOk;\n}\n\nexport interface SddIntegrateCliOptions {\n root?: string;\n change?: string;\n all?: boolean;\n auto?: boolean;\n headRef?: string;\n prTitle?: string;\n prBody?: string;\n author?: string;\n autoArchive?: boolean;\n silent?: boolean;\n json?: boolean;\n format?: string;\n}\n\nfunction handleUndetectedChange(detection: ReturnType<typeof detectActiveChangeForIntegration>, isSilent: boolean, useJson: boolean): null {\n if (!isSilent) {\n console.log(pc.yellow('\\nℹ [AI-SDLC SDD] No active SDD change detected to integrate:'));\n for (const r of detection.reasons) console.log(` - ${r}`);\n console.log('');\n }\n if (useJson) {\n const payload = { command: 'sdd:integrate', success: false, exitCode: 1, reasons: detection.reasons, error: 'No active SDD change detected to integrate' };\n console.log(JSON.stringify(payload, null, 2));\n }\n return null;\n}\n\nfunction handlePendingTasks(detection: ReturnType<typeof detectActiveChangeForIntegration>, isSilent: boolean, useJson: boolean): null {\n if (!isSilent) {\n console.log(pc.red(`\\n✖ [AI-SDLC SDD] Detected change '${detection.changeId}' has pending tasks (${detection.completedTasksCount}/${detection.totalTasksCount} completed). All tasks must be in COMPLETED status.\\n`));\n }\n if (useJson) {\n const payload = {\n command: 'sdd:integrate', success: false, exitCode: 1, changeId: detection.changeId,\n completedTasksCount: detection.completedTasksCount, totalTasksCount: detection.totalTasksCount,\n error: `Detected change '${detection.changeId}' has pending tasks (${detection.completedTasksCount}/${detection.totalTasksCount} completed).`,\n };\n console.log(JSON.stringify(payload, null, 2));\n }\n return null;\n}\n\nfunction resolveAutoChange(\n options: SddIntegrateCliOptions,\n rootDir: string,\n isSilent: boolean,\n useJson: boolean\n): string | null {\n const detection = detectActiveChangeForIntegration({\n rootDir,\n headRef: options.headRef,\n prTitle: options.prTitle,\n prBody: options.prBody,\n });\n if (!detection.detected || !detection.changeId) {\n return handleUndetectedChange(detection, isSilent, useJson);\n }\n if (!detection.allTasksCompleted) {\n return handlePendingTasks(detection, isSilent, useJson);\n }\n if (!isSilent) {\n console.log(pc.cyan(` ✔ Automatically detected SDD change: ${pc.bold(detection.changeId)} (via ${detection.source})`));\n }\n return detection.changeId;\n}\n\nfunction resolveIntegrationChangeId(options: SddIntegrateCliOptions, rootDir: string, isSilent: boolean, useJson: boolean): string | null {\n const changeId = options.change || (options.auto ? resolveAutoChange(options, rootDir, isSilent, useJson) : null);\n if (!changeId) {\n if (!options.auto) {\n if (!isSilent) console.error(pc.red('\\n✖ Change identifier (--change <id>) or --auto option must be specified.\\n'));\n if (useJson) {\n console.log(JSON.stringify({ command: 'sdd:integrate', success: false, exitCode: 1, error: 'Change identifier (--change <id>) or --auto option must be specified.' }, null, 2));\n }\n }\n return null;\n }\n return changeId;\n}\n\nfunction printIntegrationSuccess(changeId: string, result: ReturnType<typeof integrateSddChange>): void {\n console.log(` ${pc.green('✔')} Change '${changeId}' successfully processed:`);\n console.log(` - Completed tasks: ${pc.bold(String(result.completedTasks.length))}`);\n console.log(` - Integrated requirements: ${pc.green(result.integratedRequirements.join(', ') || 'None')}`);\n console.log(` - Created canonical artifacts: ${pc.green(result.createdCanonicalArtifacts?.join(', ') || 'None')}`);\n console.log(` - Updated product artifacts: ${pc.green(result.updatedProductArtifacts.join(', ') || 'None')}`);\n console.log(` - Updated arc42 architecture: ${pc.green(result.updatedArchitectureArtifacts.join(', ') || 'None')}`);\n if (result.archived) {\n console.log(` - Archived to: ${pc.cyan(result.archivedPath || 'specs/changes/completed')}`);\n }\n console.log(pc.green('\\n✔ Canonical specification integration COMPLETED (EXIT 0)\\n'));\n}\n\nfunction printIntegrationFailure(changeId: string, errors: string[]): void {\n console.log(pc.red(`\\n✖ Failed to integrate change '${changeId}':`));\n for (const err of errors) console.log(` ${pc.red('✖')} ${err}`);\n console.log(pc.red('\\n✖ Integration BLOCKED (EXIT 1)\\n'));\n}\n\nfunction emitIntegrateJson(changeId: string, result: ReturnType<typeof integrateSddChange>): void {\n const payload = {\n command: 'sdd:integrate',\n success: result.success,\n exitCode: result.success ? 0 : 1,\n changeId,\n completedTasks: result.completedTasks,\n integratedRequirements: result.integratedRequirements,\n createdCanonicalArtifacts: result.createdCanonicalArtifacts ?? [],\n updatedProductArtifacts: result.updatedProductArtifacts,\n updatedArchitectureArtifacts: result.updatedArchitectureArtifacts,\n archived: result.archived,\n archivedPath: result.archivedPath,\n errors: result.errors,\n };\n console.log(JSON.stringify(payload, null, 2));\n}\n\nfunction printBatchIntegrationResult(result: ReturnType<typeof integrateAllSddChanges>): void {\n console.log(` ${pc.green('✔')} Processed changes: ${pc.bold(String(result.processedChanges.length))} (${result.processedChanges.join(', ') || 'None'})`);\n console.log(` ${pc.yellow('ℹ')} Skipped changes: ${pc.bold(String(result.skippedChanges.length))}`);\n console.log(` ${pc.green('✔')} Updated product artifacts: ${pc.green(result.updatedProductArtifacts.join(', ') || 'None')}`);\n console.log(` ${pc.green('✔')} Updated arc42 architecture: ${pc.green(result.updatedArchitectureArtifacts.join(', ') || 'None')}`);\n console.log(` ${pc.green('✔')} Synced PDaC SHA-256 digests: ${pc.cyan(String(result.syncedDigestsCount))}`);\n if (result.success) {\n console.log(pc.green('\\n✔ Batch canonical specification integration COMPLETED (EXIT 0)\\n'));\n } else {\n for (const err of result.errors) console.log(` ${pc.red('✖')} ${err}`);\n console.log(pc.red('\\n✖ Batch integration finished with errors (EXIT 1)\\n'));\n }\n}\n\nfunction emitBatchIntegrateJson(result: ReturnType<typeof integrateAllSddChanges>): void {\n const payload = {\n command: 'sdd:integrate:all',\n success: result.success,\n exitCode: result.success ? 0 : 1,\n processedChanges: result.processedChanges,\n skippedChanges: result.skippedChanges,\n updatedProductArtifacts: result.updatedProductArtifacts,\n updatedArchitectureArtifacts: result.updatedArchitectureArtifacts,\n createdCanonicalArtifacts: result.createdCanonicalArtifacts,\n syncedDigestsCount: result.syncedDigestsCount,\n errors: result.errors,\n };\n console.log(JSON.stringify(payload, null, 2));\n}\n\nfunction runBatchSddIntegrate(options: SddIntegrateCliOptions, rootDir: string, isSilent: boolean, useJson: boolean): boolean {\n if (!isSilent) {\n console.log(pc.bold(pc.cyan('\\n🔄 [AI-SDLC SDD] Consolidating all completed SDD changes into canonical specifications...')));\n }\n const result = integrateAllSddChanges({ rootDir, author: options.author, autoArchive: options.autoArchive });\n if (!isSilent) printBatchIntegrationResult(result);\n if (useJson) emitBatchIntegrateJson(result);\n return result.success;\n}\n\nexport function runSddIntegrate(options: SddIntegrateCliOptions): boolean {\n const rootDir = options.root || process.cwd();\n const useJson = isJsonOutput(options);\n const isSilent = Boolean(options.silent || useJson);\n if (options.all) {\n return runBatchSddIntegrate(options, rootDir, isSilent, useJson);\n }\n const changeId = resolveIntegrationChangeId(options, rootDir, isSilent, useJson);\n if (!changeId) return false;\n\n if (!isSilent) {\n console.log(pc.bold(pc.cyan(`\\n🔄 [AI-SDLC SDD] Integrating change '${changeId}' into canonical specification...`)));\n }\n\n const result = integrateSddChange({ rootDir, changeId, author: options.author, autoArchive: options.autoArchive });\n if (!isSilent) {\n if (result.success) printIntegrationSuccess(changeId, result);\n else printIntegrationFailure(changeId, result.errors);\n }\n if (useJson) emitIntegrateJson(changeId, result);\n return result.success;\n}\n\nexport interface ChangeNewCliOptions {\n root?: string;\n name: string;\n from?: string | string[];\n id?: string;\n profile?: ChangeProfile;\n framework?: SddFramework;\n author?: string;\n silent?: boolean;\n json?: boolean;\n format?: string;\n}\n\nfunction printChangeNewSuccess(result: ReturnType<typeof scaffoldSddChange>): void {\n console.log(` ${pc.green('✔')} Change directory: ${pc.bold(result.changeDir)}`);\n console.log(` ${pc.green('✔')} SDD Change ID: ${pc.cyan(result.canonicalId)} (${result.changeId})`);\n console.log(` ${pc.green('✔')} Risk profile: ${pc.magenta(result.profile || 'standard')}`);\n if (result.productArtifactCreated) {\n console.log(` ${pc.green('✔')} Product artifact: ${pc.bold(result.productArtifactCreated)} (status: draft)`);\n }\n console.log(` ${pc.green('✔')} Cited artifacts: ${result.citedArtifacts.length}`);\n for (const cite of result.citedArtifacts) {\n console.log(` - [${pc.cyan(cite.id)}] ${cite.digest.substring(0, 19)}... (${cite.title || 'Untitled'})`);\n }\n console.log(` ${pc.green('✔')} Generated files: ${result.createdFiles.length}`);\n console.log(pc.green('\\n✔ SDD change successfully initialized and validated.\\n'));\n}\n\nfunction printChangeNewFailure(name: string, errors: string[]): void {\n console.log(pc.red(`\\n✖ Failed to create SDD change '${name}':`));\n for (const err of errors) console.log(` ${pc.red('✖')} ${err}`);\n console.log(pc.red('\\n✖ Change creation BLOCKED\\n'));\n}\n\nfunction emitChangeNewJson(name: string, result: ReturnType<typeof scaffoldSddChange>): void {\n const payload = {\n command: 'change:new',\n success: result.success,\n exitCode: result.success ? 0 : 1,\n name,\n canonicalId: result.canonicalId,\n changeId: result.changeId,\n changeDir: result.changeDir,\n profile: result.profile,\n createdFiles: result.createdFiles,\n productArtifactCreated: result.productArtifactCreated,\n citedArtifacts: result.citedArtifacts,\n errors: result.errors,\n };\n console.log(JSON.stringify(payload, null, 2));\n}\n\nfunction printChangeNewHeader(name: string, framework: string): void {\n console.log(pc.bold(pc.cyan(`\\n📦 [AI-SDLC SDD] Scaffolding new SDD change '${name}' (${framework})...`)));\n}\n\nfunction handleScaffoldOutput(name: string, result: ReturnType<typeof scaffoldSddChange>, isSilent: boolean, useJson: boolean): void {\n if (!isSilent) {\n if (result.success) printChangeNewSuccess(result);\n else printChangeNewFailure(name, result.errors);\n }\n if (useJson) emitChangeNewJson(name, result);\n}\n\nexport function runChangeNew(options: ChangeNewCliOptions): boolean {\n const rootDir = options.root || process.cwd();\n const name = options.name;\n const framework = options.framework || 'openspec';\n const useJson = isJsonOutput(options);\n const isSilent = Boolean(options.silent || useJson);\n\n if (!isSilent) {\n printChangeNewHeader(name, framework);\n }\n\n const result = scaffoldSddChange({\n rootDir,\n name,\n changeId: options.id,\n profile: options.profile,\n from: options.from,\n framework,\n author: options.author,\n silent: isSilent,\n });\n\n handleScaffoldOutput(name, result, isSilent, useJson);\n return result.success;\n}\n"],"mappings":";;;AAKA,SAAS,eAAe;AACxB,OAAOA,UAAQ;AACf,SAAS,iCAAiC;;;ACF1C,YAAY,QAAQ;AACpB,YAAYC,WAAU;AACtB,OAAOC,SAAQ;AAC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,KAAK;AAAA,IACX,QAAQ,KAAK;AAAA,IACb,MAAM,KAAK;AAAA,EACb,CAAC;AACD,MAAI,CAAC,GAAI,SAAQ,KAAK,CAAC;AACzB,CAAC;AAGH,QACG,QAAQ,SAAS,EACjB,YAAY,+EAA+E,EAC3F,OAAO,qBAAqB,2BAA2B,EACvD,OAAO,aAAa,6CAA6C,EACjE,OAAO,eAAe,8BAA8B,EACpD,OAAO,eAAe,wDAAwD,EAC9E,OAAO,4BAA4B,yDAAyD,EAC5F,OAAO,UAAU,iCAAiC,EAClD,OAAO,iBAAiB,wBAAwB,EAChD,OAAO,OAAO,SAAS;AACtB,QAAM,WAAW,MAAM,WAAW;AAAA,IAChC,MAAM,KAAK;AAAA,IACX,QAAQ,KAAK;AAAA,IACb,QAAQ,KAAK;AAAA,IACb,OAAO,KAAK;AAAA,IACZ,sBAAsB,KAAK;AAAA,IAC3B,MAAM,KAAK;AAAA,IACX,SAAS,KAAK;AAAA,EAChB,CAAC;AACD,UAAQ,KAAK,QAAQ;AACvB,CAAC;AAGH,QAAQ,GAAG,aAAa,MAAM;AAC5B,UAAQ,MAAME,KAAG,IAAI;AAAA,gCAAmC,QAAQ,KAAK,KAAK,GAAG,CAAC,EAAE,CAAC;AACjF,UAAQ,IAAIA,KAAG,OAAO,kDAAkD,CAAC;AACzE,UAAQ,KAAK,CAAC;AAChB,CAAC;AAED,QAAQ,MAAM,QAAQ,IAAI;","names":["pc","path","pc","checkGherkinInSync","verifyArtifactDuplicates","verifyArtifactsSchemas","verifyLicenses","verifyPdacGraph","verifyPrivacy","verifyProgressiveFriction","verifyQualityGate","verifySast","verifySecrets","verifyTasksGovernance","verifyTestingCoverage","verifyTraceability","checkGherkinInSync","pc","verifyPdacGraph","verifyQualityGate","verifyTraceability","verifyTasksGovernance","verifyTestingCoverage","verifyLicenses","verifyArtifactsSchemas","verifySecrets","verifySast","verifyArtifactDuplicates","verifyProgressiveFriction","verifyPrivacy","pc","readline","pc","extractGherkinFeatures","scaffoldGherkinSteps","pc","extractGherkinFeatures","resolve","scaffoldGherkinSteps","pc","readline","pc","pc","fs","pc","pc","path","pc","pc","isJsonOutput","path","pc","path","pc","verifyArtifactDuplicates","pc","verifyArtifactDuplicates","pc"]}