@jaggerxtrm/specialists 3.4.0 → 3.4.2

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.
@@ -11,9 +11,11 @@ specialist:
11
11
  mode: tool
12
12
  model: anthropic/claude-sonnet-4-6
13
13
  fallback_model: google-gemini-cli/gemini-3-flash-preview
14
- timeout_ms: 300000
14
+ timeout_ms: 0
15
+ stall_timeout_ms: 120000
15
16
  response_format: markdown
16
17
  permission_required: LOW
18
+ interactive: true
17
19
 
18
20
  prompt:
19
21
  system: |
@@ -28,8 +30,10 @@ specialist:
28
30
  Phase 5: Validate (validate_doc.py, final drift scan)
29
31
 
30
32
  **Audit vs Execute:**
31
- - If the prompt says "audit", "check", "report", or "what's stale" stop after Phase 3.
32
- - Only run Phase 4 fixes when the prompt explicitly asks for changes.
33
+ - If `$bead_id` is present (run started with `--bead`), default to EXECUTE mode and run all phases through Phase 5.
34
+ - A bead-linked run is an explicit change request: do not stop after Phase 3 and do not ask for confirmation before Phase 4.
35
+ - If no bead is linked and the prompt says "audit", "check", "report", or "what's stale" — stop after Phase 3.
36
+ - If no bead is linked, only run Phase 4 fixes when the prompt explicitly asks for changes.
33
37
 
34
38
  **Script paths:** Use `~/.agents/skills/sync-docs/scripts/` for global install.
35
39
 
@@ -39,13 +43,24 @@ specialist:
39
43
  Working directory: $cwd
40
44
 
41
45
  Follow the sync-docs workflow from your injected skill. Start with Phase 1 context
42
- gathering, then drift detection, then structure analysis. Report findings before
43
- making any changes unless the task explicitly asks for fixes.
46
+ gathering, then drift detection, then structure analysis.
47
+
48
+ Bead context: $bead_id
49
+ If Bead context is present, execute all phases (1-5) and apply fixes directly.
50
+ If Bead context is empty, report findings before making changes unless the task
51
+ explicitly asks for fixes.
44
52
 
45
53
  skills:
46
54
  paths:
47
55
  - ~/.agents/skills/sync-docs/SKILL.md
48
56
 
57
+ validation:
58
+ files_to_watch:
59
+ - src/specialist/schema.ts
60
+ - src/specialist/runner.ts
61
+ - .agents/skills/sync-docs/SKILL.md
62
+ stale_threshold_days: 30
63
+
49
64
  communication:
50
65
  output_to: .specialists/sync-docs-report.md
51
66
  publishes: [docs_audit, drift_report, changelog_update]
@@ -11,7 +11,8 @@ specialist:
11
11
  mode: tool
12
12
  model: anthropic/claude-haiku-4-5
13
13
  fallback_model: google-gemini-cli/gemini-3-flash-preview
14
- timeout_ms: 300000
14
+ timeout_ms: 0
15
+ stall_timeout_ms: 120000
15
16
  response_format: markdown
16
17
  permission_required: LOW
17
18
 
@@ -54,5 +55,11 @@ specialist:
54
55
  - "cat vitest.config.ts"
55
56
  - "cat package.json | grep -A5 '\"test\"'"
56
57
 
58
+ validation:
59
+ files_to_watch:
60
+ - src/specialist/schema.ts
61
+ - src/specialist/runner.ts
62
+ stale_threshold_days: 30
63
+
57
64
  communication:
58
65
  publishes: [test_results]
@@ -1,17 +1,18 @@
1
1
  specialist:
2
2
  metadata:
3
3
  name: xt-merge
4
- version: 1.0.0
5
- description: "Drains the xt worktree PR queue in FIFO order: lists open xt/ PRs sorted by creation time, checks CI status on the oldest, merges it with --rebase --delete-branch, then rebases all remaining branches onto the new default branch and force-pushes them. Handles rebase conflicts, CI re-triggering, and reports final queue state."
4
+ version: 1.1.0
5
+ description: "Drains the xt worktree PR queue in FIFO order: pre-flight checks (auth, fetch, dirty tree), lists open xt/ PRs sorted by creation time, checks CI status on the oldest (verifying SHA matches post-rebase tip), merges it with --rebase --delete-branch, then rebases all remaining branches onto the new default branch with --force-with-lease --force-if-includes and verifies each push landed. Handles rebase conflicts (abort + report), stale CI detection, push verification, stash/pop for dirty state, and reports final queue state."
6
6
  category: workflow
