5526 Commits

Author SHA1 Message Date
Steve Yegge
4192dd27f5 more pre-launch README tweaks 2025-10-12 23:00:25 -07:00
Steve Yegge
378d98ff92 some more pre-launch tweaks to README.md 2025-10-12 22:24:25 -07:00
Steve Yegge
57e2f0593c more pre-launch README tweaks 2025-10-12 22:18:48 -07:00
Steve Yegge
3e00a32f6f edited the README.md intro 2025-10-12 22:10:44 -07:00
Steve Yegge
aaeff4d9bc Close bd-1: Export/import commands fully implemented
Feature is complete with JSONL format, collision detection, and auto-resolution.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-12 21:58:43 -07:00
Steve Yegge
fc0b323d57 Clarify multi-project isolation in README
- Updated Features: Multi-project isolation instead of Project-aware
- Expanded FAQ to clearly explain multi-project scenarios
- Added concrete example showing multiple agents on different projects
- Documented limitation: cross-project issue linking not supported
- Emphasized that each project database is completely isolated (no conflicts)

Makes it clear that running bd on multiple projects simultaneously is safe and expected.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-12 19:14:43 -07:00
Steve Yegge
896a950301 Add collaborative workflow diagram and clarify PostgreSQL status
- Added new diagram showing humans + AI agents + git workflow
- Clarified that PostgreSQL is planned but not yet implemented
- Updated system architecture diagram to distinguish implemented (SQLite) vs planned (PostgreSQL) backends
- Added workflow steps and benefits explanation for collaborative work

The architecture diagrams now accurately reflect current implementation status.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-12 18:48:53 -07:00
Steve Yegge
5fc61ba285 Add comprehensive Mermaid architecture diagrams to DESIGN.md
Added 5 visual diagrams to document the system architecture:
- System Architecture (layers and components)
- Entity Relationship Diagram (data model)
- Dependency Flow & Ready Work Calculation
- CLI Command Structure
- Data Flow Sequence (create issue workflow)

These diagrams provide a visual overview before diving into the detailed documentation.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-12 17:35:38 -07:00
Steve Yegge
54f76543ad Pre-release fixes and polish for open source launch
Fixed critical issues identified in code review:
- Fixed invalid Go version (1.25.2 → 1.21) in go.mod
- Fixed unchecked error in import.go JSON unmarshaling
- Fixed unchecked error returns in test cleanup (export_import_test.go, import_collision_test.go)
- Removed duplicate test code in dependencies_test.go via helper function

Added release infrastructure:
- Added 'bd version' command with JSON output support
- Created comprehensive CHANGELOG.md following Keep a Changelog format
- Updated README.md with clear alpha status warnings

All tests passing. Ready for public repository opening.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-12 17:28:48 -07:00
Steve Yegge
183ded4096 Add collision resolution with automatic ID remapping
Implements --resolve-collisions flag for import command to safely handle ID
collisions during branch merges. When enabled, colliding issues are remapped
to new IDs and all text references and dependencies are automatically updated.

Also adds comprehensive tests, branch-merge example, and documentation.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-12 17:13:09 -07:00
Steve Yegge
42e3bb315d Implement reference scoring algorithm (bd-13)
Add reference scoring to prioritize which colliding issues should be
renumbered during collision resolution. Issues with fewer references
are renumbered first to minimize total update work.

Changes to collision.go:
- Add ReferenceScore field to CollisionDetail
- scoreCollisions() calculates scores and sorts collisions ascending
- countReferences() counts text mentions + dependency references
- Uses word-boundary regex (\b) to match exact IDs (bd-10 not bd-100)

New tests in collision_test.go:
- TestCountReferences: validates reference counting logic
- TestScoreCollisions: verifies scoring and sorting behavior
- TestCountReferencesWordBoundary: ensures exact ID matching

Reference score = text mentions (desc/design/notes/criteria) + deps
Sort order: fewest references first (minimizes renumbering impact)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-12 16:27:05 -07:00
Steve Yegge
b065b32a51 Implement collision detection for import (bd-12)
Add collision detection infrastructure to identify conflicts during
JSONL import when branches diverge and create issues with the same ID.

