sequant 2.8.0 → 2.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (211) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/README.md +23 -4
  4. package/dist/bin/cli.js +99 -18
  5. package/dist/marketplace/external_plugins/sequant/.claude-plugin/plugin.json +1 -1
  6. package/dist/marketplace/external_plugins/sequant/.mcp.json +1 -1
  7. package/dist/marketplace/external_plugins/sequant/README.md +58 -2
  8. package/dist/marketplace/external_plugins/sequant/hooks/parallel-marker.sh +50 -0
  9. package/dist/marketplace/external_plugins/sequant/hooks/post-tool.sh +38 -10
  10. package/dist/marketplace/external_plugins/sequant/hooks/pre-tool.sh +405 -67
  11. package/dist/marketplace/external_plugins/sequant/skills/_shared/references/trust-model.md +18 -0
  12. package/dist/marketplace/external_plugins/sequant/skills/assess/SKILL.md +250 -344
  13. package/dist/marketplace/external_plugins/sequant/skills/assess/references/predicted-collision-detection.md +10 -7
  14. package/dist/marketplace/external_plugins/sequant/skills/docs/SKILL.md +4 -4
  15. package/dist/marketplace/external_plugins/sequant/skills/exec/SKILL.md +26 -6
  16. package/dist/marketplace/external_plugins/sequant/skills/fullsolve/SKILL.md +4 -2
  17. package/dist/marketplace/external_plugins/sequant/skills/loop/SKILL.md +38 -2
  18. package/dist/marketplace/external_plugins/sequant/skills/merger/SKILL.md +2 -2
  19. package/dist/marketplace/external_plugins/sequant/skills/qa/SKILL.md +337 -57
  20. package/dist/marketplace/external_plugins/sequant/skills/qa/references/anti-pattern-detection.md +6 -6
  21. package/dist/marketplace/external_plugins/sequant/skills/qa/references/call-site-review.md +2 -2
  22. package/dist/marketplace/external_plugins/sequant/skills/qa/references/code-review-checklist.md +2 -2
  23. package/dist/marketplace/external_plugins/sequant/skills/qa/references/fixtures/injection-issue-body.md +36 -0
  24. package/dist/marketplace/external_plugins/sequant/skills/qa/references/quality-gates.md +21 -7
  25. package/dist/marketplace/external_plugins/sequant/skills/qa/references/testing-requirements.md +1 -1
  26. package/dist/marketplace/external_plugins/sequant/skills/qa/scripts/quality-checks.sh +11 -11
  27. package/dist/marketplace/external_plugins/sequant/skills/reflect/SKILL.md +27 -13
  28. package/dist/marketplace/external_plugins/sequant/skills/reflect/references/documentation-tiers.md +80 -68
  29. package/dist/marketplace/external_plugins/sequant/skills/reflect/references/phase-reflection.md +31 -15
  30. package/dist/marketplace/external_plugins/sequant/skills/release/SKILL.md +11 -3
  31. package/dist/marketplace/external_plugins/sequant/skills/setup/SKILL.md +5 -5
  32. package/dist/marketplace/external_plugins/sequant/skills/spec/SKILL.md +2 -0
  33. package/dist/marketplace/external_plugins/sequant/skills/spec/references/verification-criteria.md +1 -1
  34. package/dist/marketplace/external_plugins/sequant/skills/test/SKILL.md +1 -1
  35. package/dist/src/commands/assess-render.d.ts +23 -0
  36. package/dist/src/commands/assess-render.js +60 -0
  37. package/dist/src/commands/doctor.js +8 -13
  38. package/dist/src/commands/init.js +13 -1
  39. package/dist/src/commands/locks.js +2 -0
  40. package/dist/src/commands/logs.js +20 -6
  41. package/dist/src/commands/merge.js +154 -2
  42. package/dist/src/commands/ready-tui-adapter.js +6 -1
  43. package/dist/src/commands/ready.d.ts +25 -3
  44. package/dist/src/commands/ready.js +39 -13
  45. package/dist/src/commands/resume.d.ts +113 -0
  46. package/dist/src/commands/resume.js +193 -0
  47. package/dist/src/commands/run-display.d.ts +20 -0
  48. package/dist/src/commands/run-display.js +117 -5
  49. package/dist/src/commands/run-flags.d.ts +42 -1
  50. package/dist/src/commands/run-flags.js +53 -1
  51. package/dist/src/commands/run-progress.js +26 -1
  52. package/dist/src/commands/run.js +11 -10
  53. package/dist/src/commands/state.js +7 -0
  54. package/dist/src/commands/stats.js +47 -0
  55. package/dist/src/commands/status.d.ts +9 -0
  56. package/dist/src/commands/status.js +24 -1
  57. package/dist/src/commands/sync.js +90 -19
  58. package/dist/src/commands/update.js +28 -5
  59. package/dist/src/lib/ac-parser.d.ts +14 -0
  60. package/dist/src/lib/ac-parser.js +99 -5
  61. package/dist/src/lib/assess/index.d.ts +10 -0
  62. package/dist/src/lib/assess/index.js +9 -0
  63. package/dist/src/lib/assess/renderer.d.ts +64 -0
  64. package/dist/src/lib/assess/renderer.js +481 -0
  65. package/dist/src/lib/assess/types.d.ts +224 -0
  66. package/dist/src/lib/assess/types.js +241 -0
  67. package/dist/src/lib/assess-collision-detect.d.ts +19 -2
  68. package/dist/src/lib/assess-collision-detect.js +68 -4
  69. package/dist/src/lib/ci/outputs.d.ts +15 -2
  70. package/dist/src/lib/ci/outputs.js +17 -5
  71. package/dist/src/lib/cli-flags.d.ts +33 -0
  72. package/dist/src/lib/cli-flags.js +46 -0
  73. package/dist/src/lib/cli-ui/run-renderer-types.d.ts +21 -7
  74. package/dist/src/lib/cli-ui/run-renderer.d.ts +10 -0
  75. package/dist/src/lib/cli-ui/run-renderer.js +79 -9
  76. package/dist/src/lib/errors.d.ts +84 -6
  77. package/dist/src/lib/errors.js +142 -17
  78. package/dist/src/lib/locks/index.d.ts +3 -3
  79. package/dist/src/lib/locks/index.js +2 -2
  80. package/dist/src/lib/locks/lock-manager.d.ts +20 -2
  81. package/dist/src/lib/locks/lock-manager.js +47 -3
  82. package/dist/src/lib/locks/types.d.ts +34 -3
  83. package/dist/src/lib/locks/types.js +16 -0
  84. package/dist/src/lib/manifest.js +1 -17
  85. package/dist/src/lib/mcp-config.d.ts +45 -0
  86. package/dist/src/lib/mcp-config.js +77 -1
  87. package/dist/src/lib/merge-check/combined-branch-test.d.ts +21 -2
  88. package/dist/src/lib/merge-check/combined-branch-test.js +233 -110
  89. package/dist/src/lib/merge-check/command-result.d.ts +36 -0
  90. package/dist/src/lib/merge-check/command-result.js +56 -0
  91. package/dist/src/lib/merge-check/index.d.ts +4 -0
  92. package/dist/src/lib/merge-check/index.js +1 -1
  93. package/dist/src/lib/merge-check/report.js +5 -1
  94. package/dist/src/lib/merge-check/types.d.ts +9 -0
  95. package/dist/src/lib/merge-check/watch.d.ts +121 -0
  96. package/dist/src/lib/merge-check/watch.js +215 -0
  97. package/dist/src/lib/qa/infra-blocked-ci.d.ts +90 -0
  98. package/dist/src/lib/qa/infra-blocked-ci.js +80 -0
  99. package/dist/src/lib/settings.d.ts +14 -0
  100. package/dist/src/lib/settings.js +61 -8
  101. package/dist/src/lib/shutdown.d.ts +42 -2
  102. package/dist/src/lib/shutdown.js +75 -5
  103. package/dist/src/lib/skills-check.d.ts +26 -0
  104. package/dist/src/lib/skills-check.js +31 -0
  105. package/dist/src/lib/stacks.d.ts +110 -1
  106. package/dist/src/lib/stacks.js +244 -5
  107. package/dist/src/lib/templates.d.ts +74 -0
  108. package/dist/src/lib/templates.js +171 -16
  109. package/dist/src/lib/test-tautology-detector.d.ts +9 -2
  110. package/dist/src/lib/test-tautology-detector.js +153 -12
  111. package/dist/src/lib/version-check.d.ts +31 -0
  112. package/dist/src/lib/version-check.js +46 -7
  113. package/dist/src/lib/workflow/batch-executor.d.ts +138 -6
  114. package/dist/src/lib/workflow/batch-executor.js +550 -54
  115. package/dist/src/lib/workflow/chain-preflight.d.ts +89 -0
  116. package/dist/src/lib/workflow/chain-preflight.js +199 -0
  117. package/dist/src/lib/workflow/chain-resume.d.ts +118 -0
  118. package/dist/src/lib/workflow/chain-resume.js +170 -0
  119. package/dist/src/lib/workflow/completed-status.d.ts +52 -0
  120. package/dist/src/lib/workflow/completed-status.js +57 -0
  121. package/dist/src/lib/workflow/config-resolver.d.ts +26 -0
  122. package/dist/src/lib/workflow/config-resolver.js +54 -2
  123. package/dist/src/lib/workflow/dependency-markers.d.ts +29 -0
  124. package/dist/src/lib/workflow/dependency-markers.js +79 -0
  125. package/dist/src/lib/workflow/drivers/agent-driver.d.ts +7 -0
  126. package/dist/src/lib/workflow/drivers/aider.d.ts +2 -0
  127. package/dist/src/lib/workflow/drivers/aider.js +2 -0
  128. package/dist/src/lib/workflow/drivers/claude-code.d.ts +21 -0
  129. package/dist/src/lib/workflow/drivers/claude-code.js +50 -8
  130. package/dist/src/lib/workflow/error-classifier.d.ts +9 -2
  131. package/dist/src/lib/workflow/error-classifier.js +14 -1
  132. package/dist/src/lib/workflow/git-diff-utils.d.ts +35 -3
  133. package/dist/src/lib/workflow/git-diff-utils.js +77 -4
  134. package/dist/src/lib/workflow/heartbeat.d.ts +38 -0
  135. package/dist/src/lib/workflow/heartbeat.js +90 -0
  136. package/dist/src/lib/workflow/log-writer.d.ts +44 -1
  137. package/dist/src/lib/workflow/log-writer.js +81 -14
  138. package/dist/src/lib/workflow/metrics-schema.d.ts +42 -3
  139. package/dist/src/lib/workflow/metrics-schema.js +16 -0
  140. package/dist/src/lib/workflow/metrics-writer.d.ts +2 -1
  141. package/dist/src/lib/workflow/phase-executor.d.ts +234 -13
  142. package/dist/src/lib/workflow/phase-executor.js +533 -56
  143. package/dist/src/lib/workflow/phase-registry.js +2 -1
  144. package/dist/src/lib/workflow/platforms/github.d.ts +64 -0
  145. package/dist/src/lib/workflow/platforms/github.js +152 -0
  146. package/dist/src/lib/workflow/qa-cache.d.ts +6 -1
  147. package/dist/src/lib/workflow/qa-cache.js +22 -9
  148. package/dist/src/lib/workflow/ready-gate.d.ts +17 -4
  149. package/dist/src/lib/workflow/ready-gate.js +25 -9
  150. package/dist/src/lib/workflow/run-log-schema.d.ts +37 -0
  151. package/dist/src/lib/workflow/run-log-schema.js +92 -2
  152. package/dist/src/lib/workflow/run-orchestrator.d.ts +33 -0
  153. package/dist/src/lib/workflow/run-orchestrator.js +429 -47
  154. package/dist/src/lib/workflow/skills-preflight.d.ts +89 -0
  155. package/dist/src/lib/workflow/skills-preflight.js +112 -0
  156. package/dist/src/lib/workflow/state-cleanup.js +9 -2
  157. package/dist/src/lib/workflow/state-manager.d.ts +33 -0
  158. package/dist/src/lib/workflow/state-manager.js +83 -0
  159. package/dist/src/lib/workflow/state-schema.d.ts +26 -0
  160. package/dist/src/lib/workflow/state-schema.js +47 -0
  161. package/dist/src/lib/workflow/status-derivation.d.ts +30 -0
  162. package/dist/src/lib/workflow/status-derivation.js +27 -0
  163. package/dist/src/lib/workflow/types.d.ts +149 -4
  164. package/dist/src/lib/workflow/types.js +1 -0
  165. package/dist/src/lib/workflow/worktree-manager.d.ts +70 -2
  166. package/dist/src/lib/workflow/worktree-manager.js +201 -52
  167. package/dist/src/mcp/tools/run.d.ts +11 -1
  168. package/dist/src/mcp/tools/run.js +22 -1
  169. package/dist/src/mcp/tools/status.js +6 -0
  170. package/dist/src/ui/tui/ElapsedTimer.d.ts +12 -3
  171. package/dist/src/ui/tui/ElapsedTimer.js +12 -10
  172. package/dist/src/ui/tui/IssueBox.js +10 -2
  173. package/dist/src/ui/tui/row-cap.js +2 -1
  174. package/dist/src/ui/tui/theme.d.ts +7 -0
  175. package/dist/src/ui/tui/theme.js +9 -0
  176. package/package.json +9 -10
  177. package/templates/hooks/parallel-marker.sh +50 -0
  178. package/templates/hooks/post-tool.sh +38 -10
  179. package/templates/hooks/pre-tool.sh +405 -67
  180. package/templates/scripts/cleanup-worktree.sh +282 -30
  181. package/templates/scripts/new-feature.sh +264 -16
  182. package/templates/skills/_shared/references/trust-model.md +18 -0
  183. package/templates/skills/assess/SKILL.md +250 -344
  184. package/templates/skills/assess/references/predicted-collision-detection.md +10 -7
  185. package/templates/skills/docs/SKILL.md +4 -4
  186. package/templates/skills/exec/SKILL.md +26 -6
  187. package/templates/skills/fullsolve/SKILL.md +4 -2
  188. package/templates/skills/loop/SKILL.md +38 -2
  189. package/templates/skills/merger/SKILL.md +2 -2
  190. package/templates/skills/qa/SKILL.md +337 -57
  191. package/templates/skills/qa/references/anti-pattern-detection.md +6 -6
  192. package/templates/skills/qa/references/call-site-review.md +2 -2
  193. package/templates/skills/qa/references/code-review-checklist.md +2 -2
  194. package/templates/skills/qa/references/fixtures/injection-issue-body.md +36 -0
  195. package/templates/skills/qa/references/quality-gates.md +21 -7
  196. package/templates/skills/qa/references/testing-requirements.md +1 -1
  197. package/templates/skills/qa/scripts/quality-checks.sh +11 -11
  198. package/templates/skills/reflect/SKILL.md +27 -13
  199. package/templates/skills/reflect/references/documentation-tiers.md +80 -68
  200. package/templates/skills/reflect/references/phase-reflection.md +31 -15
  201. package/templates/skills/release/SKILL.md +11 -3
  202. package/templates/skills/setup/SKILL.md +5 -5
  203. package/templates/skills/spec/SKILL.md +2 -0
  204. package/templates/skills/spec/references/verification-criteria.md +1 -1
  205. package/templates/skills/test/SKILL.md +1 -1
  206. package/dist/src/lib/phase-spinner.d.ts +0 -146
  207. package/dist/src/lib/phase-spinner.js +0 -255
  208. package/dist/src/lib/workflow/pr-operations.d.ts +0 -86
  209. package/dist/src/lib/workflow/pr-operations.js +0 -326
  210. package/dist/src/lib/workflow/run-summary.d.ts +0 -36
  211. package/dist/src/lib/workflow/run-summary.js +0 -142
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "sequant",
3
- "version": "2.8.0",
3
+ "version": "2.10.0",
4
4
  "description": "AI coding agent orchestrator — resolve GitHub issues end-to-end with isolated git worktrees, quality gates, and an MCP server. Works with Claude Code or Aider.",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "sequant": "dist/bin/cli.js"