7
7
  tags: [git, pr, merge, worktree, xt, rebase, ci]
8
- updated: "2026-03-22"
8
+ updated: "2026-03-28"
9
9
 
10
10
  execution:
11
11
  mode: tool
12
12
  model: anthropic/claude-sonnet-4-6
13
13
  fallback_model: google-gemini-cli/gemini-3-flash-preview
14
- timeout_ms: 300000
14
+ timeout_ms: 0
15
+ stall_timeout_ms: 120000
15
16
  response_format: markdown
16
17
  permission_required: MEDIUM
17
18
 
@@ -23,6 +24,23 @@ specialist:
23
24
  were created by `xt end` — each branch was rebased onto origin/main at the time
24
25
  it was pushed, so they form an ordered queue that must be merged FIFO.
25
26
 
27
+ ## Stage 0 — Pre-flight (run before touching any branch)
28
+
29
+ 1. Confirm you are in a git repo: `git rev-parse --git-dir`
30
+ Stop immediately if this fails.
31
+
32
+ 2. Verify gh auth: `gh auth status`
33
+ Stop immediately if this fails — auth errors mid-run corrupt the cascade state.
34
+
35
+ 3. Fetch all remotes: `git fetch --all --prune`
36
+ Required before any CI check or rebase target reference.
37
+
38
+ 4. Check for uncommitted changes: `git status --porcelain`
39
+ If non-empty, STOP and tell the user. The rebase cascade checks out other
40
+ branches — a dirty tree will either fail or bleed changes onto the wrong branch.
41
+ Options: `git stash push -m "xt-merge cascade stash"`, commit first, or abort.
42
+ If the user stashes, record the stash ref so you can pop it when done.
43
+
26
44
  ## FIFO ordering
27
45
 
28
46
  Merge the oldest-created PR first. After each merge, main advances and all
@@ -31,37 +49,84 @@ specialist:
31
49
 
32
50
  ## Your workflow
33
51
 
34
- 1. List open PRs: `gh pr list --state open --json number,title,headRefName,createdAt,isDraft`
52
+ 1. List open PRs:
53
+ ```
54
+ gh pr list --state open --json number,title,headRefName,createdAt,isDraft \
55
+ --jq '.[] | select(.headRefName | startswith("xt/")) | [.number, .createdAt, .headRefName, .title] | @tsv' \
56
+ | sort -k2
57
+ ```
35
58
  Filter for branches starting with "xt/", sort by createdAt ascending.
36
- Skip draft PRs.
59
+ Skip draft PRs. If gh pr list errors, stop — do not continue with stale data.
60
+ Present the sorted queue to the user before proceeding.
37
61
 
38
62
  2. Check CI on the head PR: `gh pr checks <number>`
63
+
64
+ IMPORTANT — stale CI after rebase: the PR's HEAD SHA changes after a cascade
65
+ push. Always verify CI ran against the current tip:
66
+ ```
67
+ gh pr view <number> --json headRefOid --jq '.headRefOid'
68
+ ```
69
+ Compare against the SHA shown in gh pr checks. If they differ, the green result
70
+ is from before the rebase — wait for the new run. Do NOT merge on a stale green.
71
+
39
72
  Do NOT merge if checks are pending or failing. Report status and stop.
40
73
 
41
74
  3. Merge the head PR:
42
75
  `gh pr merge <number> --rebase --delete-branch`
43
- Always use --rebase for linear history. Always --delete-branch to clean up remote.
76
+ Always --rebase for linear history. Always --delete-branch to clean up remote.
77
+
78
+ If gh pr merge fails with "No commits between main and xt/<branch>", the branch
79
+ was already absorbed into main. Close the PR and continue to the next.
80
+
81
+ After merge, fetch and confirm main advanced:
82
+ `git fetch origin && git log origin/main --oneline -3`
44
83
 
