ultra-builder-pro-cli 0.5.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.
Files changed (206) hide show
  1. package/.ultra-template/delivery-report.json +9 -0
  2. package/.ultra-template/docs/research/README.md +53 -0
  3. package/.ultra-template/specs/architecture.md +250 -0
  4. package/.ultra-template/specs/discovery.md +248 -0
  5. package/.ultra-template/specs/product.md +223 -0
  6. package/.ultra-template/tasks/contexts/TEMPLATE.md +57 -0
  7. package/.ultra-template/tasks/tasks.json +33 -0
  8. package/.ultra-template/test-report.json +8 -0
  9. package/CHANGELOG.md +194 -0
  10. package/LICENSE +21 -0
  11. package/README.md +187 -0
  12. package/adapters/_shared/codex-assets.cjs +1128 -0
  13. package/adapters/_shared/codex-ultra-tools-entry.cjs +11 -0
  14. package/adapters/_shared/file-ops.cjs +115 -0
  15. package/adapters/_shared/frontmatter.cjs +52 -0
  16. package/adapters/_shared/handbook.cjs +144 -0
  17. package/adapters/_shared/md-to-toml.cjs +54 -0
  18. package/adapters/_shared/path-rewrite.cjs +79 -0
  19. package/adapters/_shared/rtk-detect.cjs +86 -0
  20. package/adapters/_shared/runtime-assets.cjs +70 -0
  21. package/adapters/_shared/settings-merge.cjs +76 -0
  22. package/adapters/_shared/tests/file-ops.test.cjs +54 -0
  23. package/adapters/_shared/tests/frontmatter.test.cjs +47 -0
  24. package/adapters/_shared/tests/handbook.test.cjs +86 -0
  25. package/adapters/_shared/tests/md-to-toml.test.cjs +48 -0
  26. package/adapters/_shared/tests/path-rewrite.test.cjs +60 -0
  27. package/adapters/_shared/tests/resolve-target.test.cjs +85 -0
  28. package/adapters/_shared/tests/rtk-detect.test.cjs +116 -0
  29. package/adapters/_shared/tests/runtime-assets.test.cjs +107 -0
  30. package/adapters/_shared/tests/settings-merge.test.cjs +85 -0
  31. package/adapters/_shared/tests/validate.test.cjs +30 -0
  32. package/adapters/_shared/validate.cjs +24 -0
  33. package/adapters/claude.js +182 -0
  34. package/adapters/codex.js +385 -0
  35. package/adapters/gemini.js +204 -0
  36. package/adapters/opencode.js +506 -0
  37. package/adapters/tests/claude.test.cjs +117 -0
  38. package/adapters/tests/codex-hook.test.cjs +90 -0
  39. package/adapters/tests/codex.test.cjs +356 -0
  40. package/adapters/tests/gemini.test.cjs +112 -0
  41. package/adapters/tests/opencode.test.cjs +246 -0
  42. package/agents/code-reviewer.md +102 -0
  43. package/agents/debugger.md +127 -0
  44. package/agents/review-code.md +125 -0
  45. package/agents/review-comments.md +98 -0
  46. package/agents/review-coordinator.md +146 -0
  47. package/agents/review-design.md +133 -0
  48. package/agents/review-errors.md +87 -0
  49. package/agents/review-tests.md +93 -0
  50. package/agents/tdd-runner.md +92 -0
  51. package/bin/handbook.js +54 -0
  52. package/bin/install.js +254 -0
  53. package/bin/orchestrator.js +214 -0
  54. package/commands/learn.md +41 -0
  55. package/commands/ultra-deliver.md +45 -0
  56. package/commands/ultra-dev.md +50 -0
  57. package/commands/ultra-init.md +51 -0
  58. package/commands/ultra-plan.md +49 -0
  59. package/commands/ultra-research.md +59 -0
  60. package/commands/ultra-status.md +46 -0
  61. package/commands/ultra-test.md +48 -0
  62. package/commands/ultra-think.md +45 -0
  63. package/docs/AGENT-CONTEXT.md +143 -0
  64. package/docs/ARCHITECTURE.md +197 -0
  65. package/docs/COMMIT-HASH-BACKFILL.md +101 -0
  66. package/docs/LEGACY-HERMES.md +1175 -0
  67. package/docs/PLAN.zh-CN.md +1683 -0
  68. package/docs/ROADMAP.md +102 -0
  69. package/docs/RUNTIME-COMPAT-MATRIX.md +98 -0
  70. package/docs/STATE-DB-ACCESS-POLICY.md +109 -0
  71. package/docs/USER-HANDBOOK-CONTRACT.md +61 -0
  72. package/hooks/README.md +24 -0
  73. package/hooks/active_task_context.py +44 -0
  74. package/hooks/adapters/codex.py +302 -0
  75. package/hooks/health_check.py +61 -0
  76. package/hooks/pre_stop_check.py +56 -0
  77. package/hooks/subagent_tracker.py +116 -0
  78. package/hooks/workflow_checkpoint.py +56 -0
  79. package/hooks/workflow_context.py +63 -0
  80. package/hooks/workflow_resume.py +50 -0
  81. package/mcp-server/lib/init-project.cjs +162 -0
  82. package/mcp-server/lib/llm-client.cjs +157 -0
  83. package/mcp-server/lib/llm-client.test.cjs +156 -0
  84. package/mcp-server/lib/plan-store.cjs +96 -0
  85. package/mcp-server/lib/plan-store.test.cjs +132 -0
  86. package/mcp-server/lib/prd-parser.cjs +110 -0
  87. package/mcp-server/lib/prd-parser.test.cjs +171 -0
  88. package/mcp-server/lib/pricing.cjs +53 -0
  89. package/mcp-server/lib/projector.cjs +158 -0
  90. package/mcp-server/lib/state-db.cjs +113 -0
  91. package/mcp-server/lib/state-db.test.cjs +116 -0
  92. package/mcp-server/lib/state-ops.cjs +725 -0
  93. package/mcp-server/lib/task-expander.cjs +123 -0
  94. package/mcp-server/lib/task-expander.test.cjs +253 -0
  95. package/mcp-server/lib/telemetry.cjs +72 -0
  96. package/mcp-server/lib/topo.cjs +131 -0
  97. package/mcp-server/lib/topo.test.cjs +158 -0
  98. package/mcp-server/server.cjs +482 -0
  99. package/mcp-server/tests/circuit-breaker.test.cjs +125 -0
  100. package/mcp-server/tests/commit-hash-flow.test.cjs +117 -0
  101. package/mcp-server/tests/concurrency-update.test.cjs +96 -0
  102. package/mcp-server/tests/concurrency.test.cjs +112 -0
  103. package/mcp-server/tests/db-ops.test.cjs +117 -0
  104. package/mcp-server/tests/init-project.test.cjs +141 -0
  105. package/mcp-server/tests/migrate.test.cjs +144 -0
  106. package/mcp-server/tests/projector.test.cjs +130 -0
  107. package/mcp-server/tests/server-contract.test.cjs +750 -0
  108. package/mcp-server/tests/staleness.test.cjs +190 -0
  109. package/mcp-server/tests/state-ops.test.cjs +286 -0
  110. package/mcp-server/tests/tagged-tasks.test.cjs +163 -0
  111. package/mcp-server/tests/telemetry.test.cjs +205 -0
  112. package/orchestrator/auto-merge.cjs +109 -0
  113. package/orchestrator/code-graph-watcher.cjs +121 -0
  114. package/orchestrator/daemon.cjs +112 -0
  115. package/orchestrator/dispatch-rules.cjs +93 -0
  116. package/orchestrator/parallel-orchestrator.cjs +195 -0
  117. package/orchestrator/planner/expand-prompt.cjs +62 -0
  118. package/orchestrator/planner/expand-prompt.test.cjs +52 -0
  119. package/orchestrator/planner/plan-builder.cjs +116 -0
  120. package/orchestrator/planner/plan-builder.test.cjs +165 -0
  121. package/orchestrator/planner/prd-prompt.cjs +44 -0
  122. package/orchestrator/planner/prd-prompt.test.cjs +30 -0
  123. package/orchestrator/recovery.cjs +70 -0
  124. package/orchestrator/session-runner.cjs +224 -0
  125. package/orchestrator/skill-miner.cjs +133 -0
  126. package/orchestrator/tests/auto-merge.test.cjs +216 -0
  127. package/orchestrator/tests/code-graph-watcher.test.cjs +183 -0
  128. package/orchestrator/tests/daemon.test.cjs +260 -0
  129. package/orchestrator/tests/dispatch-rules.test.cjs +122 -0
  130. package/orchestrator/tests/parallel-orchestrator.test.cjs +233 -0
  131. package/orchestrator/tests/phase-8b-gate.test.cjs +183 -0
  132. package/orchestrator/tests/recovery.test.cjs +190 -0
  133. package/orchestrator/tests/session-runner.test.cjs +314 -0
  134. package/orchestrator/tests/skill-miner.test.cjs +147 -0
  135. package/orchestrator/tests/worktree-manager.test.cjs +148 -0
  136. package/orchestrator/worktree-manager.cjs +131 -0
  137. package/output-styles/coding-vibes.md +67 -0
  138. package/output-styles/structural-thinking.md +61 -0
  139. package/package.json +109 -0
  140. package/settings.json +8 -0
  141. package/skills/cc-collab/SKILL.md +41 -0
  142. package/skills/code-review-expert/SKILL.md +118 -0
  143. package/skills/code-review-expert/references/code-quality-checklist.md +112 -0
  144. package/skills/code-review-expert/references/integration-checklist.md +46 -0
  145. package/skills/code-review-expert/references/removal-plan.md +52 -0
  146. package/skills/code-review-expert/references/security-checklist.md +100 -0
  147. package/skills/code-review-expert/references/solid-checklist.md +65 -0
  148. package/skills/codex-collab/SKILL.md +52 -0
  149. package/skills/codex-collab/evals/evals.json +40 -0
  150. package/skills/gemini-collab/SKILL.md +51 -0
  151. package/skills/gemini-collab/evals/evals.json +42 -0
  152. package/skills/integration-rules/SKILL.md +71 -0
  153. package/skills/learn/SKILL.md +117 -0
  154. package/skills/security-rules/SKILL.md +60 -0
  155. package/skills/testing-rules/SKILL.md +56 -0
  156. package/skills/ultra-deliver/SKILL.md +171 -0
  157. package/skills/ultra-dev/SKILL.md +324 -0
  158. package/skills/ultra-init/SKILL.md +148 -0
  159. package/skills/ultra-plan/SKILL.md +314 -0
  160. package/skills/ultra-research/SKILL.md +156 -0
  161. package/skills/ultra-research/steps/step-00-problem-validation.md +154 -0
  162. package/skills/ultra-research/steps/step-01-opportunity-discovery.md +172 -0
  163. package/skills/ultra-research/steps/step-02-market-assessment.md +195 -0
  164. package/skills/ultra-research/steps/step-03-competitive-landscape.md +197 -0
  165. package/skills/ultra-research/steps/step-04-product-strategy.md +196 -0
  166. package/skills/ultra-research/steps/step-05-assumptions-validation.md +234 -0
  167. package/skills/ultra-research/steps/step-10-user-personas.md +169 -0
  168. package/skills/ultra-research/steps/step-11-user-scenarios.md +181 -0
  169. package/skills/ultra-research/steps/step-20-user-stories.md +156 -0
  170. package/skills/ultra-research/steps/step-21-features-scope.md +157 -0
  171. package/skills/ultra-research/steps/step-22-success-metrics.md +195 -0
  172. package/skills/ultra-research/steps/step-30-architecture-context.md +154 -0
  173. package/skills/ultra-research/steps/step-31-solution-strategy.md +172 -0
  174. package/skills/ultra-research/steps/step-32-building-blocks.md +188 -0
  175. package/skills/ultra-research/steps/step-40-deployment.md +123 -0
  176. package/skills/ultra-research/steps/step-41-quality-risks.md +135 -0
  177. package/skills/ultra-research/steps/step-99-synthesis.md +188 -0
  178. package/skills/ultra-review/SKILL.md +437 -0
  179. package/skills/ultra-review/references/unified-schema.md +127 -0
  180. package/skills/ultra-review/scripts/review_verdict_update.py +99 -0
  181. package/skills/ultra-review/scripts/review_wait.py +120 -0
  182. package/skills/ultra-status/SKILL.md +162 -0
  183. package/skills/ultra-test/SKILL.md +195 -0
  184. package/skills/ultra-think/SKILL.md +109 -0
  185. package/skills/ultra-verify/SKILL.md +111 -0
  186. package/skills/ultra-verify/evals/evals.json +51 -0
  187. package/skills/ultra-verify/references/confidence-system.md +38 -0
  188. package/skills/ultra-verify/references/cross-verify-modes.md +73 -0
  189. package/skills/ultra-verify/scripts/verify_wait.py +131 -0
  190. package/spec/cli-protocol.md +118 -0
  191. package/spec/mcp-tools.yaml +658 -0
  192. package/spec/schemas/command-manifest.schema.json +47 -0
  193. package/spec/schemas/context-file.v4.5.schema.json +54 -0
  194. package/spec/schemas/mcp-tools.schema.json +136 -0
  195. package/spec/schemas/skill-manifest.schema.json +94 -0
  196. package/spec/schemas/state-db.sql +154 -0
  197. package/spec/schemas/tasks.v4.5.schema.json +66 -0
  198. package/ultra-tools/cli.cjs +121 -0
  199. package/ultra-tools/commands/db.cjs +175 -0
  200. package/ultra-tools/commands/legacy-memory.cjs +159 -0
  201. package/ultra-tools/commands/migrate.cjs +354 -0
  202. package/ultra-tools/commands/session.cjs +180 -0
  203. package/ultra-tools/commands/status.cjs +158 -0
  204. package/ultra-tools/commands/task.cjs +95 -0
  205. package/ultra-tools/legacy-memory.test.cjs +80 -0
  206. package/ultra-tools/status-command.test.cjs +132 -0
