@boyingliu01/xp-gate 0.15.5 → 0.18.1

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.
Files changed (165) hide show
  1. package/adapter-common.sh +0 -0
  2. package/adapters/cpp.sh +0 -0
  3. package/adapters/dart.sh +0 -0
  4. package/adapters/flutter.sh +0 -0
  5. package/adapters/go.sh +0 -0
  6. package/adapters/iac.sh +0 -0
  7. package/adapters/java.sh +0 -0
  8. package/adapters/kotlin.sh +0 -0
  9. package/adapters/objectivec.sh +0 -0
  10. package/adapters/plugins/book299-20132-python/scripts/install-gradle.sh +0 -0
  11. package/adapters/plugins/book299-20132-python/scripts/install-maven.sh +0 -0
  12. package/adapters/plugins/book299-4081-c/scripts/install-gradle.sh +0 -0
  13. package/adapters/plugins/book299-4081-c/scripts/install-maven.sh +0 -0
  14. package/adapters/plugins/book299-4083-javascriptes5/scripts/install-gradle.sh +0 -0
  15. package/adapters/plugins/book299-4083-javascriptes5/scripts/install-maven.sh +0 -0
  16. package/adapters/powershell.sh +0 -0
  17. package/adapters/python.sh +0 -0
  18. package/adapters/shell.sh +0 -0
  19. package/adapters/swift.sh +0 -0
  20. package/adapters/typescript.sh +0 -0
  21. package/bin/xp-gate.js +29 -1
  22. package/gate-3.sh +0 -0
  23. package/gate-4.sh +0 -0
  24. package/gate-7.sh +0 -0
  25. package/gate-8.sh +0 -0
  26. package/gate-9.sh +0 -0
  27. package/hooks/adapter-common.sh +0 -0
  28. package/hooks/gate-3.sh +0 -0
  29. package/hooks/gate-4.sh +0 -0
  30. package/hooks/gate-7.sh +0 -0
  31. package/hooks/gate-8.sh +0 -0
  32. package/hooks/gate-9.sh +0 -0
  33. package/hooks/lib/now-ms.sh +33 -0
  34. package/hooks/pre-commit +63 -47
  35. package/hooks/pre-push +0 -0
  36. package/hooks/sprint-gate.sh +291 -0
  37. package/lib/__tests__/check-version.test.js +122 -0
  38. package/lib/__tests__/doctor.test.js +13 -15
  39. package/lib/__tests__/gate-audit.test.ts +38 -0
  40. package/lib/__tests__/phase-transition.test.js +512 -272
  41. package/lib/__tests__/retro.test.js +131 -0
  42. package/lib/__tests__/sprint-audit.test.js +207 -207
  43. package/lib/__tests__/sprint-status-rework.test.js +184 -0
  44. package/lib/check-version.js +9 -0
  45. package/lib/doctor-tui.js +268 -198
  46. package/lib/doctor.js +15 -3
  47. package/lib/gate-audit.ts +18 -7
  48. package/lib/gate-runner.js +77 -30
  49. package/lib/init.js +10 -0
  50. package/lib/language-tools.js +833 -833
  51. package/lib/mattpocock-license-verdict.json +7 -0
  52. package/lib/phase-transition.js +499 -249
  53. package/lib/retro.js +222 -0
  54. package/lib/shared-utils.js +7 -0
  55. package/lib/sprint-audit.js +235 -235
  56. package/lib/sprint-init.js +207 -0
  57. package/lib/sprint-state-migrator.js +1 -0
  58. package/lib/sprint-status.js +111 -0
  59. package/mock-policy/AGENTS.md +3 -3
  60. package/mutation/AGENTS.md +3 -3
  61. package/package.json +3 -2
  62. package/plugins/claude-code/.claude-plugin/plugin.json +1 -1
  63. package/plugins/claude-code/bin/delphi-review-guard.sh +0 -0
  64. package/plugins/claude-code/bin/xp-gate-check +0 -0
  65. package/plugins/claude-code/skills/batch-grill-me/SKILL.md +15 -0
  66. package/plugins/claude-code/skills/delphi-review/AGENTS.md +3 -3
  67. package/plugins/claude-code/skills/delphi-review/SKILL.md +59 -4
  68. package/plugins/claude-code/skills/delphi-review/references/requirements.md +390 -0
  69. package/plugins/claude-code/skills/delphi-review/references/round-templates.md +67 -0
  70. package/plugins/claude-code/skills/domain-modeling/ADR-FORMAT.md +64 -0
  71. package/plugins/claude-code/skills/domain-modeling/CONTEXT-FORMAT.md +60 -0
  72. package/plugins/claude-code/skills/domain-modeling/SKILL.md +74 -0
  73. package/plugins/claude-code/skills/grill-with-docs/SKILL.md +7 -0
  74. package/plugins/claude-code/skills/grilling/SKILL.md +12 -0
  75. package/plugins/claude-code/skills/sprint-flow/AGENTS.md +3 -3
  76. package/plugins/claude-code/skills/sprint-flow/SKILL.md +168 -43
  77. package/plugins/claude-code/skills/sprint-flow/references/components/memory.md +1 -1
  78. package/plugins/claude-code/skills/sprint-flow/references/components/middleware.md +1 -1
  79. package/plugins/claude-code/skills/sprint-flow/references/components/skill-invocations.md +21 -20
  80. package/plugins/claude-code/skills/sprint-flow/references/components/tool-descriptions.md +22 -23
  81. package/plugins/claude-code/skills/sprint-flow/references/orchestration-rules.md +14 -12
  82. package/plugins/claude-code/skills/sprint-flow/references/phase-2-design.md +145 -133
  83. package/plugins/claude-code/skills/sprint-flow/references/phase-3-build.md +69 -2
  84. package/plugins/claude-code/skills/sprint-flow/references/phase-4-verify.md +93 -31
  85. package/plugins/claude-code/skills/sprint-flow/references/phase-5-ship.md +99 -14
  86. package/plugins/claude-code/skills/sprint-flow/references/phase-6-close.md +37 -5
  87. package/plugins/claude-code/skills/sprint-flow/references/phase-overview.md +58 -53
  88. package/plugins/claude-code/skills/test-specification-alignment/AGENTS.md +3 -3
  89. package/plugins/claude-code/skills/test-specification-alignment/SKILL.md +8 -3
  90. package/plugins/claude-code/skills/to-issues/SKILL.md +1 -1
  91. package/plugins/opencode/index.ts +1 -0
  92. package/plugins/opencode/package.json +1 -1
  93. package/plugins/opencode/skills/batch-grill-me/SKILL.md +15 -0
  94. package/plugins/opencode/skills/delphi-review/AGENTS.md +3 -3
  95. package/plugins/opencode/skills/delphi-review/SKILL.md +59 -4
  96. package/plugins/opencode/skills/delphi-review/references/requirements.md +390 -0
  97. package/plugins/opencode/skills/delphi-review/references/round-templates.md +67 -0
  98. package/plugins/opencode/skills/domain-modeling/ADR-FORMAT.md +64 -0
  99. package/plugins/opencode/skills/domain-modeling/CONTEXT-FORMAT.md +60 -0
  100. package/plugins/opencode/skills/domain-modeling/SKILL.md +74 -0
  101. package/plugins/opencode/skills/grill-with-docs/SKILL.md +7 -0
  102. package/plugins/opencode/skills/grilling/SKILL.md +12 -0
  103. package/plugins/opencode/skills/sprint-flow/AGENTS.md +3 -3
  104. package/plugins/opencode/skills/sprint-flow/SKILL.md +168 -43
  105. package/plugins/opencode/skills/sprint-flow/references/components/memory.md +1 -1
  106. package/plugins/opencode/skills/sprint-flow/references/components/middleware.md +1 -1
  107. package/plugins/opencode/skills/sprint-flow/references/components/skill-invocations.md +21 -20
  108. package/plugins/opencode/skills/sprint-flow/references/components/tool-descriptions.md +22 -23
  109. package/plugins/opencode/skills/sprint-flow/references/orchestration-rules.md +14 -12
  110. package/plugins/opencode/skills/sprint-flow/references/phase-2-design.md +145 -133
  111. package/plugins/opencode/skills/sprint-flow/references/phase-3-build.md +69 -2
  112. package/plugins/opencode/skills/sprint-flow/references/phase-4-verify.md +93 -31
  113. package/plugins/opencode/skills/sprint-flow/references/phase-5-ship.md +99 -14
  114. package/plugins/opencode/skills/sprint-flow/references/phase-6-close.md +37 -5
  115. package/plugins/opencode/skills/sprint-flow/references/phase-overview.md +58 -53
  116. package/plugins/opencode/skills/test-specification-alignment/AGENTS.md +3 -3
  117. package/plugins/opencode/skills/test-specification-alignment/SKILL.md +8 -3
  118. package/plugins/opencode/skills/to-issues/SKILL.md +1 -1
  119. package/plugins/qoder/agents/delphi-architecture.md +48 -48
  120. package/plugins/qoder/agents/delphi-feasibility.md +48 -48
  121. package/plugins/qoder/agents/delphi-technical.md +48 -48
  122. package/plugins/qoder/bin/sprint-flow-guard.sh +0 -0
  123. package/plugins/qoder/bin/xp-gate-check +0 -0
  124. package/plugins/qoder/plugin.json +1 -1
  125. package/plugins/qoder/skills/delphi-review/AGENTS.md +3 -3
  126. package/plugins/qoder/skills/sprint-flow/AGENTS.md +3 -3
  127. package/plugins/qoder/skills/test-specification-alignment/AGENTS.md +3 -3
  128. package/principles/AGENTS.md +3 -3
  129. package/scripts/__tests__/check-mattpocock-license.test.js +229 -0
  130. package/scripts/__tests__/sync-package-content.test.js +50 -0
  131. package/scripts/check-mattpocock-license.cjs +302 -0
  132. package/scripts/delphi-external-review.cjs +432 -432
  133. package/scripts/migrate-audit-anomalies.mjs +78 -0
  134. package/scripts/sync-package-content.js +52 -5
  135. package/skills/batch-grill-me/SKILL.md +15 -0
  136. package/skills/delphi-review/AGENTS.md +3 -3
  137. package/skills/delphi-review/SKILL.md +59 -4
  138. package/skills/delphi-review/references/requirements.md +390 -0
  139. package/skills/delphi-review/references/round-templates.md +67 -0
  140. package/skills/domain-modeling/ADR-FORMAT.md +64 -0
  141. package/skills/domain-modeling/CONTEXT-FORMAT.md +60 -0
  142. package/skills/domain-modeling/SKILL.md +74 -0
  143. package/skills/grill-with-docs/SKILL.md +7 -0
  144. package/skills/grilling/SKILL.md +12 -0
  145. package/skills/sprint-flow/AGENTS.md +3 -3
  146. package/skills/sprint-flow/SKILL.md +168 -43
  147. package/skills/sprint-flow/references/components/memory.md +1 -1
  148. package/skills/sprint-flow/references/components/middleware.md +1 -1
  149. package/skills/sprint-flow/references/components/skill-invocations.md +21 -20
  150. package/skills/sprint-flow/references/components/tool-descriptions.md +22 -23
  151. package/skills/sprint-flow/references/orchestration-rules.md +14 -12
  152. package/skills/sprint-flow/references/phase-2-design.md +145 -133
  153. package/skills/sprint-flow/references/phase-3-build.md +69 -2
  154. package/skills/sprint-flow/references/phase-4-verify.md +93 -31
  155. package/skills/sprint-flow/references/phase-5-ship.md +99 -14
  156. package/skills/sprint-flow/references/phase-6-close.md +37 -5
  157. package/skills/sprint-flow/references/phase-overview.md +58 -53
  158. package/skills/test-specification-alignment/AGENTS.md +3 -3
  159. package/skills/test-specification-alignment/SKILL.md +8 -3
  160. package/skills/to-issues/SKILL.md +1 -1
  161. package/adapters/gate-3.sh +0 -68
  162. package/adapters/gate-4.sh +0 -80
  163. package/adapters/gate-7.sh +0 -45
  164. package/adapters/gate-8.sh +0 -56
  165. package/adapters/gate-9.sh +0 -104
@@ -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
- const script = resolveGateScript('3');
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
- const script = resolveGateScript('7');
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
- const script = resolveGateScript('8');
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
- const script = resolveGateScript('9');
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