{"version":3,"file":"cli.cjs","names":["R","Option","SupportedMethods","NullCacheStore","FileSystemCacheStore","Compiler","Argument","Option","SupportedMethods","Compiler","fs","Compiler","Option","SupportedMethods","Compiler","Option","Compiler","ConfigNotFoundException","FileSystemCacheStore","Compiler","fs","Matcher","CONFIG_FILENAMES","fs","fs","yaml","McpServer","z","Compiler","fs","StdioServerTransport","fs","FileSystemCacheStore","Option","SupportedMethods","Compiler","Command"],"sources":["../src/utils/xprod-merge.ts","../src/commands/utils/xprod-filter-rules.ts","../src/utils/get-cache-dir.ts","../src/commands/build.ts","../src/commands/filter.ts","../src/utils/scan-generated-files.ts","../src/commands/list.ts","../src/commands/apis.ts","../src/commands/mock.ts","../src/commands/init.ts","../src/search/embedder.ts","../src/search/search-engine.ts","../src/commands/search.ts","../src/mcp/compiler-provider.ts","../src/mcp/find-config-in-dir.ts","../src/mcp/compiler-provider-registry.ts","../src/mcp/discover-projects.ts","../src/commands/mcp.ts","../src/commands/cache.ts","../src/commands/describe.ts","../src/cli.ts"],"sourcesContent":["import * as R from 'ramda'\n\n// 定义一个能推断多个对象合并结果的类型工具\ntype MergeAll<T extends unknown[]> = T extends [infer F, ...infer R]\n  ? F & MergeAll<R>\n  : Record<string, never>\n\n/**\n * 对多个对象数组执行笛卡尔积合并\n * @example\n * xprodMerge([{ a: 1 }, { a: 2 }], [{b: 1}], [{ c: 1 }])\n * // => [{ a: 1, b: 1, c: 1}, { a: 2, b:1, c: 1 }]\n */\nexport function xprodMerge<T extends object[]>(\n  ...lists: { [K in keyof T]: T[K][] }\n): MergeAll<T>[] {\n  if (lists.length === 0) return [] as MergeAll<T>[]\n  if (lists.length === 1) return lists[0] as MergeAll<T>[]\n\n  // 使用 reduce 和 R.chain 对所有数组执行笛卡尔积操作，并合并每个组合的对象\n  // eslint-disable-next-line @typescript-eslint/no-explicit-any\n  const result = lists.reduce((acc: any[], curr: any[]) => R.chain((item1: Record<string, unknown>) => R.map((item2: Record<string, unknown>) => R.mergeAll([item1, item2]), curr), acc)) as MergeAll<T>[]\n\n  return result\n}\n","import { xprodMerge } from '../../utils/xprod-merge.js'\nimport type { FilterRule } from '../../utils/matcher.js'\n\nexport function xprodFilterRules(options: { module?: string[]; method?: string; pathname?: string; persist?: boolean }): FilterRule[] {\n  return xprodMerge(\n    (options.module || ['*']).map((moduleName) => ({ deny: false, persist: options.persist, moduleName })),\n    options.method ? [{ operationMethod: options.method.toLowerCase() }] : [{ operationMethod: '*' }],\n    options.pathname ? [{ operationPathname: options.pathname }] : [{ operationPathname: '/**' }],\n  ) as unknown as FilterRule[]\n}\n","import path from 'path'\nimport os from 'os'\nimport { createHash } from 'crypto'\n\nconst APP_NAME = 'keq-request'\nconst SUB_DIR = 'cli'\nconst CACHE_VERSION = 'v5'\n\nfunction getBaseCacheDir(): string {\n  const platform = process.platform\n\n  if (platform === 'darwin') {\n    return path.join(os.homedir(), 'Library', 'Caches', APP_NAME, SUB_DIR, CACHE_VERSION)\n  }\n\n  if (platform === 'win32') {\n    const localAppData = process.env.LOCALAPPDATA || path.join(os.homedir(), 'AppData', 'Local')\n    return path.join(localAppData, APP_NAME, SUB_DIR, 'Cache', CACHE_VERSION)\n  }\n\n  const xdgCache = process.env.XDG_CACHE_HOME || path.join(os.homedir(), '.cache')\n  return path.join(xdgCache, APP_NAME, SUB_DIR, CACHE_VERSION)\n}\n\nfunction hashProjectPath(projectDir: string): string {\n  return createHash('sha256')\n    .update(projectDir)\n    .digest('hex')\n    .slice(0, 16)\n}\n\nexport function getCacheDir(projectDir: string): string {\n  return path.join(getBaseCacheDir(), hashProjectPath(projectDir))\n}\n\nexport function getAllCacheDir(): string {\n  return getBaseCacheDir()\n}\n","import { Command, Option } from 'commander'\nimport { SupportedMethods } from '../constants/supported-methods.js'\nimport { Compiler } from '../compiler/compiler.js'\nimport { FileSystemCacheStore, NullCacheStore } from '../cache-store/index.js'\nimport type { CacheStore } from '../cache-store/index.js'\nimport type { FilterRule } from '../utils/matcher.js'\nimport { xprodFilterRules } from './utils/xprod-filter-rules.js'\nimport { getCacheDir } from '../utils/get-cache-dir.js'\n\nexport function registerBuildCommand(program: Command): void {\n  program\n    .command('build')\n    .description('Build and generate API client code from OpenAPI/Swagger specifications')\n    .option('-c --config <config>', 'The keq-cli config file')\n    .option('--module <modules...>', 'Filter module(s) to generate')\n    .option('--debug', 'Print debug information')\n    .option('--tolerant', 'Tolerate wrong swagger/openapi structure')\n    .option('--fresh', 'Clean the output directory before building')\n    .option('--no-cache', 'Disable download caching')\n    .option('-i --interactive', 'Interactive select the scope of generation')\n    .addOption(\n      new Option('--method <method>', 'Only generate files of the specified operation method')\n        .choices([\n          ...SupportedMethods,\n          ...SupportedMethods.map((method) => method.toUpperCase()),\n        ]),\n    )\n    .option('--pathname <pathname>', 'Only generate files of the specified operation pathname')\n    .action(async (options) => {\n      const filterRules: FilterRule[] = []\n\n      if (options.module || options.method || options.pathname) {\n        filterRules.push(\n          {\n            deny: true,\n            persist: false,\n            moduleName: '*',\n            operationMethod: '*',\n            operationPathname: '/**',\n          },\n          ...xprodFilterRules({\n            module: options.module,\n            method: options.method,\n            pathname: options.pathname,\n            persist: false,\n          }),\n        )\n      } else if (options.interactive) {\n        filterRules.push({\n          deny: true,\n          persist: false,\n          moduleName: '*',\n          operationMethod: '*',\n          operationPathname: '/**',\n        })\n      }\n\n      let cacheStore: CacheStore\n      if (options.cache === false) {\n        cacheStore = new NullCacheStore()\n      } else {\n        cacheStore = new FileSystemCacheStore(getCacheDir(process.cwd()))\n        if (options.fresh) {\n          await cacheStore.clear()\n        }\n      }\n\n      const compiler = new Compiler({\n        build: true,\n        persist: true,\n        fresh: !!options.fresh,\n        config: options.config,\n        debug: !!options.debug,\n        tolerant: !!options.tolerant,\n        interactive: !!options.interactive && { mode: 'allow' },\n        cacheStore,\n        filter: filterRules.length > 0\n          ? { rules: filterRules }\n          : undefined,\n      })\n\n      await compiler.run()\n    })\n}\n","import { Argument, Command, Option } from 'commander'\nimport { SupportedMethods } from '../constants/supported-methods.js'\nimport { Compiler } from '../compiler/compiler.js'\n\nexport function registerFilterCommand(program: Command): void {\n  program\n    .command('filter')\n    .description('Manage filter rules for API generation using .keqfilter file')\n    .addArgument(\n      new Argument('<mode>', 'The filter mode')\n        .choices(['all', 'deny', 'allow'])\n        .argRequired(),\n    )\n    .option('-c --config <config>', 'The keq-cli config file')\n    .option('--debug', 'Print debug information')\n    .option('--tolerant', 'Tolerate wrong swagger/openapi structure')\n    .option('--module <modules...>')\n    .option('--build', 'Build after updating .keqfilter file')\n    .addOption(\n      new Option('--method <method>', 'Only generate files of the specified operation method')\n        .choices([\n          ...SupportedMethods,\n          ...SupportedMethods.map((method) => method.toUpperCase()),\n        ]),\n    )\n    .option('--pathname <pathnames>', 'Only generate files of the specified operation pathname')\n    .option('-i --interactive', 'Interactive select the scope of generation')\n    .action(async (mode, options) => {\n      let compiler: Compiler\n\n      if (mode === 'all') {\n        if (options.build) throw new Error(\"'--build' cannot be used with 'all' mode\")\n        if (options.interactive) throw new Error(\"'--interactive' cannot be used with 'all' mode\")\n        if (options.module) throw new Error(\"'--module' cannot be used with 'all' mode\")\n        if (options.method) throw new Error(\"'--method' cannot be used with 'all' mode\")\n        if (options.pathname) throw new Error(\"'--pathname' cannot be used with 'all' mode\")\n\n        compiler = new Compiler({\n          build: false,\n          persist: true,\n          config: options.config,\n          debug: !!options.debug,\n          tolerant: !!options.tolerant,\n          interactive: false,\n          filter: {\n            rules: [{\n              persist: true,\n              deny: true,\n              moduleName: '*',\n              operationMethod: '*',\n              operationPathname: '/**',\n            }],\n          },\n        })\n      } else if (options.interactive) {\n        if (options.interactive) {\n          if (options.method) throw new Error(\"'--method' cannot be used with '--interactive'\")\n          if (options.pathname) throw new Error(\"'--pathname' cannot be used with '--interactive'\")\n        }\n\n        compiler = new Compiler({\n          build: !!options.build,\n          persist: true,\n          config: options.config,\n          debug: !!options.debug,\n          tolerant: !!options.tolerant,\n          interactive: {\n            mode,\n            persist: true,\n          },\n          filter: {\n            rules: [{\n              persist: false,\n              deny: true,\n              moduleName: '*',\n              operationMethod: '*',\n              operationPathname: '/**',\n            }],\n          },\n        })\n      } else {\n        if (!options.method && !options.pathname) {\n          throw new Error(\"at least one of '-i --interactive', '--method' or '--pathname' must be specified\")\n        }\n\n        const moduleNames = options.module || ['*']\n\n        compiler = new Compiler({\n          build: !!options.build,\n          persist: true,\n          config: options.config,\n          debug: !!options.debug,\n          tolerant: !!options.tolerant,\n          filter: {\n            rules: moduleNames.map((moduleNames) => ({\n              persist: true,\n              deny: mode === 'deny',\n              moduleName: moduleNames,\n              operationMethod: options.method,\n              operationPathname: options.pathname,\n            })),\n          },\n          interactive: false,\n        })\n      }\n\n      await compiler.run()\n    })\n}\n","import * as path from 'path'\nimport fs from 'fs-extra'\n\nexport interface GeneratedFile {\n  /** Absolute path to the file */\n  absolutePath: string\n  /** Relative path from outdir */\n  relativePath: string\n}\n\n/**\n * Recursively find all files in a directory\n */\nasync function findAllFiles(dir: string, extensions?: string[]): Promise<string[]> {\n  const results: string[] = []\n\n  async function scan(currentDir: string): Promise<void> {\n    let entries: string[]\n    try {\n      entries = await fs.readdir(currentDir)\n    } catch (err) {\n      // Skip directories that can't be read\n      return\n    }\n\n    for (const entry of entries) {\n      // Skip node_modules and .git directories\n      if (entry === 'node_modules' || entry === '.git') {\n        continue\n      }\n\n      const fullPath = path.join(currentDir, entry)\n      let stat: fs.Stats\n      try {\n        stat = await fs.stat(fullPath)\n      } catch (err) {\n        // Skip entries that can't be stat'd\n        continue\n      }\n\n      if (stat.isDirectory()) {\n        await scan(fullPath)\n      } else if (stat.isFile()) {\n        if (!extensions) {\n          // If no extensions specified, include all files\n          results.push(fullPath)\n        } else {\n          const ext = path.extname(fullPath)\n          if (extensions.includes(ext)) {\n            results.push(fullPath)\n          }\n        }\n      }\n    }\n  }\n\n  await scan(dir)\n  return results\n}\n\n/**\n * Scan all files in the output directory\n * @param outdir The output directory to scan\n * @returns List of all files with their paths\n */\nasync function scanAllFiles(outdir: string): Promise<GeneratedFile[]> {\n  const absoluteOutdir = path.resolve(outdir)\n\n  // Check if outdir exists\n  if (!await fs.exists(absoluteOutdir)) {\n    return []\n  }\n\n  // Find all files in outdir (no extension filter)\n  const files = await findAllFiles(absoluteOutdir)\n\n  return files.map((file) => ({\n    absolutePath: file,\n    relativePath: path.relative(absoluteOutdir, file),\n  }))\n}\n\n/**\n * Find invalid files that are not in the current artifacts list\n * This includes both non-generated files and outdated generated files\n * @param outdir The output directory\n * @param validFilePaths List of valid file paths (relative to outdir)\n * @returns List of invalid files\n */\nexport async function findInvalidFiles(\n  outdir: string,\n  validFilePaths: string[],\n): Promise<GeneratedFile[]> {\n  const allFiles = await scanAllFiles(outdir)\n  const validPathsSet = new Set(validFilePaths.map((p) => path.normalize(p)))\n\n  return allFiles.filter((file) => {\n    const normalizedPath = path.normalize(file.relativePath)\n    return !validPathsSet.has(normalizedPath)\n  })\n}\n","import * as path from 'path'\nimport { Command } from 'commander'\nimport { Compiler } from '../compiler/compiler.js'\nimport { findInvalidFiles } from '../utils/scan-generated-files.js'\n\nexport function registerListCommand(program: Command): void {\n  program\n    .command('list')\n    .description('List generated files based on current configuration')\n    .option('-c --config <config>', 'The keq-cli config file')\n    .option('--invalid', 'List only invalid generated files (files not in current build)')\n    .option('--debug', 'Print debug information')\n    .option('--tolerant', 'Tolerate wrong swagger/openapi structure')\n    .action(async (options) => {\n      const compiler = new Compiler({\n        build: true,\n        persist: false,\n        silent: true,\n        config: options.config,\n        debug: !!options.debug,\n        tolerant: !!options.tolerant,\n      })\n\n      await compiler.run()\n\n      const context = compiler.context\n\n      if (!context.rc) {\n        throw new Error('Failed to load configuration')\n      }\n\n      if (options.invalid) {\n        const validFilePaths = (context.artifacts || []).map((artifact) => artifact.filepath)\n        const invalidFiles = await findInvalidFiles(context.rc.outdir, validFilePaths)\n\n        for (const file of invalidFiles) {\n          const fullPath = path.relative(process.cwd(), path.join(context.rc.outdir, file.relativePath))\n          console.log(fullPath)\n        }\n      } else {\n        const artifacts = context.artifacts || []\n\n        for (const artifact of artifacts) {\n          const fullPath = path.relative(process.cwd(), path.join(context.rc.outdir, artifact.filepath))\n          console.log(fullPath)\n        }\n      }\n    })\n}\n","import { Command, Option } from 'commander'\nimport { SupportedMethods } from '../constants/supported-methods.js'\nimport { Compiler } from '../compiler/compiler.js'\nimport type { FilterRule } from '../utils/matcher.js'\nimport { xprodFilterRules } from './utils/xprod-filter-rules.js'\n\nexport function registerApisCommand(program: Command): void {\n  program\n    .command('apis')\n    .description('List API operations and components from OpenAPI/Swagger specifications')\n    .option('-c --config <config>', 'The keq-cli config file')\n    .option('--tolerant', 'Tolerate wrong swagger/openapi structure')\n    .addOption(\n      new Option('--includes <includes...>', 'Include specific parts')\n        .choices(['operations', 'components']),\n    )\n    .option('--module <modules...>', 'Filter module(s) to list')\n    .addOption(\n      new Option('--method <method>', 'Only generate files of the specified operation method')\n        .choices([\n          ...SupportedMethods,\n          ...SupportedMethods.map((method) => method.toUpperCase()),\n        ]),\n    )\n    .option('--pathname <pathnames>', 'Only generate files of the specified operation pathname')\n    .addOption(\n      new Option('--format <format>', 'Output format')\n        .choices(['compact', 'json']),\n    )\n    .option('--json', 'Output in JSON format (shortcut for --format json)')\n    .option('--all', 'Ignore .keqfilter rules and show all modules/operations')\n    .option('--debug', 'Print debug information')\n    .action(async (options) => {\n      if (options.all && (options.module || options.method || options.pathname)) {\n        throw new Error(\"'--all' cannot be used with '--module', '--method', or '--pathname'\")\n      }\n\n      const filterRules: FilterRule[] = []\n\n      if (options.module || options.method || options.pathname) {\n        filterRules.push(\n          {\n            deny: true,\n            persist: false,\n            moduleName: '*',\n            operationMethod: '*',\n            operationPathname: '/**',\n          },\n          ...xprodFilterRules({\n            module: options.module,\n            method: options.method,\n            pathname: options.pathname,\n            persist: false,\n          }),\n        )\n      }\n\n\n      const compiler = new Compiler({\n        build: true,\n        persist: false,\n        silent: true,\n        config: options.config,\n        debug: !!options.debug,\n        tolerant: !!options.tolerant,\n        filter: options.all\n          ? false\n          : filterRules.length > 0\n            ? { rules: filterRules }\n            : undefined,\n      })\n\n      await compiler.run()\n\n      const context = compiler.context\n      const documents = context.documents || []\n\n      const includesList = options.includes || ['operations', 'components']\n      const includeOperations = includesList.includes('operations')\n      const includeComponents = includesList.includes('components')\n\n      const result = documents.map((document) => {\n        const item: {\n          module: string\n          operations?: Array<{ method: string; path: string; operationId: string; summary: string; description: string }>\n          components?: { schemas: Array<{ name: string; description: string }> }\n        } = {\n          module: document.module.name,\n        }\n\n        if (includeOperations) {\n          item.operations = document.operations.map((operation) => ({\n            method: operation.method.toUpperCase(),\n            path: operation.pathname,\n            operationId: operation.operationId,\n            summary: operation.operation.summary || '',\n            description: operation.operation.description || '',\n          }))\n        }\n\n        if (includeComponents) {\n          item.components = {\n            schemas: document.schemas.map((schema) => {\n              const schemaObj = schema.schema as { description?: string }\n              return {\n                name: schema.name,\n                description: schemaObj.description || '',\n              }\n            }),\n          }\n        }\n\n        return item\n      })\n\n      const format = options.format || (options.json ? 'json' : undefined)\n\n      if (format === 'json') {\n        console.log(JSON.stringify(result, null, 2))\n      } else if (format === 'compact') {\n        for (const item of result) {\n          console.log(`\\nModule: ${item.module}`)\n          console.log('─'.repeat(70))\n\n          if (includeOperations) {\n            console.log('\\n  APIs:')\n            if (!item.operations || item.operations.length === 0) {\n              console.log('    (No APIs)')\n            } else {\n              for (const operation of item.operations) {\n                const method = operation.method.padEnd(7)\n                const desc = operation.summary || operation.description\n                const descText = desc ? `  ${desc}` : ''\n                console.log(`    ${method} ${operation.path}${descText}`)\n              }\n            }\n          }\n\n          if (includeComponents) {\n            console.log('\\n  Schemas:')\n            if (!item.components || item.components.schemas.length === 0) {\n              console.log('    (No Schemas)')\n            } else {\n              for (const schema of item.components.schemas) {\n                const desc = schema.description ? `  ${schema.description}` : ''\n                console.log(`    ${schema.name}${desc}`)\n              }\n            }\n          }\n        }\n\n        const totalApis = result.reduce((sum, item) => sum + (item.operations?.length || 0), 0)\n        const totalSchemas = result.reduce((sum, item) => sum + (item.components?.schemas.length || 0), 0)\n        console.log('\\n' + '─'.repeat(70))\n        const parts = [`${result.length} modules`]\n        if (includeOperations) parts.push(`${totalApis} APIs`)\n        if (includeComponents) parts.push(`${totalSchemas} Schemas`)\n        console.log(`Total: ${parts.join(', ')}`)\n      } else {\n        for (const item of result) {\n          console.log(`\\nModule: ${item.module}`)\n          console.log('─'.repeat(70))\n\n          if (includeOperations) {\n            console.log('\\n  APIs:')\n            if (!item.operations || item.operations.length === 0) {\n              console.log('    (No APIs)')\n            } else {\n              for (const operation of item.operations) {\n                const method = operation.method.padEnd(7)\n                console.log(`    ${method} ${operation.path}`)\n                const desc = operation.summary || operation.description\n                if (desc) {\n                  console.log(`    ${desc}`)\n                }\n              }\n            }\n          }\n\n          if (includeComponents) {\n            console.log('\\n  Schemas:')\n            if (!item.components || item.components.schemas.length === 0) {\n              console.log('    (No Schemas)')\n            } else {\n              for (const schema of item.components.schemas) {\n                console.log(`    ${schema.name}`)\n                if (schema.description) {\n                  console.log(`    ${schema.description}`)\n                }\n              }\n            }\n          }\n        }\n\n        const totalApis = result.reduce((sum, item) => sum + (item.operations?.length || 0), 0)\n        const totalSchemas = result.reduce((sum, item) => sum + (item.components?.schemas.length || 0), 0)\n        console.log('\\n' + '─'.repeat(70))\n        const parts = [`${result.length} modules`]\n        if (includeOperations) parts.push(`${totalApis} APIs`)\n        if (includeComponents) parts.push(`${totalSchemas} Schemas`)\n        console.log(`Total: ${parts.join(', ')}`)\n      }\n    })\n}\n","import { Command } from 'commander'\n\nexport function registerMockCommand(program: Command): void {\n  program\n    .command('mock')\n    .description('Start a mock server based on OpenAPI specifications')\n    .option('-c --config <config>', 'The keq-cli config file')\n    .option('-p --port <port>', 'Port to listen on', '3939')\n    .option('--host <host>', 'Host to bind to', 'localhost')\n    .option('--module <modules...>', 'Filter module(s) to mock')\n    .option('--cors', 'Enable CORS headers', true)\n    .option('--delay <delay>', 'Response delay in ms (or min-max range like \"100-500\")')\n    .option('--max-depth <depth>', 'Max schema depth for mock data generation', '10')\n    .option('--ref-depth <depth>', 'Max $ref recursion depth for circular schemas', '5')\n    .option('--debug', 'Print debug information')\n    .option('--tolerant', 'Tolerate wrong swagger/openapi structure')\n    .action(async (options) => {\n      const { mockCommand } = await import('../mock/mock-command.js')\n      await mockCommand(options)\n    })\n}\n","import { Command } from 'commander'\n\nexport function registerInitCommand(program: Command): void {\n  program\n    .command('init')\n    .description('Initialize keq configuration file')\n    .option('-f --force', 'Force overwrite existing config file')\n    .action(async (options) => {\n      const { initConfig } = await import('../init.js')\n      await initConfig(options)\n    })\n}\n","import path from 'path'\nimport os from 'os'\nimport type { FeatureExtractionPipeline } from '@huggingface/transformers'\n\nconst MODEL_NAME = 'intfloat/multilingual-e5-small'\nconst CACHE_DIR = path.join(os.homedir(), '.cache', 'keq', 'models')\n\nlet transformers: typeof import('@huggingface/transformers') | null = null\nlet loadError: Error | null = null\nlet extractor: FeatureExtractionPipeline | null = null\n\nexport class EmbedderUnavailableError extends Error {\n  constructor(cause?: Error) {\n    super(\n      '@huggingface/transformers is not installed. Semantic search is unavailable.\\n' +\n      'Run `pnpm add @huggingface/transformers` to enable this feature.',\n    )\n    this.name = 'EmbedderUnavailableError'\n    if (cause) this.cause = cause\n  }\n}\n\nasync function loadTransformers(): Promise<typeof import('@huggingface/transformers')> {\n  if (transformers) return transformers\n  if (loadError) throw new EmbedderUnavailableError(loadError)\n  try {\n    transformers = await import('@huggingface/transformers')\n    return transformers\n  } catch (e) {\n    loadError = e instanceof Error ? e : new Error(String(e))\n    throw new EmbedderUnavailableError(loadError)\n  }\n}\n\nexport async function getEmbedder(): Promise<FeatureExtractionPipeline> {\n  if (extractor) return extractor\n\n  const { pipeline, env } = await loadTransformers()\n\n  env.cacheDir = CACHE_DIR\n  env.allowLocalModels = true\n\n  extractor = await pipeline('feature-extraction', MODEL_NAME, {\n    dtype: 'fp32',\n  })\n\n  return extractor\n}\n\nexport async function embed(texts: string[]): Promise<Float32Array[]> {\n  const extractor = await getEmbedder()\n  const prefixed = texts.map((t) => `query: ${t}`)\n  const output = await extractor(prefixed, { pooling: 'mean', normalize: true })\n  const data = output.tolist() as number[][]\n  return data.map((vec) => new Float32Array(vec))\n}\n\nexport async function embedDocuments(texts: string[]): Promise<Float32Array[]> {\n  const extractor = await getEmbedder()\n  const prefixed = texts.map((t) => `passage: ${t}`)\n  const output = await extractor(prefixed, { pooling: 'mean', normalize: true })\n  const data = output.tolist() as number[][]\n  return data.map((vec) => new Float32Array(vec))\n}\n\nexport function cosineSimilarity(a: Float32Array, b: Float32Array): number {\n  let dot = 0\n  for (let i = 0; i < a.length; i++) {\n    dot += a[i] * b[i]\n  }\n  return dot\n}\n","import type { ApiDocumentV3_1 } from '~/models/api-document_v3_1.js'\nimport type { IndexedOperation, SearchResult, SearchResultDetail } from './types.js'\nimport { embed, embedDocuments, cosineSimilarity } from './embedder.js'\n\nexport class SearchEngine {\n  private operations: IndexedOperation[]\n  private embeddingsReady = false\n\n  /**\n   * 文档在构造时一次性解析为操作元数据(纯字符串处理,不加载语义模型)。\n   * embedding(检索索引)推迟到首次 `search` 时惰性构建。\n   */\n  constructor(documents: ApiDocumentV3_1[] = []) {\n    this.operations = documents.flatMap((document) => document.operations.map((op) => {\n      const tags = op.operation.tags || []\n      const summary = op.operation.summary || ''\n      const description = op.operation.description || ''\n\n      return {\n        id: `${document.module.name}:${op.method}:${op.pathname}`,\n        module: document.module.name,\n        method: op.method.toUpperCase(),\n        pathname: op.pathname,\n        operationId: op.operationId,\n        summary,\n        description,\n        tags,\n        text: [\n          op.method.toUpperCase(),\n          op.pathname,\n          op.operationId,\n          summary,\n          description,\n          ...tags,\n        ].filter(Boolean).join(' '),\n        operation: op.operation,\n      }\n    }))\n  }\n\n  /**\n   * 惰性构建 embedding —— 此处才首次加载语义模型,且只构建一次。\n   * 模型不可用时会抛出 EmbedderUnavailableError,由调用方处理。\n   */\n  private async ensureEmbeddings(): Promise<void> {\n    if (this.embeddingsReady) return\n\n    if (this.operations.length > 0) {\n      const embeddings = await embedDocuments(this.operations.map((op) => op.text))\n      for (let i = 0; i < this.operations.length; i++) {\n        this.operations[i].embedding = embeddings[i]\n      }\n    }\n\n    this.embeddingsReady = true\n  }\n\n  async search(query: string, options?: { limit?: number; module?: string[] }): Promise<SearchResult[]> {\n    const limit = options?.limit ?? 10\n    const modules = options?.module\n\n    await this.ensureEmbeddings()\n\n    let candidates = this.operations\n    if (modules && modules.length > 0) {\n      candidates = candidates.filter((op) => modules.includes(op.module))\n    }\n\n    if (candidates.length === 0) return []\n\n    const [queryEmbedding] = await embed([query])\n\n    const scored = candidates\n      .filter((op) => op.embedding)\n      .map((op) => ({\n        op,\n        score: cosineSimilarity(queryEmbedding, op.embedding!),\n      }))\n      .sort((a, b) => b.score - a.score)\n      .slice(0, limit)\n\n    return scored.map(({ op, score }) => ({\n      score: Math.round(score * 1000) / 1000,\n      module: op.module,\n      method: op.method,\n      pathname: op.pathname,\n      operationId: op.operationId,\n      summary: op.summary,\n      description: op.description,\n      tags: op.tags,\n    }))\n  }\n\n  getDetail(module: string, method: string, pathname: string): SearchResultDetail | undefined {\n    const op = this.operations.find(\n      (o) => o.module === module && o.method === method.toUpperCase() && o.pathname === pathname,\n    )\n    if (!op) return undefined\n\n    const operation = op.operation as Record<string, unknown>\n\n    return {\n      score: 1,\n      module: op.module,\n      method: op.method,\n      pathname: op.pathname,\n      operationId: op.operationId,\n      summary: op.summary,\n      description: op.description,\n      tags: op.tags,\n      parameters: (operation.parameters || []) as unknown[],\n      requestBody: operation.requestBody || null,\n      responses: operation.responses || null,\n    }\n  }\n\n  listModules(): string[] {\n    return [...new Set(this.operations.map((op) => op.module))]\n  }\n}\n","import { Command, Option } from 'commander'\nimport { Compiler } from '../compiler/compiler.js'\nimport { SearchEngine } from '../search/search-engine.js'\nimport { EmbedderUnavailableError } from '../search/embedder.js'\nimport type { SearchResult } from '../search/types.js'\nimport type { FilterRule } from '../utils/matcher.js'\nimport { xprodFilterRules } from './utils/xprod-filter-rules.js'\n\nexport function registerSearchCommand(program: Command): void {\n  program\n    .command('search')\n    .description('Semantic search for API operations using natural language')\n    .argument('<query>', 'Natural language search query')\n    .option('-c --config <config>', 'The keq-cli config file')\n    .option('--module <modules...>', 'Filter module(s) to search')\n    .option('--limit <limit>', 'Maximum number of results', '10')\n    .option('--detail', 'Include full request/response schema in results')\n    .addOption(\n      new Option('--format <format>', 'Output format')\n        .choices(['json', 'compact'])\n        .default('json'),\n    )\n    .option('--all', 'Ignore .keqfilter rules')\n    .option('--tolerant', 'Tolerate wrong swagger/openapi structure')\n    .option('--debug', 'Print debug information')\n    .action(async (query, options) => {\n      const filterRules: FilterRule[] = []\n\n      if (options.module && !options.all) {\n        filterRules.push(\n          {\n            deny: true,\n            persist: false,\n            moduleName: '*',\n            operationMethod: '*',\n            operationPathname: '/**',\n          },\n          ...xprodFilterRules({\n            module: options.module,\n            persist: false,\n          }),\n        )\n      }\n\n      const compiler = new Compiler({\n        build: true,\n        persist: false,\n        silent: true,\n        config: options.config,\n        debug: !!options.debug,\n        tolerant: !!options.tolerant,\n        filter: options.all\n          ? false\n          : filterRules.length > 0\n            ? { rules: filterRules }\n            : undefined,\n      })\n\n      await compiler.run()\n\n      const documents = compiler.context.documents || []\n      const engine = new SearchEngine(documents)\n\n      const limit = parseInt(options.limit, 10)\n\n      let results: SearchResult[]\n      try {\n        results = await engine.search(query, { limit, module: options.module })\n      } catch (e) {\n        if (e instanceof EmbedderUnavailableError) {\n          console.error(e.message)\n          process.exit(1)\n        }\n        throw e\n      }\n\n      if (options.detail) {\n        const detailed = results.map((r) => {\n          const detail = engine.getDetail(r.module, r.method, r.pathname)\n          return detail || r\n        })\n        printResults(detailed, options.format)\n      } else {\n        printResults(results, options.format)\n      }\n    })\n}\n\nfunction printResults(results: unknown[], format: string): void {\n  if (format === 'json') {\n    console.log(JSON.stringify({ results, total: results.length }, null, 2))\n  } else {\n    for (const r of results as Array<Record<string, unknown>>) {\n      const method = String(r.method).padEnd(7)\n      const score = String(r.score)\n      console.log(`  [${score}] ${method} ${String(r.pathname)}`)\n      if (typeof r.summary === 'string') console.log(`         ${r.summary}`)\n      console.log(`         ${String(r.module)} | ${String(r.operationId)}`)\n      console.log()\n    }\n    console.log(`Total: ${results.length} results`)\n  }\n}\n","import path from 'path'\nimport fs from 'fs-extra'\nimport { cosmiconfig } from 'cosmiconfig'\nimport { Compiler } from '~/compiler/compiler.js'\nimport { SearchEngine } from '~/search/search-engine.js'\nimport { Matcher } from '~/utils/matcher.js'\nimport { getCacheDir } from '~/utils/get-cache-dir.js'\nimport { FileSystemCacheStore } from '~/cache-store/index.js'\nimport { ConfigNotFoundException } from '~/exceptions/index.js'\nimport type { CacheStore } from '~/cache-store/index.js'\nimport type { ApiDocumentV3_1 } from '~/models/api-document_v3_1.js'\nimport type { CompilerContext } from '~/compiler/types/compiler-context.js'\n\ninterface CompilerProviderOptions {\n  config?: string\n  debug: boolean\n  tolerant: boolean\n  cacheStore?: CacheStore\n}\n\nexport class CompilerProvider {\n  private _engine: SearchEngine\n  private _documents: ApiDocumentV3_1[]\n  private _context: CompilerContext\n  private _matcher: Matcher\n  private _configPath: string\n\n  private constructor(\n    context: CompilerContext,\n    documents: ApiDocumentV3_1[],\n    engine: SearchEngine,\n    matcher: Matcher,\n    configPath: string,\n  ) {\n    this._context = context\n    this._documents = documents\n    this._engine = engine\n    this._matcher = matcher\n    this._configPath = configPath\n  }\n\n  get configPath(): string {\n    return this._configPath\n  }\n\n  get documents(): ApiDocumentV3_1[] {\n    return this._documents\n  }\n\n  get context(): CompilerContext {\n    return this._context\n  }\n\n  get matcher(): Matcher {\n    return this._matcher\n  }\n\n  getEngine(): SearchEngine {\n    return this._engine\n  }\n\n  static async init(options: CompilerProviderOptions): Promise<CompilerProvider> {\n    const explore = cosmiconfig('keq')\n    const result = options.config\n      ? await explore.load(options.config)\n      : await explore.search()\n\n    if (!result) {\n      throw new ConfigNotFoundException(options.config ?? process.cwd())\n    }\n\n    const configFilepath = result.filepath\n    const keqfilterPath = path.resolve(path.dirname(configFilepath), '.keqfilter')\n    const cacheStore: CacheStore = options.cacheStore ?? new FileSystemCacheStore(\n      getCacheDir(path.dirname(configFilepath)),\n    )\n\n    const compiler = new Compiler({\n      build: true,\n      persist: false,\n      silent: true,\n      config: options.config,\n      debug: options.debug,\n      tolerant: options.tolerant,\n      filter: false,\n      cacheStore,\n    })\n    await compiler.run()\n\n    const context = compiler.context\n    const documents = context.documents || []\n\n    const engine = new SearchEngine(documents)\n\n    const matcher = await fs.exists(keqfilterPath)\n      ? await Matcher.read(keqfilterPath)\n      : new Matcher([])\n\n    return new CompilerProvider(context, documents, engine, matcher, configFilepath)\n  }\n}\n","import path from 'path'\nimport fs from 'fs-extra'\nimport { CONFIG_FILENAMES } from '~/constants/index.js'\n\nexport async function findConfigInDir(dir: string): Promise<string | null> {\n  for (const filename of CONFIG_FILENAMES) {\n    const filePath = path.resolve(dir, filename)\n    if (await fs.pathExists(filePath)) {\n      return filePath\n    }\n  }\n  return null\n}\n","import path from 'path'\nimport { CompilerProvider } from './compiler-provider.js'\nimport { findConfigInDir } from './find-config-in-dir.js'\n\nexport interface ProjectEntry {\n  configPath: string\n  projectDir: string\n  packageName?: string\n}\n\ninterface RegistryOptions {\n  debug: boolean\n  tolerant: boolean\n}\n\n/**\n * Manages multiple CompilerProvider instances for monorepo/multi-project support.\n * Resolves project entries and creates fresh CompilerProvider instances on each access.\n */\nexport class CompilerProviderRegistry {\n  private entries: Map<string, ProjectEntry> = new Map()\n  private options: RegistryOptions\n\n  constructor(options: RegistryOptions) {\n    this.options = options\n  }\n\n  register(entry: ProjectEntry): void {\n    this.entries.set(entry.projectDir, entry)\n  }\n\n  has(projectDir: string): boolean {\n    return this.entries.has(projectDir)\n  }\n\n  list(): ProjectEntry[] {\n    return [...this.entries.values()]\n  }\n\n  async resolve(projectDir?: string): Promise<CompilerProvider> {\n    const entry = await this.resolveEntry(projectDir)\n    return CompilerProvider.init({\n      config: entry.configPath,\n      debug: this.options.debug,\n      tolerant: this.options.tolerant,\n    })\n  }\n\n  getConfigPath(projectDir?: string): string {\n    const resolved = this.resolveEntrySync(projectDir)\n    return resolved.configPath\n  }\n\n  private async resolveEntry(projectDir?: string): Promise<ProjectEntry> {\n    if (!projectDir) {\n      return this.resolveDefault()\n    }\n\n    if (!path.isAbsolute(projectDir)) {\n      throw new Error(`The 'project' parameter must be an absolute path. Received: ${projectDir}. Please call 'list_projects' tool to get valid project paths.`)\n    }\n\n    const existing = this.entries.get(projectDir)\n    if (existing) return existing\n\n    const configPath = await findConfigInDir(projectDir)\n    if (!configPath) {\n      throw new Error(`No keqrc config file found in ${projectDir}. Please call 'list_projects' tool to get valid project paths.`)\n    }\n\n    const entry: ProjectEntry = { configPath, projectDir }\n    this.register(entry)\n    return entry\n  }\n\n  private resolveEntrySync(projectDir?: string): ProjectEntry {\n    if (!projectDir) {\n      return this.resolveDefault()\n    }\n\n    if (!path.isAbsolute(projectDir)) {\n      throw new Error(`The 'project' parameter must be an absolute path. Received: ${projectDir}. Please call 'list_projects' tool to get valid project paths.`)\n    }\n\n    const existing = this.entries.get(projectDir)\n    if (!existing) {\n      throw new Error(`No keqrc config file found in ${projectDir}. Please call 'list_projects' tool to get valid project paths.`)\n    }\n    return existing\n  }\n\n  private resolveDefault(): ProjectEntry {\n    if (this.entries.size === 0) {\n      throw new Error(\n        'No keq project found. Please call \\'list_projects\\' tool first to check available projects, or specify \\'project\\' parameter with the absolute path to your project directory containing a keqrc config file.',\n      )\n    }\n\n    if (this.entries.size === 1) {\n      return this.entries.values().next().value!\n    }\n\n    const projects = [...this.entries.values()]\n      .map((e) => {\n        const label = e.packageName ? ` [${e.packageName}]` : ''\n        return `- ${e.projectDir} (${path.basename(e.configPath)})${label}`\n      })\n      .join('\\n')\n\n    throw new Error(\n      `This is a monorepo with multiple keq projects. Please call 'list_projects' tool to get the full project list, then specify 'project' parameter with one of the following project directories:\\n${projects}`,\n    )\n  }\n}\n","import path from 'path'\nimport fs from 'fs-extra'\nimport * as yaml from 'js-yaml'\nimport picomatch from 'picomatch'\nimport { cosmiconfig } from 'cosmiconfig'\nimport { findConfigInDir } from './find-config-in-dir.js'\n\nexport interface ProjectEntry {\n  configPath: string\n  projectDir: string\n  packageName?: string\n}\n\nexport async function discoverProjects(config?: string): Promise<ProjectEntry[]> {\n  if (config) {\n    const configPath = path.resolve(config)\n    const projectDir = path.dirname(configPath)\n    const packageName = await readPackageName(projectDir)\n    return [{ configPath, projectDir, packageName }]\n  }\n\n  const cwd = process.cwd()\n  const monorepoEntries = await discoverFromMonorepo(cwd)\n  if (monorepoEntries.length > 0) {\n    return monorepoEntries\n  }\n\n  const explore = cosmiconfig('keq')\n  const result = await explore.search()\n  if (result) {\n    const projectDir = path.dirname(result.filepath)\n    const packageName = await readPackageName(projectDir)\n    return [{ configPath: result.filepath, projectDir, packageName }]\n  }\n\n  return []\n}\n\nasync function discoverFromMonorepo(root: string): Promise<ProjectEntry[]> {\n  const workspaceGlobs = await getWorkspaceGlobs(root)\n  if (workspaceGlobs.length === 0) return []\n\n  const memberDirs = await expandWorkspaceGlobs(root, workspaceGlobs)\n\n  const dirs = [root, ...memberDirs]\n  const entries: ProjectEntry[] = []\n\n  for (const dir of dirs) {\n    const configPath = await findConfigInDir(dir)\n    if (configPath) {\n      const packageName = await readPackageName(dir)\n      entries.push({ configPath, projectDir: dir, packageName })\n    }\n  }\n\n  return entries\n}\n\nasync function getWorkspaceGlobs(root: string): Promise<string[]> {\n  const pnpmWorkspacePath = path.join(root, 'pnpm-workspace.yaml')\n  if (await fs.pathExists(pnpmWorkspacePath)) {\n    const content = await fs.readFile(pnpmWorkspacePath, 'utf-8')\n    const parsed = yaml.load(content) as { packages?: string[] } | null\n    if (parsed?.packages) {\n      return parsed.packages\n    }\n  }\n\n  const packageJsonPath = path.join(root, 'package.json')\n  if (await fs.pathExists(packageJsonPath)) {\n    const pkg = await fs.readJson(packageJsonPath) as { workspaces?: string[] | { packages?: string[] } }\n    if (Array.isArray(pkg.workspaces)) {\n      return pkg.workspaces\n    }\n    if (Array.isArray(pkg.workspaces?.packages)) {\n      return pkg.workspaces.packages\n    }\n  }\n\n  return []\n}\n\nasync function expandWorkspaceGlobs(root: string, globs: string[]): Promise<string[]> {\n  const dirs: string[] = []\n\n  for (const glob of globs) {\n    const parts = glob.split('/')\n    const baseParts: string[] = []\n    let globPart = ''\n\n    for (let i = 0; i < parts.length; i++) {\n      if (parts[i].includes('*') || parts[i].includes('{') || parts[i].includes('?')) {\n        globPart = parts.slice(i).join('/')\n        break\n      }\n      baseParts.push(parts[i])\n    }\n\n    const baseDir = path.join(root, ...baseParts)\n    if (!await fs.pathExists(baseDir)) continue\n\n    if (!globPart) {\n      const fullPath = path.resolve(root, glob)\n      if (await fs.pathExists(fullPath)) {\n        dirs.push(fullPath)\n      }\n      continue\n    }\n\n    const matcher = picomatch(globPart)\n    const candidates = await fs.readdir(baseDir, { withFileTypes: true })\n\n    for (const entry of candidates) {\n      if (!entry.isDirectory()) continue\n      if (matcher(entry.name)) {\n        dirs.push(path.join(baseDir, entry.name))\n      }\n    }\n  }\n\n  return dirs\n}\n\nasync function readPackageName(dir: string): Promise<string | undefined> {\n  try {\n    const pkg = await fs.readJson(path.join(dir, 'package.json'))\n    return pkg.name\n  } catch {\n    return undefined\n  }\n}\n","import * as path from 'path'\nimport { Command } from 'commander'\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'\nimport { z } from 'zod'\nimport fs from 'fs-extra'\nimport picomatch from 'picomatch'\nimport { Compiler } from '../compiler/compiler.js'\nimport { findInvalidFiles } from '../utils/scan-generated-files.js'\nimport { xprodFilterRules } from './utils/xprod-filter-rules.js'\nimport { CompilerProviderRegistry } from '../mcp/compiler-provider-registry.js'\nimport { discoverProjects } from '../mcp/discover-projects.js'\nimport type { Matcher } from '../utils/matcher.js'\nimport type { FilterRule } from '../utils/matcher.js'\nimport type { OperationDefinition } from '../models/index.js'\n\nfunction getFilterAnnotation(matcher: Matcher, op: OperationDefinition | undefined): string {\n  if (op && matcher.isOperationDenied(op)) {\n    return 'This API is excluded from the code generation list by .keqfilter rules'\n  }\n  return 'This API is included in the code generation list'\n}\n\nexport function registerMcpCommand(program: Command): void {\n  program\n    .command('mcp')\n    .description('Start keq MCP server')\n    .option('-c --config <config>', 'The keq-cli config file')\n    .option('--tolerant', 'Tolerate wrong swagger/openapi structure')\n    .option('--debug', 'Print debug information')\n    .action(async (options) => {\n      const config: string | undefined = options.config\n      const tolerant = !!options.tolerant\n      const debug = !!options.debug\n\n      const entries = await discoverProjects(config)\n      const registry = new CompilerProviderRegistry({ debug, tolerant })\n      for (const entry of entries) {\n        registry.register(entry)\n      }\n\n      const server = new McpServer({\n        name: 'keq',\n        version: '1.0.0',\n        description: '查询和搜索项目中对接的所有后端服务 API 接口。当用户想了解后端有哪些接口、查找某个功能的 API、查看接口的请求参数和响应格式时使用。支持自然语言语义搜索（中英文）。也可为接口生成 TypeScript 客户端代码。数据来源：项目配置的 Swagger/OpenAPI 规范文档。',\n      })\n\n      const projectParam = z.string().optional()\n        .describe('项目目录绝对路径，用于 monorepo 中指定操作哪个子项目。非 monorepo 项目无需提供。')\n\n      server.registerTool(\n        'list_projects',\n        {\n          description: '列出工作区中所有 keq 项目。用于获取其他工具的 project 参数可选值，monorepo 环境中应首先调用此工具确定目标项目。',\n          inputSchema: {},\n          annotations: { readOnlyHint: true, destructiveHint: false },\n        },\n        async () => {\n          try {\n            const projects = registry.list()\n            const result = projects.map((entry) => ({\n              projectDir: entry.projectDir,\n              configFile: path.basename(entry.configPath),\n              packageName: entry.packageName || null,\n            }))\n            return {\n              content: [{\n                type: 'text',\n                text: JSON.stringify({\n                  count: result.length,\n                  isMonorepo: result.length > 1,\n                  projects: result,\n                }, null, 2),\n              }],\n            }\n          } catch (error) {\n            return { content: [{ type: 'text', text: `Error: ${error instanceof Error ? error.message : String(error)}` }], isError: true }\n          }\n        },\n      )\n\n      server.registerTool(\n        'search_apis',\n        {\n          description: '通过语义匹配搜索项目中的后端 API 接口。仅当用户描述了具体功能或业务场景（如\"用户登录\"、\"搜索商品\"）来查找相关接口时使用。如果用户想查看所有接口或按模块/路径浏览接口列表，应使用 list_apis 而非此工具。支持中英文自然语言，返回按相关度排序的接口列表。',\n          inputSchema: {\n            project: projectParam,\n            query: z.string().describe('自然语言搜索词，如\"用户登录\"、\"搜索商品\"、\"订单列表\"等'),\n            module: z.array(z.string()).optional()\n              .describe('按模块名筛选，限定在特定后端服务中搜索'),\n            limit: z.number().optional()\n              .default(10)\n              .describe('返回结果数量上限'),\n          },\n          annotations: { readOnlyHint: true, destructiveHint: false },\n        },\n        async ({ project, query, module, limit }) => {\n          try {\n            const provider = await registry.resolve(project)\n            const engine = provider.getEngine()\n            const matcher = provider.matcher\n            const documents = provider.documents\n            const results = await engine.search(query, { limit, module })\n\n            const annotated = results.map((result) => {\n              const { score, ...rest } = result\n              const doc = documents.find((d) => d.module.name === result.module)\n              const op = doc?.operations.find(\n                (o) => o.method.toLowerCase() === result.method.toLowerCase() && o.pathname === result.pathname,\n              )\n              return {\n                ...rest,\n                'x-keq-score': score,\n                'x-keq-filter': getFilterAnnotation(matcher, op),\n              }\n            })\n\n            return { content: [{ type: 'text', text: JSON.stringify(annotated, null, 2) }] }\n          } catch (error) {\n            return { content: [{ type: 'text', text: `Error: ${error instanceof Error ? error.message : String(error)}` }], isError: true }\n          }\n        },\n      )\n\n      server.registerTool(\n        'get_api_detail',\n        {\n          description: '获取某个 API 接口的完整详情，包含请求参数、请求体、响应体的结构定义。当用户想知道某个接口怎么调用、需要传什么参数、返回什么数据时使用。需要先通过 search_apis 或 list_apis 获取接口的 module、method、pathname。',\n          inputSchema: {\n            project: projectParam,\n            module: z.string().describe('Module name'),\n            method: z.string().describe('HTTP method (GET, POST, PUT, DELETE, etc.)'),\n            pathname: z.string().describe('API pathname (e.g. /api/v1/users)'),\n          },\n          annotations: { readOnlyHint: true, destructiveHint: false },\n        },\n        async ({ project, module, method, pathname }) => {\n          try {\n            const provider = await registry.resolve(project)\n            const engine = provider.getEngine()\n            const matcher = provider.matcher\n            const documents = provider.documents\n            const detail = engine.getDetail(module, method, pathname)\n            if (!detail) {\n              return { content: [{ type: 'text', text: 'API not found' }], isError: true }\n            }\n\n            const doc = documents.find((d) => d.module.name === module)\n            const op = doc?.operations.find(\n              (o) => o.method.toLowerCase() === method.toLowerCase() && o.pathname === pathname,\n            )\n\n            return { content: [{ type: 'text', text: JSON.stringify({ ...detail, 'x-keq-filter': getFilterAnnotation(matcher, op) }, null, 2) }] }\n          } catch (error) {\n            return { content: [{ type: 'text', text: `Error: ${error instanceof Error ? error.message : String(error)}` }], isError: true }\n          }\n        },\n      )\n\n      server.registerTool(\n        'list_modules',\n        {\n          description: '列出项目对接的所有后端服务模块。当用户想知道项目接入了哪些后端系统、有哪些服务可用时使用。每个模块对应一个后端服务的 API 文档。',\n          inputSchema: {\n            project: projectParam,\n          },\n          annotations: { readOnlyHint: true, destructiveHint: false },\n        },\n        async ({ project }) => {\n          try {\n            const provider = await registry.resolve(project)\n            const engine = provider.getEngine()\n            const modules = engine.listModules()\n            return { content: [{ type: 'text', text: JSON.stringify(modules, null, 2) }] }\n          } catch (error) {\n            return { content: [{ type: 'text', text: `Error: ${error instanceof Error ? error.message : String(error)}` }], isError: true }\n          }\n        },\n      )\n\n      server.registerTool(\n        'list_apis',\n        {\n          description: '列出项目中所有可用的后端 API 接口。当用户想查看所有接口、浏览某个服务的全部接口、查询某个系统有哪些接口、或按条件筛选接口（如只看 GET 请求或某个路径下的接口）时使用。如果用户描述了具体功能来查找接口（如\"搜索商品的接口\"），应使用 search_apis。',\n          inputSchema: {\n            project: projectParam,\n            module: z.array(z.string()).optional()\n              .describe('Filter by module names'),\n            method: z.string().optional()\n              .describe('Filter by HTTP method (GET, POST, PUT, DELETE, etc.)'),\n            pathname: z.string().optional()\n              .describe('Filter by pathname pattern (glob supported)'),\n            includes: z.array(z.enum(['operations', 'components'])).optional()\n              .default(['operations'])\n              .describe('What to include in results'),\n          },\n          annotations: { readOnlyHint: true, destructiveHint: false },\n        },\n        async ({ project, module, method, pathname, includes }) => {\n          try {\n            const provider = await registry.resolve(project)\n            const documents = provider.documents\n            const matcher = provider.matcher\n            const result = documents\n              .filter((doc) => !module || module.includes(doc.module.name))\n              .map((document) => {\n                const item: {\n                  module: string\n                  operations?: Array<{ method: string; path: string; operationId: string; summary: string; description: string; 'x-keq-filter': string }>\n                  components?: { schemas: Array<{ name: string; description: string }> }\n                } = { module: document.module.name }\n\n                if (includes.includes('operations')) {\n                  let ops = document.operations\n                  if (method) {\n                    ops = ops.filter((op) => op.method.toLowerCase() === method.toLowerCase())\n                  }\n                  if (pathname) {\n                    const match = picomatch(pathname)\n                    ops = ops.filter((op) => match(op.pathname))\n                  }\n                  item.operations = ops.map((op) => ({\n                    method: op.method.toUpperCase(),\n                    path: op.pathname,\n                    operationId: op.operationId,\n                    summary: op.operation.summary || '',\n                    description: op.operation.description || '',\n                    'x-keq-filter': getFilterAnnotation(matcher, op),\n                  }))\n                }\n\n                if (includes.includes('components')) {\n                  item.components = {\n                    schemas: document.schemas.map((schema) => {\n                      const schemaObj = schema.schema as { description?: string }\n                      return { name: schema.name, description: schemaObj.description || '' }\n                    }),\n                  }\n                }\n\n                return item\n              })\n\n            return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }\n          } catch (error) {\n            return { content: [{ type: 'text', text: `Error: ${error instanceof Error ? error.message : String(error)}` }], isError: true }\n          }\n        },\n      )\n\n      server.registerTool(\n        'build_apis',\n        {\n          description: '为后端 API 接口生成类型安全的 TypeScript 请求函数代码。当用户想生成某个接口的调用代码、需要类型安全的 HTTP 客户端时使用。可按模块、方法、路径范围筛选要生成的接口。生成的文件写入项目配置的输出目录。',\n          inputSchema: {\n            project: projectParam,\n            module: z.array(z.string()).optional()\n              .describe('Module(s) to generate code for'),\n            method: z.string().optional()\n              .describe('HTTP method filter (e.g. GET, POST)'),\n            pathname: z.string().optional()\n              .describe('Pathname filter (glob pattern supported, e.g. /api/v1/users/**)'),\n            fresh: z.boolean().optional()\n              .default(false)\n              .describe('Clean output directory before building'),\n          },\n          annotations: { readOnlyHint: false, destructiveHint: false },\n        },\n        async ({ project, module, method, pathname, fresh }) => {\n          try {\n            const configPath = registry.getConfigPath(project)\n            const filterRules: FilterRule[] = []\n\n            if (module || method || pathname) {\n              filterRules.push(\n                {\n                  deny: true,\n                  persist: false,\n                  moduleName: '*',\n                  operationMethod: '*',\n                  operationPathname: '/**',\n                },\n                ...xprodFilterRules({\n                  module,\n                  method,\n                  pathname,\n                  persist: false,\n                }),\n              )\n            }\n\n            const buildCompiler = new Compiler({\n              build: true,\n              persist: true,\n              silent: true,\n              fresh,\n              config: configPath,\n              debug,\n              tolerant,\n              filter: filterRules.length > 0 ? { rules: filterRules } : undefined,\n            })\n\n            await buildCompiler.run()\n\n            const artifacts = buildCompiler.context.artifacts || []\n            const rc = buildCompiler.context.rc\n            const files = artifacts.map((a) => (rc ? path.join(rc.outdir, a.filepath) : a.filepath))\n\n            return { content: [{ type: 'text', text: JSON.stringify({ generated: files.length, files }, null, 2) }] }\n          } catch (error) {\n            return { content: [{ type: 'text', text: `Error: ${error instanceof Error ? error.message : String(error)}` }], isError: true }\n          }\n        },\n      )\n\n      server.registerTool(\n        'list_generated_files',\n        {\n          description: '列出已生成的 API 客户端代码文件。当用户想查看哪些接口已经生成了代码、或想找出过期/无效的生成文件时使用。',\n          inputSchema: {\n            project: projectParam,\n            invalid: z.boolean().optional()\n              .default(false)\n              .describe('If true, only list invalid/stale files not matching current build'),\n          },\n          annotations: { readOnlyHint: true, destructiveHint: false },\n        },\n        async ({ project, invalid }) => {\n          try {\n            const provider = await registry.resolve(project)\n            const context = provider.context\n            const rc = context.rc\n            if (!rc) {\n              return { content: [{ type: 'text', text: 'Error: Failed to load configuration' }], isError: true }\n            }\n\n            if (invalid) {\n              const validFilePaths = (context.artifacts || []).map((a) => a.filepath)\n              const invalidFiles = await findInvalidFiles(rc.outdir, validFilePaths)\n              const files = invalidFiles.map((f) => path.join(rc.outdir, f.relativePath))\n              return { content: [{ type: 'text', text: JSON.stringify({ count: files.length, files }, null, 2) }] }\n            }\n\n            const artifacts = context.artifacts || []\n            const files = artifacts.map((a) => path.join(rc.outdir, a.filepath))\n            return { content: [{ type: 'text', text: JSON.stringify({ count: files.length, files }, null, 2) }] }\n          } catch (error) {\n            return { content: [{ type: 'text', text: `Error: ${error instanceof Error ? error.message : String(error)}` }], isError: true }\n          }\n        },\n      )\n\n      server.registerTool(\n        'get_filter_rules',\n        {\n          description: '查看当前的接口过滤规则。过滤规则决定哪些 API 接口会被纳入代码生成范围。当用户想了解哪些接口被排除或包含在生成列表中时使用。',\n          inputSchema: {\n            project: projectParam,\n          },\n          annotations: { readOnlyHint: true, destructiveHint: false },\n        },\n        async ({ project }) => {\n          try {\n            await registry.resolve(project)\n            const configPath = registry.getConfigPath(project)\n            const filterPath = path.resolve(path.dirname(configPath), '.keqfilter')\n            if (!await fs.exists(filterPath)) {\n              return { content: [{ type: 'text', text: JSON.stringify({ exists: false, content: '' }, null, 2) }] }\n            }\n            const content = await fs.readFile(filterPath, 'utf-8')\n            return { content: [{ type: 'text', text: JSON.stringify({ exists: true, content }, null, 2) }] }\n          } catch (error) {\n            return { content: [{ type: 'text', text: `Error: ${error instanceof Error ? error.message : String(error)}` }], isError: true }\n          }\n        },\n      )\n\n      server.registerTool(\n        'add_filter_rule',\n        {\n          description: '添加接口过滤规则，控制哪些 API 需要生成代码。当用户想排除某些不需要的接口、或只保留特定接口时使用。deny 模式排除接口，allow 模式包含接口。',\n          inputSchema: {\n            project: projectParam,\n            mode: z.enum(['deny', 'allow']).describe('Rule mode: deny excludes APIs, allow includes them'),\n            module: z.string().optional()\n              .default('*')\n              .describe('Module name pattern (glob supported)'),\n            method: z.string().optional()\n              .default('*')\n              .describe('HTTP method pattern (e.g. GET, POST, or * for all)'),\n            pathname: z.string().describe('Pathname pattern (glob supported, e.g. /api/v1/users/**)'),\n            build: z.boolean().optional()\n              .default(false)\n              .describe('Whether to rebuild after adding the rule'),\n          },\n          annotations: { readOnlyHint: false, destructiveHint: false },\n        },\n        async ({ project, mode, module, method, pathname, build }) => {\n          try {\n            const configPath = registry.getConfigPath(project)\n\n            const filterCompiler = new Compiler({\n              build,\n              persist: true,\n              silent: true,\n              config: configPath,\n              debug,\n              tolerant,\n              filter: {\n                rules: [{\n                  persist: true,\n                  deny: mode === 'deny',\n                  moduleName: module,\n                  operationMethod: method.toLowerCase(),\n                  operationPathname: pathname,\n                }],\n              },\n            })\n\n            await filterCompiler.run()\n\n            return { content: [{ type: 'text', text: JSON.stringify({ success: true, rule: { mode, module, method, pathname } }, null, 2) }] }\n          } catch (error) {\n            return { content: [{ type: 'text', text: `Error: ${error instanceof Error ? error.message : String(error)}` }], isError: true }\n          }\n        },\n      )\n\n      server.registerTool(\n        'remove_filter_rule',\n        {\n          description: '移除已有的接口过滤规则。当用户想恢复之前被排除的接口、或调整过滤策略时使用。',\n          inputSchema: {\n            project: projectParam,\n            mode: z.enum(['deny', 'allow']).describe('Which section the rule is in'),\n            module: z.string().describe('Exact module name pattern to match'),\n            method: z.string().describe('Exact method pattern to match'),\n            pathname: z.string().describe('Exact pathname pattern to match'),\n            build: z.boolean().optional()\n              .default(false)\n              .describe('Whether to rebuild after removing the rule'),\n          },\n          annotations: { readOnlyHint: false, destructiveHint: false },\n        },\n        async ({ project, mode, module, method, pathname, build }) => {\n          try {\n            const configPath = registry.getConfigPath(project)\n            const filterPath = path.resolve(path.dirname(configPath), '.keqfilter')\n\n            if (!await fs.exists(filterPath)) {\n              return { content: [{ type: 'text', text: 'Error: .keqfilter file not found' }], isError: true }\n            }\n\n            const content = await fs.readFile(filterPath, 'utf-8')\n            const isDeny = mode === 'deny'\n            const targetMethod = method.toLowerCase()\n\n            const lines = content.split('\\n')\n            const resultLines: string[] = []\n            let currentSection: 'deny' | 'allow' | null = null\n            let skipNext = false\n\n            for (const line of lines) {\n              const trimmed = line.replace(/#.*$/, '').trim()\n\n              if (trimmed === '[deny]') {\n                currentSection = 'deny'\n                resultLines.push(line)\n                continue\n              }\n              if (trimmed === '[allow]') {\n                currentSection = 'allow'\n                resultLines.push(line)\n                continue\n              }\n\n              if (!trimmed) {\n                if (!skipNext) resultLines.push(line)\n                skipNext = false\n                continue\n              }\n\n              const matched = trimmed.match(/^([^\\s]+)\\s+([^:\\s]+):(.*)$/)\n              if (matched && currentSection === (isDeny ? 'deny' : 'allow')) {\n                const [, ruleMethod, ruleModule, rulePathname] = matched\n                if (\n                  ruleMethod.toLowerCase() === targetMethod\n                  && ruleModule === module\n                  && rulePathname === pathname\n                ) {\n                  skipNext = false\n                  continue\n                }\n              }\n\n              resultLines.push(line)\n              skipNext = false\n            }\n\n            await fs.writeFile(filterPath, resultLines.join('\\n'), 'utf-8')\n\n            if (build) {\n              const buildCompiler = new Compiler({\n                build: true,\n                persist: true,\n                silent: true,\n                config: configPath,\n                debug,\n                tolerant,\n              })\n              await buildCompiler.run()\n            }\n\n            return { content: [{ type: 'text', text: JSON.stringify({ success: true, removed: { mode, module, method, pathname } }, null, 2) }] }\n          } catch (error) {\n            return { content: [{ type: 'text', text: `Error: ${error instanceof Error ? error.message : String(error)}` }], isError: true }\n          }\n        },\n      )\n\n      const transport = new StdioServerTransport()\n\n      // ── 进程生命周期管理 ──────────────────────────────────────\n      // stdio 传输下每个客户端都会 spawn 一个独立进程。onnxruntime 等原生\n      // 句柄会让事件循环常驻,若不在断连/父进程消失/收到信号/长时间空闲时\n      // 主动退出,孤儿进程会不断堆积直至内存耗尽。\n      const IDLE_TIMEOUT_MS = 30 * 60 * 1000\n      let idleTimer: NodeJS.Timeout | undefined\n      let closing = false\n\n      const shutdown = (code: number): void => {\n        if (closing) return\n        closing = true\n        if (idleTimer) clearTimeout(idleTimer)\n        void server.close()\n          .catch(() => {})\n          .finally(() => process.exit(code))\n      }\n\n      const touchIdle = (): void => {\n        if (idleTimer) clearTimeout(idleTimer)\n        idleTimer = setTimeout(() => shutdown(0), IDLE_TIMEOUT_MS)\n        idleTimer.unref()\n      }\n\n      await server.connect(transport)\n\n      // 任何客户端活动都重置空闲计时;30 分钟无请求则自动退出,\n      // 下次使用时客户端会重新 spawn(仅一次模型冷加载延迟)。\n      // 透传全部参数(message, extra),避免丢失 SDK 依赖的 extra 信息。\n      const routeMessage = transport.onmessage?.bind(transport)\n      transport.onmessage = (...args) => {\n        touchIdle()\n        routeMessage?.(...args)\n      }\n\n      // 传输断开(客户端主动关闭连接)→ 退出\n      const handleClose = transport.onclose?.bind(transport)\n      transport.onclose = () => {\n        handleClose?.()\n        shutdown(0)\n      }\n\n      // stdin EOF —— 父进程消失时最直接的信号(仅监听结束事件,不消费数据)\n      process.stdin.on('end', () => shutdown(0))\n      process.stdin.on('close', () => shutdown(0))\n\n      // 终止信号 → 优雅退出\n      for (const signal of ['SIGINT', 'SIGTERM', 'SIGHUP'] as const) {\n        process.on(signal, () => shutdown(0))\n      }\n\n      // 孤儿进程看门狗:父进程死亡后本进程被 reparent(ppid 变化或变为 1),\n      // 作为 stdin/onclose 的兜底,确保任何情况下都不会残留常驻进程。\n      const initialPpid = process.ppid\n      const watchdog = setInterval(() => {\n        if (process.ppid !== initialPpid || process.ppid === 1) {\n          shutdown(0)\n        }\n      }, 10_000)\n      watchdog.unref()\n\n      // 启动即武装空闲计时器:从未被调用的进程也会在超时后自动退出。\n      touchIdle()\n\n      if (registry.list().length === 1) {\n        registry.resolve().catch(() => {})\n      }\n    })\n}\n","import { Command } from 'commander'\nimport fs from 'fs-extra'\nimport { FileSystemCacheStore } from '../cache-store/index.js'\nimport { getCacheDir, getAllCacheDir } from '../utils/get-cache-dir.js'\n\nexport function registerCacheCommand(program: Command): void {\n  const cache = program\n    .command('cache')\n    .description('Manage the download cache')\n\n  cache\n    .command('clear')\n    .description('Clear cached downloads')\n    .option('-c --config <config>', 'The keq-cli config file')\n    .option('--all', 'Clear cache for all projects')\n    .action(async (options) => {\n      if (options.all) {\n        await fs.remove(getAllCacheDir()).catch(() => {})\n        console.log('All caches cleared.')\n      } else {\n        const store = new FileSystemCacheStore(getCacheDir(process.cwd()))\n        await store.clear()\n        console.log('Cache cleared.')\n      }\n    })\n}\n","import chalk from 'chalk'\nimport { Command, Option } from 'commander'\nimport { SupportedMethods } from '../constants/supported-methods.js'\nimport { Compiler } from '../compiler/compiler.js'\nimport { SearchEngine } from '../search/search-engine.js'\nimport type { ApiDocumentV3_1 } from '../models/api-document_v3_1.js'\n\n\nexport function registerDescribeCommand(program: Command): void {\n  const describe = program\n    .command('describe')\n    .description('Describe detailed structure of an API operation or schema component')\n\n  describe\n    .command('operation')\n    .description('Show full detail of an API operation including parameters, request body and responses')\n    .requiredOption('--module <module>', 'Module name')\n    .addOption(\n      new Option('--method <method>', 'HTTP method')\n        .choices([\n          ...SupportedMethods,\n          ...SupportedMethods.map((m) => m.toUpperCase()),\n        ])\n        .makeOptionMandatory(true),\n    )\n    .requiredOption('--pathname <pathname>', 'API pathname (e.g. /api/v1/users)')\n    .option('-c --config <config>', 'The keq-cli config file')\n    .option('--tolerant', 'Tolerate wrong swagger/openapi structure')\n    .addOption(\n      new Option('--format <format>', 'Output format')\n        .choices(['json']),\n    )\n    .option('--json', 'Output in JSON format (shortcut for --format json)')\n    .option('--debug', 'Print debug information')\n    .action(handleDescribeOperation)\n\n  describe\n    .command('schema')\n    .description('Show full detail of a schema component')\n    .requiredOption('--module <module>', 'Module name')\n    .requiredOption('--name <name>', 'Schema component name')\n    .option('-c --config <config>', 'The keq-cli config file')\n    .option('--tolerant', 'Tolerate wrong swagger/openapi structure')\n    .addOption(\n      new Option('--format <format>', 'Output format')\n        .choices(['json']),\n    )\n    .option('--json', 'Output in JSON format (shortcut for --format json)')\n    .option('--debug', 'Print debug information')\n    .action(handleDescribeSchema)\n}\n\n\ninterface DescribeOperationOptions {\n  module: string\n  method: string\n  pathname: string\n  config?: string\n  tolerant?: boolean\n  format?: string\n  json?: boolean\n  debug?: boolean\n}\n\ninterface DescribeSchemaOptions {\n  module: string\n  name: string\n  config?: string\n  tolerant?: boolean\n  format?: string\n  json?: boolean\n  debug?: boolean\n}\n\nasync function loadDocuments(options: { config?: string; debug?: boolean; tolerant?: boolean }): Promise<ApiDocumentV3_1[]> {\n  const compiler = new Compiler({\n    build: true,\n    persist: false,\n    silent: true,\n    config: options.config,\n    debug: !!options.debug,\n    tolerant: !!options.tolerant,\n    filter: false,\n  })\n\n  await compiler.run()\n  return compiler.context.documents || []\n}\n\nfunction findDocument(documents: ApiDocumentV3_1[], moduleName: string): ApiDocumentV3_1 {\n  const doc = documents.find((d) => d.module.name === moduleName)\n  if (!doc) {\n    const available = documents.map((d) => d.module.name)\n    console.error(`Module \"${moduleName}\" not found.`)\n    if (available.length > 0) {\n      console.error(`Available modules: ${available.join(', ')}`)\n    }\n    process.exit(1)\n  }\n  return doc\n}\n\n\nasync function handleDescribeOperation(options: DescribeOperationOptions): Promise<void> {\n  const documents = await loadDocuments(options)\n  const doc = findDocument(documents, options.module)\n\n  const engine = new SearchEngine(documents)\n  const detail = engine.getDetail(options.module, options.method, options.pathname)\n\n  if (!detail) {\n    console.error(`Operation ${options.method.toUpperCase()} ${options.pathname} not found in module \"${options.module}\".`)\n    console.error(`Run ${chalk.cyan(`keq apis --module ${options.module}`)} to see available operations.`)\n    process.exit(1)\n  }\n\n  const opDef = doc.operations.find(\n    (o) => o.method.toLowerCase() === options.method.toLowerCase() && o.pathname === options.pathname,\n  )\n\n  const format = options.format || (options.json ? 'json' : undefined)\n\n  if (format === 'json') {\n    const result = {\n      module: detail.module,\n      method: detail.method,\n      pathname: detail.pathname,\n      operationId: detail.operationId,\n      summary: detail.summary,\n      description: detail.description,\n      tags: detail.tags,\n      deprecated: opDef?.operation.deprecated ?? false,\n      parameters: detail.parameters,\n      requestBody: detail.requestBody,\n      responses: detail.responses,\n    }\n    console.log(JSON.stringify(result, null, 2))\n    return\n  }\n\n  printOperationCompact(detail, opDef)\n}\n\nasync function handleDescribeSchema(options: DescribeSchemaOptions): Promise<void> {\n  const documents = await loadDocuments(options)\n  const doc = findDocument(documents, options.module)\n\n  const schemaDef = doc.schemas.find((s) => s.name === options.name)\n\n  if (!schemaDef) {\n    const available = doc.schemas.map((s) => s.name)\n    console.error(`Schema \"${options.name}\" not found in module \"${options.module}\".`)\n    if (available.length > 0) {\n      const shown = available.slice(0, 10)\n      console.error(`Available schemas: ${shown.join(', ')}${available.length > 10 ? ` ... (${available.length} total)` : ''}`)\n    }\n    process.exit(1)\n  }\n\n  const format = options.format || (options.json ? 'json' : undefined)\n\n  if (format === 'json') {\n    console.log(JSON.stringify({\n      module: options.module,\n      name: schemaDef.name,\n      schema: schemaDef.schema,\n    }, null, 2))\n    return\n  }\n\n  printSchemaCompact(options.module, schemaDef.name, schemaDef.schema)\n}\n\n\n// ---------------------------------------------------------------------------\n// Compact formatters\n// ---------------------------------------------------------------------------\n\ninterface DetailLike {\n  module: string\n  method: string\n  pathname: string\n  operationId: string\n  summary: string\n  description: string\n  tags: string[]\n  parameters: unknown[]\n  requestBody: unknown\n  responses: unknown\n}\n\ninterface OperationDefLike {\n  operation: { deprecated?: boolean }\n}\n\nfunction printOperationCompact(detail: DetailLike, opDef?: OperationDefLike): void {\n  console.log(`\\nModule: ${detail.module}`)\n  console.log(`${chalk.bold(detail.method)} ${detail.pathname}`)\n\n  const meta: Array<[string, string]> = []\n  meta.push(['operationId', detail.operationId])\n  if (detail.summary) meta.push(['summary', detail.summary])\n  if (detail.description) meta.push(['description', detail.description])\n  if (detail.tags.length > 0) meta.push(['tags', detail.tags.join(', ')])\n  meta.push(['deprecated', opDef?.operation.deprecated ? 'yes' : 'no'])\n\n  const labelWidth = Math.max(...meta.map(([k]) => k.length))\n  for (const [label, value] of meta) {\n    console.log(`  ${chalk.dim(label.padEnd(labelWidth))}  ${value}`)\n  }\n\n  // Parameters\n  const params = detail.parameters as Array<Record<string, unknown>> | undefined\n  console.log(`\\n${chalk.bold('Parameters:')}`)\n  if (!params || params.length === 0) {\n    console.log('  (none)')\n  } else {\n    formatParameters(params)\n  }\n\n  // Request Body\n  console.log(`\\n${chalk.bold('Request Body:')}`)\n  if (!detail.requestBody) {\n    console.log('  (none)')\n  } else {\n    formatRequestBody(detail.requestBody as Record<string, unknown>)\n  }\n\n  // Responses\n  console.log(`\\n${chalk.bold('Responses:')}`)\n  if (!detail.responses) {\n    console.log('  (none)')\n  } else {\n    formatResponses(detail.responses as Record<string, unknown>)\n  }\n\n  console.log()\n}\n\nfunction printSchemaCompact(moduleName: string, name: string, schema: Record<string, unknown>): void {\n  console.log(`\\nModule: ${moduleName}`)\n  console.log(`Schema: ${chalk.bold(name)}`)\n\n  if (typeof schema.description === 'string' && schema.description) {\n    console.log(`  ${schema.description}`)\n  }\n  console.log()\n\n  formatSchemaBlock(schema, 1, new Set())\n  console.log()\n}\n\n\n// ---------------------------------------------------------------------------\n// Parameter formatting\n// ---------------------------------------------------------------------------\n\nfunction formatParameters(params: Array<Record<string, unknown>>): void {\n  const rows = params.map((p) => {\n    const loc = `[${String(p.in)}]`\n    const name = String(p.name)\n    const schemaObj = (p.schema || {}) as Record<string, unknown>\n    const type = formatTypeLabel(schemaObj)\n    const req = p.required ? '(required)' : ''\n    const desc = typeof p.description === 'string' ? p.description : ''\n    return { loc, name, type, req, desc }\n  })\n\n  const maxLoc = Math.max(...rows.map((r) => r.loc.length))\n  const maxName = Math.max(...rows.map((r) => r.name.length))\n  const maxType = Math.max(...rows.map((r) => r.type.length))\n  const maxReq = Math.max(...rows.map((r) => r.req.length))\n\n  for (const row of rows) {\n    const parts = [\n      '  ',\n      chalk.dim(row.loc.padEnd(maxLoc)),\n      '  ',\n      row.name.padEnd(maxName),\n      '  ',\n      chalk.cyan(row.type.padEnd(maxType)),\n      '  ',\n      row.req ? chalk.yellow(row.req.padEnd(maxReq)) : ' '.repeat(maxReq),\n      row.desc ? `  ${chalk.dim(row.desc)}` : '',\n    ]\n    console.log(parts.join(''))\n  }\n}\n\n\n// ---------------------------------------------------------------------------\n// Request Body formatting\n// ---------------------------------------------------------------------------\n\nfunction formatRequestBody(body: Record<string, unknown>): void {\n  if (typeof body.description === 'string' && body.description) {\n    console.log(`  ${body.description}`)\n  }\n\n  const content = body.content as Record<string, Record<string, unknown>> | undefined\n  if (!content) {\n    console.log('  (no content)')\n    return\n  }\n\n  for (const [mediaType, mediaObj] of Object.entries(content)) {\n    console.log(`  ${chalk.dim(`(${mediaType})`)}`)\n    const schema = mediaObj.schema as Record<string, unknown> | undefined\n    if (schema) {\n      formatSchemaBlock(schema, 2, new Set())\n    }\n  }\n}\n\n\n// ---------------------------------------------------------------------------\n// Responses formatting\n// ---------------------------------------------------------------------------\n\nfunction formatResponses(responses: Record<string, unknown>): void {\n  for (const [statusCode, responseObj] of Object.entries(responses)) {\n    const resp = responseObj as Record<string, unknown>\n\n    if ('$ref' in resp) {\n      const refName = extractRefName(String(resp.$ref))\n      console.log(`  ${chalk.bold(statusCode)} ${chalk.dim(`→ ${refName} (ref)`)}`)\n      continue\n    }\n\n    const desc = typeof resp.description === 'string' ? resp.description : ''\n    const content = resp.content as Record<string, Record<string, unknown>> | undefined\n\n    if (!content) {\n      console.log(`  ${chalk.bold(statusCode)}${desc ? ` - ${desc}` : ''}`)\n      console.log('    (no content)')\n      continue\n    }\n\n    for (const [mediaType, mediaObj] of Object.entries(content)) {\n      console.log(`  ${chalk.bold(statusCode)}${desc ? ` - ${desc}` : ''} ${chalk.dim(`(${mediaType})`)}`)\n      const schema = mediaObj.schema as Record<string, unknown> | undefined\n      if (schema) {\n        formatSchemaBlock(schema, 2, new Set())\n      }\n    }\n  }\n}\n\n\n// ---------------------------------------------------------------------------\n// Schema block formatting (recursive)\n// ---------------------------------------------------------------------------\n\nconst MAX_DEPTH = 3\n\nfunction formatSchemaBlock(schema: Record<string, unknown>, indent: number, visited: Set<string>): void {\n  const pad = '  '.repeat(indent)\n\n  if ('$ref' in schema) {\n    const refName = extractRefName(String(schema.$ref))\n    console.log(`${pad}${chalk.dim(`→ ${refName} (ref)`)}`)\n    return\n  }\n\n  const type = schema.type as string | undefined\n  if (type) {\n    const extra: string[] = []\n    if (typeof schema.format === 'string') extra.push(`format: ${schema.format}`)\n    if (Array.isArray(schema.enum)) extra.push(`enum: ${schema.enum.join(', ')}`)\n    if (typeof schema.pattern === 'string') extra.push(`pattern: ${schema.pattern}`)\n\n    const typeStr = extra.length > 0 ? `${type} (${extra.join(', ')})` : type\n    console.log(`${pad}type: ${chalk.cyan(typeStr)}`)\n  }\n\n  // allOf / oneOf / anyOf\n  for (const keyword of ['allOf', 'oneOf', 'anyOf'] as const) {\n    const list = schema[keyword] as Array<Record<string, unknown>> | undefined\n    if (!list) continue\n    console.log(`${pad}${keyword}:`)\n    for (const item of list) {\n      formatSchemaBlock(item, indent + 1, visited)\n    }\n  }\n\n  // array items\n  if (type === 'array' && schema.items) {\n    console.log(`${pad}items:`)\n    formatSchemaBlock(schema.items as Record<string, unknown>, indent + 1, visited)\n  }\n\n  // object properties\n  const properties = schema.properties as Record<string, Record<string, unknown>> | undefined\n  if (properties) {\n    const requiredSet = new Set(Array.isArray(schema.required) ? schema.required as string[] : [])\n\n    console.log(`${pad}properties:`)\n\n    if (indent >= MAX_DEPTH) {\n      console.log(`${pad}  ${chalk.dim('...')}`)\n      return\n    }\n\n    const propPad = '  '.repeat(indent + 1)\n    const entries = Object.entries(properties)\n    const maxNameLen = entries.length > 0 ? Math.max(...entries.map(([n]) => n.length)) : 0\n\n    for (const [propName, propSchema] of entries) {\n      if ('$ref' in propSchema) {\n        const refName = extractRefName(String(propSchema.$ref))\n        const req = requiredSet.has(propName) ? chalk.yellow('(required)') + '  ' : ''\n        console.log(`${propPad}${propName.padEnd(maxNameLen)}  ${chalk.dim(`→ ${refName}`)}  ${req}`)\n        continue\n      }\n\n      const typeLabel = formatTypeLabel(propSchema)\n      const req = requiredSet.has(propName) ? chalk.yellow('(required)') + '  ' : ''\n      const desc = typeof propSchema.description === 'string' ? chalk.dim(propSchema.description) : ''\n\n      console.log(`${propPad}${propName.padEnd(maxNameLen)}  ${chalk.cyan(typeLabel)}  ${req}${desc}`)\n\n      // Recurse into nested objects\n      const propType = propSchema.type as string | undefined\n      if (propType === 'object' && propSchema.properties && indent + 1 < MAX_DEPTH) {\n        const refId = `prop:${propName}`\n        if (!visited.has(refId)) {\n          visited.add(refId)\n          formatSchemaBlock(propSchema, indent + 2, visited)\n        } else {\n          console.log(`${'  '.repeat(indent + 2)}${chalk.dim('(circular)')}`)\n        }\n      }\n\n      if (propType === 'array' && propSchema.items) {\n        const items = propSchema.items as Record<string, unknown>\n        if ('$ref' in items) {\n          console.log(`${'  '.repeat(indent + 2)}items: ${chalk.dim(`→ ${extractRefName(String(items.$ref))}`)}`)\n        } else if ((items.type === 'object' && items.properties) && indent + 1 < MAX_DEPTH) {\n          console.log(`${'  '.repeat(indent + 2)}items:`)\n          formatSchemaBlock(items, indent + 3, visited)\n        }\n      }\n    }\n  }\n\n  // additionalProperties\n  if (schema.additionalProperties && typeof schema.additionalProperties === 'object') {\n    console.log(`${pad}additionalProperties:`)\n    formatSchemaBlock(schema.additionalProperties as Record<string, unknown>, indent + 1, visited)\n  }\n}\n\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\nfunction formatTypeLabel(schema: Record<string, unknown>): string {\n  if ('$ref' in schema) {\n    return `→ ${extractRefName(String(schema.$ref))}`\n  }\n\n  const type = schema.type as string | undefined\n  if (!type) return 'unknown'\n\n  if (type === 'array') {\n    const items = schema.items as Record<string, unknown> | undefined\n    if (items) {\n      if ('$ref' in items) return `${extractRefName(String(items.$ref))}[]`\n      return `${String(items.type || 'unknown')}[]`\n    }\n    return 'array'\n  }\n\n  const parts: string[] = [type]\n  if (typeof schema.format === 'string') parts.push(`(${schema.format})`)\n  if (Array.isArray(schema.enum)) parts.push(`(enum: ${schema.enum.join(', ')})`)\n  if (typeof schema.pattern === 'string') parts.push(`(pattern: ${schema.pattern})`)\n\n  return parts.join(' ')\n}\n\nfunction extractRefName(ref: string): string {\n  const parts = ref.split('/')\n  return parts[parts.length - 1]\n}\n","#!/usr/bin/env node\nimport semver from 'semver'\nimport { Command } from 'commander'\nimport { logger } from './utils/logger.js'\nimport { registerBuildCommand } from './commands/build.js'\nimport { registerFilterCommand } from './commands/filter.js'\nimport { registerListCommand } from './commands/list.js'\nimport { registerApisCommand } from './commands/apis.js'\nimport { registerMockCommand } from './commands/mock.js'\nimport { registerInitCommand } from './commands/init.js'\nimport { registerSearchCommand } from './commands/search.js'\nimport { registerMcpCommand } from './commands/mcp.js'\nimport { registerCacheCommand } from './commands/cache.js'\nimport { registerDescribeCommand } from './commands/describe.js'\n\n\nif (semver.lt(process.version, '20.0.0')) {\n  throw new Error('Node.js version must be greater than 20')\n}\n\nconst program = new Command()\n\nregisterBuildCommand(program)\nregisterFilterCommand(program)\nregisterListCommand(program)\nregisterApisCommand(program)\nregisterMockCommand(program)\nregisterInitCommand(program)\nregisterSearchCommand(program)\nregisterMcpCommand(program)\nregisterCacheCommand(program)\nregisterDescribeCommand(program)\n\nasync function main(): Promise<void> {\n  program.on('command:*', function (operands) {\n    throw new Error(`Unknown command '${String(operands[0])}'`)\n  })\n\n  try {\n    await program.parseAsync(process.argv)\n  } catch (err) {\n    if (process.argv.includes('--debug')) {\n      console.error(err)\n    } else {\n      logger.error(err instanceof Error ? err.message : String(err))\n    }\n    process.exit(1)\n  }\n}\n\nvoid main()\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,SAAgB,WACd,GAAG,OACY;AACf,KAAI,MAAM,WAAW,EAAG,QAAO,EAAE;AACjC,KAAI,MAAM,WAAW,EAAG,QAAO,MAAM;AAMrC,QAFe,MAAM,QAAQ,KAAY,SAAgBA,MAAE,OAAO,UAAmCA,MAAE,KAAK,UAAmCA,MAAE,SAAS,CAAC,OAAO,MAAM,CAAC,EAAE,KAAK,EAAE,IAAI,CAEzK;;;;ACpBf,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