feat: gt mol attach auto-detects agent from cwd when single arg provided

When called with 1 arg from an agent working directory, gt mol attach
now auto-detects the pinned bead ID from the current agent's hook.

Uses the same role detection infrastructure as gt mail and bd. (gt-t7ekm)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-12-30 00:15:58 -08:00
parent fdea399d6f
commit 3aeaeaf845
2 changed files with 68 additions and 6 deletions

View File

@@ -55,16 +55,20 @@ Example:
}
var moleculeAttachCmd = &cobra.Command{
Use: "attach <pinned-bead-id> <molecule-id>",
Use: "attach [pinned-bead-id] <molecule-id>",
Short: "Attach a molecule to a pinned bead",
Long: `Attach a molecule to a pinned/handoff bead.
This records which molecule an agent is currently working on. The attachment
is stored in the pinned bead's description and visible via 'bd show'.
Example:
gt molecule attach gt-abc mol-xyz`,
Args: cobra.ExactArgs(2),
When called with a single argument from an agent working directory, the
pinned bead ID is auto-detected from the current agent's hook.
Examples:
gt molecule attach gt-abc mol-xyz # Explicit pinned bead
gt molecule attach mol-xyz # Auto-detect from cwd`,
Args: cobra.RangeArgs(1, 2),
RunE: runMoleculeAttach,
}