Commit Graph

2227 Commits

Author SHA1 Message Date
Steve Yegge
ae5a4ac6ea Add security tests for WriteFile permissions in doctor command
Resolves bd-ee1: Add security tests for WriteFile permissions in doctor command

Added comprehensive security tests for the FixGitignore function to verify:
- Files are created with 0600 permissions (secure, owner-only read/write)
- Existing files with insecure permissions are fixed
- Read-only files can be updated (permissions fixed first)
- File ownership is correct
- Permissions are enforced even on systems that respect umask

Also improved FixGitignore implementation to:
- Handle read-only files by fixing permissions before writing
- Explicitly set permissions after write to ensure 0600 regardless of umask
- Maintain secure permissions throughout the operation

Tests verify the gosec G306 security concern is properly addressed.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-23 21:19:14 -08:00
Steve Yegge
4f15e66599 bd sync: apply DB changes after import 2025-11-23 21:16:33 -08:00
Steve Yegge
6f90fe4a2d Merge branch 'main' of https://github.com/steveyegge/beads 2025-11-23 21:16:32 -08:00
Steve Yegge
732c23c608 bd sync: 2025-11-23 21:16:31 2025-11-23 21:16:31 -08:00
Steve Yegge
9e16469b2e Implement BD_GUIDE.md generation for version-stamped documentation (bd-woro)
This implements the ability to separate bd-specific instructions from
project-specific instructions by generating a canonical BD_GUIDE.md file.

## Changes

1. Added `--output` flag to `bd onboard` command
   - Generates version-stamped BD_GUIDE.md at specified path
   - Includes both agentsContent and copilotInstructionsContent
   - Auto-generated header warns against manual editing

2. Version tracking integration
   - checkAndSuggestBDGuideUpdate() detects outdated BD_GUIDE.md
   - Suggests regeneration when bd version changes
   - Integrated with maybeShowUpgradeNotification()

3. Comprehensive test coverage
   - Tests for BD_GUIDE.md generation
   - Tests for version stamp validation
   - Tests for content inclusion

4. Documentation updates
   - Updated AGENTS.md with BD_GUIDE.md workflow
   - Added regeneration instructions to upgrade workflow

## Benefits

- Clear separation of concerns (bd vs project instructions)
- Deterministic updates (no LLM involved)
- Git-trackable diffs show exactly what changed
- Progressive disclosure (agents read when needed)

## Usage

