Commit Graph

15 Commits

Author SHA1 Message Date
Steve Yegge
e75b228576 Add tests and documentation for --shared hooks feature
- Fix existing tests to work with new installHooks signature
- Add TestInstallHooksShared to verify shared hooks functionality
- Update git-hooks README with comprehensive --shared documentation
- Document benefits, use cases, and workflow for shared hooks
2025-11-23 12:39:11 -08:00
Steve Yegge
54702b59a2 Fix #264 and #262: Remove stale --resolve-collisions references
- Update examples/git-hooks README to use 'bd hooks install' instead of non-existent install.sh
- Fix post-merge hook error message to not suggest --resolve-collisions flag (removed in v0.20)
- Clean up all doc references to --resolve-collisions (flag removed, hash IDs prevent collisions)

Fixes #264 (git hooks installer missing)
Fixes #262 (misleading error message)

Amp-Thread-ID: https://ampcode.com/threads/T-c9f0e4cb-fba2-4db2-a3d5-36dc1892be9d
Co-authored-by: Amp <amp@ampcode.com>
2025-11-08 13:18:50 -08:00
Steve Yegge
abb1d1c714 Fix post-merge hook to show actual error messages
Previously the hook redirected stderr to /dev/null, hiding useful error
messages like 'Git conflict markers detected'. Users only saw a generic
warning with no indication of the root cause.

Now captures and displays the actual error output, making it immediately
clear what went wrong (e.g., merge conflicts in JSONL).

Fixes bd-nszi

Amp-Thread-ID: https://ampcode.com/threads/T-6231e968-2c06-44ad-855d-bb5fafe452f6
Co-authored-by: Amp <amp@ampcode.com>
2025-11-08 02:46:04 -08:00
Steve Yegge
497f12fca5 Remove old install.sh script, replaced by bd hooks install
Amp-Thread-ID: https://ampcode.com/threads/T-6d470bf0-ada4-4b71-95ca-21d926837764
Co-authored-by: Amp <amp@ampcode.com>
2025-11-08 01:29:36 -08:00
Steve Yegge
187fdd258a Add bd hooks install command with embedded git hooks (bd-908z)
- Embed git hooks in binary using go:embed and templates directory
- Add bd hooks install/uninstall/list subcommands
- Install hooks with automatic backup of existing hooks
- Update AGENTS.md to reference 'bd hooks install' instead of install.sh
- Add comprehensive tests for hooks commands
- Update hook version to 0.22.1

Closes bd-908z
2025-11-08 01:28:19 -08:00
Steve Yegge
046e852861 Fix GH#254: bd init now detects and chains with existing git hooks
- Detect existing git hooks (pre-commit framework, custom scripts)
- Prompt user with 3 options: chain (recommended), overwrite, skip
- Chain mode preserves existing hooks by calling them first
- Overwrite mode creates timestamped backups
- Add tests for hook detection and installation
- Update documentation with chaining feature

Fixes silent overwrites of pre-commit framework hooks that caused
test failures to slip through.

Amp-Thread-ID: https://ampcode.com/threads/T-37164fd7-6452-40b0-b5dd-c13672dcb843
Co-authored-by: Amp <amp@ampcode.com>
2025-11-07 15:55:19 -08:00
Steve Yegge
0b0d9a43d1 Improve bd-my64 fix based on oracle review
Oracle identified a critical race condition in the initial fix:
- Pre-push hook checked for changes but didn't flush first
- Pending 5s-debounced flushes could land after the check
- Result: stale JSONL could still be pushed

Improvements:
1. Pre-push now flushes pending changes FIRST (bd sync --flush-only)
2. Uses git status --porcelain to catch ALL change types:
   - Staged, unstaged, untracked, deleted, renamed, conflicts
3. Handles both beads.jsonl and issues.jsonl (backward compat)
4. Works even without bd installed (git-only check)
5. Pre-commit stages both JSONL files (simpler loop)

This completely eliminates the race condition.
2025-11-06 19:01:28 -08:00
Steve Yegge
3ba245e6c0 Fix bd-my64: Pre-push hook blocks instead of exports
The original pre-push hook tried to export DB → JSONL during the push,
then run 'git add', but this doesn't work because:

1. The commit is already created when pre-push runs
2. git add in pre-push stages files for a FUTURE commit
3. The current push sends the old commit with stale JSONL
4. Result: dirty git status after push

Fix:
- Pre-push now CHECKS for uncommitted JSONL changes
- If found, it FAILS the push with clear instructions
- User must commit JSONL before pushing
- This prevents stale JSONL from reaching remote

The pre-commit hook already properly flushes changes, so this
catch-all prevents changes made BETWEEN commit and push.

Amp-Thread-ID: https://ampcode.com/threads/T-39a89553-c301-4d4f-b39f-6df9c403d22b
Co-authored-by: Amp <amp@ampcode.com>
2025-11-06 18:57:34 -08:00
Steve Yegge
991c6248ca Add git hooks support and refactor info command 2025-11-06 15:00:15 -08:00
Steve Yegge
9c38082cbf Add pre-push hook to prevent stale JSONL exports 2025-11-01 22:22:55 -07:00
Steve Yegge
d5488cb97f Remove collision-era language from docs and code
- Updated FAQ.md, ADVANCED.md, TROUBLESHOOTING.md to explain hash IDs eliminate collisions
- Removed --resolve-collisions references from all documentation and examples
- Renamed handleCollisions() to detectUpdates() to reflect update semantics
- Updated test names: TestAutoImportWithCollision → TestAutoImportWithUpdate
- Clarified: with hash IDs, same-ID = update operation, not collision

Closes: bd-50a7, bd-b84f, bd-bda8, bd-650c, bd-3ef2, bd-c083, bd-85a6
2025-10-31 14:24:50 -07:00
Steve Yegge
897edc6ce7 Update post-merge hook to use bd sync --import-only and auto-detect *.jsonl files (bd-126) 2025-10-27 18:27:01 -07:00
Steve Yegge
0344e1f08b Fix bd-51: Add git hooks to eliminate auto-flush race condition
- Added --flush-only flag to bd sync command
- Created pre-commit hook to flush pending changes before commit
- Created post-merge hook to import changes after pull/merge
- Added install script for easy setup
- Updated AGENTS.md with git hooks workflow
- Resolves race condition where daemon auto-flush fires after commit

Amp-Thread-ID: https://ampcode.com/threads/T-00b80d3a-4194-4c75-a60e-25a318cf9f91
Co-authored-by: Amp <amp@ampcode.com>
2025-10-24 22:17:06 -07:00
Steve Yegge
584cd1ebfc Implement auto-import to complete automatic git sync workflow
Adds auto-import feature to complement bd-35's auto-export, completing
the automatic sync workflow for git collaboration.

**Implementation:**
- Auto-import checks if JSONL is newer than DB on command startup
- Silently imports JSONL when modification time is newer
- Skips import command itself to avoid recursion
- Can be disabled with --no-auto-import flag

**Documentation updates:**
- Updated README.md git workflow section
- Updated CLAUDE.md workflow and pro tips
- Updated bd quickstart with auto-sync section
- Updated git hooks README to clarify they're now optional

**Testing:**
- Tested auto-import by touching JSONL and running commands
- Tested auto-export with create/close operations
- Complete workflow verified working

Closes bd-33

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-13 22:48:30 -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