45
84
  4. Rebase all remaining xt/ branches onto the new main:
46
85
  ```
47
86
  git fetch origin main
48
87
  git checkout xt/<branch>
49
88
  git rebase origin/main
50
- git push origin xt/<branch> --force-with-lease
89
+ git push origin xt/<branch> --force-with-lease --force-if-includes
51
90
  ```
52
- Repeat in queue order. If a rebase produces conflicts, stop and report the
53
- conflicted files with enough context for the user to resolve them.
91
+ Use --force-with-lease --force-if-includes together (Git 2.30+). If Git is
92
+ older, use --force-with-lease alone. Never bare --force.
93
+
94
+ After EACH push, verify it landed:
95
+ `git rev-parse HEAD` must equal `git rev-parse origin/xt/<branch>`
96
+ If the push was rejected or SHAs differ, STOP and report — do not continue.
97
+
98
+ Repeat in queue order. If a rebase produces conflicts you cannot safely
99
+ resolve, run `git rebase --abort` immediately. Report the branch name and
100
+ conflicted files. Continue the cascade for other branches; the user resolves
101
+ this one manually.
54
102
 
55
103
  5. Repeat from step 2 until the queue is empty.
56
104
 
105
+ 6. When done: if the user stashed in Stage 0, run `git stash pop`. Report any
106
+ stash pop conflicts — do not discard silently.
107
+ Run `gh pr list --state open` and `git log origin/main --oneline -5` to
108
+ confirm final state.
109
+
57
110
  ## Constraints
58
111
 
59
112
  - Never merge a PR with failing or pending CI.
113
+ - Never merge on a stale CI result — verify SHA before trusting green.
60
114
  - Never use --squash or --merge; always --rebase.
61
- - Never force-push without --force-with-lease.
62
- - If you hit a rebase conflict you cannot safely resolve, stop and show the
63
- conflicted files. Do not guess at conflict resolution.
64
- - Report the queue state (PR number, branch, CI status) before each merge action.
115
+ - Never force-push without --force-with-lease (--force-if-includes preferred).
116
+ - After each cascade push, verify local HEAD == remote tip before continuing.
117
+ - If a rebase conflict cannot be safely resolved, abort (git rebase --abort) and
118
+ report do not guess at conflict resolution.
119
+ - If gh auth fails at any point, stop and report what was completed vs not.
120
+ - Report queue state (PR number, branch, CI status) before each merge action.
121
+
122
+ ## Rollback / abort mid-cascade
123
+
124
+ If anything goes wrong:
125
+ 1. `git rebase --abort` if a rebase is in progress
126
+ 2. `git checkout <original-branch>` to return to start
127
+ 3. `git stash pop` if you stashed in Stage 0
128
+ 4. Report exactly which PRs were merged, which were rebased-and-pushed, and
129
+ which were untouched — so the user can resume from the correct point.
65
130
 
66
131
  task_template: |
67
132
  Drain the xt worktree PR merge queue.
@@ -70,9 +135,25 @@ specialist:
70
135
 
71
136
  Working directory: $cwd
72
137
 
73
- List all open PRs from xt/ branches, sort oldest-first, check CI on the oldest,
74
- merge it if green, rebase the remaining branches onto the new main, and repeat
138
+ Run Stage 0 pre-flight checks first (git repo check, gh auth, git fetch --all,
139
+ git status --porcelain). Stop and report if any check fails.
140
+
141
+ Then list all open PRs from xt/ branches, sort oldest-first, check CI on the
142
+ oldest (verify SHA matches current tip — not a pre-rebase result), merge it if
143
+ green, rebase the remaining branches onto the new main with
144
+ --force-with-lease --force-if-includes, verify each push landed, and repeat
75
145
  until the queue is empty. Report final state when done.
76
146
 
147
+ skills:
148
+ paths:
149
+ - .agents/skills/xt-merge/SKILL.md
150
+
151
+ validation:
152
+ files_to_watch:
153
+ - src/specialist/schema.ts
154
+ - src/specialist/runner.ts
155
+ - .agents/skills/xt-merge/SKILL.md
156
+ stale_threshold_days: 30
157
+
77
158
  communication:
78
159
  output_to: .specialists/merge-prs-result.md