New files:
- internal/storage/sqlite/collision.go: Core collision detection logic
  - detectCollisions() categorizes issues as exact matches, collisions, or new
  - compareIssues() identifies which fields differ between issues
  - CollisionDetail provides detailed collision reporting

- internal/storage/sqlite/collision_test.go: Comprehensive test suite
  - Tests exact matches, new issues, and various collision scenarios
  - Tests multi-field conflicts and edge cases
  - All tests passing

This lays the foundation for bd-13 through bd-17 (reference scoring,
ID remapping, CLI flags, and documentation).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-12 16:22:44 -07:00
Steve Yegge
ee14c811c4 Add bd-24: Support ID space partitioning for parallel worker agents
Enable external orchestrators to control issue ID assignment via --id flag
on bd create and optional next_id config. Keeps beads simple while allowing
orchestrators to implement ID partitioning strategies to minimize merge
conflicts. Complementary to bd-9 collision resolution work.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-12 16:20:21 -07:00
Steve Yegge
3440899850 Fix code review issues bd-19 through bd-23
- bd-19: Fix import zero-value field handling using JSON presence detection
- bd-20: Add --strict flag for dependency import failures
- bd-21: Simplify getNextID SQL query (reduce params from 4 to 2)
- bd-22: Add validation/warning for malformed issue IDs
- bd-23: Optimize export dependency queries (fix N+1 problem)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-12 15:30:11 -07:00
Steve Yegge
f048602d9f Add code review issues (bd-19 to bd-23) 2025-10-12 15:13:37 -07:00
Steve Yegge
8d3bbbcc52 Implement bd-10: Export/import dependencies in JSONL
Added dependency support to export/import workflow:

Changes:
- Added GetDependencyRecords() to Storage interface to get raw dependency records
- Extended Issue struct with Dependencies field (omitempty for backward compat)
- Modified export.go to populate dependencies for each issue
- Modified import.go to process dependencies in second pass after all issues exist
- All tests pass

Benefits:
- JSONL is now self-contained with full dependency information
- Enables proper collision resolution in future (bd-12+)
- Idempotent imports: existing dependencies are not duplicated
- Forward references handled: dependencies created after all issues exist

Example output:
{
  "id": "bd-10",
  "title": "...",
  "dependencies": [{
    "issue_id": "bd-10",
    "depends_on_id": "bd-9",
    "type": "parent-child",
    "created_at": "...",
    "created_by": "stevey"
  }]
}

Closes bd-10

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-12 15:08:05 -07:00
Steve Yegge
216f640ab4 Fix getNextID bug and design collision resolution (bd-9)
Critical bug fix: getNextID() was using alphabetical MAX instead of
numerical MAX, causing "bd-9" to be treated as max when "bd-10" existed.
This blocked all new issue creation after bd-10.

Fixed by using SQL CAST to extract and compare numeric portions of IDs.
This ensures bd-10 > bd-9 numerically, not alphabetically.

Also completed comprehensive design for bd-9 (collision resolution):
- Algorithm design with 7 phases (detection, scoring, remapping, etc.)
- Created 7 child issues (bd-10, bd-12-17) breaking down implementation
- Added design documents to .beads/ for future reference
- Updated issues JSONL with new issues and dependencies

Issues created:
- bd-10: Export dependencies in JSONL
- bd-12: Collision detection
- bd-13: Reference scoring algorithm
- bd-14: ID remapping with updates
- bd-15: CLI flags and reporting
- bd-16: Comprehensive tests
- bd-17: Documentation updates
- bd-18: Add design/notes fields to update command

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-12 14:41:58 -07:00
Steve Yegge
19cd7d1887 Prepare for public launch: comprehensive examples, docs, and tooling
This commit adds everything needed for a successful public launch:

**New Documentation**
- SECURITY.md: Security policy and best practices
- CLAUDE.md: Complete agent instructions for contributing to beads
- Enhanced README with pain points, FAQ, troubleshooting sections
- Added Taskwarrior to comparison table with detailed explanation

**Installation**
- install.sh: One-liner installation script with platform detection
- Auto-detects OS/arch, tries go install, falls back to building from source
- Updated README with prominent installation instructions

