Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,22 @@
<!-- Link to related GitHub issues -->
Closes #

## πŸ§ͺ Testability Checklist
## πŸ§ͺ Code Standards Checklist

<!-- Check all that apply -->
<!-- Check all that apply - See docs/TYPESCRIPT_STANDARDS.md -->

- [ ] Pure functions extracted to `utils/` modules
- [ ] Utilities achieve 100% coverage (statements & functions)
- [ ] No `!` non-null assertions (use guard clauses or optional chaining)
- [ ] **No type assertions (`as`, `!`)** without validation
- [ ] **Runtime validation** for external data (Zod/type guards)
- [ ] **Result types** used instead of exceptions
- [ ] Modules organized by domain (not generic "utils")
- [ ] Each module < 200 lines
- [ ] Each module < 300 lines, each class < 400 lines
- [ ] Constructor injection for dependencies
- [ ] Atomic commits with clear dependencies

**See:** [TypeScript Standards](../docs/TYPESCRIPT_STANDARDS.md)

## βœ… Testing

<!-- Describe testing approach -->
Expand Down
159 changes: 159 additions & 0 deletions WORKFLOW.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

Standard workflow for implementing features in dev-agent.

## πŸ“š Related Documentation

Before starting development, familiarize yourself with our coding standards:

- **[TypeScript Standards](./docs/TYPESCRIPT_STANDARDS.md)** ⭐ **START HERE** - Our coding manifesto
- **[Feature Template](./docs/FEATURE_TEMPLATE.md)** - Step-by-step guide for new features
- **[Architecture](./ARCHITECTURE.md)** - System design and package structure

## The Drillβ„’

### 1. Find Next Work (Dogfooding! πŸ•πŸ½οΈ)
Expand Down Expand Up @@ -99,6 +107,7 @@ pnpm typecheck
- βœ… 100% function coverage
- βœ… No linter errors
- βœ… No TypeScript errors
- βœ… **Follows [TypeScript Standards](./docs/TYPESCRIPT_STANDARDS.md)** (no `as`, Result types, pure functions)
- βœ… Documentation with examples

### 6. Commit & PR
Expand Down Expand Up @@ -175,6 +184,156 @@ Fix MCP install error handling' > .changeset/fix-name.md
- The wrapper package needs to pull in the latest CLI changes
- Ensures `npm install -g dev-agent` gets all improvements

## 🎯 Commit Checkpoints (Know When to Commit)

**Principle:** Commit when you reach a "green state" at a logical boundary. Secure working progress before entering complexity.

### The Checkpoint Signals

Commit when you hit **any 2** of these signals:

#### 1. βœ… Green State
- All tests passing
- Build successful
- No linter/TypeScript errors
- **This is non-negotiable** - never commit broken code

#### 2. 🎯 Logical Boundary
- Foundation complete (schemas, types, utils)
- Feature partially working (demo-able)
- Pattern proven (1+ examples working)
- Module/component finished

#### 3. ⚠️ Before Complexity
- About to refactor large file (>500 lines)
- About to change core architecture
- About to touch multiple interconnected systems
- About to migrate/upgrade major dependencies

#### 4. πŸ“Š Demonstrable Value
- Can show progress in PR review
- Reviewers can understand what changed
- Rollback would still leave useful code
- "X/Y complete" milestones (e.g., "5/9 adapters migrated")

#### 5. 🧠 Context Limits
- Approaching 150K+ tokens in AI session
- Been working >2 hours on single task
- About to switch tasks/contexts
- End of work session

### Examples of Good Checkpoints

βœ… **Foundation + Pattern Proven**
```bash
git commit -m "feat(mcp): add Zod validation to MCP adapters (5/9 complete)

- Create schemas for all 9 adapters (247 lines, 33 tests)
- Migrate 5 adapters (eliminates ~150 lines of validation)
- Pattern proven, remaining 4 follow same approach

All tests passing, build successful"
```

βœ… **Before Complexity**
```bash
git commit -m "refactor(indexer): extract pure stat merging functions

- Extract 6 pure functions from 102-line method
- Add comprehensive tests (17 tests, 100% coverage)
- About to integrate into RepositoryIndexer class

Foundation secure before complex integration"
```

