@boyingliu01/xp-gate 0.8.8 → 0.8.9
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/bin/xp-gate.js +18 -0
- package/hooks/pre-commit +565 -120
- package/lib/arch.js +49 -0
- package/lib/check.js +50 -0
- package/lib/principles.js +48 -0
- package/package.json +1 -1
- package/plugins/claude-code/.claude-plugin/plugin.json +2 -2
- package/plugins/claude-code/skills/delphi-review/AGENTS.md +3 -3
- package/plugins/claude-code/skills/sprint-flow/AGENTS.md +83 -36
- package/plugins/claude-code/skills/test-specification-alignment/AGENTS.md +3 -3
- package/plugins/opencode/README.md +23 -7
- package/plugins/opencode/index.ts +36 -21
- package/plugins/opencode/package.json +1 -1
- package/plugins/opencode/skills/delphi-review/AGENTS.md +3 -3
- package/plugins/opencode/skills/sprint-flow/AGENTS.md +83 -36
- package/plugins/opencode/skills/test-specification-alignment/AGENTS.md +3 -3
- package/plugins/qoder/plugin.json +20 -0
- package/plugins/qoder/skills/delphi-review/AGENTS.md +3 -3
- package/plugins/qoder/skills/sprint-flow/AGENTS.md +83 -36
- package/plugins/qoder/skills/test-driven-development/SKILL.md +371 -0
- package/plugins/qoder/skills/test-driven-development/testing-anti-patterns.md +299 -0
- package/plugins/qoder/skills/test-specification-alignment/AGENTS.md +3 -3
- package/skills/delphi-review/AGENTS.md +3 -3
- package/skills/sprint-flow/AGENTS.md +83 -36
- package/skills/test-specification-alignment/AGENTS.md +3 -3
package/lib/arch.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { spawnSync } = require('child_process');
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
|
|
7
|
+
// Looks for architecture.yaml in CWD, then walks up to git root.
|
|
8
|
+
function findArchConfig(startDir) {
|
|
9
|
+
let dir = path.resolve(startDir);
|
|
10
|
+
const root = path.parse(dir).root;
|
|
11
|
+
while (dir !== root) {
|
|
12
|
+
const candidate = path.join(dir, 'architecture.yaml');
|
|
13
|
+
if (fs.existsSync(candidate)) return candidate;
|
|
14
|
+
if (fs.existsSync(path.join(dir, '.git'))) return null;
|
|
15
|
+
dir = path.dirname(dir);
|
|
16
|
+
}
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function arch(args) {
|
|
21
|
+
const configIdx = args.indexOf('--config');
|
|
22
|
+
const explicitConfig = configIdx >= 0 ? args[configIdx + 1] : null;
|
|
23
|
+
const config = explicitConfig || findArchConfig(process.cwd());
|
|
24
|
+
|
|
25
|
+
if (!config) {
|
|
26
|
+
console.error('[xp-gate arch] ERROR: architecture.yaml not found in CWD or git root');
|
|
27
|
+
console.error(' Create one or pass --config <path>');
|
|
28
|
+
return Promise.resolve(1);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (!fs.existsSync(config)) {
|
|
32
|
+
console.error(`[xp-gate arch] ERROR: config file not found: ${config}`);
|
|
33
|
+
return Promise.resolve(1);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const result = spawnSync('npx', ['-y', '@archlinter/cli', 'scan', '.', '--config', config], {
|
|
37
|
+
stdio: 'inherit',
|
|
38
|
+
shell: process.platform === 'win32',
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
if (result.error && result.error.code === 'ENOENT') {
|
|
42
|
+
console.error('[xp-gate arch] ERROR: npx not found in PATH. Install Node.js >=18.');
|
|
43
|
+
return Promise.resolve(1);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return Promise.resolve(result.status === null ? 1 : result.status);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
module.exports = { arch };
|
package/lib/check.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { principles } = require('./principles.js');
|
|
4
|
+
const { arch } = require('./arch.js');
|
|
5
|
+
|
|
6
|
+
// Runs the user-invokable subset of quality gates on a path. Mirrors what the
|
|
7
|
+
// pre-commit hook does, but as a standalone CLI surface. Intentionally narrower
|
|
8
|
+
// than the full pre-commit run (no git staging context, no Boy Scout baseline).
|
|
9
|
+
// Currently delegates to: Gate 4 (Principles) + Gate 6 (Architecture).
|
|
10
|
+
async function check(args) {
|
|
11
|
+
const target = args[0];
|
|
12
|
+
if (!target) {
|
|
13
|
+
console.error('Usage: xp-gate check <file_or_directory> [--gates principles,arch]');
|
|
14
|
+
return 1;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const gatesIdx = args.indexOf('--gates');
|
|
18
|
+
const gateList = gatesIdx >= 0
|
|
19
|
+
? args[gatesIdx + 1].split(',').map(s => s.trim()).filter(Boolean)
|
|
20
|
+
: ['principles', 'arch'];
|
|
21
|
+
|
|
22
|
+
let failures = 0;
|
|
23
|
+
let ran = 0;
|
|
24
|
+
|
|
25
|
+
if (gateList.includes('principles')) {
|
|
26
|
+
console.log('━━━ Gate 4: Principles ━━━');
|
|
27
|
+
const code = await principles([target]);
|
|
28
|
+
if (code !== 0) failures += 1;
|
|
29
|
+
ran += 1;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (gateList.includes('arch')) {
|
|
33
|
+
console.log('━━━ Gate 6: Architecture ━━━');
|
|
34
|
+
const code = await arch([]);
|
|
35
|
+
if (code !== 0) failures += 1;
|
|
36
|
+
ran += 1;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (ran === 0) {
|
|
40
|
+
console.error(`[xp-gate check] No valid gates in --gates list: ${gateList.join(',')}`);
|
|
41
|
+
console.error(' Available gates: principles, arch');
|
|
42
|
+
return 1;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
console.log('');
|
|
46
|
+
console.log(`[xp-gate check] ${ran - failures}/${ran} gate(s) passed`);
|
|
47
|
+
return failures === 0 ? 0 : 1;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
module.exports = { check };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { spawnSync } = require('child_process');
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
|
|
7
|
+
// Resolves repo root for the installed xp-gate npm package, or the development
|
|
8
|
+
// checkout when running from source. Walks up looking for either:
|
|
9
|
+
// - src/principles/index.ts (this repo / dev mode)
|
|
10
|
+
// - ../../src/principles/index.ts (installed under node_modules/@boyingliu01/xp-gate)
|
|
11
|
+
function findPrinciplesEntry() {
|
|
12
|
+
const candidates = [
|
|
13
|
+
path.resolve(__dirname, '..', '..', '..', 'src', 'principles', 'index.ts'),
|
|
14
|
+
path.resolve(__dirname, '..', '..', 'src', 'principles', 'index.ts'),
|
|
15
|
+
path.resolve(process.cwd(), 'src', 'principles', 'index.ts'),
|
|
16
|
+
];
|
|
17
|
+
for (const c of candidates) {
|
|
18
|
+
if (fs.existsSync(c)) return c;
|
|
19
|
+
}
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function principles(args) {
|
|
24
|
+
const target = args[0];
|
|
25
|
+
if (!target) {
|
|
26
|
+
console.error('Usage: xp-gate principles <file_or_directory> [--format console|json|sarif]');
|
|
27
|
+
return Promise.resolve(1);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const formatIdx = args.indexOf('--format');
|
|
31
|
+
const format = formatIdx >= 0 ? args[formatIdx + 1] : 'console';
|
|
32
|
+
|
|
33
|
+
const entry = findPrinciplesEntry();
|
|
34
|
+
if (!entry) {
|
|
35
|
+
console.error('[xp-gate principles] ERROR: cannot locate src/principles/index.ts');
|
|
36
|
+
console.error(' Run from inside the xp-gate repo, or install via npm install -g @boyingliu01/xp-gate');
|
|
37
|
+
return Promise.resolve(1);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const result = spawnSync('npx', ['-y', 'tsx', entry, '--files', target, '--format', format], {
|
|
41
|
+
stdio: 'inherit',
|
|
42
|
+
shell: process.platform === 'win32',
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
return Promise.resolve(result.status === null ? 1 : result.status);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
module.exports = { principles };
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xp-gate",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.9",
|
|
4
4
|
"displayName": "XP-Gate",
|
|
5
|
-
"description": "Extreme Programming quality gates + AI workflow skills for Claude Code. Includes
|
|
5
|
+
"description": "Extreme Programming quality gates + AI workflow skills for Claude Code. Includes 10 quality gates (Gate 0-9), Sprint Flow (11 phases), and Delphi multi-expert review (>=91% consensus).",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "boyingliu01"
|
|
8
8
|
},
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# SKILLS/DELPHI-REVIEW KNOWLEDGE BASE
|
|
2
2
|
|
|
3
|
-
**Generated:** 2026-
|
|
4
|
-
**Commit:**
|
|
3
|
+
**Generated:** 2026-06-11
|
|
4
|
+
**Commit:** c18f82b
|
|
5
5
|
**Branch:** main
|
|
6
|
-
**Version:**
|
|
6
|
+
**Version:** 0.8.9.0
|
|
7
7
|
|
|
8
8
|
## OVERVIEW
|
|
9
9
|
Delphi Consensus Review — multi-round anonymous expert review (≥91% threshold, 3 experts from ≥2 providers, domestic models only). Supports design + code-walkthrough modes.
|
|
@@ -1,68 +1,115 @@
|
|
|
1
1
|
# SKILLS/SPRINT-FLOW KNOWLEDGE BASE
|
|
2
2
|
|
|
3
|
-
**Generated:** 2026-
|
|
4
|
-
**
|
|
3
|
+
**Generated:** 2026-06-11
|
|
4
|
+
**Commit:** c18f82b
|
|
5
|
+
**Branch:** main
|
|
6
|
+
**Version:** 0.8.9.0
|
|
5
7
|
|
|
6
8
|
## OVERVIEW
|
|
7
|
-
|
|
9
|
+
**11-phase** development pipeline: ISOLATE → AUTO-ESTIMATE → THINK → PLAN → BUILD → REVIEW → USER ACCEPTANCE → FEEDBACK → SHIP → LAND → CLEANUP. Phase 2 default build mode is **ralph-loop** (REQ-level iteration, 40-67% token savings vs parallel). HARD-GATE in Phase 1: design must pass Delphi review (≥91% consensus) before any coding.
|
|
10
|
+
|
|
11
|
+
> **Doc drift**: README/CAPABILITIES still describe a "7-phase" pipeline. The canonical 11-phase model lives in `SKILL.md` and is what actually executes. See root `AGENTS.md` → "Known Drift" #4.
|
|
8
12
|
|
|
9
13
|
## STRUCTURE
|
|
10
14
|
```
|
|
11
15
|
skills/sprint-flow/
|
|
12
|
-
├── SKILL.md #
|
|
16
|
+
├── SKILL.md # 11-phase pipeline definition (canonical)
|
|
17
|
+
├── AGENTS.md # This file (mirrored to 7 other locations — DO NOT edit mirrors)
|
|
13
18
|
├── evals/ # Evaluation test cases
|
|
14
|
-
├── evolution-history.json
|
|
15
|
-
├── evolution-log.md
|
|
16
|
-
├── references/
|
|
17
|
-
│ ├── phase-0-
|
|
18
|
-
│
|
|
19
|
-
|
|
19
|
+
├── evolution-history.json
|
|
20
|
+
├── evolution-log.md
|
|
21
|
+
├── references/
|
|
22
|
+
│ ├── phase-minus-0-5-auto-estimate.md # Phase -0.5: AUTO-ESTIMATE
|
|
23
|
+
│ ├── phase-0-think.md # Phase 0: brainstorming → CONTEXT.md + ADR
|
|
24
|
+
│ ├── phase-1-plan.md # Phase 1: autoplan + delphi-review (HARD-GATE)
|
|
25
|
+
│ ├── phase-2-build.md # Phase 2: ralph-loop default + TDD + test-align
|
|
26
|
+
│ ├── phase-3-review.md # Phase 3: code-walkthrough + QA + benchmark
|
|
27
|
+
│ ├── phase-4-uat.md # Phase 4: USER ACCEPTANCE
|
|
28
|
+
│ ├── phase-5-feedback.md # Phase 5: retro + debugging + learn
|
|
29
|
+
│ ├── phase-6-ship.md # Phase 6: finishing-dev-branch + PR
|
|
30
|
+
│ ├── phase-7-land.md # Phase 7: land + deploy
|
|
31
|
+
│ ├── phase-8-cleanup.md # Phase 8: sprint branch cleanup
|
|
32
|
+
│ ├── force-levels.md # Phase forcing rules
|
|
33
|
+
│ └── components/ # Reusable phase building blocks
|
|
34
|
+
└── templates/
|
|
35
|
+
├── auto-estimate-output-template.md
|
|
36
|
+
├── auto-estimate-learning-log.md
|
|
37
|
+
├── pain-document-template.md
|
|
38
|
+
├── sprint-progress-template.md
|
|
39
|
+
├── sprint-summary-template.md
|
|
40
|
+
└── emergent-issues-template.md
|
|
20
41
|
```
|
|
21
42
|
|
|
22
43
|
## WHERE TO LOOK
|
|
23
44
|
| Task | Location | Notes |
|
|
24
45
|
|------|----------|-------|
|
|
25
|
-
| Pipeline
|
|
46
|
+
| Pipeline definition | SKILL.md | 11 phases with HARD-GATE between Phase 1 and Phase 2 |
|
|
47
|
+
| Auto-estimate phase | references/phase-minus-0-5-auto-estimate.md | Sizing pass before THINK |
|
|
26
48
|
| THINK phase | references/phase-0-think.md | brainstorming → CONTEXT.md + ADR |
|
|
27
|
-
|
|
|
49
|
+
| PLAN phase + HARD-GATE | references/phase-1-plan.md | autoplan → delphi-review → specification.yaml |
|
|
50
|
+
| BUILD phase | references/phase-2-build.md | ralph-loop (default) vs parallel |
|
|
51
|
+
| Force-level rules | references/force-levels.md | Defines when each phase becomes mandatory |
|
|
52
|
+
| Templates | templates/ | Auto-estimate, sprint progress/summary, pain doc, emergent issues |
|
|
53
|
+
|
|
54
|
+
## THE 11 PHASES
|
|
28
55
|
|
|
29
|
-
## 7 PHASES
|
|
30
56
|
| Phase | Name | Key Action | Hard Gate |
|
|
31
57
|
|-------|------|-----------|-----------|
|
|
32
|
-
|
|
|
33
|
-
|
|
|
34
|
-
|
|
|
58
|
+
| -1 | ISOLATE | Isolate working tree / worktree creation | — |
|
|
59
|
+
| -0.5 | AUTO-ESTIMATE | Sizing pass; emits estimate template | — |
|
|
60
|
+
| 0 | THINK | brainstorming → CONTEXT.md + ADR | — |
|
|
61
|
+
| 1 | PLAN | autoplan → delphi-review → specification.yaml | **HARD-GATE**: design must reach ≥91% Delphi consensus |
|
|
62
|
+
| 2 | BUILD | ralph-loop (REQ-level, default) + TDD + test-spec-alignment | — |
|
|
35
63
|
| 3 | REVIEW | code-walkthrough + QA + benchmark | — |
|
|
36
|
-
| 4 | USER
|
|
37
|
-
| 5 | FEEDBACK |
|
|
38
|
-
| 6 | SHIP | finishing-
|
|
64
|
+
| 4 | USER ACCEPTANCE | Manual verification | — |
|
|
65
|
+
| 5 | FEEDBACK | retro + debugging + `learn` (Sprint-level) | — |
|
|
66
|
+
| 6 | SHIP | finishing-a-development-branch → PR | — |
|
|
67
|
+
| 7 | LAND | land + deploy + canary | — |
|
|
68
|
+
| 8 | CLEANUP | Sprint branch cleanup (per `docs/plans/2026-06-06-sprint-branch-cleanup-design.md`) | — |
|
|
39
69
|
|
|
40
70
|
## CONVENTIONS
|
|
41
|
-
- ralph-loop is Phase 2
|
|
42
|
-
- delphi-review HARD-GATE in Phase 1
|
|
43
|
-
-
|
|
44
|
-
-
|
|
71
|
+
- **ralph-loop is Phase 2 default**. Each REQ runs in a clean context (no linear accumulation), saving 40-67% tokens vs parallel mode.
|
|
72
|
+
- **delphi-review HARD-GATE in Phase 1**: design must reach ≥91% consensus across ≥2 model providers, domestic models only. Unapproved → BLOCK coding.
|
|
73
|
+
- **`learn` is called twice**: once per REQ in Phase 2 (ralph-loop internal, `progress.log` permanent/contextual classification) and once in Phase 5 (Sprint-level retro).
|
|
74
|
+
- **Phase isolation**: each phase has explicit entry/exit criteria documented in its `references/phase-*.md` file.
|
|
75
|
+
- **Emergent Requirements** discovered in Phase 4 (USER ACCEPTANCE) are explicitly captured via `templates/emergent-issues-template.md` — never silently merged.
|
|
76
|
+
- **Auto-detection**: Phase 0 uses `src/npm-package/lib/ui-detector.ts` to pick the right tech-stack templates.
|
|
45
77
|
|
|
46
78
|
## ANTI-PATTERNS (THIS PROJECT)
|
|
47
|
-
- Do NOT skip delphi-review in Phase 1 — HARD-GATE blocks implementation
|
|
48
|
-
- Do NOT use parallel build mode unless explicitly requested
|
|
49
|
-
- Do NOT enter Phase 1 (PLAN) without completing THINK
|
|
50
|
-
-
|
|
79
|
+
- Do NOT skip `delphi-review` in Phase 1 — HARD-GATE blocks implementation.
|
|
80
|
+
- Do NOT use parallel build mode unless explicitly requested. Ralph-loop is the default for a reason.
|
|
81
|
+
- Do NOT enter Phase 1 (PLAN) without completing Phase 0 (THINK).
|
|
82
|
+
- Do NOT implement before design is APPROVED — Phase 1 must reach Delphi consensus first.
|
|
83
|
+
- Do NOT merge an Emergent Requirement into the original Sprint silently — capture it via the template.
|
|
84
|
+
- Do NOT terminate Delphi review before ≥91% consensus or 5 rounds, whichever first.
|
|
51
85
|
|
|
52
86
|
## UNIQUE STYLES
|
|
53
|
-
-
|
|
54
|
-
-
|
|
55
|
-
-
|
|
56
|
-
-
|
|
87
|
+
- **11 phases** including negative-numbered pre-phases (-1, -0.5) — intentional, captures the work that happens before "real" coding starts.
|
|
88
|
+
- **HARD-GATE** between PLAN and BUILD is enforced both in the SKILL.md instructions and in the Claude Code plugin's PreToolUse hook (`plugins/claude-code/bin/delphi-review-guard.sh`).
|
|
89
|
+
- **Per-REQ clean context in ralph-loop** = the core efficiency mechanism. Sprint-flow specifically chooses this over parallel mode.
|
|
90
|
+
- **Tech-stack auto-detection** via `--type` and `--lang` flags or `ui-detector.ts`.
|
|
57
91
|
|
|
58
92
|
## COMMANDS
|
|
59
93
|
```bash
|
|
94
|
+
/sprint-flow "开发用户登录" # Full 11-phase pipeline
|
|
95
|
+
/sprint-flow "开发用户登录" --type web-nextjs --lang typescript # Pin tech stack
|
|
96
|
+
/sprint-flow "开发用户登录" --phase build-only # Skip planning (advanced)
|
|
97
|
+
/sprint-flow "开发用户登录" --mode parallel # Legacy all-at-once (NOT default)
|
|
60
98
|
/delphi-review "开发用户登录" --type web-nextjs --lang typescript
|
|
61
|
-
/sprint-flow "开发用户登录" --phase build-only
|
|
62
|
-
/sprint-flow "开发用户登录" --mode parallel # Legacy all-at-once
|
|
63
99
|
```
|
|
64
100
|
|
|
65
101
|
## NOTES
|
|
66
|
-
- Integrates brainstorming, autoplan, delphi-review, TDD, test-specification-alignment
|
|
67
|
-
- ralph-loop internal learnings via progress.log (permanent
|
|
68
|
-
- Phase 5 calls gstack/learn for Sprint-level retrospective
|
|
102
|
+
- Integrates: brainstorming, autoplan, delphi-review, TDD, test-specification-alignment, qa, design-review, benchmark, systematic-debugging, retro, learn, finishing-a-development-branch.
|
|
103
|
+
- ralph-loop's internal learnings are persisted via `progress.log` (permanent vs contextual classification).
|
|
104
|
+
- Phase 5 calls `gstack/learn` for Sprint-level retrospective.
|
|
105
|
+
- Phase 8 cleanup behavior is governed by `docs/plans/2026-06-06-sprint-branch-cleanup-design.md`.
|
|
106
|
+
- This `AGENTS.md` is the canonical version. **7 byte-identical mirrors** exist at:
|
|
107
|
+
- `plugins/claude-code/skills/sprint-flow/AGENTS.md`
|
|
108
|
+
- `plugins/opencode/skills/sprint-flow/AGENTS.md`
|
|
109
|
+
- `plugins/qoder/skills/sprint-flow/AGENTS.md`
|
|
110
|
+
- `src/npm-package/skills/sprint-flow/AGENTS.md`
|
|
111
|
+
- `src/npm-package/plugins/claude-code/skills/sprint-flow/AGENTS.md`
|
|
112
|
+
- `src/npm-package/plugins/opencode/skills/sprint-flow/AGENTS.md`
|
|
113
|
+
- `src/npm-package/plugins/qoder/skills/sprint-flow/AGENTS.md`
|
|
114
|
+
Mirrors are updated by `scripts/copy-skills.sh`. Do NOT edit them by hand.
|
|
115
|
+
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# SKILLS/TEST-SPECIFICATION-ALIGNMENT KNOWLEDGE BASE
|
|
2
2
|
|
|
3
|
-
**Generated:** 2026-
|
|
4
|
-
**Commit:**
|
|
3
|
+
**Generated:** 2026-06-11
|
|
4
|
+
**Commit:** c18f82b
|
|
5
5
|
**Branch:** main
|
|
6
|
-
**Version:**
|
|
6
|
+
**Version:** 0.8.9.0
|
|
7
7
|
|
|
8
8
|
## OVERVIEW
|
|
9
9
|
Test-Specification Alignment Engine — two-stage validation ensuring tests accurately reflect requirements and design specs.
|
|
@@ -4,9 +4,21 @@ OpenCode plugin exposing xp-gate quality gates and AI workflow skills.
|
|
|
4
4
|
|
|
5
5
|
## Tools
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
These three tools are **dual-surface**: callable both as OpenCode tools (from
|
|
8
|
+
inside an OpenCode session) and as `xp-gate` CLI subcommands (from any shell).
|
|
9
|
+
Both paths produce identical output. See repo README for the matching CLI table.
|
|
10
|
+
|
|
11
|
+
- **gate-check** ⇄ `xp-gate check <path>`: Run user-invokable quality gates
|
|
12
|
+
(Gate 4 Principles + Gate 6 Architecture) on a file or directory.
|
|
13
|
+
- **gate-principles** ⇄ `xp-gate principles <path>`: Run Clean Code + SOLID
|
|
14
|
+
principles checker (Gate 4 standalone).
|
|
15
|
+
- **gate-arch** ⇄ `xp-gate arch`: Run architecture validation (Gate 6
|
|
16
|
+
standalone, layer boundary checks).
|
|
17
|
+
|
|
18
|
+
> Earlier docs said "all 6 quality gates" — that was inaccurate. `gate-check`
|
|
19
|
+
> intentionally runs only the two user-invokable gates (Principles + Arch); the
|
|
20
|
+
> full 10-gate pre-commit suite (Gate 0-9) is enforced by `xp-gate init`'s git
|
|
21
|
+
> hooks, not by this tool. Fixes #208.
|
|
10
22
|
|
|
11
23
|
## Installation
|
|
12
24
|
|
|
@@ -29,10 +41,14 @@ Or via local path (development):
|
|
|
29
41
|
## Requirements
|
|
30
42
|
|
|
31
43
|
- OpenCode v0.11+
|
|
32
|
-
-
|
|
33
|
-
-
|
|
34
|
-
- `
|
|
44
|
+
- One of:
|
|
45
|
+
- `xp-gate` CLI installed globally (`npm install -g @boyingliu01/xp-gate`) — **preferred**, or
|
|
46
|
+
- the xp-gate repo checked out locally with `src/principles/index.ts` reachable — **fallback** (the tool will shell out via `npx -y tsx`)
|
|
47
|
+
- `architecture.yaml` in repo root (for `gate-arch` only)
|
|
35
48
|
|
|
36
49
|
## Graceful Degradation
|
|
37
50
|
|
|
38
|
-
|
|
51
|
+
Every tool runs a chained shell-out: it first tries `xp-gate <subcommand>` and,
|
|
52
|
+
only if that's not on `PATH`, falls back to invoking the underlying checker
|
|
53
|
+
source directly. If both paths fail, the tool returns install instructions
|
|
54
|
+
instead of throwing.
|
|
@@ -1,57 +1,69 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* XP-Gate OpenCode Plugin
|
|
3
3
|
*
|
|
4
|
-
* Exposes 3
|
|
5
|
-
* - gate-check: Run
|
|
6
|
-
* - gate-principles: Run Clean Code + SOLID principles checker
|
|
7
|
-
* - gate-arch: Run architecture validation
|
|
4
|
+
* Exposes 3 OpenCode tools that mirror the equivalent `xp-gate` CLI subcommands:
|
|
5
|
+
* - gate-check: Run user-invokable quality gates (Gate 4 Principles + Gate 6 Arch) on a path
|
|
6
|
+
* - gate-principles: Run Clean Code + SOLID principles checker (Gate 4 standalone)
|
|
7
|
+
* - gate-arch: Run architecture validation (Gate 6 standalone)
|
|
8
8
|
*
|
|
9
|
-
*
|
|
9
|
+
* Dual-surface design (fixes #208): every tool is callable BOTH from inside an
|
|
10
|
+
* OpenCode session (as these tools) AND from a plain shell (as `xp-gate check`,
|
|
11
|
+
* `xp-gate principles`, `xp-gate arch`). The tools prefer the global `xp-gate`
|
|
12
|
+
* CLI when available, but fall back to running the checker source directly via
|
|
13
|
+
* `npx -y tsx` so they work even before `npm install -g @boyingliu01/xp-gate`.
|
|
10
14
|
*/
|
|
11
15
|
import { tool } from "@opencode-ai/plugin"
|
|
12
16
|
import { z } from "zod"
|
|
13
17
|
|
|
14
|
-
|
|
18
|
+
interface OpenCodePluginInput {
|
|
19
|
+
directory: string
|
|
20
|
+
$: (strings: TemplateStringsArray, ...values: unknown[]) => Promise<{ text(): Promise<string> }>
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const XpGatePlugin = async (input: OpenCodePluginInput) => {
|
|
15
24
|
const { directory, $ } = input
|
|
16
25
|
|
|
17
26
|
return {
|
|
18
27
|
tool: {
|
|
19
28
|
"gate-check": tool({
|
|
20
29
|
description:
|
|
21
|
-
"Run xp-gate quality
|
|
30
|
+
"Run xp-gate user-invokable quality gates (Gate 4 Principles + Gate 6 Architecture) on a file or directory. Prefers global xp-gate CLI; falls back to running checker source directly.",
|
|
22
31
|
args: {
|
|
23
32
|
path: z.string().describe("File or directory path (absolute or relative to workspace)"),
|
|
24
|
-
gates: z.array(z.string()).optional().describe("Optional gate subset (e.g. ['principles', '
|
|
33
|
+
gates: z.array(z.string()).optional().describe("Optional gate subset (e.g. ['principles', 'arch'])"),
|
|
25
34
|
},
|
|
26
35
|
async execute(args, ctx) {
|
|
27
36
|
const cwd = ctx.directory || directory
|
|
28
37
|
const target = args.path.startsWith("/") ? args.path : `${cwd}/${args.path}`
|
|
29
|
-
const
|
|
38
|
+
const gatesFlag = args.gates?.length ? ` --gates ${args.gates.join(",")}` : ""
|
|
39
|
+
// Prefer the installed xp-gate CLI. Fall back to invoking the same
|
|
40
|
+
// subcommand source directly via npx tsx so the tool still works in
|
|
41
|
+
// a fresh clone before `npm install -g @boyingliu01/xp-gate`.
|
|
42
|
+
const cmd = `cd "${cwd}" && (command -v xp-gate >/dev/null 2>&1 && xp-gate check "${target}"${gatesFlag} || node ${directory}/src/npm-package/bin/xp-gate.js check "${target}"${gatesFlag})`
|
|
30
43
|
try {
|
|
31
|
-
const result = await $`bash -c ${
|
|
44
|
+
const result = await $`bash -c ${cmd}`
|
|
32
45
|
const text = await result.text()
|
|
33
|
-
return text || "[XP-Gate] Check complete."
|
|
46
|
+
return text || "[XP-Gate] Check complete (no violations)."
|
|
34
47
|
} catch (err) {
|
|
35
|
-
return `[XP-Gate] xp-gate CLI
|
|
48
|
+
return `[XP-Gate] gate-check failed.\nInstall xp-gate CLI: npm install -g @boyingliu01/xp-gate\n${err instanceof Error ? err.message : ""}`
|
|
36
49
|
}
|
|
37
50
|
},
|
|
38
51
|
}),
|
|
39
52
|
"gate-principles": tool({
|
|
40
53
|
description:
|
|
41
|
-
"Run Clean Code + SOLID principles checker on a file.",
|
|
54
|
+
"Run Clean Code + SOLID principles checker (Gate 4 standalone) on a file or directory.",
|
|
42
55
|
args: {
|
|
43
|
-
path: z.string().describe("Source file path to check"),
|
|
56
|
+
path: z.string().describe("Source file or directory path to check"),
|
|
44
57
|
},
|
|
45
58
|
async execute(args, ctx) {
|
|
46
59
|
const cwd = ctx.directory || directory
|
|
47
60
|
const target = args.path.startsWith("/") ? args.path : `${cwd}/${args.path}`
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
const cmd = `cd "${cwd}" && command -v xp-gate >/dev/null 2>&1 && xp-gate principles "${target}" || npx -y tsx ${directory}/src/principles/index.ts --files "${target}" --format console`
|
|
61
|
+
// Try xp-gate CLI first, fall back to the principles source directly.
|
|
62
|
+
const cmd = `cd "${cwd}" && (command -v xp-gate >/dev/null 2>&1 && xp-gate principles "${target}" || npx -y tsx ${directory}/src/principles/index.ts --files "${target}" --format console)`
|
|
51
63
|
try {
|
|
52
64
|
const result = await $`bash -c ${cmd}`
|
|
53
65
|
const text = await result.text()
|
|
54
|
-
return text || "[XP-Gate] Principles check complete."
|
|
66
|
+
return text || "[XP-Gate] Principles check complete (no violations)."
|
|
55
67
|
} catch (err) {
|
|
56
68
|
return `[XP-Gate] Principles checker failed.\nInstall xp-gate CLI: npm install -g @boyingliu01/xp-gate\n${err instanceof Error ? err.message : ""}`
|
|
57
69
|
}
|
|
@@ -59,18 +71,21 @@ export const XpGatePlugin = async (input) => {
|
|
|
59
71
|
}),
|
|
60
72
|
"gate-arch": tool({
|
|
61
73
|
description:
|
|
62
|
-
"Run architecture validation (layer boundary checks) on the repository.",
|
|
74
|
+
"Run architecture validation (Gate 6 standalone, layer boundary checks) on the repository.",
|
|
63
75
|
args: {
|
|
64
76
|
config: z.string().describe("Path to architecture config file").default("architecture.yaml"),
|
|
65
77
|
},
|
|
66
78
|
async execute(args, ctx) {
|
|
67
79
|
const cwd = ctx.directory || directory
|
|
80
|
+
// Prefer xp-gate CLI; fall back to @archlinter/cli directly so the tool
|
|
81
|
+
// also works without xp-gate installed (matches gate-principles pattern).
|
|
82
|
+
const cmd = `cd "${cwd}" && (command -v xp-gate >/dev/null 2>&1 && xp-gate arch --config ${args.config} || npx -y @archlinter/cli scan . --config ${args.config})`
|
|
68
83
|
try {
|
|
69
|
-
const result = await $`bash -c ${
|
|
84
|
+
const result = await $`bash -c ${cmd}`
|
|
70
85
|
const text = await result.text()
|
|
71
86
|
return text || "[XP-Gate] Architecture check complete."
|
|
72
87
|
} catch (err) {
|
|
73
|
-
return `[XP-Gate] Architecture validation
|
|
88
|
+
return `[XP-Gate] Architecture validation failed.\nRequires architecture.yaml in repo root.\nInstall xp-gate CLI: npm install -g @boyingliu01/xp-gate\n${err instanceof Error ? err.message : ""}`
|
|
74
89
|
}
|
|
75
90
|
},
|
|
76
91
|
}),
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# SKILLS/DELPHI-REVIEW KNOWLEDGE BASE
|
|
2
2
|
|
|
3
|
-
**Generated:** 2026-
|
|
4
|
-
**Commit:**
|
|
3
|
+
**Generated:** 2026-06-11
|
|
4
|
+
**Commit:** c18f82b
|
|
5
5
|
**Branch:** main
|
|
6
|
-
**Version:**
|
|
6
|
+
**Version:** 0.8.9.0
|
|
7
7
|
|
|
8
8
|
## OVERVIEW
|
|
9
9
|
Delphi Consensus Review — multi-round anonymous expert review (≥91% threshold, 3 experts from ≥2 providers, domestic models only). Supports design + code-walkthrough modes.
|