@boyingliu01/xp-gate 0.14.5 → 0.14.7

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 (51) hide show
  1. package/adapters/plugins/whalecloud-java/scripts/install-maven-whalecloud.sh +4 -2
  2. package/lib/__tests__/sprint-status.test.ts +9 -18
  3. package/lib/sprint-status.js +3 -4
  4. package/mock-policy/AGENTS.md +3 -3
  5. package/mutation/AGENTS.md +3 -3
  6. package/package.json +1 -1
  7. package/plugins/claude-code/.claude-plugin/plugin.json +1 -1
  8. package/plugins/claude-code/skills/delphi-review/AGENTS.md +4 -4
  9. package/plugins/claude-code/skills/delphi-review/SKILL.md +62 -3
  10. package/plugins/claude-code/skills/delphi-review/hooks.md +19 -0
  11. package/plugins/claude-code/skills/delphi-review/scripts/verify-consensus.sh +43 -0
  12. package/plugins/claude-code/skills/delphi-review/tools.md +29 -0
  13. package/plugins/claude-code/skills/sprint-flow/AGENTS.md +4 -4
  14. package/plugins/claude-code/skills/sprint-flow/SKILL.md +3 -0
  15. package/plugins/claude-code/skills/sprint-flow/__tests__/sprint-flow.test.cjs +4 -2
  16. package/plugins/claude-code/skills/sprint-flow/hooks.md +18 -0
  17. package/plugins/claude-code/skills/sprint-flow/scripts/verify-sprint-state.sh +38 -0
  18. package/plugins/claude-code/skills/sprint-flow/tools.md +29 -0
  19. package/plugins/claude-code/skills/test-specification-alignment/AGENTS.md +4 -4
  20. package/plugins/opencode/README.md +14 -0
  21. package/plugins/opencode/index.ts +72 -0
  22. package/plugins/opencode/package.json +1 -1
  23. package/plugins/opencode/skills/delphi-review/AGENTS.md +4 -4
  24. package/plugins/opencode/skills/delphi-review/SKILL.md +62 -3
  25. package/plugins/opencode/skills/delphi-review/hooks.md +19 -0
  26. package/plugins/opencode/skills/delphi-review/scripts/verify-consensus.sh +43 -0
  27. package/plugins/opencode/skills/delphi-review/tools.md +29 -0
  28. package/plugins/opencode/skills/sprint-flow/AGENTS.md +4 -4
  29. package/plugins/opencode/skills/sprint-flow/SKILL.md +3 -0
  30. package/plugins/opencode/skills/sprint-flow/__tests__/sprint-flow.test.cjs +4 -2
  31. package/plugins/opencode/skills/sprint-flow/hooks.md +18 -0
  32. package/plugins/opencode/skills/sprint-flow/scripts/verify-sprint-state.sh +38 -0
  33. package/plugins/opencode/skills/sprint-flow/tools.md +29 -0
  34. package/plugins/opencode/skills/test-specification-alignment/AGENTS.md +4 -4
  35. package/plugins/qoder/plugin.json +1 -1
  36. package/plugins/qoder/skills/delphi-review/AGENTS.md +4 -4
  37. package/plugins/qoder/skills/sprint-flow/AGENTS.md +4 -4
  38. package/plugins/qoder/skills/test-specification-alignment/AGENTS.md +4 -4
  39. package/principles/AGENTS.md +3 -3
  40. package/skills/delphi-review/AGENTS.md +4 -4
  41. package/skills/delphi-review/SKILL.md +62 -3
  42. package/skills/delphi-review/hooks.md +19 -0
  43. package/skills/delphi-review/scripts/verify-consensus.sh +43 -0
  44. package/skills/delphi-review/tools.md +29 -0
  45. package/skills/sprint-flow/AGENTS.md +4 -4
  46. package/skills/sprint-flow/SKILL.md +3 -0
  47. package/skills/sprint-flow/__tests__/sprint-flow.test.cjs +4 -2
  48. package/skills/sprint-flow/hooks.md +18 -0
  49. package/skills/sprint-flow/scripts/verify-sprint-state.sh +38 -0
  50. package/skills/sprint-flow/tools.md +29 -0
  51. package/skills/test-specification-alignment/AGENTS.md +4 -4
@@ -74,8 +74,10 @@ else
74
74
  <!-- Security: J000078 SQL injection -->
75
75
  <rule ref="category/java/security.xml/MethodRequiresCheck"/>
76
76
 
