Codebase intelligence engine and AI agent skill.
Point CodeDna at any local directory or remote Git URL. It scans the repository and produces a complete intelligence report β tech stack, architecture, LOC distribution, framework usage, infrastructure, dead code β in milliseconds. Output is both human-readable and machine-readable (JSON), making it the ideal first command for any AI coding agent.
codedna analyze .
codedna analyze https://github.com/vercel/next.js
codedna json . --compactThis repository is primarily a Rust CLI tool. It also ships agent integration files so CodeDna can be used cleanly from Codex, OpenCode, and Claude.
- Install
- Quick Start
- Commands
- Example Output
- JSON Output
- How It Works
- Git URL Support
- Detection Coverage
- Performance
- AI Agent Skill
- Project Structure
- Contributing
- License
cargo install --git https://github.com/crafteraadarsh/codednagit clone https://github.com/crafteraadarsh/codedna
cd codedna
cargo install --path .Requires Rust stable. Install Rust at rustup.rs.
Verify installation:
codedna --versionCodeDna integrates with agents using their native distribution paths:
Codex: packaged skill inskill/codedna/OpenCode: native skill in.opencode/skills/codedna/Claude: plugin marketplace at.claude-plugin/marketplace.json
If you want Codex to use CodeDna as a real skill, use the dedicated package in skill/codedna/.
skill/codedna/SKILL.mdcontains the trigger description and workflowskill/codedna/agents/openai.yamlcontains Codex UI metadata
Install it with:
./scripts/install-codex-skill.shPackage it as a distributable tarball with:
./scripts/package-codex-skill.shTo copy the OpenCode skill into another repository and add Claude bootstrap guidance:
./scripts/bootstrap-agent-files.sh /path/to/target-repo opencode claudeTo install the Codex skill and bootstrap OpenCode plus Claude in one go:
./scripts/bootstrap-agent-files.sh /path/to/target-repo codex opencode claudeInstall the OpenCode skill globally with:
./scripts/install-opencode-skill.shOpenCode also discovers project-local skills from:
.opencode/skills/codedna/SKILL.md
This repository now includes an official Claude plugin marketplace:
.claude-plugin/marketplace.json
plugins/codedna/.claude-plugin/plugin.json
In Claude Code, install it with:
/plugin marketplace add crafteraadarsh/codedna
/plugin install codedna@codedna-marketplace
# Full intelligence report (local)
codedna analyze .
# Full intelligence report (remote β auto-clones)
codedna analyze https://github.com/vercel/next.js
# JSON for AI agents
codedna json . --compact
# Tech stack only
codedna stack .
# Dead code detection
codedna deadcode https://github.com/user/repo
# Directory tree
codedna map . --depth 3
# Find files using a specific framework
codedna framework react .All commands accept a local path or a Git URL.
| Command | Description |
|---|---|
codedna analyze [path|url] |
Full intelligence report |
codedna analyze [path|url] --time |
Report with elapsed time |
codedna stack [path|url] |
Languages, frameworks, databases |
codedna files [path|url] |
Per-file LOC breakdown |
codedna framework <name> [path|url] |
Files importing a given framework |
codedna deadcode [path|url] |
Unreachable / unused files |
codedna map [path|url] |
Directory tree |
codedna map [path|url] --depth N |
Directory tree limited to N levels |
codedna scan [path|url] |
Raw scanned file list |
codedna json [path|url] |
Full analysis as JSON |
codedna json [path|url] --compact |
Single-line JSON |
codedna json [path|url] --time |
JSON with elapsed time |
ββββββββββββββββββββββββββββββββββββββββββ
β β
β CodeDna Intelligence Report β
β β
ββββββββββββββββββββββββββββββββββββββββββ
Project Type
ββββββββββββ
Full-stack web application
Stack
βββββ
React + Vite + Express
Databases
βββββββββ
PostgreSQL, Redis
Infrastructure
ββββββββββββββ
Docker β’ GitHub Actions
Architecture
ββββββββββββ
Frontend β API β Database
Languages
βββββββββ
TypeScript ββββββββββββββββββββββββββββ 78% 12,450 LOC
JavaScript ββββββββββββββββββββββββββββ 13% 2,100 LOC
CSS ββββββββββββββββββββββββββββ 7% 1,100 LOC
Markdown ββββββββββββββββββββββββββββ 2% 130 LOC
Top 5 Files by LOC
ββββββββββββββββββ
1 src/server.ts 340 LOC TypeScript
2 src/controllers/user.ts 290 LOC TypeScript
3 src/api/routes.ts 240 LOC TypeScript
4 src/components/Dashboard.tsx 180 LOC TypeScript
5 src/utils/auth.ts 160 LOC TypeScript
Dead Code
βββββββββ
src/utils/oldHelper.ts
src/components/LegacyNavbar.tsx
Summary
βββββββ
Total LOC 15,780
Languages 4
Frameworks 3
Databases 2
Infrastructure 2
Files scanned 148
Dead files 2
Dependency links 87
codedna json . produces structured JSON for programmatic consumption:
{
"project_type": "Full-stack web application",
"total_loc": 15780,
"languages": {
"TypeScript": 12450,
"JavaScript": 2100,
"CSS": 1100
},
"frameworks": ["React", "Vite", "Express"],
"databases": ["PostgreSQL", "Redis"],
"infrastructure": ["Docker", "GitHub Actions"],
"architecture": "Frontend β API β Database",
"dead_code": [
"src/utils/oldHelper.ts",
"src/components/LegacyNavbar.tsx"
],
"dependency_graph": {
"src/server.ts": ["src/api/routes.ts"],
"src/api/routes.ts": ["src/controllers/user.ts"]
},
"file_breakdown": [
{ "file": "src/server.ts", "loc": 340, "language": "TypeScript" }
]
}| Field | Type | Description |
|---|---|---|
project_type |
string | High-level project classification |
total_loc |
number | Total non-empty lines of code |
languages |
object | Language β LOC map |
frameworks |
string[] | Detected frameworks |
databases |
string[] | Detected databases / ORMs |
infrastructure |
string[] | Detected DevOps tooling |
architecture |
string | Inferred architecture pattern |
dead_code |
string[] | Unreachable file paths |
dependency_graph |
object | File β imported files map |
file_breakdown |
object[] | Per-file { file, loc, language } |
# Compact agent context
codedna json . --compact | jq -c '{project_type,frameworks,databases,infrastructure,architecture,total_loc}'
# All frameworks
codedna json . | jq '.frameworks[]'
# Languages sorted by LOC
codedna json . | jq '.languages | to_entries | sort_by(-.value)'
# Dead code files
codedna json . | jq '.dead_code[]'
# Top 5 largest files
codedna json . | jq '.file_breakdown[:5]'
# Check if Docker is used
codedna json . | jq '.infrastructure | contains(["Docker"])'Input (local path or Git URL)
β
βΌ
Git Handler β detect URL vs path; shallow-clone if remote
β
βΌ
Scanner β recursive file walk, skip ignored directories
β
ββββΊ Language Detector β file extension β language classification
ββββΊ LOC Counter β count non-empty lines per file (parallel)
ββββΊ Framework Detector β parse manifests + per-file import scanning
ββββΊ Infra Detector β detect Docker, CI, Kubernetes, Makefile
ββββΊ Dependency Graph β parse import/require/mod statements (parallel)
ββββΊ Dead Code Detector β BFS from entry points over dependency graph
β
βΌ
AnalysisResult
β
βββββββ΄ββββββ
βΌ βΌ
CLI Report JSON Output
β
βΌ
Cleanup (delete temp dir if remote)
All file-level analysis runs in parallel via rayon.
CodeDna accepts Git URLs directly. No manual cloning required.
https://github.com/user/repo
https://gitlab.com/user/repo
http://github.com/user/repo
git@github.com:user/repo.git
git@gitlab.com:user/repo.git
Any input starting with http://, https://, or git@ is treated as a Git URL. Everything else is a local path.
- URL detected β shallow clone (
--depth 1) into a temp directory - Standard analysis pipeline runs on the cloned content
- Output paths are normalized (identical format to local analysis)
- Temp directory is deleted automatically
- Repository not found β clear message for non-existent repos
- Network failure β connectivity error with retry suggestion
- Invalid URL β message indicating the URL is not a valid Git repository
- Auth required β message for private repos needing authentication
.rs .ts .tsx .js .jsx .mjs .py .go .sol .css .scss .sass .html .htm .toml .json .yml .yaml .md .sh .bash .zsh
| Ecosystem | Frameworks |
|---|---|
| JS / TS | React, Next.js, Vue, Nuxt, Svelte, Astro, Remix, Gatsby, Express, Vite, NestJS, Fastify, Koa, Hapi |
| Python | FastAPI, Django, Flask, Starlette, Tornado, aiohttp, Pyramid, Sanic, Litestar |
| Rust | Tokio, Axum, Actix-web, Rocket, Warp, Tonic, Poem, Hyper, Tauri, Leptos, Dioxus, Yew |
| Go | Gin, Echo, Fiber, Gorilla Mux, Beego, Chi, Revel, Uber FX |
| Source | Databases |
|---|---|
package.json |
PostgreSQL, MongoDB, MySQL, Redis, Prisma, SQLite, Sequelize, TypeORM, Drizzle ORM, Knex, Cassandra, Elasticsearch, DynamoDB |
requirements.txt |
SQLAlchemy, PostgreSQL, MongoDB, Redis, MySQL, Tortoise ORM, Peewee |
Cargo.toml |
SQLx, Diesel, SeaORM, PostgreSQL, MongoDB, Redis, SQLite, Sled, Elasticsearch |
| Signal | Technology |
|---|---|
Dockerfile |
Docker |
docker-compose.yml / .yaml |
Docker Compose |
.github/workflows/*.yml |
GitHub Actions |
k8s/ or kubernetes/ YAML files |
Kubernetes |
Makefile |
Makefile |
| Signals | Result |
|---|---|
| Frontend + Backend + Database | Frontend β API β Database |
| Frontend + Backend | Frontend β API |
| Backend + Database | API β Database |
| Frontend only | Frontend only |
| Backend only | API only |
| None detected | Monolithic / undetermined |
node_modules/ .git/ target/ dist/ build/ coverage/
| Metric | Value |
|---|---|
| Local analysis (26 files) | ~2.6 ms |
| Remote repos | Shallow clone (--depth 1) |
| Parallelism | rayon β all CPU cores |
| 100k+ file repos | < 5 seconds target |
| Memory | Streaming per-file reads |
| Temp dir cleanup | Automatic after analysis |
# Build in release mode for best performance
cargo build --release
./target/release/codedna analyze .CodeDna is designed as the first command any AI agent runs on a new codebase.
codedna/
βββ .claude-plugin/
β βββ marketplace.json β Claude plugin marketplace definition
βββ .opencode/
β βββ skills/
β βββ codedna/
β βββ SKILL.md β native OpenCode skill
βββ skills/
β βββ codedna-analyzer/
β βββ SKILL.md β full portable skill specification
β βββ examples/
β βββ local-analysis.md
β βββ remote-analysis.md
βββ skill/
β βββ codedna/
β βββ SKILL.md β valid Codex skill package
β βββ agents/openai.yaml β Codex skill metadata
βββ plugins/
β βββ codedna/
β βββ .claude-plugin/plugin.json
β βββ skills/codedna/SKILL.md
βββ templates/
β βββ CLAUDE.md β portable Claude template
βββ scripts/
β βββ install-codex-skill.sh
β βββ install-opencode-skill.sh
β βββ package-codex-skill.sh
β βββ bootstrap-agent-files.sh
βββ AGENTS.md β OpenCode / Codex CLI
βββ CLAUDE.md β Claude Code
βββ GEMINI.md β Gemini CLI
βββ .cursorrules β Cursor
The detailed, portable reference lives in skills/codedna-analyzer/SKILL.md. The valid Codex skill package lives in skill/codedna/.
| File | Purpose |
|---|---|
AGENTS.md |
Instructions for OpenCode and Codex-style repo guidance here |
CLAUDE.md |
Claude Code bootstrap for this repository |
GEMINI.md |
Gemini CLI bootstrap for this repository |
.cursorrules |
Cursor guidance for this repository |
.opencode/skills/codedna/SKILL.md |
Native OpenCode skill |
.claude-plugin/marketplace.json |
Claude marketplace definition |
plugins/codedna/.claude-plugin/plugin.json |
Claude plugin manifest |
plugins/codedna/skills/codedna/SKILL.md |
Claude-packaged CodeDna skill |
skill/codedna/SKILL.md |
Codex skill trigger and workflow |
skill/codedna/agents/openai.yaml |
Codex UI metadata for the skill |
templates/CLAUDE.md |
Portable Claude bootstrap template |
scripts/install-opencode-skill.sh |
Installs the OpenCode skill globally |
scripts/bootstrap-agent-files.sh |
Copies/install skills into a target repository |
Each config file instructs the agent to run codedna json . --compact before any task and use the output to understand the project.
# Get compact context
codedna json . --compact | jq -c '{project_type,frameworks,databases,infrastructure,architecture,total_loc}'
# Or for a remote repo
codedna json https://github.com/user/repo --compact | jq -c '{project_type,frameworks,databases,infrastructure,architecture,total_loc}'
# Copy to clipboard (macOS)
codedna json . --compact | pbcopy
# Copy to clipboard (Linux)
codedna json . --compact | xclip -selection clipboardSee skills/codedna-analyzer/SKILL.md for the complete skill definition β JSON schema, field reference, detection tables, architecture inference, jq recipes, and annotated examples.
src/
βββ main.rs β entry point, module declarations
βββ cli.rs β clap CLI definitions and command dispatch
βββ git_handler.rs β Git URL detection, shallow clone, temp dir management
βββ analysis.rs β analysis pipeline orchestration
βββ scanner.rs β recursive file walker (walkdir)
βββ language_detector.rs β file extension β language mapping
βββ loc_counter.rs β line counting with binary detection
βββ framework_detector.rs β manifest parsing + per-file import scanning
βββ dependency_graph.rs β import/require/mod statement parsing
βββ dead_code_detector.rs β BFS reachability from entry points
βββ reporter.rs β CLI report + JSON output formatting
βββ repo_map.rs β tree-style directory rendering
| Crate | Purpose |
|---|---|
clap 4 |
CLI argument parsing (derive) |
walkdir 2 |
Recursive directory traversal |
serde + serde_json |
JSON serialization |
rayon |
Parallel file processing |
git2 0.19 |
Git operations (vendored OpenSSL) |
tempfile 3 |
Temp directory management |
Cross-platform CI via GitHub Actions β runs on every push to main:
- Clippy β lint-free (
-D warnings) - Rustfmt β format check
- Tests β Ubuntu, macOS, Windows (155 tests)
- Release builds β Linux x86_64, macOS x86_64, macOS ARM64, Windows x86_64
Release binaries are uploaded as artifacts on every green build.
Contributions welcome. See CONTRIBUTING.md for the full guide.
cargo test # 155 tests must pass
cargo clippy # must be warning-free
cargo fmt # must be formattedMIT β see LICENSE.