/**
 * C++ Toolchain capability manifest
 * Registered via CapabilityRegistry per DD §15.
 * INV-4: registered via capability boundary, not direct runtime import.
 *
 * @module packages/toolchain-cpp/src/capability
 */

import type { CapabilityManifestV1 } from '@aircoding/contracts'

export const CPP_TOOLCHAIN_CAPABILITY: CapabilityManifestV1 = {
  schema_version: 1,
  name: 'aircoding-cpp-toolchain',
  version: '1.0.0-alpha',
  description: 'C++ build and analysis toolchain for AirCoding',
  trust_level: 'local',
  tools: [
    {
      name: 'cpp.detect', version: 1,
      description: 'Detect C++ project structure and toolchain',
      category: 'debug' as const,
      permissions: { read_paths: { allow: ['*'] }, execute: false, network: false },
      input_schema: { type: 'object', properties: { project_root: { type: 'string' } } },
      output_schema: { type: 'object', properties: {} }
    },
    {
      name: 'cpp.configure', version: 1,
      description: 'Configure C++ build with CMake',
      category: 'build' as const,
      permissions: { read_paths: { allow: ['*'] }, write_paths: { allow: ['build/**'] }, execute: true, network: false },
      input_schema: { type: 'object', properties: { generator: { type: 'string' }, build_type: { type: 'string' } } },
      output_schema: { type: 'object', properties: {} }
    },
    {
      name: 'cpp.build', version: 1,
      description: 'Build C++ project with CMake',
      category: 'build' as const,
      permissions: { read_paths: { allow: ['*'] }, write_paths: { allow: ['build/**'] }, execute: true, network: false },
      input_schema: { type: 'object', properties: { target: { type: 'string' } } },
      output_schema: { type: 'object', properties: {} }
    },
    {
      name: 'cpp.test', version: 1,
      description: 'Run C++ tests via ctest',
      category: 'test' as const,
      permissions: { read_paths: { allow: ['*'] }, execute: true, network: false },
      input_schema: { type: 'object', properties: {} },
      output_schema: { type: 'object', properties: {} }
    },
    {
      name: 'cpp.cppcheck', version: 1,
      description: 'Run cppcheck static analysis with exhaustive branch checking',
      category: 'static_analysis' as const,
      permissions: { read_paths: { allow: ['*'] }, execute: true, network: false },
      input_schema: { type: 'object', properties: { enable_all: { type: 'boolean' }, check_config: { type: 'boolean' } } },
      output_schema: { type: 'object', properties: {} }
    },
    {
      name: 'cpp.clangd', version: 1,
      description: 'Query clangd LSP for symbol/diagnostic info',
      category: 'static_analysis' as const,
      permissions: { read_paths: { allow: ['*'] }, execute: true, network: false },
      input_schema: { type: 'object', properties: { file: { type: 'string' }, line: { type: 'number' }, column: { type: 'number' } } },
      output_schema: { type: 'object', properties: {} }
    }
  ]
}
