This guide covers advanced usage patterns and features of DoCode.
cd docode/packages/core
node dist/index.js analyze --folder /path/to/node-projectDoCode automatically detects:
- JavaScript/TypeScript files (
.js,.ts,.jsx,.tsx) - Package dependencies (
package.json) - Module imports/exports
node dist/index.js analyze --folder /path/to/python-projectDetects:
- Python files (
.py) - Classes, functions, methods
- Import statements
- Decorators
node dist/index.js analyze --folder /path/to/monorepoHandles:
- Workspace packages
- Cross-package dependencies
- Shared configurations
DoCode is optimized for speed:
- 485 files analyzed in ~1 second
- Cache key system avoids re-analysis
- Progress indicators for long runs
After analysis, the target repository contains:
your-project/
├── .DoCode/
│ ├── knowledge-graph.json # Structural graph (required)
│ ├── domain-graph.json # Domain/business graph (optional)
│ ├── meta.json # Analysis metadata
│ └── docs/ # Generated docs (optional, future)
│ ├── README.md
│ ├── documentation-bundle.json
│ └── export-manifest.json
Contains the structural representation:
{
"nodes": [
{
"id": "file:src/index.ts",
"type": "file",
"label": "index.ts",
"path": "src/index.ts",
"language": "typescript"
},
{
"id": "func:main",
"type": "function",
"label": "main",
"file": "src/index.ts",
"line": 10
}
],
"edges": [
{
"source": "file:src/index.ts",
"target": "func:main",
"type": "defines"
},
{
"source": "func:main",
"target": "func:helper",
"type": "calls"
}
]
}Analysis metadata:
{
"lastAnalyzedAt": "2026-04-20T06:10:41.234Z",
"gitCommitHash": "7893c4df4dc3462ac45e2a11dfc7477415bcbd59",
"version": "1.0.0-phase4",
"analyzedFiles": 485,
"analysisMode": "codebase",
"sourceType": "folder"
}# Set the graph directory
export GRAPH_DIR=/path/to/your-project/.DoCode
# Start development server
pnpm dev:dashboard
# Or in one line
GRAPH_DIR=/path/to/project/.DoCode pnpm dev:dashboardKeyboard Shortcuts (from KeyboardShortcutsHelp.tsx):
Ctrl+F/Cmd+F: Open searchEscape: Close modals?: Show keyboard shortcuts help
Path Finder (from PathFinderModal.tsx):
- Find shortest path between two code entities
- Useful for understanding dependencies
The dashboard provides:
- Full-text search across all nodes
- Filter by type (file, function, class)
- Navigate to definition with one click
Domain graphs capture business logic and high-level flows:
# Enable domain graph generation (if supported)
node dist/index.js analyze --folder /path/to/project --include-domainDomain graphs include:
- User flows
- Business logic relationships
- High-level architecture patterns
node dist/index.js analyze --github https://github.com/4shil/agent-sandboxFor private repos, ensure you have:
- GitHub CLI authenticated (
gh auth login) - Or set
GITHUB_TOKENenvironment variable
export GITHUB_TOKEN=ghp_yourtokenhere
node dist/index.js analyze --github https://github.com/user/private-reponode dist/index.js analyze --zip /path/to/archive.zipUseful for:
- Analyzing code without cloning
- Sharing analysis results
- CI/CD integration
Add DoCode to your CI pipeline:
# .github/workflows/analyze.yml
name: Code Analysis
on: [push, pull_request]
jobs:
analyze:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'
- run: npm install -g pnpm
- run: pnpm install
- run: pnpm --filter @docode/core build
- run: |
cd docode/packages/core
node dist/index.js analyze --folder .
- uses: actions/upload-artifact@v3
with:
name: knowledge-graph
path: .DoCode/DoCode uses a cache key system. If the code hasn't changed, it skips re-analysis:
// .DoCode/meta.json
{
"cacheKey": "4c2e8780ef79d6eaf6a6a997c340b8435c9f3b68"
}For large monorepos, analyze only specific packages:
node dist/index.js analyze --folder ./packages/coreDoCode automatically excludes:
node_modules/.git/dist/,build/,out/- Binary files
- Check if cache is working (look for
"cacheHit": truein meta.json) - Analyze smaller subdirectories first
- Check for infinite loops in symlinks
- Verify
GRAPH_DIRpoints to a directory withknowledge-graph.json - Check browser console for errors
- Ensure the JSON file is valid (use
jqto validate)
- Use dashboard filters to hide certain node types
- Zoom out to see the full structure
- Use the path finder to focus on specific relationships
If you need custom analysis logic, you can:
- Fork the core package
- Modify
docode/packages/core/src/analyzer.ts - Add custom node/edge types
- Rebuild:
pnpm --filter @docode/core build
- Explore the Dashboard in detail
- Read the API Reference for programmatic usage
- Check Contributing if you want to extend DoCode