@phuc1403/musketeer 0.8.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/INSTALLATION.md +52 -52
- package/README.md +49 -49
- package/bin/musketeer.js +168 -168
- package/manifest.json +333 -301
- package/package.json +48 -48
- package/src/dotnet-scaffold-copier.js +79 -79
- package/src/provisioner/detect.js +93 -93
- package/src/self-update.js +77 -77
- package/template/.claude/agents/code-reviewer.md +182 -166
- package/template/.claude/agents/git-manager.md +18 -18
- package/template/.claude/agents/hallmark-auditor.md +78 -78
- package/template/.claude/agents/researcher.md +33 -33
- package/template/.claude/hooks/block-unsafe-adr-title.cjs +85 -85
- package/template/.claude/hooks/git-skill-reminder.cjs +53 -0
- package/template/.claude/hooks/init-adr-dir.cjs +173 -173
- package/template/.claude/hooks/inject-adr-flags.cjs +94 -94
- package/template/.claude/hooks/lib/adr/command-scan.cjs +115 -115
- package/template/.claude/hooks/lib/characteristics/checker.cjs +357 -357
- package/template/.claude/hooks/lib/colors.cjs +180 -122
- package/template/.claude/hooks/lib/git-info-cache.cjs +191 -191
- package/template/.claude/hooks/lib/transcript-parser.cjs +300 -277
- package/template/.claude/hooks/sync-adr-toc.cjs +146 -146
- package/template/.claude/hooks/{usage-context-awareness.cjs → usage-quota-cache-refresh.cjs} +166 -166
- package/template/.claude/hooks/validate-characteristics-hook.cjs +66 -66
- package/template/.claude/hooks/validate-cml-hook.js +145 -145
- package/template/.claude/skills/adr-writer/SKILL.md +48 -48
- package/template/.claude/skills/adr-writer/references/adr-example.md +35 -35
- package/template/.claude/skills/architecture-characteristic-writer/SKILL.md +215 -215
- package/template/.claude/skills/architecture-characteristic-writer/assets/worksheet-template.md +29 -29
- package/template/.claude/skills/architecture-characteristic-writer/references/characteristics-catalog.md +40 -40
- package/template/.claude/skills/architecture-characteristic-writer/scripts/ranking-table.cjs +171 -171
- package/template/.claude/skills/code-review/SKILL.md +201 -54
- package/template/.claude/skills/code-review/references/checklist-workflow.md +96 -0
- package/template/.claude/skills/code-review/references/checklists/api.md +52 -52
- package/template/.claude/skills/code-review/references/checklists/base.md +100 -100
- package/template/.claude/skills/code-review/references/checklists/web-app.md +54 -54
- package/template/.claude/skills/code-review/references/code-review-reception.md +113 -0
- package/template/.claude/skills/code-review/references/codebase-scan-workflow.md +30 -0
- package/template/.claude/skills/code-review/references/edge-case-scouting.md +119 -0
- package/template/.claude/skills/code-review/references/input-mode-resolution.md +135 -0
- package/template/.claude/skills/code-review/references/parallel-review-workflow.md +76 -0
- package/template/.claude/skills/code-review/references/requesting-code-review.md +116 -0
- package/template/.claude/skills/code-review/references/spec-compliance-review.md +43 -0
- package/template/.claude/skills/code-review/references/task-management-reviews.md +140 -0
- package/template/.claude/skills/code-review/references/verification-before-completion.md +139 -0
- package/template/.claude/skills/context-map/SKILL.md +80 -80
- package/template/.claude/skills/context-map/example.cml +106 -106
- package/template/.claude/skills/context-map/reference/Bounded Context/Bounded Context.md +40 -40
- package/template/.claude/skills/context-map/reference/Bounded Context/businessModel.md +5 -5
- package/template/.claude/skills/context-map/reference/Bounded Context/domainVisionStatement.md +2 -2
- package/template/.claude/skills/context-map/reference/Bounded Context/evolution.md +5 -5
- package/template/.claude/skills/context-map/reference/Bounded Context/implementationTechnology.md +1 -1
- package/template/.claude/skills/context-map/reference/Bounded Context/implements.md +1 -1
- package/template/.claude/skills/context-map/reference/Bounded Context/knowledgeLevel.md +4 -4
- package/template/.claude/skills/context-map/reference/Bounded Context/realizes.md +9 -9
- package/template/.claude/skills/context-map/reference/Bounded Context/refines.md +10 -10
- package/template/.claude/skills/context-map/reference/Bounded Context/responsibilities.md +26 -26
- package/template/.claude/skills/context-map/reference/Bounded Context/type.md +23 -23
- package/template/.claude/skills/context-map/reference/Bounded Context Relationship/Anticorruption Layer.md +5 -5
- package/template/.claude/skills/context-map/reference/Bounded Context Relationship/Bounded Context Relationship.md +12 -12
- package/template/.claude/skills/context-map/reference/Bounded Context Relationship/Conformist.md +5 -5
- package/template/.claude/skills/context-map/reference/Bounded Context Relationship/Customer-Supplier (C-S).md +22 -22
- package/template/.claude/skills/context-map/reference/Bounded Context Relationship/Open Host Service.md +4 -4
- package/template/.claude/skills/context-map/reference/Bounded Context Relationship/Partnership (P).md +13 -13
- package/template/.claude/skills/context-map/reference/Bounded Context Relationship/Published Language.md +4 -4
- package/template/.claude/skills/context-map/reference/Bounded Context Relationship/Shared Kernel (SK).md +12 -12
- package/template/.claude/skills/context-map/reference/Context Map.md +62 -62
- package/template/.claude/skills/context-map/reference/Domain/Domain.md +30 -30
- package/template/.claude/skills/context-map/reference/Domain/supports.md +33 -33
- package/template/.claude/skills/context-map/reference/Domain/type.md +3 -3
- package/template/.claude/skills/context-map/reference/Semantic Rules.md +32 -32
- package/template/.claude/skills/git/SKILL.md +131 -115
- package/template/.claude/skills/git/references/branch-management.md +88 -88
- package/template/.claude/skills/git/references/commit-standards.md +46 -46
- package/template/.claude/skills/git/references/context-efficiency.md +54 -0
- package/template/.claude/skills/git/references/gh-cli-guide.md +109 -109
- package/template/.claude/skills/git/references/safety-protocols.md +69 -69
- package/template/.claude/skills/git/references/workflow-commit.md +58 -58
- package/template/.claude/skills/git/references/workflow-merge-pr.md +136 -0
- package/template/.claude/skills/git/references/workflow-merge.md +48 -48
- package/template/.claude/skills/git/references/workflow-pr.md +58 -58
- package/template/.claude/skills/git/references/workflow-push.md +52 -52
- package/template/.claude/skills/hallmark/SKILL.md +552 -552
- package/template/.claude/skills/hallmark/references/anti-patterns.md +412 -412
- package/template/.claude/skills/hallmark/references/assets.md +406 -406
- package/template/.claude/skills/hallmark/references/color.md +95 -95
- package/template/.claude/skills/hallmark/references/component-cookbook.md +256 -256
- package/template/.claude/skills/hallmark/references/components/c1-outlined-chip.md +12 -12
- package/template/.claude/skills/hallmark/references/components/c2-inline-form-as-cta.md +16 -16
- package/template/.claude/skills/hallmark/references/components/c3-typographic-link.md +8 -8
- package/template/.claude/skills/hallmark/references/components/c4-sticky-bottom-bar.md +16 -16
- package/template/.claude/skills/hallmark/references/components/f1-bento-grid.md +20 -20
- package/template/.claude/skills/hallmark/references/components/f2-sticky-scroll-stack.md +20 -20
- package/template/.claude/skills/hallmark/references/components/f3-tabular-spec-sheet.md +11 -11
- package/template/.claude/skills/hallmark/references/components/f4-step-sequence.md +11 -11
- package/template/.claude/skills/hallmark/references/components/f5-annotated-screenshot.md +11 -11
- package/template/.claude/skills/hallmark/references/components/f6-product-card-grid.md +41 -41
- package/template/.claude/skills/hallmark/references/components/ft1-mast-headed.md +13 -13
- package/template/.claude/skills/hallmark/references/components/ft2-inline-rule-single-line.md +10 -10
- package/template/.claude/skills/hallmark/references/components/ft3-index-style-category-list.md +12 -12
- package/template/.claude/skills/hallmark/references/components/ft4-dense-typographic.md +10 -10
- package/template/.claude/skills/hallmark/references/components/ft5-statement.md +21 -21
- package/template/.claude/skills/hallmark/references/components/ft6-letter-close.md +19 -19
- package/template/.claude/skills/hallmark/references/components/ft7-newsletter-first.md +27 -27
- package/template/.claude/skills/hallmark/references/components/ft8-marquee-scroll.md +25 -25
- package/template/.claude/skills/hallmark/references/components/h1-marquee.md +15 -15
- package/template/.claude/skills/hallmark/references/components/h2-split-diptych.md +15 -15
- package/template/.claude/skills/hallmark/references/components/h3-quote-led.md +11 -11
- package/template/.claude/skills/hallmark/references/components/h4-stat-led.md +14 -14
- package/template/.claude/skills/hallmark/references/components/h5-letter-hero.md +11 -11
- package/template/.claude/skills/hallmark/references/components/h6-photographic-fold.md +16 -16
- package/template/.claude/skills/hallmark/references/components/h7-demo-video-clipped-by-viewport-edge.md +27 -27
- package/template/.claude/skills/hallmark/references/components/h8-mockup-split-browser-framed.md +23 -23
- package/template/.claude/skills/hallmark/references/components/h9-custom-illustration-centerpiece.md +27 -27
- package/template/.claude/skills/hallmark/references/components/n1-wordmark-2-links.md +12 -12
- package/template/.claude/skills/hallmark/references/components/n10-floating-on-scroll-morph.md +19 -19
- package/template/.claude/skills/hallmark/references/components/n2-floating-chip.md +14 -14
- package/template/.claude/skills/hallmark/references/components/n3-side-rail.md +14 -14
- package/template/.claude/skills/hallmark/references/components/n4-hidden-behind-k.md +9 -9
- package/template/.claude/skills/hallmark/references/components/n5-floating-pill.md +28 -28
- package/template/.claude/skills/hallmark/references/components/n6-newspaper-masthead.md +24 -24
- package/template/.claude/skills/hallmark/references/components/n7-brutal-slab.md +22 -22
- package/template/.claude/skills/hallmark/references/components/n8-terminal-command.md +21 -21
- package/template/.claude/skills/hallmark/references/components/n9-edge-aligned-minimal.md +17 -17
- package/template/.claude/skills/hallmark/references/components/s1-left-margin-numbered.md +15 -15
- package/template/.claude/skills/hallmark/references/components/s2-hanging.md +13 -13
- package/template/.claude/skills/hallmark/references/components/s3-sticky-pinned.md +19 -19
- package/template/.claude/skills/hallmark/references/components/s4-inline-no-break.md +11 -11
- package/template/.claude/skills/hallmark/references/components/s5-bottom-anchored.md +13 -13
- package/template/.claude/skills/hallmark/references/components/t1-pull-quote-with-marginalia.md +12 -12
- package/template/.claude/skills/hallmark/references/components/t2-logo-wall-hairline.md +19 -19
- package/template/.claude/skills/hallmark/references/components/t3-single-huge-quote.md +11 -11
- package/template/.claude/skills/hallmark/references/components/t4-numbered-stat-strip.md +14 -14
- package/template/.claude/skills/hallmark/references/contract.md +24 -24
- package/template/.claude/skills/hallmark/references/copy.md +182 -182
- package/template/.claude/skills/hallmark/references/custom-craft.md +626 -626
- package/template/.claude/skills/hallmark/references/custom-theme.md +329 -329
- package/template/.claude/skills/hallmark/references/design-md.md +116 -116
- package/template/.claude/skills/hallmark/references/export-formats.md +328 -328
- package/template/.claude/skills/hallmark/references/floating-nav.md +89 -89
- package/template/.claude/skills/hallmark/references/genres/atmospheric.md +65 -65
- package/template/.claude/skills/hallmark/references/genres/editorial.md +70 -70
- package/template/.claude/skills/hallmark/references/genres/modern-minimal.md +67 -67
- package/template/.claude/skills/hallmark/references/genres/playful.md +65 -65
- package/template/.claude/skills/hallmark/references/hero-enrichment.md +474 -474
- package/template/.claude/skills/hallmark/references/imagery-kit.md +170 -170
- package/template/.claude/skills/hallmark/references/interaction-and-states.md +207 -207
- package/template/.claude/skills/hallmark/references/layout-and-space.md +111 -111
- package/template/.claude/skills/hallmark/references/macrostructures/01-bento-grid.md +35 -35
- package/template/.claude/skills/hallmark/references/macrostructures/02-long-document.md +34 -34
- package/template/.claude/skills/hallmark/references/macrostructures/03-marquee-hero.md +31 -31
- package/template/.claude/skills/hallmark/references/macrostructures/04-stat-led.md +32 -32
- package/template/.claude/skills/hallmark/references/macrostructures/05-workbench.md +32 -32
- package/template/.claude/skills/hallmark/references/macrostructures/06-conversational-faq.md +33 -33
- package/template/.claude/skills/hallmark/references/macrostructures/07-manifesto.md +32 -32
- package/template/.claude/skills/hallmark/references/macrostructures/08-photographic.md +34 -34
- package/template/.claude/skills/hallmark/references/macrostructures/09-quote-led.md +32 -32
- package/template/.claude/skills/hallmark/references/macrostructures/10-specimen.md +32 -32
- package/template/.claude/skills/hallmark/references/macrostructures/11-catalogue.md +23 -23
- package/template/.claude/skills/hallmark/references/macrostructures/12-letter.md +23 -23
- package/template/.claude/skills/hallmark/references/macrostructures/13-index-first.md +23 -23
- package/template/.claude/skills/hallmark/references/macrostructures/14-narrative-workflow.md +23 -23
- package/template/.claude/skills/hallmark/references/macrostructures/15-split-studio.md +23 -23
- package/template/.claude/skills/hallmark/references/macrostructures/16-feature-stack.md +23 -23
- package/template/.claude/skills/hallmark/references/macrostructures/17-type-specimen.md +23 -23
- package/template/.claude/skills/hallmark/references/macrostructures/18-portfolio-grid.md +23 -23
- package/template/.claude/skills/hallmark/references/macrostructures/19-map-diagram.md +23 -23
- package/template/.claude/skills/hallmark/references/macrostructures/20-ecosystem-index.md +23 -23
- package/template/.claude/skills/hallmark/references/macrostructures/21-component-playground.md +23 -23
- package/template/.claude/skills/hallmark/references/macrostructures.md +89 -89
- package/template/.claude/skills/hallmark/references/microinteractions.md +260 -260
- package/template/.claude/skills/hallmark/references/motion.md +109 -109
- package/template/.claude/skills/hallmark/references/preview-examples.md +49 -49
- package/template/.claude/skills/hallmark/references/responsive.md +138 -138
- package/template/.claude/skills/hallmark/references/slop-test.md +205 -205
- package/template/.claude/skills/hallmark/references/structure.md +164 -164
- package/template/.claude/skills/hallmark/references/study.md +511 -511
- package/template/.claude/skills/hallmark/references/typography.md +243 -243
- package/template/.claude/skills/hallmark/references/verbs/audit.md +25 -25
- package/template/.claude/skills/hallmark/references/verbs/redesign.md +269 -269
- package/template/.claude/skills/hallmark-loop/SKILL.md +105 -105
- package/template/.claude/skills/hallmark-loop/references/auditor-call.md +60 -60
- package/template/.claude/skills/hallmark-loop/references/capture.md +78 -78
- package/template/.claude/skills/hallmark-loop/references/loop-control.md +79 -79
- package/template/.claude/skills/handoff/SKILL.md +15 -15
- package/template/.claude/skills/knowledge-crunching/SKILL.md +94 -94
- package/template/.claude/skills/research/SKILL.md +69 -69
- package/template/.claude/skills/skill-creator/LICENSE.txt +201 -201
- package/template/.claude/skills/skill-creator/SKILL.md +154 -149
- package/template/.claude/skills/skill-creator/agents/analyzer.md +274 -274
- package/template/.claude/skills/skill-creator/agents/comparator.md +202 -202
- package/template/.claude/skills/skill-creator/agents/grader.md +223 -223
- package/template/.claude/skills/skill-creator/assets/eval_review.html +146 -146
- package/template/.claude/skills/skill-creator/eval-viewer/generate_review.py +471 -471
- package/template/.claude/skills/skill-creator/eval-viewer/viewer.html +1325 -1325
- package/template/.claude/skills/skill-creator/references/benchmark-optimization-guide.md +86 -86
- package/template/.claude/skills/skill-creator/references/distribution-guide.md +79 -79
- package/template/.claude/skills/skill-creator/references/eval-infrastructure-guide.md +129 -129
- package/template/.claude/skills/skill-creator/references/eval-schemas.md +121 -121
- package/template/.claude/skills/skill-creator/references/mcp-skills-integration.md +71 -71
- package/template/.claude/skills/skill-creator/references/metadata-quality-criteria.md +94 -94
- package/template/.claude/skills/skill-creator/references/plugin-marketplace-hosting.md +104 -104
- package/template/.claude/skills/skill-creator/references/plugin-marketplace-overview.md +89 -89
- package/template/.claude/skills/skill-creator/references/plugin-marketplace-schema.md +93 -93
- package/template/.claude/skills/skill-creator/references/plugin-marketplace-sources.md +103 -103
- package/template/.claude/skills/skill-creator/references/plugin-marketplace-troubleshooting.md +76 -76
- package/template/.claude/skills/skill-creator/references/script-quality-criteria.md +106 -106
- package/template/.claude/skills/skill-creator/references/skill-anatomy-and-requirements.md +77 -77
- package/template/.claude/skills/skill-creator/references/skill-creation-workflow.md +152 -151
- package/template/.claude/skills/skill-creator/references/skill-design-patterns.md +75 -75
- package/template/.claude/skills/skill-creator/references/skillmark-benchmark-criteria.md +102 -102
- package/template/.claude/skills/skill-creator/references/structure-organization-criteria.md +114 -114
- package/template/.claude/skills/skill-creator/references/testing-and-iteration.md +78 -78
- package/template/.claude/skills/skill-creator/references/token-efficiency-criteria.md +74 -74
- package/template/.claude/skills/skill-creator/references/troubleshooting-guide.md +81 -81
- package/template/.claude/skills/skill-creator/references/validation-checklist.md +83 -83
- package/template/.claude/skills/skill-creator/references/writing-effective-instructions.md +88 -88
- package/template/.claude/skills/skill-creator/references/yaml-frontmatter-reference.md +92 -92
- package/template/.claude/skills/skill-creator/scripts/aggregate_benchmark.py +401 -401
- package/template/.claude/skills/skill-creator/scripts/encoding_utils.py +36 -36
- package/template/.claude/skills/skill-creator/scripts/generate_report.py +326 -326
- package/template/.claude/skills/skill-creator/scripts/improve_description.py +248 -248
- package/template/.claude/skills/skill-creator/scripts/init_skill.py +360 -360
- package/template/.claude/skills/skill-creator/scripts/package_skill.py +143 -143
- package/template/.claude/skills/skill-creator/scripts/quick_validate.py +110 -110
- package/template/.claude/skills/skill-creator/scripts/run_eval.py +310 -310
- package/template/.claude/skills/skill-creator/scripts/run_loop.py +332 -332
- package/template/.claude/skills/skill-creator/scripts/utils.py +47 -47
- package/template/.claude/skills/tdd/SKILL.md +142 -142
- package/template/.claude/skills/tdd/deep-modules.md +15 -15
- package/template/.claude/skills/tdd/interface-design.md +31 -31
- package/template/.claude/skills/tdd/mocking.md +59 -59
- package/template/.claude/skills/tdd/refactoring.md +10 -10
- package/template/.claude/skills/tdd/tests.md +61 -61
- package/template/.claude/statusline.cjs +0 -0
- package/template/.claude/skills/code-review/references/adversarial-review.md +0 -223
package/template/.claude/skills/architecture-characteristic-writer/scripts/ranking-table.cjs
CHANGED
|
@@ -1,171 +1,171 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
// Scaffolds and repairs the architecture-characteristics ranking table.
|
|
3
|
-
//
|
|
4
|
-
// scaffold write a blank ranking holding every catalog characteristic
|
|
5
|
-
// fix renumber the Order column and rebuild every "Above X:" prefix
|
|
6
|
-
// from the row order as it now stands, keeping the justifications
|
|
7
|
-
//
|
|
8
|
-
// Ranking ORDER and justification prose are the architect's work. Everything
|
|
9
|
-
// this script touches — which characteristics appear, the numbering, which row
|
|
10
|
-
// each reason compares against — is mechanical, so no one has to transcribe it.
|
|
11
|
-
//
|
|
12
|
-
// Run `fix` after moving rows. A prefix left naming the wrong row is the usual
|
|
13
|
-
// defect after a reorder, and regenerating them makes it impossible.
|
|
14
|
-
|
|
15
|
-
const fs = require('fs');
|
|
16
|
-
const path = require('path');
|
|
17
|
-
|
|
18
|
-
const {
|
|
19
|
-
loadCatalog,
|
|
20
|
-
normalise,
|
|
21
|
-
locateTable,
|
|
22
|
-
splitCells,
|
|
23
|
-
isSeparator,
|
|
24
|
-
RANKING_HEADER,
|
|
25
|
-
} = require('../../../hooks/lib/characteristics/checker.cjs');
|
|
26
|
-
|
|
27
|
-
const DEFAULT_FILE = 'docs/architecture-characteristics-ranking.md';
|
|
28
|
-
|
|
29
|
-
// The validation hook resolves the ranking against CLAUDE_PROJECT_DIR. Resolve
|
|
30
|
-
// against the same root, or running this from a subdirectory would quietly
|
|
31
|
-
// write a second ranking somewhere the hook never looks at.
|
|
32
|
-
const projectRoot = () => process.env.CLAUDE_PROJECT_DIR || process.cwd();
|
|
33
|
-
const PLACEHOLDER = '{why}';
|
|
34
|
-
const HEADING = '# Architecture Characteristics Ranking';
|
|
35
|
-
|
|
36
|
-
const PREAMBLE = [
|
|
37
|
-
HEADING,
|
|
38
|
-
'',
|
|
39
|
-
'All characteristics in priority order. The top 7 feed the worksheet in',
|
|
40
|
-
'`architecture-characteristics.md`.',
|
|
41
|
-
'',
|
|
42
|
-
'<!-- Reason = why this row outranks the row directly BELOW it. Comparative, never a description.',
|
|
43
|
-
' Keep the "Above {next characteristic}:" prefix and replace {why} with the justification.',
|
|
44
|
-
' Both sides must appear: what this row protects, and what the row below gives up.',
|
|
45
|
-
' State WHY the system needs it, meaning the business driver or risk.',
|
|
46
|
-
' Never name the mechanism: no patterns, libraries, components, or tactics.',
|
|
47
|
-
'',
|
|
48
|
-
' Move rows freely, then run scripts/ranking-table.cjs fix to renumber and',
|
|
49
|
-
' rebuild every prefix. Do not hand-maintain the numbering or the prefixes. -->',
|
|
50
|
-
'',
|
|
51
|
-
];
|
|
52
|
-
|
|
53
|
-
const die = (msg) => {
|
|
54
|
-
process.stderr.write(`${msg}\n`);
|
|
55
|
-
process.exit(1);
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
// Builds the three table lines plus data rows for the given ordered names,
|
|
59
|
-
// pairing each row with the justification supplied for it.
|
|
60
|
-
function render(order, justifications) {
|
|
61
|
-
const rows = order.map((name, i) => {
|
|
62
|
-
const last = i === order.length - 1;
|
|
63
|
-
const reason = last ? '—' : `Above ${order[i + 1]}: ${justifications[i] || PLACEHOLDER}`;
|
|
64
|
-
return `| ${i + 1} | ${name} | ${reason} |`;
|
|
65
|
-
});
|
|
66
|
-
return ['| Order | Characteristic | Reason |', '|---|---|---|', ...rows];
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
// Drops an "Above X:" prefix and a lone em dash, leaving the justification the
|
|
70
|
-
// author actually wrote.
|
|
71
|
-
function justificationOf(reason) {
|
|
72
|
-
const text = String(reason).trim();
|
|
73
|
-
if (/^[—-]$/.test(text)) return '';
|
|
74
|
-
const m = text.match(/^above\s+[^:]+:\s*(.*)$/i);
|
|
75
|
-
return (m ? m[1] : text).trim();
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
function scaffold(argv) {
|
|
79
|
-
const out = argv.out || DEFAULT_FILE;
|
|
80
|
-
const target = path.resolve(projectRoot(), out);
|
|
81
|
-
|
|
82
|
-
if (fs.existsSync(target) && !argv.force) {
|
|
83
|
-
die(`${out} already exists. Run fix to repair it, or pass --force to start over.`);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
const { catalog } = loadCatalog(argv.catalog);
|
|
87
|
-
fs.mkdirSync(path.dirname(target), { recursive: true });
|
|
88
|
-
fs.writeFileSync(target, [...PREAMBLE, ...render(catalog, []), ''].join('\n'), 'utf8');
|
|
89
|
-
|
|
90
|
-
process.stdout.write(
|
|
91
|
-
`Wrote ${out} with ${catalog.length} characteristics in catalog order.\n` +
|
|
92
|
-
'Reorder the rows, replace every {why}, then run fix.\n'
|
|
93
|
-
);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
function fix(argv) {
|
|
97
|
-
const file = argv.file || DEFAULT_FILE;
|
|
98
|
-
const target = path.resolve(projectRoot(), file);
|
|
99
|
-
|
|
100
|
-
if (!fs.existsSync(target)) die(`${file} does not exist. Run scaffold first.`);
|
|
101
|
-
|
|
102
|
-
const original = fs.readFileSync(target, 'utf8');
|
|
103
|
-
const eol = original.includes('\r\n') ? '\r\n' : '\n';
|
|
104
|
-
const lines = original.split(/\r?\n/);
|
|
105
|
-
|
|
106
|
-
const bounds = locateTable(lines, RANKING_HEADER);
|
|
107
|
-
if (!bounds) die(`${file} holds no table with a "| Order | Characteristic | Reason |" header row.`);
|
|
108
|
-
|
|
109
|
-
const table = lines.slice(bounds.start, bounds.end);
|
|
110
|
-
const data = table.filter((l) => {
|
|
111
|
-
const c = splitCells(l);
|
|
112
|
-
return c.length >= 3 && !isSeparator(c) && !/^order$/i.test(c[0]);
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
if (!data.length) die(`${file} holds no ranking rows to fix.`);
|
|
116
|
-
|
|
117
|
-
const order = data.map((l) => normalise(splitCells(l)[1]));
|
|
118
|
-
const justifications = data.map((l) => justificationOf(splitCells(l)[2]));
|
|
119
|
-
|
|
120
|
-
const { catalog } = loadCatalog(argv.catalog);
|
|
121
|
-
const unknown = order.filter((n) => !catalog.includes(n));
|
|
122
|
-
if (unknown.length) die(`${file} names characteristics absent from the catalog: ${unknown.join(', ')}`);
|
|
123
|
-
|
|
124
|
-
const rebuilt = render(order, justifications);
|
|
125
|
-
const next = [...lines.slice(0, bounds.start), ...rebuilt, ...lines.slice(bounds.end)];
|
|
126
|
-
const updated = next.join(eol);
|
|
127
|
-
|
|
128
|
-
// Reported whether or not anything moved: a scaffold is already correct and
|
|
129
|
-
// still has every justification left to write.
|
|
130
|
-
const blank = justifications.filter((j, i) => i < justifications.length - 1 && (!j || j === PLACEHOLDER)).length;
|
|
131
|
-
const outstanding = blank ? `${blank} row(s) still need a justification in place of ${PLACEHOLDER}.\n` : '';
|
|
132
|
-
|
|
133
|
-
if (updated === original) {
|
|
134
|
-
process.stdout.write(`${file} is already correct.\n${outstanding}`);
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
fs.writeFileSync(target, updated, 'utf8');
|
|
139
|
-
|
|
140
|
-
const repaired = data.filter((l, i) => splitCells(l)[2] !== splitCells(rebuilt[i + 2])[2]).length;
|
|
141
|
-
const renumbered = data.filter((l, i) => splitCells(l)[0] !== String(i + 1)).length;
|
|
142
|
-
|
|
143
|
-
process.stdout.write(
|
|
144
|
-
`Fixed ${file}: renumbered ${renumbered} row(s), rebuilt ${repaired} reason(s).\n${outstanding}`
|
|
145
|
-
);
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
function main() {
|
|
149
|
-
const [command, ...rest] = process.argv.slice(2);
|
|
150
|
-
const argv = { force: false };
|
|
151
|
-
|
|
152
|
-
for (let i = 0; i < rest.length; i += 1) {
|
|
153
|
-
const flag = rest[i];
|
|
154
|
-
if (flag === '--force') argv.force = true;
|
|
155
|
-
else if (flag === '--out') argv.out = rest[(i += 1)];
|
|
156
|
-
else if (flag === '--file') argv.file = rest[(i += 1)];
|
|
157
|
-
else if (flag === '--catalog') argv.catalog = rest[(i += 1)];
|
|
158
|
-
else die(`unknown argument: ${flag}`);
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
try {
|
|
162
|
-
if (command === 'scaffold') return scaffold(argv);
|
|
163
|
-
if (command === 'fix') return fix(argv);
|
|
164
|
-
} catch (err) {
|
|
165
|
-
die(err.message);
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
die('usage: ranking-table.cjs scaffold [--out <path>] [--force] | fix [--file <path>]');
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
main();
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Scaffolds and repairs the architecture-characteristics ranking table.
|
|
3
|
+
//
|
|
4
|
+
// scaffold write a blank ranking holding every catalog characteristic
|
|
5
|
+
// fix renumber the Order column and rebuild every "Above X:" prefix
|
|
6
|
+
// from the row order as it now stands, keeping the justifications
|
|
7
|
+
//
|
|
8
|
+
// Ranking ORDER and justification prose are the architect's work. Everything
|
|
9
|
+
// this script touches — which characteristics appear, the numbering, which row
|
|
10
|
+
// each reason compares against — is mechanical, so no one has to transcribe it.
|
|
11
|
+
//
|
|
12
|
+
// Run `fix` after moving rows. A prefix left naming the wrong row is the usual
|
|
13
|
+
// defect after a reorder, and regenerating them makes it impossible.
|
|
14
|
+
|
|
15
|
+
const fs = require('fs');
|
|
16
|
+
const path = require('path');
|
|
17
|
+
|
|
18
|
+
const {
|
|
19
|
+
loadCatalog,
|
|
20
|
+
normalise,
|
|
21
|
+
locateTable,
|
|
22
|
+
splitCells,
|
|
23
|
+
isSeparator,
|
|
24
|
+
RANKING_HEADER,
|
|
25
|
+
} = require('../../../hooks/lib/characteristics/checker.cjs');
|
|
26
|
+
|
|
27
|
+
const DEFAULT_FILE = 'docs/architecture-characteristics-ranking.md';
|
|
28
|
+
|
|
29
|
+
// The validation hook resolves the ranking against CLAUDE_PROJECT_DIR. Resolve
|
|
30
|
+
// against the same root, or running this from a subdirectory would quietly
|
|
31
|
+
// write a second ranking somewhere the hook never looks at.
|
|
32
|
+
const projectRoot = () => process.env.CLAUDE_PROJECT_DIR || process.cwd();
|
|
33
|
+
const PLACEHOLDER = '{why}';
|
|
34
|
+
const HEADING = '# Architecture Characteristics Ranking';
|
|
35
|
+
|
|
36
|
+
const PREAMBLE = [
|
|
37
|
+
HEADING,
|
|
38
|
+
'',
|
|
39
|
+
'All characteristics in priority order. The top 7 feed the worksheet in',
|
|
40
|
+
'`architecture-characteristics.md`.',
|
|
41
|
+
'',
|
|
42
|
+
'<!-- Reason = why this row outranks the row directly BELOW it. Comparative, never a description.',
|
|
43
|
+
' Keep the "Above {next characteristic}:" prefix and replace {why} with the justification.',
|
|
44
|
+
' Both sides must appear: what this row protects, and what the row below gives up.',
|
|
45
|
+
' State WHY the system needs it, meaning the business driver or risk.',
|
|
46
|
+
' Never name the mechanism: no patterns, libraries, components, or tactics.',
|
|
47
|
+
'',
|
|
48
|
+
' Move rows freely, then run scripts/ranking-table.cjs fix to renumber and',
|
|
49
|
+
' rebuild every prefix. Do not hand-maintain the numbering or the prefixes. -->',
|
|
50
|
+
'',
|
|
51
|
+
];
|
|
52
|
+
|
|
53
|
+
const die = (msg) => {
|
|
54
|
+
process.stderr.write(`${msg}\n`);
|
|
55
|
+
process.exit(1);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
// Builds the three table lines plus data rows for the given ordered names,
|
|
59
|
+
// pairing each row with the justification supplied for it.
|
|
60
|
+
function render(order, justifications) {
|
|
61
|
+
const rows = order.map((name, i) => {
|
|
62
|
+
const last = i === order.length - 1;
|
|
63
|
+
const reason = last ? '—' : `Above ${order[i + 1]}: ${justifications[i] || PLACEHOLDER}`;
|
|
64
|
+
return `| ${i + 1} | ${name} | ${reason} |`;
|
|
65
|
+
});
|
|
66
|
+
return ['| Order | Characteristic | Reason |', '|---|---|---|', ...rows];
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Drops an "Above X:" prefix and a lone em dash, leaving the justification the
|
|
70
|
+
// author actually wrote.
|
|
71
|
+
function justificationOf(reason) {
|
|
72
|
+
const text = String(reason).trim();
|
|
73
|
+
if (/^[—-]$/.test(text)) return '';
|
|
74
|
+
const m = text.match(/^above\s+[^:]+:\s*(.*)$/i);
|
|
75
|
+
return (m ? m[1] : text).trim();
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function scaffold(argv) {
|
|
79
|
+
const out = argv.out || DEFAULT_FILE;
|
|
80
|
+
const target = path.resolve(projectRoot(), out);
|
|
81
|
+
|
|
82
|
+
if (fs.existsSync(target) && !argv.force) {
|
|
83
|
+
die(`${out} already exists. Run fix to repair it, or pass --force to start over.`);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const { catalog } = loadCatalog(argv.catalog);
|
|
87
|
+
fs.mkdirSync(path.dirname(target), { recursive: true });
|
|
88
|
+
fs.writeFileSync(target, [...PREAMBLE, ...render(catalog, []), ''].join('\n'), 'utf8');
|
|
89
|
+
|
|
90
|
+
process.stdout.write(
|
|
91
|
+
`Wrote ${out} with ${catalog.length} characteristics in catalog order.\n` +
|
|
92
|
+
'Reorder the rows, replace every {why}, then run fix.\n'
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function fix(argv) {
|
|
97
|
+
const file = argv.file || DEFAULT_FILE;
|
|
98
|
+
const target = path.resolve(projectRoot(), file);
|
|
99
|
+
|
|
100
|
+
if (!fs.existsSync(target)) die(`${file} does not exist. Run scaffold first.`);
|
|
101
|
+
|
|
102
|
+
const original = fs.readFileSync(target, 'utf8');
|
|
103
|
+
const eol = original.includes('\r\n') ? '\r\n' : '\n';
|
|
104
|
+
const lines = original.split(/\r?\n/);
|
|
105
|
+
|
|
106
|
+
const bounds = locateTable(lines, RANKING_HEADER);
|
|
107
|
+
if (!bounds) die(`${file} holds no table with a "| Order | Characteristic | Reason |" header row.`);
|
|
108
|
+
|
|
109
|
+
const table = lines.slice(bounds.start, bounds.end);
|
|
110
|
+
const data = table.filter((l) => {
|
|
111
|
+
const c = splitCells(l);
|
|
112
|
+
return c.length >= 3 && !isSeparator(c) && !/^order$/i.test(c[0]);
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
if (!data.length) die(`${file} holds no ranking rows to fix.`);
|
|
116
|
+
|
|
117
|
+
const order = data.map((l) => normalise(splitCells(l)[1]));
|
|
118
|
+
const justifications = data.map((l) => justificationOf(splitCells(l)[2]));
|
|
119
|
+
|
|
120
|
+
const { catalog } = loadCatalog(argv.catalog);
|
|
121
|
+
const unknown = order.filter((n) => !catalog.includes(n));
|
|
122
|
+
if (unknown.length) die(`${file} names characteristics absent from the catalog: ${unknown.join(', ')}`);
|
|
123
|
+
|
|
124
|
+
const rebuilt = render(order, justifications);
|
|
125
|
+
const next = [...lines.slice(0, bounds.start), ...rebuilt, ...lines.slice(bounds.end)];
|
|
126
|
+
const updated = next.join(eol);
|
|
127
|
+
|
|
128
|
+
// Reported whether or not anything moved: a scaffold is already correct and
|
|
129
|
+
// still has every justification left to write.
|
|
130
|
+
const blank = justifications.filter((j, i) => i < justifications.length - 1 && (!j || j === PLACEHOLDER)).length;
|
|
131
|
+
const outstanding = blank ? `${blank} row(s) still need a justification in place of ${PLACEHOLDER}.\n` : '';
|
|
132
|
+
|
|
133
|
+
if (updated === original) {
|
|
134
|
+
process.stdout.write(`${file} is already correct.\n${outstanding}`);
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
fs.writeFileSync(target, updated, 'utf8');
|
|
139
|
+
|
|
140
|
+
const repaired = data.filter((l, i) => splitCells(l)[2] !== splitCells(rebuilt[i + 2])[2]).length;
|
|
141
|
+
const renumbered = data.filter((l, i) => splitCells(l)[0] !== String(i + 1)).length;
|
|
142
|
+
|
|
143
|
+
process.stdout.write(
|
|
144
|
+
`Fixed ${file}: renumbered ${renumbered} row(s), rebuilt ${repaired} reason(s).\n${outstanding}`
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function main() {
|
|
149
|
+
const [command, ...rest] = process.argv.slice(2);
|
|
150
|
+
const argv = { force: false };
|
|
151
|
+
|
|
152
|
+
for (let i = 0; i < rest.length; i += 1) {
|
|
153
|
+
const flag = rest[i];
|
|
154
|
+
if (flag === '--force') argv.force = true;
|
|
155
|
+
else if (flag === '--out') argv.out = rest[(i += 1)];
|
|
156
|
+
else if (flag === '--file') argv.file = rest[(i += 1)];
|
|
157
|
+
else if (flag === '--catalog') argv.catalog = rest[(i += 1)];
|
|
158
|
+
else die(`unknown argument: ${flag}`);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
try {
|
|
162
|
+
if (command === 'scaffold') return scaffold(argv);
|
|
163
|
+
if (command === 'fix') return fix(argv);
|
|
164
|
+
} catch (err) {
|
|
165
|
+
die(err.message);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
die('usage: ranking-table.cjs scaffold [--out <path>] [--force] | fix [--file <path>]');
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
main();
|
|
@@ -1,54 +1,201 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: code-review
|
|
3
|
-
description: "Review code quality with
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
|
23
|
-
|
|
24
|
-
| `
|
|
25
|
-
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
1
|
+
---
|
|
2
|
+
name: code-review
|
|
3
|
+
description: "Review code quality with evidence-based rigor. Supports input modes: pending changes, PR number, commit hash, and codebase scan. Focuses on bugs, regressions, maintainability, reliability, and verification gaps."
|
|
4
|
+
user-invocable: true
|
|
5
|
+
when_to_use: "Invoke to review diffs, PRs, commits, or full codebases."
|
|
6
|
+
category: utilities
|
|
7
|
+
keywords: [review, quality, verification, reliability]
|
|
8
|
+
argument-hint: "[#PR | COMMIT | --pending | codebase [parallel]]"
|
|
9
|
+
metadata:
|
|
10
|
+
author: claudekit
|
|
11
|
+
version: "4.0.0"
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# Code Review
|
|
15
|
+
|
|
16
|
+
Production-readiness code review with technical rigor, evidence-based claims, and verification over performative responses. Reviews focus on production risks, regression paths, and whether the implementation matches the requested change.
|
|
17
|
+
|
|
18
|
+
## Input Modes
|
|
19
|
+
|
|
20
|
+
Auto-detect from arguments. If ambiguous or no arguments, prompt via `AskUserQuestion`.
|
|
21
|
+
|
|
22
|
+
| Input | Mode | What Gets Reviewed |
|
|
23
|
+
|-------|------|--------------------|
|
|
24
|
+
| `#123` or PR URL | **PR** | Full PR diff fetched via `gh pr diff` |
|
|
25
|
+
| `abc1234` (7+ hex chars) | **Commit** | Single commit diff via `git show` |
|
|
26
|
+
| `--pending` | **Pending** | Staged + unstaged changes via `git diff` |
|
|
27
|
+
| *(no args, recent changes)* | **Default** | Recent changes in context |
|
|
28
|
+
| `codebase` | **Codebase** | Full codebase scan |
|
|
29
|
+
| `codebase parallel` | **Codebase+** | Parallel multi-reviewer audit |
|
|
30
|
+
|
|
31
|
+
**Resolution details:** `references/input-mode-resolution.md`
|
|
32
|
+
|
|
33
|
+
### No Arguments
|
|
34
|
+
|
|
35
|
+
If invoked WITHOUT arguments and no recent changes in context, use `AskUserQuestion` with header "Review Target", question "What would you like to review?":
|
|
36
|
+
|
|
37
|
+
| Option | Description |
|
|
38
|
+
|--------|-------------|
|
|
39
|
+
| Pending changes | Review staged/unstaged git diff |
|
|
40
|
+
| Enter PR number | Fetch and review a specific PR |
|
|
41
|
+
| Enter commit hash | Review a specific commit |
|
|
42
|
+
| Full codebase scan | Deep codebase analysis |
|
|
43
|
+
| Parallel codebase audit | Multi-reviewer codebase scan |
|
|
44
|
+
|
|
45
|
+
## Core Principle
|
|
46
|
+
|
|
47
|
+
**YAGNI**, **KISS**, **DRY** always. Technical correctness over social comfort.
|
|
48
|
+
**Be honest, be brutal, straight to the point, and be concise.**
|
|
49
|
+
|
|
50
|
+
Default assumption: reviewed code may be AI-assisted. Do not trust polished shape, confident comments, or happy-path tests. Verify behavior, project-rule compliance, and scope discipline from evidence.
|
|
51
|
+
|
|
52
|
+
No rubber-stamp reviews. The reviewer is not trying to please the author or preserve momentum; the reviewer enforces the rulebook and blocks defects, regressions, hidden scope drift, and AI-slop patterns.
|
|
53
|
+
|
|
54
|
+
Verify before implementing. Ask before assuming. Evidence before claims.
|
|
55
|
+
|
|
56
|
+
## Practices
|
|
57
|
+
|
|
58
|
+
| Practice | When | Reference |
|
|
59
|
+
|----------|------|-----------|
|
|
60
|
+
| **Spec compliance** | After implementing from plan/spec, BEFORE quality review | `references/spec-compliance-review.md` |
|
|
61
|
+
| Receiving feedback | Unclear feedback, external reviewers, needs prioritization | `references/code-review-reception.md` |
|
|
62
|
+
| Requesting review | After tasks, before merge, stuck on problem | `references/requesting-code-review.md` |
|
|
63
|
+
| Verification gates | Before any completion claim, commit, PR | `references/verification-before-completion.md` |
|
|
64
|
+
| Edge case scouting | After implementation, before review | `references/edge-case-scouting.md` |
|
|
65
|
+
| **Checklist review** | Pre-landing, pre-merge, security audit | `references/checklist-workflow.md` |
|
|
66
|
+
| **Task-managed reviews** | Multi-file features (3+ files), parallel reviewers, fix cycles | `references/task-management-reviews.md` |
|
|
67
|
+
|
|
68
|
+
## Quick Decision Tree
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
SITUATION?
|
|
72
|
+
│
|
|
73
|
+
├─ Input mode? → Resolve diff (references/input-mode-resolution.md)
|
|
74
|
+
│ ├─ #PR / URL → fetch PR diff
|
|
75
|
+
│ ├─ commit hash → git show
|
|
76
|
+
│ ├─ --pending → git diff (staged + unstaged)
|
|
77
|
+
│ ├─ codebase → full scan (references/codebase-scan-workflow.md)
|
|
78
|
+
│ ├─ codebase parallel → parallel audit (references/parallel-review-workflow.md)
|
|
79
|
+
│ └─ default → recent changes in context
|
|
80
|
+
│
|
|
81
|
+
├─ Received feedback → STOP if unclear, verify if external, implement if human partner
|
|
82
|
+
├─ Completed work from plan/spec:
|
|
83
|
+
│ ├─ Stage 1: Spec compliance review (references/spec-compliance-review.md)
|
|
84
|
+
│ │ └─ PASS? → Stage 2 │ FAIL? → Fix → Re-review Stage 1
|
|
85
|
+
│ ├─ Stage 2: Code quality review (code-reviewer subagent)
|
|
86
|
+
│ │ └─ Scout edge cases → Review standards, performance
|
|
87
|
+
│ └─ Verification gate → Run required tests/builds before claims
|
|
88
|
+
├─ Completed work (no plan) → Scout → Code quality → Verification
|
|
89
|
+
├─ Pre-landing / ship → Load checklists → Two-pass review → Verification
|
|
90
|
+
├─ Multi-file feature (3+ files) → Create review pipeline tasks (scout→review→fix→verify)
|
|
91
|
+
└─ About to claim status → RUN verification command FIRST
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Review Protocol
|
|
95
|
+
|
|
96
|
+
**Stage 1 — Spec Compliance** (load `references/spec-compliance-review.md`)
|
|
97
|
+
- Does code match what was requested?
|
|
98
|
+
- Any missing requirements? Any unjustified extras?
|
|
99
|
+
- MUST pass before Stage 2
|
|
100
|
+
|
|
101
|
+
**Stage 2 — Code Quality** (code-reviewer subagent)
|
|
102
|
+
- Only runs AFTER spec compliance passes
|
|
103
|
+
- Standards, security, performance, edge cases
|
|
104
|
+
|
|
105
|
+
**Final Verification**
|
|
106
|
+
- Runs AFTER Stage 2 passes
|
|
107
|
+
- Re-run the relevant tests, build, lint, or manual reproduction
|
|
108
|
+
- Verify accepted findings are fixed and no new regression is introduced
|
|
109
|
+
- Critical findings block merge until fixed and re-verified
|
|
110
|
+
|
|
111
|
+
## Receiving Feedback
|
|
112
|
+
|
|
113
|
+
**Pattern:** READ → UNDERSTAND → VERIFY → EVALUATE → RESPOND → IMPLEMENT
|
|
114
|
+
No performative agreement. Verify before implementing. Push back if wrong.
|
|
115
|
+
|
|
116
|
+
**Full protocol:** `references/code-review-reception.md`
|
|
117
|
+
|
|
118
|
+
## Requesting Review
|
|
119
|
+
|
|
120
|
+
**When:** After each task, major features, before merge
|
|
121
|
+
|
|
122
|
+
**Process:**
|
|
123
|
+
1. **Scout edge cases first** (see below)
|
|
124
|
+
2. Get SHAs: `BASE_SHA=$(git rev-parse HEAD~1)` and `HEAD_SHA=$(git rev-parse HEAD)`
|
|
125
|
+
3. Dispatch code-reviewer subagent with: WHAT, PLAN, BASE_SHA, HEAD_SHA, DESCRIPTION
|
|
126
|
+
4. Fix Critical immediately, Important before proceeding
|
|
127
|
+
|
|
128
|
+
**Full protocol:** `references/requesting-code-review.md`
|
|
129
|
+
|
|
130
|
+
## Edge Case Scouting
|
|
131
|
+
|
|
132
|
+
**When:** After implementation, before requesting code-reviewer
|
|
133
|
+
|
|
134
|
+
**Process:**
|
|
135
|
+
1. Dispatch an `Explore` subagent with an edge-case-focused prompt
|
|
136
|
+
2. It analyzes: affected files, data flows, error paths, boundary conditions
|
|
137
|
+
3. Review the returned findings for potential issues
|
|
138
|
+
4. Address critical gaps before code review
|
|
139
|
+
|
|
140
|
+
**Full protocol:** `references/edge-case-scouting.md`
|
|
141
|
+
|
|
142
|
+
## Task-Managed Review Pipeline
|
|
143
|
+
|
|
144
|
+
**When:** Multi-file features (3+ changed files), parallel code-reviewer scopes, review cycles with Critical fix iterations.
|
|
145
|
+
|
|
146
|
+
**Fallback:** Task tools (`TaskCreate`/`TaskUpdate`/`TaskGet`/`TaskList`) are CLI-only — unavailable in VSCode extension. If they error, use `TodoWrite` for tracking and run pipeline sequentially. Review quality is identical.
|
|
147
|
+
|
|
148
|
+
**Pipeline:** scout → review → fix → verify (each a Task with dependency chain)
|
|
149
|
+
|
|
150
|
+
```
|
|
151
|
+
TaskCreate: "Scout edge cases" → pending
|
|
152
|
+
TaskCreate: "Review implementation" → pending, blockedBy: [scout]
|
|
153
|
+
TaskCreate: "Fix critical issues" → pending, blockedBy: [review]
|
|
154
|
+
TaskCreate: "Verify fixes pass" → pending, blockedBy: [fix]
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
**Parallel reviews:** Spawn scoped code-reviewer subagents for independent file groups (e.g., backend + frontend). Fix task blocks on all reviewers completing.
|
|
158
|
+
|
|
159
|
+
**Re-review cycles:** If fixes introduce new issues, create cycle-2 review task. Limit 3 cycles, escalate to user after.
|
|
160
|
+
|
|
161
|
+
**Full protocol:** `references/task-management-reviews.md`
|
|
162
|
+
|
|
163
|
+
## Verification Gates
|
|
164
|
+
|
|
165
|
+
**Iron Law:** NO COMPLETION CLAIMS WITHOUT FRESH VERIFICATION EVIDENCE
|
|
166
|
+
|
|
167
|
+
**Gate:** IDENTIFY command → RUN full → READ output → VERIFY confirms → THEN claim
|
|
168
|
+
|
|
169
|
+
**Requirements:**
|
|
170
|
+
- Tests pass: Output shows 0 failures
|
|
171
|
+
- Build succeeds: Exit 0
|
|
172
|
+
- Bug fixed: Original symptom passes
|
|
173
|
+
- Requirements met: Checklist verified
|
|
174
|
+
|
|
175
|
+
**Red Flags:** "should"/"probably"/"seems to", satisfaction before verification, trusting agent reports
|
|
176
|
+
|
|
177
|
+
**Full protocol:** `references/verification-before-completion.md`
|
|
178
|
+
|
|
179
|
+
## Integration with Workflows
|
|
180
|
+
|
|
181
|
+
- **Subagent-Driven:** Scout → Review → Verify before next task
|
|
182
|
+
- **Pull Requests:** Scout → Code quality → Verify → Merge
|
|
183
|
+
- **Task Pipeline:** Create review tasks with dependencies → auto-unblock through chain
|
|
184
|
+
- **PR Review:** `/code-review #123` → fetch diff → full review pipeline on PR changes
|
|
185
|
+
- **Commit Review:** `/code-review abc1234` → review specific commit with full pipeline
|
|
186
|
+
|
|
187
|
+
## Codebase Analysis Subcommands
|
|
188
|
+
|
|
189
|
+
| Subcommand | Reference | Purpose |
|
|
190
|
+
|------------|-----------|---------|
|
|
191
|
+
| `/code-review codebase` | `references/codebase-scan-workflow.md` | Scan & analyze the codebase |
|
|
192
|
+
| `/code-review codebase parallel` | `references/parallel-review-workflow.md` | Ultrathink edge cases, then parallel verify |
|
|
193
|
+
|
|
194
|
+
## Bottom Line
|
|
195
|
+
|
|
196
|
+
1. Resolve input mode first — know WHAT you're reviewing
|
|
197
|
+
2. Technical rigor over social performance
|
|
198
|
+
3. Scout edge cases before review
|
|
199
|
+
4. Evidence before claims
|
|
200
|
+
|
|
201
|
+
Verify. Scout. Question. Then implement. Evidence. Then claim.
|