fix(sling): set attached_molecule field when bonding formula to bead (#451)

When using `gt sling <formula> --on <bead>`, the wisp was bonded to the
target bead but the attached_molecule field wasn't being set in the
bead's description. This caused `gt hook` to report "No molecule
attached" even though the formula was correctly bonded.

Now both sling.go (--on mode) and sling_formula.go (standalone formula)
call storeAttachedMoleculeInBead() to record the molecule attachment
after wisp creation. This ensures gt hook can properly display molecule
progress.

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Julian Knutsen
2026-01-16 19:41:05 +00:00
committed by GitHub
parent e5aea04fa1
commit 7e158cddd6
4 changed files with 220 additions and 0 deletions

View File

@@ -434,6 +434,13 @@ func runSling(cmd *cobra.Command, args []string) error {
fmt.Printf("%s Formula bonded to %s\n", style.Bold.Render("✓"), beadID)
// Record the attached molecule in the wisp's description.
// This is required for gt hook to recognize the molecule attachment.
if err := storeAttachedMoleculeInBead(wispRootID, wispRootID); err != nil {
// Warn but don't fail - polecat can still work through steps
fmt.Printf("%s Could not store attached_molecule: %v\n", style.Dim.Render("Warning:"), err)
}
// Update beadID to hook the compound root instead of bare bead
beadID = wispRootID
}