**Examples** (2,268+ lines of working code)
- examples/python-agent/: Full Python implementation of agent workflow
- examples/bash-agent/: Shell script agent with colorized output
- examples/git-hooks/: Pre-commit, post-merge, post-checkout hooks with installer
- examples/claude-desktop-mcp/: Documentation for future MCP server integration
- examples/README.md: Overview of all examples

**Dogfooding**
- Initialized bd in beads project itself (.beads/beads.db)
- Created issues for roadmap (MCP server, migrations, demos, 1.0 milestone)
- Exported to .beads/issues.jsonl for git versioning

**Visual Assets**
- Added screenshot showing agent using beads to README intro
- Placed in .github/images/ following GitHub conventions

This addresses all launch readiness items:
 Security policy
 Working agent examples (Python, Bash)
 Git hooks for automation
 FAQ addressing skeptics
 Troubleshooting common issues
 Easy installation
 Dogfooding our own tool
 Pain points that create urgency

Ready to ship! 🚀

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-12 11:25:29 -07:00
Steve Yegge
a2957f5ee3 Highlight distributed database architecture in README
Added new section "The Magic: Distributed Database via Git" explaining
the key insight: bd provides the illusion of a centralized database
while actually distributing via git.

Key points:
- Feels like centralized DB (query, update from any machine)
- Actually distributed via git (JSONL source of truth)
- Local SQLite cache for fast queries (<100ms)
- No server, daemon, or configuration needed
- AI-assisted conflict resolution for the rare conflicts

Updated Features section:
- 📦 Git-versioned - JSONL records stored in git
- 🌍 Distributed by design - Multiple machines share one logical DB

Updated comparison table to emphasize no-server advantage:
- "Distributed via git" vs "Git-native storage"
- "No server required" vs "Self-hosted"

This clarifies what makes bd unique: you get database-like behavior
(queries, transactions, dependencies) without database-like operations
(server setup, hosting, network config). Just install bd, clone repo.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-12 10:31:56 -07:00
Steve Yegge
22124d2039 Update README to emphasize agent-first design
Split Quick Start into "For Humans" and "For AI Agents" sections:
- Humans: Just init and add line to CLAUDE.md, then supervise
- Agents: Run quickstart, use --json flags for programmatic workflows

Rewrite "Why bd?" section to clarify the core insight:
- Traditional issue trackers built for humans (web UIs, cards, manual updates)
- bd built for AI agents (JSON APIs, memory, autonomous execution)
- Issues aren't planning artifacts, they're agent memory
- Prevents agents from losing focus during long coding sessions
- Humans supervise rather than micromanage

This reflects the actual design intent: Beads is FOR agents, not just "agent-friendly".

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-12 10:17:15 -07:00
Steve Yegge
2c7708eaa7 Address remaining golangci-lint findings
- Add package comment to cmd/bd/dep.go
- Change directory permissions from 0755 to 0750 in init.go
- Simplify getNextID signature (remove unused error return)
- Configure golangci-lint exclusions for false positives
- Document linting policy in LINTING.md

The remaining ~100 lint warnings are documented false positives:
- 73 errcheck: deferred cleanup (idiomatic Go)
- 17 revive: Cobra interface requirements and naming choices
- 7 gosec: false positives on validated SQL and user file paths
- 2 dupl: acceptable test code duplication
- 1 goconst: test constant repetition

See LINTING.md for full rationale. Contributors should focus on
avoiding NEW issues rather than the documented baseline.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-12 09:48:22 -07:00
Steve Yegge
87ed7c8793 Polish for open-source release
Major improvements to code quality, documentation, and CI:

Code Quality:
- Add golangci-lint configuration with 13 linters
- Fix unchecked error returns in export/import/init
- Refactor duplicate scanIssues code
- Add package comments for all packages
- Add const block comments for exported constants
- Configure errcheck to allow idiomatic defer patterns

Documentation:
- Add comprehensive CONTRIBUTING.md with setup, testing, and workflow
- Fix QUICKSTART.md binary name references (beads → bd)
- Correct default database path documentation

CI/CD:
- Add GitHub Actions workflow for tests and linting
- Enable race detection and coverage reporting
- Automated quality checks on all PRs