77
- <!-- TODO: Add custom rules for J-rules not covered by standard PMD rulesets -->
78
- <!-- Custom rules via XPath will be added here as the plugin matures -->
77
+ <!-- Deferred: Custom XPath rules for J-rules not covered by standard PMD categories.
78
+ All 106 whalecloud rules currently map to standard PMD 7.x category XMLs.
79
+ Custom XPath rules will be added here when enterprise-specific rules
80
+ cannot be expressed via built-in PMD checks. Track via issue backlog. -->
79
81
 
80
82
  </ruleset>
81
83
  RULESET
@@ -16,11 +16,11 @@ const TMP_DIR = fs.mkdtempSync(path.join(os.tmpdir(), 'sprint-status-test-'));
16
16
  const STATE_DIR = path.join(TMP_DIR, '.sprint-state');
17
17
  const STATE_FILE = path.join(STATE_DIR, 'sprint-state.json');
18
18
 
19
- // Active sprint state (canonical format per SKILL.md L893-942)
19
+ // Active sprint state (canonical format per SKILL.md L893-942, 6-phase schema)
20
20
  const ACTIVE_STATE = {
21
21
  id: 'sprint-2026-06-16-01',
22
22
  task_description: 'Test sprint',
23
- phase: 2,
23
+ phase: 3,
24
24
  status: 'running',
25
25
  started_at: '2026-06-16T10:00:00Z',
26
26
  isolation: {
@@ -29,22 +29,13 @@ const ACTIVE_STATE = {
29
29
  created_from: 'main',
30
30
  created_from_commit: 'abc123'
31
31
  },
32
- auto_estimate: {
33
- change_type: '新增功能',
34
- estimated_level: '轻量',
35
- user_decision: 'accepted'
36
- },
37
32
  phase_history: [
38
- { phase: -1, phase_name: 'ISOLATE', status: 'completed',
33
+ { phase: 1, phase_name: 'PREP', status: 'completed',
39
34
  started_at: '2026-06-16T10:00:00Z', completed_at: '2026-06-16T10:03:00Z', duration_seconds: 180 },
40
- { phase: -0.5, phase_name: 'AUTO-ESTIMATE', status: 'completed',
41
- started_at: '2026-06-16T10:03:00Z', completed_at: '2026-06-16T10:05:00Z', duration_seconds: 120 },
42
- { phase: 0, phase_name: 'THINK', status: 'completed',
43
- started_at: '2026-06-16T10:05:00Z', completed_at: '2026-06-16T10:15:00Z', duration_seconds: 600 },
44
- { phase: 1, phase_name: 'PLAN', status: 'completed',
45
- started_at: '2026-06-16T10:15:00Z', completed_at: '2026-06-16T10:25:00Z', duration_seconds: 600 },
46
- { phase: 2, phase_name: 'BUILD', status: 'in_progress',
47
- started_at: '2026-06-16T10:25:00Z', completed_at: null, duration_seconds: null,
35
+ { phase: 2, phase_name: 'DESIGN', status: 'completed',
36
+ started_at: '2026-06-16T10:03:00Z', completed_at: '2026-06-16T10:15:00Z', duration_seconds: 720 },
37
+ { phase: 3, phase_name: 'BUILD', status: 'in_progress',
38
+ started_at: '2026-06-16T10:15:00Z', completed_at: null, duration_seconds: null,
48
39
  reqs: {
49
40
  'REQ-001': { name: 'Feature A', status: 'completed' },
50
41
  'REQ-002': { name: 'Feature B', status: 'in_progress' }
@@ -103,7 +94,7 @@ describe('sprint-status: readSprintState', () => {
103
94
  expect(state).not.toBeNull();
104
95
  const stateObj = state as Record<string, unknown>;
105
96
  expect(stateObj.task_description).toBe('Test sprint');
106
- expect(stateObj.phase).toBe(2);
97
+ expect(stateObj.phase).toBe(3);
107
98
  expect(stateObj.status).toBe('running');
108
99
  expect(Array.isArray(stateObj.phase_history)).toBe(true);
109
100
  });
@@ -216,6 +207,6 @@ describe('sprint-status: jsonMode', () => {
216
207
  const json = sprintStatus!.jsonMode(ACTIVE_STATE);
217
208
  const parsed = JSON.parse(json);
218
209
  expect(parsed.task_description).toBe('Test sprint');
219
- expect(parsed.phase).toBe(2);
210
+ expect(parsed.phase).toBe(3);
220
211
  });
221
212
  });
@@ -13,11 +13,10 @@ const { discoverActiveSprints } = require('./sprint-discovery');
13
13
 
14
14
  // Phase constants (inlined; was shared-phase-constants.js, removed in v0.13.0 slimming)
15
15
  const PHASE_NAMES = {
16
- '-1': 'ISOLATE', '-0.5': 'AUTO-ESTIMATE',
17
- '0': 'THINK', '1': 'PLAN', '2': 'BUILD', '3': 'REVIEW',
18
- '4': 'USER ACCEPTANCE', '5': 'FEEDBACK', '6': 'SHIP', '7': 'LAND', '8': 'CLEANUP',
16
+ '1': 'PREP', '2': 'DESIGN', '3': 'BUILD',
17
+ '4': 'VERIFY', '5': 'SHIP', '6': 'CLOSE',
19
18
  };
20
- const PHASE_ORDER = ['-1', '-0.5', '0', '1', '2', '3', '4', '5', '6', '7', '8'];
19
+ const PHASE_ORDER = ['1', '2', '3', '4', '5', '6'];
21
20
 
22
21
  function parseTime(value) {
23
22
  if (!value) return 0;
@@ -1,9 +1,9 @@
1
1
  # SRC/MOCK-POLICY KNOWLEDGE BASE
2
2
 
3
- **Generated:** 2026-07-09
4
- **Commit:** a09c009
3
+ **Generated:** 2026-07-10
4
+ **Commit:** a9276f6
5
5
  **Branch:** main
6
- **Version:** 0.14.3.0
6
+ **Version:** 0.14.6.2
7
7
 
8
8
  ## OVERVIEW
9
9
  Mock layering policy enforcement — Gate M3 of pre-push hook. Ensures integration tests use real implementations for internal dependencies, mock external dependencies, and annotate pending mocks with removal plans. Combines project scope scanning, mock decision engine, and per-file validation into a single pipeline.
@@ -1,9 +1,9 @@
1
1
  # SRC/MUTATION KNOWLEDGE BASE
2
2
 
3
- **Generated:** 2026-07-09
4
- **Commit:** a09c009
3
+ **Generated:** 2026-07-10
4
+ **Commit:** a9276f6
5
5
  **Branch:** main
6
- **Version:** 0.14.3.0
6
+ **Version:** 0.14.6.2
7
7
 
8
8
  ## OVERVIEW
9
9
  **Gate M** (incremental mutation testing) + **Gate M2** helpers (test-layer detection used by `src/mock-policy/`). Pre-push quality gate. TypeScript-only; uses Stryker.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boyingliu01/xp-gate",
3
- "version": "0.14.5",
3
+ "version": "0.14.7",
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.14.5",
3
+ "version": "0.14.7",
4
4
  "displayName": "XP-Gate",
5
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 (>=90% consensus).",
6
6
  "author": {
@@ -1,9 +1,9 @@
1
1
  # SKILLS/DELPHI-REVIEW KNOWLEDGE BASE
2
2
 
3
- **Generated:** 2026-07-09
4
- **Commit:** b1d2c76
5
- **Branch:** sprint/2026-07-09-02
6
- **Version:** 0.14.5.0
3
+ **Generated:** 2026-07-10
4
+ **Commit:** a9276f6
5
+ **Branch:** main
6
+ **Version:** 0.14.6.2
7
7
 
8
8
  ## OVERVIEW
9
9
  Delphi Consensus Review — multi-round anonymous expert review (≥90% threshold, 3 experts from ≥2 providers, domestic models only). Supports design + code-walkthrough modes.
@@ -13,14 +13,19 @@ description: >
13
13
  before push, architecture evaluation, or "/delphi-review".
14
14
  NOT WHEN: Asking HOW to review something (educational), mentioning "review" in passing without intent,
15
15
  requesting a simple code check or lint, asking about the Delphi process itself, or mentioning
16
- "review" as part of a different workflow (e.g., "code review" without multi-expert intent).
16
+ "review" as part of a different workflow (e.g., "code review" without multi-expert intent),
17
+ asking for review guidelines/checklists/formats, individual peer review, or casual review requests.
17
18
 
18
19
  TRIGGERS: "/delphi-review", "review this design", "评审这个需求", "评审这个设计", "design review",
19
20
  "多专家评审", "consensus review", "code walkthrough", "push review", "architecture review",
20
- "delphi review", "run delphi", "start delphi".
21
+ "delphi review", "run delphi", "start delphi", "评审这个架构", "review this architecture",
22
+ "评审PR", "review this PR with delphi", "delphi评审", "delphi 评审", "run delphi review",
23
+ "执行delphi", "启动delphi评审".
21
24
  NEGATIVE TRIGGERS: "how does delphi work", "what is delphi review", "code review checklist",
22
25
  "review my code quickly", "can you review this", "peer review", "I need a review",
23
- "explain the review process", "review guidelines".
26
+ "explain the review process", "review guidelines", "how to review a design",
27
+ "code review template", "review format", "PR review", "帮我review一下",
28
+ "just review this", "quick review", "review steps".
24
29
  maturity: beta
25
30
  auto_continue: true
26
31
  triggers:
@@ -37,6 +42,15 @@ triggers:
37
42
  - "delphi review"
38
43
  - "run delphi"
39
44
  - "start delphi"
45
+ - "评审这个架构"
46
+ - "review this architecture"
47
+ - "评审PR"
48
+ - "review this PR with delphi"
49
+ - "delphi评审"
50
+ - "delphi 评审"
51
+ - "run delphi review"
52
+ - "执行delphi"
53
+ - "启动delphi评审"
40
54
  triggers_negative_examples:
41
55
  - "how does delphi work" # educational question about the process
42
56
  - "what is delphi review" # asking for explanation, not execution
@@ -49,6 +63,15 @@ triggers_negative_examples:
49
63
  - "review guidelines" # asking about guidelines, not executing
50
64
  - "how to review a design" # educational
51
65
  - "PR review" # single-reviewer PR check, not multi-expert Delphi
66
+ - "review my PR" # informal PR review request, not Delphi
67
+ - "帮我review一下" # casual Chinese review request, no multi-expert intent
68
+ - "just review this" # casual, single-pass review request
69
+ - "quick review" # explicitly contradicts multi-round Delphi process
70
+ - "review steps" # asking for review instructions, not running review
71
+ - "code review template" # asking for a template, not executing review
72
+ - "review format" # asking about format, not executing
73
+ - "show me how to review" # educational request about reviewing
74
+ - "review checklist example" # asking for examples, not running review
52
75
  triggers_negative_test_cases:
53
76
  - input: "how does delphi work"
54
77
  expect: "NOT triggered"
@@ -86,6 +109,24 @@ triggers_negative_test_cases:
86
109
  expect: "triggered"
87
110
  - input: "delphi review"
88
111
  expect: "triggered"
112
+ - input: "评审这个架构"
113
+ expect: "triggered"
114
+ - input: "delphi 评审"
115
+ expect: "triggered"
116
+ - input: "run delphi review"
117
+ expect: "triggered"
118
+ - input: "review my PR"
119
+ expect: "NOT triggered"
120
+ - input: "帮我review一下"
121
+ expect: "NOT triggered"
122
+ - input: "just review this"
123
+ expect: "NOT triggered"
124
+ - input: "quick review"
125
+ expect: "NOT triggered"
126
+ - input: "review steps"
127
+ expect: "NOT triggered"
128
+ - input: "code review template"
129
+ expect: "NOT triggered"
89
130
  - input: "run delphi"
90
131
  expect: "triggered"
91
132
  workflow_steps:
@@ -153,6 +194,15 @@ tools_denied:
153
194
  - delphi review
154
195
  - run delphi
155
196
  - start delphi
197
+ - 评审这个架构
198
+ - review this architecture
199
+ - 评审PR
200
+ - review this PR with delphi
201
+ - delphi评审
202
+ - delphi 评审
203
+ - run delphi review
204
+ - 执行delphi
205
+ - 启动delphi评审
156
206
 
157
207
  **NOT triggered by:**
158
208
  - "how does delphi work" (educational)
@@ -163,6 +213,15 @@ tools_denied:
163
213
  - "I need a review" (too vague)
164
214
  - "explain the review process" (educational)
165
215
  - "review guidelines" (asking about guidelines)
216
+ - "PR review" (single-reviewer PR check)
217
+ - "review my PR" (informal PR review)
218
+ - "帮我review一下" (casual Chinese request)
219
+ - "just review this" (casual single-pass)
220
+ - "quick review" (contradicts multi-round process)
221
+ - "review steps" (asking for instructions)
222
+ - "code review template" (asking for template)
223
+ - "review format" (asking about format)
224
+ - "show me how to review" (educational)
166
225
 
167
226
  ## Workflow
168
227
 
@@ -0,0 +1,19 @@
1
+ # Hooks — Delphi Review
2
+
3
+ Delphi Review integrates with safety and operational hooks to ensure review integrity
4
+ and context preservation.
5
+
6
+ ## Security Hooks
7
+
8
+ | Hook | Purpose | Activation |
9
+ |------|---------|------------|
10
+ | `/careful` | Safety guardrails for destructive commands | Ensure review is read-only — block any destructive operations |
11
+ | `/freeze` | Restrict edits to review scope | Prevent accidental changes during review |
12
+ | `/guard` | Full safety mode (careful + freeze) | Maximum protection — read-only review with no accidental edits |
13
+
14
+ ## Operational Hooks
15
+
16
+ | Hook | Purpose | Activation |
17
+ |------|---------|------------|
18
+ | `/context-save` | Save review context before pause or handoff | Before pausing review or switching tasks |
19
+ | `/context-restore` | Restore review context on resume | When resuming review from pause or handoff |
@@ -0,0 +1,43 @@
1
+ #!/usr/bin/env bash
2
+ # delphi-review: Verify consensus report integrity
3
+ # Checks that delphi-reviewed.json is valid JSON and contains expected verdict field.
4
+ #
5
+ # Usage: bash verify-consensus.sh [state-dir]
6
+
7
+ set -euo pipefail
8
+
9
+ STATE_DIR="${1:-.sprint-state}"
10
+ STATE_FILE="$STATE_DIR/delphi-reviewed.json"
11
+
12
+ if [ ! -f "$STATE_FILE" ]; then
13
+ echo "SKIP: No delphi-reviewed.json found at $STATE_FILE"
14
+ exit 0
15
+ fi
16
+
17
+ # Validate JSON
18
+ if ! command -v node &>/dev/null; then
19
+ echo "WARN: node not available, skipping JSON validation"
20
+ exit 0
21
+ fi
22
+
23
+ node -e "
24
+ const fs = require('fs');
25
+ try {
26
+ const data = JSON.parse(fs.readFileSync('$STATE_FILE', 'utf8'));
27
+ const requiredKeys = ['mode', 'timestamp', 'verdict', 'consensus_ratio'];
28
+ const missing = requiredKeys.filter(k => !(k in data));
29
+ if (missing.length > 0) {
30
+ console.error('ERROR: Missing required keys in delphi-reviewed.json:', missing.join(', '));
31
+ process.exit(1);
32
+ }
33
+ const validVerdicts = ['APPROVED', 'PASS_WITH_CAVEATS', 'REQUEST_CHANGES', 'BLOCKED'];
34
+ if (!validVerdicts.includes(data.verdict)) {
35
+ console.error('ERROR: Invalid verdict:', data.verdict, '(expected one of:', validVerdicts.join(', '), ')');
36
+ process.exit(1);
37
+ }
38
+ console.log('OK: delphi-reviewed.json is valid with verdict:', data.verdict);
39
+ } catch (e) {
40
+ console.error('ERROR: delphi-reviewed.json is not valid JSON:', e.message);
41
+ process.exit(1);
42
+ }
43
+ "
@@ -0,0 +1,29 @@
1
+ # Tools Whitelist — Delphi Review
2
+
3
+ Delphi Review is a **read-only review skill** that dispatches expert subagents
4
+ and synthesizes their verdicts. It does NOT implement code changes.
5
+
6
+ ## Allowed Tools
7
+
8
+ | Tool | Usage | Rationale |
9
+ |------|-------|-----------|
10
+ | `Read` | Read design docs, code, configs, specification.yaml | Required for review input analysis |
11
+ | `Glob` | Find files by pattern | Required for context discovery |
12
+ | `Grep` | Search code content | Required for codebase understanding |
13
+ | `Bash` | Read-only: git diff, git log, file stats | Required for change analysis |
14
+ | `Task(subagent_type=oracle)` | Dispatch oracle for deep analysis | Required for complex review questions |
15
+ | `Task(subagent_type=delphi-reviewer-architecture)` | Dispatch architecture expert | Core Delphi expert dispatch |
16
+ | `Task(subagent_type=delphi-reviewer-technical)` | Dispatch technical expert | Core Delphi expert dispatch |
17
+ | `Task(subagent_type=delphi-reviewer-feasibility)` | Dispatch feasibility expert | Core Delphi expert dispatch |
18
+ | `Write(specification.yaml, .code-walkthrough-result.json, delphi-reviewed.json)` | Write output artifacts only | Required for review output persistence |
19
+ | `Skill` | Invoke related skills for context | Required for cross-skill integration |
20
+ | `Question` | Ask user at decision points | Required for user interaction |
21
+
22
+ ## Denied Tools
23
+
24
+ | Tool | Rationale |
25
+ |------|-----------|
26
+ | `Edit(source code)` | Delphi review NEVER edits implementation code during review |
27
+ | `Write(source code)` | Delphi review NEVER writes implementation code |
28
+ | `Bash(git commit, git push)` | Delphi review NEVER commits or pushes during review |
29
+ | `Task(category=*, subagent_type=build)` | Delphi review NEVER delegates build/implementation tasks |
@@ -1,9 +1,9 @@
1
1
  # SKILLS/SPRINT-FLOW KNOWLEDGE BASE
2
2
 
3
- **Generated:** 2026-07-09
4
- **Commit:** b1d2c76
5
- **Branch:** sprint/2026-07-09-02
6
- **Version:** 0.14.5.0
3
+ **Generated:** 2026-07-10
4
+ **Commit:** a9276f6
5
+ **Branch:** main
6
+ **Version:** 0.14.6.2
7
7
 
8
8
  ## OVERVIEW
9
9
  **6-phase** development pipeline (v2.0 compact redesign, Issue #290): PREP → DESIGN → BUILD → VERIFY → SHIP → CLOSE. Phase 3/6 BUILD default build mode is **ralph-loop** (REQ-level iteration, 40-67% token savings vs parallel). HARD-GATE between DESIGN (2/6) and BUILD (3/6): design must pass Delphi review (≥90% consensus) before any coding.
@@ -200,6 +200,9 @@ Every phase MUST output its header as the first line of that phase's output. For
200
200
  4. On `/sprint-flow` trigger, first line MUST output: `Sprint Flow: PREP → DESIGN → BUILD → VERIFY → SHIP → CLOSE`
201
201
  5. Each phase completion MUST write Phase Summary to `.sprint-state/phase-outputs/phase-{N}-summary.md`
202
202
  6. Each phase completion MUST update `.sprint-state/sprint-state.json`
203
+
204
+ ### Required Rendering (MANDATORY per phase)
205
+
203
206
  7. Each phase completion MUST render the ASCII progress dashboard using `templates/sprint-progress-template.md` — the orchestrator reads `sprint-state.json` and outputs the dashboard after every phase's status block, so the user always sees current global progress without needing to ask
204
207
 
205
208
  ### Phase Output Status Schema (MANDATORY per phase)
@@ -29,10 +29,12 @@ function contentIncludes(str) {
29
29
  return skillContent.includes(str) || phaseOverviewContent.includes(str);
30
30
  }
31
31
  function contentSplit(str) {
32
- // Return the part after str from whichever file contains it
32
+ // Return the part after str from whichever file contains it.
33
+ // Throws descriptive error instead of returning undefined so callers
34
+ // get a clear assertion message rather than a TypeError crash.
33
35
  if (skillContent.includes(str)) return skillContent.split(str)[1];
34
36
  if (phaseOverviewContent.includes(str)) return phaseOverviewContent.split(str)[1];
35
- return undefined;
37
+ throw new Error(`Section "${str}" not found in SKILL.md or references/phase-overview.md`);
36
38
  }
37
39
 
38
40
  function parseFrontmatter(content) {
@@ -0,0 +1,18 @@
1
+ # Hooks — Sprint Flow
2
+
3
+ Sprint Flow integrates with safety and operational hooks to protect the development environment.
4
+
5
+ ## Security Hooks
6
+
7
+ | Hook | Purpose | Activation |
8
+ |------|---------|------------|
9
+ | `/careful` | Safety guardrails for destructive commands | Activate before any `rm`, `force-push`, or `git reset` |
10
+ | `/freeze` | Restrict edits to sprint worktree directory | Prevent accidental changes outside sprint scope |
11
+ | `/guard` | Full safety mode (careful + freeze) | Maximum protection for high-risk operations |
12
+
13
+ ## Operational Hooks
14
+
15
+ | Hook | Purpose | Activation |
16
+ |------|---------|------------|
17
+ | `/context-save` | Save sprint context before pause or handoff | Before pausing sprint or switching tasks |
18
+ | `/context-restore` | Restore sprint context on resume | When resuming from pause or handoff |
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env bash
2
+ # sprint-flow: Verify sprint state integrity
3
+ # Checks that sprint-state.json is valid JSON and all expected keys exist.
4
+ #
5
+ # Usage: bash verify-sprint-state.sh [sprint-state-dir]
6
+
7
+ set -euo pipefail
8
+
9
+ STATE_DIR="${1:-.sprint-state}"
10
+ STATE_FILE="$STATE_DIR/sprint-state.json"
11
+
12
+ if [ ! -f "$STATE_FILE" ]; then
13
+ echo "SKIP: No sprint-state.json found at $STATE_FILE"
14
+ exit 0
15
+ fi
16
+
17
+ # Validate JSON
18
+ if ! command -v node &>/dev/null; then
19
+ echo "WARN: node not available, skipping JSON validation"
20
+ exit 0
21
+ fi
22
+
23
+ node -e "
24
+ const fs = require('fs');
25
+ try {
26
+ const data = JSON.parse(fs.readFileSync('$STATE_FILE', 'utf8'));
27
+ const requiredKeys = ['sprint_id', 'status', 'current_phase', 'phases'];
28
+ const missing = requiredKeys.filter(k => !(k in data));
29
+ if (missing.length > 0) {
30
+ console.error('ERROR: Missing required keys in sprint-state.json:', missing.join(', '));
31
+ process.exit(1);
32
+ }
33
+ console.log('OK: sprint-state.json is valid with all required keys');
34
+ } catch (e) {
35
+ console.error('ERROR: sprint-state.json is not valid JSON:', e.message);
36
+ process.exit(1);
37
+ }
38
+ "
@@ -0,0 +1,29 @@
1
+ # Tools Whitelist — Sprint Flow
2
+
3
+ Sprint Flow is an **orchestration skill** that coordinates subagents and system commands.
4
+ It does NOT implement code directly — it delegates implementation to subagents.
5
+
6
+ ## Allowed Tools
7
+
8
+ | Tool | Usage | Rationale |
9
+ |------|-------|-----------|
10
+ | `Bash(git, gh, npm, node)` | git worktree/branch/commit, gh PR/release, npm/node CLI | Required for sprint infrastructure management |
11
+ | `Read` | Read project files, configs, docs | Required for context gathering |
12
+ | `Write` | Write sprint-state, specification.yaml, phase summaries | Required for sprint state persistence |
13
+ | `Edit` | Edit sprint-state, CHANGELOG, VERSION | Required for version management |
14
+ | `Glob` | Find project files by pattern | Required for project discovery |
15
+ | `Grep` | Search file contents | Required for codebase understanding |
16
+ | `Task` | Delegate to subagents (quick, deep, unspecified-high) | Core orchestration mechanism |
17
+ | `Skill` | Invoke integrated skills (brainstorming, autoplan, delphi-review, etc.) | Required for skill chain execution |
18
+ | `TodoWrite` | Track sprint progress | Required for progress visibility |
19
+ | `Question` | Ask user at decision gates | Required for user decision points |
20
+
21
+ ## Denied Tools
22
+
23
+ | Tool | Rationale |
24
+ |------|-----------|
25
+ | `rm -rf (any recursive force remove)` | Destructive — sprint flow only cleans up via `git worktree remove` |
26
+ | `git push --force` | Destructive — never force push during sprint |
27
+ | `DROP TABLE or destructive DB operations` | Destructive — sprint flow orchestrates, does not manage databases |
28
+ | `Write(source code)` | Sprint flow NEVER writes implementation code directly — delegates to subagents via `Task` |
29
+ | `Edit(source code)` | Sprint flow NEVER edits implementation code — delegates to subagents via `Task` |
@@ -1,9 +1,9 @@
1
1
  # SKILLS/TEST-SPECIFICATION-ALIGNMENT KNOWLEDGE BASE
2
2
 
3
- **Generated:** 2026-07-09
4
- **Commit:** b1d2c76
5
- **Branch:** sprint/2026-07-09-02
6
- **Version:** 0.14.5.0
3
+ **Generated:** 2026-07-10
4
+ **Commit:** a9276f6
5
+ **Branch:** main
6
+ **Version:** 0.14.6.2
7
7
 
8
8
  ## OVERVIEW
9
9
  Test-Specification Alignment Engine — two-stage validation ensuring tests accurately reflect requirements and design specs.
@@ -10,6 +10,20 @@ OpenCode plugin exposing xp-gate quality gates and AI workflow skills.
10
10
  principles checker (Gate 4 standalone).
11
11
  - **gate-arch** ⇄ `xp-gate arch`: Run architecture validation (Gate 6
12
12
  standalone, layer boundary checks).
13
+ - **session-reload-model**: Reload session model from config. After switching
14
+ provider configs (opencode.json + oh-my-openagent.json via switch-coding-plan.sh),
15
+ updates the session model in OpenCode DB to match the new config, so restarted
16
+ sessions use the current provider/model.
17
+
18
+ Usage:
19
+ ```typescript
20
+ // Reload current session model from config
21
+ session-reload-model()
22
+
23
+ // Reload a specific session
24
+ session-reload-model({ sessionId: "ses_xxx" })
25
+ ```
26
+
13
27
  - **session-rename**: Rename an OpenCode session. When called without a
14
28
  `newTitle`, analyzes the session's recent user messages and auto-generates a
15
29
  descriptive title. Works by directly updating the OpenCode SQLite database
@@ -376,6 +376,78 @@ export const XpGatePlugin = async (input: OpenCodePluginInput) => {
376
376
  return runCmd(cmd, cwd)
377
377
  },
378
378
  }),
379
+ "session-reload-model": tool({
380
+ description: "Reload session model from config. After switching provider configs (opencode.json + oh-my-openagent.json via switch-coding-plan.sh), updates the session model in OpenCode DB to match the new config. This ensures restarted sessions use the current provider/model.",
381
+ args: {
382
+ sessionId: z.string().optional().describe("Session ID to reload (defaults to current session)"),
383
+ },
384
+ async execute(args, ctx) {
385
+ const sessionId = args.sessionId || ctx.sessionID
386
+ const dbPath = join(homedir(), ".local", "share", "opencode", "opencode.db")
387
+ const configDir = join(homedir(), ".config", "opencode")
388
+ const omoConfigPath = join(configDir, "oh-my-openagent.json")
389
+
390
+ if (!existsSync(dbPath)) {
391
+ return "Session reload failed: OpenCode database not found at " + dbPath
392
+ }
393
+ if (!existsSync(omoConfigPath)) {
394
+ return "Session reload failed: oh-my-openagent.json not found at " + omoConfigPath
395
+ }
396
+
397
+ let omoConfig: Record<string, unknown>
398
+ try {
399
+ omoConfig = JSON.parse(readFileSync(omoConfigPath, "utf8"))
400
+ } catch (err) {
401
+ const msg = err instanceof Error ? err.message : String(err)
402
+ return "Session reload failed: could not parse oh-my-openagent.json: " + msg
403
+ }
404
+
405
+ const agents = omoConfig?.["agents"] as Record<string, { model?: string }> | undefined
406
+ const sisyphusModel = agents?.["sisyphus"]?.["model"]
407
+ if (!sisyphusModel || typeof sisyphusModel !== "string") {
408
+ return "Session reload failed: could not find sisyphus.model in oh-my-openagent.json"
409
+ }
410
+
411
+ const slashIdx = sisyphusModel.indexOf("/")
412
+ if (slashIdx === -1) {
413
+ return `Session reload failed: model "${sisyphusModel}" is not in provider/model format`
414
+ }
415
+ const providerID = sisyphusModel.substring(0, slashIdx)
416
+ const modelID = sisyphusModel.substring(slashIdx + 1)
417
+
418
+ let oldModel = "unknown"
419
+ try {
420
+ const escapedId = sessionId.replace(/'/g, "''")
421
+ const currentRaw = execSync(
422
+ `sqlite3 "${dbPath}" "SELECT model FROM session WHERE id = '${escapedId}'"`,
423
+ { encoding: "utf8", timeout: 5000 }
424
+ ).trim()
425
+ if (currentRaw) {
426
+ try {
427
+ const parsed = JSON.parse(currentRaw)
428
+ oldModel = `${parsed.providerID || "?"}/${parsed.id || "?"}`
429
+ } catch {
430
+ oldModel = currentRaw
431
+ }
432
+ }
433
+ } catch {
434
+ oldModel = "unknown"
435
+ }
436
+
437
+ const newModelJson = JSON.stringify({ id: modelID, providerID })
438
+ const escapedId = sessionId.replace(/'/g, "''")
439
+ const escapedModel = newModelJson.replace(/'/g, "''")
440
+ const sql = `UPDATE session SET model = '${escapedModel}', time_updated = ${Date.now()} WHERE id = '${escapedId}'`
441
+
442
+ try {
443
+ execSync(`sqlite3 "${dbPath}" "${sql}"`, { timeout: 5000 })
444
+ return `Session model reloaded: ${oldModel} → ${providerID}/${modelID}`
445
+ } catch (err) {
446
+ const msg = err instanceof Error ? err.message : String(err)
447
+ return `Session reload failed: ${msg}`
448
+ }
449
+ },
450
+ }),
379
451
  "session-rename": tool({
380
452
  description: "Rename an OpenCode session. When called without newTitle, analyzes the session's recent conversation and auto-generates a descriptive title based on the work done.",
381
453
  args: {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boyingliu01/opencode-plugin",
3
- "version": "0.14.5",
3
+ "version": "0.14.7",
4
4
  "type": "module",
5
5
  "main": "index.ts",
6
6
  "description": "XP-Gate quality gates + AI workflow skills + Sprint Flow TUI sidebar for OpenCode",
@@ -1,9 +1,9 @@
1
1
  # SKILLS/DELPHI-REVIEW KNOWLEDGE BASE
2
2
 
3
- **Generated:** 2026-07-09
4
- **Commit:** b1d2c76
5
- **Branch:** sprint/2026-07-09-02
6
- **Version:** 0.14.5.0
3
+ **Generated:** 2026-07-10
4
+ **Commit:** a9276f6
5
+ **Branch:** main
6
+ **Version:** 0.14.6.2
7
7
 
8
8
  ## OVERVIEW
9
9
  Delphi Consensus Review — multi-round anonymous expert review (≥90% threshold, 3 experts from ≥2 providers, domestic models only). Supports design + code-walkthrough modes.