@boyingliu01/xp-gate 0.15.5 → 0.18.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/adapter-common.sh +0 -0
- package/adapters/cpp.sh +0 -0
- package/adapters/dart.sh +0 -0
- package/adapters/flutter.sh +0 -0
- package/adapters/go.sh +0 -0
- package/adapters/iac.sh +0 -0
- package/adapters/java.sh +0 -0
- package/adapters/kotlin.sh +0 -0
- package/adapters/objectivec.sh +0 -0
- package/adapters/plugins/book299-20132-python/scripts/install-gradle.sh +0 -0
- package/adapters/plugins/book299-20132-python/scripts/install-maven.sh +0 -0
- package/adapters/plugins/book299-4081-c/scripts/install-gradle.sh +0 -0
- package/adapters/plugins/book299-4081-c/scripts/install-maven.sh +0 -0
- package/adapters/plugins/book299-4083-javascriptes5/scripts/install-gradle.sh +0 -0
- package/adapters/plugins/book299-4083-javascriptes5/scripts/install-maven.sh +0 -0
- package/adapters/powershell.sh +0 -0
- package/adapters/python.sh +0 -0
- package/adapters/shell.sh +0 -0
- package/adapters/swift.sh +0 -0
- package/adapters/typescript.sh +0 -0
- package/bin/xp-gate.js +29 -1
- package/gate-3.sh +0 -0
- package/gate-4.sh +0 -0
- package/gate-7.sh +0 -0
- package/gate-8.sh +0 -0
- package/gate-9.sh +0 -0
- package/hooks/adapter-common.sh +0 -0
- package/hooks/gate-3.sh +0 -0
- package/hooks/gate-4.sh +0 -0
- package/hooks/gate-7.sh +0 -0
- package/hooks/gate-8.sh +0 -0
- package/hooks/gate-9.sh +0 -0
- package/hooks/lib/now-ms.sh +33 -0
- package/hooks/pre-commit +63 -47
- package/hooks/pre-push +0 -0
- package/hooks/sprint-gate.sh +291 -0
- package/lib/__tests__/check-version.test.js +122 -0
- package/lib/__tests__/doctor.test.js +13 -15
- package/lib/__tests__/gate-audit.test.ts +38 -0
- package/lib/__tests__/phase-transition.test.js +512 -272
- package/lib/__tests__/retro.test.js +131 -0
- package/lib/__tests__/sprint-audit.test.js +207 -207
- package/lib/__tests__/sprint-status-rework.test.js +184 -0
- package/lib/check-version.js +9 -0
- package/lib/doctor-tui.js +268 -198
- package/lib/doctor.js +15 -3
- package/lib/gate-audit.ts +18 -7
- package/lib/gate-runner.js +77 -30
- package/lib/init.js +10 -0
- package/lib/language-tools.js +833 -833
- package/lib/mattpocock-license-verdict.json +7 -0
- package/lib/phase-transition.js +499 -249
- package/lib/retro.js +222 -0
- package/lib/shared-utils.js +7 -0
- package/lib/sprint-audit.js +235 -235
- package/lib/sprint-init.js +207 -0
- package/lib/sprint-state-migrator.js +1 -0
- package/lib/sprint-status.js +111 -0
- package/mock-policy/AGENTS.md +3 -3
- package/mutation/AGENTS.md +3 -3
- package/package.json +3 -2
- package/plugins/claude-code/.claude-plugin/plugin.json +1 -1
- package/plugins/claude-code/bin/delphi-review-guard.sh +0 -0
- package/plugins/claude-code/bin/xp-gate-check +0 -0
- package/plugins/claude-code/skills/batch-grill-me/SKILL.md +15 -0
- package/plugins/claude-code/skills/delphi-review/AGENTS.md +3 -3
- package/plugins/claude-code/skills/delphi-review/SKILL.md +59 -4
- package/plugins/claude-code/skills/delphi-review/references/requirements.md +390 -0
- package/plugins/claude-code/skills/delphi-review/references/round-templates.md +67 -0
- package/plugins/claude-code/skills/domain-modeling/ADR-FORMAT.md +64 -0
- package/plugins/claude-code/skills/domain-modeling/CONTEXT-FORMAT.md +60 -0
- package/plugins/claude-code/skills/domain-modeling/SKILL.md +74 -0
- package/plugins/claude-code/skills/grill-with-docs/SKILL.md +7 -0
- package/plugins/claude-code/skills/grilling/SKILL.md +12 -0
- package/plugins/claude-code/skills/sprint-flow/AGENTS.md +3 -3
- package/plugins/claude-code/skills/sprint-flow/SKILL.md +168 -43
- package/plugins/claude-code/skills/sprint-flow/references/components/memory.md +1 -1
- package/plugins/claude-code/skills/sprint-flow/references/components/middleware.md +1 -1
- package/plugins/claude-code/skills/sprint-flow/references/components/skill-invocations.md +21 -20
- package/plugins/claude-code/skills/sprint-flow/references/components/tool-descriptions.md +22 -23
- package/plugins/claude-code/skills/sprint-flow/references/orchestration-rules.md +14 -12
- package/plugins/claude-code/skills/sprint-flow/references/phase-2-design.md +145 -133
- package/plugins/claude-code/skills/sprint-flow/references/phase-3-build.md +69 -2
- package/plugins/claude-code/skills/sprint-flow/references/phase-4-verify.md +93 -31
- package/plugins/claude-code/skills/sprint-flow/references/phase-5-ship.md +99 -14
- package/plugins/claude-code/skills/sprint-flow/references/phase-6-close.md +37 -5
- package/plugins/claude-code/skills/sprint-flow/references/phase-overview.md +58 -53
- package/plugins/claude-code/skills/test-specification-alignment/AGENTS.md +3 -3
- package/plugins/claude-code/skills/test-specification-alignment/SKILL.md +8 -3
- package/plugins/claude-code/skills/to-issues/SKILL.md +1 -1
- package/plugins/opencode/index.ts +1 -0
- package/plugins/opencode/package.json +1 -1
- package/plugins/opencode/skills/batch-grill-me/SKILL.md +15 -0
- package/plugins/opencode/skills/delphi-review/AGENTS.md +3 -3
- package/plugins/opencode/skills/delphi-review/SKILL.md +59 -4
- package/plugins/opencode/skills/delphi-review/references/requirements.md +390 -0
- package/plugins/opencode/skills/delphi-review/references/round-templates.md +67 -0
- package/plugins/opencode/skills/domain-modeling/ADR-FORMAT.md +64 -0
- package/plugins/opencode/skills/domain-modeling/CONTEXT-FORMAT.md +60 -0
- package/plugins/opencode/skills/domain-modeling/SKILL.md +74 -0
- package/plugins/opencode/skills/grill-with-docs/SKILL.md +7 -0
- package/plugins/opencode/skills/grilling/SKILL.md +12 -0
- package/plugins/opencode/skills/sprint-flow/AGENTS.md +3 -3
- package/plugins/opencode/skills/sprint-flow/SKILL.md +168 -43
- package/plugins/opencode/skills/sprint-flow/references/components/memory.md +1 -1
- package/plugins/opencode/skills/sprint-flow/references/components/middleware.md +1 -1
- package/plugins/opencode/skills/sprint-flow/references/components/skill-invocations.md +21 -20
- package/plugins/opencode/skills/sprint-flow/references/components/tool-descriptions.md +22 -23
- package/plugins/opencode/skills/sprint-flow/references/orchestration-rules.md +14 -12
- package/plugins/opencode/skills/sprint-flow/references/phase-2-design.md +145 -133
- package/plugins/opencode/skills/sprint-flow/references/phase-3-build.md +69 -2
- package/plugins/opencode/skills/sprint-flow/references/phase-4-verify.md +93 -31
- package/plugins/opencode/skills/sprint-flow/references/phase-5-ship.md +99 -14
- package/plugins/opencode/skills/sprint-flow/references/phase-6-close.md +37 -5
- package/plugins/opencode/skills/sprint-flow/references/phase-overview.md +58 -53
- package/plugins/opencode/skills/test-specification-alignment/AGENTS.md +3 -3
- package/plugins/opencode/skills/test-specification-alignment/SKILL.md +8 -3
- package/plugins/opencode/skills/to-issues/SKILL.md +1 -1
- package/plugins/qoder/agents/delphi-architecture.md +48 -48
- package/plugins/qoder/agents/delphi-feasibility.md +48 -48
- package/plugins/qoder/agents/delphi-technical.md +48 -48
- package/plugins/qoder/bin/sprint-flow-guard.sh +0 -0
- package/plugins/qoder/bin/xp-gate-check +0 -0
- package/plugins/qoder/plugin.json +1 -1
- package/plugins/qoder/skills/delphi-review/AGENTS.md +3 -3
- package/plugins/qoder/skills/sprint-flow/AGENTS.md +3 -3
- package/plugins/qoder/skills/test-specification-alignment/AGENTS.md +3 -3
- package/principles/AGENTS.md +3 -3
- package/scripts/__tests__/check-mattpocock-license.test.js +229 -0
- package/scripts/__tests__/sync-package-content.test.js +50 -0
- package/scripts/check-mattpocock-license.cjs +302 -0
- package/scripts/delphi-external-review.cjs +432 -432
- package/scripts/migrate-audit-anomalies.mjs +78 -0
- package/scripts/sync-package-content.js +52 -5
- package/skills/batch-grill-me/SKILL.md +15 -0
- package/skills/delphi-review/AGENTS.md +3 -3
- package/skills/delphi-review/SKILL.md +59 -4
- package/skills/delphi-review/references/requirements.md +390 -0
- package/skills/delphi-review/references/round-templates.md +67 -0
- package/skills/domain-modeling/ADR-FORMAT.md +64 -0
- package/skills/domain-modeling/CONTEXT-FORMAT.md +60 -0
- package/skills/domain-modeling/SKILL.md +74 -0
- package/skills/grill-with-docs/SKILL.md +7 -0
- package/skills/grilling/SKILL.md +12 -0
- package/skills/sprint-flow/AGENTS.md +3 -3
- package/skills/sprint-flow/SKILL.md +168 -43
- package/skills/sprint-flow/references/components/memory.md +1 -1
- package/skills/sprint-flow/references/components/middleware.md +1 -1
- package/skills/sprint-flow/references/components/skill-invocations.md +21 -20
- package/skills/sprint-flow/references/components/tool-descriptions.md +22 -23
- package/skills/sprint-flow/references/orchestration-rules.md +14 -12
- package/skills/sprint-flow/references/phase-2-design.md +145 -133
- package/skills/sprint-flow/references/phase-3-build.md +69 -2
- package/skills/sprint-flow/references/phase-4-verify.md +93 -31
- package/skills/sprint-flow/references/phase-5-ship.md +99 -14
- package/skills/sprint-flow/references/phase-6-close.md +37 -5
- package/skills/sprint-flow/references/phase-overview.md +58 -53
- package/skills/test-specification-alignment/AGENTS.md +3 -3
- package/skills/test-specification-alignment/SKILL.md +8 -3
- package/skills/to-issues/SKILL.md +1 -1
- package/adapters/gate-3.sh +0 -68
- package/adapters/gate-4.sh +0 -80
- package/adapters/gate-7.sh +0 -45
- package/adapters/gate-8.sh +0 -56
- package/adapters/gate-9.sh +0 -104
package/lib/gate-runner.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const { execSync, execFileSync } = require('child_process');
|
|
3
|
+
const { execSync, execFileSync, spawnSync } = require('child_process');
|
|
4
4
|
const fs = require('fs');
|
|
5
5
|
const path = require('path');
|
|
6
6
|
|
|
@@ -28,6 +28,54 @@ function runBashScript(scriptPath) {
|
|
|
28
28
|
// Gate metadata registry — maps gate IDs to names, descriptions, and how to run them.
|
|
29
29
|
// Standalone gates (<gate-id>: { run }) are invokable via xp-gate gate-<id>.
|
|
30
30
|
// Pre-commit-only gates (<gate-id>: { preCommitOnly: true }) run only in git commit context.
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Run a TypeScript gate module via npx tsx.
|
|
34
|
+
* Finds the .ts entry point, spawns tsx with --run flag.
|
|
35
|
+
* Falls back to bash script if TypeScript module not found.
|
|
36
|
+
*/
|
|
37
|
+
function runTsGate(gateModule, targetPath) {
|
|
38
|
+
const entry = findTsGateEntry(gateModule);
|
|
39
|
+
if (!entry) {
|
|
40
|
+
// Fallback to bash script
|
|
41
|
+
const script = resolveGateScript(gateModule.replace('gate-', ''));
|
|
42
|
+
if (script) {
|
|
43
|
+
runBashScript(script);
|
|
44
|
+
} else {
|
|
45
|
+
console.log(`Gate ${gateModule}: TypeScript module not found and no bash fallback available.`);
|
|
46
|
+
}
|
|
47
|
+
return 0;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const args = ['-y', 'tsx', entry, '--run'];
|
|
51
|
+
if (targetPath) args.push('--cwd', targetPath);
|
|
52
|
+
|
|
53
|
+
const result = spawnSync('npx', args, {
|
|
54
|
+
stdio: 'inherit',
|
|
55
|
+
shell: process.platform === 'win32',
|
|
56
|
+
cwd: targetPath || process.cwd(),
|
|
57
|
+
timeout: 120000,
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
return result.status === null ? 1 : result.status;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function findTsGateEntry(gateModule) {
|
|
64
|
+
const candidates = [
|
|
65
|
+
// Development layout
|
|
66
|
+
path.resolve(__dirname, '..', '..', '..', 'src', 'gates', `${gateModule}.ts`),
|
|
67
|
+
// npm package bundled layout
|
|
68
|
+
path.resolve(__dirname, '..', 'gates', `${gateModule}.ts`),
|
|
69
|
+
// node_modules install
|
|
70
|
+
path.resolve(__dirname, '..', '..', 'src', 'gates', `${gateModule}.ts`),
|
|
71
|
+
// Repo root
|
|
72
|
+
path.resolve(process.cwd(), 'src', 'gates', `${gateModule}.ts`),
|
|
73
|
+
];
|
|
74
|
+
for (const c of candidates) {
|
|
75
|
+
if (fs.existsSync(c)) return c;
|
|
76
|
+
}
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
31
79
|
const GATE_REGISTRY = {
|
|
32
80
|
'0': {
|
|
33
81
|
name: 'Version Consistency',
|
|
@@ -59,14 +107,7 @@ const GATE_REGISTRY = {
|
|
|
59
107
|
description: 'lizard cyclomatic complexity analysis',
|
|
60
108
|
aliases: ['complexity', 'ccn', '3'],
|
|
61
109
|
run: (targetPath) => {
|
|
62
|
-
|
|
63
|
-
if (script) {
|
|
64
|
-
runBashScript(script);
|
|
65
|
-
} else {
|
|
66
|
-
const target = targetPath || '.';
|
|
67
|
-
console.log(`Running lizard on ${target}...`);
|
|
68
|
-
execFileSync('lizard', [target, '--CCN', '10', '--length', '50', '--arguments', '5', '--warnings_only'], { stdio: 'inherit', shell: true });
|
|
69
|
-
}
|
|
110
|
+
return runTsGate('gate-3', targetPath);
|
|
70
111
|
},
|
|
71
112
|
},
|
|
72
113
|
'4': {
|
|
@@ -99,13 +140,7 @@ const GATE_REGISTRY = {
|
|
|
99
140
|
description: 'Infrastructure-as-Code security scanning (checkov, hadolint, kube-score, tflint)',
|
|
100
141
|
aliases: ['iac', 'infra', '7'],
|
|
101
142
|
run: (targetPath) => {
|
|
102
|
-
|
|
103
|
-
if (script) {
|
|
104
|
-
runBashScript(script);
|
|
105
|
-
} else {
|
|
106
|
-
console.log('IaC security scan requires git-staged context for changed files detection.');
|
|
107
|
-
console.log('Run: git commit to trigger Gate 7 automatically.');
|
|
108
|
-
}
|
|
143
|
+
return runTsGate('gate-7', targetPath);
|
|
109
144
|
},
|
|
110
145
|
},
|
|
111
146
|
'8': {
|
|
@@ -113,13 +148,7 @@ const GATE_REGISTRY = {
|
|
|
113
148
|
description: 'gitleaks secret and credential detection',
|
|
114
149
|
aliases: ['secrets', 'secret', '8'],
|
|
115
150
|
run: (targetPath) => {
|
|
116
|
-
|
|
117
|
-
if (script) {
|
|
118
|
-
runBashScript(script);
|
|
119
|
-
} else {
|
|
120
|
-
console.log('Secret scanning requires git-staged context for changed files detection.');
|
|
121
|
-
console.log('Run: git commit to trigger Gate 8 automatically.');
|
|
122
|
-
}
|
|
151
|
+
return runTsGate('gate-8', targetPath);
|
|
123
152
|
},
|
|
124
153
|
},
|
|
125
154
|
'9': {
|
|
@@ -127,13 +156,7 @@ const GATE_REGISTRY = {
|
|
|
127
156
|
description: 'semgrep static application security testing',
|
|
128
157
|
aliases: ['sast', 'semgrep', '9'],
|
|
129
158
|
run: (targetPath) => {
|
|
130
|
-
|
|
131
|
-
if (script) {
|
|
132
|
-
runBashScript(script);
|
|
133
|
-
} else {
|
|
134
|
-
console.log('SAST scanning requires git-staged context for changed files detection.');
|
|
135
|
-
console.log('Run: git commit to trigger Gate 9 automatically.');
|
|
136
|
-
}
|
|
159
|
+
return runTsGate('gate-9', targetPath);
|
|
137
160
|
},
|
|
138
161
|
},
|
|
139
162
|
'10': {
|
|
@@ -150,6 +173,30 @@ const GATE_REGISTRY = {
|
|
|
150
173
|
preCommitOnly: true,
|
|
151
174
|
reason: 'Requires sprint state (.sprint-state/) and git branch context',
|
|
152
175
|
},
|
|
176
|
+
'python-health': {
|
|
177
|
+
name: 'Python Environment Health',
|
|
178
|
+
description: 'Comprehensive Python environment diagnostics',
|
|
179
|
+
aliases: ['python-health', 'py-health'],
|
|
180
|
+
run: (targetPath) => {
|
|
181
|
+
return runTsGate('python-health', targetPath);
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
'test-layers': {
|
|
185
|
+
name: 'Test Layer Analytics',
|
|
186
|
+
description: 'Report test distribution across unit/integration/e2e layers',
|
|
187
|
+
aliases: ['test-layers', 'layers', 'test-analytics'],
|
|
188
|
+
run: (targetPath) => {
|
|
189
|
+
return runTsGate('test-layers', targetPath);
|
|
190
|
+
},
|
|
191
|
+
},
|
|
192
|
+
'pbt': {
|
|
193
|
+
name: 'Property-Based Testing Detection',
|
|
194
|
+
description: 'Detect PBT framework usage and report coverage',
|
|
195
|
+
aliases: ['pbt', 'pbt-detect', 'property-based-testing'],
|
|
196
|
+
run: (targetPath) => {
|
|
197
|
+
return runTsGate('pbt-detect', targetPath);
|
|
198
|
+
},
|
|
199
|
+
},
|
|
153
200
|
};
|
|
154
201
|
|
|
155
202
|
// Reverse-lookup: alias → gate ID (built once at module load)
|
package/lib/init.js
CHANGED
|
@@ -318,6 +318,7 @@ async function init(args) {
|
|
|
318
318
|
console.log('====================\n');
|
|
319
319
|
|
|
320
320
|
// Check bash availability (required for shell hooks)
|
|
321
|
+
console.log('Checking bash availability...');
|
|
321
322
|
const bashCheck = checkBash();
|
|
322
323
|
if (bashCheck.ok) {
|
|
323
324
|
console.log(`Bash: ✓ ${bashCheck.path} (v${bashCheck.version})\n`);
|
|
@@ -327,8 +328,10 @@ async function init(args) {
|
|
|
327
328
|
}
|
|
328
329
|
|
|
329
330
|
// Check CLI tools availability (quality gates will SKIP silently if tools are missing)
|
|
331
|
+
console.log('Checking CLI tools...');
|
|
330
332
|
printCliToolStatus();
|
|
331
333
|
|
|
334
|
+
console.log('Checking platform dependencies...');
|
|
332
335
|
// Detect platform and check/auto-install dependencies
|
|
333
336
|
const platform = detectPlatform();
|
|
334
337
|
console.log(`Platform: ${platform}\n`);
|
|
@@ -534,18 +537,22 @@ async function setupGlobal(args) {
|
|
|
534
537
|
console.log(`Global hooks: ${GLOBAL_HOOKS_DIR}`);
|
|
535
538
|
console.log(`Global adapters: ${GLOBAL_ADAPTERS_DIR}\n`);
|
|
536
539
|
|
|
540
|
+
console.log('[setup-global] Creating global directories...');
|
|
537
541
|
fs.mkdirSync(GLOBAL_HOOKS_DIR, { recursive: true });
|
|
538
542
|
fs.mkdirSync(GLOBAL_ADAPTERS_DIR, { recursive: true });
|
|
539
543
|
|
|
544
|
+
console.log('[setup-global] Installing git hooks...');
|
|
540
545
|
copyHooks(srcDir, GLOBAL_HOOKS_DIR);
|
|
541
546
|
console.log('Installing hooks...');
|
|
542
547
|
console.log(` pre-commit -> ${GLOBAL_HOOKS_DIR}`);
|
|
543
548
|
console.log(` pre-push -> ${GLOBAL_HOOKS_DIR}`);
|
|
544
549
|
|
|
550
|
+
console.log('[setup-global] Installing adapters...');
|
|
545
551
|
copyAdapters(srcDir, GLOBAL_ADAPTERS_DIR);
|
|
546
552
|
console.log(` adapter-common.sh + adapters -> ${GLOBAL_ADAPTERS_DIR}`);
|
|
547
553
|
|
|
548
554
|
// Install principles/, mutation/, mock-policy/ to global modules dir
|
|
555
|
+
console.log('[setup-global] Installing quality gate modules...');
|
|
549
556
|
const globalModulesDir = path.join(CONFIG_DIR, 'modules');
|
|
550
557
|
['principles', 'mutation', 'mock-policy'].forEach(module => {
|
|
551
558
|
const moduleSrc = path.join(srcDir, module);
|
|
@@ -557,6 +564,7 @@ async function setupGlobal(args) {
|
|
|
557
564
|
}
|
|
558
565
|
});
|
|
559
566
|
|
|
567
|
+
console.log('[setup-global] Configuring git...');
|
|
560
568
|
const { execSync } = require('child_process');
|
|
561
569
|
try {
|
|
562
570
|
execSync(`git config --global core.hooksPath "${GLOBAL_HOOKS_DIR}"`);
|
|
@@ -567,6 +575,7 @@ async function setupGlobal(args) {
|
|
|
567
575
|
|
|
568
576
|
ensureConfigDir();
|
|
569
577
|
|
|
578
|
+
console.log('[setup-global] Generating installation manifest...');
|
|
570
579
|
const manifest = generateGlobalManifest(srcDir);
|
|
571
580
|
updateConfig({ lastInit: new Date().toISOString(), mode: 'global', templateDir: TEMPLATE_DIR, manifest });
|
|
572
581
|
|
|
@@ -581,6 +590,7 @@ async function setupGlobal(args) {
|
|
|
581
590
|
console.log('Per-project adapters can still override by creating <repo>/githooks/');
|
|
582
591
|
|
|
583
592
|
// Auto-install missing CLI tools (prompt user)
|
|
593
|
+
console.log('[setup-global] Checking quality gate CLI tools...');
|
|
584
594
|
const autoYes = args.includes('--yes') || args.includes('--auto-install');
|
|
585
595
|
await promptBootstrap(autoYes);
|
|
586
596
|
|