Repository navigation
Closed
Labels
enhancementNew feature or requestgraph-2026-09-fieldField-report graph 2026-09-28: downstream non-Node adoption gapsplannedImplementation plan approved
Description
Epic: field-2026-09-28 (downstream non-Node adoption) Tier: judgment Graph: tracker #1203
Problem. The root is path.join(path.dirname(gitRoot), "worktrees") (worktree-manager.ts:745) and ../worktrees/ in new-feature.sh:112,417. There is no setting or env var. Path-substring checks would break under a custom root:
pre-tool.sh:1199, in 3 copies:worktrees/feature/quality-checks.sh:521, in 2 copies:*"/worktrees/"*
Lookups already go through git worktree list (#900).
AC
- AC-1: A
worktreeRootsetting and aSEQUANT_WORKTREE_ROOTenv var set the root for both the TS path andnew-feature.sh. Evidence:npx vitest run src/lib/workflow/worktree-manager.test.ts - AC-2: The hook and quality-checks detect "inside a sequant worktree" via
git rev-parse --git-common-dir, not a path substring. Evidence:npx vitest run __tests__/pre-tool-hook.integration.test.ts
#1192 (native WorktreeCreate hooks) is not a dependency: it concerns the .exec-agents/ sub-worktrees inside an issue worktree (worktree-isolation.ts:60), not the root this issue configures. Owner decision, 2026-09-29. #1136 (in-place mode) already sidesteps the root.
Graph metadata
- No dependency edges. The former
Blocked by #1192was dropped by owner decision on 2026-09-29.
May touch
src/lib/workflow/worktree-manager.tssrc/lib/settings.tstemplates/scripts/new-feature.shscripts/new-feature.sh(tracked mirror, byte-identical to the template)src/lib/workflow/worktree-manager.test.ts__tests__/pre-tool-hook.integration.test.tshooks/pre-tool.sh.claude/hooks/pre-tool.shtemplates/hooks/pre-tool.sh.claude/skills/qa/scripts/quality-checks.shskills/qa/scripts/quality-checks.shtemplates/skills/qa/scripts/quality-checks.sh
File overlap (don't run in the same wave; merge one first):
- fix(worktree): TS provisioning runs
npm ci/pip install -qin repos with no manifest to install from — the shell path guards, TS doesn't #1196:src/lib/workflow/worktree-manager.ts - feat(pr): opt out of closing keywords —
Refs #Nfor issues a PR should not close #1197:src/lib/settings.ts,src/lib/workflow/worktree-manager.ts
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestgraph-2026-09-fieldField-report graph 2026-09-28: downstream non-Node adoption gapsplannedImplementation plan approved
Activity
admarble commentedon Sep 30, 2026
Context for the run (re-checked against
main@a12c441d, 2026-09-29)Owner decision: the
Blocked by #1192edge is dropped. #1192 is about the.exec-agents/sub-worktrees (src/lib/worktree-isolation.ts:60), not the issue-worktree root, so this issue is unblocked. The body is patched: checkboxes are added, line refs updated, and the "May touch" list extended.Current line refs
src/lib/workflow/worktree-manager.ts:746,path.join(path.dirname(gitRoot), "worktrees").templates/scripts/new-feature.sh:112(WORKTREE_DIR="../worktrees/${BRANCH_NAME}"),:143(hint text) and:417(CACHE_DIR="${MAIN_REPO_DIR}/../worktrees/.npm-cache"). The cache dir should follow the configured root.scripts/new-feature.shis a tracked, byte-identical mirror of the template, so edit both identically.pre-tool.sh:1199(grep -qE 'worktrees/feature/'), inhooks/,.claude/hooks/andtemplates/hooks/, all identical.quality-checks.sh:521(*"/worktrees/"*), in.claude/skills/qa/scripts/,skills/qa/scripts/andtemplates/skills/qa/scripts/, all identical.src/lib/settings.ts.RunSettingsstarts at:192. PutworktreeRootthere, next to the base-branch setting (:214).Design constraints
SEQUANT_WORKTREE_ROOTenv var, then theworktreeRootsetting, then the current default (<parent of repo>/worktrees). A relative value resolves against the main repo root. Resolve it in one TS helper and use it at:746.new-feature.shmust read the setting JSONC-safely..sequant/settings.jsonmay contain comments, so a plainjqread fails. Either honour only the env var in the shell script and have the TS caller exportSEQUANT_WORKTREE_ROOTwhen it invokes the script, or use a JSONC-tolerant read. Say which you chose in the PR.git rev-parse --git-dir≠git rev-parse --git-common-dir(resolve both to absolute paths). Don't match on a path substring.../worktrees/feature/<issue>-*/(src/lib/locks/checkout-lock.ts:182,187,pre-tool.sh:1057) and the skill prose inSKILL.mdfiles. They're guidance text, not detection logic. List them in the PR as a possible follow-up, but don't edit them here.pre-tool.shand the plugin-cache copy both fire. The AC-2 change reaches plugin users only after a plugin version bump. Note that in the PR body.Standard block
npm testin exec or in qa. This applies to the qa phase as well as exec. Run targeted suites in the foreground with a timeout:timeout 600 npx vitest run src/lib/workflow/worktree-manager.test.tsandtimeout 600 npx vitest run __tests__/pre-tool-hook.integration.test.ts(plus thenew-feature-*integration tests if you touch the script). Global setup runsnpm run buildfirst.failedTeststarts with the test file path.Closes #1199. UseRefsonly for the tracker, tracker(graph): field report 2026-09-28 — downstream non-Node adoption gaps (10 nodes) #1203. Don't reference investigation(worktrees): can native WorktreeCreate/WorktreeRemove hooks replace src/lib/worktree-isolation.ts? #1192 with a closing keyword..sequant/settings.jsonmust handle JSONC. That applies here tonew-feature.shandquality-checks.sh.admarble commentedon Sep 30, 2026
Complexity: Standard (2 ACs, 6 directories)
AC Quality Check
Evidence:commands pass onmaintoday, so neither gates anything yet.worktree-manager.test.tshas no worktree-root cases.pre-tool-hook.integration.test.tshas noWORKTREE_WARNINGcases. The evidence only counts once new cases land in those files and fail on unchanged code.new-feature.sh, and nothing tests that. → Derived AC-3.quality-checks.shis named in the AC, but no test covers it. → Derived AC-4.--git-dir≠--git-common-dir) detects any linked worktree. That includes.exec-agents/sub-worktrees and worktrees made by other tools. For a warn-only commit check and a find-the-main-repo lookup, that is the right behaviour. I'm reading the AC as "inside a linked worktree".Scope Assessment
Non-Goals: No
## Non-Goalsheading. The owner comment's "Out of scope" list does the same job: hint strings incheckout-lock.ts:182,187andpre-tool.sh:1057, and theSKILL.mdprose.src/lib,src/lib/workflow,templates/scripts+scripts, 3× hooks, 3× qa scripts,__tests__)Verdict: ✅ SCOPE_OK. The spread is mirror copies, not separate features.
Conflicts: #1196 and #1197 are closed. The in-flight worktrees for #1195 and #1217 don't touch the files in this plan. (#1217 has merged, and its worktree is stale.)
Acceptance Criteria
AC-1:
worktreeRootsetting +SEQUANT_WORKTREE_ROOTenv set the root for TS andnew-feature.shVerification: Unit Test (TS resolver) + Integration Test (script, see AC-3)
Scenario: Given
SEQUANT_WORKTREE_ROOT=/tmp/wt→ When the root is resolved → Then it is/tmp/wt. Given no env var andrun.worktreeRoot: "../trees"→ Then it is<repoRoot>/../trees, resolved. Given neither → Then it ispath.join(path.dirname(gitRoot), "worktrees"), same as today.Assumptions: A relative value resolves against the main repo root, not the cwd (owner comment). An empty or whitespace-only env var is treated as unset.
AC-2: Hook + quality-checks detect "inside a worktree" via
git rev-parse --git-common-dirVerification: Integration Test
Scenario: Given a linked worktree at a custom root with no
worktrees/feature/in its path → When agit commitBash payload runs throughpre-tool.shwith thatcwd→ Then noWORKTREE_WARNINGis written. Given the main checkout → ThenWORKTREE_WARNINGis written.Assumptions: The check runs in
${HOOK_CWD:-$PWD}, not barepwd. Line 1182 already uses that form, and barepwdis the hook's own directory rather than the command's. Both paths are made absolute before comparing:--git-dirreturns.gitrelative in the main checkout.Implementation Plan
Phase 1: TS resolver + setting (AC-1)
src/lib/settings.ts:worktreeRoot?: stringtoRunSettings, next todefaultBase(:218).:597), the known-keys list (:811) and the generated docs table (:1826).src/lib/workflow/worktree-manager.ts:resolveWorktreeRoot(gitRoot, configured?, env = process.env). Precedence: env, then setting, then default. Relative values are joined togitRoot, thenpath.resolved.:746.worktreeRootin as a new optional parameter ofensureWorktree/ensureWorktrees/ensureWorktreesChain.run-orchestrator.ts:1199,1206passessettings.run.worktreeRoot.worktree-manager.test.ts: env beats setting, setting beats default, a relative value resolves against the repo root, an empty env var is ignored.Phase 2: Shell script (AC-1, AC-3)
templates/scripts/new-feature.sh, then copy it byte-for-byte toscripts/new-feature.sh:WORKTREE_ROOTonce, after thecd "$MAIN_REPO_DIR"(:109). Order:$SEQUANT_WORKTREE_ROOT, then a JSONC-tolerant text read ofworktreeRootfrom.sequant/settings.json, then../worktrees.:112(WORKTREE_DIR),:143(thegit worktree addhint, which is a command users paste) and:417(CACHE_DIR).jq. It matches thepackageManagerprecedent at:236and works in non-Node repos. Lines whose first non-blank characters are//are dropped, then"worktreeRoot"\s*:\s*"([^"]*)"is matched. Env-only was rejected: no TS code runsnew-feature.sh(users and skills call it directly), so a TS export would never reach it, and the setting half of AC-1 would silently do nothing.__tests__/new-feature-*.integration.test.ts. Run the script withSEQUANT_WORKTREE_ROOTset, then with a JSONC settings file that has a commented-out decoy key followed by the real key. Assert where the worktree lands.Phase 3: Detection (AC-2, AC-4)
hooks/pre-tool.sh:1197-1203: replace thegrep -qE 'worktrees/feature/'check with a comparison of absolute--git-dirand--git-common-dirfromgit -C "${HOOK_CWD:-$PWD}". Get absolute paths withcd … && pwd -P, or--absolute-git-dirfor the git dir. Copy the file byte-for-byte to.claude/hooks/andtemplates/hooks/.skills/qa/scripts/quality-checks.sh:521: same comparison in place of*"/worktrees/"*. Copy to the.claude/skills/qa/scripts/andtemplates/skills/qa/scripts/mirrors.pre-tool-hook.integration.test.ts: a linked worktree at a custom path (noworktrees/substring) produces no warning, and the main checkout does. Mutation-verify by restoring the substring check and confirming the custom-root case fails.Design Review
worktree-manager.ts, which owns the path today, with the key inRunSettings. The shell script resolves on its own because it is a separate producer: two producers, one precedence rule (fix(cli): bare parseInt on run --timeout lets a malformed value abort every phase instantly (sibling of #818) #833/new-feature.sh hardcodes npm ci while the TS path is package-manager aware — pnpm/yarn/bun provisioning fails misleadingly #847 class). Detection stays in each shell script and uses git itself.env, so it tests without touchingprocess.env. Settings are passed in as a parameter instead of callinggetSettings()insideensureWorktree: the orchestrator has already loaded them, and that keeps the function I/O-free. Rejected: env-only in the shell, for the reason in step 4.defaultBasefor the setting and its resolution priority. ThepackageManagertext read innew-feature.shfor JSONC-safe shell reads.git -C "${HOOK_CWD:-$PWD}"frompre-tool.sh:1182./* */block-commented key would still match. That's acceptable: it's rare, and it's the same trade-off thepackageManagerread made. Say so in the PR.--absolute-git-dirfor both?"--git-common-dirhas no absolute variant on older git, so normalise that one withcd && pwd -P.pwd -Palso handles the/tmp→/private/tmpsymlink on macOS, which will otherwise break a naive string compare in tests.No ADR: the owner already fixed the design choices in their comment.
Feature Quality Planning
The standard checks pass. Items to watch:
new-feature.sh×2,pre-tool.sh×3,quality-checks.sh×3. Check withcmpbefore committing.pre-tool.shalso fires, so plugin users get AC-2 only after a plugin version bump. Note that in the PR body.pwd, which is the hook's own directory.HOOK_CWDfixes that as part of AC-2; no scope widening.checkout-lock.ts:182,187,pre-tool.sh:1057,worktree-resolver.ts:5,10,163(prose/messages only) and theSKILL.mdtext. List them in the PR as a possible follow-up.Derived ACs
new-feature.shplaces the worktree under$SEQUANT_WORKTREE_ROOT, or under aworktreeRootread from a JSONC settings file, ignoring a//-commented decoy. Evidence: new__tests__/new-feature-worktree-root.integration.test.tsquality-checks.sh'sverify_build_against_mainfinds the main repo from a worktree at a custom root. Evidence: an integration test that sources the function from a custom-root worktree, or a recorded manual run in the PR if sourcing proves impracticalOpen Questions
~inworktreeRoot? Recommendation: no. Document the value as absolute or repo-root-relative. Impact if wrong:~/wtbecomes<repo>/~/wt, which is visible immediately and easy to fix.quality-checks.shalso derivemain_repo_dirfrom--git-common-dir, replacing thegrep [main]heuristic? Recommendation: no. Keep this PR to the detection condition; it's a possible follow-up. Impact: none for this AC.Recommended Workflow
Phases: exec → qa
Quality Loop: disabled
Reasoning: The design is fully specified by the owner, and there are 2 ACs whose tests are concrete cases in named files. Testgen stubs would add a round-trip without adding structure, so I'm overriding the "Unit/Integration → testgen" default. Per the owner's standard block, neither phase runs the full suite: targeted
timeout 600 npx vitest run …only.Label Review
Current: enhancement, graph-2026-09-field
Recommended: + planned
Quality Loop: won't auto-enable. The scope is OK and there is no
complex/refactorlabel.admarble commentedon Sep 30, 2026
QA Verdict: READY_FOR_MERGE
AC coverage: 4/4 met
admarble commentedon Sep 30, 2026
Runner verification — PR #1226 (QA verdict READY_FOR_MERGE, no gaps)
Spot-checked, since a verdict is a claim:
worktree-manager.test.ts,pre-tool-hook.integration,new-feature-worktree-root.integration,quality-checks-worktree-root.integration. 420 passed. After merging main (fix(#1195): sequant://install recomputes on every read and reports a broken manifest as {error} #1225) they pass again, along withinstall-resource: 431 passed.tscis clean.<sandbox>/custom-root/…for the hook and for quality-checks; the env var winning over the setting fornew-feature.sh; and JSONC settings with a//-commented decoy key.in_linked_worktree's git-dir check back to the old*worktrees/feature/*substring in all three hook copies. Both custom-root cases then failed for every copy (6 failed); restored.pre-tool.shand threequality-checks.shcopies are byte-identical, andscripts/new-feature.shis a symlink to the template.feat(#1199): configurable worktree root (#1226)
admarble commentedon Sep 30, 2026
Delivered by #1226 (squash
4797ac8conmain). Closed by hand:closingIssuesReferenceslisted #1199 before the merge, but the merge didn't close it (same as #1195/#1225).