xtrm-tools 0.7.12 → 0.7.14
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.
- package/.xtrm/config/hooks.json +10 -0
- package/.xtrm/hooks/specialists/specialists-memory-cache-sync.mjs +57 -0
- package/.xtrm/hooks/specialists-agent-guard.mjs +76 -0
- package/.xtrm/registry.json +509 -393
- package/.xtrm/skills/default/premortem/SKILL.md +218 -0
- package/.xtrm/skills/default/releasing/SKILL.md +94 -0
- package/.xtrm/skills/default/releasing/scripts/xt-reports.ts +18 -0
- package/.xtrm/skills/default/session-close-report/SKILL.md +85 -17
- package/.xtrm/skills/default/specialists-creator/SKILL.md +117 -42
- package/.xtrm/skills/default/specialists-creator/scripts/audit-spec-uniformity.mjs +86 -0
- package/.xtrm/skills/default/specialists-creator/scripts/scaffold-specialist.ts +223 -0
- package/.xtrm/skills/default/specialists-creator/scripts/validate-specialist.ts +1 -1
- package/.xtrm/skills/default/sync-docs/SKILL.md +88 -208
- package/.xtrm/skills/default/sync-docs/scripts/pre-context.sh +17 -0
- package/.xtrm/skills/default/update-specialists/SKILL.md +99 -201
- package/.xtrm/skills/default/update-xt/SKILL.md +34 -0
- package/.xtrm/skills/default/using-kpi/SKILL.md +150 -0
- package/.xtrm/skills/default/using-nodes/SKILL.md +18 -102
- package/.xtrm/skills/default/using-script-specialists/SKILL.md +208 -0
- package/.xtrm/skills/default/using-specialists/SKILL.md +13 -0
- package/.xtrm/skills/default/using-specialists-v2/SKILL.md +773 -0
- package/.xtrm/skills/default/using-specialists-v3/SKILL.md +284 -0
- package/.xtrm/skills/default/using-specialists-v3/evals/evals.json +89 -0
- package/CHANGELOG.md +17 -0
- package/README.md +5 -1
- package/cli/dist/index.cjs +3401 -627
- package/cli/dist/index.cjs.map +1 -1
- package/cli/package.json +1 -1
- package/package.json +3 -2
- package/packages/pi-extensions/.serena/project.yml +130 -0
- package/packages/pi-extensions/extensions/pi-serena-compact/index.ts +4 -12
- package/packages/pi-extensions/extensions/xtrm-loader/index.ts +0 -1
- package/packages/pi-extensions/extensions/xtrm-ui/index.ts +201 -36
- package/packages/pi-extensions/extensions/xtrm-ui/themes/pidex-dark-flattools.json +79 -0
- package/packages/pi-extensions/extensions/xtrm-ui/themes/pidex-dark.json +85 -0
- package/packages/pi-extensions/extensions/xtrm-ui/themes/pidex-light-flattools.json +79 -0
- package/packages/pi-extensions/extensions/xtrm-ui/themes/pidex-light.json +85 -0
- package/packages/pi-extensions/package.json +1 -1
- package/packages/pi-extensions/themes/xtrm-ui/pidex-dark-flattools.json +79 -0
- package/packages/pi-extensions/themes/xtrm-ui/pidex-dark.json +3 -3
- package/packages/pi-extensions/themes/xtrm-ui/pidex-light-flattools.json +79 -0
- package/scripts/patch-external-pi-tools.mjs +154 -0
|
@@ -1,262 +1,142 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: sync-docs
|
|
3
3
|
description: >-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
Single-doc documentation sync specialist for xtrm projects. Each invocation
|
|
5
|
+
operates on exactly one doc named in the bead's SCOPE. Source files are
|
|
6
|
+
off-limits to every tool — context comes from a pre-script (xt report
|
|
7
|
+
excerpt + commits) and per-commit `git show <hash> -- <paths>` for at most
|
|
8
|
+
3 unclear commits. Hard runtime cap. Use when one specific doc needs
|
|
9
|
+
syncing after code changes — never for whole-tree audits.
|
|
9
10
|
gemini-command: sync-docs
|
|
10
|
-
version:
|
|
11
|
+
version: 3.1.0
|
|
11
12
|
---
|
|
12
13
|
|
|
13
14
|
# sync-docs
|
|
14
15
|
|
|
15
|
-
|
|
16
|
+
Single-doc sync specialist. One invocation = one doc.
|
|
16
17
|
|
|
17
|
-
##
|
|
18
|
+
## The single-doc invariant
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
Phase 0: Route mode/scope — targeted, area, or full audit?
|
|
21
|
-
Phase 1: Gather context — commits, issues, changed files in window
|
|
22
|
-
Phase 2: Inspect with xtrm — what does the docs suite report?
|
|
23
|
-
Phase 3: Detect drift — which docs are stale?
|
|
24
|
-
Phase 4: Plan delta — what to edit vs report
|
|
25
|
-
Phase 5: Execute fixes — update docs within scope
|
|
26
|
-
Phase 6: Validate — confirm no remaining drift
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
**Audit vs Execute:** Bead-linked runs execute all phases. Non-bead runs with
|
|
30
|
-
"audit/check/report" stop after Phase 4. Non-bead runs with "update/fix/sync"
|
|
31
|
-
execute.
|
|
32
|
-
|
|
33
|
-
---
|
|
34
|
-
|
|
35
|
-
## Phase 0: Route Mode and Scope
|
|
36
|
-
|
|
37
|
-
Determine your mode BEFORE gathering context. This controls everything downstream.
|
|
38
|
-
|
|
39
|
-
### Mode precedence
|
|
20
|
+
The bead's `SCOPE` field MUST name exactly one doc path. If SCOPE names zero docs, multiple docs, or a non-doc path, emit `BLOCKED: scope-violation` in Phase 1 and stop. There is no other mode. There is no "audit" or "area" path. Multi-doc updates are N parallel sync-docs runs orchestrated externally.
|
|
40
21
|
|
|
41
|
-
|
|
42
|
-
|----------|-----------|------|
|
|
43
|
-
| 1 | Prompt contains explicit doc file paths | **Targeted** |
|
|
44
|
-
| 2 | Prompt contains time window + directory/source scope | **Area** |
|
|
45
|
-
| 3 | Everything else | **Full audit** |
|
|
22
|
+
The mandatory rule (`sync-docs-scope-discipline`) appended after this skill is enforced. Read it. It encodes the hard tool bans, the budget, the steer-obey rule, and the compaction-STOP rule.
|
|
46
23
|
|
|
47
|
-
|
|
24
|
+
## How you read code
|
|
48
25
|
|
|
49
|
-
**
|
|
50
|
-
Report collateral docs that likely also need updates but do NOT edit them.
|
|
26
|
+
You don't, broadly. Source files under `src/`, `tests/`, `pi/`, `packages/`, `config/specialists/`, `.specialists/default/` are off-limits to **every tool**: `Read`, `Grep`, `Glob`, `find`, `cat`, `head`, `tail`, `sed`, `awk`, `rg`, `git grep`, `python -c open(...)`, and any `Bash` redirection that pipes a source file.
|
|
51
27
|
|
|
52
|
-
|
|
53
|
-
Use drift detector to confirm staleness. Edit candidate docs within derived scope.
|
|
28
|
+
The legal channels for understanding what changed:
|
|
54
29
|
|
|
55
|
-
**
|
|
56
|
-
|
|
30
|
+
1. **Pre-script context** (already injected above): latest xt report excerpt + `git log master --oneline -20`.
|
|
31
|
+
2. **Your one doc's content** (`Read`).
|
|
32
|
+
3. **Filtered drift**: `python3 .xtrm/skills/default/sync-docs/scripts/drift_detector.py scan --json`, filtered through `jq` or `python -c` to YOUR ONE DOC. Discard everything else.
|
|
33
|
+
4. **Filtered context_gatherer** (only if pre-script context is insufficient): `python3 .xtrm/skills/default/sync-docs/scripts/context_gatherer.py --doc <YOUR_DOC>` — that flag only.
|
|
34
|
+
5. **Per-commit diff** for unclear claims: `git show <hash> -- <path1> [<path2>...]`. Maximum 3 such calls per run. NEVER `git diff <a>..<b>`. NEVER `git show <hash>` without `--`.
|
|
57
35
|
|
|
58
|
-
|
|
36
|
+
## Phases
|
|
59
37
|
|
|
60
|
-
|
|
|
61
|
-
|
|
62
|
-
|
|
|
63
|
-
|
|
|
64
|
-
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
## Phase 1: Gather Scoped Context
|
|
69
|
-
|
|
70
|
-
### Context gatherer
|
|
71
|
-
|
|
72
|
-
The context gatherer supports time-window and scope-aware gathering:
|
|
73
|
-
|
|
74
|
-
```bash
|
|
75
|
-
# Targeted: specific docs + time window
|
|
76
|
-
python3 .xtrm/skills/default/sync-docs/scripts/context_gatherer.py \
|
|
77
|
-
--doc docs/features.md --doc docs/cli-reference.md --since-hours 24
|
|
38
|
+
| Phase | Action | Budget |
|
|
39
|
+
|---|---|---|
|
|
40
|
+
| 1 | Verify SCOPE names exactly one doc. STOP if not. | 0 tools |
|
|
41
|
+
| 2 | Filtered drift scan for that one doc. | 1 call |
|
|
42
|
+
| 3 | Per-commit `git show <hash> -- <paths>` for unclear commits. | ≤3 calls |
|
|
43
|
+
| 4 | Edit the one doc. Bump `version` + `updated`. Stamp via `drift_detector.py update-sync <path>`. | edits to one doc only |
|
|
44
|
+
| 5 | Re-run filtered drift; confirm cleared. Emit final report. | 1 call |
|
|
78
45
|
|
|
79
|
-
|
|
80
|
-
python3 .xtrm/skills/default/sync-docs/scripts/context_gatherer.py \
|
|
81
|
-
--scope-path src/specialist/ --since-hours 24
|
|
46
|
+
After Phase 5, stop. Do not look at other docs. Do not propose new beads.
|
|
82
47
|
|
|
83
|
-
|
|
84
|
-
python3 .xtrm/skills/default/sync-docs/scripts/context_gatherer.py \
|
|
85
|
-
--scope-path src/cli/ --since-days 7
|
|
48
|
+
## Phase 1: SCOPE check
|
|
86
49
|
|
|
87
|
-
|
|
88
|
-
python3 .xtrm/skills/default/sync-docs/scripts/context_gatherer.py \
|
|
89
|
-
--since-days 7
|
|
50
|
+
Read the bead's SCOPE field. It must name exactly one doc path. Examples of valid SCOPE:
|
|
90
51
|
|
|
91
|
-
# Legacy compat (commit count)
|
|
92
|
-
python3 .xtrm/skills/default/sync-docs/scripts/context_gatherer.py \
|
|
93
|
-
--since-commits 30
|
|
94
52
|
```
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
Outputs JSON with:
|
|
99
|
-
- `mode_hint`: targeted / area / full
|
|
100
|
-
- `window`: type + value + git_since
|
|
101
|
-
- `scope`: doc targets + source paths
|
|
102
|
-
- `git.recent_commits`: commits with changed files
|
|
103
|
-
- `git.changed_files`: unique files ranked by change frequency
|
|
104
|
-
- `git.changed_dirs`: directory-level summary
|
|
105
|
-
- `bd.closed_issues`: recently closed issues
|
|
106
|
-
- `docs`: drift detector results
|
|
107
|
-
|
|
108
|
-
### xtrm docs suite
|
|
109
|
-
|
|
110
|
-
Use for operator-facing inspection:
|
|
111
|
-
|
|
112
|
-
```bash
|
|
113
|
-
xtrm docs list --json
|
|
114
|
-
xtrm docs show --json
|
|
115
|
-
xtrm docs cross-check --json --days 30
|
|
53
|
+
SCOPE: docs/cli-reference.md
|
|
54
|
+
SCOPE: CHANGELOG.md
|
|
116
55
|
```
|
|
117
56
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
## Phase 2: Inspect Docs State
|
|
121
|
-
|
|
122
|
-
Use `xtrm docs` to answer:
|
|
123
|
-
- What docs exist and their metadata?
|
|
124
|
-
- Which have missing or outdated frontmatter?
|
|
125
|
-
- Coverage gaps between recent work and docs?
|
|
126
|
-
|
|
127
|
-
If the CLI already isolates the problem clearly, skip to Phase 4.
|
|
128
|
-
|
|
129
|
-
---
|
|
130
|
-
|
|
131
|
-
## Phase 3: Detect Drift
|
|
132
|
-
|
|
133
|
-
Use the drift detector filtered to your scope:
|
|
57
|
+
Examples that are `BLOCKED: scope-violation`:
|
|
134
58
|
|
|
135
|
-
```
|
|
136
|
-
#
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
#
|
|
140
|
-
python3 .xtrm/skills/default/sync-docs/scripts/drift_detector.py scan --since 30 --json
|
|
59
|
+
```
|
|
60
|
+
SCOPE: # empty
|
|
61
|
+
SCOPE: docs/cli-reference.md docs/features.md # multiple
|
|
62
|
+
SCOPE: docs/ # directory
|
|
63
|
+
SCOPE: src/cli/run.ts # non-doc
|
|
141
64
|
```
|
|
142
65
|
|
|
143
|
-
|
|
144
|
-
1. It declares `source_of_truth_for` globs in frontmatter
|
|
145
|
-
2. AND commits affecting matching files exist AFTER the `synced_at` hash
|
|
146
|
-
|
|
147
|
-
### Staleness model
|
|
148
|
-
|
|
149
|
-
- **Time windows** decide what recent work to consider now (relevance)
|
|
150
|
-
- **`synced_at` / hash-based drift** decides whether a doc is actually stale (truth)
|
|
151
|
-
- **Fallback**: when metadata is missing, time-window heuristics prioritize review
|
|
152
|
-
|
|
153
|
-
---
|
|
154
|
-
|
|
155
|
-
## Phase 4: Plan Delta
|
|
156
|
-
|
|
157
|
-
Before editing, identify:
|
|
158
|
-
- Docs to update (within scope)
|
|
159
|
-
- Docs to leave untouched
|
|
160
|
-
- Collateral docs to report only (targeted mode)
|
|
161
|
-
|
|
162
|
-
**If audit-only, stop here and output the report.**
|
|
163
|
-
|
|
164
|
-
Include both:
|
|
165
|
-
- `xtrm docs` findings (operator-facing)
|
|
166
|
-
- Python analyzer findings (drift/structure enforcement)
|
|
167
|
-
|
|
168
|
-
---
|
|
169
|
-
|
|
170
|
-
## Phase 5: Execute Fixes
|
|
171
|
-
|
|
172
|
-
| Situation | Action |
|
|
173
|
-
|-----------|--------|
|
|
174
|
-
| Stale docs file | Update content + bump `version` + `updated` |
|
|
175
|
-
| README bloated | Extract large sections to focused docs files |
|
|
176
|
-
| Missing docs file | Generate scaffold via `validate_doc.py --generate` |
|
|
177
|
-
| Stale CHANGELOG | Add entry with changelog script |
|
|
178
|
-
| Invalid schema | Fix frontmatter |
|
|
179
|
-
|
|
180
|
-
### After each doc update
|
|
66
|
+
If blocked, emit:
|
|
181
67
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
68
|
+
```
|
|
69
|
+
DOC: <whatever was in SCOPE, or empty>
|
|
70
|
+
VERDICT: BLOCKED
|
|
71
|
+
EDITS: none
|
|
72
|
+
NOTES: scope-violation — <reason>
|
|
185
73
|
```
|
|
186
74
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
In targeted mode, ONLY edit the named docs. If you discover other docs need
|
|
190
|
-
updating, list them in your output as "Suggested follow-ups" — do not edit them.
|
|
75
|
+
and stop.
|
|
191
76
|
|
|
192
|
-
|
|
77
|
+
## Phase 2: Filtered drift
|
|
193
78
|
|
|
194
79
|
```bash
|
|
195
|
-
python3 .xtrm/skills/default/sync-docs/scripts/
|
|
196
|
-
|
|
80
|
+
python3 .xtrm/skills/default/sync-docs/scripts/drift_detector.py scan --json \
|
|
81
|
+
| jq '[.[] | select(.path == "<YOUR_DOC>")]'
|
|
197
82
|
```
|
|
198
83
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
```bash
|
|
202
|
-
python3 .xtrm/skills/default/sync-docs/scripts/changelog/add_entry.py \
|
|
203
|
-
CHANGELOG.md Added "Describe the documentation update"
|
|
204
|
-
```
|
|
84
|
+
If your doc reports stale, capture the list of commits since `synced_at` — those are your candidate commits for Phase 3.
|
|
205
85
|
|
|
206
|
-
|
|
86
|
+
If your doc is not in the drift output (no `source_of_truth_for` declared, or no commits since `synced_at`), use the pre-script's recent commits + your reading of the doc's content to form a candidate list.
|
|
207
87
|
|
|
208
|
-
## Phase
|
|
88
|
+
## Phase 3: Per-commit diff (unclear cases only)
|
|
209
89
|
|
|
210
|
-
|
|
90
|
+
For commits whose subjects don't make the impact on your doc obvious, run:
|
|
211
91
|
|
|
212
92
|
```bash
|
|
213
|
-
|
|
214
|
-
xtrm docs cross-check --json --days 30
|
|
215
|
-
python3 .xtrm/skills/default/sync-docs/scripts/drift_detector.py scan --json
|
|
93
|
+
git show <hash> -- <path1> <path2>
|
|
216
94
|
```
|
|
217
95
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
---
|
|
96
|
+
The `<paths>` should be paths your doc actually claims about (e.g. if the doc is `docs/cli-reference.md`, paths under `src/cli/` and `src/index.ts` are reasonable; paths under `pi/` are not unless the doc covers pi).
|
|
221
97
|
|
|
222
|
-
|
|
98
|
+
Maximum 3 such calls per run. If 3 calls aren't enough, the commit set is too broad — emit `BLOCKED: too-many-unclear-commits` and ask for a narrower bead.
|
|
223
99
|
|
|
224
|
-
|
|
100
|
+
## Phase 4: Edit
|
|
225
101
|
|
|
226
|
-
|
|
102
|
+
For your one doc:
|
|
103
|
+
- Update content based on the gathered context.
|
|
104
|
+
- Bump frontmatter `version` (patch/minor/major per change) and `updated` (today).
|
|
105
|
+
- Stamp:
|
|
106
|
+
```bash
|
|
107
|
+
python3 .xtrm/skills/default/sync-docs/scripts/drift_detector.py update-sync <YOUR_DOC>
|
|
108
|
+
```
|
|
227
109
|
|
|
228
|
-
|
|
229
|
-
|-------|--------|---------|
|
|
230
|
-
| `title` | string | `"Hooks Reference"` |
|
|
231
|
-
| `scope` | string | `hooks` |
|
|
232
|
-
| `category` | enum | `reference` |
|
|
233
|
-
| `version` | semver | `1.0.0` |
|
|
234
|
-
| `updated` | date | `2026-03-22` |
|
|
110
|
+
Edit nothing else. CHANGELOG, README, other docs, source files — all off-limits.
|
|
235
111
|
|
|
236
|
-
|
|
112
|
+
## Phase 5: Validate
|
|
237
113
|
|
|
238
|
-
|
|
114
|
+
Re-run the filtered drift scan from Phase 2. Confirm your doc is no longer stale.
|
|
239
115
|
|
|
240
|
-
|
|
116
|
+
## Final report
|
|
241
117
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
118
|
+
```
|
|
119
|
+
DOC: <path>
|
|
120
|
+
VERDICT: <UPDATED | NO_CHANGE_NEEDED | BLOCKED>
|
|
121
|
+
COMMITS_REVIEWED: <hash1>, <hash2>, ...
|
|
122
|
+
EDITS: <one-line summary, or "none">
|
|
123
|
+
DRIFT_BEFORE: <stale | clean | unknown>
|
|
124
|
+
DRIFT_AFTER: <clean | n/a>
|
|
125
|
+
SUGGESTED_FOLLOWUPS: <other doc names that may need separate sync-docs runs — names only, never edited>
|
|
126
|
+
```
|
|
248
127
|
|
|
249
|
-
|
|
128
|
+
## References
|
|
250
129
|
|
|
251
|
-
|
|
130
|
+
- [Frontmatter schema](references/schema.md) — required/optional fields, categories, version-bump rules
|
|
131
|
+
- [Doc structure](references/doc-structure.md) — INDEX block regen, structure analyzer
|
|
252
132
|
|
|
253
|
-
|
|
254
|
-
- `xtrm docs list --json` — inventory
|
|
255
|
-
- `xtrm docs show --json` — frontmatter inspection
|
|
256
|
-
- `xtrm docs cross-check --json` — drift, coverage gaps
|
|
133
|
+
## Anti-patterns (forbidden by the mandatory rule)
|
|
257
134
|
|
|
258
|
-
|
|
259
|
-
- `
|
|
260
|
-
-
|
|
261
|
-
-
|
|
262
|
-
- `context_gatherer.py`
|
|
135
|
+
- Reading source files by **any** tool, not just `Read`
|
|
136
|
+
- `git diff <a>..<b>` (range diffs) or `git show <hash>` without `--`
|
|
137
|
+
- Editing CHANGELOG / README / other docs / source files (unless that file IS the SCOPE doc)
|
|
138
|
+
- Auditing the docs/ tree
|
|
139
|
+
- Running `context_gatherer.py` with `--scope-path` or `--since-days` (broad)
|
|
140
|
+
- Re-fetching after compaction
|
|
141
|
+
- Continuing after a steer/stop
|
|
142
|
+
- "Let me also check X" loops
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# sync-docs pre-script: byte-capped context dump.
|
|
3
|
+
# Output is injected into the specialist prompt at run-time.
|
|
4
|
+
|
|
5
|
+
echo '=== Latest xt report (excerpt, 5KB cap) ==='
|
|
6
|
+
R=$(ls -1 .xtrm/reports/*.md 2>/dev/null | sort -r | head -1)
|
|
7
|
+
if [ -n "$R" ]; then
|
|
8
|
+
echo "FILE: $R"
|
|
9
|
+
head -c 5000 "$R"
|
|
10
|
+
echo
|
|
11
|
+
else
|
|
12
|
+
echo '(no reports found)'
|
|
13
|
+
fi
|
|
14
|
+
echo
|
|
15
|
+
echo '=== Recent master commits (20, 2KB cap) ==='
|
|
16
|
+
git log master --oneline -20 2>/dev/null | head -c 2000 || echo '(git unavailable)'
|
|
17
|
+
echo
|