\`\`\`bash
# Generate BD_GUIDE.md
bd onboard --output .beads/BD_GUIDE.md

# After upgrading bd
bd onboard --output .beads/BD_GUIDE.md  # Regenerate
\`\`\`

Closes bd-woro
2025-11-23 21:16:09 -08:00
Steve Yegge
2637a7bde0 bd sync: apply DB changes after import 2025-11-23 21:12:08 -08:00
Steve Yegge
b9531d4cf3 Merge branch 'main' of https://github.com/steveyegge/beads 2025-11-23 21:12:08 -08:00
Steve Yegge
0e0dc3a753 bd sync: 2025-11-23 21:12:07 2025-11-23 21:12:07 -08:00
Steve Yegge
0ded604d5b Merge remote changes 2025-11-23 21:10:21 -08:00
Steve Yegge
a1a2082fff bd sync: 2025-11-23 21:10:06 2025-11-23 21:10:06 -08:00
Steve Yegge
83609d5098 Add bd doctor check and fix for missing sync.branch config (bd-rsua)
Problem: Existing beads repositories initialized before commit a4c38d5 don't have sync.branch configured. This causes 'bd sync --status' to fail with a confusing error.

Solution: Added new check in 'bd doctor' that detects when sync.branch is not configured and provides automatic fix via 'bd doctor --fix'. The fix automatically sets sync.branch to the current branch using 'git symbolic-ref --short HEAD'.

Changes:
- Added checkSyncBranchConfig() function in doctor.go
- Created fix/sync_branch.go with SyncBranchConfig() fix handler
- Added comprehensive test coverage in doctor_test.go
- Integrated check into applyFixes() switch statement

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-23 21:09:55 -08:00
Steve Yegge
bc551e1ac1 bd sync: apply DB changes after import 2025-11-23 21:09:00 -08:00
Steve Yegge
0bc5caee45 Merge branch 'main' of https://github.com/steveyegge/beads 2025-11-23 21:08:59 -08:00
Steve Yegge
4d1f4d6649 bd sync: 2025-11-23 21:08:58 2025-11-23 21:08:58 -08:00
Steve Yegge
a2769dd093 bd sync: 2025-11-23 21:07:30 2025-11-23 21:07:57 -08:00
Steve Yegge
71502b1b93 bd sync: 2025-11-23 21:06:28 2025-11-23 21:06:28 -08:00
Steve Yegge
c58740dda8 bd sync: apply DB changes after import 2025-11-23 21:03:41 -08:00
Steve Yegge
6079e3c04e Merge branch 'main' of https://github.com/steveyegge/beads 2025-11-23 21:03:40 -08:00
Steve Yegge
a2c5a4d0f7 bd sync: 2025-11-23 21:03:40 2025-11-23 21:03:40 -08:00
Steve Yegge
18f81051f3 Fix race condition in client socket cleanup (bd-4owj)
- Re-check socket existence after lock check to avoid stale socket state
- If socket is initially missing but daemon lock is held, re-check socket to handle daemon startup race
- Add test TestTryConnectWithTimeout_SocketExistenceRecheck to verify fix

Fixes bd-4owj
2025-11-23 20:58:11 -08:00
Steve Yegge
e45ea617b7 Merge branch 'main' of https://github.com/steveyegge/beads 2025-11-23 20:57:56 -08:00
Steve Yegge
5ff65cae45 bd daemon export: 2025-11-23 20:57:39 2025-11-23 20:57:39 -08:00
Steve Yegge
0fa99ebc20 bd sync: apply DB changes after import 2025-11-23 20:55:27 -08:00
Steve Yegge
b4acc2b3b2 bd sync: 2025-11-23 20:55:16 2025-11-23 20:55:16 -08:00
Steve Yegge
7150d02502 bd daemon export: 2025-11-23 20:54:53 2025-11-23 20:54:53 -08:00
Steve Yegge
0073234d84 bd sync: apply DB changes after import 2025-11-23 20:54:24 -08:00
Steve Yegge
cae955fb9d Merge branch 'main' of https://github.com/steveyegge/beads 2025-11-23 20:54:24 -08:00
Steve Yegge
b75914b8ca Fix: Improve staleness check error handling (bd-2q6d, bd-o4qy, bd-n4td)
Changes:
- CheckStaleness now returns errors for corrupted last_import_time metadata
  instead of silently returning false (bd-o4qy)
- Added handling for empty string metadata (memory store behavior)
- Enhanced warning messages when staleness check fails to be more explicit
  that operation continues with potentially stale data (bd-n4td)
- Added test coverage for corrupted metadata scenario

Closes bd-2q6d, bd-o4qy, bd-n4td

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-23 20:54:18 -08:00
Steve Yegge
9ba039ce45 bd daemon export: 2025-11-23 20:51:15 2025-11-23 20:51:15 -08:00
Steve Yegge
d91560e260 Merge branch 'main' of https://github.com/steveyegge/beads 2025-11-23 20:51:11 -08:00
Steve Yegge
e8a752e707 Fix unvalidated dependency parsing in create.go
Validate dependsOnID is non-empty before setting discoveredFromParentID
to prevent attempting to fetch an issue with empty ID.

Also added validation to ensure parent issue exists before generating
child IDs in direct mode.

Fixes: bd-ia8r
2025-11-23 20:51:09 -08:00
Steve Yegge
3cf5e26d1e Implement auto-resolution of JSONL merge conflicts during bd sync
- Add isInRebase() to detect rebase state
- Add hasJSONLConflict() to check for JSONL-only conflicts
- Add runGitRebaseContinue() to continue rebase after resolution
- Auto-export from DB and resolve conflict when detected
- Add comprehensive tests for auto-resolution logic

Implements bd-cwmt
2025-11-23 20:41:35 -08:00
Steve Yegge
3ca11dc440 bd sync: 2025-11-23 20:41:25 2025-11-23 20:41:25 -08:00
Steve Yegge
144f4dea32 Merge branch 'main' of https://github.com/steveyegge/beads 2025-11-23 20:39:55 -08:00
Steve Yegge
c39243710c bd sync: apply DB changes after import 2025-11-23 20:38:42 -08:00
Steve Yegge
157d87ac8b Merge branch 'main' of https://github.com/steveyegge/beads 2025-11-23 20:38:42 -08:00
Steve Yegge
8a2f910475 bd sync: 2025-11-23 20:38:41 2025-11-23 20:38:41 -08:00
Steve Yegge
4fd7933c10 bd sync: 2025-11-23 20:31:00
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-23 20:34:51 -08:00
Steve Yegge
d26f71bd31 bd daemon export: 2025-11-23 20:34:27 2025-11-23 20:34:27 -08:00
Steve Yegge
273a4d1cfc feat: Complete command set standardization (bd-au0)
Epic bd-au0: Command Set Standardization & Flag Consistency

Completed all 10 child issues:

P0 tasks:
- Standardize --dry-run flag across all commands (bd-au0.1)
- Add label operations to bd update (bd-au0.2)
- Fix --title vs --title-contains redundancy (bd-au0.3)
- Standardize priority flag parsing (bd-au0.4)

P1 tasks:
- Add date/priority filters to bd search (bd-au0.5)
- Add comprehensive filters to bd export (bd-au0.6)
- Audit and standardize JSON output (bd-au0.7)

P2 tasks:
- Improve clean vs cleanup documentation (bd-au0.8)
- Document rarely-used commands (bd-au0.9)

P3 tasks:
- Add global verbosity flags --verbose/-v and --quiet/-q (bd-au0.10)

Key changes:
- export.go: Added filters (assignee, type, labels, priority, dates)
- main.go: Added --verbose/-v and --quiet/-q global flags
- debug.go: Added SetVerbose/SetQuiet and PrintNormal helpers
- clean.go/cleanup.go: Improved documentation with cross-references
- detect_pollution.go: Added use cases and warnings
- migrate_hash_ids.go: Marked as legacy command
- rename_prefix.go: Added use cases documentation

All success criteria met: flags standardized, feature parity achieved,
naming clarified, JSON output consistent.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-23 20:33:31 -08:00
Steve Yegge
b5fb06c17d bd sync: apply DB changes after import 2025-11-23 20:32:54 -08:00
Steve Yegge
ea0900229b Merge branch 'main' of https://github.com/steveyegge/beads 2025-11-23 20:32:54 -08:00
Steve Yegge
19098b92ee Fix unused variable in init.go
Remove unused yellow color variable that was causing build warning.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-23 20:32:49 -08:00
Steve Yegge
c765e6562d bd sync: 2025-11-23 20:24:44 2025-11-23 20:24:44 -08:00
Steve Yegge
58a71021ae bd sync: 2025-11-23 20:20:07 2025-11-23 20:24:40 -08:00
Steve Yegge
e07f1d43f7 bd sync: 2025-11-23 20:22:09 2025-11-23 20:22:09 -08:00
Steve Yegge
83246c8a2c Merge branch 'main' of https://github.com/steveyegge/beads 2025-11-23 20:22:03 -08:00
Steve Yegge
e3e0a04496 Add configurable export error handling policies (bd-exug)
Implements flexible error handling for export operations with four policies:
- strict: Fail-fast on any error (default for user exports)
- best-effort: Skip errors with warnings (default for auto-exports)
- partial: Retry then skip with manifest tracking
- required-core: Fail on core data, skip enrichments

Key features:
- Per-project configuration via `bd config set export.error_policy`
- Separate policy for auto-exports: `auto_export.error_policy`
- Retry with exponential backoff (configurable attempts/delay)
- Optional export manifests documenting completeness
- Per-issue encoding error handling

This allows users to choose the right trade-off between data integrity
and system availability for their specific project needs.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-23 20:21:51 -08:00
Steve Yegge
83b8e38331 bd sync: 2025-11-23 20:21:05 2025-11-23 20:21:05 -08:00
Steve Yegge
44bf71d47e Merge branch 'main' of https://github.com/steveyegge/beads 2025-11-23 20:16:18 -08:00