Warn on Empty Transcript, Improve Transport Tests · Entire
Spec 1 — Warn on a transcript that parses to nothing (highest value)
Goal:
Don't silently produce a contentless checkpoint. extractTranscriptMetadata can return an all-zero meta (no user turns, no first prompt, no model). Attach then proceeds; attachPrompts returns nil, attachStepCount floors the count to 1, and the checkpoint is written and reported as success with no prompt/title.
Change:
After meta := extractTranscriptMetadata(transcriptData), if meta.FirstPrompt == "" && meta.TurnCount == 0, emit a warning to stderr like: warning: no user prompts were parsed from this transcript; the checkpoint will have no recorded prompt. Verify the --agent value. Then continue (still write the checkpoint).
Critical constraint — must be a warning, not a hard error.
Tests:
Add to attach_test.go — a transcript that extracts to empty produces the warning on stderr and still writes the checkpoint (assert both).
Spec 2 — Post-attach summary footer
Goal:
Confirm what was captured. Currently, success prints only Attached session X + Created/Added checkpoint Y; entire session info shows richer stats but attach gives none.
Change:
In runAttach, after the Attached session line, print a summary of meta.TurnCount, meta.Model, and tokenUsage. Example: Captured: 12 turns · claude-opus-4-8 · 1.3k tokens.
Tests:
Extend existing happy-path attach test to assert footer renders with turns/model.
Spec 3 — Surface the amend-failure reason to the user
Goal:
When --amend fails, tell the user why on screen. Currently, the user sees no indication the amend was attempted and failed.
Change:
At the amend call sites, print a brief stderr note before the fallback trailer: Could not amend the commit automatically (%v).
Tests:
Add one for the decline path (assert the fallback trailer prints).
Spec 4 — Help-text accuracy (doc-only)
Goal:
Document two true behaviors.
Changes:
--forceflag help — append that the amend is best-effort.- Long help — add a sentence about auto-detecting the agent.
Recommended order:
Spec 1 bundled with Spec 3, then Spec 2, then Spec 4.
Summary of changes
cmd/entire/cli/attach.go
- Plumbing (Spec 1+3):
runAttachnow takes anerrW io.Writer. - Spec 1: A warning is emitted when
meta.FirstPrompt == "" && meta.TurnCount == 0. - Spec 2: Captured footer shown after the real-attach path.
- Spec 3: Print error notes to stderr in addition to existing logging.
- Spec 4: Update help texts.
cmd/entire/cli/attach_test.go
- Updated all existing
runAttachcall sites for the new signature. - Added test cases for warnings and footer display.