βœ… **Logical Boundary**
```bash
git commit -m "feat(core): add stats metadata tracking

- Add StatsMetadata interface
- Implement in getStats() method
- Update CLI formatters to display metadata

Next: Incremental update merging (complex)"
```

### Anti-Patterns (Don't Commit)

❌ **Broken State**
```bash
# NEVER commit this:
git commit -m "WIP: refactoring adapters, tests failing"
git commit -m "fix: half-done, will finish tomorrow"
```

❌ **No Value**
```bash
# Don't commit just to save work:
git commit -m "save work"
git commit -m "checkpoint" # (what's done?)
git commit -m "WIP" # (what works?)
```

❌ **Debug Code**
```bash
# Don't commit with:
console.log('DEBUG: ...')
// TODO: fix this later
// HACK: temporary workaround
```

### Quick Checkpoint Checklist

Run before every commit:

```bash
# 1. Quality gates
pnpm build # βœ… Builds without errors?
pnpm test # βœ… All tests pass?
pnpm typecheck # βœ… No TypeScript errors?

# 2. Review changes
git diff --stat # πŸ“Š Reasonable change size?
git status # πŸ” All intended files staged?

# 3. If all pass β†’ commit!
git add -A
git commit -m "feat(scope): description..."
```

### Why This Matters

**For Teams:**
- Reduces risk of losing working code
- Makes code review easier (incremental progress)
- Git bisect finds bugs faster
- Enables parallel work (others can pull partial features)

**For AI Collaboration:**
- Context windows reset - commits are checkpoints
- Recovery is instant (just read git log)
- TODOs + commits = perfect state reconstruction
- Enables long-running refactorings (>1 session)

**For You:**
- Sleep better (work is secured)
- Switch contexts freely (commit before leaving)
- Experiment safely (can always rollback)
- Build confidence (see progress accumulate)

### Real Example: Zod Migration

**Checkpoint Decision:** After migrating 5/9 adapters
- βœ… Green: All tests passing, build successful
- βœ… Logical boundary: Foundation complete, pattern proven
- βœ… Before complexity: Next 4 adapters are 690-724 lines each
- βœ… Demonstrable: "5/9 complete, 150 lines eliminated"
- βœ… Context: At 115K tokens, approaching limit

**Result:** Committed working state. If next adapters break, we can rollback to this checkpoint.

---

## Commit Message Format

### Structure
Expand Down
24 changes: 8 additions & 16 deletions docs/FEATURE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,24 +260,16 @@ Before submitting your feature:

---

## πŸ“š Examples
## πŸ“š Examples & Resources

See these implementations:
**Real implementations:**
1. `packages/subagents/src/explorer/` - 99 tests, 100% on utilities
2. `packages/core/src/indexer/stats-merger.ts` - 17 tests, pure functions
3. `packages/cli/src/utils/date-utils.ts` - 18 tests, 100% coverage

1. **Explorer Subagent**
- Path: `packages/subagents/src/explorer/`
- 99 tests, 100% on utilities
- 4 domain modules: metadata, filters, relationships, analysis

2. **Repository Indexer**
- Path: `packages/core/src/indexer/`
- 87 tests on utilities
- 3 domain modules: language, formatting, documents

3. **Subagent Coordinator**
- Path: `packages/subagents/src/coordinator/`
- Context manager, task queue, message protocol
- High test coverage with mocks where needed
**Documentation:**
- [TYPESCRIPT_STANDARDS.md](./TYPESCRIPT_STANDARDS.md) - Our coding manifesto
- [REFACTORING_SUMMARY.md](./REFACTORING_SUMMARY.md) - Recent refactoring example

---

Expand Down
131 changes: 118 additions & 13 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,125 @@
# Dev-Agent Documentation
# Documentation Index

This directory contains comprehensive documentation for the Dev-Agent project.
Welcome to the dev-agent documentation! This index helps you find the right doc for your needs.

## Contents
---

- [Getting Started](./getting-started.md) - Installation and basic usage
- [Architecture](./architecture.md) - System architecture and components
- [Configuration](./configuration.md) - Configuration options
- [Integrations](./integrations.md) - Integration with AI tools
- [API Reference](./api-reference.md) - API documentation
- [Subagents](./subagents.md) - Working with subagents
## πŸš€ Getting Started