8
8
  },
9
- "main": "./dist/index.js",
10
- "types": "./dist/index.d.ts",
9
+ "main": "./dist/src/index.js",
10
+ "types": "./dist/src/index.d.ts",
11
11
  "exports": {
12
12
  ".": {
13
- "import": "./dist/index.js",
14
- "types": "./dist/index.d.ts"
13
+ "types": "./dist/src/index.d.ts",
14
+ "import": "./dist/src/index.js"
15
15
  }
16
16
  },
17
17
  "files": [
@@ -21,7 +21,7 @@
21
21
  ".claude-plugin"
22
22
  ],
23
23
  "scripts": {
24
- "build": "tsc",
24
+ "build": "rm -rf dist/src dist/bin dist/dashboard && tsc && chmod +x dist/bin/cli.js",
25
25
  "dev": "tsx bin/cli.ts",
26
26
  "test": "vitest run",
27
27
  "lint": "eslint src/ bin/ --max-warnings 0",
@@ -29,6 +29,7 @@
29
29
  "sync:hooks": "bash scripts/sync-hooks.sh",
30
30
  "validate:skills": "for skill in templates/skills/*/; do case \"$skill\" in *_shared*|*/references/*) continue;; esac; npx skills-ref validate \"$skill\"; done",
31
31
  "lint:skill-calls": "npx tsx scripts/lint-skill-calls.ts",
32
+ "lint:skill-gates": "npx tsx scripts/lint-skill-gates.ts",
32
33
  "lint:skill-sync": "npx tsx scripts/check-skill-sync.ts",
33
34
  "prepare:marketplace": "npx tsx scripts/prepare-marketplace.ts",
34
35
  "validate:marketplace": "npx tsx scripts/prepare-marketplace.ts --validate-only",
@@ -78,7 +79,7 @@
78
79
  },
