Repository navigation
feat(branch): custom issue providers (#357) - #366
Conversation
…answer (#357) Phase 1 of #357: the version-1 fetch request/answer schemas (strict zod) and fetchCustomIssue, which runs the configured argv with the request on stdin, bounds it at 15 s and 1 MiB, and maps the provider's errors. runCapturing gains stdin input and maxBuffer, and now reports a timed-out child as killed with a null code even when its SIGTERM handler exits with a code. Gate 1: all verify.md sections exit 0 (pnpm test 3898, docs:test 1655). Gate 2: reviewer subagent PASS after two loopbacks.
…357) Phase 2 of #357: issueProvider.name and issueProvider.command as team keys (git config, .worktree.yml, user file), the issueProvider section with branchType in the project schema, resolveIssueProvider() taking the pair from the layer that sets the command, config --list / --project / summary support, the regenerated docs/public/schema/v1.json, and the docs for the keys. Gate 1: all verify.md sections exit 0 (pnpm test 3961, docs:test 1655). Gate 2: reviewer subagent PASS WITH NOTES after one loopback.
…he file (#357) Phase 3 of #357: ensureIssueProviderApproved() and approveIssueProvider(), a SHA-256 over the command's argv tokens under an internal git config key. A command from .worktree.yml fails closed (exit 2) when nothing can ask and on --dry-run; one from git config or the user file never asks. config --approve covers the postCreate steps and the provider command, each only when set and unapproved, and a local issueProvider.command is kept until the file's is approved. Docs, README, the skill and context7.json describe it. Gate 1: all verify.md sections exit 0 after one loopback (docs:audit-dist; pnpm test 3978, docs:test 1655). Gate 2: reviewer subagent PASS WITH NOTES.
Phase 4 of #357: `worktree branch --issue <ref>` (-i) sends the reference to the configured issueProvider.command, checks the per-person approval first (failing closed on --dry-run and with nothing to ask), and names the branch through the rules engine in D7's order: issueProvider.branchType, the shared branchType, then the provider's kind. --dry-run names the list that decided, --json reports issue {provider:"custom", name, key, url}. --assign/--start with --issue warn that they are not supported yet. A run with no issue flag spawns nothing, and in a repository whose file has no issueProvider section it reads no issueProvider key; one whose file sets it still reads those keys during the silent-removal step, as D4 and D5 require. Gate 1: all verify.md sections exit 0 (pnpm test 4017, docs:test 1655). Gate 2: reviewer subagent PASS WITH NOTES after one loopback.
Phase 5 of #357: the provider protocol gains optional assign and start operations, declared in the fetch answer's `can`, run through the same 15 s / 1 MiB runner and validation as fetch. `worktree branch --issue` assigns before the worktree exists and starts after it, through the personal keys issueProvider.autoAssign and issueProvider.autoStart (ignored with a warning in .worktree.yml). An operation the provider does not list is never called; held-by-other, left-alone, failures and timeouts warn and never abort. assigned and started keep their --json meaning. Gate 1: all verify.md sections exit 0 (pnpm test 4077, docs:test 1655). Gate 2: reviewer subagent PASS WITH NOTES after one loopback.
Phase 6 of #357: guides/custom-issue-provider, the protocol's reference — the command line and how it runs (cwd, environment, stdin, 1 MiB, 15 s), the fetch, assign and start requests and answers with every field, optional and default, `can`, extra fields, the error codes and their exits and --json codes, when assign and start are sent (including by default on runs that cannot ask), approval and the relative-path caveat, where credentials live, and a minimal provider for a made-up tracker. Linked from the guides index, the sidebar, branch.mdx, project-configuration.mdx, the FAQ and the README roadmap. The page count goes from 28 to 29 wherever it is written out, and docs/README.md's chunk count to 221. audit-dist's withoutElements no longer stops after 20 removals, so a page with more heading anchors than that no longer fails falsely. Gate 1: all verify.md sections exit 0 (audit: 29 pages; pnpm test 4077, docs:test 1657). Gate 2: reviewer subagent PASS WITH NOTES after one loopback.
The "requires one of" usage errors for --assign/--no-assign, --start/--no-start and --dry-run listed only the four built-in issue flags, though each guard already accepts --issue. They now name all five, in the wording of the "only one of" message beside them. The test that covers the guards also checks --start now, as its title said it did. Gate 1: all verify.md sections exit 0 (pnpm test 4077, docs:test 1657, audit 29 pages). Gate 2: reviewer subagent PASS WITH NOTES; the stale test title it noted is fixed here.
`--issue ""` and `--issue=` parse to an empty string, which every truthiness test in run() read as "no issue flag": the run went on as a plain branch, or said --assign/--start/--dry-run needed an issue flag. The flag now counts as given whenever it is defined, so an empty value reaches the existing trim check and is refused exactly like a whitespace-only one (exit 2, invalid_value), as branch.mdx's error table already said; with another issue flag it is refused as several. Gate 1: all verify.md sections exit 0 (pnpm test 4084, docs:test 1657, audit 29 pages). Gate 2: reviewer subagent PASS WITH NOTES; its unpinned-rule note (an empty --issue counting toward "only one of") is pinned by a test here, checked to fail against the old count.
…#357) The provider's name is read from the layer that sets issueProvider.command, but `worktree config` treated it as a key of its own: --list showed a git-config name beside the file's command as overriding the file, the read form printed it, and setting it claimed an override that never applied. --list now shows the name in effect first and every other one as not in effect, with the reason (the command comes from another layer, no command is set, or not a valid name); the read form prints the name in effect or nothing; setting a git-config name that will not apply warns and stores it. commands/config.mdx gains Issue Provider Keys entries for issueProvider.command and issueProvider.name, and it, the README and the skill say what these forms now print. The docs chunk count is 222 wherever it is written. Gate 1: all verify.md sections exit 0 (pnpm test 4109, docs:test 1657, audit 29 pages). Gate 2: reviewer subagent FAIL (docs/README.md chunk count; the read form; an invalid git-config name listed as in effect), then PASS WITH NOTES after one loopback; its two doc-wording notes are fixed here.
…the code does (#357) The README's setup-flow list no longer names issueProvider.command, which the wizard never asks for. commands/config.mdx's removal list says a local issueProvider.command, and its name, stay until the file's command is approved, and the page gains issueProvider.autoAssign and issueProvider.autoStart entries. project-configuration.mdx says what `worktree config --approve` does for the steps and the provider command, and "Approving the provider command" is its own heading, so it is in the table of contents and the links labelled for it land on it. The guide's slug sentence matches sanitizeBranchName. The unapproved-command error now reads "...; pass your approval (run `worktree config --approve` once in a terminal)". Gate 1: all verify.md sections exit 0 (pnpm test 4109, docs:test 1657, audit 29 pages). Gate 2: reviewer subagent PASS WITH NOTES; its clearer message wording, the ### heading for the table of contents and the removeCoveredLocalConfig doc comment are applied here.
…ers (#357) A custom provider's start answer reached the spinner line and the --json warning uncut, so `from`, `to` or `state` could carry up to the 1 MiB answer limit into one line. They are now cut at print to 200 characters, the bound heldBy already had, through one helper, shownField, which heldBy and the provider's stderr also use. A cut that falls inside a surrogate pair, or a lone surrogate the provider sent, now shows U+FFFD instead of half a character. The guide states the cut for heldBy and for the start fields. Gate 1: all verify.md sections exit 0 (pnpm test 4116, docs:test 1657, audit 29 pages). Gate 2: reviewer subagent PASS WITH NOTES; the heldBy test and the surrogate fix it suggested are applied here and re-checked: PASS.
There was a problem hiding this comment.
code-reviewer: minor issues
This adds branch --issue, which runs a team-configured issueProvider.command over a versioned stdin/stdout JSON contract. It also adds per-person approval of a command that comes from .worktree.yml, the issueProvider.* config keys with name/command resolved as a pair, assign/start through the provider, and the guide plus the docs page-count updates. The runner, the strict zod boundary validation, the fail-closed approval and the runCapturing changes (stdin input, maxBuffer, timeout-then-exit treated as a timeout) look correct and are well tested; I found no code defects. The findings are documentation the change left partly untrue, which the repository guide treats as part of the change.
Reviewed 7db7e95 for baldurpan · claude-opus-5-5 · 44 files · $0.90
craig-o-curtis
left a comment
There was a problem hiding this comment.
Ten findings, most severe first. Fix the first two before merging: an unset maxBuffer in runCapturing now removes Node's 1 MiB limit for every existing caller (reproduced on Node 26), and the provider's stdout cap also caps stderr. The rest are edge cases and cleanups. Only #1 was reproduced; the others come from reading the code.
…ssigned and started (#357)
There was a problem hiding this comment.
code-reviewer follow-up: looks good
Since the last review, only documentation changed. The README, commands/branch.mdx and the skill now describe --assign, --start, assigned and started for the --issue provider, in the same wording across all three, which closes all three earlier comments. A few lines outside these hunks still omit --issue, and the guide says a change should fix the docs it makes untrue, so they are worth a touch-up:
- In
branch.mdx, the "What It Does" steps 2 and 6 still name only--github/--jira/--clickupfor assigning and--linear/--clickup/--jirafor starting. - In
SKILL.md, the "Bounded calls" bullet leaves out the 15 s and 1 MiB provider bound that the README lists.
Earlier comments
- Fixed; yours to resolve: Suggestion: Bullet still says --assign/--no-assign need one of the four built-in flags
- Fixed; yours to resolve: Suggestion: Skill's --json and defaults text not updated for --issue
- Fixed; yours to resolve: Suggestion: README
assigned/starteddescription omits the custom provider
Reviewed 0ca9e2f (changes since 7db7e95) for baldurpan · claude-opus-5-5 · 3 files · $0.33
- runCapturing passes maxBuffer only when set: an explicit undefined lifted Node's 1 MiB default for every caller that did not name one. - An overrun names the stream it happened on; the guide says stderr is capped at 1 MiB too, since execFile bounds both. - Every provider error carries its --json code (failed, or timeout for the timeout), so text the provider wrote can no longer read as a timeout. - A provider stopped by a signal says so, instead of "could not be run" with Node's argv-bearing message. - A team key of only whitespace is no value: it no longer hides a lower layer's command. - One pairing rule (pairIssueProvider) for branch and config; the name rule's message and the control-character test are shared constants. - The covered-copy removal keeps a local command while git config names the provider otherwise than the file. - config --approve lists already-approved steps and command again. - branch counts an issue flag by whether it was given, and resolves the provider once per run.
There was a problem hiding this comment.
code-reviewer follow-up: looks good
Since 0ca9e2f, this push makes four groups of fixes. branch --issue now resolves the provider once and hands it to the approval step. The name/command pairing rule moves into pairIssueProvider, so config and branch cannot read the pair two ways, and values of only spaces now count as unset at every layer. Provider errors carry an explicit --json code, so stderr reading like "did not answer within 30s" is no longer reported as a timeout; the 1 MiB cap now covers stderr and the message names which stream overran; and a provider killed by a signal gets its own message. Smaller fixes: runCapturing no longer lifts Node's buffer limit when maxBuffer is unset, --approve lists items already approved, and the local command copy is kept while git config names the provider differently from the file. I checked the new paths against how Node's execFile reports maxBuffer overruns, timeouts, signals and missing programs, and they line up; the docs match the code, the new tests cover each fix, and I found nothing that needs changing.
Reviewed 74653ea (changes since 0ca9e2f) for baldurpan · claude-opus-5-5 · 16 files · $0.19
craig-o-curtis
left a comment
There was a problem hiding this comment.
Re-reviewed 74653ea. All nine fixes check out in the diff:
runCapturingaddsmaxBufferonly when it's set, and a test pins the default.- Provider errors carry an explicit
code, andfetchCustomIssue's caller rethrows them unchanged, sotoErrorCodenever falls back to the message. - The overrun message names the stream from Node's
stderr maxBuffer length exceededtext. signalgets its own branch, afterkilled, so a timeout is still reported as a timeout.pairIssueProvideris now the single place the name/command pairing is decided.- Whitespace-only values count as unset at every layer.
--approvelists already-approved items.- The local command copy is kept while git config's name differs from the file's.
- All five issue flags are counted with
!== undefined.
On the approval covering only the command text: leaving it as is makes sense, given the plan's recorded "accept and document" decision and the fact that hashing paths would promise more than it delivers. Fine with the rest of the empty built-in flag case staying in #363.
Two non-blocking doc touch-ups (also raised in the bot's earlier follow-up) that still leave out --issue:
commands/branch.mdx"What It Does": step 2 (assign) names only--github/--jira/--clickup, and step 6 (start) only--linear/--clickup/--jira.skills/worktree/SKILL.md:393"Bounded calls" is missing the provider's 15 s / 1 MiB bound that the README's line 356 lists.
|
Thanks for the re-review, @craig-o-curtis. Both doc touch-ups are in 3ca529a:
These are docs only, but the push makes your approval stale under the ruleset's dismiss-on-push. Sorry for the extra click. |
There was a problem hiding this comment.
code-reviewer follow-up: looks good
Since the last review, two documentation-only edits landed. The branch command page now lists --issue providers that can assign or start in steps 2 and 6 of the creation sequence, and the skill's bounded-calls list now includes the --issue provider call (15 s, at most 1 MiB of output). Both edits keep the docs in step with the feature, as the repository guide asks. I couldn't check the 15 s / 1 MiB figures against the runner code, which isn't in this diff, and found nothing to raise.
Reviewed 3ca529a (changes since 74653ea) for baldurpan · claude-opus-5-5 · 2 files · $0.03
…es (#355) #366 renamed the SKILL.md issue section to '…, a ClickUp task or your own tracker', so the starter case's vocabulary title no longer resolved. Its --issue text in commands/branch.mdx also pushes the github-issue-integration guide from rank 3 to 4 for 'Name my branch after a GitHub issue', past the fit budget; the baseline records the move (fit.kept 1 -> 0.962, MRR 0.703 -> 0.7).
Adds
--issue, which names a branch from your own issue tracker through a command configured asissueProvider;--assignand--startwork through it too. Includes the per-person approval of the command from the file, theissueProviderconfig keys and schema, and the provider guide page.Phases landed (all
done, plan in #357): 1 protocol and runner (646eb49), 2 configuration and schema (e3d4900), 3 approval (8dab5e6), 4branch --issue(e5176f6), 5 assign and start (da7abb2), 6 guide page (460ed25), plus review fixes.Release note: minor,
.changeset/quiet-trackers-name.md.Owner checks filed, not defects: #364 (a real provider end to end), #365 (browser pass of the guide page).
Closes #357