Commit graph

19 commits

Author SHA1 Message Date
kev
e90f980ada feat(setup): omit bd dolt push from template when no remote configured
RenderSection() and ReplaceSection() now accept RenderOpts with a
HasRemote flag. When false, "bd dolt push" is stripped from the
session-completion code block (and the Auto-Sync informational bullet
in the full profile). This prevents agents from dutifully running a
no-op every session on solo/local-only projects.

bd init detects the remote via shouldWireInitRemote(); bd setup detects
it by reading sync.remote / sync.git-remote from config.yaml. The
existing no-arg RenderSection() and ReplaceSection() default to
HasRemote=true for full backward compatibility.

Closes beads-ozg.
2026-04-27 17:37:42 -04:00
seanmartinsmith
3fa0e23032
fix(setup): prevent doubled BEGIN/END markers from CRLF embedded template (#3553)
When bd is built from a Windows checkout (default core.autocrlf=true),
//go:embed reads CRLF bytes from the working tree for
internal/templates/agents/defaults/beads-section.md. templateBody()'s
LF-only TrimPrefix/TrimSuffix then failed to strip the legacy markers
inside the embedded body, so RenderSection wrapped them with fresh
markers — producing two nested BEGIN/END pairs in any AGENTS.md
written by bd setup mux/claude/etc.

bd setup mux --remove only stripped the outer pair (find-first
semantics), leaving a stray <!-- END BEADS INTEGRATION --> in the
user's file. TestRemoveMuxProjectRemovesBothLayers caught this on
Windows.

Two complementary fixes:

1. Pin internal/templates/agents/defaults/*.md to eol=lf in
   .gitattributes. Embedded templates are shipped data, not
   user-edited text, and should never carry CRLF.
2. Normalize CRLF→LF in templateBody() before stripping markers.
   Defensive against future templates added without a gitattributes
   pin.

Adds TestRenderSectionFullSingleMarkers as a direct regression guard
(asserts exactly one BEGIN and one END in RenderSection output).

Fixes #3552
2026-04-27 13:41:45 -07:00
coffeegoddd☕️✨
a44d4f9d58 fix(init): replace 'bd onboard' references with 'bd prime' in AGENTS.md (#2902)
bd init creates a complete AGENTS.md but tells users to "Run bd onboard
to get started", which suggests different/conflicting content. Replace
with "Run bd prime" which is the correct entry point for workflow context.

Also migrates the Claude settings prompt from bd onboard to bd prime,
with backward-compatible detection of existing onboard references.

Closes #2902

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 10:42:50 -07:00
ruby
8f18302cb5 refactor: remove polecat/crew/gastown GT terminology from beads types (bd-77g2)
Replace Gas Town-specific terminology with generic equivalents:
- types.go: polecat->worker in MolType comments, EntityRef examples
- types_test.go: polecat-nux->worker-1, gastown->local in all EntityRef tests
- config_test.go: crew,polecat->team,worker in agent_roles test
- agents templates: Landing the Plane -> Session Completion
- info.go: session cycling -> session handoff in changelog
- CHANGELOG.md: landing the plane -> session completion
2026-03-20 18:35:57 -07:00
flint
3a2164b12f chore: remove orphan GT role templates (deacon, witness, refinery) from beads (bd-qc2h)
internal/templates/roles/ contained deacon.md.tmpl, witness.md.tmpl,
refinery.md.tmpl — Gas Town agent role templates that belong in the GT
repo, not beads. No Go code in beads references or embeds these files.
GT maintains its own copies in gastown/*/internal/templates/roles/.
2026-03-20 18:26:44 -07:00
lizzy
0fe9c03233 feat: surface quality/lifecycle commands in prime, template, and doctor (fix-merge PR #2664)
Surfaces existing but undiscoverable commands in bd prime output (CLI mode)
and beads-section.md template. Adds doctor --check=conventions as a composite
of lint, stale, and orphan checks (advisory only).

Fix-merge changes:
- Remove Close Reason Format section (not an established convention yet)
- Fix --by to --with for bd supersede (matches actual flag name)

Co-Authored-By: seanmartinsmith <114885497+seanmartinsmith@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 17:50:24 -07:00
obsidian
05142d0160 feat: consolidate prime SSOT section replacement into canonical ReplaceSection (bd-jfe5)
Create agents.ReplaceSection(content, profile) as the single canonical
function for replacing beads integration sections. Both init_agent.go
(upgradeBeadsSection) and setup/agents.go (updateBeadsSectionWithProfile)
now delegate to it.

Key changes:
- Hash-based freshness check skips rewrite when content is current
- Returns error on malformed markers (missing/reversed) instead of
  silent append
- Marker format now includes v:1 version field for forward compat
- atomicWriteFile accepts optional permissions param (default 0644)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 18:59:15 -07:00
maphew
87b6beabc4 style: fix gofmt formatting
Amp-Thread-ID: https://ampcode.com/threads/T-019ced8f-f8dc-76ca-b8b1-7650879f3633
Co-authored-by: Amp <amp@ampcode.com>
2026-03-15 15:02:52 -07:00
maphew
fca2d29263 fix: sync agents.md.tmpl beads section with beads-section.md
Update agents.md.tmpl to match canonical beads-section.md content:
- 'Version-controlled: Built on Dolt with cell-level merge' →
  'Git-friendly: Dolt-powered version control with native sync'
- JSONL-based sync description → Dolt push/pull sync model
- Legacy markers → versioned markers (profile:full hash:d4f96305)

This ensures EmbeddedDefault() output has a beads section body
identical to beads-section.md, so upgradeBeadsSection() in bd init
is a no-op for freshly created files.

Ref: #2139
Amp-Thread-ID: https://ampcode.com/threads/T-019ced8e-4a10-7404-b1f6-83cc78d1996c
Co-authored-by: Amp <amp@ampcode.com>
2026-03-15 15:02:52 -07:00
maphew
46816ee05b feat: prime SSOT tasks 1-3 — shared render API, template profiles, prefix-aware parser (#2139)
Implement the foundational pieces for making bd prime the single source
of truth for agent instructions:

Task 1 - Shared render API (internal/templates/agents/render.go):
  - Profile type with Full and Minimal constants
  - RenderSection(profile) generates sections with marker metadata
  - ParseMarker() extracts profile/hash from begin markers
  - CurrentHash(profile) for staleness detection
  - 8-char SHA-256 hash for deterministic freshness

Task 2 - Template splitting:
  - New beads-section-minimal.md for hook-enabled agents (Claude, Gemini)
  - Minimal profile: pointer to bd prime + quick reference + landing protocol
  - Existing beads-section.md preserved as full profile body

Task 3 - Parser refactor (cmd/bd/setup/agents.go):
  - Prefix-based marker matching via containsBeadsMarker/findBeginMarker
  - Legacy markers (no metadata) detected and upgradable
  - New markers: <!-- BEGIN BEADS INTEGRATION profile:full hash:a1b2c3d4 -->
  - agentsIntegration gains profile field (defaults to full)
  - updateBeadsSectionWithProfile for profile-aware updates
  - createNewAgentsFileWithProfile for new file creation

Backward compatible: EmbeddedBeadsSection/EmbeddedDefault still work.
Legacy markers are auto-upgraded on next bd setup run.

Amp-Thread-ID: https://ampcode.com/threads/T-019ced5e-0acd-7158-93ad-0695c6d02580
Co-authored-by: Amp <amp@ampcode.com>
2026-03-15 15:02:52 -07:00
beads/crew/emma
d1549d996a fix: bd export crash on zero-time timestamps + stale bd sync refs (GH#2488, GH#2493)
Export: sanitize zero-value time.Time fields (year 0001) to Unix epoch
before JSON marshaling. NULL datetime columns from Dolt scan as
time.Time{} which causes MarshalJSON to fail.

Templates: replace stale 'bd sync' with 'bd dolt push' in agent
instruction templates generated by bd setup factory.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 13:46:21 -07:00
dutch
f31acbb892 Remove stale sync mode documentation
Update documentation to reflect that only dolt-native sync mode is supported:

- docs/CONFIG.md: Remove git-portable and belt-and-suspenders references
- docs/DOLT-BACKEND.md: Simplify sync mode section
- FEDERATION-SETUP.md: Remove deprecated sync mode table
- agents.md.tmpl: Update "Git-friendly: JSONL" to "Version-controlled: Dolt"

The sync mode code was already cleaned up (only SyncModeDoltNative is valid
in internal/config/sync.go), but documentation still referenced removed modes.

w-bd-004

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-04 12:52:24 -05:00
beads/crew/jane
8140c1a49e fix: move Landing the Plane inside beads integration markers (#2265)
bd init appended the "Landing the Plane" section outside the
<!-- BEGIN/END BEADS INTEGRATION --> markers, making it unmanaged
debris that removeBeadsSection() could never clean up.

Move landing content into beads-section.md and agents.md.tmpl within
the markers, simplify updateAgentFile() to stop separately appending
it, invert TestBeadsSectionDoesNotContainLanding, and add a round-trip
test proving add→remove leaves no beads content behind.

Closes #2265

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 14:01:35 -08:00
mayor
6ebd79796c fix: remove "notify polecat" instructions from refinery template
Polecats are ephemeral — they die after submitting their MR via `gt done`.
The refinery cannot send work back to a dead polecat. All failure handling
must go through the witness (MERGE_FAILED protocol), which manages polecat
lifecycles and can re-sling work.

Changes:
- Add explicit warning that polecats are ephemeral (near role definition)
- ZFC table: route failures to witness, not polecat
- Conflict examples: send MERGE_FAILED to witness
- handle-failures: branch failures → reopen issue + notify witness
- Remove "fix it yourself" option for pre-existing failures (refinery is
  mechanical, not a developer)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 19:50:10 -08:00
jasper
6abc586ba2 feat: add PreToolUse hook to block interactive cp/mv/rm prompts (bd-tm2p)
Polecats hang indefinitely when macOS shell aliases add -i (interactive)
flags to cp/mv/rm. This adds a Claude Code PreToolUse hook that blocks
these commands unless -f flag or alias-bypass (command prefix, absolute
path) is present.

Changes:
- New hook: .claude/hooks/block-interactive-cmds.sh
- Register hook in .claude/settings.json
- Add non-interactive guidance to default agents.md template

Executed-By: beads/polecats/jasper
Rig: beads
Role: polecats
2026-02-27 16:16:24 -08:00
vp
6a70a3ecf8 docs(setup): use --claim in generated agent templates 2026-02-24 03:29:33 +03:00
beads/crew/elinor
90da8f6028 docs: remove stale JSONL references from ~73 markdown files (bd-9ni.4)
Replace JSONL storage/sync references with Dolt-native equivalents across
documentation, plugin resources, website docs, agent instructions, and
example READMEs. Preserves legitimate JSONL references (bd import/export
commands, CHANGELOG history, routes.jsonl/interactions.jsonl concepts).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 22:18:02 -08:00
beads/crew/emma
87d49a6cc1 feat: embed AGENTS.md templates with embed.FS and add --agents-template flag
Move AGENTS.md content from Go string concatenation into embedded template
files using embed.FS. Add --agents-template flag to bd init for custom
templates. Inspired by PR #1879.

- New internal/templates/agents/ package with EmbeddedDefault() and
  EmbeddedBeadsSection() loaders
- Remove landingThePlaneSection and agentsBeadsSection string constants
- bd init --agents-template <path> overrides the embedded default
- Net -86 lines of code

Co-authored-by: iliyafa <20426296+iliyafa@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Executed-By: beads/crew/emma
Rig: beads
Role: crew
2026-02-21 14:14:35 -08:00
beads/crew/emma
c51022a3d6 chore: add role templates and gitignore bd_test
- Add witness, deacon, refinery role templates
- Ignore bd_test binary (bd-test was already ignored)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 18:03:43 -08:00