cli: share checkpoint/trail command-noun constants · Entire

cli: share checkpoint/trail command-noun constants

2374173·

Soph·2w ago·4 files·+13 added/-6 removed

The literals "checkpoint" and "trail" were repeated across the command definitions, agent-help example, and tune-source parsing, tripping goconst locally (CI's only-new-issues mode hid it). Name them once next to the checkpoint group and reuse them.

Co-Authored-By: Claude Fable 5 noreply@anthropic.com

Sessions

4d50122f351fView transcript

Changes

4

280 unmodified lines

281
282
283
284
284
285
286
286
287
288
289

280 unmodified lines

}
    // Use an example command that is actually advertised here (trail is gated on
    // trails being enabled), so we never point at a command the agent can't use.
    example := "checkpoint"
    example := checkpointCmdName
    if trailsEnabled {
        example = "trail"
        example = trailCmdName
    }
    fmt.Fprintf(&b, "\nDrill in for exact, currently-installed flags:  entire agent-help <command>  (e.g. entire agent-help %s)\n", example)
    b.WriteString("Add --json for structured output.\n")

Mcmd/entire/cli/agent_help_cmd.go+2/-2

6 unmodified lines

7
8
9
10
11
12
13
14
15
16
17
18
19
20
14
21
22
23
24

6 unmodified lines

"github.com/spf13/cobra"
//
// checkpointCmdName and trailCmdName are the command nouns shared by the
// command definitions and the agent-help/tuning surfaces that mention them.
const (
    checkpointCmdName = "checkpoint"
    trailCmdName      = "trail"
)
//
// newCheckpointGroupCmd builds the `entire checkpoint` parent command and
// registers list/explain/tokens/search as children, plus the deprecated rewind.
func newCheckpointGroupCmd() *cobra.Command {
    cmd := &cobra.Command{
        Use:     "checkpoint",
        Use:     checkpointCmdName,
        Aliases: []string{"cp", "checkpoints"},
        Short:   "Inspect and search checkpoints",
        Long: `Operations on checkpoints — the persistent records of agent work tied to commits.

Mcmd/entire/cli/checkpoint_group.go+8/-1

51 unmodified lines

52
53
54
55
55
56
57
57
58
59
60

51 unmodified lines

s.repo = true
        case "pr", "prs", "issue", "issues":
        s.prs = true
        case "checkpoint", "checkpoints":
        case checkpointCmdName, "checkpoints":
        s.checkpoints = true
        case "trail", "trails":
        case trailCmdName, "trails":
        s.trails = true
        default:
            return s, fmt.Errorf("unknown source %q (valid: repo, prs, checkpoints, trails, all)\n", item)

Mcmd/entire/cli/runner_gather.go+2/-2

42 unmodified lines

43
44
45
46
46
47
48
49

42 unmodified lines

var repoOverride string

cmd := &cobra.Command{
        Use:    "trail",
        Use:    trailCmdName,
        Short:  "Manage trails for your branches",
        Hidden: true,
        // Hidden from root help while the surface matures, but advertised to

Mcmd/entire/cli/trail_cmd.go+1/-1