@heihei0299/matt-skills 1.3.2 → 1.5.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.
- package/.agents/skills/ci-guard/SKILL.md +94 -0
- package/.agents/skills/ci-guard/agents/openai.yaml +5 -0
- package/.agents/skills/commit-check/SKILL.md +13 -18
- package/.agents/skills/diagnose-fix/SKILL.md +0 -1
- package/.agents/skills/grill-to-spec/SKILL.md +0 -3
- package/.agents/skills/instance-test/SKILL.md +36 -27
- package/.agents/skills/instance-test/agents/openai.yaml +1 -1
- package/.agents/skills/instance-test/references/instances.md +63 -36
- package/.agents/skills/scaffold-functional-test/SKILL.md +75 -0
- package/.agents/skills/scaffold-functional-test/agents/openai.yaml +5 -0
- package/.agents/skills/tdd-implement/SKILL.md +0 -1
- package/.agents/skills/tdd-implement/references/orchestration.md +2 -2
- package/.agents/skills/tdd-implement/references/stages.md +2 -7
- package/README.md +55 -54
- package/bin/cli.js +216 -64
- package/config/engineering.json +20 -0
- package/config/proprietary.json +8 -1
- package/package.json +2 -1
- package/scripts/sync-upstream.js +69 -43
- package/template/.agents/skills/ask-matt/PHASE-BOUNDARIES.md +55 -0
- package/template/.agents/skills/ask-matt/SKILL.md +90 -0
- package/template/.agents/skills/ask-matt/agents/openai.yaml +5 -0
- package/template/.agents/skills/ci-guard/SKILL.md +94 -0
- package/template/.agents/skills/ci-guard/agents/openai.yaml +5 -0
- package/template/.agents/skills/code-review/SKILL.md +87 -0
- package/template/.agents/skills/code-review/agents/openai.yaml +3 -0
- package/template/.agents/skills/codebase-design/DEEPENING.md +37 -0
- package/template/.agents/skills/codebase-design/DESIGN-IT-TWICE.md +44 -0
- package/template/.agents/skills/codebase-design/SKILL.md +114 -0
- package/template/.agents/skills/codebase-design/agents/openai.yaml +3 -0
- package/template/{.opencode → .agents}/skills/commit-check/SKILL.md +13 -18
- package/template/{.pi → .agents}/skills/diagnose-fix/SKILL.md +0 -1
- package/template/.agents/skills/diagnosing-bugs/SKILL.md +138 -0
- package/template/.agents/skills/diagnosing-bugs/agents/openai.yaml +3 -0
- package/template/.agents/skills/diagnosing-bugs/scripts/hitl-loop.template.sh +44 -0
- package/template/.agents/skills/domain-modeling/ADR-FORMAT.md +47 -0
- package/template/.agents/skills/domain-modeling/CONTEXT-FORMAT.md +60 -0
- package/template/.agents/skills/domain-modeling/SKILL.md +74 -0
- package/template/.agents/skills/domain-modeling/agents/openai.yaml +3 -0
- package/template/.agents/skills/grill-me/SKILL.md +7 -0
- package/template/.agents/skills/grill-me/agents/openai.yaml +5 -0
- package/template/{.pi → .agents}/skills/grill-to-spec/SKILL.md +0 -3
- package/template/.agents/skills/grill-with-docs/SKILL.md +7 -0
- package/template/.agents/skills/grill-with-docs/agents/openai.yaml +5 -0
- package/template/.agents/skills/grilling/SKILL.md +28 -0
- package/template/.agents/skills/grilling/agents/openai.yaml +3 -0
- package/template/.agents/skills/handoff/SKILL.md +16 -0
- package/template/.agents/skills/handoff/agents/openai.yaml +5 -0
- package/template/.agents/skills/implement/SKILL.md +15 -0
- package/template/.agents/skills/implement/agents/openai.yaml +5 -0
- package/template/.agents/skills/improve-codebase-architecture/HTML-REPORT.md +123 -0
- package/template/.agents/skills/improve-codebase-architecture/SKILL.md +71 -0
- package/template/.agents/skills/improve-codebase-architecture/agents/openai.yaml +5 -0
- package/template/.agents/skills/instance-test/SKILL.md +70 -0
- package/template/.agents/skills/instance-test/agents/openai.yaml +5 -0
- package/template/.agents/skills/instance-test/references/instances.md +75 -0
- package/template/.agents/skills/prototype/LOGIC.md +67 -0
- package/template/.agents/skills/prototype/SKILL.md +26 -0
- package/template/.agents/skills/prototype/UI.md +112 -0
- package/template/.agents/skills/prototype/agents/openai.yaml +3 -0
- package/template/.agents/skills/research/SKILL.md +12 -0
- package/template/.agents/skills/research/agents/openai.yaml +3 -0
- package/template/.agents/skills/resolving-merge-conflicts/SKILL.md +14 -0
- package/template/.agents/skills/resolving-merge-conflicts/agents/openai.yaml +3 -0
- package/template/.agents/skills/scaffold-functional-test/SKILL.md +75 -0
- package/template/.agents/skills/scaffold-functional-test/agents/openai.yaml +5 -0
- package/template/.agents/skills/setup-matt-pocock-skills/SKILL.md +116 -0
- package/template/.agents/skills/setup-matt-pocock-skills/agents/openai.yaml +5 -0
- package/template/.agents/skills/setup-matt-pocock-skills/domain.md +51 -0
- package/template/.agents/skills/setup-matt-pocock-skills/issue-tracker-github.md +45 -0
- package/template/.agents/skills/setup-matt-pocock-skills/issue-tracker-gitlab.md +46 -0
- package/template/.agents/skills/setup-matt-pocock-skills/issue-tracker-local.md +30 -0
- package/template/.agents/skills/setup-matt-pocock-skills/triage-labels.md +15 -0
- package/template/.agents/skills/tdd/SKILL.md +38 -0
- package/template/.agents/skills/tdd/agents/openai.yaml +3 -0
- package/template/.agents/skills/tdd/mocking.md +59 -0
- package/template/.agents/skills/tdd/tests.md +77 -0
- package/template/{.opencode → .agents}/skills/tdd-implement/SKILL.md +0 -1
- package/template/{.pi → .agents}/skills/tdd-implement/references/orchestration.md +2 -2
- package/template/{.opencode → .agents}/skills/tdd-implement/references/stages.md +2 -7
- package/template/.agents/skills/teach/GLOSSARY-FORMAT.md +35 -0
- package/template/.agents/skills/teach/LEARNING-RECORD-FORMAT.md +46 -0
- package/template/.agents/skills/teach/MISSION-FORMAT.md +31 -0
- package/template/.agents/skills/teach/RESOURCES-FORMAT.md +32 -0
- package/template/.agents/skills/teach/SKILL.md +140 -0
- package/template/.agents/skills/teach/agents/openai.yaml +5 -0
- package/template/.agents/skills/to-questionnaire/SKILL.md +54 -0
- package/template/.agents/skills/to-questionnaire/agents/openai.yaml +5 -0
- package/template/.agents/skills/to-spec/SKILL.md +75 -0
- package/template/.agents/skills/to-spec/agents/openai.yaml +5 -0
- package/template/.agents/skills/to-tickets/SKILL.md +105 -0
- package/template/.agents/skills/to-tickets/agents/openai.yaml +5 -0
- package/template/.agents/skills/triage/AGENT-BRIEF.md +207 -0
- package/template/.agents/skills/triage/OUT-OF-SCOPE.md +105 -0
- package/template/.agents/skills/triage/SKILL.md +112 -0
- package/template/.agents/skills/triage/agents/openai.yaml +5 -0
- package/template/.agents/skills/wait-what/SKILL.md +7 -0
- package/template/.agents/skills/wait-what/agents/openai.yaml +5 -0
- package/template/.agents/skills/wayfinder/SKILL.md +128 -0
- package/template/.agents/skills/wayfinder/agents/openai.yaml +5 -0
- package/template/.agents/skills/wizard/SKILL.md +44 -0
- package/template/.agents/skills/wizard/agents/openai.yaml +3 -0
- package/template/.agents/skills/wizard/template.sh +204 -0
- package/template/.agents/skills/writing-for-agents/SKILL-MECHANICS.md +22 -0
- package/template/.agents/skills/writing-for-agents/SKILL.md +81 -0
- package/template/.agents/skills/writing-for-agents/agents/openai.yaml +3 -0
- package/template/.opencode/CONTEXT.md +8 -8
- package/template/.opencode/skills/.gitkeep +0 -0
- package/template/.opencode/skills/README.md +4 -0
- package/template/.pi/CONTEXT.md +8 -8
- package/template/.pi/skills/.gitkeep +0 -0
- package/template/.pi/skills/README.md +4 -0
- package/template/AGENTS.md +5 -8
- package/template/.opencode/skills/diagnose-fix/SKILL.md +0 -66
- package/template/.opencode/skills/grill-to-spec/SKILL.md +0 -83
- package/template/.opencode/skills/instance-test/SKILL.md +0 -61
- package/template/.opencode/skills/instance-test/agents/openai.yaml +0 -5
- package/template/.opencode/skills/instance-test/references/instances.md +0 -48
- package/template/.opencode/skills/tdd-implement/references/orchestration.md +0 -136
- package/template/.pi/skills/commit-check/SKILL.md +0 -67
- package/template/.pi/skills/commit-check/agents/openai.yaml +0 -5
- package/template/.pi/skills/commit-check/scripts/scan-sensitive.sh +0 -36
- package/template/.pi/skills/diagnose-fix/agents/openai.yaml +0 -5
- package/template/.pi/skills/diagnose-fix/references/anti-patterns.md +0 -20
- package/template/.pi/skills/grill-to-spec/agents/openai.yaml +0 -5
- package/template/.pi/skills/grill-to-spec/references/rules.md +0 -33
- package/template/.pi/skills/instance-test/SKILL.md +0 -61
- package/template/.pi/skills/instance-test/agents/openai.yaml +0 -5
- package/template/.pi/skills/instance-test/references/instances.md +0 -48
- package/template/.pi/skills/tdd-implement/SKILL.md +0 -48
- package/template/.pi/skills/tdd-implement/agents/openai.yaml +0 -5
- package/template/.pi/skills/tdd-implement/references/stages.md +0 -316
- /package/template/{.opencode → .agents}/skills/commit-check/agents/openai.yaml +0 -0
- /package/template/{.opencode → .agents}/skills/commit-check/scripts/scan-sensitive.sh +0 -0
- /package/template/{.opencode → .agents}/skills/diagnose-fix/agents/openai.yaml +0 -0
- /package/template/{.opencode → .agents}/skills/diagnose-fix/references/anti-patterns.md +0 -0
- /package/template/{.opencode → .agents}/skills/grill-to-spec/agents/openai.yaml +0 -0
- /package/template/{.opencode → .agents}/skills/grill-to-spec/references/rules.md +0 -0
- /package/template/{.opencode → .agents}/skills/tdd-implement/agents/openai.yaml +0 -0
package/scripts/sync-upstream.js
CHANGED
|
@@ -9,6 +9,7 @@ import { fileURLToPath } from 'node:url';
|
|
|
9
9
|
const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
|
10
10
|
const LOCAL_SKILLS_DIR = path.join(ROOT, '.agents', 'skills');
|
|
11
11
|
const PROPRIETARY_PATH = path.join(ROOT, 'config', 'proprietary.json');
|
|
12
|
+
const ENGINEERING_PATH = path.join(ROOT, 'config', 'engineering.json');
|
|
12
13
|
const UPSTREAM_URL = 'https://github.com/mattpocock/skills.git';
|
|
13
14
|
|
|
14
15
|
// 重命名映射:上游已重命名,本地旧名需迁移
|
|
@@ -21,7 +22,16 @@ async function loadProprietary() {
|
|
|
21
22
|
const raw = await readFile(PROPRIETARY_PATH, 'utf8');
|
|
22
23
|
return new Set(JSON.parse(raw));
|
|
23
24
|
} catch {
|
|
24
|
-
return new Set(['tdd-implement', 'grill-to-spec', 'diagnose-fix', 'commit-check', '
|
|
25
|
+
return new Set(['ci-guard', 'tdd-implement', 'grill-to-spec', 'diagnose-fix', 'commit-check', 'scaffold-functional-test']);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async function loadEngineering() {
|
|
30
|
+
try {
|
|
31
|
+
const raw = await readFile(ENGINEERING_PATH, 'utf8');
|
|
32
|
+
return new Set(JSON.parse(raw));
|
|
33
|
+
} catch {
|
|
34
|
+
return new Set(['ask-matt','code-review','codebase-design','diagnosing-bugs','domain-modeling','grill-with-docs','implement','improve-codebase-architecture','prototype','research','resolving-merge-conflicts','setup-matt-pocock-skills','tdd','to-spec','to-tickets','triage','wayfinder','wizard']);
|
|
25
35
|
}
|
|
26
36
|
}
|
|
27
37
|
|
|
@@ -103,12 +113,19 @@ async function collectLocalSkills(proprietary) {
|
|
|
103
113
|
return map;
|
|
104
114
|
}
|
|
105
115
|
|
|
106
|
-
export async function compare({ upstreamUrl, tmpDir, ref } = {}) {
|
|
116
|
+
export async function compare({ upstreamUrl, tmpDir, ref, onlyProgramming = true } = {}) {
|
|
107
117
|
const proprietary = await loadProprietary();
|
|
118
|
+
const engineering = await loadEngineering();
|
|
108
119
|
const fetched = await fetchUpstream({ tmpDir, upstreamUrl, ref });
|
|
109
120
|
const upstreamRoot = fetched.dest;
|
|
110
|
-
const
|
|
111
|
-
const
|
|
121
|
+
const upstreamMapFull = await collectUpstreamSkills(upstreamRoot);
|
|
122
|
+
const localMapFull = await collectLocalSkills(proprietary);
|
|
123
|
+
// 编程子集:engineering 桶即编程(默认),--all 则含 productivity
|
|
124
|
+
const upstreamMap = onlyProgramming
|
|
125
|
+
? new Map([...upstreamMapFull.entries()].filter(([, v]) => v.bucket === 'engineering'))
|
|
126
|
+
: upstreamMapFull;
|
|
127
|
+
const localMap = localMapFull;
|
|
128
|
+
const isEngineering = (name) => engineering.has(name);
|
|
112
129
|
|
|
113
130
|
const added = [];
|
|
114
131
|
const updated = [];
|
|
@@ -118,27 +135,28 @@ export async function compare({ upstreamUrl, tmpDir, ref } = {}) {
|
|
|
118
135
|
|
|
119
136
|
// 检测重命名:本地旧名存在且上游新名存在,且本地旧名不在上游
|
|
120
137
|
for (const [oldName, newName] of Object.entries(RENAMES)) {
|
|
121
|
-
if (
|
|
122
|
-
|
|
138
|
+
if (onlyProgramming) {
|
|
139
|
+
if (localMap.has(oldName) && upstreamMap.has(newName) && !upstreamMap.has(oldName)) {
|
|
140
|
+
renamed.push({ from: oldName, to: newName });
|
|
141
|
+
}
|
|
142
|
+
} else {
|
|
143
|
+
if (localMap.has(oldName) && upstreamMapFull.has(newName) && !upstreamMapFull.has(oldName)) {
|
|
144
|
+
renamed.push({ from: oldName, to: newName });
|
|
145
|
+
}
|
|
123
146
|
}
|
|
124
147
|
}
|
|
125
148
|
const renamedFrom = new Set(renamed.map((r) => r.from));
|
|
126
149
|
const renamedTo = new Set(renamed.map((r) => r.to));
|
|
127
150
|
|
|
128
151
|
for (const [name, u] of upstreamMap.entries()) {
|
|
129
|
-
if (renamedTo.has(name)) continue;
|
|
152
|
+
if (renamedTo.has(name)) continue;
|
|
130
153
|
const local = localMap.get(name);
|
|
131
|
-
if (!local)
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
updated.push(name);
|
|
135
|
-
} else {
|
|
136
|
-
same.push(name);
|
|
137
|
-
}
|
|
154
|
+
if (!local) added.push(name);
|
|
155
|
+
else if (local.hash !== u.hash) updated.push(name);
|
|
156
|
+
else same.push(name);
|
|
138
157
|
}
|
|
139
|
-
// 重命名的也算 updated(需迁移)
|
|
140
158
|
for (const r of renamed) {
|
|
141
|
-
const u = upstreamMap.get(r.to);
|
|
159
|
+
const u = upstreamMap.get(r.to) || upstreamMapFull.get(r.to);
|
|
142
160
|
const local = localMap.get(r.from);
|
|
143
161
|
if (local && u && local.hash !== u.hash) updated.push(`${r.from}→${r.to}`);
|
|
144
162
|
else if (!local) added.push(r.to);
|
|
@@ -147,35 +165,46 @@ export async function compare({ upstreamUrl, tmpDir, ref } = {}) {
|
|
|
147
165
|
|
|
148
166
|
for (const name of localMap.keys()) {
|
|
149
167
|
if (renamedFrom.has(name)) continue;
|
|
150
|
-
if (
|
|
151
|
-
|
|
152
|
-
|
|
168
|
+
if (upstreamMap.has(name) || renamedTo.has(name)) continue;
|
|
169
|
+
// 编程模式下仅报告 engineering 本地技能的删除;productivity/instance-test 等跳过
|
|
170
|
+
if (onlyProgramming && !isEngineering(name)) continue;
|
|
171
|
+
// 全量模式下所有本地非独有且不在上游的都视为 removed
|
|
172
|
+
removed.push(name);
|
|
153
173
|
}
|
|
154
174
|
|
|
175
|
+
const localCount = onlyProgramming
|
|
176
|
+
? [...localMap.keys()].filter(isEngineering).length
|
|
177
|
+
: localMap.size;
|
|
155
178
|
return {
|
|
156
179
|
head: fetched.head,
|
|
157
180
|
dest: fetched.dest,
|
|
158
181
|
upstreamMap,
|
|
182
|
+
upstreamMapFull,
|
|
159
183
|
localMap,
|
|
184
|
+
localMapFull,
|
|
160
185
|
proprietary: [...proprietary],
|
|
186
|
+
engineering: [...engineering],
|
|
187
|
+
onlyProgramming,
|
|
161
188
|
result: { added: added.sort(), updated: updated.sort(), same: same.sort(), removed: removed.sort(), renamed },
|
|
162
|
-
counts: { upstream: upstreamMap.size, local:
|
|
189
|
+
counts: { upstream: upstreamMap.size, local: localCount, upstreamFull: upstreamMapFull.size, localFull: localMapFull.size },
|
|
163
190
|
};
|
|
164
191
|
}
|
|
165
192
|
|
|
166
|
-
export async function applySync({ upstreamUrl, tmpDir, ref, dryRun = false, force = false } = {}) {
|
|
193
|
+
export async function applySync({ upstreamUrl, tmpDir, ref, dryRun = false, force = false, onlyProgramming = true } = {}) {
|
|
167
194
|
const proprietary = await loadProprietary();
|
|
168
|
-
const cmp = await compare({ upstreamUrl, tmpDir, ref });
|
|
169
|
-
const { dest, head, upstreamMap, result } = cmp;
|
|
195
|
+
const cmp = await compare({ upstreamUrl, tmpDir, ref, onlyProgramming });
|
|
196
|
+
const { dest, head, upstreamMap, upstreamMapFull, result } = cmp;
|
|
197
|
+
const effectiveMap = onlyProgramming ? upstreamMap : upstreamMapFull;
|
|
170
198
|
const actions = [];
|
|
171
199
|
|
|
172
200
|
if (dryRun) {
|
|
173
201
|
return { ...cmp, actions, dryRun: true };
|
|
174
202
|
}
|
|
175
203
|
|
|
176
|
-
//
|
|
204
|
+
// 处理重命名
|
|
177
205
|
for (const r of result.renamed) {
|
|
178
|
-
const src =
|
|
206
|
+
const src = effectiveMap.get(r.to)?.dir || upstreamMapFull.get(r.to)?.dir;
|
|
207
|
+
if (!src) continue;
|
|
179
208
|
const dst = path.join(LOCAL_SKILLS_DIR, r.to);
|
|
180
209
|
const oldDst = path.join(LOCAL_SKILLS_DIR, r.from);
|
|
181
210
|
await rm(oldDst, { recursive: true, force: true });
|
|
@@ -184,21 +213,18 @@ export async function applySync({ upstreamUrl, tmpDir, ref, dryRun = false, forc
|
|
|
184
213
|
actions.push(`rename ${r.from} → ${r.to}`);
|
|
185
214
|
}
|
|
186
215
|
|
|
187
|
-
// 新增
|
|
188
216
|
for (const name of result.added) {
|
|
189
|
-
// 跳过已通过重命名处理的新名
|
|
190
217
|
if (result.renamed.some((r) => r.to === name)) continue;
|
|
191
|
-
const src =
|
|
218
|
+
const src = effectiveMap.get(name)?.dir || upstreamMapFull.get(name)?.dir;
|
|
192
219
|
if (!src) continue;
|
|
193
220
|
const dst = path.join(LOCAL_SKILLS_DIR, name);
|
|
194
221
|
await cp(src, dst, { recursive: true, force: true });
|
|
195
222
|
actions.push(`add ${name}`);
|
|
196
223
|
}
|
|
197
224
|
|
|
198
|
-
// 更新
|
|
199
225
|
for (const name of result.updated) {
|
|
200
|
-
if (name.includes('→')) continue;
|
|
201
|
-
const src =
|
|
226
|
+
if (name.includes('→')) continue;
|
|
227
|
+
const src = effectiveMap.get(name)?.dir || upstreamMapFull.get(name)?.dir;
|
|
202
228
|
if (!src) continue;
|
|
203
229
|
const dst = path.join(LOCAL_SKILLS_DIR, name);
|
|
204
230
|
await rm(dst, { recursive: true, force: true });
|
|
@@ -206,10 +232,8 @@ export async function applySync({ upstreamUrl, tmpDir, ref, dryRun = false, forc
|
|
|
206
232
|
actions.push(`update ${name}`);
|
|
207
233
|
}
|
|
208
234
|
|
|
209
|
-
// 删除(上游已删且非独有)
|
|
210
235
|
for (const name of result.removed) {
|
|
211
236
|
const dst = path.join(LOCAL_SKILLS_DIR, name);
|
|
212
|
-
// 仅当非独有且上游确实不存在时删除;默认执行,需 --force 才删?按自动覆盖策略直接删
|
|
213
237
|
await rm(dst, { recursive: true, force: true });
|
|
214
238
|
actions.push(`remove ${name}`);
|
|
215
239
|
}
|
|
@@ -219,12 +243,12 @@ export async function applySync({ upstreamUrl, tmpDir, ref, dryRun = false, forc
|
|
|
219
243
|
|
|
220
244
|
return { ...cmp, dest: null, actions, head };
|
|
221
245
|
}
|
|
222
|
-
|
|
223
246
|
function formatTable(cmp) {
|
|
224
|
-
const { result, counts, head } = cmp;
|
|
247
|
+
const { result, counts, head, onlyProgramming } = cmp;
|
|
225
248
|
const lines = [];
|
|
226
249
|
lines.push(`上游 HEAD: ${head}`);
|
|
227
|
-
|
|
250
|
+
const modeHint = onlyProgramming ? '(仅编程,engineering)' : '(全量,含 productivity)';
|
|
251
|
+
lines.push(`本地非独有: ${counts.local} 上游: ${counts.upstream} ${modeHint}`);
|
|
228
252
|
lines.push('');
|
|
229
253
|
const totalDiff = result.added.length + result.updated.length + result.removed.length + result.renamed.length;
|
|
230
254
|
if (totalDiff === 0) {
|
|
@@ -248,24 +272,26 @@ async function main() {
|
|
|
248
272
|
check: args.includes('--check'),
|
|
249
273
|
apply: args.includes('--apply') || args.includes('--update'),
|
|
250
274
|
verbose: args.includes('--verbose') || args.includes('-v'),
|
|
275
|
+
all: args.includes('--all'),
|
|
251
276
|
};
|
|
277
|
+
const onlyProgramming = !opts.all;
|
|
252
278
|
const upstreamIdx = args.indexOf('--upstream');
|
|
253
279
|
const upstreamUrl = upstreamIdx !== -1 ? args[upstreamIdx + 1] : undefined;
|
|
254
280
|
const refIdx = args.indexOf('--ref');
|
|
255
281
|
const ref = refIdx !== -1 ? args[refIdx + 1] : undefined;
|
|
256
282
|
const tmpIdx = args.indexOf('--tmp');
|
|
257
283
|
const tmpDir = tmpIdx !== -1 ? args[tmpIdx + 1] : undefined;
|
|
258
|
-
|
|
259
284
|
if (args.includes('--help') || args.includes('-h') || args.length === 0) {
|
|
260
285
|
process.stdout.write(`sync-upstream — 对比/同步 mattpocock/skills 上游技能
|
|
261
286
|
|
|
262
287
|
Usage:
|
|
263
|
-
node scripts/sync-upstream.js --check [--json] [--upstream <url>] [--ref <ref>]
|
|
264
|
-
node scripts/sync-upstream.js --apply [--dry-run] [--force] [--upstream <url>] [--ref <ref>]
|
|
288
|
+
node scripts/sync-upstream.js --check [--all] [--json] [--upstream <url>] [--ref <ref>]
|
|
289
|
+
node scripts/sync-upstream.js --apply [--all] [--dry-run] [--force] [--upstream <url>] [--ref <ref>]
|
|
265
290
|
|
|
266
291
|
Options:
|
|
267
292
|
--check 只对比,不改动文件(默认)
|
|
268
293
|
--apply 应用同步(覆盖 .agents/skills 非独有技能)
|
|
294
|
+
--all 包含非编程技能(productivity);默认仅同步编程相关(engineering)
|
|
269
295
|
--dry-run 演练模式,不写文件
|
|
270
296
|
--json 以 JSON 输出结果
|
|
271
297
|
--upstream 上游仓库 URL(默认 https://github.com/mattpocock/skills.git)
|
|
@@ -278,9 +304,9 @@ Options:
|
|
|
278
304
|
}
|
|
279
305
|
|
|
280
306
|
if (opts.apply) {
|
|
281
|
-
const res = await applySync({ upstreamUrl, tmpDir, ref, dryRun: opts.dryRun, force: opts.force });
|
|
307
|
+
const res = await applySync({ upstreamUrl, tmpDir, ref, dryRun: opts.dryRun, force: opts.force, onlyProgramming });
|
|
282
308
|
if (opts.json) {
|
|
283
|
-
process.stdout.write(JSON.stringify({ head: res.head, result: res.result, actions: res.actions, dryRun: opts.dryRun }, null, 2) + '\n');
|
|
309
|
+
process.stdout.write(JSON.stringify({ head: res.head, result: res.result, actions: res.actions, dryRun: opts.dryRun, onlyProgramming }, null, 2) + '\n');
|
|
284
310
|
} else {
|
|
285
311
|
process.stdout.write(formatTable(res) + '\n');
|
|
286
312
|
if (res.actions.length) {
|
|
@@ -295,9 +321,9 @@ Options:
|
|
|
295
321
|
}
|
|
296
322
|
|
|
297
323
|
// 默认 --check
|
|
298
|
-
const cmp = await compare({ upstreamUrl, tmpDir, ref });
|
|
324
|
+
const cmp = await compare({ upstreamUrl, tmpDir, ref, onlyProgramming });
|
|
299
325
|
if (opts.json) {
|
|
300
|
-
process.stdout.write(JSON.stringify({ head: cmp.head, counts: cmp.counts, result: cmp.result }, null, 2) + '\n');
|
|
326
|
+
process.stdout.write(JSON.stringify({ head: cmp.head, counts: cmp.counts, result: cmp.result, onlyProgramming }, null, 2) + '\n');
|
|
301
327
|
} else {
|
|
302
328
|
process.stdout.write(formatTable(cmp) + '\n');
|
|
303
329
|
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Phase boundaries
|
|
2
|
+
|
|
3
|
+
A **phase** is a chunk of work inside a session: the grilling, the implementation, the QA. The definition is fuzzy on purpose: a phase ends when you think *"ok, we're done with that"*.
|
|
4
|
+
|
|
5
|
+
The **phase boundary** is the gap between two phases, and it is the only place this decision belongs. Mid-phase there is no decision to make: continue, or split the work that's left into subagents. Compacting mid-phase makes the agent lose the thread.
|
|
6
|
+
|
|
7
|
+
## The five options
|
|
8
|
+
|
|
9
|
+
| Option | What it does |
|
|
10
|
+
| ------------ | --------------------------------------------------------------- |
|
|
11
|
+
| **Continue** | Stay in the session. No context switch at all. |
|
|
12
|
+
| **`/clear`** | Empty the context window and start from nothing. |
|
|
13
|
+
| **`/handoff`** | Write a portable markdown file and seed a session anywhere with it. |
|
|
14
|
+
| **Subagent** | Send the task to its own context window and get a report back. |
|
|
15
|
+
| **`/compact`** | Compress this context and seed a fresh session with the summary. |
|
|
16
|
+
|
|
17
|
+
## The tree
|
|
18
|
+
|
|
19
|
+
Work top to bottom at the boundary. The first **yes** wins.
|
|
20
|
+
|
|
21
|
+
**1. Can you continue in this session?** Two things make the answer yes: the next phase needs this phase as a **primary source**, or you have enough [smart zone](https://www.aihero.dev/ai-coding-dictionary/smart-zone) left (~150k tokens) for the next phase to fit. Grilling → implementation is the standard yes: the implementation wants the reasoning verbatim, not a summary of it. Continue costs nothing and loses nothing, so rule it out before anything else.
|
|
22
|
+
|
|
23
|
+
**2. Is the context irrelevant to what comes next?** Is everything in this session (the exploration, the decisions, the dead ends) disposable? If so, **`/clear`**. It is the cheapest move on the board: it takes no time and hands back the whole window. `/clear` also isn't terminal: the old session stays resumable.
|
|
24
|
+
|
|
25
|
+
The cost of getting this wrong is one-way. Clear a *relevant* context and you lose the **why** behind what you built, and no amount of reading the diff back gets it returned.
|
|
26
|
+
|
|
27
|
+
**3. Do you need to hand off?** `/handoff` is narrow. You need it only when you are:
|
|
28
|
+
|
|
29
|
+
- swapping to a **new harness** (Claude → Codex),
|
|
30
|
+
- moving to a **new directory** or repo,
|
|
31
|
+
- sending the work to a **colleague**,
|
|
32
|
+
- or forking a side task you found **mid-phase** without derailing what you're doing.
|
|
33
|
+
|
|
34
|
+
That list is the whole clause. What `/handoff` buys is **portability**: a file that travels. If nothing is travelling, you don't need it.
|
|
35
|
+
|
|
36
|
+
**4. Can the task be done AFK?** Is it scoped tightly enough to run with you away from the keyboard, no steering? Then send it to a **subagent** and leave this session untouched. Automated review is the standard case: the agent reads the diff and reports, and you aren't needed while it does.
|
|
37
|
+
|
|
38
|
+
**5. Otherwise, `/compact`.** Relevant context, same harness, same directory, and you need to stay in the loop: this is where the tree lands, and it lands here often. Pass it an instruction (`/compact we're going to QA this area`) so the summary keeps what the next phase needs.
|
|
39
|
+
|
|
40
|
+
`/compact` is the **default, not the first reach**. It sits at the bottom because the four questions above it are all cheaper or more precise. The failure mode when people start here is a fresh session that is confidently wrong about a decision the summary flattened.
|
|
41
|
+
|
|
42
|
+
## Primary and secondary sources
|
|
43
|
+
|
|
44
|
+
Every move except **Continue** turns a **primary source** into a **secondary source**: the session as it happened, replaced by a summary of it. The trade is always the same shape:
|
|
45
|
+
|
|
46
|
+
| Source | Information | Noise | Room to move |
|
|
47
|
+
| --------------------------------- | ----------- | ----- | ------------ |
|
|
48
|
+
| Primary (Continue) | Full | Lots | Little |
|
|
49
|
+
| Secondary (`/compact`, `/handoff`) | Lossy | Less | Lots |
|
|
50
|
+
|
|
51
|
+
This is why question 1 comes first. You only pay the lossiness when staying costs more than it saves.
|
|
52
|
+
|
|
53
|
+
## These are judgement calls
|
|
54
|
+
|
|
55
|
+
The questions are not objective: each has taste in it, and the same boundary can go two ways on two days. The value is in asking them **in order**, at the boundary rather than in the middle of the work.
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ask-matt
|
|
3
|
+
description: Ask which skill or flow fits your situation. A router over the skills in this repo.
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Ask Matt
|
|
8
|
+
|
|
9
|
+
You don't remember every skill, so ask.
|
|
10
|
+
|
|
11
|
+
A **flow** is a path through the skills. Most paths run along one **main flow**, and two **on-ramps** merge onto it. Everything else is standalone, or a vocabulary layer that runs underneath.
|
|
12
|
+
|
|
13
|
+
## The main flow: idea → ship
|
|
14
|
+
|
|
15
|
+
The route most work travels. You have an idea and want it built.
|
|
16
|
+
|
|
17
|
+
1. **`/grill-with-docs`** sharpens the idea by interview. Start here whenever you are **working in a working directory**: it's stateful, retaining what it learns in `CONTEXT.md` and ADRs. (No working directory? Use `/grill-me` instead, covered under Standalone. Both run the same `/grilling` primitive; `grill-with-docs` is the one that leaves a paper trail, which makes it the better of the two whenever a repo is there to leave it in.)
|
|
18
|
+
2. **Branch: can you settle every question in conversation?** If a question needs a runnable answer (state, business logic, a UI you have to see), detour through a prototype, bridged by **`/handoff`** in both directions (a prototype lives in its own directory, which is exactly what `/handoff` is for; see Phase boundaries):
|
|
19
|
+
- **`/handoff`** out, then open a fresh session against that file,
|
|
20
|
+
- **`/prototype`** to answer the question with throwaway code,
|
|
21
|
+
- **`/handoff`** back what you learned, and reference it from the original idea thread.
|
|
22
|
+
3. **Branch: is this a multi-session build?**
|
|
23
|
+
- **Yes** → **`/to-spec`** (turn the thread into a spec), then **`/to-tickets`** to split it into tracer-bullet tickets, each declaring its **blocking edges**. On a local tracker that's one file per ticket under `.scratch/<feature>/issues/`, worked blockers-first by hand; on a real tracker the edges become native blocking links, so any ticket whose blockers are done can be grabbed: kick off **`/implement`** per ticket, **`/clear`ing context between each one**. Each ticket is self-contained, so the last one's context is disposable.
|
|
24
|
+
- **No** → **`/implement`** right here, in the same context window.
|
|
25
|
+
|
|
26
|
+
Either way, **`/implement`** builds each issue by driving **`/tdd`** internally (one red-green slice at a time), then closes out by running **`/code-review`**, a two-axis review (Standards + Spec) of the diff, before committing. Reach for **`/tdd`** on its own when you just want to build a concrete behaviour test-first without a full spec, and **`/code-review`** on its own whenever you want to review a branch or PR against a fixed point.
|
|
27
|
+
|
|
28
|
+
### Context hygiene
|
|
29
|
+
|
|
30
|
+
Keep steps 1–3 in **one unbroken context window** (don't compact or clear until after `/to-tickets`) so the grilling, spec, and tickets all build on the same thinking. Each `/implement` then starts fresh, working from the ticket.
|
|
31
|
+
|
|
32
|
+
The limit on this is the **[smart zone](https://www.aihero.dev/ai-coding-dictionary/smart-zone)**: the window (~150k tokens on state-of-the-art models) within which the model still reasons sharply. If a session approaches it before `/to-tickets`, don't push on degraded; `/compact` at the nearest phase boundary and carry on (see Phase boundaries).
|
|
33
|
+
|
|
34
|
+
## On-ramps
|
|
35
|
+
|
|
36
|
+
A starting situation that generates work, then merges onto the main flow.
|
|
37
|
+
|
|
38
|
+
- **Bugs and requests piling up** → **`/triage`**. It moves issues through triage roles and produces agent-ready issues, which **`/implement`** later picks up.
|
|
39
|
+
|
|
40
|
+
Triage is only for issues **you didn't create**: bug reports, incoming feature requests, anything that arrives raw. Tickets that `/to-tickets` produced are already agent-ready, so **don't triage them**.
|
|
41
|
+
|
|
42
|
+
- **Something's broken** → **`/diagnosing-bugs`**. For the hard ones: the bug that resists a first glance, the intermittent flake, the regression that crept in between two known-good states. It refuses to theorise until it has a **tight feedback loop** (one command that already goes red on *this* bug), then fixes with a regression test. Its post-mortem hands off to **`/improve-codebase-architecture`** when the real finding is that there's no good seam to lock the bug down.
|
|
43
|
+
|
|
44
|
+
- **A huge, foggy effort: a greenfield project or a huge feature build, too big for one session** → **`/wayfinder`**, the most cognitively demanding flow here. When the way from here to the destination isn't visible yet, it charts a **shared map** of **decision tickets** on the issue tracker and resolves them one at a time, producing **decisions, not deliverables**, until the fog is pushed back and the way is clear. Where **`/grill-with-docs`** sharpens an idea you can hold in one session, wayfinder is for the idea you can't, and it's slower and denser, so save it for exactly that, never a well-scoped feature.
|
|
45
|
+
|
|
46
|
+
When the map clears, **it hands off, it doesn't build**: merge onto the main flow at **`/to-spec`**, which collapses the map's linked decisions into a buildable plan, then `/to-tickets` and `/implement` as usual. Looping the map straight into `/implement` skips that collapse and throws the linked detail away, so go straight to `/implement` only when the effort turned out genuinely small.
|
|
47
|
+
|
|
48
|
+
## Codebase health
|
|
49
|
+
|
|
50
|
+
Not feature work, just upkeep.
|
|
51
|
+
|
|
52
|
+
- **`/improve-codebase-architecture`** runs whenever you have a spare moment to keep the codebase good for agents to operate in. It surfaces **deepening opportunities**; picking one _generates an idea_ you can take into the main flow at `/grill-with-docs`. It's the survey that finds the candidates; **`/codebase-design`** (below) is the bench you design the chosen one on.
|
|
53
|
+
|
|
54
|
+
## Vocabulary underneath
|
|
55
|
+
|
|
56
|
+
Two model-invoked references that run *beneath* the other skills, each the single source of truth for its vocabulary. Reach for them directly when the **words**, not the process, are the problem; or let the skills above pull them in.
|
|
57
|
+
|
|
58
|
+
- **`/domain-modeling`**: sharpen the project's *domain* language: challenge a fuzzy term, resolve an overloaded word ("account" doing three jobs), record a hard-to-reverse decision as an ADR. It's the active discipline `/grill-with-docs` drives to keep `CONTEXT.md` a clean glossary.
|
|
59
|
+
- **`/codebase-design`** is the deep-module vocabulary (module, interface, depth, seam, adapter, leverage, locality) for designing a module's *shape*: a lot of behaviour behind a small interface at a clean seam. `/tdd` and `/improve-codebase-architecture` both speak it.
|
|
60
|
+
|
|
61
|
+
## Phase boundaries
|
|
62
|
+
|
|
63
|
+
A **phase** is a chunk of work inside a session: the grilling, the implementation, the QA. At the **boundary** between two of them you have five options, and picking between them is the fuzziest decision in this whole map:
|
|
64
|
+
|
|
65
|
+
- **Continue**: stay put. Costs nothing, loses nothing.
|
|
66
|
+
- **`/clear`**: empty the window, when nothing here matters to what's next.
|
|
67
|
+
- **`/handoff`** writes a portable markdown file. Narrow: only for a **new harness**, a **new directory**, a **colleague**, or forking a side task **mid-phase**. What it buys is portability.
|
|
68
|
+
- **Subagent**: send a tightly-scoped task to its own window and get a report back.
|
|
69
|
+
- **`/compact`** compresses this context and seeds a fresh session with it. The **default**, at the bottom of the tree rather than the first reach.
|
|
70
|
+
|
|
71
|
+
Read [PHASE-BOUNDARIES.md](PHASE-BOUNDARIES.md) for the ordered tree: the five questions, the reasoning behind each branch, and why the primary-source cost makes **Continue** the one to rule out first. Make the decision **at** a boundary; mid-phase, continue or split the rest into subagents.
|
|
72
|
+
|
|
73
|
+
## Standalone
|
|
74
|
+
|
|
75
|
+
Off the main flow entirely.
|
|
76
|
+
|
|
77
|
+
- **`/grill-me`**: the same relentless interview as `/grill-with-docs`, but **stateless**: it saves nothing locally and builds no `CONTEXT.md`. Reach for it when you are **not working in a working directory** (sharpening a plan, a design, a piece of writing, anything with no repo under it). If you are in a working directory, use `/grill-with-docs` instead: it runs the same interview and leaves a paper trail, so it is strictly the better one.
|
|
78
|
+
- **`/grilling`** is the interview primitive itself: rounds, the frontier, facts are the agent's job and decisions are yours. `/grill-me` and `/grill-with-docs` are the two named ways in, and `/triage`, `/wayfinder` and `/improve-codebase-architecture` all run it internally. Reach for it directly only when you want the interview with no wrapper around it.
|
|
79
|
+
- **`/resolving-merge-conflicts`** works an in-progress merge or rebase conflict hunk by hunk, resolving by **intent** traced to each side's primary source rather than by picking lines, then finishes the operation. It never runs `--abort`. Standalone and off every flow: reach for it when you are already mid-conflict.
|
|
80
|
+
- **`/prototype`** is a small, throwaway program that answers one design question: does this state model feel right, or what should this UI look like. Throwaway is a constraint on how the code is written, not a promise to destroy it: the answer folds into the real code, and the prototype itself is kept as a **primary source** on a `prototype/<name>` branch out of main, pointed at from the implementation issue. It's the detour in step 2 of the main flow, but reach for it any time a design question is hard to settle on paper.
|
|
81
|
+
- **`/research`**: delegate reading legwork to a **background agent**: it investigates a question against **primary sources**, then leaves a cited Markdown file in the repo. Keep working while it reads. The file it produces is something to take *into* the main flow at `/grill-with-docs`, since research feeds the thinking rather than replacing it.
|
|
82
|
+
- **`/to-questionnaire`** comes in when the thing blocking you isn't in your head or the codebase but in **someone else's**, and it writes them a questionnaire to fill in. It's the inverse of `/grill-me`: instead of interviewing you about the subject, it interviews you about the **send** (who it's going to, what you need back) and aims the questions at the gap. What comes back is material for `/grill-with-docs` or `/to-spec`.
|
|
83
|
+
- **`/wizard`** is for the steps only a **human** can take: provisioning infrastructure, setting up credentials or CI secrets, clicking through an unfamiliar third-party dashboard, running a one-off migration or cutover. It generates an interactive bash script that opens each URL, captures each value, and writes it into `.env` and GitHub secrets, so the procedure stops being something you re-explain to an agent every time. Model-invoked, so the agent reaches for it the moment it hits a wall only you can pass. If the agent could just do it itself, it should; this is for where a human is genuinely in the loop.
|
|
84
|
+
- **`/wait-what`** is the corrective for a message that didn't land. Use it mid-conversation, inside any other skill, and the agent re-pitches what it just said with the context you were missing, in plain English, using the `CONTEXT.md` vocabulary. It works after the fact; `/grill-with-docs` is the upfront cure, because a shared language agreed early is what stops the jargon arriving at all.
|
|
85
|
+
- **`/teach`**: learn a concept over multiple sessions, using the current directory as a stateful workspace.
|
|
86
|
+
- **`/writing-for-agents`** is the reference for writing documents agents consume: skills, AGENTS.md, pointed-at docs.
|
|
87
|
+
|
|
88
|
+
## Precondition
|
|
89
|
+
|
|
90
|
+
**`/setup-matt-pocock-skills`**: run before your first engineering flow to configure the issue tracker, triage labels, and doc layout the other skills assume. Custom issue trackers also work.
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ci-guard
|
|
3
|
+
description: "Guard the GitHub Actions release pipeline: orchestrate workflow flow, enforce pre-release verification, and self-correct after publish. Use when CI is flaky/failing, when setting up or editing .github/workflows/ci.yml, or before tagging a release to npm."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# CI Guard
|
|
7
|
+
|
|
8
|
+
**guard** 为领衔词的发布门禁技能:以一次**可复现的失败**为起点,把 `verify → build → publish` 编排成不可绕过的门,把**预发布校验**做成硬门槛,把**发布后自纠**做成闭环。本技能沉淀自 `heihei0299/pi-switch` 23 次运行中 14 次失败的复盘(见 `.scratch/research/ci-actions-调研.md`)——不替代 `diagnose-fix` 的通用诊断,只收敛 CI/发布这一条链。
|
|
9
|
+
|
|
10
|
+
## 何时用
|
|
11
|
+
|
|
12
|
+
- Actions 持续红 / 偶发红(尤其是 `verify` 单点红而 `publish` 仍绿)
|
|
13
|
+
- 新建或改动 `.github/workflows/ci.yml`、调整 `cargo test` / `clippy` / `rustfmt` 参数
|
|
14
|
+
- 打 tag 前、发 npm 前、或发布后需要自检/回滚
|
|
15
|
+
|
|
16
|
+
## 三段式门禁
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
① 编排 flows → ② 预发布 gate → ③ 发布后自纠
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
每段有**完成条件**(可验证),未满足不进入下一段。
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
### ① 编排 flows —— 让工作流不可被绕过
|
|
27
|
+
|
|
28
|
+
**做**:
|
|
29
|
+
- `on`:`push.tags: ["v*"]` **必须**同时配 `push.branches: [main]`(或 `master`)+ `pull_request.branches: [main]` + `workflow_dispatch`。否则直推 `main` 的修复(如 `2d68f62`)无法被 CI 验证,tag 才暴露问题
|
|
30
|
+
- `jobs` 依赖:`publish.needs: [build, verify]`,**禁止** `needs: build` 单依赖。门禁失效的直接原因就是 `verify` 红仍发包
|
|
31
|
+
- `permissions` 最小化:`verify`/`build` 只需 `contents: read`,仅 `publish` 保留 `contents: write` + `packages: write`(或 `id-token: write` 若用 OIDC)
|
|
32
|
+
- `concurrency`:`group: ci-${{ github.ref }}` + `cancel-in-progress: true`,避免同分支并行互踩
|
|
33
|
+
|
|
34
|
+
**完成条件**:
|
|
35
|
+
- [ ] `git diff HEAD -- .github/workflows/ci.yml` 显示 `on.push.branches` 存在
|
|
36
|
+
- [ ] `publish.needs` 包含 `verify`
|
|
37
|
+
- [ ] `workflow_dispatch` 可手动触发全量
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
### ② 预发布 gate —— 测试 GitHub Action 流程
|
|
42
|
+
|
|
43
|
+
本段是**硬门槛**,顺序固定:`action lint → workflow dry-run → dispatch 验证`,任一步红即阻断 `publish`。
|
|
44
|
+
|
|
45
|
+
**action lint**:
|
|
46
|
+
- `actionlint` 校验 `.github/workflows/ci.yml` 语法与 `on/needs/permissions` 完整性
|
|
47
|
+
- `yamllint` 检查缩进与重复键
|
|
48
|
+
|
|
49
|
+
**workflow dry-run**:
|
|
50
|
+
- `act --dry-run` 或 `gh workflow view` 模拟 `verify/build/publish` 三 job 依赖与 `if` 条件
|
|
51
|
+
- 校验 `publish.needs` 含 `verify` 且 `workflow_dispatch` 可手动触发
|
|
52
|
+
|
|
53
|
+
**dispatch 验证**:
|
|
54
|
+
- 通过 `gh workflow run ci.yml --ref main -f dry_run=true` 触发试运行,观察 `verify` 日志与产物上传
|
|
55
|
+
- 失败即阻断 `publish`,日志留存于 Actions
|
|
56
|
+
|
|
57
|
+
**完成条件**:
|
|
58
|
+
- [ ] `actionlint` 0 error
|
|
59
|
+
- [ ] `act --dry-run` 三 job 依赖正确
|
|
60
|
+
- [ ] `workflow_dispatch` 试运行通过
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
### ③ 发布后自纠 —— 发出去的包自己负责
|
|
65
|
+
|
|
66
|
+
**发布时**:
|
|
67
|
+
- `npm publish --access public` 仅在 `if: startsWith(github.ref, 'refs/tags/v')` 且 `needs` 全绿时执行
|
|
68
|
+
- 发布前 `actions/download-artifact` 校验 `if-no-files-found: error`,发布后 `npm view <pkg>@<version> version` 回读确认
|
|
69
|
+
|
|
70
|
+
**自纠**:
|
|
71
|
+
- 失败即 **阻断**:`verify` 红 → `publish` 不执行(由 `needs` 保证);`publish` 自身失败(`409 already exists` / `401`)→ 工作流整体 `failure`,不静默
|
|
72
|
+
- 发布后 30s 内 `curl https://registry.npmjs.org/<pkg>/<version>` 校验可用;失败则 `gh issue create --title "chore(release): vX.Y.Z 发布后自检失败" --body "run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"` 并 `gh release delete vX.Y.Z --yes`(或 `npm unpublish <pkg>@<version>` 在 72h 内)
|
|
73
|
+
- `workflow_dispatch` 支持 `inputs.rollback_version` 手动回滚
|
|
74
|
+
|
|
75
|
+
**完成条件**:
|
|
76
|
+
- [ ] `npm view` 回读与 tag 一致
|
|
77
|
+
- [ ] 失败路径有 issue/通知(非静默)
|
|
78
|
+
- [ ] `git tag` 与 `package.json version` 一致(`scripts/release.sh` 或 `npm version` 保证)
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## 反模式
|
|
83
|
+
|
|
84
|
+
- **单依赖 publish**:`needs: build` 是本仓 7 次带病发布的根因
|
|
85
|
+
- **仅 tag 触发**:`push.branches` 缺失导致主干修复无 CI
|
|
86
|
+
- **静默发布**:`publish` 失败不建 issue / 不删 tag,下次 `409` 叠加
|
|
87
|
+
- **`-A clippy::all`**:掩盖真实告警
|
|
88
|
+
|
|
89
|
+
## 引用
|
|
90
|
+
|
|
91
|
+
- 调研:`.scratch/research/ci-actions-调研.md`(23 次运行全量、`proxy.rs:115` vs `config.rs:460` 对比)
|
|
92
|
+
- 修复:`2d68f62 fix(ci): gate publish on verify and serialize Rust tests`
|
|
93
|
+
- 关联技能:`diagnose-fix`(通用诊断)、`commit-check`(提交前门禁)、`tdd`(测试隔离后的回归)
|
|
94
|
+
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: code-review
|
|
3
|
+
description: "Review the changes since a fixed point (commit, branch, tag, or merge-base) along two axes: Standards (does the code follow this repo's documented coding standards?) and Spec (does the code match what the originating issue/spec asked for?). Runs both reviews in parallel sub-agents and reports them side by side. Use when the user wants to review a branch, a PR, work-in-progress changes, or asks to \"review since X\"."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Two-axis review of the diff between `HEAD` and a fixed point the user supplies:
|
|
7
|
+
|
|
8
|
+
- **Standards**: does the code conform to this repo's documented coding standards?
|
|
9
|
+
- **Spec**: does the code faithfully implement the originating issue / spec?
|
|
10
|
+
|
|
11
|
+
Both axes run as **parallel sub-agents** so they don't pollute each other's context, then this skill aggregates their findings.
|
|
12
|
+
|
|
13
|
+
The issue tracker should have been provided to you. If `docs/agents/issue-tracker.md` is missing, tell the user to run `/setup-matt-pocock-skills`.
|
|
14
|
+
|
|
15
|
+
## Process
|
|
16
|
+
|
|
17
|
+
### 1. Pin the fixed point
|
|
18
|
+
|
|
19
|
+
Whatever the user said is the fixed point (a commit SHA, branch name, tag, `main`, `HEAD~5`, etc.). If they didn't specify one, ask for it.
|
|
20
|
+
|
|
21
|
+
Capture the diff command once: `git diff <fixed-point>...HEAD` (three-dot, so the comparison is against the merge-base). Also note the list of commits via `git log <fixed-point>..HEAD --oneline`.
|
|
22
|
+
|
|
23
|
+
Before going further, confirm the fixed point resolves (`git rev-parse <fixed-point>`) and the diff is non-empty. A bad ref or empty diff should fail here, not inside two parallel sub-agents.
|
|
24
|
+
|
|
25
|
+
### 2. Identify the spec source
|
|
26
|
+
|
|
27
|
+
Look for the originating spec, in this order:
|
|
28
|
+
|
|
29
|
+
1. Issue references in the commit messages (`#123`, `Closes #45`, GitLab `!67`, etc.), fetched via the workflow in `docs/agents/issue-tracker.md`.
|
|
30
|
+
2. A path the user passed as an argument.
|
|
31
|
+
3. A spec file under `docs/`, `specs/`, or `.scratch/` matching the branch name or feature.
|
|
32
|
+
4. If nothing is found, ask the user where the spec is. If they say there isn't one, the **Spec** sub-agent will skip and report "no spec available".
|
|
33
|
+
|
|
34
|
+
### 3. Identify the standards sources
|
|
35
|
+
|
|
36
|
+
Anything in the repo that documents how code should be written, such as `CODING_STANDARDS.md` or `CONTRIBUTING.md`.
|
|
37
|
+
|
|
38
|
+
On top of whatever the repo documents, the Standards axis always carries the **smell baseline** below: a fixed set of Fowler code smells (_Refactoring_, ch.3) that applies even when a repo documents nothing. Two rules bind it:
|
|
39
|
+
|
|
40
|
+
- **The repo overrides.** A documented repo standard always wins; where it endorses something the baseline would flag, suppress the smell.
|
|
41
|
+
- **Always a judgement call.** Each smell is a labelled heuristic ("possible Feature Envy"), never a hard violation. Like any standard here, skip anything tooling already enforces.
|
|
42
|
+
|
|
43
|
+
Each smell reads *what it is* → *how to fix*; match it against the diff:
|
|
44
|
+
|
|
45
|
+
- **Mysterious Name**: a function, variable, or type whose name doesn't reveal what it does or holds. → rename it; if no honest name comes, the design's murky.
|
|
46
|
+
- **Duplicated Code**: the same logic shape appears in more than one hunk or file in the change. → extract the shared shape, call it from both.
|
|
47
|
+
- **Feature Envy**: a method that reaches into another object's data more than its own. → move the method onto the data it envies.
|
|
48
|
+
- **Data Clumps**: the same few fields or params keep travelling together (a type wanting to be born). → bundle them into one type, pass that.
|
|
49
|
+
- **Primitive Obsession**: a primitive or string standing in for a domain concept that deserves its own type. → give the concept its own small type.
|
|
50
|
+
- **Repeated Switches**: the same `switch`/`if`-cascade on the same type recurs across the change. → replace with polymorphism, or one map both sites share.
|
|
51
|
+
- **Shotgun Surgery**: one logical change forces scattered edits across many files in the diff. → gather what changes together into one module.
|
|
52
|
+
- **Divergent Change**: one file or module is edited for several unrelated reasons. → split so each module changes for one reason.
|
|
53
|
+
- **Speculative Generality**: abstraction, parameters, or hooks added for needs the spec doesn't have. → delete it; inline back until a real need shows.
|
|
54
|
+
- **Message Chains**: long `a.b().c().d()` navigation the caller shouldn't depend on. → hide the walk behind one method on the first object.
|
|
55
|
+
- **Middle Man**: a class or function that mostly just delegates onward. → cut it, call the real target direct.
|
|
56
|
+
- **Refused Bequest**: a subclass or implementer that ignores or overrides most of what it inherits. → drop the inheritance, use composition.
|
|
57
|
+
|
|
58
|
+
### 4. Spawn both sub-agents in parallel
|
|
59
|
+
|
|
60
|
+
**Standards sub-agent prompt** should include:
|
|
61
|
+
|
|
62
|
+
- The full diff command and commit list.
|
|
63
|
+
- The list of standards-source files you found in step 3, **plus the smell baseline from step 3** pasted in full (the sub-agent has no other access to it).
|
|
64
|
+
- The brief: "Report, per file/hunk where relevant, (a) every place the diff violates a documented standard: cite the standard (file + the rule); and (b) any baseline smell you spot: name it and quote the hunk. Distinguish hard violations from judgement calls: documented-standard breaches can be hard, but baseline smells are always judgement calls, and a documented repo standard overrides the baseline. Skip anything tooling enforces. Under 400 words."
|
|
65
|
+
|
|
66
|
+
**Spec sub-agent prompt** should include:
|
|
67
|
+
|
|
68
|
+
- The diff command and commit list.
|
|
69
|
+
- The path or fetched contents of the spec.
|
|
70
|
+
- The brief: "Report: (a) requirements the spec asked for that are missing or partial; (b) behaviour in the diff that wasn't asked for (scope creep); (c) requirements that look implemented but where the implementation looks wrong. Quote the spec line for each finding. Under 400 words."
|
|
71
|
+
|
|
72
|
+
If the spec is missing, skip the Spec sub-agent and note this in the final report.
|
|
73
|
+
|
|
74
|
+
### 5. Aggregate
|
|
75
|
+
|
|
76
|
+
Present the two reports under `## Standards` and `## Spec` headings, verbatim or lightly cleaned. Do **not** merge or rerank findings, because the two axes are deliberately separate (see _Why two axes_).
|
|
77
|
+
|
|
78
|
+
End with a one-line summary: total findings per axis, and the worst issue _within each axis_ (if any). Don't pick a single winner across axes: that's the reranking the separation exists to prevent.
|
|
79
|
+
|
|
80
|
+
## Why two axes
|
|
81
|
+
|
|
82
|
+
A change can pass one axis and fail the other:
|
|
83
|
+
|
|
84
|
+
- Code that follows every standard but implements the wrong thing → **Standards pass, Spec fail.**
|
|
85
|
+
- Code that does exactly what the issue asked but breaks the project's conventions → **Spec pass, Standards fail.**
|
|
86
|
+
|
|
87
|
+
Reporting them separately stops one axis from masking the other.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Deepening
|
|
2
|
+
|
|
3
|
+
How to deepen a cluster of shallow modules safely, given its dependencies. Assumes the vocabulary in [SKILL.md](SKILL.md): **module**, **interface**, **seam**, **adapter**.
|
|
4
|
+
|
|
5
|
+
## Dependency categories
|
|
6
|
+
|
|
7
|
+
When assessing a candidate for deepening, classify its dependencies. The category determines how the deepened module is tested across its seam.
|
|
8
|
+
|
|
9
|
+
### 1. In-process
|
|
10
|
+
|
|
11
|
+
Pure computation, in-memory state, no I/O. Always deepenable: merge the modules and test through the new interface directly. No adapter needed.
|
|
12
|
+
|
|
13
|
+
### 2. Local-substitutable
|
|
14
|
+
|
|
15
|
+
Dependencies that have local test stand-ins (PGLite for Postgres, in-memory filesystem). Deepenable if the stand-in exists. The deepened module is tested with the stand-in running in the test suite. The seam is internal; no port at the module's external interface.
|
|
16
|
+
|
|
17
|
+
### 3. Remote but owned (Ports & Adapters)
|
|
18
|
+
|
|
19
|
+
Your own services across a network boundary (microservices, internal APIs). Define a **port** (interface) at the seam. The deep module owns the logic; the transport is injected as an **adapter**. Tests use an in-memory adapter. Production uses an HTTP/gRPC/queue adapter.
|
|
20
|
+
|
|
21
|
+
Recommendation shape: *"Define a port at the seam, implement an HTTP adapter for production and an in-memory adapter for testing, so the logic sits in one deep module even though it's deployed across a network."*
|
|
22
|
+
|
|
23
|
+
### 4. True external (Mock)
|
|
24
|
+
|
|
25
|
+
Third-party services (Stripe, Twilio, etc.) you don't control. The deepened module takes the external dependency as an injected port; tests provide a mock adapter.
|
|
26
|
+
|
|
27
|
+
## Seam discipline
|
|
28
|
+
|
|
29
|
+
- **One adapter means a hypothetical seam. Two adapters means a real one.** Don't introduce a port unless at least two adapters are justified (typically production + test). A single-adapter seam is just indirection.
|
|
30
|
+
- **Internal seams vs external seams.** A deep module can have internal seams (private to its implementation, used by its own tests) as well as the external seam at its interface. Don't expose internal seams through the interface just because tests use them.
|
|
31
|
+
|
|
32
|
+
## Testing strategy: replace, don't layer
|
|
33
|
+
|
|
34
|
+
- Old unit tests on shallow modules become waste once tests at the deepened module's interface exist; delete them.
|
|
35
|
+
- Write new tests at the deepened module's interface. The **interface is the test surface**.
|
|
36
|
+
- Tests assert on observable outcomes through the interface, not internal state.
|
|
37
|
+
- Tests should survive internal refactors, since they describe behaviour, not implementation. If a test has to change when the implementation changes, it's testing past the interface.
|