|
1 | 1 | # Contributing to Dev-Agent |
2 | 2 |
|
3 | | -Thank you for considering contributing to dev-agent! This document outlines the process for contributing and the standards we follow. |
| 3 | +## Prerequisites |
4 | 4 |
|
5 | | -## 🎯 **Core Values** |
| 5 | +- **Node.js >= 22** (LTS) |
| 6 | +- **pnpm** — `npm install -g pnpm` |
| 7 | +- **Claude Code** — [install](https://claude.com/claude-code). We use Claude Code + dev-agent for development. |
| 8 | +- **dev-agent** — `npm install -g @prosdevlab/dev-agent` |
| 9 | +- **Antfly** — local search backend. Run `dev setup` after install. |
6 | 10 |
|
7 | | -1. **Testability First** - If it's hard to test, refactor it |
8 | | -2. **Modularity** - Small, focused, reusable modules |
9 | | -3. **100% Coverage on Utilities** - Pure functions should be fully tested |
10 | | -4. **Atomic Commits** - Each commit should build and test independently |
| 11 | +## Getting started |
11 | 12 |
|
12 | | -## Development Process |
| 13 | +```bash |
| 14 | +# Clone and install |
| 15 | +git clone https://github.com/prosdevlab/dev-agent.git |
| 16 | +cd dev-agent |
| 17 | +pnpm install |
| 18 | + |
| 19 | +# Start Antfly (one-time setup) |
| 20 | +dev setup |
13 | 21 |
|
14 | | -1. **Fork and clone** the repository |
15 | | -2. **Install dependencies**: `pnpm install` |
16 | | -3. **Create a branch**: `git checkout -b feature/my-feature` |
17 | | -4. **Make your changes** |
18 | | -5. **Test your changes**: `pnpm test` |
19 | | -6. **Ensure code quality**: `pnpm lint && pnpm typecheck` |
| 22 | +# Index the codebase |
| 23 | +dev index |
20 | 24 |
|
21 | | -## Commit Message Convention |
| 25 | +# Install MCP server for Claude Code |
| 26 | +dev mcp install |
22 | 27 |
|
23 | | -We follow [Conventional Commits](https://www.conventionalcommits.org/) for commit messages. This is enforced using commitlint. |
| 28 | +# Build and test |
| 29 | +pnpm build |
| 30 | +pnpm test |
| 31 | +``` |
24 | 32 |
|
25 | | -Format: `type(scope): subject` |
| 33 | +## Development workflow |
26 | 34 |
|
27 | | -Types: |
28 | | -- `feat`: A new feature |
29 | | -- `fix`: A bug fix |
30 | | -- `docs`: Documentation changes |
31 | | -- `style`: Changes that don't affect code meaning (formatting, etc.) |
32 | | -- `refactor`: Code changes that neither fix bugs nor add features |
33 | | -- `perf`: Performance improvements |
34 | | -- `test`: Adding or fixing tests |
35 | | -- `chore`: Changes to build process or auxiliary tools |
| 35 | +We use Claude Code with dev-agent's MCP tools for development. The tools |
| 36 | +provide semantic code search, call graph tracing, pattern analysis, and |
| 37 | +codebase structure — saving significant context window usage. |
36 | 38 |
|
37 | | -Example: |
38 | | -``` |
39 | | -feat(core): add new API method for authentication |
| 39 | +### Before you code |
| 40 | + |
| 41 | +1. **Index the repo:** `dev index` (run after pulling changes) |
| 42 | +2. **Understand the area:** `dev search "your topic"`, `dev map --focus packages/core` |
| 43 | +3. **Plan non-trivial features:** Write a plan in `.claude/da-plans/` and run the `plan-reviewer` agent before implementation |
| 44 | + |
| 45 | +### While you code |
| 46 | + |
| 47 | +```bash |
| 48 | +pnpm dev # Watch mode |
| 49 | +pnpm test # Run tests (from root, NOT turbo test) |
| 50 | +pnpm lint # Biome lint |
| 51 | +pnpm typecheck # Type check (AFTER pnpm build) |
40 | 52 | ``` |
41 | 53 |
|
42 | | -## Pull Request Process |
| 54 | +### Before you PR |
43 | 55 |
|
44 | | -1. Update the README.md if needed with details of changes to the interface. |
45 | | -2. Add a changeset to document your changes: `pnpm changeset` |
46 | | -3. Create a pull request to the `main` branch. |
47 | | -4. The PR will be reviewed and merged if it meets our standards. |
| 56 | +1. Run the `code-reviewer` agent on your branch diff |
| 57 | +2. Address any CRITICAL or WARNING findings |
| 58 | +3. Add a changeset: `pnpm changeset` (only for `@prosdevlab/dev-agent` or `@prosdevlab/kero`) |
| 59 | +4. Update release notes in `website/content/updates/index.mdx` and `website/content/latest-version.ts` |
48 | 60 |
|
49 | | -## Adding New Packages |
| 61 | +## Commit convention |
50 | 62 |
|
51 | | -1. Create a new directory in the `packages` folder. |
52 | | -2. Create a `package.json`, `tsconfig.json`, and source files. |
53 | | -3. Add the package to relevant workspace configurations. |
54 | | -4. Update path mappings in the root `tsconfig.json`. |
| 63 | +[Conventional Commits](https://www.conventionalcommits.org/) enforced by commitlint. |
55 | 64 |
|
56 | | -## Testing & Testability |
| 65 | +``` |
| 66 | +type(scope): description |
57 | 67 |
|
58 | | -### 📖 **Read First:** [TESTABILITY.md](./docs/TESTABILITY.md) |
| 68 | +feat(mcp): add health check adapter |
| 69 | +fix(core): resolve vector search timeout |
| 70 | +docs: update CLAUDE.md |
| 71 | +chore: update dependencies |
| 72 | +``` |
59 | 73 |
|
60 | | -Our comprehensive testability guide covers: |
61 | | -- When and how to extract utilities |
62 | | -- Organization patterns |
63 | | -- Coverage targets |
64 | | -- Real-world examples |
| 74 | +Types: `feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `chore`, `ci` |
65 | 75 |
|
66 | | -### **Quick Rules:** |
| 76 | +## Pull request process |
67 | 77 |
|
68 | | -1. **Extract Pure Functions** to `utils/` modules |
69 | | - - ✅ DO: `utils/formatting.ts` with `formatDocument(doc: Document)` |
70 | | - - ❌ DON'T: Private methods in 500-line classes |
| 78 | +1. Create a branch: `git checkout -b feat/my-feature` |
| 79 | +2. Make your changes with tests |
| 80 | +3. Run the full validation suite: `pnpm build && pnpm test && pnpm typecheck && pnpm lint` |
| 81 | +4. Run `code-reviewer` agent on the diff |
| 82 | +5. Add a changeset if the change affects published packages |
| 83 | +6. Push and create a PR to `main` |
71 | 84 |
|
72 | | -2. **Aim for 100% on Utilities** |
73 | | - - Pure functions are easy to test |
74 | | - - No mocks needed |
75 | | - - Foundation for everything else |
| 85 | +## CLI tools (available after `dev index`) |
76 | 86 |
|
77 | | -3. **No Non-Null Assertions (`!`)** |
78 | | - - Use guard clauses or optional chaining |
79 | | - - Makes code safer and more testable |
| 87 | +```bash |
| 88 | +dev search "authentication" # Semantic code search |
| 89 | +dev refs "functionName" # Find callers/callees |
| 90 | +dev refs "fn" --depends-on "src/db.ts" # Trace dependency chain |
| 91 | +dev map # Codebase structure overview |
| 92 | +dev map --focus packages/core --depth 3 # Focused map |
| 93 | +``` |
80 | 94 |
|
81 | | -4. **Organize by Domain** |
82 | | - - ✅ `utils/strings.ts`, `utils/dates.ts`, `utils/validation.ts` |
83 | | - - ❌ `utils.ts` (500 lines of everything) |
| 95 | +## Agent system (`.claude/agents/`) |
84 | 96 |
|
85 | | -### **Coverage Targets:** |
| 97 | +We use Claude Code agents for code review, research, and planning: |
86 | 98 |
|
87 | | -| Code Type | Target | Example | |
88 | | -|-----------|--------|---------| |
89 | | -| **Pure Utilities** | 100% | `formatDocument()`, `calculateCoverage()` | |
90 | | -| **Integration** | >80% | `RepositoryIndexer`, `ExplorerAgent` | |
91 | | -| **CLI/UI** | >60% | Command handlers, spinners | |
| 99 | +| Agent | Purpose | |
| 100 | +|-------|---------| |
| 101 | +| `code-reviewer` | Orchestrates security, logic, and quality review in parallel | |
| 102 | +| `research-planner` | Maps internal code + delegates external research to sub-agents | |
| 103 | +| `plan-reviewer` | Two-pass plan review (engineer + SDET) | |
| 104 | +| `bug-investigator` | Systematic root cause analysis | |
| 105 | +| `quick-scout` | Fast codebase exploration | |
92 | 106 |
|
93 | | -### **Before Submitting:** |
| 107 | +Agents use dev-agent's MCP tools (`dev_search`, `dev_refs`, `dev_map`, `dev_patterns`) |
| 108 | +to understand the codebase without reading every file. |
94 | 109 |
|
95 | | -```bash |
96 | | -# Run tests with coverage |
97 | | -pnpm vitest run --coverage |
| 110 | +## Architecture |
98 | 111 |
|
99 | | -# Check specific package |
100 | | -pnpm vitest run packages/core/src/indexer --coverage |
101 | | -``` |
| 112 | +See [CLAUDE.md](./CLAUDE.md) for the full monorepo structure, build order, |
| 113 | +MCP tools reference, and non-negotiables. |
102 | 114 |
|
103 | | -- Write tests for all new features and bug fixes |
104 | | -- Run existing tests to ensure your changes don't break existing functionality |
105 | | -- See [TESTABILITY.md](./docs/TESTABILITY.md) for detailed guidelines |
| 115 | +## Testing |
106 | 116 |
|
107 | | -## Code Style |
| 117 | +- **Tests run from root only:** `pnpm test` |
| 118 | +- **Build before typecheck:** `pnpm build` then `pnpm typecheck` |
| 119 | +- **Biome for linting:** `pnpm lint` (not ESLint) |
108 | 120 |
|
109 | | -We use Biome for linting and formatting: |
| 121 | +| Code type | Coverage target | |
| 122 | +|-----------|----------------| |
| 123 | +| Pure utilities | 100% | |
| 124 | +| Integration | >80% | |
| 125 | +| CLI/UI | >60% | |
110 | 126 |
|
111 | | -- Run `pnpm lint` to check code quality. |
112 | | -- Run `pnpm format` to format the code. |
| 127 | +See [TESTABILITY.md](./docs/TESTABILITY.md) for detailed guidelines. |
113 | 128 |
|
114 | | -All code must pass linting and typechecking before being merged. |
| 129 | +## Changesets |
115 | 130 |
|
116 | | -## Versioning |
| 131 | +We use [Changesets](https://github.com/changesets/changesets) for versioning. |
| 132 | +Only `@prosdevlab/dev-agent` and `@prosdevlab/kero` are published — all other |
| 133 | +packages are private and bundled. |
117 | 134 |
|
118 | | -We use [Changesets](https://github.com/changesets/changesets) to manage versions and generate changelogs. |
| 135 | +```bash |
| 136 | +pnpm changeset # Create a changeset |
| 137 | +``` |
119 | 138 |
|
120 | | -After making changes: |
121 | | -1. Run `pnpm changeset` |
122 | | -2. Follow the prompts to describe your changes |
123 | | -3. Commit the generated changeset file |
| 139 | +When adding a changeset, also update: |
| 140 | +1. `website/content/updates/index.mdx` — release notes |
| 141 | +2. `website/content/latest-version.ts` — latest version callout |
124 | 142 |
|
125 | 143 | ## Questions? |
126 | 144 |
|
127 | | -If you have any questions, please open an issue or discussion in the repository. |
| 145 | +Open an issue or discussion in the repository. |
0 commit comments