@@ -0,0 +1,60 @@
1
+ ---
2
+ name: security-rules
3
+ description: Ultra Builder Pro security rules
4
+ user-invocable: false
5
+ ---
6
+
7
+ # Security Rules
8
+
9
+ These rules are mandatory for all code review and security-related work.
10
+
11
+ ## Input Validation
12
+
13
+ All external input MUST be validated:
14
+ - **Syntactic**: correct format (email, date, UUID)
15
+ - **Semantic**: valid in business context (start < end, price > 0)
16
+ - Validate early, reject invalid input immediately
17
+
18
+ ## Forbidden Patterns
19
+
20
+ | Pattern | Risk | Alternative |
21
+ |---------|------|-------------|
22
+ | SQL string concatenation | SQL Injection | Parameterized queries (`$1`, `?`) |
23
+ | User input → HTML directly | XSS | textContent, sanitizer library |
24
+ | Hardcoded secrets/keys | Credential leak | Environment variables, secret manager |
25
+ | Trust client-supplied role | Privilege escalation | Derive from session/token server-side |
26
+ | Dynamic code evaluation with user input | Code injection | Use safe parsers (JSON.parse, etc.) |
27
+ | Regex with user input | ReDoS | Validate/escape regex input |
28
+
29
+ ## Required Practices
30
+
31
+ | Area | Rule |
32
+ |------|------|
33
+ | SQL | Parameterized queries only |
34
+ | Output | Escape/sanitize all user-derived content |
35
+ | Auth | Use established auth libraries |
36
+ | Secrets | Environment variables or secret manager |
37
+ | Sessions | Secure, HttpOnly, SameSite cookies |
38
+ | CORS | Explicit allowlist, never wildcard in production |
39
+ | File upload | Validate type, size, sanitize filename |
40
+
41
+ ## Error Handling Security
42
+
43
+ - Never expose stack traces to end users
44
+ - Never include sensitive data in error messages
45
+ - Log security events with sufficient context for investigation
46
+ - Use typed errors, not generic messages
47
+
48
+ ## Review Checklist
49
+
50
+ When reviewing code, check for:
51
+ 1. SQL injection vectors (string concatenation in queries)
52
+ 2. XSS vectors (unescaped user input in HTML/templates)
53
+ 3. Hardcoded credentials, API keys, or secrets
54
+ 4. Missing authentication/authorization checks
55
+ 5. Missing input validation on external boundaries
56
+ 6. Insecure direct object references (IDOR)
57
+ 7. Missing rate limiting on sensitive endpoints
58
+ 8. Sensitive data in logs or error messages
59
+ 9. Missing CSRF protection on state-changing operations
60
+ 10. Insecure deserialization
@@ -0,0 +1,56 @@
1
+ ---
2
+ name: testing-rules
3
+ description: Ultra Builder Pro testing discipline rules
4
+ user-invocable: false
5
+ ---
6
+
7
+ # Testing Rules
8
+
9
+ These rules are mandatory for all test-related work.
10
+
11
+ ## TDD Workflow
12
+
13
+ RED → GREEN → REFACTOR (all new code).
14
+
15
+ ## Test Strategy
16
+
17
+ | Layer | Test Type | Mock Strategy |
18
+ |-------|-----------|---------------|
19
+ | Functional Core | Unit Test | No mocks needed (pure input→output) |
20
+ | Imperative Shell | Integration | Testcontainers (real DB/services) |
21
+ | External APIs | Test Double | With `// Test Double rationale: [reason]` |
22
+
23
+ ## Forbidden Patterns
24
+
25
+ These patterns are **never** acceptable:
26
+
27
+ | Pattern | Why Forbidden | Alternative |
28
+ |---------|---------------|-------------|
29
+ | `jest.fn()` for Repository/Service/Domain | Invalid test — doesn't prove production works | Testcontainers |
30
+ | `class InMemoryRepository` | Diverges from real DB behavior | Real DB container |
31
+ | `class MockXxx` / `class FakeXxx` | Hides integration issues | Direct instantiation or Testcontainers |
32
+ | `jest.mock('../services/X')` | Skips real collaboration | Test real collaboration |
33
+ | `it.skip('...database...')` | "Too slow" is not valid | Testcontainers are fast enough |
34
+
35
+ ## Coverage Requirements
36
+
37
+ - 80% overall minimum
38
+ - 100% Functional Core (pure logic must be fully tested)
39
+ - Critical paths for Imperative Shell
40
+
41
+ ## Dev/Prod Parity
42
+
43
+ Tests must use real dependencies:
44
+ - Real database via Testcontainers (not in-memory substitutes)
45
+ - Config via environment variables
46
+ - Mock tests passing ≠ production working
47
+
48
+ ## Detection Checklist
49
+
50
+ When analyzing test files, flag:
51
+ 1. Any `jest.fn()` usage on Repository, Service, or Domain classes
52
+ 2. Any `InMemory*` or `Mock*` or `Fake*` class definitions
53
+ 3. Any `jest.mock()` calls on internal modules
54
+ 4. Any skipped tests with database/slow excuses
55
+ 5. Missing error case coverage
56
+ 6. Missing edge case coverage
@@ -0,0 +1,171 @@
1
+ ---
2
+ name: ultra-deliver
3
+ description: "Release preparation — verify /ultra-test passed, update docs, build, version-bump, tag, push. Writes .ultra/delivery-report.json."
4
+ runtime: all
5
+ cli_fallback: "direct user interaction"
6
+ ---
7
+
8
+ # ultra-deliver — Phase 3.5
9
+
10
+ Release the current working tree. Driven entirely by file-level artifacts
11
+ (`.ultra/test-report.json` as the gate; `.ultra/delivery-report.json` as the
12
+ output). No state.db writes.
13
+
14
+ ## Prerequisites (Pre-Delivery Validations — both BLOCKING)
15
+
16
+ ### Validation 1 — `/ultra-test` passed
17
+
18
+ Read `.ultra/test-report.json`:
19
+ - File must exist → else: "Run `/ultra-test` first" → **EXIT**
20
+ - `passed === true` → else: show `blocking_issues`, **EXIT**
21
+ - `git_commit === current HEAD` → else: "Code changed since last test;
22
+ re-run `/ultra-test`" → **EXIT**
23
+
24
+ ### Validation 2 — No uncommitted changes
25
+
26
+ `git status --porcelain` must be empty. If dirty, ask through the current
27
+ Host's native user-interaction surface:
28
+ - A: "Auto-commit all changes" → `git add -A && git commit -m "chore: pre-delivery cleanup"`
29
+ - B: "Review changes first" → `git diff --stat` → re-ask
30
+ - C: "Block delivery" → **EXIT**
31
+
32
+ Commit failure (conflicts, hook rejection) → surface error and **EXIT**.
33
+
34
+ ## Workflow
35
+
36
+ ### Step 1 — Documentation Update (MANDATORY)
37
+
38
+ **1.1 CHANGELOG.md** (required):
39
+ 1. `git log --oneline <last-tag>..HEAD`
40
+ 2. Categorize by Conventional Commit type: `feat:` → Added, `fix:` → Fixed,
41
+ `chore:` → Maintenance, `refactor:` → Changed, `docs:` → Documentation,
42
+ `test:` → Tests, `perf:` → Performance.
43
+ 3. Insert a new version section at the top of CHANGELOG.md.
44
+ 4. Verify: Read CHANGELOG.md; confirm new version section exists.
45
+
46
+ **1.2 Technical debt report** (required):
47
+ 1. Grep source for `TODO:` / `FIXME:` / `HACK:` / `XXX:`.
48
+ 2. Generate / refresh `.ultra/docs/technical-debt.md`:
49
+ ```markdown
50
+ # Technical Debt (<date>, <commit>)
51
+ | File | Line | Kind | Note |
52
+ |------|------|------|------|
53
+ | src/foo.ts | 42 | TODO | "remove after v1.3" |
54
+ ```
55
+ 3. Verify: file reflects current grep output.
56
+
57
+ **1.3 README.md** (conditional — public API changed):
58
+ 1. Diff exported API signatures since last release (`git diff <last-tag>..HEAD -- 'src/**'`)
59
+ 2. If signatures changed, update README usage examples
60
+ 3. Verify examples match the new API
61
+
62
+ **Checklist**:
63
+ - [ ] CHANGELOG.md updated
64
+ - [ ] technical-debt.md refreshed
65
+ - [ ] README.md reflects current API (if applicable)
66
+
67
+ Any unchecked → fix, then continue.
68
+
69
+ ### Step 2 — Production Build
70
+
71
+ Detect build command (priority order):
72
+ 1. `package.json → scripts.build` → `npm run build` (or `pnpm build`/`yarn build`
73
+ based on lockfile)
74
+ 2. `Makefile` → `make build` or `make release`
75
+ 3. `Cargo.toml` → `cargo build --release`
76
+ 4. `go.mod` → `go build ./...`
77
+ 5. Nothing detected → ask the user for the command
78
+
79
+ Non-zero exit → block with stderr captured, then ask the user:
80
+ - A: "Fix error and retry"
81
+ - B: "Abort delivery"
82
+
83
+ ### Step 3 — Version + Release (MANDATORY — all 5 sub-steps)
84
+
85
+ **3.1 Determine version bump**:
86
+ - `git log <last-tag>..HEAD --oneline` → analyze commit types
87
+ - `feat:` → minor, `BREAKING CHANGE:` / `!:` → major, else patch
88
+ - Display `<old> → <new>`; allow an explicit user override.
89
+
90
+ **3.2 Update version in project files**:
91
+ - `package.json`, `Cargo.toml`, `pyproject.toml`, etc.
92
+ - Verify: read the file; confirm new version.
93
+
94
+ **3.3 Release commit**:
95
+ ```bash
96
+ git add -A
97
+ git commit -m "chore(release): v<X.Y.Z>"
98
+ ```
99
+ Verify with `git log -1 --oneline`.
100
+
101
+ **3.4 Git tag**:
102
+ ```bash
103
+ git tag v<X.Y.Z>
104
+ ```
105
+ Verify with `git tag -l v<X.Y.Z>`.
106
+
107
+ **3.5 Push to remote**:
108
+ ```bash
109
+ git push origin main # release commit
110
+ git push origin v<X.Y.Z> # version tag
111
+ ```
112
+ Verify with `git ls-remote --tags origin | grep v<X.Y.Z>`.
113
+
114
+ **Release checklist**:
115
+ - [ ] Version determined and displayed
116
+ - [ ] Version file updated and verified
117
+ - [ ] Release commit created and verified
118
+ - [ ] Git tag created and verified
119
+ - [ ] Commit and tag pushed and verified on remote
120
+
121
+ Any failure → stop immediately; do NOT continue; surface last-step error.
122
+
123
+ ### Step 4 — Persist `.ultra/delivery-report.json`
124
+
125
+ ```jsonc
126
+ {
127
+ "timestamp": "<ISO8601>",
128
+ "version": "<X.Y.Z>",
129
+ "git_tag": "v<X.Y.Z>",
130
+ "git_commit": "<HEAD SHA>",
131
+ "changelog_updated": true,
132
+ "technical_debt_refreshed": true,
133
+ "build_success": true,
134
+ "pushed": true
135
+ }
136
+ ```
137
+
138
+ ### Step 5 — Report
139
+
140
+ Print a tight release summary: tag, commit, files touched in CHANGELOG,
141
+ outstanding technical-debt count, next suggested action (deploy / announce).
142
+
143
+ ## Deliverables Checklist (final)
144
+
145
+ - [ ] `/ultra-test` passed (verified via test-report.json)
146
+ - [ ] Uncommitted changes handled
147
+ - [ ] CHANGELOG + technical-debt refreshed (README if API changed)
148
+ - [ ] Production build exit 0
149
+ - [ ] Version bumped, tagged, pushed
150
+ - [ ] delivery-report.json written
151
+
152
+ ## MCP → CLI fallback matrix
153
+
154
+ | Purpose | MCP tool | CLI fallback |
155
+ |---------|----------|--------------|
156
+ | Resolve dirty-tree action | none | current Host's native user-interaction surface |
157
+ | Override version bump | none | current Host's native user-interaction surface |
158
+
159
+ ## What this skill DOES NOT do
160
+
161
+ - Does NOT run tests (that is `/ultra-test`'s job)
162
+ - Does NOT publish to npm / crates.io / PyPI (Phase 9 handles distribution)
163
+ - Does NOT mutate state.db
164
+
165
+ ## Integration
166
+
167
+ | | |
168
+ |---|---|
169
+ | **Input** | `.ultra/test-report.json` (gate), current repo |
170
+ | **Output** | `.ultra/delivery-report.json`, git tag + remote push |
171
+ | **Next** | Deploy target (Railway / Vercel / etc.) or release announcement |
@@ -0,0 +1,324 @@
1
+ ---
2
+ name: ultra-dev
3
+ description: "Agile development execution with TDD workflow. Writes state through live task MCP tools, reviews through native host subagents, and checkpoints through workflow-state plus lifecycle hooks."
4
+ runtime: all
5
+ mcp_tools_required:
6
+ - task.update
7
+ - task.get
8
+ - task.list
9
+ cli_fallback: "task update"
10
+ ---
11
+
12
+ # ultra-dev — Phase 3.4
13
+
14
+ Drive one task from `pending → completed` using a strict TDD loop, gated by
15
+ `/ultra-review`. **state.db is the authority**: status transitions go through
16
+ MCP `task.update`; the projector regenerates `tasks.json` and context-md
17
+ frontmatter. The skill only writes context-md **bodies** (Change Log,
18
+ Completion, Dual-Write notes).
19
+
20
+ ## Design decisions vs pre-Phase-3
21
+
22
+ - **Single-write status**: Step 1.5 / Step 5 stop touching `contexts/task-{id}.md`
23
+ frontmatter or the "`> **Status**: xxx`" line. Only MCP `task.update` fires;
24
+ projector rewrites frontmatter; humans read body for history.
25
+ - **Native review path**: `/ultra-review all` delegates bounded review work to
26
+ the current Host's installed review agents. Review is not an MCP service.
27
+ - **No `/compact` dependency**: Step 4.4 writes `.ultra/workflow-state.json`;
28
+ trusted lifecycle hooks preserve and restore it around compaction when the
29
+ Host exposes those events.
30
+
31
+ ## Prerequisites
32
+
33
+ - `.ultra/tasks/tasks.json` exists (from `/ultra-plan`)
34
+ - At least one task with `status=pending`
35
+ - `state.db` initialized (first `task.*` call will init if missing)
36
+
37
+ ## Arguments
38
+
39
+ - `$1`: task id (optional; default = first `pending` task in topological order)
40
+
41
+ ## Workflow
42
+
43
+ ### Step 0 — Workflow Resume Check
44
+
45
+ Read `.ultra/workflow-state.json` if present.
46
+ - If `branch` matches current `git branch --show-current` → resume from the
47
+ step after `status`
48
+ - If `review_session` is set → skip re-running review
49
+ - Otherwise → proceed to Step 0.5
50
+
51
+ ### Step 0.5 — Design Approval Gate (first run only)
52
+
53
+ Fires when `.ultra/workflow-state.json` does NOT exist.
54
+
55
+ 1. `task.list` → confirm plan present; if empty, instruct `/ultra-plan` and **EXIT**
56
+ 2. If ANY task has `status` in (`in_progress`, `completed`) → plan was already
57
+ approved → skip this gate
58
+ 3. Present plan overview (totals, P0/P1/P2, Walking-Skeleton position)
59
+ 4. Ask through the current Host's native user-interaction surface:
60
+ - A: "Confirm, start implementation" → continue to Step 1
61
+ - B: "Revise plan first" → suggest `/ultra-plan` → **EXIT**
62
+ 5. On approval, write workflow-state:
63
+ ```jsonc
64
+ {"command":"ultra-dev","task_id":0,"branch":"","step":"0.5","status":"design_approved","ts":"<ISO8601>"}
65
+ ```
66
+
67
+ ### Step 1 — Task Selection
68
+
69
+ ```jsonc
70
+ // MCP: task.list (or runtime args supply id)
71
+ { "status": "pending" }
72
+ ```
73
+
74
+ Pick the first result (dependency-resolved) or the one matching `$1`.
75
+ Read `.ultra/tasks/contexts/task-{id}.md` body for the Implementation /
76
+ Acceptance sections. Use the Acceptance list as the initial todo set.
77
+
78
+ ### Step 1.5 — Status → in_progress (single-write)
79
+
80
+ ```jsonc
81
+ // MCP: task.update (R: do NOT touch context-md frontmatter or "> **Status**" line)
82
+ { "id": "<id>", "patch": { "status": "in_progress" } }
83
+ ```
84
+
85
+ **CLI fallback**: `ultra-tools task update <id> --status in_progress`.
86
+
87
+ Projector runs after the write → `tasks.json` + `contexts/task-{id}.md`
88
+ frontmatter re-generated with `status: in_progress`. **Do not hand-edit either.**
89
+
90
+ ### Step 2 — Environment Setup
91
+
92
+ **Unmerged-completed recovery**: `git branch --list 'feat/task-*'`; for each,
93
+ extract task id, look up status via `task.get`. If any completed task has an
94
+ unmerged branch → ask the user:
95
+ - "Merge task-{id} to main first" (recommended)
96
+ - "Delete branch (abandoned)"
97
+ - "Skip, continue with new task"
98
+
99
+ **Branch setup**:
100
+
101
+ | Current branch | Action |
102
+ |----------------|--------|
103
+ | `main` / `master` | `git pull origin main && git checkout -b feat/task-{id}-{slug}` |
104
+ | `feat/task-{id}-*` (same task) | continue (resume checkpoint) |
105
+ | other | ask the user: switch to main + new branch / continue current |
106
+
107
+ **Dependencies**: soft-warn only; parallel work is allowed.
108
+
109
+ ### Step 3 — TDD Cycle
110
+
111
+ **Subagent isolation (complexity ≥ 7)**: optional — delegate a bounded TDD
112
+ cycle through the current Host's native subagent surface; the subagent returns
113
+ a summary and the primary agent owns verification.
114
+
115
+ **Mid-TDD checkpoint (complexity ≥ 6)**: after GREEN phase, write a
116
+ checkpoint. See Step 4.4 for the preferred MCP route.
117
+
118
+ **RED** — write failing tests:
119
+ - Mine Acceptance list for test specs
120
+ - Cover 5 dimensions: functional / boundary / exception / security / integration
121
+ - At least one integration test per boundary-crossing module
122
+ - Run; confirm failure
123
+
124
+ **GREEN** — minimum code to pass:
125
+ - Production-ready (no TODO / placeholder)
126
+ - Run; confirm pass
127
+
128
+ **REFACTOR** — SOLID / DRY / KISS / YAGNI; tests stay green.
129
+
130
+ **Checkpoint after Step 3.3**:
131
+ ```jsonc
132
+ {"command":"ultra-dev","task_id":<id>,"branch":"<branch>","step":"3.3","status":"tdd_complete","ts":"<iso>"}
133
+ ```
134
+ → `.ultra/workflow-state.json`
135
+
136
+ ### Step 4 — Quality Gates
137
+
138
+ | Gate | Requirement |
139
+ |------|-------------|
140
+ | Tests green | 0 failures |
141
+ | Coverage | ≥80% overall; 100% functional-core; critical paths for shell |
142
+ | Mock policy | Core logic: no mocks; external: testcontainers/stub OK |
143
+ | No degradation | Zero fallback or demo code |
144
+ | Integration test | Boundary-crossing code has ≥1 real integration test |
145
+ | Entry-point reachable | New modules trace to a handler/listener/cron |
146
+ | Spec compliance | Each Acceptance criterion implemented AND tested |
147
+
148
+ Checkpoint `step="4"`, `status="gates_passed"`.
149
+
150
+ ### Step 4.4 — Pre-Review Checkpoint
151
+
152
+ 1. Write `.ultra/workflow-state.json` with `step=4.5, status=pre_review`.
153
+ 2. Let trusted Host lifecycle hooks preserve and restore that state when
154
+ compaction events exist.
155
+ 3. On Hosts without compaction hooks, resume directly from the same file.
156
+
157
+ **Gate**: the skill MUST NOT require `/compact`; it MUST work when the
158
+ runtime cannot compact.
159
+
160
+ ### Step 4.5 — Ultra Review (MANDATORY)
161
+
162
+ Invoke `/ultra-review all`. The workflow uses the current Host's installed
163
+ review agents and writes the unified review artifact. The primary agent owns
164
+ the final verdict and re-runs relevant tests after fixes.
165
+
166
+ **MAX_REVIEW_ITERATIONS = 2**
167
+
168
+ | Verdict | Iter | Action |
169
+ |---------|------|--------|
170
+ | APPROVE | any | → Step 5 |
171
+ | COMMENT | any | review P1s, fix if warranted, → Step 5 |
172
+ | REQUEST_CHANGES | 1 | fix ALL P0, re-run tests, `/ultra-review recheck` |
173
+ | REQUEST_CHANGES | 2 | stall check → escalate or fix |
174
+
175
+ **Stall detection before iter 2**: if `curr_count >= prev_count` (P0+P1 not
176
+ shrinking) → write `UNRESOLVED.md`, WARN user, proceed to Step 5.
177
+
178
+ **Verification gate before Step 5**:
179
+ - SUMMARY.json verdict ≠ `REQUEST_CHANGES`
180
+ - All P0 resolved
181
+ - Tests still green
182
+
183
+ Checkpoint `step="4.5", status="review_done", review_session=<id>, review_iteration=<N>`.
184
+
185
+ ### Step 5 — Status → completed (single-write)
186
+
187
+ **Prerequisites**: Step 4 + Step 4.5 green.
188
+
189
+ ```jsonc
190
+ // MCP: task.update
191
+ {
192
+ "id": "<id>",
193
+ "patch": {
194
+ "status": "completed",
195
+ "completion_commit": "_pending_" // overwritten in Step 6 after commit
196
+ }
197
+ }
198
+ ```
199
+
200
+ **CLI fallback**: `ultra-tools task update <id> --status completed`.
201
+
202
+ Projector regenerates frontmatter. **Then** write the context-md **body**
203
+ Completion section (skill responsibility, not projector):
204
+
205
+ ```markdown
206
+ ## Completion
207
+ - **Completed**: <YYYY-MM-DD>
208
+ - **Commit**: _pending_ # filled in Step 6
209
+ - **Summary**: <one-line delivery summary>
210
+ ```
211
+
212
+ **Do not** hand-edit `> **Status**` anywhere in the body — frontmatter owns it.
213
+
214
+ ### Step 5.5 — Pre-Commit Checklist (BLOCKING)
215
+
216
+ Before `git commit`, verify every item:
217
+
218
+ - [ ] `task.get` confirms `status="completed"`
219
+ - [ ] context-md body has updated Completion section
220
+ - [ ] All tests pass
221
+ - [ ] Ultra Review verdict ≠ `REQUEST_CHANGES`
222
+ - [ ] New modules reach a live entry point (no orphan)
223
+ - [ ] Boundary-crossing code has integration test
224
+
225
+ Any unchecked → fix; do NOT commit.
226
+
227
+ ### Step 6 — Commit + Merge
228
+
229
+ 1. `git status` → show diff
230
+ 2. Ask through the current Host's native user-interaction surface:
231
+ - A: "Commit + Merge to main" (recommended)
232
+ - B: "Commit only, create PR later"
233
+ - C: "Review diff first" → `git diff --stat` → re-ask
234
+
235
+ 3. On approval:
236
+ ```bash
237
+ git add -A
238
+ git commit -m "feat(scope): description"
239
+ ```
240
+
241
+ 4. Record commit hash via MCP:
242
+ ```jsonc
243
+ { "id": "<id>", "patch": { "completion_commit": "<sha>" } }
244
+ ```
245
+ Update context-md body Completion line to the real hash; amend:
246
+ ```bash
247
+ git add .ultra/tasks/contexts/task-<id>.md
248
+ git commit --amend --no-edit
249
+ ```
250
+ (The amend is OK here — the first commit is a local, not-yet-pushed commit
251
+ in the feature branch. Never amend pushed commits.)
252
+
253
+ 5. `git fetch origin && git rebase origin/main`; resolve any conflicts.
254
+
255
+ 6. Re-run tests after rebase. Fail → fix → amend → repeat 5-6.
256
+
257
+ 7. If Option A chosen:
258
+ ```bash
259
+ git checkout main && git pull origin main
260
+ git merge --no-ff feat/task-<id>-<slug>
261
+ git push origin main && git branch -d feat/task-<id>-<slug>
262
+ ```
263
+
264
+ Checkpoint `step="6", status="committed", commit=<sha>`.
265
+
266
+ ### Step 7 — Report
267
+
268
+ - Commit hash
269
+ - Project progress (`task.list` → `completed/total`)
270
+ - Next task suggestion (first remaining `pending` in topological order)
271
+
272
+ ## Dual-Write Mode
273
+
274
+ Triggered when implementation reveals spec gaps or requirement changes.
275
+
276
+ **Classification (mandatory before updating specs)**:
277
+
278
+ | Kind | Meaning | Action |
279
+ |------|---------|--------|
280
+ | **EXPANSION** | new requirement surfaced | update spec + Change Log |
281
+ | **CORRECTION** | spec error/ambiguity | update spec + Change Log |
282
+ | **REDUCTION** | removing/weakening scope | **STOP** → ask the user for approval |
283
+
284
+ **REDUCTION gate** — options:
285
+ - A: "Approve reduction, update spec"
286
+ - B: "Keep original scope, find alternative implementation"
287
+ - C: "Split into separate task, defer to next cycle"
288
+
289
+ Update `.ultra/specs/` immediately so parallel tasks see current truth.
290
+ Log in context-md body Change Log:
291
+
292
+ ```markdown
293
+ | <date> | <KIND> | <change desc> | specs/<file>#<section> | <reason> |
294
+ ```
295
+
296
+ **Principle**: `specs/` is source of truth; `contexts/` tracks implementation
297
+ history. Specs may grow (EXPANSION) or be corrected (CORRECTION). Specs must
298
+ never silently shrink (REDUCTION without gate).
299
+
300
+ ## MCP → CLI fallback matrix
301
+
302
+ | Purpose | MCP tool (phase) | CLI / runtime fallback |
303
+ |---------|------------------|------------------------|
304
+ | Select pending task | `task.list` (2) / `task.get` (2) | `ultra-tools task list --status pending` |
305
+ | Status → in_progress | `task.update` (2) | `ultra-tools task update <id> --status in_progress` |
306
+ | Pre-review checkpoint | none | write `.ultra/workflow-state.json`; lifecycle hooks restore it |
307
+ | Run review | none | `/ultra-review all` + Host-native review agents |
308
+ | Status → completed | `task.update` (2) | `ultra-tools task update <id> --status completed` |
309
+ | Ask user | none | current Host's native user-interaction surface |
310
+
311
+ ## What this skill DOES NOT do
312
+
313
+ - Does NOT write `tasks.json` directly (projector owns it)
314
+ - Does NOT edit context-md frontmatter (projector owns it)
315
+ - Does NOT require the runtime to support `/compact`
316
+ - Does NOT advertise review or checkpoint operations as MCP tools
317
+
318
+ ## Integration
319
+
320
+ | | |
321
+ |---|---|
322
+ | **Input** | `.ultra/tasks/tasks.json`, `.ultra/tasks/contexts/task-<id>.md` body, state.db |
323
+ | **Writes** | state.db (via `task.update`), context-md body (Completion + Change Log), workflow-state.json checkpoints |
324
+ | **Next** | `/ultra-dev <next-id>` or `/ultra-test` when all Walking Skeleton + critical-path tasks complete |