Skip to content

feat: customizable worktree branch naming (#98) - #99

Merged
cloader merged 2 commits into
mainfrom
feat/issue-98-branch-naming
Nov 5, 2026
Merged

cloader merged 2 commits into
mainfrom
feat/issue-98-branch-naming

Conversation

@cloader

@cloader cloader commented Nov 5, 2026

Copy link
Copy Markdown
Owner

Closes #98

What

Worktree task branches are currently always task/<标题>+<taskId> — a Chinese title yields a Chinese branch name. This PR makes the naming configurable at two levels:

Board level (看板设置 → 分支命名): a naming preset picker —

Preset Output
task/标题+ID (default) task/修复登录+t-1a2b (pre-#98 behavior, byte-identical)
task/ID task/t-1a2b (pure ASCII)
前缀/ID work/t-1a2b
前缀/标题+ID work/修复登录+t-1a2b

Prefix presets reveal a prefix input (sanitized with the same illegal-char rules, 20-code-point cap). A live example preview renders as you switch.

Task level (task form, worktree isolation): an optional branch-name field. It defaults to (and keeps following) the board-rule derivation while the title edits; typing stops the auto-follow; clearing it restores the preset. The placeholder previews the rule in both modes — create mode renders the not-yet-minted id as the literal ID placeholder. Once execution history exists the field locks, same rule as isolation (the branch is pinned by the first worktree creation).

The taskboard_create agent tool accepts the same explicit branch argument; taskboard_update stays read-only on execution config (matching the existing isolation edge).

Compatibility

  • No migration, no schema bump: absent settings fields resolve to the legacy output byte for byte; sanitizeBranchName now delegates to buildBranchName under the factory preset and its existing test suite passes unchanged.
  • All pre-existing invariants kept: first-run pin, +r<8hex> collision fallback, optimistic pin replacement (pinBranches), multi-repo per-repo pins, successor cards not inheriting branches.
  • User-supplied names are sanitized host-side (git-illegal chars stripped, / kept for multi-level names, .lock suffixes stripped, 60-code-point cap); garbage input fail-softs to the board preset.

Tests

  • tests/issue-98.spec.ts — preset builder (legacy byte-equality regression), custom-name sanitizer spectrum, settings whitelist + accessor defaults.
  • tests/issue-98-ui.spec.tsx — form field (default derivation, title follow-until-touched, locked state, create-mode payload), settings picker (prefix input, save body).
  • tests/routes.spec.ts — create materialization, update swap/clear, execution-history lock.
  • Full suite: 711 tests green; typecheck + host/client build clean. i18n: zh/en/ru parity.

Board-level naming presets + task-level override for worktree-isolated
tasks:

- Board settings: a branch-naming preset picker (task/标题+ID default,
  task/ID, prefix/ID, prefix/标题+ID) with a conditional prefix input
  and a live example preview.
- Task form: an optional branch-name field shown for worktree tasks.
  It defaults to (and follows) the board-rule derivation until edited;
  clearing it restores the preset. The placeholder previews the rule
  in both modes (create mode renders the not-yet-minted id as the
  literal ID placeholder). Locked once execution history exists, like
  isolation.
- taskboard_create tool accepts an explicit branch (taskboard_update
  stays read-only on execution config, matching the isolation edge).
- Pre-#98 ledgers need no migration: absent fields resolve to the
  legacy byte-identical task/<标题>+<taskId> output; pin, collision
  fallback, multi-repo mirrors and successor-card semantics unchanged.

Closes #98
@cloader
cloader force-pushed the feat/issue-98-branch-naming branch from bd3766b to 5687921 Compare November 5, 2026 01:28
@cloader
cloader merged commit 49e9a51 into main Nov 5, 2026
2 checks passed
@cloader
cloader deleted the feat/issue-98-branch-naming branch November 9, 2026 08:51
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.

1 participant