@boyingliu01/xp-gate 0.5.3 → 0.7.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.
@@ -0,0 +1,279 @@
1
+ /**
2
+ * Gate Audit Logger — structured JSONL audit for quality gate executions.
3
+ *
4
+ * Log file: .xp-gate/audit.jsonl
5
+ * Rotation: max 10 MB, rename to .1, keep up to 3 archives.
6
+ * Fail-safe: write errors never block the caller.
7
+ */
8
+ import {
9
+ existsSync,
10
+ mkdirSync,
11
+ appendFileSync,
12
+ writeFileSync,
13
+ readFileSync,
14
+ renameSync,
15
+ statSync,
16
+ chmodSync,
17
+ } from 'fs';
18
+ import { join } from 'path';
19
+
20
+ // ── Constants ────────────────────────────────────────────────────────────────
21
+
22
+ const AUDIT_DIR = '.xp-gate';
23
+ const AUDIT_FILE = 'audit.jsonl';
24
+ const MAX_FILE_BYTES = 10 * 1024 * 1024; // 10 MB
25
+ const MAX_ARCHIVES = 3;
26
+
27
+ // ── Types ────────────────────────────────────────────────────────────────────
28
+
29
+ export interface GateAuditEntry {
30
+ timestamp: string;
31
+ gate_id: string;
32
+ gate_name: string;
33
+ passed: boolean;
34
+ issues_found: number;
35
+ duration_ms: number;
36
+ trigger: 'commit' | 'push' | 'manual';
37
+ repo_path: string;
38
+ commit_hash: string;
39
+ }
40
+
41
+ // ── Public API ───────────────────────────────────────────────────────────────
42
+
43
+ /**
44
+ * Append one audit entry to .xp-gate/audit.jsonl.
45
+ * Creates the directory lazily on first write.
46
+ * NEVER throws — errors are logged to stderr only.
47
+ */
48
+ export function appendAuditEntry(
49
+ entry: GateAuditEntry,
50
+ repoRoot: string = process.cwd(),
51
+ ): void {
52
+ try {
53
+ const logPath = join(repoRoot, AUDIT_DIR, AUDIT_FILE);
54
+
55
+ // Lazy-create directory
56
+ const dirPath = join(repoRoot, AUDIT_DIR);
57
+ if (!existsSync(dirPath)) {
58
+ mkdirSync(dirPath, { recursive: true });
59
+ }
60
+
61
+ // Rotate before write if file is too large
62
+ rotateIfNeeded(logPath);
63
+
64
+ const line = JSON.stringify(entry) + '\n';
65
+
66
+ // POSIX append with atomic semantics
67
+ try {
68
+ appendFileSync(logPath, line, 'utf8');
69
+ // Set restrictive permissions on first write (idempotent)
70
+ try {
71
+ chmodSync(logPath, 0o600);
72
+ } catch {
73
+ // chmod may fail on some filesystems — non-fatal
74
+ }
75
+ } catch {
76
+ // Windows fallback: open with 'a' flag
77
+ writeFileSync(logPath, line, { flag: 'a', encoding: 'utf8' });
78
+ }
79
+ } catch (err) {
80
+ // Fail-safe: never propagate errors to caller
81
+ console.error('[xp-gate audit] Failed to append entry:', (err as Error).message);
82
+ }
83
+ }
84
+
85
+ /**
86
+ * Read the last N entries from the audit log.
87
+ */
88
+ export function readTailEntries(
89
+ count: number = 20,
90
+ repoRoot: string = process.cwd(),
91
+ ): GateAuditEntry[] {
92
+ const logPath = join(repoRoot, AUDIT_DIR, AUDIT_FILE);
93
+ if (!existsSync(logPath)) {
94
+ return [];
95
+ }
96
+
97
+ const content = readFileSync(logPath, 'utf8').trim();
98
+ if (!content) {
99
+ return [];
100
+ }
101
+
102
+ const allLines = content.split('\n');
103
+ const tailLines = allLines.slice(-count);
104
+ const entries: GateAuditEntry[] = [];
105
+
106
+ for (const line of tailLines) {
107
+ if (line.trim()) {
108
+ try {
109
+ entries.push(JSON.parse(line) as GateAuditEntry);
110
+ } catch {
111
+ // Skip malformed lines
112
+ }
113
+ }
114
+ }
115
+
116
+ return entries;
117
+ }
118
+
119
+ /**
120
+ * Compute per-gate aggregate statistics.
121
+ */
122
+ export function computeStats(
123
+ repoRoot: string = process.cwd(),
124
+ ): { gate_id: string; pass_pct: string; avg_ms: number; avg_issues: number }[] {
125
+ const logPath = join(repoRoot, AUDIT_DIR, AUDIT_FILE);
126
+ if (!existsSync(logPath)) {
127
+ return [];
128
+ }
129
+
130
+ const content = readFileSync(logPath, 'utf8').trim();
131
+ if (!content) {
132
+ return [];
133
+ }
134
+
135
+ // Parse all valid entries
136
+ const entries: GateAuditEntry[] = [];
137
+ for (const line of content.split('\n')) {
138
+ if (line.trim()) {
139
+ try {
140
+ entries.push(JSON.parse(line) as GateAuditEntry);
141
+ } catch {
142
+ // Skip malformed
143
+ }
144
+ }
145
+ }
146
+
147
+ // Aggregate by gate_id
148
+ const buckets = new Map<string, { total: number; passed: number; ms: number; issues: number }>();
149
+
150
+ for (const e of entries) {
151
+ const b = buckets.get(e.gate_id) ?? { total: 0, passed: 0, ms: 0, issues: 0 };
152
+ b.total += 1;
153
+ if (e.passed) b.passed += 1;
154
+ b.ms += e.duration_ms;
155
+ b.issues += e.issues_found;
156
+ buckets.set(e.gate_id, b);
157
+ }
158
+
159
+ const results: { gate_id: string; pass_pct: string; avg_ms: number; avg_issues: number }[] = [];
160
+
161
+ for (const [gate_id, b] of Array.from(buckets.entries())) {
162
+ results.push({
163
+ gate_id,
164
+ pass_pct: (b.total > 0 ? ((b.passed / b.total) * 100).toFixed(1) + '%' : 'N/A'),
165
+ avg_ms: b.total > 0 ? Math.round(b.ms / b.total) : 0,
166
+ avg_issues: b.total > 0 ? parseFloat((b.issues / b.total).toFixed(2)) : 0,
167
+ });
168
+ }
169
+
170
+ // Sort by gate_id for stable output
171
+ results.sort((a, b) => a.gate_id.localeCompare(b.gate_id));
172
+ return results;
173
+ }
174
+
175
+ /**
176
+ * Rotate the audit log if it exceeds MAX_FILE_BYTES.
177
+ * Renames current file to .1, shifts existing archives.
178
+ * Keeps at most MAX_ARCHIVES archived files.
179
+ */
180
+ export function rotateIfNeeded(logPath: string): void {
181
+ if (!existsSync(logPath)) {
182
+ return;
183
+ }
184
+
185
+ let stats;
186
+ try {
187
+ stats = statSync(logPath);
188
+ } catch {
189
+ return;
190
+ }
191
+
192
+ if (stats.size < MAX_FILE_BYTES) {
193
+ return;
194
+ }
195
+
196
+ // Shift archives: .2 -> .3, .1 -> .2
197
+ for (let i = MAX_ARCHIVES; i >= 2; i--) {
198
+ const from = `${logPath}.${i - 1}`;
199
+ const to = `${logPath}.${i}`;
200
+ if (existsSync(from)) {
201
+ try {
202
+ renameSync(from, to);
203
+ } catch {
204
+ // Race condition or permission issue — skip
205
+ }
206
+ }
207
+ }
208
+
209
+ // Current -> .1
210
+ const firstArchive = `${logPath}.1`;
211
+ if (existsSync(firstArchive)) {
212
+ try {
213
+ renameSync(firstArchive, `${logPath}.2`);
214
+ } catch {
215
+ // Skip on error
216
+ }
217
+ }
218
+
219
+ try {
220
+ renameSync(logPath, firstArchive);
221
+ } catch {
222
+ // If rename fails, truncate the current file instead
223
+ try {
224
+ writeFileSync(logPath, '', 'utf8');
225
+ } catch {
226
+ console.error('[xp-gate audit] Failed to rotate or truncate log:', logPath);
227
+ }
228
+ }
229
+ }
230
+
231
+ // ── CLI entry point (direct invocation from hooks) ───────────────────────────
232
+
233
+ /**
234
+ * When called directly via `npx tsx gate-audit.ts record --gate-id ...`,
235
+ * this block handles CLI argument parsing and appends the entry.
236
+ */
237
+ if (require.main === module) {
238
+ const args = process.argv.slice(2);
239
+ const command = args[0];
240
+
241
+ if (command === 'record') {
242
+ const opts = parseCliOptions(args.slice(1));
243
+ const entry: GateAuditEntry = {
244
+ timestamp: new Date().toISOString(),
245
+ gate_id: opts['gate-id'] || 'unknown',
246
+ gate_name: opts['gate-name'] || 'unknown',
247
+ passed: opts['passed'] === 'true',
248
+ issues_found: parseInt(opts['issues-found'] || '0', 10),
249
+ duration_ms: parseInt(opts['duration-ms'] || '0', 10),
250
+ trigger: (opts['trigger'] as 'commit' | 'push' | 'manual') || 'manual',
251
+ repo_path: process.cwd(),
252
+ commit_hash: getCommitHash(),
253
+ };
254
+ appendAuditEntry(entry);
255
+ } else {
256
+ console.error(`Unknown audit command: ${command}`);
257
+ process.exit(1);
258
+ }
259
+ }
260
+
261
+ function parseCliOptions(args: string[]): Record<string, string> {
262
+ const opts: Record<string, string> = {};
263
+ for (let i = 0; i < args.length; i++) {
264
+ if (args[i].startsWith('--') && i + 1 < args.length) {
265
+ opts[args[i].slice(2)] = args[i + 1];
266
+ i++;
267
+ }
268
+ }
269
+ return opts;
270
+ }
271
+
272
+ function getCommitHash(): string {
273
+ try {
274
+ const { execSync } = require('child_process');
275
+ return execSync('git rev-parse HEAD', { encoding: 'utf8', stdio: ['pipe', 'pipe', 'pipe'] }).trim();
276
+ } catch {
277
+ return 'unknown';
278
+ }
279
+ }
@@ -13,6 +13,13 @@ const HOME = process.env.HOME || process.env.USERPROFILE || os.homedir();
13
13
 