All tests passing. Lint issues reduced from 117 to 103 (remaining are
idiomatic patterns and test code). Ready for open-source release.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-12 09:41:29 -07:00
Steve Yegge
9a768ba4a3 Add comprehensive test coverage for types and export/import
## Test Coverage Improvements

**Before:**
- cmd/bd: 0%
- internal/types: 0%
- internal/storage/sqlite: 57.8%

**After:**
- cmd/bd: 8.5%
- internal/types: 100%
- internal/storage/sqlite: 57.8%

## New Tests

### types_test.go (100% coverage)
- TestIssueValidation: All validation rules (title, priority, status, etc.)
- TestStatusIsValid: All status values
- TestIssueTypeIsValid: All issue types
- TestDependencyTypeIsValid: All dependency types
- TestIssueStructFields: Time field handling
- TestBlockedIssueEmbedding: Embedded struct access
- TestTreeNodeEmbedding: Tree node structure

### export_import_test.go (integration tests)
- TestExportImport: Full export/import workflow
  - Export with sorting verification
  - JSONL format validation
  - Import creates new issues
  - Import updates existing issues
  - Export with status filtering
- TestExportEmpty: Empty database handling
- TestImportInvalidJSON: Error handling for malformed JSON
- TestRoundTrip: Data integrity verification (all fields preserved)

## Test Quality
- Uses table-driven tests for comprehensive coverage
- Tests both happy paths and error cases
- Validates JSONL format correctness
- Ensures data integrity through round-trip testing
- Covers edge cases (empty DB, invalid JSON, pointer fields)

All tests passing 

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-12 01:24:21 -07:00
Steve Yegge
15afb5ad17 Implement JSONL export/import and shift to text-first architecture
This is a fundamental architectural shift from binary SQLite to JSONL as
the source of truth for git workflows.

## New Features

- `bd export --format=jsonl` - Export issues to JSON Lines format
- `bd import` - Import issues from JSONL (create new, update existing)
- `--skip-existing` flag for import to only create new issues

## Architecture Change

**Before:** Binary SQLite database committed to git
**After:** JSONL text files as source of truth, SQLite as ephemeral cache

Benefits:
- Git-friendly text format with clean diffs
- AI-resolvable merge conflicts (append-only is 95% conflict-free)
- Human-readable issue tracking in git
- No binary merge conflicts

## Documentation

- Updated README with JSONL-first workflow and git hooks
- Added TEXT_FORMATS.md analyzing JSONL vs CSV vs binary
- Updated GIT_WORKFLOW.md with historical context
- .gitignore now excludes *.db, includes .beads/*.jsonl

## Implementation Details

- Export sorts issues by ID for consistent diffs
- Import handles both creates and updates atomically
- Proper handling of pointer fields (EstimatedMinutes)
- All tests passing

## Breaking Changes

- Database files (*.db) should now be gitignored
- Use export/import workflow for git collaboration
- Git hooks recommended for automation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-12 01:17:50 -07:00
Steve Yegge
9105059843 Fix .gitignore to exclude binary but not cmd/beads directory
Changed 'beads' to '/beads' to only ignore the binary in the root,
not the source code directory.

🤖 Generated with Claude Code
2025-10-11 20:07:52 -07:00
Steve Yegge
704515125d Initial commit: Beads issue tracker with security fixes
Core features:
- Dependency-aware issue tracking with SQLite backend
- Ready work detection (issues with no open blockers)
- Dependency tree visualization
- Cycle detection and prevention
- Full audit trail
- CLI with colored output

Security and correctness fixes applied:
- Fixed SQL injection vulnerability in UpdateIssue (whitelisted fields)
- Fixed race condition in ID generation (added mutex)
- Fixed cycle detection to return full paths (not just issue IDs)
- Added cycle prevention in AddDependency (validates before commit)
- Added comprehensive input validation (priority, status, types, etc.)
- Fixed N+1 query in GetBlockedIssues (using GROUP_CONCAT)
- Improved query building in GetReadyWork (proper string joining)
- Fixed P0 priority filter bug (using Changed() instead of value check)

All critical and major issues from code review have been addressed.

🤖 Generated with Claude Code
2025-10-11 20:07:36 -07:00