xtrm-tools 0.7.10 → 0.7.12

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.
@@ -0,0 +1,256 @@
1
+ ---
2
+ name: update-specialists
3
+ description: >
4
+ Reconcile a project with current canonical specialists install state.
5
+ Use this skill when a user says "update specialists", "specialists is broken",
6
+ "sp is out of date", "hooks not firing", "skills not loading after update",
7
+ or when drift is detected in installed specialists config, hooks, jobs, DB,
8
+ extensions, or worktree cleanup.
9
+ version: 1.0
10
+ synced_at: 00000000
11
+ ---
12
+
13
+ # update-specialists
14
+
15
+ Bring specialists install back to canonical state. Detect drift, apply targeted
16
+ fixes, then verify with `sp doctor`.
17
+
18
+ ## Canonical State
19
+
20
+ Check each item explicitly. This is what a healthy specialists-initialized project
21
+ looks like.
22
+
23
+ ### Specialists configs
24
+
25
+ | Check | Expected value |
26
+ |-------|----------------|
27
+ | `.specialists/default/*.specialist.json` | JSON-first specialist configs present |
28
+ | `metadata.name` | Matches filename stem |
29
+ | `metadata.version` | Valid semver string |
30
+ | `metadata.description` | Present |
31
+ | `metadata.category` | Present |
32
+ | `execution.model` | Present and pingable |
33
+ | `execution.fallback_model` | Present, different provider from primary |
34
+ | `execution.permission_required` | Valid enum |
35
+ | `execution.extensions.serena` | Present when skill needs opt-out or default true |
36
+ | `execution.extensions.gitnexus` | Present when skill needs opt-out or default true |
37
+ | `execution.interactive` | Matches intended keep-alive behavior |
38
+
39
+ ### Hooks wiring
40
+
41
+ | Check | Expected value |
42
+ |-------|----------------|
43
+ | `.claude/settings.json` | Has hook entries for active events |
44
+ | Hook events | At minimum: `SessionStart`, `PreToolUse`, `PostToolUse`, `Stop` |
45
+ | Hook paths | Point at specialists runtime hook scripts, not stale xtrm-only paths |
46
+ | Hook format | Matches project's installed settings format and loads cleanly |
47
+
48
+ ### CLI reachability
49
+
50
+ | Check | Expected value |
51
+ |-------|----------------|
52
+ | `sp` command | On PATH and runs |
53
+ | `specialists` command | On PATH and runs |
54
+ | Version compatibility | `sp doctor` reports matching runtime / install state |
55
+ | Command surface | `sp doctor`, `sp init`, `sp clean`, `sp status` available |
56
+
57
+ ### Jobs and runtime dirs
58
+
59
+ | Check | Expected value |
60
+ |-------|----------------|
61
+ | `.specialists/jobs/` | Exists |
62
+ | `.specialists/ready/` | Exists if used by runtime |
63
+ | `.specialists/default/` | Canonical install copy present |
64
+ | Orphaned worktrees | None under `.worktrees/` |
65
+ | Worktree ownership | No stale entries for deleted jobs |
66
+
67
+ ### SQLite / observability
68
+
69
+ | Check | Expected value |
70
+ |-------|----------------|
71
+ | specialists DB | Opens cleanly |
72
+ | Schema version | Matches runtime expectation |
73
+ | WAL / busy timeout settings | Present when runtime uses SQLite |
74
+ | Corruption / lock errors | None in `sp doctor` |
75
+
76
+ ### Pi extensions
77
+
78
+ | Check | Expected value |
79
+ |-------|----------------|
80
+ | `quality-gates` | Registered if project uses quality gates |
81
+ | `pi-gitnexus` | Registered when GitNexus integration is expected |
82
+ | `pi-serena-tools` | Registered when Serena integration is expected |
83
+ | Extension paths | Resolve from installed project, not stale workspace copies |
84
+
85
+ ## Detection
86
+
87
+ Run these in order. Report which checks pass and which drift.
88
+
89
+ ```bash
90
+ # 1. Primary health check
91
+ sp doctor
92
+
93
+ # 2. Runtime status
94
+ sp status
95
+
96
+ # 3. Config shape
97
+ find .specialists/default -maxdepth 1 -name '*.specialist.json' -print
98
+
99
+ # 4. Validate specialist JSON files
100
+ node -e "const fs=require('fs'); const path=require('path'); const dir='.specialists/default'; for (const file of fs.readdirSync(dir)) { if (!file.endsWith('.specialist.json')) continue; const data=JSON.parse(fs.readFileSync(path.join(dir,file),'utf8')); const s=data.specialist||data; const m=s.metadata||{}; const e=s.execution||{}; const missing=[]; for (const key of ['name','version','description','category']) if (!m[key]) missing.push('metadata.'+key); for (const key of ['model','fallback_model','permission_required']) if (!e[key]) missing.push('execution.'+key); if (missing.length) console.log(file+': MISSING '+missing.join(', ')); if (m.name && m.name !== file.replace(/\.specialist\.json$/, '')) console.log(file+': NAME MISMATCH '+m.name); }"
101
+
102
+ # 5. Hooks wiring
103
+ node -e "const fs=require('fs'); const p='.claude/settings.json'; if (fs.existsSync(p)) { const s=JSON.parse(fs.readFileSync(p,'utf8')); console.log(JSON.stringify(s.hooks ?? s, null, 2)); } else { console.log('MISSING .claude/settings.json'); }"
104
+
105
+ # 6. Command availability
106
+ command -v sp
107
+ command -v specialists
108
+ sp doctor --json 2>/dev/null || true
109
+
110
+ # 7. Jobs and worktrees
111
+ ls -1 .specialists/jobs 2>/dev/null || true
112
+ find .worktrees -maxdepth 2 -mindepth 1 -type d 2>/dev/null || true
113
+
114
+ # 8. Extension registration
115
+ node -e "const fs=require('fs'); const p='.pi/settings.json'; if (fs.existsSync(p)) console.log(JSON.stringify(JSON.parse(fs.readFileSync(p,'utf8')).skills ?? JSON.parse(fs.readFileSync(p,'utf8')).extensions ?? {}, null, 2)); else console.log('MISSING .pi/settings.json')"
116
+ ```
117
+
118
+ ## Drift -> Fix Mapping
119
+
120
+ Use targeted fixes first. Escalate to full sync only if needed.
121
+
122
+ | Drift | Fix |
123
+ |-------|-----|
124
+ | Specialist JSON missing required fields | `sp edit <name> ...` or regenerate via `sp init --sync-skills` |
125
+ | Specialist JSON schema mismatch | `sp init --sync-skills` |
126
+ | Hooks missing or stale | `sp init --sync-hooks` if available, otherwise `sp init --sync-skills` or `sp init -y` |
127
+ | `sp` / `specialists` missing from PATH | Reinstall / re-bootstrap specialists runtime |
128
+ | Job dir missing | `sp init -y` |
129
+ | Orphaned `.worktrees/` entries | `specialists clean` |
130
+ | SQLite schema/version mismatch | `sp doctor` first, then `sp init --sync-skills` or runtime migration command |
131
+ | Pi extensions missing | `sp init --sync-skills` or reinstall extension registration |
132
+ | Hook config format stale | `sp init -y` |
133
+ | Unknown manual drift | Stop, inspect, then apply user-approved fix |
134
+
135
+ ## Remediation
136
+
137
+ ### Fix: Specialist configs drifted
138
+
139
+ If `sp doctor` or JSON validation shows missing fields, wrong names, or schema
140
+ mismatch:
141
+
142
+ ```bash
143
+ sp init --sync-skills
144
+ ```
145
+
146
+ If one specialist needs a small repair and `sp edit` supports it, prefer that over
147
+ full sync.
148
+
149
+ ### Fix: Hooks not firing
150
+
151
+ If hooks are missing, wrong events, or stale script paths:
152
+
153
+ ```bash
154
+ sp init -y
155
+ ```
156
+
157
+ If runtime exposes a narrower hook sync command, prefer it. Use full init only
158
+ when hook-only sync is not enough.
159
+
160
+ ### Fix: CLI not reachable
161
+
162
+ If `sp` or `specialists` is missing or incompatible:
163
+
164
+ ```bash
165
+ sp doctor
166
+ ```
167
+
168
+ If doctor confirms install drift, reinstall or re-bootstrap specialists runtime.
169
+ Do not guess at file edits when command surface itself is broken.
170
+
171
+ ### Fix: Job dirs or worktree GC drift
172
+
173
+ If jobs exist without owners, worktrees are orphaned, or cleanup state is stale:
174
+
175
+ ```bash
176
+ specialists clean
177
+ ```
178
+
179
+ Then re-run `sp doctor`.
180
+
181
+ ### Fix: SQLite schema drift
182
+
183
+ If doctor reports DB version mismatch or recovery issue:
184
+
185
+ 1. Run `sp doctor` and capture exact schema error.
186
+ 2. Apply runtime migration command if available.
187
+ 3. If no automated migration exists, flag manual intervention.
188
+
189
+ ### Fix: Pi extensions not registered
190
+
191
+ If `quality-gates`, `pi-gitnexus`, or `pi-serena-tools` are missing:
192
+
193
+ ```bash
194
+ sp init --sync-skills
195
+ ```
196
+
197
+ If project uses different extension packaging, re-run install step that writes
198
+ `.pi/settings.json`.
199
+
200
+ ## Verification
201
+
202
+ After fixes, confirm canonical state restored.
203
+
204
+ ```bash
205
+ sp doctor
206
+ sp status
207
+
208
+ command -v sp
209
+ command -v specialists
210
+
211
+ node -e "const fs=require('fs'); const p='.claude/settings.json'; const s=JSON.parse(fs.readFileSync(p,'utf8')); console.log(Boolean(s.hooks || Object.keys(s).length))"
212
+ ```
213
+
214
+ Expected outcome:
215
+ - `sp doctor` clean
216
+ - `sp status` no drift / no repair hints
217
+ - `sp` and `specialists` reachable
218
+ - specialist JSON files valid
219
+ - hooks present on required events
220
+ - no orphaned worktrees
221
+ - SQLite state healthy
222
+
223
+ ## Manual Intervention
224
+
225
+ Flag these when automatic fix is unsafe or impossible:
226
+
227
+ - `sp doctor` reports corrupt DB / unreadable SQLite file
228
+ - command surface missing because install itself is broken
229
+ - hook scripts absent from repo and cannot be regenerated
230
+ - schema mismatch with no available migration path
231
+ - worktree cleanup would remove user changes
232
+ - extensions required by project are not installed at package level
233
+
234
+ When manual intervention needed, report:
235
+ 1. exact drift
236
+ 2. exact command tried
237
+ 3. why auto-fix stopped
238
+ 4. next safe operator action
239
+
240
+ ## User Summary Format
241
+
242
+ After detection + remediation, answer with compact status:
243
+
244
+ ```text
245
+ ## specialists update complete
246
+
247
+ ✓ sp doctor clean
248
+ ✓ specialist configs valid
249
+ ✓ hooks wired
250
+ ✓ CLI reachable
251
+ ✓ jobs/worktrees clean
252
+ ✓ SQLite healthy
253
+ ✓ extensions registered
254
+
255
+ [manual items, if any]
256
+ ```
@@ -0,0 +1,185 @@
1
+ ---
2
+ name: update-xt
3
+ description: >
4
+ Update an xtrm-initialized project to match the current canonical install state.
5
+ Use this skill whenever the user asks to update, upgrade, repair, or re-sync xtrm
6
+ in a project — or when they say something like "xt is out of date", "skills aren't
7
+ loading", "hooks aren't firing", "the install looks wrong", or "I just pulled new
8
+ xtrm changes". Also triggers when the agent detects stale paths like
9
+ .claude/skills → active/claude (old structure) or .pi/settings.json pointing to
10
+ active/pi (old structure). Proactively suggest running this skill after any
11
+ xtrm-tools upgrade.
12
+ ---
13
+
14
+ # update-xt
15
+
16
+ Reconcile a project's xtrm installation against the current canonical state. Detect
17
+ drift, apply targeted fixes, verify everything is wired correctly.
18
+
19
+ ## Canonical State (current)
20
+
21
+ This is what a correctly installed project looks like. Check each item.
22
+
23
+ ### Skills wiring
24
+
25
+ | Check | Expected value |
26
+ |-------|----------------|
27
+ | `.claude/skills` symlink target | `../.xtrm/skills/active` |
28
+ | `.xtrm/skills/active/` | Flat directory of symlinks to `../default/<skill>` |
29
+ | `active/pi/` subdirectory | Must NOT exist (stale — old runtime split) |
30
+ | `active/claude/` subdirectory | Must NOT exist (stale — old runtime split) |
31
+ | `.pi/settings.json` `.skills` array | Must include `"../.xtrm/skills/active"` |
32
+ | `.pi/settings.json` `.skills` array | Must NOT include `"../.xtrm/skills/active/pi"` (old path) |
33
+
34
+ ### Hooks wiring
35
+
36
+ | Check | Expected value |
37
+ |-------|----------------|
38
+ | `.claude/settings.json` or `~/.claude/settings.json` | Has `hooks` block with commands containing `/.xtrm/hooks/` paths |
39
+ | Hooks events covered | At minimum: `SessionStart`, `PreToolUse`, `PostToolUse`, `Stop` |
40
+
41
+ ### Project bootstrap
42
+
43
+ | Check | Expected value |
44
+ |-------|----------------|
45
+ | `.beads/` exists | Yes |
46
+ | `CLAUDE.md` or `AGENTS.md` exists | Yes |
47
+
48
+ ## Detection
49
+
50
+ Run these in order. Report what passes and what drifts.
51
+
52
+ ```bash
53
+ # 1. High-level status — shows pending syncs
54
+ xt status
55
+
56
+ # 2. Claude hook wiring
57
+ xt claude status
58
+
59
+ # 3. Skills symlink
60
+ readlink .claude/skills
61
+ # Expected: ../.xtrm/skills/active
62
+ # Stale: ../.xtrm/skills/active/claude
63
+
64
+ # 4. Stale runtime subdirs (should return nothing)
65
+ ls .xtrm/skills/active/pi 2>/dev/null && echo "STALE: active/pi exists"
66
+ ls .xtrm/skills/active/claude 2>/dev/null && echo "STALE: active/claude exists"
67
+
68
+ # 5. Pi settings skills entry
69
+ node -e "const s=require('./.pi/settings.json'); console.log(s.skills)" 2>/dev/null
70
+ # Expected to include: ../.xtrm/skills/active
71
+ # Stale if includes: ../.xtrm/skills/active/pi
72
+
73
+ # 6. Active view integrity (all entries must be valid symlinks)
74
+ for f in .xtrm/skills/active/*; do [ -L "$f" ] || echo "NOT A SYMLINK: $f"; done
75
+ ```
76
+
77
+ ## Remediation
78
+
79
+ Two commands cover almost all drift. Know which fixes what:
80
+
81
+ | Command | Fixes |
82
+ |---------|-------|
83
+ | `xt claude install` | Hooks wiring only (settings.json hooks block) |
84
+ | `xt init -y` | Skills symlink, active/ view rebuild, Pi settings, all phases |
85
+
86
+ ### Fix: Skills symlink stale or active/ view wrong
87
+
88
+ `xt claude install` does NOT rebuild skills. Only `xt init` does (Phase 6b).
89
+
90
+ ```bash
91
+ xt init -y
92
+ ```
93
+
94
+ ### Fix: Stale active/pi or active/claude subdirs
95
+
96
+ `xt init` rebuilds `active/` atomically — it does NOT remove old subdirs left over
97
+ from a previous layout. After `xt init -y` confirms the flat view is working, remove
98
+ the stale dirs manually:
99
+
100
+ ```bash
101
+ rm -rf .xtrm/skills/active/pi
102
+ rm -rf .xtrm/skills/active/claude
103
+ ```
104
+
105
+ Verify flat active/ is intact:
106
+ ```bash
107
+ ls .xtrm/skills/active/
108
+ # Should show skill dirs directly (clean-code, deepwiki, ...) — NOT pi/ or claude/ subdirs
109
+ ```
110
+
111
+ ### Fix: Hooks not wired
112
+
113
+ ```bash
114
+ xt claude install
115
+ ```
116
+
117
+ Rewires from `.xtrm/config/hooks.json` into `.claude/settings.json`.
118
+
119
+ ### Fix: Pi settings stale path
120
+
121
+ Covered by `xt init -y`. If you need to target it alone:
122
+ ```bash
123
+ xt pi install
124
+ ```
125
+
126
+ ### Fix: beads not initialized
127
+
128
+ ```bash
129
+ bd init
130
+ ```
131
+
132
+ ## If updating xtrm-tools itself (not a consumer project)
133
+
134
+ After merging changes to `cli/src/`, the dist must be rebuilt before `xt` picks up
135
+ the new logic. Skipping this causes verification to report stale errors even after
136
+ `xt init` runs.
137
+
138
+ ```bash
139
+ cd cli && npm run build
140
+ xt init -y # now runs with updated code
141
+ ```
142
+
143
+ ## Verification
144
+
145
+ After all fixes, confirm canonical state is restored:
146
+
147
+ ```bash
148
+ xt claude status
149
+ # Should show: ✓ Claude hooks wired
150
+ # Should show: ✓ claude CLI available
151
+
152
+ xt status
153
+ # Should show no pending changes (or only optional ones)
154
+
155
+ readlink .claude/skills
156
+ # Must output: ../.xtrm/skills/active
157
+
158
+ node -e "const s=require('./.pi/settings.json'); console.log(s.skills.includes('../.xtrm/skills/active'))" 2>/dev/null
159
+ # Must output: true
160
+ ```
161
+
162
+ If `xt status` still shows drift after targeted fixes, run the full sync:
163
+ ```bash
164
+ xt init
165
+ ```
166
+
167
+ ## Reporting to the user
168
+
169
+ After completing detection + remediation + verification, give the user a concise
170
+ summary:
171
+
172
+ ```
173
+ ## xtrm update complete
174
+
175
+ ✓ .claude/skills → ../.xtrm/skills/active
176
+ ✓ active/ view: N skills (flat, all valid symlinks)
177
+ ✓ active/pi and active/claude stale dirs: removed
178
+ ✓ Hooks wired (X events, Y commands)
179
+ ✓ .pi/settings.json skills entry: current
180
+
181
+ [Any items that could not be auto-fixed, with manual instructions]
182
+ ```
183
+
184
+ If anything could not be fixed automatically (e.g. missing `.pi/settings.json`,
185
+ no beads config), explain the manual step clearly — don't just report failure.