14
14
  const CONFIG_DIR = path.join(HOME, '.config', 'xp-gate');
15
15
  const SKILLS_DIR = path.join(HOME, '.config', 'opencode', 'skills');
16
+ const QODER_SKILLS_DIR = path.join(HOME, '.qoder', 'skills');
17
+
18
+ // Platform-specific skill directories
19
+ const PLATFORM_SKILLS_DIRS = {
20
+ opencode: SKILLS_DIR,
21
+ qoder: QODER_SKILLS_DIR,
22
+ };
16
23
 
17
24
  const SKILLS_REGISTRY = {
18
25
  'sprint-flow': { repo: 'boyingliu01/xp-gate', path: 'skills/sprint-flow' },
@@ -22,20 +29,23 @@ const SKILLS_REGISTRY = {
22
29
  };
23
30
 
24
31
  async function installSkill(name, options = {}) {
25
- const { offline = false, verbose = false, force = false } = options;
26
-
27
- const depCheck = await checkDeps();
28
- if (!depCheck.ok) {
29
- if (depCheck.missing) {
30
- console.error(`Error: ${depCheck.missing} is required but not installed`);
31
- console.error('Please install superpowers and gstack first');
32
- console.error('See: https://github.com/boyingliu01/superpowers');
33
- return 1;
34
- }
35
- if (depCheck.versionMismatch) {
36
- console.error(`Error: ${depCheck.versionMismatch.name} version too old`);
37
- console.error(`Need: ${depCheck.versionMismatch.required}, Found: ${depCheck.versionMismatch.found}`);
38
- return 1;
32
+ const { offline = false, verbose = false, force = false, platform = 'opencode' } = options;
33
+
34
+ // Qoder platform has no superpowers/gstack dependency
35
+ if (platform !== 'qoder') {
36
+ const depCheck = await checkDeps();
37
+ if (!depCheck.ok) {
38
+ if (depCheck.missing) {
39
+ console.error(`Error: ${depCheck.missing} is required but not installed`);
40
+ console.error('Please install superpowers and gstack first');
41
+ console.error('See: https://github.com/boyingliu01/superpowers');
42
+ return 1;
43
+ }
44
+ if (depCheck.versionMismatch) {
45
+ console.error(`Error: ${depCheck.versionMismatch.name} version too old`);
46
+ console.error(`Need: ${depCheck.versionMismatch.required}, Found: ${depCheck.versionMismatch.found}`);
47
+ return 1;
48
+ }
39
49
  }
40
50
  }
41
51
 
@@ -46,7 +56,8 @@ async function installSkill(name, options = {}) {
46
56
  return 1;
47
57
  }
48
58
 
49
- const targetDir = path.join(SKILLS_DIR, name);
59
+ const targetSkillsDir = PLATFORM_SKILLS_DIRS[platform] || SKILLS_DIR;
60
+ const targetDir = path.join(targetSkillsDir, name);
50
61
  if (fs.existsSync(targetDir) && !force) {
51
62
  console.error(`Error: ${name} is already installed`);
52
63
  console.error('Use --force to overwrite');
@@ -204,21 +204,21 @@ function processOutput(input: string, repoRoot: string): void {
204
204
  .map(parseRenamedFile)
205
205
  .filter((f) => f.length > 0);
206
206
  const result = collectUiMatches(files, repoRoot);
207
- // eslint-disable-next-line no-console
207
+
208
208
  console.log(JSON.stringify(result, null, 2));
209
209
  process.exit(result.isUiSprint ? 0 : 1);
210
210
  }
211
211
 
212
- function runCheckBranch(repoRoot: string): void {
212
+ function runCheckBranch(_repoRoot: string): void {
213
213
  const result = detectUiSprint('HEAD');
214
- // eslint-disable-next-line no-console
214
+
215
215
  console.log(JSON.stringify(result, null, 2));
216
216
  process.exit(result.isUiSprint ? 0 : 1);
217
217
  }
218
218
 
219
- function runDefault(repoRoot: string): void {
219
+ function runDefault(_repoRoot: string): void {
220
220
  const result = detectUiSprint();
221
- // eslint-disable-next-line no-console
221
+
222
222
  console.log(JSON.stringify(result, null, 2));
223
223
  process.exit(result.isUiSprint ? 0 : 1);
224
224
  }
package/lib/ui-review.ts CHANGED
@@ -15,9 +15,9 @@ interface UiReviewResult {
15
15
  }
16
16
 
17
17
  function main(): void {
18
- // eslint-disable-next-line no-console
18
+
19
19
  console.log('═══ xp-gate ui-review ═══');
20
- // eslint-disable-next-line no-console
20
+
21
21
  console.log('');
22
22
 
23
23
  // Get staged + modified files
@@ -25,7 +25,7 @@ function main(): void {
25
25
  try {
26
26
  files = execSync('git diff --cached --name-only && git diff --name-only', { encoding: 'utf8' }).trim();
27
27
  } catch {
28
- // eslint-disable-next-line no-console
28
+
29
29
  console.log('⚠️ No git repo or no changes. Running in current directory.');
30
30
  }
31
31
 
@@ -35,7 +35,7 @@ function main(): void {
35
35
  .filter(f => f.length > 0);
36
36
 
37
37
  if (fileList.length === 0) {
38
- // eslint-disable-next-line no-console
38
+
39
39
  console.log('No files staged or modified. Checking all tracked files.');
40
40
  try {
41
41
  files = execSync('git ls-files', { encoding: 'utf8' }).trim();
@@ -48,28 +48,28 @@ function main(): void {
48
48
  const result = collectUiMatches(fileList);
49
49
 
50
50
  if (!result.isUiSprint) {
51
- // eslint-disable-next-line no-console
51
+
52
52
  console.log('ℹ️ No UI changes detected in staged/modified files.');
53
- // eslint-disable-next-line no-console
53
+
54
54
  console.log(' Nothing to review. Exiting.');
55
55
  process.exit(0);
56
56
  }
57
57
 
58
- // eslint-disable-next-line no-console
58
+
59
59
  console.log(`🎨 UI changes detected (${result.matchedFiles.length} files):`);
60
60
  result.matchedFiles.forEach(f => console.log(` - ${f}`));
61
- // eslint-disable-next-line no-console
61
+
62
62
  console.log('');
63
63
 
64
- // eslint-disable-next-line no-console
64
+
65
65
  console.log('Next steps required before push:');
66
- // eslint-disable-next-line no-console
66
+
67
67
  console.log(' 1. Run /design-review in your AI agent session');
68
- // eslint-disable-next-line no-console
68
+
69
69
  console.log(' 2. Run /qa or /qa-only in your AI agent session');
70
- // eslint-disable-next-line no-console
70
+
71
71
  console.log(' 3. Ensure you have .delphi-config.json configured for Delphi review');
72
- // eslint-disable-next-line no-console
72
+
73
73
  console.log('');
74
74
 
75
75
  const commit = execSync('git rev-parse HEAD 2>/dev/null || echo "no-commit"', { encoding: 'utf8' }).trim();
@@ -86,23 +86,23 @@ function main(): void {
86
86
 
87
87
  writeFileSync(join(process.cwd(), RESULT_FILE), JSON.stringify(uiResult, null, 2) + '\n', 'utf8');
88
88
 
89
- // eslint-disable-next-line no-console
89
+
90
90
  console.log(`✅ Generated ${RESULT_FILE} with APPROVED verdict (template)`);
91
- // eslint-disable-next-line no-console
91
+
92
92
  console.log(` Commit: ${commit}`);
93
- // eslint-disable-next-line no-console
93
+
94
94
  console.log(` Expires: ${expires}`);
95
- // eslint-disable-next-line no-console
95
+
96
96
  console.log('');
97
- // eslint-disable-next-line no-console
97
+
98
98
  console.log('⚠️ REVIEW THIS FILE before push:');
99
- // eslint-disable-next-line no-console
99
+
100
100
  console.log(' - Ensure design_review and browser_qa are actually APPROVED');
101
- // eslint-disable-next-line no-console
101
+
102
102
  console.log(' - Edit verdict to REJECTED if issues found');
103
- // eslint-disable-next-line no-console
103
+
104
104
  console.log('');
105
- // eslint-disable-next-line no-console
105
+
106
106
  console.log('Then: git push (pre-push will validate this file)');
107
107
  }
108
108
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boyingliu01/xp-gate",
3
- "version": "0.5.3",
3
+ "version": "0.7.0",
4
4
  "description": "AI-driven development workflow: 6 quality gates + Delphi review + Sprint Flow",
5
5
  "bin": {
6
6
  "xp-gate": "./bin/xp-gate.js"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xp-gate",
3
- "version": "0.5.3",
3
+ "version": "0.7.0",
4
4
  "displayName": "XP-Gate",
5
5
  "description": "Extreme Programming quality gates + AI workflow skills for Claude Code. Includes 6 quality gates, Sprint Flow, and Delphi multi-expert review.",
6
6
  "author": {
@@ -0,0 +1,93 @@
1
+ # QODER PLUGIN KNOWLEDGE BASE
2
+
3
+ **Generated:** 2026-06-03
4
+ **Version:** v0.6.0
5
+
6
+ ## OVERVIEW
7
+ Cross-platform plugin for Qoder IDE — shared skills, Qoder-specific enhancements (genui widgets, Canvas, Memory, CodeReview subagent, browser-use MCP). No hooks.json (Qoder uses skill-embedded gates instead of file-system event hooks).
8
+
9
+ ## STRUCTURE
10
+ ```
11
+ plugins/qoder/
12
+ ├── README.md # Installation and usage guide
13
+ ├── AGENTS.md # This knowledge base
14
+ ├── skills/ # Auto-populated by build-plugin.sh (8 skills)
15
+ │ ├── sprint-flow/SKILL.md # 7-phase pipeline + Qoder Pre-Edit Gate + Agent mapping
16
+ │ ├── delphi-review/SKILL.md # Multi-expert consensus + Qoder multi-model adaptation
17
+ │ ├── test-specification-alignment/SKILL.md # 2-phase test-spec verification
18
+ │ ├── ralph-loop/SKILL.md # REQ-level iterative build + Memory integration
19
+ │ ├── test-driven-development/SKILL.md # TDD enforcement (zero modification)
20
+ │ ├── improve-codebase-architecture/SKILL.md # Architecture health + Canvas output
21
+ │ ├── to-issues/SKILL.md # Vertical slice issue splitting (zero modification)
22
+ │ └── admin-template-guidelines/SKILL.md # 6 maintainability rules (zero modification)
23
+ ├── widgets/ # genui show_widget templates
24
+ │ ├── quality-report.html # Quality gate report dashboard
25
+ │ └── sprint-dashboard.html # Sprint status board
26
+ └── references/
27
+ └── qoder-adaptation.md # Platform differences and adaptation rules
28
+ ```
29
+
30
+ ## WHERE TO LOOK
31
+ | Task | Location | Notes |
32
+ |------|----------|-------|
33
+ | Installation | README.md | User-level (~/.qoder/skills/) and project-level (.qoder/skills/) |
34
+ | Skill adaptations | skills/*/SKILL.md | Qoder-specific paragraphs marked with "Qoder" header |
35
+ | Pre-Edit Gate | skills/sprint-flow/SKILL.md | Replaces Claude Code's delphi-review-guard.sh hook |
36
+ | Multi-model review | skills/delphi-review/references/qoder-multi-model.md | Expert→model mapping via Qoder Agent subagents |
37
+ | Agent dispatch | skills/sprint-flow/SKILL.md | Phase→Qoder Agent mapping table |
38
+ | External skill fallback | skills/sprint-flow/references/qoder-adaptation.md | superpowers/gstack replacements |
39
+ | Quality widget | widgets/quality-report.html | genui show_widget template for Phase 3 results |
40
+ | Sprint widget | widgets/sprint-dashboard.html | genui show_widget template for sprint status |
41
+ | Memory integration | skills/ralph-loop/SKILL.md | UpdateMemory for permanent/contextual learnings |
42
+ | CodeReview | skills/sprint-flow/SKILL.md | Phase 2 step 4 + Phase 3 code walkthrough |
43
+ | Browser MCP | skills/sprint-flow/references/qoder-adaptation.md | browser-use replaces gstack/browse |
44
+
45
+ ## CONVENTIONS
46
+ - Plugin skills auto-populated by build-plugin.sh --platform qoder — never edit plugins/qoder/skills/ directly
47
+ - Qoder-specific skill modifications live in source skills/ directory (marked with "## Qoder" sections)
48
+ - No hooks.json — Qoder lacks file-system event hooks; gates embedded in skill instructions
49
+ - genui widgets use show_widget MCP tool with widget_path template mode
50
+ - Memory system replaces gstack/learn for learnings persistence
51
+ - CodeReview subagent replaces superpowers/requesting-code-review
52
+ - browser-use MCP replaces gstack/browse for Phase 3 browser testing
53
+ - External skills (superpowers/gstack) replaced by orchestrator inline execution or Qoder native capabilities
54
+
55
+ ## ANTI-PATTERNS (THIS PLUGIN)
56
+ - Do NOT edit plugins/qoder/skills/ directly — rebuild from source via build-plugin.sh
57
+ - Do NOT assume xp-gate CLI is installed — skills must degrade gracefully
58
+ - Do NOT create hooks.json for Qoder — platform does not support file-system event hooks
59
+ - Do NOT use curl for API calls — curl is in Qoder's command deny list; use PowerShell Invoke-RestMethod or Qoder's built-in multi-model capability
60
+ - Do NOT reference OpenCode task() API in Qoder skills — use Agent tool (Browser/CodeReview/plan-agent) instead
61
+
62
+ ## UNIQUE STYLES
63
+ - Qoder: SKILL.md + genui widgets + Canvas + Memory + CodeReview subagent + browser-use MCP
64
+ - Pre-Edit Gate: skill-embedded mandatory check replaces Claude Code's physical hook blocking
65
+ - Multi-model review: Qoder Agent subagent dispatch (plan-agent/CodeReview) replaces OpenCode task() API
66
+ - Graceful degradation: skills work even without xp-gate CLI installed
67
+ - Shared skill source: one SKILL.md → copied to Claude Code, OpenCode, and Qoder platforms
68
+
69
+ ## COMMANDS
70
+ ```bash
71
+ # Build Qoder plugin
72
+ npm run build:qoder-plugin # Build Qoder plugin with all 8 skills
73
+ bash scripts/build-plugin.sh --platform qoder # Same, via script
74
+
75
+ # Install skills
76
+ bash scripts/install-qoder-skills.sh --global # User-level: ~/.qoder/skills/
77
+ bash scripts/install-qoder-skills.sh --local # Project-level: .qoder/skills/
78
+
79
+ # Test plugin
80
+ bash scripts/test-plugins.sh # Includes Qoder platform tests
81
+
82
+ # CLI skill install
83
+ xp-gate install-skill sprint-flow --platform qoder --global
84
+ xp-gate install-skill delphi-review --platform qoder --local
85
+ ```
86
+
87
+ ## NOTES
88
+ - v0.6.0+: Qoder plugin support introduced
89
+ - Qoder plugin: 8 skills (all source skills, including admin-template-guidelines)
90
+ - Claude Code plugin: 7 skills (no admin-template-guidelines)
91
+ - OpenCode plugin: 7 skills + 3 custom tools (gate-check, gate-principles, gate-arch)
92
+ - build-plugin.sh validates 8 expected skills for Qoder platform
93
+ - test-plugins.sh: includes Qoder-specific test cases (widgets, no hooks.json)
@@ -0,0 +1,87 @@
1
+ # XP-Gate Qoder Plugin
2
+
3
+ Qoder IDE plugin exposing xp-gate quality gates, AI workflow skills, and visual dashboards.
4
+
5
+ ## Skills (8 AI Workflow Skills)
6
+
7
+ | Skill | Trigger | Description |
8
+ |-------|---------|-------------|
9
+ | sprint-flow | `/sprint-flow "需求"` | 7-phase pipeline: THINK→PLAN→BUILD→REVIEW→ACCEPT→FEEDBACK→SHIP |
10
+ | delphi-review | `/delphi-review` | Multi-expert anonymous consensus review (design + code-walkthrough) |
11
+ | test-specification-alignment | `/test-specification-alignment` | 2-phase test-spec verification |
12
+ | ralph-loop | Via sprint-flow Phase 2 | REQ-level iterative build (saves 40-67% tokens) |
13
+ | test-driven-development | `/test-driven-development` | TDD enforcement (RED→GREEN→REFACTOR) |
14
+ | improve-codebase-architecture | `/improve-codebase-architecture` | Architecture health checks |
15
+ | to-issues | `/to-issues` | Vertical slice issue splitting |
16
+ | admin-template-guidelines | Via sprint-flow BUILD | 6 maintainability rules for admin templates |
17
+
18
+ ## Qoder-Specific Enhancements
19
+
20
+ - **genui Widgets**: Quality report dashboard and Sprint status board (via `show_widget`)
21
+ - **CodeReview Subagent**: Deep integration for Phase 2 blind review and Phase 3 code walkthrough
22
+ - **browser-use MCP**: Phase 3 browser automation testing (replaces gstack/browse)
23
+ - **Memory System**: Learnings persistence via Qoder's built-in memory (replaces gstack/learn)
24
+ - **Canvas Output**: Architecture relationship diagrams (via `.canvas.tsx`)
25
+
26
+ ## Installation
27
+
28
+ ### Option 1: User-Level (Global, All Projects)
29
+
30
+ ```bash
31
+ # Via xp-gate CLI
32
+ xp-gate install-skill sprint-flow --platform qoder --global
33
+ xp-gate install-skill delphi-review --platform qoder --global
34
+
35
+ # Or via install script (all 8 skills)
36
+ bash scripts/install-qoder-skills.sh --global
37
+ # Installs to: ~/.qoder/skills/
38
+ ```
39
+
40
+ ### Option 2: Project-Level (Current Project Only)
41
+
42
+ ```bash
43
+ # Via install script
44
+ bash scripts/install-qoder-skills.sh --local
45
+ # Installs to: .qoder/skills/
46
+
47
+ # Or via build script
48
+ bash scripts/build-plugin.sh --platform qoder
49
+ ```
50
+
51
+ ### Option 3: Build from Source
52
+
53
+ ```bash
54
+ npm run build:qoder-plugin
55
+ # Produces plugins/qoder/ with all skills + widgets
56
+ ```
57
+
58
+ ## Requirements
59
+
60
+ - Qoder IDE
61
+ - xp-gate npm package installed globally (for git hooks: `npm install -g @boyingliu01/xp-gate && xp-gate init`)
62
+ - Node.js ≥ 18 (for principles checker)
63
+
64
+ ## Pre-Edit Gate (Replaces Claude Code Hooks)
65
+
66
+ Qoder does not have file-system event hooks like Claude Code's `PreToolUse`/`PostToolUse`. Instead, xp-gate skills embed **mandatory pre-edit checks** in their SKILL.md instructions:
67
+
68
+ - **Delphi Gate**: Before any code edit in Phase 2+, skill verifies `.sprint-state/delphi-reviewed.json` verdict is `APPROVED`
69
+ - **Principles Check**: After each REQ completion, skill runs principles checker via terminal
70
+
71
+ ## Graceful Degradation
72
+
73
+ If xp-gate CLI is unavailable, skills provide helpful install instructions instead of failing. Quality gates still run via git hooks (pre-commit) at commit time.
74
+
75
+ ## Comparison with Other Platforms
76
+
77
+ | Feature | Claude Code | OpenCode | Qoder |
78
+ |---------|:-----------:|:--------:|:-----:|
79
+ | AI Skills (8) | ✅ | ✅ | ✅ |
80
+ | Git Hooks | ❌ (separate npm) | ❌ (separate npm) | ❌ (separate npm) |
81
+ | Event Hooks | ✅ PreToolUse/PostToolUse | ✅ tool() | ❌ (skill-embedded) |
82
+ | Custom Tools | ❌ | ✅ 3 tools | ❌ (MCP instead) |
83
+ | Widget UI | ❌ | ❌ | ✅ genui |
84
+ | Canvas Output | ❌ | ❌ | ✅ .canvas.tsx |
85
+ | Memory System | ❌ | ❌ | ✅ UpdateMemory |
86
+ | CodeReview Agent | ❌ | ❌ | ✅ subagent |
87
+ | Browser MCP | ❌ | ❌ | ✅ browser-use |