用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/vinilana/dotcontext --skill bug-investigation命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
Implement or review bounded MCP inputs and responses. Use for gateway response helpers, MCP Zod schemas, list actions, cursor pagination, maxEvents, JSON serialization, audit logging, response metadata, artifact exports, or payload-size and client-compatibility changes.
Implement or review child-process execution with bounded stdout and stderr memory. Use for Node spawn wrappers, sensors, test runners, acceptance commands, timeout handling, output tails, truncation, or any change that captures subprocess output in the dotcontext harness.
Design, implement, or review bounded cache and persistent-index lifecycle. Use for ContextCache, SemanticContextBuilder, tree-sitter analysis cache, MCP session cache, hook host-session bindings, checkpoints, TTL, LRU, byte budgets, invalidation, cleanup timers, disposal, migration, or runtime retention configuration.
基于 SOC 职业分类
| type | skill |
| name | Bug Investigation |
| description | Systematic bug investigation and root cause analysis |
| skillSlug | bug-investigation |
| phases | ["E","V"] |
| generated | "2026-03-18T00:00:00.000Z" |
| status | filled |
| scaffoldVersion | 2.0.0 |
Systematic approach to investigating and fixing bugs in the @dotcontext/cli CLI tool.
workflow, sync, mcp, etc.) produces incorrect output or crashes| Area | Key Files | Common Issues |
|---|---|---|
| CLI commands | src/index.ts, src/services/*/index.ts | Commander option parsing, missing args |
| MCP server | src/services/mcp/mcpServer.ts, src/services/mcp/gateway/*.ts | repoPath resolution, Zod validation failures |
| Scaffold generation | src/generators/*/, src/types/scaffoldFrontmatter.ts | Frontmatter parsing, file path resolution |
| Scaffold fill via MCP | src/services/ai/tools/fillScaffoldingTool.ts, src/services/mcp/gateway/context.ts | Missing files, stale context, oversized responses |
| Semantic analysis | src/services/semantic/codebaseAnalyzer.ts, src/services/semantic/treeSitter/ | tree-sitter optional dep missing, parse failures |
| Workflow | src/workflow/, src/services/workflow/workflowService.ts | Phase transition logic, gate checking |
| i18n | src/utils/i18n.ts | Missing translation keys, locale detection |
| Frontmatter | src/utils/frontMatter.ts | v1 vs v2 format confusion, status detection |
Run the CLI in dev mode to reproduce:
# Direct execution via tsx
npx tsx src/index.ts workflow --help
# For MCP-related bugs, capture stderr output
npx tsx src/index.ts mcp --verbose 2>mcp-debug.log
For MCP tool bugs, test the gateway handler directly in a script or test file rather than through the full MCP transport.
Trace the call path from the CLI command or MCP tool to the responsible service:
CLI command (src/index.ts)
-> Service (src/services/<domain>/)
-> Generator (src/generators/) or Util (src/utils/)
For MCP:
MCP tool (mcpServer.ts registerGatewayTools)
-> Gateway handler (src/services/mcp/gateway/<tool>.ts)
-> Service (src/services/<domain>/)
tree-sitter and tree-sitter-typescript are in optionalDependencies. Code must handle their absence gracefully. Check src/services/semantic/treeSitter/treeSitterLayer.ts.process.cwd(). Bugs often arise from incorrect path resolution. See getRepoPath() in mcpServer.ts.src/utils/frontMatter.ts and isScaffoldFrontmatter().src/services/ai/providerFactory.ts and src/utils/prompts/smartDefaults.ts. MCP-hosted generation usually relies on the connected tool's model.path.resolve() or path.join(). Watch for relative vs. absolute path confusion, especially in contextBuilder.ts.Run the relevant test suite to see what is expected:
# Run all tests
npm test
# Run specific test file
npx jest src/services/mcp/mcpServer.test.ts
# Run tests matching a pattern
npx jest --testPathPattern="mcp"
Key test files:
src/services/mcp/mcpServer.test.ts -- MCP server instantiationsrc/services/mcp/mcpServer.test.ts -- MCP tool registration and dispatchsrc/services/semantic/codebaseAnalyzer.test.ts -- Semantic analysissrc/utils/frontMatter.test.ts -- Frontmatter parsingsrc/utils/contentSanitizer.test.ts -- Content sanitizationsrc/workflow/gates/gateChecker.test.ts -- Workflow gate logicThe project uses ora for spinners and chalk for colored output. For debugging:
--verbose flag to enable detailed logginglog() method writes to process.stderr when verbose: trueconsole.error() calls (never console.log() in MCP mode)After identifying root cause:
npm testnpx tsx src/index.ts <command>npm run build@generators/agents/* path alias (defined in tsconfig.json)tsconfig.jsonmcpServer.ts -- params may not match the schemarepoPath resolves to a directory with .context/ scaffoldingscaffoldVersion: "2.0.0" and status: unfilled|filledisScaffoldFrontmatter() check happens before v1 fallbacksrc/workflow/gates/src/workflow/prevcConfig.ts for scale definitionsfillSingleFileTool can read the scaffold and build semantic contextgetScaffoldStructure()SemanticContextBuilder is returning project-specific content