Commit Graph

1206 Commits

Author SHA1 Message Date
Dirceu Pereira Tiegs
939ade731f fix: doctor check skips interactions.jsonl and molecules.jsonl (GH#709) (#739)
The fix for GH#709 updated FindJSONLInDir to skip interactions.jsonl,
but the doctor check in CheckLegacyJSONLFilename was not updated.
This caused `bd doctor` to warn about multiple JSONL files when
both issues.jsonl and interactions.jsonl exist (which is normal
after `bd init`).

Also skip molecules.jsonl which is another system file that shouldn't
be counted as a duplicate issue database.
2025-12-25 11:52:43 -08:00
Steve Yegge
c7bc8e6ca7 feat: Add proto prefix for distilled molecules (bd-hobo)
Distilled protos (via `bd mol distill`) now get bd-proto-xxx IDs.

Summary of distinct prefixes:
- bd-proto-xxx: templates created via distill
- bd-mol-xxx: instances created via pour
- bd-wisp-xxx: ephemeral instances via wisp create
- bd-xxx: regular issues

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 02:11:52 -08:00
Steve Yegge
cfb1196044 Implement expansion operators for formula composition (gt-8tmz.3)
Add expand and map operators that apply macro-style template expansion:
- expand(target, template) - replace a single step with expanded template
- map(select, template) - replace all matching steps with expanded template

The expansion formula type (e.g., rule-of-five) uses a template field with
{target} and {target.description} placeholders that are substituted when
applied to target steps.

Changes:
- Add Template field to Formula struct for expansion formulas
- Add ExpandRule and MapRule types to ComposeRules
- Implement ApplyExpansions in new expand.go
- Add LoadByName method to Parser for loading expansion formulas
- Integrate expansion into bd cook command
- Add comprehensive tests

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 02:11:03 -08:00
Steve Yegge
f78fe883d0 feat: Distinct prefixes for protos, molecules, wisps (bd-hobo)
Added type-specific ID prefixes for better visual recognition:
- `bd pour` now generates IDs with "mol-" prefix
- `bd wisp create` now generates IDs with "wisp-" prefix
- Regular issues continue using the configured prefix

Implementation:
- Added IDPrefix field to types.Issue (internal, not exported to JSONL)
- Added Prefix field to CloneOptions for spawning operations
- Added IDPrefix to RPC CreateArgs for daemon communication
- Updated storage layer to use issue.IDPrefix when generating IDs
- Updated pour.go and wisp.go to pass appropriate prefixes

This enables instant visual recognition of entity types and prevents
accidental modification of templates.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 02:05:25 -08:00
Steve Yegge
a643b9ab67 Implement advice operators for formula composition (gt-8tmz.2)
Add Lisp-style advice operators to the formula DSL:
- before(target, step) - insert step before target
- after(target, step) - insert step after target
- around(target, wrapper) - wrap target with before/after

Features:
- Glob pattern matching for targets (*.implement, shiny.*, etc)
- Pointcut matching by type or label
- Step reference substitution ({step.id}, {step.title})
- Automatic dependency chaining

New types: AdviceRule, AdviceStep, AroundAdvice, Pointcut
New functions: ApplyAdvice, MatchGlob, MatchPointcut

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 01:53:43 -08:00
Steve Yegge
e068ac574f refactor: Simplify wisp architecture - badges not separate storage
Wisps are now just issues with Wisp=true flag in the main database,
not exported to JSONL. Removes all references to .beads-wisp/ directory.

- Update docs: CLAUDE.md, CLI_REFERENCE.md, MOLECULES.md, DELETIONS.md
- Update code comments: wisp.go
- Update changelog and info.go version notes

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 01:49:57 -08:00
Steve Yegge
e6ce0d6365 refactor: Switch formula format from YAML to JSON
- Change file extension from .formula.yaml to .formula.json
- Replace gopkg.in/yaml.v3 with encoding/json in parser
- Remove yaml struct tags, keep json tags only
- Update all test cases to use JSON format
- Update documentation references

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 01:37:22 -08:00
Steve Yegge
9314f20092 Remove hardcoded deacon assignee from gate.go
bd should not assume specific orchestrator agents exist. Gates are just
data records - the orchestrator decides who processes them.

- Remove Assignee: deacon/ from gate creation
- Update help text to say orchestrator instead of Deacon patrol

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 01:14:53 -08:00
Steve Yegge
dd0fb7ce90 Remove bd mol run - orchestration belongs in gt
bd mol run was a convenience combo (pour + assign + pin + start) that
felt like orchestration but lived in the data layer. This blurred the
architectural boundary between bd (data) and gt (orchestration).

- Delete cmd/bd/mol_run.go entirely
- Update mol.go help text to remove run reference
- Update mol_current.go to suggest bd pour instead

gt spawn will implement the orchestration combo by calling the atomic
bd commands (pour, update, pin) directly.

Closes bd-00u3

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 01:05:16 -08:00
Steve Yegge
c429405e0d fix: mol run loads all hierarchical children + supports title lookup (bd-c8d5, bd-drcx)
Two issues fixed:

1. bd-c8d5: mol run only created partial children from proto
   - Root cause: children with missing/wrong dependencies were not loaded
   - Fix: loadDescendants now uses two strategies:
     - Strategy 1: Check dependency records for parent-child relationships
     - Strategy 2: Find hierarchical children by ID pattern (parent.N)
   - This catches children that may have broken dependency data

2. bd-drcx: mol run now supports proto lookup by title
   - Can use: bd mol run mol-polecat-work --var issue=gt-xxx
   - Or by ID: bd mol run gt-lwuu --var issue=gt-xxx
   - Title matching is case-insensitive and supports partial matches
   - Shows helpful error on ambiguous matches

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-24 23:33:34 -08:00
Steve Yegge
94c3fa2b29 fix: filter wisps from nodb writeIssuesToJSONL (bd-9avq) 2025-12-24 21:19:00 -08:00
Steve Yegge
9f8b3478fd fix: filter wisps from sync_export.go (bd-687g)
The sync command's exportToJSONL function was not filtering wisps,
causing them to be re-added to JSONL during bd sync re-export step.

autoflush.go had wisp filtering but sync_export.go did not. Added
the same filtering logic to prevent wisps from being exported to JSONL.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-24 20:55:31 -08:00
Steve Yegge
f2e6df95c0 refactor: simplify wisp architecture - single DB with Wisp flag (bd-bkul)
- Remove cross-store squash logic from mol_squash.go
  - Delete runWispSquash() and squashWispToPermanent() functions
  - Simplify runMolSquash() to work with main store only

- Update mol_burn.go to work with main database
  - Remove .beads-wisp/ directory references
  - Look for Wisp=true issues in main store instead

- Update mol_bond.go to use Wisp flag instead of separate store
  - --wisp now creates issues with Wisp=true in main store
  - --pour creates issues with Wisp=false (persistent)
  - Update bondProtoMol signature to accept both flags

- Deprecate wisp storage functions in beads.go
  - WispDirName, FindWispDir, FindWispDatabasePath
  - NewWispStorage, EnsureWispGitignore, IsWispDatabase
  - All marked deprecated with reference to bd-bkul

- Remove obsolete cross-store squash tests
  - TestSquashWispToPermanent
  - TestSquashWispToPermanentWithSummary
  - TestSquashWispToPermanentKeepChildren

All tests pass. Build succeeds.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-24 20:42:54 -08:00
Steve Yegge
c0271aedbf wip: simplify wisp architecture - single db with Wisp flag (bd-bkul)
Progress on eliminating separate .beads-wisp/ directory:

- Add --wisp flag to bd create (creates issue with Wisp=true)
- Update bd wisp create to use main db instead of separate wisp storage
- Update bd wisp list to query main db with Wisp filter
- Update bd wisp gc to work with main database
- Add Wisp field to RPC ListArgs for daemon mode support
- Fix terminology: use "old/abandoned" for time-based cleanup,
  reserve "stale" for graph-pressure staleness (per Gas Town taxonomy)

Still TODO:
- Finish mol squash simplification (remove cross-store logic)
- Remove runWispSquash and squashWispToPermanent functions
- Update mol burn similarly
- Deprecate .beads-wisp/ functions in internal/beads/beads.go
- Test all changes

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-24 20:31:27 -08:00
Steve Yegge
2f1ec2d388 release: v0.36.0
## Highlights

- **Formula system** - `bd cook` for declarative workflow templates
- **Gate issue type** - Async coordination primitives
- **`bd list --pretty --watch`** - Built-in colorized viewer with live updates
- **Child→parent dep prevention** - Blocks LLM temporal reasoning trap

## Breaking Changes

- `bd mol spawn` removed - use `bd pour` or `bd wisp create`
- `bd ready` excludes workflow types by default

## Bug Fixes

- GH#664: Dots in prefix handling
- GH#728: Child counter updates for explicit IDs
- GH#422: Multi-hyphen prefix parsing
- GH#704: Stealth mode uses .git/info/exclude

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-24 15:57:22 -08:00
Steve Yegge
7f33ee8f4d docs(info): add 0.36.0 to versionChanges
Adds release notes for v0.36.0 including:
- Formula system and gate issue type
- bd list --pretty --watch enhancements
- Child→parent dep prevention (LLM temporal trap)
- Multiple bug fixes

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-24 15:55:50 -08:00
Steve Yegge
f28785d2dc feat(formula): support needs and waits_for fields, add --prefix flag
- bd-hr39: Add `needs` field to Step as alias for depends_on. Converts
  to blocking dependencies between sibling steps during cooking.

- bd-j4cr: Add `waits_for` field to Step. Values: all-children or
  any-children. Preserved as gate:<value> label during cooking.

- bd-47qx: Add --prefix flag to bd cook command to prepend a prefix
  to proto IDs, enabling use of project prefixes like gt-.

Includes validation, dry-run output, and comprehensive tests.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-24 13:59:38 -08:00
Steve Yegge
d1c4526e6e fix(formula): address code review findings
Fixes from self-review of formula parser and bd cook:

1. Atomicity: Add cleanup on failure in cookFormula - if labels/deps
   transaction fails, delete the already-created issues

2. Validation: Add recursive depends_on validation for child steps
   and validate priority ranges for children

3. Documentation: Mark unimplemented fields (Expand, ExpandVars,
   Condition, Gate) with TODO(future) comments

4. Thread safety: Add note that Parser is NOT thread-safe

5. Error messages: Track first definition location for duplicate ID
   errors (e.g., "duplicate id at steps[1], first defined at steps[0]")

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-24 13:50:19 -08:00
Steve Yegge
4fdcda4568 feat(formula): add formula parser and bd cook command (bd-weu8, bd-wa2l)
Implements a new formula system for defining workflow templates in YAML:

- internal/formula/types.go: YAML schema types for .formula.yaml files
  - Formula, Step, VarDef, ComposeRules, BondPoint, Gate types
  - Support for workflow, expansion, and aspect formula types
  - Variable definitions with required, default, enum, and pattern

- internal/formula/parser.go: Parser with extends/inheritance support
  - Parse formula files from multiple search paths
  - Resolve extends references for formula inheritance
  - Variable extraction and substitution
  - Variable validation (required, enum, pattern)

- cmd/bd/cook.go: bd cook command to compile formulas into protos
  - Parse and resolve formula YAML
  - Create proto bead with template label
  - Create child issues for each step
  - Set up parent-child and blocking dependencies
  - Support --dry-run, --force, --search-path flags

Example workflow:
  bd cook mol-feature.formula.yaml
  bd pour mol-feature --var component=Auth --var framework=react

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-24 13:42:01 -08:00
Steve Yegge
ce2b05356a feat(deps): detect/prevent child→parent dependency anti-pattern (bd-nim5)
This prevents a common mistake where users add dependencies from child
issues to their parent epics. This creates a deadlock:
- Child can't start (blocked by open parent)
- Parent can't close (children not done)

Changes:
- dep.go: Reject child→parent deps at creation time with clear error
- server_labels_deps_comments.go: Same check for daemon RPC
- doctor/validation.go: New check detects existing bad deps
- doctor/fix/validation.go: Auto-fix removes bad deps
- doctor.go: Wire up check and fix handler

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-24 13:03:27 -08:00
Steve Yegge
9ad70cce64 refactor(mol): remove bd mol spawn - use pour/wisp only (bd-8y9t)
Remove the spawn command from bd mol. Proto instantiation now uses:
- bd pour <proto> - Instantiate as persistent mol (liquid phase)
- bd wisp create <proto> - Instantiate as ephemeral wisp (vapor phase)

Rationale:
- 'spawn' doesn't fit the chemistry metaphor
- Two phase transitions (pour/wisp) are clearer than one command with flags
- Avoids confusion about defaults

Changes:
- Delete mol_spawn.go
- Update mol.go, mol_catalog.go, mol_distill.go to reference pour/wisp
- Update pour.go and wisp.go to remove 'Equivalent to spawn' comments
- Update info.go changelog entries
- Update CHANGELOG.md, ARCHITECTURE.md, DELETIONS.md

Closes bd-8y9t
2025-12-24 12:52:47 -08:00
Steve Yegge
7f8f8f69d1 fix(sync): respect sync.remote config in daemon sync operations (#736)
The daemon sync functions (gitPushFromWorktree, syncBranchPull) were
checking git's branch tracking config and falling back to 'origin',
but ignoring bd's sync.remote config setting.

Now these functions check sync.remote config first, matching the
behavior of sync_check.go and sync_import.go.

Closes #736
2025-12-24 12:43:18 -08:00
Steve Yegge
9d0fc55e0b refactor(daemon): simplify JSONL path comment (#734)
Removes unnecessary parenthetical explanation about possible JSONL file names since findJSONLPath() already encapsulates that logic.

Co-authored-by: Charles P. Cross <cpdata@users.noreply.github.com>
2025-12-24 12:38:13 -08:00
Charles P. Cross
cd2e9ac5c8 refactor(daemon): simplify JSONL path comment
Remove verbose parenthetical explanation from comment on line 73.
The comment now reads '// Get the actual JSONL path' instead of
'// Get the actual JSONL path (could be issues.jsonl, beads.base.jsonl, etc.)'

This is a documentation cleanup with no functional changes.
2025-12-24 12:38:04 -08:00
matt wilkie
0f93bef240 fix(bd-68e4): export must specify -o to write to file, not stdout
When 'bd doctor --fix' detects DB has more issues than JSONL, it runs
'bd export' to sync them. However, 'bd export' without -o flag outputs
to stdout instead of writing to .beads/issues.jsonl, making the fix a
no-op.

Add -o .beads/issues.jsonl --force to the export command to ensure the
JSONL file is actually updated.
2025-12-24 12:37:24 -08:00
Charles P. Cross
61daa59fd0 feat(list): add --pretty and --watch flags for built-in viewer (#729)
feat(list): add --pretty and --watch flags for built-in viewer

Closes #654
2025-12-24 12:35:57 -08:00
Charles P. Cross
cdbca65ed4 feat(config): add override notification for config parameters (#731)
feat(config): add override notification for config parameters

Adds verbose logging when config values are overridden by flags/env vars.
2025-12-24 12:35:54 -08:00
Charles P. Cross
8676c41c18 fix: address CI lint errors (gosec, errcheck, unparam, duplicate tests) (#730)
* fix: address CI lint errors (gosec, errcheck, unparam, duplicate tests)

- Remove duplicate TestHandleDelete_DryRun and TestHandleDelete_PartialSuccess
  from server_mutations_test.go (already defined in server_delete_test.go)
- Add nolint:gosec comments for exec.CommandContext calls in sync_branch.go
  (variables come from trusted config/git sources)
- Fix gosec G304/G306 in yaml_config.go (file read/write permissions)
- Fix errcheck in mol_run.go (templateStore.Close)
- Add nolint:unparam for updateYamlKey error return

* fix: add remaining nolint:gosec comments for exec.CommandContext calls

- sync_branch.go: diffCmd, logCmd (dry-run), commitCmd, pushCmd, remoteCmd
- sync_check.go: checkLocalCmd

* fix: add more nolint:gosec comments for exec.CommandContext calls

- sync_branch.go: pullCmd
- sync_check.go: localRefCmd, remoteRefCmd, aheadCmd
- sync_import.go: checkoutCmd

* fix: add final nolint:gosec comments for exec.CommandContext calls

- sync_check.go: behindCmd
- sync_import.go: fetchCmd

---------

Co-authored-by: Charles P. Cross <cpdata@users.noreply.github.com>
2025-12-24 12:35:32 -08:00
Steve Yegge
f2506088b6 fix(json): audit and standardize JSON output across commands (bd-au0.7)
Audit findings:
- All commands properly respect --json flag for success output
- Added outputJSONError() helper for consistent JSON error output
- Removed redundant local --json flag from stale.go (inherited from rootCmd)
- Fixed stale_test.go to check InheritedFlags() instead of local Flags()

JSON output patterns verified across:
- Query commands: ready, blocked, stale, count, stats, status
- Dep commands: dep add/remove/tree/cycles
- Label commands: label add/remove/list/list-all
- Comment commands: comments add/list
- Epic commands: epic status/close-eligible

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-24 00:10:14 -08:00
Steve Yegge
36feb15d83 feat(compact): Add --prune mode for standalone tombstone pruning (bd-c7y5)
Add a new --prune mode to `bd compact` that removes expired tombstones from
issues.jsonl without requiring AI compaction or deleting closed issues.

Features:
- `bd compact --prune` removes tombstones older than 30 days (default TTL)
- `bd compact --prune --older-than N` uses custom N-day TTL
- `bd compact --prune --dry-run` previews what would be pruned
- Supports --json output for programmatic use

This reduces sync overhead by eliminating accumulated tombstones that were
previously only pruned as a side effect of compaction or cleanup operations.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-24 00:08:10 -08:00
Steve Yegge
cdcb716cfc test(delete): Add comprehensive tests for deleteViaDaemon RPC client (bd-dtl8)
Add integration tests for the deleteViaDaemon function that handles
client-side RPC deletion calls:

- TestDeleteViaDaemon_SuccessfulDeletion: Single issue deletion
- TestDeleteViaDaemon_CascadeDeletion: Cascade deletion through daemon
- TestDeleteViaDaemon_ForceDeletion: Force delete bypassing deps
- TestDeleteViaDaemon_DryRunMode: Preview without actual deletion
- TestDeleteViaDaemon_InvalidIssueID: Error handling for invalid IDs
- TestDeleteViaDaemon_BatchDeletion: Multiple issues at once
- TestDeleteViaDaemon_JSONOutput: JSON output validation
- TestDeleteViaDaemon_HumanReadableOutput: Human-readable formatting
- TestDeleteViaDaemon_DependencyConflict: Dependency conflict handling
- TestDeleteViaDaemon_EmptyIDs: Empty ID list handling
- TestDeleteViaDaemon_MultipleErrors: Mixed valid/invalid batch
- TestDeleteViaDaemon_DirectCall: Direct call with global client
- TestDeleteViaDaemon_DirectDryRun: Direct dry-run test
- TestDeleteViaDaemon_DirectHumanOutput: Direct human output test
- TestDeleteViaDaemon_DirectBatch: Direct batch deletion test

Coverage: 59.4% for deleteViaDaemon (remaining 40% is os.Exit paths)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-24 00:07:55 -08:00
Steve Yegge
422ec718e7 fix(json): standardize JSON output for errors and empty arrays (bd-au0.7)
- Add FatalErrorRespectJSON helper for JSON-aware error output
- Fix bd comments list returning null instead of [] for empty arrays
- Remove redundant local --json flags from show/update/close commands
  that were shadowing the global persistent --json flag
- Update show command error handlers to use FatalErrorRespectJSON

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-24 00:07:52 -08:00
Steve Yegge
bed89fdfde feat(export): add --priority exact match filter (bd-au0.6)
Add the --priority (-p) flag to bd export for filtering by exact priority,
matching the behavior of bd list. This completes the comprehensive filtering
support for bd export.

The flag uses cmd.Flags().Changed() to properly handle P0 (priority 0), which
would otherwise be interpreted as "not set" due to Go zero-value semantics.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-24 00:06:51 -08:00
Steve Yegge
e67f27c092 bd sync: 2025-12-23 23:38:57 2025-12-24 00:06:41 -08:00
Steve Yegge
2069f0a3d7 Add tests for cmd/bd CLI to improve coverage (bd-llfl)
Added tests for:
- daemon_config.go: ensureBeadsDir, getPIDFilePath, getLogFilePath,
  getSocketPathForPID
- daemon_autostart.go: determineSocketPath, isDaemonRunningQuiet
- activity.go: printEvent
- cleanup.go: showCleanupDeprecationHint
- upgrade.go: pluralize
- wisp.go: formatTimeAgo
- list.go: pinIndicator, sortIssues
- hooks.go: FormatHookWarnings, isRebaseInProgress, hasBeadsJSONL
- template.go: extractIDSuffix
- thanks.go: getContributorsSorted

Coverage improved from 22.5% to 23.1% for cmd/bd package.
Most remaining untested code requires daemon/RPC operations.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-23 22:47:25 -08:00
Steve Yegge
bbb08d6d8d Fix template commands failing with daemon mode (bd-indn)
Added daemon-compatible functions for template operations:
- loadTemplateSubgraphViaDaemon: loads template subgraph via RPC calls
- cloneSubgraphViaDaemon: creates new issues from template via RPC
- Updated templateShowCmd and templateInstantiateCmd to use daemon path

The template commands were using storage.Storage directly even when
daemon was connected, causing "no database connection" errors.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-23 22:43:04 -08:00
Steve Yegge
9354dbd9f2 Refactor duplicate JSONL-from-git parsing code (bd-y2v)
Extract readFromGitRef helper function to eliminate duplicate code for
running git show <ref>:<path> commands. The helper is now used by:
- checkGitForIssues() in autoimport.go
- importFromGit() in autoimport.go
- readFirstIssueFromGit() in init.go

The scanning/parsing logic is intentionally kept separate since each
function has different requirements (error handling, SetDefaults, etc).

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-23 22:41:05 -08:00
Steve Yegge
091b4b8f35 Add tests for setup package (28.4% → 53.8% coverage)
Adds comprehensive tests for:
- factory.go: updateBeadsSection, removeBeadsSection, createNewAgentsFile,
  InstallFactory, RemoveFactory
- cursor.go: InstallCursor, RemoveCursor, CheckCursor
- aider.go: InstallAider, RemoveAider, CheckAider, templates

Coverage improved from 21.6% (measured) to 53.8%, exceeding 50% target.

(bd-sh4c)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-23 22:40:16 -08:00
Steve Yegge
2de1695615 bd sync: 2025-12-23 22:33:32 2025-12-23 22:33:33 -08:00
Steve Yegge
7d3447b971 Add tests for createTombstone and deleteIssue wrappers (bd-d28c)
Test scenarios cover:
- Successful tombstone creation with actor/reason tracking
- Original type preservation in tombstone
- Audit trail recording
- Issue deletion with dependency cleanup
- Error handling for non-existent issues
- Unsupported storage backend fallback

Both functions achieve 100% test coverage.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-23 21:32:08 -08:00
Steve Yegge
cf9e5a597b bd sync: 2025-12-23 20:50:50 2025-12-23 20:50:50 -08:00
Steve Yegge
9c8761abc9 bd sync: 2025-12-23 20:45:19 2025-12-23 20:45:19 -08:00
Steve Yegge
e0f1d43c2c fix: write startup config keys to config.yaml instead of SQLite (GH#536)
`bd config set no-db true` now correctly writes to config.yaml instead of
SQLite. Previously, startup flags like no-db, no-daemon, no-auto-flush were
stored in SQLite but read from config.yaml at startup - making the command
appear to work while having no effect.

This adds:
- yaml_config.go: Defines yaml-only keys and provides SetYamlConfig/GetYamlConfig
- Updated config set/get commands to route yaml-only keys appropriately
- Comprehensive tests for yaml config handling

Startup flags affected: no-db, no-daemon, no-auto-flush, no-auto-import,
json, auto-start-daemon, flush-debounce, lock-timeout, git.*, sync.*, routing.*

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-23 17:03:39 -08:00
Steve Yegge
2ac190f26d bd mol run: add cross-database spawning support (gt-jsup)
Add --template-db flag and auto-discovery for wisp molecule spawning.
When --db contains .beads-wisp, auto-discover the main database to read
templates from while writing spawned instances to wisp storage.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-23 16:39:18 -08:00
Steve Yegge
3d924f88f3 fix: handle multi-hyphen prefixes correctly (GH#422)
The prefix mismatch detection was using ExtractIssuePrefix() which
tries to guess the prefix by analyzing suffix patterns. This failed
for multi-hyphen prefixes like "asianops-audit-" when issue IDs had
word-like suffixes (e.g., "asianops-audit-test") - the heuristic
would fall back to the first hyphen and report "asianops-" as the
prefix.

Fixed by checking directly if the issue ID starts with the configured
prefix using strings.HasPrefix(). This is more reliable than guessing
since we know the expected prefix from the database config.

Added test case TestImportMultiHyphenPrefix to prevent regression.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-23 16:20:04 -08:00
Steve Yegge
ee3d070d08 fix(mol): respect --pour flag in bond operations (bd-l7y3)
bondProtoMol was hardcoding Wisp=true, ignoring --pour flag.
Now passes pour parameter through the call chain so --pour
correctly creates persistent (non-wisp) issues.
2025-12-23 15:25:13 -08:00
Steve Yegge
7b671662aa bd sync: 2025-12-23 13:49:07 2025-12-23 14:39:07 -08:00
Steve Yegge
37ec967619 fix(stealth): use .git/info/exclude instead of global gitignore (GH#704)
The --stealth flag was writing absolute paths to global gitignore, but
git pattern matching does not support absolute paths in gitignore files.
Patterns are interpreted relative to the gitignore location, making
absolute paths like /home/user/project/.beads/ never match.

Fix: Use .git/info/exclude which is the git-recommended location for
user-specific, per-repository ignores. Patterns here are relative to
repo root, so .beads/ works correctly.

Benefits:
- Patterns actually work (fixes the bug)
- Per-repo isolation (stealth in one repo does not affect others)
- No global gitignore pollution
- Follows git best practices for user-local ignores

Generated with Claude Code

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-23 14:18:02 -08:00
Steve Yegge
2b26de08e5 Split sync.go into modular files (bd-u2sc.3)
Split the 2203-line sync.go into 5 focused modules:
- sync.go (1238 lines) - Main command and git helpers
- sync_export.go (170 lines) - Export operations
- sync_import.go (132 lines) - Import operations + doSyncFromMain
- sync_branch.go (285 lines) - Sync branch and external beads support
- sync_check.go (395 lines) - Integrity check operations

All tests pass. Remaining files (init.go, show.go, compact.go)
still need splitting - tracked for future work.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-23 13:48:01 -08:00
Steve Yegge
a129e36054 Add daemon RPC support for gate commands (bd-likt)
- Add gate operation constants (OpGateCreate, OpGateList, OpGateShow,
  OpGateClose, OpGateWait) to protocol.go
- Add Gate*Args and Gate*Result types to protocol.go
- Add gate handler methods (handleGateCreate, handleGateList,
  handleGateShow, handleGateClose, handleGateWait) to server_issues_epics.go
- Register gate handlers in handleRequest switch
- Add gate client methods (GateCreate, GateList, GateShow, GateClose,
  GateWait) to client.go
- Update cmd/bd/gate.go to use daemon client when available, falling
  back to direct store access

Gate commands now work with the daemon, eliminating the need for
--no-daemon flag.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-23 13:47:24 -08:00