ワンクリックで
ワンクリックで
Design MCP tools and gateway interfaces for the dotcontext server
Review code quality, patterns, and best practices
Generate commit messages following conventional commits with scope detection
Generate and update technical documentation
Break down features into implementable tasks
Review pull requests against team standards and best practices
| 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