## Quick Start
- **[AGENTS.md](../AGENTS.md)** - AI agent guidance for working with this codebase
- **[CLAUDE.md](../CLAUDE.md)** - Claude Code specific integration guide
- **[README.md](../README.md)** - Project overview and quick start

See the [Getting Started](./getting-started.md) guide for installation and basic usage instructions.
---

## Contributing
## πŸ“ Architecture & Design

For contribution guidelines, see the [Contributing](./contributing.md) document.
- **[ARCHITECTURE.md](../ARCHITECTURE.md)** - System architecture, design decisions
- **[LANGUAGE_SUPPORT.md](../LANGUAGE_SUPPORT.md)** - Supported languages and parsers

---

## πŸ’» Development

### Core Standards (Read These First!)

- **[TYPESCRIPT_STANDARDS.md](./TYPESCRIPT_STANDARDS.md)** ⭐ **START HERE - Our Manifesto**
- Pure function extraction
- Runtime validation (Zod)
- Result types vs exceptions
- Dependency injection
- Testing requirements
- Module organization

- **[WORKFLOW.md](../WORKFLOW.md)** ⭐ **Essential**
- Branch strategy
- Commit standards
- PR process
- Testing requirements

### Feature Development

- **[FEATURE_TEMPLATE.md](./FEATURE_TEMPLATE.md)**
- Step-by-step guide for new features
- Structure and organization
- Testing strategy
- Checklist and examples

---

## πŸ§ͺ Testing & Quality

- **[TYPESCRIPT_STANDARDS.md](./TYPESCRIPT_STANDARDS.md)** - Testing philosophy, coverage targets, patterns

---

## 🀝 Contributing

- **[CONTRIBUTING.md](../CONTRIBUTING.md)** - How to contribute
- **[CODE_OF_CONDUCT.md](../CODE_OF_CONDUCT.md)** - Community standards
- **[WORKFLOW.md](../WORKFLOW.md)** - Development workflow

---

## πŸ”§ Operations

- **[TROUBLESHOOTING.md](../TROUBLESHOOTING.md)** - Common issues and solutions
- **[SECURITY.md](../SECURITY.md)** - Security policy

---

## πŸ“ Other Resources

- **[CHANGELOG.md](../CHANGELOG.md)** - Version history
- **[PLAN.md](../PLAN.md)** - Project roadmap

---

## 🎯 Quick Reference by Task

### "I'm implementing a new feature"
1. Read [TYPESCRIPT_STANDARDS.md](./TYPESCRIPT_STANDARDS.md) (our manifesto)
2. Follow [WORKFLOW.md](../WORKFLOW.md)
3. Use [FEATURE_TEMPLATE.md](./FEATURE_TEMPLATE.md) for structure

### "I'm refactoring existing code"
1. Apply [TYPESCRIPT_STANDARDS.md](./TYPESCRIPT_STANDARDS.md) patterns
2. See [REFACTORING_SUMMARY.md](./REFACTORING_SUMMARY.md) for example

### "I'm fixing a bug"
1. Follow [WORKFLOW.md](../WORKFLOW.md#bug-fixes)
2. Add regression tests
3. Document in [TROUBLESHOOTING.md](../TROUBLESHOOTING.md) if common

### "I'm reviewing a PR"
1. Check [.github/pull_request_template.md](../.github/pull_request_template.md)
2. Verify [TYPESCRIPT_STANDARDS.md](./TYPESCRIPT_STANDARDS.md) compliance

### "I'm using AI to help code"
1. Share [AGENTS.md](../AGENTS.md) and [TYPESCRIPT_STANDARDS.md](./TYPESCRIPT_STANDARDS.md) with AI
2. Use [FEATURE_TEMPLATE.md](./FEATURE_TEMPLATE.md) for structure

---

## πŸ“š External Resources

- [TypeScript Handbook](https://www.typescriptlang.org/docs/handbook/intro.html)
- [Zod Documentation](https://zod.dev/)
- [Vitest Guide](https://vitest.dev/guide/)
- [Turborepo Docs](https://turbo.build/repo/docs)

---

## ❓ Questions?

If you can't find what you're looking for:

1. Check this index again
2. Search the repository
3. Ask in GitHub Discussions
4. Create an issue with label `documentation`

---

**Last Updated:** 2024-12-12
**Maintained By:** dev-agent contributors
Loading