79
80
  "homepage": "https://sequant.io",
80
81
  "engines": {
81
- "node": ">=22.12.0"
82
+ "node": ">=22.13.0"
82
83
  },
83
84
  "peerDependencies": {
84
85
  "@modelcontextprotocol/sdk": "^1.27.1"
@@ -97,7 +98,6 @@
97
98
  "cli-table3": "^0.6.5",
98
99
  "commander": "^14.0.3",
99
100
  "diff": "^9.0.0",
100
- "gradient-string": "^3.0.0",
101
101
  "hono": "^4.12.1",
102
102
  "ink": "^7.0.1",
103
103
  "inquirer": "^14.0.1",
@@ -112,9 +112,8 @@
112
112
  },
113
113
  "devDependencies": {
114
114
  "@eslint/js": "^10.0.1",
115
- "@types/gradient-string": "^1.1.6",
116
115
  "@types/inquirer": "^9.0.7",
117
- "@types/node": "^25.4.0",
116
+ "@types/node": "^26.0.1",
118
117
  "@types/react": "^19.2.14",
119
118
  "@typescript-eslint/eslint-plugin": "^8.58.0",
120
119
  "@typescript-eslint/parser": "^8.58.0",
@@ -0,0 +1,50 @@
1
+ #!/bin/bash
2
+ # Shared naming contract for /exec parallel-group marker files (#881).
3
+ #
4
+ # One writer (the /exec skill) and two readers (pre-tool.sh, post-tool.sh) must
5
+ # agree on (a) the marker filename and (b) how the owning project is identified.
6
+ # Before #881 the filename was a global constant, so a parallel group in ONE
7
+ # project silently redirected worktree enforcement for EVERY concurrent Claude
8
+ # session on the machine — the first matching marker in the shared temp dir won,
9
+ # regardless of which project wrote it. Keeping the scheme in this single sourced
10
+ # file is what stops the writer and the readers from drifting apart (AC-4).
11
+ #
12
+ # Marker filename: ${TMPDIR}/claude-parallel-<project-hash>-<group-id>.marker
13
+ # Marker contents: line 1 = worktree path, line 2 = owning project root.
14
+
15
+ # parallel_marker_project_root — the canonical identity of the current project,
16
+ # derived identically in skill-context and hook-context. CLAUDE_PROJECT_DIR is
17
+ # set by Claude Code for both the skill's shell and the hook's shell within the
18
+ # same session; the git-toplevel fallback resolves to the same worktree when it
19
+ # is unset. A mismatch here would silently re-introduce the cross-project
20
+ # collision this fix exists to close, so the two contexts MUST agree.
21
+ parallel_marker_project_root() {
22
+ if [[ -n "${CLAUDE_PROJECT_DIR:-}" ]]; then
23
+ printf '%s' "$CLAUDE_PROJECT_DIR"
24
+ else
25
+ git rev-parse --show-toplevel 2>/dev/null || printf '%s' "$PWD"
26
+ fi
27
+ }
28
+
29
+ # parallel_marker_hash — a stable per-project hash used in the marker filename so
30
+ # two projects running parallel groups at once cannot collide (AC-1). Reuses the
31
+ # md5-with-md5sum-fallback idiom already used for the per-file lock in
32
+ # pre-tool.sh. printf (no trailing newline) keeps writer and reader identical.
33
+ parallel_marker_hash() {
34
+ local root
35
+ root="$(parallel_marker_project_root)"
36
+ printf '%s' "$root" | md5 -q 2>/dev/null || printf '%s' "$root" | md5sum | cut -d' ' -f1
37
+ }
38
+
39
+ # parallel_marker_prefix — the ${TMPDIR}-anchored, project-scoped filename prefix
40
+ # that both the writer and the readers glob on (AC-2). Honors $TMPDIR (macOS's
41
+ # per-user temp) with a /tmp fallback, matching the hooks' own _TMPDIR.
42
+ parallel_marker_prefix() {
43
+ local tmp="${TMPDIR:-/tmp}"
44
+ printf '%s/claude-parallel-%s-' "$tmp" "$(parallel_marker_hash)"
45
+ }
46
+
47
+ # parallel_marker_path <group-id> — the full marker path for one group.
48
+ parallel_marker_path() {
49
+ printf '%s%s.marker' "$(parallel_marker_prefix)" "$1"
50
+ }
@@ -51,33 +51,61 @@ fi
51
51
 
52
52
  _TMPDIR="${TMPDIR:-/tmp}"
53
53
 
54
- # Use CLAUDE_PLUGIN_DATA for persistent logs (survives plugin updates)
55
- if [[ -n "${CLAUDE_PLUGIN_DATA}" ]]; then
54
+ # Log sink (#763 AC-5c: blocked-command history must survive to be a useful
55
+ # regression corpus, so $TMPDIR which macOS purges — is a last resort only).
56
+ #
57
+ # This block MUST stay identical to the one in pre-tool.sh. The two hooks
58
+ # write the *same* claude-timing.log (START there, END here) and the same
59
+ # claude-quality.log, so any divergence silently splits every START/END pair
60
+ # across two files.
61
+ #
62
+ # Every candidate is absolute and lives outside the repo. A repo-local or
63
+ # relative path is wrong three times over: it resolves against the hook's cwd
64
+ # (which Claude Code does not pin), it yields one sink per directory instead
65
+ # of the single corpus AC-5 asks for, and — worst — creating it inside a repo
66
+ # makes `git status --porcelain` non-empty, which silently defeats pre-tool.sh's
67
+ # no-changes guard that reads exactly that output.
68
+ if [[ -n "${CLAUDE_PLUGIN_DATA:-}" ]]; then
56
69
  _LOG_DIR="${CLAUDE_PLUGIN_DATA}/logs"
57
- mkdir -p "$_LOG_DIR"
70
+ elif [[ -n "${HOME:-}" ]]; then
71
+ _LOG_DIR="${HOME}/.sequant/logs"
58
72
  else
59
73
  _LOG_DIR="${_TMPDIR}"
60
74
  fi
75
+ mkdir -p "$_LOG_DIR" 2>/dev/null || _LOG_DIR="${_TMPDIR}"
61
76
 
62
77
  TIMING_LOG="${_LOG_DIR}/claude-timing.log"
63
78
  QUALITY_LOG="${_LOG_DIR}/claude-quality.log"
64
79
  TESTS_LOG="${_LOG_DIR}/claude-tests.log"
65
- PARALLEL_MARKER_PREFIX="${_TMPDIR}/claude-parallel-"
80
+
81
+ # Parallel-group marker naming (#881). Source the shared helper next to this
82
+ # hook so the project-scoped prefix stays identical to the writer and pre-tool.sh.
83
+ _MARKER_HELPER="$(dirname "${BASH_SOURCE[0]:-$0}")/parallel-marker.sh"
84
+ if [[ -f "$_MARKER_HELPER" ]]; then
85
+ # shellcheck source=parallel-marker.sh disable=SC1091
86
+ source "$_MARKER_HELPER"
87
+ PARALLEL_MARKER_PREFIX="$(parallel_marker_prefix)"
88
+ else
89
+ PARALLEL_MARKER_PREFIX="${_TMPDIR}/claude-parallel-"
90
+ fi
66
91
 
67
92
  # === AGENT ID DETECTION ===
68
- # For parallel agents, detect group ID from marker files
69
- # Format: ${_TMPDIR}/claude-parallel-<group-id>.marker
93
+ # For parallel agents, detect group ID from marker files. The glob is scoped to
94
+ # the current project's marker prefix (#881) so a foreign project's marker never
95
+ # labels this session's timing rows.
70
96
  AGENT_ID=""
71
97
  IS_PARALLEL_AGENT="false"
98
+ _MARKER_BASE=$(basename "$PARALLEL_MARKER_PREFIX")
72
99
  # Find marker files using find (works in both bash and zsh)
73
100
  while IFS= read -r marker; do
74
101
  if [[ -n "$marker" && -f "$marker" ]]; then
75
- # Extract group ID from marker filename
76
- AGENT_ID=$(basename "$marker" | sed 's/claude-parallel-//' | sed 's/\.marker//')
102
+ # Extract group ID: strip the project-scoped prefix and the suffix.
103
+ AGENT_ID=$(basename "$marker" .marker)
104
+ AGENT_ID=${AGENT_ID#"$_MARKER_BASE"}
77
105
  IS_PARALLEL_AGENT="true"
78
106
  break
79
107
  fi
80
- done < <(find "${_TMPDIR}" -maxdepth 1 -name "claude-parallel-*.marker" 2>/dev/null)
108
+ done < <(find "${_TMPDIR}" -maxdepth 1 -name "${_MARKER_BASE}*.marker" 2>/dev/null)
81
109
 
82
110
  # === TIMING END ===
83
111
  # Include agent ID in log format if available (AC-4)
@@ -238,7 +266,7 @@ if [[ "${CLAUDE_HOOKS_COVERAGE:-}" == "true" ]]; then
238
266
  COVERAGE_LOG="${_LOG_DIR}/claude-coverage.log"
239
267
 
240
268
  # Get changed source files (excluding tests)
241
- changed_files=$(git diff main...HEAD --name-only 2>/dev/null | grep -E '\.(ts|tsx|js|jsx)$' | grep -v -E '\.test\.|\.spec\.|__tests__' || true)
269
+ changed_files=$(git diff origin/main...HEAD --name-only 2>/dev/null | grep -E '\.(ts|tsx|js|jsx)$' | grep -v -E '\.test\.|\.spec\.|__tests__' || true)
242
270
 
243
271
  if [[ -n "$changed_files" ]]; then
244
272
  echo "$(date +%H:%M:%S) COVERAGE_ANALYSIS: Checking test coverage for changed files" >> "$QUALITY_LOG"