Skip to content

Deprecate branch name prefixes#182

Merged
skarim merged 4 commits into
skarim/link-append-to-stackfrom
skarim/deprecate-prefix
Jul 15, 2026
Merged

Deprecate branch name prefixes#182
skarim merged 4 commits into
skarim/link-append-to-stackfrom
skarim/deprecate-prefix

Conversation

@skarim

@skarim skarim commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

The stack branch-name prefix (and the coupled --numbered naming) has caused more confusion than it was worth. The behavior was inconsistent — the interactive prompter applied a prefix while explicit names didn't, and passing an already-qualified name double-applied it (gh stack add refactor/foofeat/refactor/foo, #152). This removes the concept entirely: from local stack state, the prompts, the init/add flags, and everywhere it was referenced.

Behavior

Branch names are now used exactly as given — nothing is ever prepended or transformed.

  • Explicit name — used verbatim (slashes included), so gh stack add refactor/foo creates refactor/foo.
  • -m without a name — auto-generated from the commit message as MM-DD-slug (e.g. 07-15-add_login). The slug uses underscores as its word separator, preserves any real hyphens from the message, and is capped at 30 characters.
  • Neither — prompts for a name (no pre-filled prefix).

Old stack files that still carry prefix/numbered keys keep loading fine — the fields are ignored and dropped on the next save.

Changes

Remove the prefix concept

  • internal/stack/stack.go, schema.json — drop the Prefix and Numbered fields from the Stack model and schema.
  • cmd/init.go — remove the -p, --prefix and -n, --numbered flags, the numbered-branch path, prefix validation, and the interactive "use as a prefix?" detection.
  • cmd/add.go — collapse branch-name resolution to the three cases above and delete applyPrefix.
  • cmd/submit.go, cmd/view.go — stop carrying the prefix through the fork-a-merged-stack path and drop the prefix field from gh stack view --json.
  • internal/branch/name.go — delete ResolveBranchName, NextNumberedName, and FollowsNumbering.

Clean up branch auto-naming

  • internal/branch/name.goDateSlug now uses an MM-DD prefix (no year); Slugify separates words with underscores (keeping literal hyphens) and truncates to 30 characters.
  • cmd/utils.go, internal/config/config.go — simplify the prompt helper to promptInput and drop the now-unused prefill parameter from InputFn.

Update docs

  • README.md, docs/src/content/docs/reference/cli.md, docs/src/content/docs/guides/workflows.md, skills/gh-stack/SKILL.md, AGENTS.md — remove the prefix/numbered flags, examples, and the prefix JSON field, and refresh the auto-naming description.

Testing

  • Removed the prefix/numbered tests and added coverage for verbatim explicit names, -m date-slug generation, and the new MM-DD + underscore + 30-char slug rules.
  • go test -race -count=1 ./... and go vet ./... are clean, and the changed files pass gofmt.

Stack created with GitHub Stacks CLIGive Feedback 💬

Copilot AI review requested due to automatic review settings July 15, 2026 12:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Removes stack branch prefixes and numbered naming, making branch names verbatim and simplifying automatic naming.

Changes:

  • Removes prefix/numbered state, flags, and JSON output.
  • Generates MM-DD-slug names with underscore separators.
  • Updates prompts, tests, documentation, and agent guidance.
Show a summary per file
File Description
AGENTS.md Updates branch utility documentation.
README.md Documents prefix-free workflows.
cmd/add.go Simplifies branch-name resolution.
cmd/add_test.go Tests verbatim and automatic names.
cmd/init.go Removes prefix and numbered initialization.
cmd/init_test.go Updates initialization coverage.
cmd/submit.go Stops copying removed naming state.
cmd/utils.go Simplifies text prompting.
cmd/view.go Removes prefix from JSON output.
cmd/view_test.go Updates JSON output tests.
docs/src/content/docs/guides/workflows.md Revises abbreviated workflows.
docs/src/content/docs/reference/cli.md Updates CLI reference.
internal/branch/name.go Revises slug and date naming.
internal/branch/name_test.go Tests new slug rules.
internal/config/config.go Simplifies the input test hook.
internal/stack/schema.json Removes obsolete schema properties.
internal/stack/stack.go Removes obsolete stack fields.
internal/stack/stack_test.go Updates persistence tests.
skills/gh-stack/SKILL.md Updates agent workflow guidance.

Review details

  • Files reviewed: 19/19 changed files
  • Comments generated: 1
  • Review effort level: Medium

Comment thread internal/branch/name.go
@skarim skarim linked an issue Jul 15, 2026 that may be closed by this pull request

@talum talum left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@skarim skarim merged commit 38aba1b into main Jul 15, 2026
7 checks passed
@skarim skarim deleted the skarim/deprecate-prefix branch July 15, 2026 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gh stack add always prefixes the branch name

3 participants