ultra-builder-pro-cli 0.25.1 → 0.26.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (243) hide show
  1. package/.ultra-template/changes/abandoned/.gitkeep +0 -0
  2. package/.ultra-template/contexts/TEMPLATE.md +94 -0
  3. package/.ultra-template/decisions/.gitkeep +1 -0
  4. package/.ultra-template/evidence/.gitkeep +1 -0
  5. package/.ultra-template/north-star.md +46 -0
  6. package/.ultra-template/research/.gitkeep +1 -0
  7. package/.ultra-template/specs/discovery.md +2 -2
  8. package/.ultra-template/tasks.json +3 -0
  9. package/.ultra-template/test-report.json +27 -0
  10. package/CHANGELOG.md +107 -1
  11. package/README.md +217 -579
  12. package/adapters/_shared/delegate-profiles/kimi-read-only.md +15 -0
  13. package/adapters/_shared/delegate-profiles/kimi-write.md +17 -0
  14. package/adapters/_shared/file-ops.cjs +76 -2
  15. package/adapters/_shared/host-profile.cjs +97 -0
  16. package/adapters/_shared/plugin-core.cjs +204 -0
  17. package/adapters/_shared/runtime-assets.cjs +31 -96
  18. package/adapters/claude.js +92 -291
  19. package/adapters/codex.js +309 -842
  20. package/adapters/grok.js +143 -1469
  21. package/adapters/kimi.js +124 -1053
  22. package/adapters/opencode.js +230 -742
  23. package/bin/delegate-worker.cjs +328 -0
  24. package/bin/delegate.cjs +463 -0
  25. package/bin/install.js +38 -11
  26. package/docs/ARCHITECTURE.md +125 -216
  27. package/docs/ARTIFACT-AUTHORITY.md +90 -268
  28. package/docs/DECISIONS.md +77 -87
  29. package/docs/PHILOSOPHY.md +208 -0
  30. package/docs/PLUGIN-ISOLATION-CONTRACT.md +65 -39
  31. package/docs/RUNTIME-COMPAT-MATRIX.md +140 -155
  32. package/docs/SKILL-AUTHORING.md +94 -73
  33. package/docs/WORKFLOW-LIFECYCLE.md +97 -189
  34. package/hooks/README.md +19 -37
  35. package/hooks/_common.py +113 -0
  36. package/hooks/adapters/codex.py +9 -16
  37. package/hooks/adapters/grok.py +5 -5
  38. package/hooks/adapters/kimi.py +8 -14
  39. package/hooks/block_dangerous_commands.py +201 -0
  40. package/hooks/compact_context.py +65 -0
  41. package/hooks/mid_workflow_recall.py +25 -0
  42. package/hooks/post_edit_guard.py +105 -0
  43. package/hooks/session_context.py +30 -0
  44. package/package.json +17 -52
  45. package/skills/ultra-change/SKILL.md +115 -50
  46. package/skills/ultra-change/references/change-contract.md +68 -3
  47. package/skills/ultra-delegate/SKILL.md +89 -0
  48. package/skills/ultra-delegate/references/delegation-contract.md +59 -0
  49. package/skills/ultra-delegate/scripts/delegate_wait.py +86 -0
  50. package/skills/ultra-deliver/SKILL.md +98 -42
  51. package/skills/ultra-deliver/references/baseline-reconciliation.md +39 -20
  52. package/skills/ultra-dev/SKILL.md +115 -62
  53. package/skills/ultra-dev/references/debugging.md +22 -0
  54. package/skills/ultra-domain-modeling/SKILL.md +79 -0
  55. package/skills/ultra-grilling/SKILL.md +118 -0
  56. package/skills/ultra-grilling/references/reframing.md +72 -0
  57. package/skills/ultra-init/SKILL.md +102 -37
  58. package/skills/ultra-init/references/brownfield-adoption.md +33 -83
  59. package/skills/ultra-init/scripts/init_project.cjs +84 -0
  60. package/skills/ultra-plan/SKILL.md +101 -68
  61. package/skills/ultra-research/SKILL.md +68 -48
  62. package/skills/ultra-research/references/00-problem-validation.md +5 -5
  63. package/skills/ultra-research/references/01-opportunity-discovery.md +3 -3
  64. package/skills/ultra-research/references/02-market-assessment.md +5 -4
  65. package/skills/ultra-research/references/03-competitive-landscape.md +3 -3
  66. package/skills/ultra-research/references/04-product-strategy.md +3 -3
  67. package/skills/ultra-research/references/05-assumptions-validation.md +5 -5
  68. package/skills/ultra-research/references/10-user-personas.md +3 -2
  69. package/skills/ultra-research/references/11-user-scenarios.md +3 -3
  70. package/skills/ultra-research/references/20-user-stories.md +4 -3
  71. package/skills/ultra-research/references/21-features-scope.md +3 -2
  72. package/skills/ultra-research/references/22-success-metrics.md +3 -3
  73. package/skills/ultra-research/references/30-architecture-context.md +3 -3
  74. package/skills/ultra-research/references/31-solution-strategy.md +3 -3
  75. package/skills/ultra-research/references/32-building-blocks.md +3 -3
  76. package/skills/ultra-research/references/40-deployment.md +3 -3
  77. package/skills/ultra-research/references/41-quality-risks.md +3 -3
  78. package/skills/ultra-research/references/99-synthesis.md +7 -7
  79. package/skills/ultra-review/SKILL.md +84 -32
  80. package/skills/ultra-review/references/code.md +17 -0
  81. package/skills/ultra-review/references/comments.md +12 -0
  82. package/skills/ultra-review/references/design.md +12 -0
  83. package/skills/ultra-review/references/errors.md +13 -0
  84. package/skills/ultra-review/references/spec.md +13 -0
  85. package/skills/ultra-review/references/tests.md +12 -0
  86. package/skills/ultra-review/references/worker-packet.md +40 -0
  87. package/skills/ultra-review/scripts/review_wait.py +26 -15
  88. package/skills/ultra-status/SKILL.md +61 -36
  89. package/skills/ultra-tdd/SKILL.md +81 -0
  90. package/skills/ultra-tdd/references/templates/README.md +20 -0
  91. package/skills/ultra-tdd/references/templates/feature-flag-default-audit.sh +79 -0
  92. package/skills/ultra-tdd/references/templates/persistence-real.ts +78 -0
  93. package/skills/ultra-tdd/references/templates/testcontainer-postgres.py +78 -0
  94. package/skills/ultra-tdd/references/templates/testcontainer-postgres.ts +73 -0
  95. package/skills/ultra-tdd/references/templates/vertical-slice.ts +66 -0
  96. package/skills/ultra-tdd/references/test-execution.md +18 -0
  97. package/skills/ultra-test/SKILL.md +75 -30
  98. package/skills/ultra-test/references/export-syntax.md +18 -0
  99. package/skills/ultra-test/scripts/worktree_digest.cjs +54 -0
  100. package/skills/ultra-think/SKILL.md +49 -27
  101. package/skills/ultra-think/references/autonomy-boundary.md +48 -0
  102. package/skills/ultra-think/references/interaction-boundary.md +18 -33
  103. package/.ultra-template/docs/research/README.md +0 -55
  104. package/.ultra-template/reports/templates/delivery-report.json +0 -17
  105. package/.ultra-template/reports/templates/test-report.json +0 -18
  106. package/.ultra-template/tasks/tasks.json +0 -15
  107. package/.ultra-template/templates/task-context.md +0 -19
  108. package/adapters/_shared/codex-assets.cjs +0 -725
  109. package/adapters/_shared/codex-ultra-tools-entry.cjs +0 -11
  110. package/adapters/_shared/interaction-contract.cjs +0 -129
  111. package/adapters/_shared/path-rewrite.cjs +0 -79
  112. package/adapters/_shared/runtime-native.cjs +0 -132
  113. package/adapters/_shared/settings-merge.cjs +0 -76
  114. package/agents/code-reviewer.md +0 -42
  115. package/agents/debugger.md +0 -40
  116. package/agents/review-code.md +0 -49
  117. package/agents/review-comments.md +0 -38
  118. package/agents/review-coordinator.md +0 -56
  119. package/agents/review-design.md +0 -40
  120. package/agents/review-errors.md +0 -43
  121. package/agents/review-spec.md +0 -39
  122. package/agents/review-tests.md +0 -40
  123. package/agents/tdd-runner.md +0 -38
  124. package/bin/orchestrator.js +0 -383
  125. package/commands/ultra-change.md +0 -10
  126. package/commands/ultra-deliver.md +0 -10
  127. package/commands/ultra-dev.md +0 -10
  128. package/commands/ultra-doctor.md +0 -10
  129. package/commands/ultra-init.md +0 -10
  130. package/commands/ultra-plan.md +0 -10
  131. package/commands/ultra-research.md +0 -10
  132. package/commands/ultra-review.md +0 -10
  133. package/commands/ultra-status.md +0 -10
  134. package/commands/ultra-test.md +0 -10
  135. package/commands/ultra-think.md +0 -10
  136. package/docs/AGENT-CONTEXT.md +0 -191
  137. package/docs/COMMIT-HASH-BACKFILL.md +0 -51
  138. package/docs/LEGACY-CLI-CROSSWALK.md +0 -175
  139. package/docs/ROADMAP.md +0 -101
  140. package/docs/STATE-DB-ACCESS-POLICY.md +0 -161
  141. package/hooks/active_task_context.py +0 -152
  142. package/hooks/context_envelope.py +0 -100
  143. package/hooks/health_check.py +0 -196
  144. package/hooks/pre_stop_check.py +0 -66
  145. package/hooks/runtime_paths.py +0 -396
  146. package/hooks/subagent_tracker.py +0 -88
  147. package/hooks/workflow_checkpoint.py +0 -76
  148. package/hooks/workflow_context.py +0 -48
  149. package/hooks/workflow_resume.py +0 -84
  150. package/mcp-server/hook-context.cjs +0 -38
  151. package/mcp-server/hook-event.cjs +0 -34
  152. package/mcp-server/lib/archive-journal.cjs +0 -1119
  153. package/mcp-server/lib/archive-mutation-worker.py +0 -365
  154. package/mcp-server/lib/artifact-registry.cjs +0 -1232
  155. package/mcp-server/lib/baseline-workflow.cjs +0 -1193
  156. package/mcp-server/lib/canonical-json.cjs +0 -19
  157. package/mcp-server/lib/change-authority.cjs +0 -26
  158. package/mcp-server/lib/change-packet.cjs +0 -790
  159. package/mcp-server/lib/change-workflow.cjs +0 -65
  160. package/mcp-server/lib/context-envelope.cjs +0 -581
  161. package/mcp-server/lib/context-paths.cjs +0 -142
  162. package/mcp-server/lib/decision-records.cjs +0 -423
  163. package/mcp-server/lib/delivery-transaction.cjs +0 -471
  164. package/mcp-server/lib/doctor-backup-worker.cjs +0 -328
  165. package/mcp-server/lib/doctor.cjs +0 -627
  166. package/mcp-server/lib/git-bootstrap.cjs +0 -651
  167. package/mcp-server/lib/init-project.cjs +0 -1021
  168. package/mcp-server/lib/kernel-change-workflow.cjs +0 -2029
  169. package/mcp-server/lib/legacy-change-workflow.cjs +0 -3032
  170. package/mcp-server/lib/managed-file-write.cjs +0 -172
  171. package/mcp-server/lib/plan-checkpoint.cjs +0 -177
  172. package/mcp-server/lib/plan-publication-worker.cjs +0 -830
  173. package/mcp-server/lib/plan-store.cjs +0 -794
  174. package/mcp-server/lib/prd-parser.cjs +0 -83
  175. package/mcp-server/lib/pricing.cjs +0 -44
  176. package/mcp-server/lib/project-context.cjs +0 -178
  177. package/mcp-server/lib/projector.cjs +0 -386
  178. package/mcp-server/lib/provider-refs.cjs +0 -42
  179. package/mcp-server/lib/runtime-paths.cjs +0 -1714
  180. package/mcp-server/lib/runtime-state.cjs +0 -222
  181. package/mcp-server/lib/safe-project-file.cjs +0 -385
  182. package/mcp-server/lib/stage-checkpoints.cjs +0 -463
  183. package/mcp-server/lib/state-authority.cjs +0 -95
  184. package/mcp-server/lib/state-db.cjs +0 -1580
  185. package/mcp-server/lib/state-ops.cjs +0 -1428
  186. package/mcp-server/lib/task-contract.cjs +0 -404
  187. package/mcp-server/lib/task-expander.cjs +0 -105
  188. package/mcp-server/lib/task-ledger.cjs +0 -1964
  189. package/mcp-server/lib/telemetry.cjs +0 -85
  190. package/mcp-server/lib/topo.cjs +0 -131
  191. package/mcp-server/lib/ultra-facade.cjs +0 -2684
  192. package/mcp-server/lib/worker-packet.cjs +0 -358
  193. package/mcp-server/server.cjs +0 -437
  194. package/orchestrator/auto-merge.cjs +0 -128
  195. package/orchestrator/daemon.cjs +0 -264
  196. package/orchestrator/dispatch-rules.cjs +0 -78
  197. package/orchestrator/parallel-orchestrator.cjs +0 -903
  198. package/orchestrator/planner/plan-builder.cjs +0 -125
  199. package/orchestrator/recovery.cjs +0 -188
  200. package/orchestrator/session-close-journal-worker.cjs +0 -5
  201. package/orchestrator/session-close-journal.cjs +0 -1014
  202. package/orchestrator/session-runner.cjs +0 -1153
  203. package/orchestrator/worktree-manager.cjs +0 -282
  204. package/settings.json +0 -7
  205. package/skills/cc-collab/SKILL.md +0 -42
  206. package/skills/code-review-expert/SKILL.md +0 -43
  207. package/skills/code-review-expert/references/correctness-reliability.md +0 -30
  208. package/skills/code-review-expert/references/design-boundaries.md +0 -26
  209. package/skills/code-review-expert/references/removal-plan.md +0 -24
  210. package/skills/codex-collab/SKILL.md +0 -49
  211. package/skills/codex-collab/evals/evals.json +0 -35
  212. package/skills/integration-rules/SKILL.md +0 -32
  213. package/skills/security-rules/SKILL.md +0 -38
  214. package/skills/testing-rules/SKILL.md +0 -32
  215. package/skills/ultra-doctor/SKILL.md +0 -41
  216. package/skills/ultra-plan/references/semantic-preflight.md +0 -20
  217. package/skills/ultra-verify/SKILL.md +0 -46
  218. package/skills/ultra-verify/evals/evals.json +0 -46
  219. package/skills/ultra-verify/references/cross-verify-modes.md +0 -28
  220. package/skills/ultra-verify/references/evidence-status.md +0 -21
  221. package/skills/ultra-verify/scripts/verify_wait.py +0 -94
  222. package/spec/cli-protocol.md +0 -102
  223. package/spec/mcp-tools.yaml +0 -312
  224. package/spec/schemas/baseline-reconciliation.v1.schema.json +0 -73
  225. package/spec/schemas/change-delta.v1.schema.json +0 -153
  226. package/spec/schemas/command-manifest.schema.json +0 -29
  227. package/spec/schemas/context-file.v4.5.schema.json +0 -54
  228. package/spec/schemas/delivery-report.v1.schema.json +0 -66
  229. package/spec/schemas/documentation-reconciliation.v1.schema.json +0 -106
  230. package/spec/schemas/mcp-tools.schema.json +0 -136
  231. package/spec/schemas/skill-manifest.schema.json +0 -24
  232. package/spec/schemas/state-db.sql +0 -641
  233. package/spec/schemas/task-ledger.v2.schema.json +0 -296
  234. package/spec/schemas/tasks.v4.5.schema.json +0 -96
  235. package/spec/schemas/test-report.v1.schema.json +0 -225
  236. package/ultra-tools/cli.cjs +0 -129
  237. package/ultra-tools/commands/db.cjs +0 -226
  238. package/ultra-tools/commands/legacy-memory.cjs +0 -159
  239. package/ultra-tools/commands/migrate.cjs +0 -1386
  240. package/ultra-tools/commands/session.cjs +0 -213
  241. package/ultra-tools/commands/status.cjs +0 -559
  242. package/ultra-tools/commands/system.cjs +0 -498
  243. package/ultra-tools/commands/task.cjs +0 -105
@@ -1,11 +0,0 @@
1
- 'use strict';
2
-
3
- const path = require('node:path');
4
-
5
- // ncc emits this entrypoint into <plugin>/runtime/ultra-tools.cjs. Set the
6
- // runtime asset root before loading modules that read schemas or templates.
7
- process.env.UBP_RUNTIME_ROOT = path.resolve(__dirname, '..');
8
-
9
- const { main } = require('../../ultra-tools/cli.cjs');
10
-
11
- main(process.argv);
@@ -1,129 +0,0 @@
1
- 'use strict';
2
-
3
- const { PUBLIC_CAPABILITY_GRAPH } = require('./runtime-assets.cjs');
4
-
5
- const SURFACES = Object.freeze({
6
- claude: Object.freeze({
7
- primary: 'AskUserQuestion',
8
- fallback: 'direct_user_interaction',
9
- availability: 'interactive_session',
10
- }),
11
- codex: Object.freeze({
12
- primary: 'request_user_input',
13
- fallback: 'direct_user_interaction',
14
- availability: 'current_mode_exposes_tool',
15
- }),
16
- opencode: Object.freeze({
17
- primary: 'question',
18
- fallback: 'direct_user_interaction',
19
- availability: 'question_permission_not_denied',
20
- }),
21
- kimi: Object.freeze({
22
- primary: 'AskUserQuestion',
23
- fallback: 'direct_user_interaction',
24
- availability: 'interactive_non_auto_mode',
25
- }),
26
- grok: Object.freeze({
27
- primary: 'AskUserQuestion',
28
- fallback: 'direct_user_interaction',
29
- availability: 'interactive_session',
30
- }),
31
- });
32
-
33
- const GENERIC_QUESTION_GUIDANCE =
34
- /Use the host-native (?:structured )?question surface declared by the installed interaction\s+contract(?: when it exists)?(?:;?\s+prefer its structured form when the host exposes one)?\./g;
35
-
36
- function interactionContract(runtime) {
37
- const question = SURFACES[runtime];
38
- if (!question) throw new Error(`unsupported interaction runtime: ${runtime}`);
39
- return {
40
- schema_version: '1.3',
41
- runtime,
42
- public_capability_graph: PUBLIC_CAPABILITY_GRAPH,
43
- authority: {
44
- user: [
45
- 'product_intent',
46
- 'material_scope_and_tradeoffs',
47
- 'semantic_route_selection',
48
- 'risk_acceptance',
49
- 'destructive_or_external_effect_authorization',
50
- ],
51
- host_model: [
52
- 'fact_finding_and_synthesis',
53
- 'reversible_implementation_judgment',
54
- 'semantic_route_recommendation',
55
- 'accepted_intent_normalization',
56
- ],
57
- ultra_mcp: [
58
- 'durable_checkpoints_and_evidence_refs',
59
- 'digests_freshness_leases_archives_and_recovery',
60
- 'mutable_semantic_diagnostics',
61
- ],
62
- },
63
- interaction: {
64
- question_surface: question,
65
- semantic_selection_flow: [
66
- 'inspect',
67
- 'suggest',
68
- 'host_native_ask',
69
- 'normalize',
70
- 'persist',
71
- 'apply',
72
- 'read_back',
73
- ],
74
- adapter_authority: 'none',
75
- dependent_decisions: 'one_at_a_time',
76
- independent_low_load_questions: { maximum: 3 },
77
- explicit_current_intent: 'normalize_without_reconfirmation',
78
- dismissed_question: 'remain_unanswered',
79
- unavailable_native_surface: 'use_direct_interaction_if_permitted',
80
- host_forbids_interaction: 'remain_unanswered',
81
- },
82
- persistence: {
83
- accepted_intent: 'trust_as_current_authority',
84
- accepted_intent_recall: 'breadcrumb_and_decision_list',
85
- user_interaction_proof: 'not_required',
86
- raw_prompt_or_transcript: 'never_store',
87
- pending_question: 'store_only_when_recovery_requires_it',
88
- application_evidence: 'record_applied_refs_when_another_authority_changes',
89
- },
90
- routing: {
91
- semantic_recommendation_owner: 'host_model',
92
- durable_recommendation_authority: false,
93
- current_context_tool: 'ultra.context',
94
- checkpoint_diagnostic_fields: ['warnings', 'blockers'],
95
- hard_blocker_boundary: [
96
- 'corruption',
97
- 'unsafe_path',
98
- 'concurrency_conflict',
99
- 'permission',
100
- 'irreversible_external_effect',
101
- ],
102
- },
103
- };
104
- }
105
-
106
- function interactionPrompt(runtime) {
107
- const contract = interactionContract(runtime);
108
- const surface = contract.interaction.question_surface;
109
- const host = {
110
- claude: 'Claude Code',
111
- codex: 'Codex',
112
- opencode: 'OpenCode',
113
- kimi: 'Kimi Code',
114
- grok: 'Grok Build',
115
- }[runtime];
116
- const primary = runtime === 'opencode' ? `\`${surface.primary}\`` : surface.primary;
117
- return `Use ${host} ${primary} when ${surface.availability.replaceAll('_', ' ')} permits it.`;
118
- }
119
-
120
- function adaptInteractionGuidance(input, runtime) {
121
- return String(input).replace(GENERIC_QUESTION_GUIDANCE, interactionPrompt(runtime));
122
- }
123
-
124
- module.exports = {
125
- SURFACES,
126
- adaptInteractionGuidance,
127
- interactionContract,
128
- interactionPrompt,
129
- };
@@ -1,79 +0,0 @@
1
- 'use strict';
2
-
3
- // Path-rewriting helpers for workflow-ref resolution per runtime.
4
- // The canonical form in commands/*.md is `@skills/<name>/SKILL.md`. Each
5
- // runtime stores skills under a different root — this module converts
6
- // the symbolic ref into a concrete path (or leaves it symbolic for
7
- // runtimes that understand the shorthand).
8
-
9
- const path = require('node:path');
10
-
11
- const SKILL_REF_RE = /^@skills\/([a-z][a-z0-9\-]*)\/SKILL\.md$/;
12
-
13
- const RUNTIME_SKILL_ROOT = {
14
- claude: '.claude/skills',
15
- opencode: '.config/opencode/skills',
16
- codex: '.agents/skills',
17
- kimi: '.kimi-code/skills',
18
- };
19
-
20
- function parseSkillRef(ref) {
21
- if (typeof ref !== 'string') return null;
22
- const m = ref.match(SKILL_REF_RE);
23
- if (!m) return null;
24
- return { name: m[1], filename: 'SKILL.md' };
25
- }
26
-
27
- function resolveSkillRef(ref, { runtime, homeDir }) {
28
- const parsed = parseSkillRef(ref);
29
- if (!parsed) throw new Error(`invalid skill ref: ${ref}`);
30
- const root = RUNTIME_SKILL_ROOT[runtime];
31
- if (!root) throw new Error(`unknown runtime: ${runtime}`);
32
- return path.join(homeDir, root, parsed.name, parsed.filename);
33
- }
34
-
35
- function rewriteWorkflowRefInText(text, { runtime, homeDir }) {
36
- return text.replace(/@skills\/([a-z][a-z0-9\-]*)\/SKILL\.md/g, (match) => {
37
- const parsed = parseSkillRef(match);
38
- if (!parsed) return match;
39
- return resolveSkillRef(match, { runtime, homeDir });
40
- });
41
- }
42
-
43
- function resolveAssetTarget(srcRel, { runtime, scope, homeDir, cwd }) {
44
- const base = scope === 'global'
45
- ? path.join(homeDir, runtimeRoot(runtime))
46
- : path.join(cwd, localRoot(runtime));
47
- return path.join(base, srcRel);
48
- }
49
-
50
- function runtimeRoot(runtime) {
51
- switch (runtime) {
52
- case 'claude': return '.claude';
53
- case 'opencode': return '.config/opencode';
54
- case 'codex': return '.agents';
55
- case 'kimi': return '.kimi-code';
56
- default: throw new Error(`unknown runtime: ${runtime}`);
57
- }
58
- }
59
-
60
- function localRoot(runtime) {
61
- switch (runtime) {
62
- case 'claude': return '.claude';
63
- case 'opencode': return '.opencode';
64
- case 'codex': return '.agents';
65
- case 'kimi': return '.kimi-code';
66
- default: throw new Error(`unknown runtime: ${runtime}`);
67
- }
68
- }
69
-
70
- module.exports = {
71
- SKILL_REF_RE,
72
- RUNTIME_SKILL_ROOT,
73
- parseSkillRef,
74
- resolveSkillRef,
75
- rewriteWorkflowRefInText,
76
- resolveAssetTarget,
77
- runtimeRoot,
78
- localRoot,
79
- };
@@ -1,132 +0,0 @@
1
- 'use strict';
2
-
3
- const crypto = require('node:crypto');
4
- const fs = require('node:fs');
5
- const path = require('node:path');
6
-
7
- const MANIFEST_FILE = 'native-runtime.json';
8
-
9
- class RuntimeNativeError extends Error {
10
- constructor(code, message, details = {}) {
11
- super(message);
12
- this.name = 'RuntimeNativeError';
13
- this.code = code;
14
- this.details = details;
15
- }
16
- }
17
-
18
- function sha256(file) {
19
- return crypto.createHash('sha256').update(fs.readFileSync(file)).digest('hex');
20
- }
21
-
22
- function readManifest(runtimeRoot) {
23
- const file = path.join(path.resolve(runtimeRoot), MANIFEST_FILE);
24
- if (!fs.existsSync(file)) {
25
- throw new RuntimeNativeError(
26
- 'RUNTIME_NATIVE_MISSING',
27
- `Ultra native runtime manifest is missing: ${file}`,
28
- { path: file },
29
- );
30
- }
31
- let manifest;
32
- try {
33
- manifest = JSON.parse(fs.readFileSync(file, 'utf8'));
34
- } catch (cause) {
35
- throw new RuntimeNativeError(
36
- 'RUNTIME_NATIVE_MISSING',
37
- `Ultra native runtime manifest is invalid: ${file}`,
38
- { path: file, cause: cause.message },
39
- );
40
- }
41
- if (manifest?.schema_version !== 1
42
- || typeof manifest.native_module !== 'string'
43
- || !/^[0-9a-f]{64}$/i.test(manifest.native_sha256 || '')) {
44
- throw new RuntimeNativeError(
45
- 'RUNTIME_NATIVE_MISSING',
46
- `Ultra native runtime manifest is incomplete: ${file}`,
47
- { path: file },
48
- );
49
- }
50
- return { file, manifest };
51
- }
52
-
53
- function inspectRuntimeNative(runtimeRoot, { load = true } = {}) {
54
- const root = path.resolve(runtimeRoot);
55
- const { file, manifest } = readManifest(root);
56
- const expected = {
57
- platform: process.platform,
58
- arch: process.arch,
59
- modules: process.versions.modules,
60
- };
61
- const actual = {
62
- platform: manifest.platform,
63
- arch: manifest.arch,
64
- modules: String(manifest.modules || ''),
65
- };
66
- if (actual.platform !== expected.platform
67
- || actual.arch !== expected.arch
68
- || actual.modules !== expected.modules) {
69
- throw new RuntimeNativeError(
70
- 'RUNTIME_ABI_MISMATCH',
71
- `Ultra native runtime requires ${actual.platform}/${actual.arch} ABI ${
72
- actual.modules
73
- }, but the active Node is ${expected.platform}/${expected.arch} ABI ${expected.modules}`,
74
- { expected: actual, actual: expected, manifest: file },
75
- );
76
- }
77
- const nativeFile = path.resolve(root, manifest.native_module);
78
- if (nativeFile !== root && !nativeFile.startsWith(`${root}${path.sep}`)) {
79
- throw new RuntimeNativeError(
80
- 'RUNTIME_NATIVE_MISSING',
81
- 'Ultra native module path escapes the runtime root',
82
- { path: manifest.native_module },
83
- );
84
- }
85
- if (!fs.existsSync(nativeFile) || !fs.statSync(nativeFile).isFile()) {
86
- throw new RuntimeNativeError(
87
- 'RUNTIME_NATIVE_MISSING',
88
- `Ultra native SQLite driver is missing: ${nativeFile}`,
89
- { path: nativeFile },
90
- );
91
- }
92
- const digest = sha256(nativeFile);
93
- if (digest !== manifest.native_sha256) {
94
- throw new RuntimeNativeError(
95
- 'RUNTIME_NATIVE_MISSING',
96
- `Ultra native SQLite driver digest does not match its manifest: ${nativeFile}`,
97
- { path: nativeFile, expected: manifest.native_sha256, actual: digest },
98
- );
99
- }
100
- if (load) {
101
- let Database;
102
- try {
103
- Database = require(require.resolve('better-sqlite3', {
104
- paths: [path.join(root, 'node_modules')],
105
- }));
106
- const db = new Database(':memory:');
107
- db.prepare('SELECT 1 AS ok').get();
108
- db.close();
109
- } catch (cause) {
110
- throw new RuntimeNativeError(
111
- 'RUNTIME_ABI_MISMATCH',
112
- `Ultra native SQLite driver cannot load in the active Node runtime: ${cause.message}`,
113
- { path: nativeFile, cause: cause.code || cause.message },
114
- );
115
- }
116
- }
117
- return {
118
- status: 'healthy',
119
- manifest: file,
120
- platform: actual.platform,
121
- arch: actual.arch,
122
- modules: actual.modules,
123
- native_module: nativeFile,
124
- native_sha256: digest,
125
- };
126
- }
127
-
128
- module.exports = {
129
- MANIFEST_FILE,
130
- RuntimeNativeError,
131
- inspectRuntimeNative,
132
- };
@@ -1,76 +0,0 @@
1
- 'use strict';
2
-
3
- // Sentinel-block merge/remove for JSON settings files (D7).
4
- // Protects user-authored settings by confining our writes to a single
5
- // well-known key (the sentinel). Install writes/updates the sentinel value;
6
- // uninstall deletes it. Everything else in the JSON is left untouched.
7
-
8
- const SENTINEL_VERSION = 1;
9
-
10
- function readJsonSafe(filepath, { fs = require('node:fs'), rescue = false } = {}) {
11
- if (!fs.existsSync(filepath)) return {};
12
- const raw = fs.readFileSync(filepath, 'utf8').trim();
13
- if (!raw) return {};
14
- try { return JSON.parse(raw); }
15
- catch (err) {
16
- // rescue mode: back up the corrupt file and treat as empty so install
17
- // can proceed instead of exploding mid-setup (P2 #7 from Phase 4 review).
18
- // Callers that need strict semantics leave rescue=false (default).
19
- if (rescue) {
20
- const backup = `${filepath}.bak-${Date.now()}`;
21
- try {
22
- fs.copyFileSync(filepath, backup);
23
- process.stderr.write(`settings-merge: corrupt ${filepath}; backed up to ${backup}, continuing with empty object\n`);
24
- } catch (_backupErr) { /* best-effort */ }
25
- return {};
26
- }
27
- throw new Error(`settings-merge: cannot parse ${filepath}: ${err.message}`);
28
- }
29
- }
30
-
31
- function withSentinelBlock(existing, sentinelKey, block) {
32
- if (!sentinelKey || typeof sentinelKey !== 'string') {
33
- throw new TypeError('withSentinelBlock: sentinelKey must be non-empty string');
34
- }
35
- const next = { ...existing };
36
- next[sentinelKey] = {
37
- __sentinel: SENTINEL_VERSION,
38
- __generated_by: 'ultra-builder-pro-cli',
39
- __generated_at: new Date().toISOString(),
40
- ...block,
41
- };
42
- return next;
43
- }
44
-
45
- function removeSentinelBlock(existing, sentinelKey) {
46
- if (!(sentinelKey in existing)) return existing;
47
- const next = { ...existing };
48
- delete next[sentinelKey];
49
- return next;
50
- }
51
-
52
- function hasSentinelBlock(existing, sentinelKey) {
53
- return Boolean(existing && existing[sentinelKey] && existing[sentinelKey].__sentinel);
54
- }
55
-
56
- function mergeArrayField(existing, key, items) {
57
- const current = Array.isArray(existing[key]) ? existing[key] : [];
58
- const seen = new Set(current.map((x) => JSON.stringify(x)));
59
- const appended = [...current];
60
- for (const item of items) {
61
- const tag = JSON.stringify(item);
62
- if (seen.has(tag)) continue;
63
- appended.push(item);
64
- seen.add(tag);
65
- }
66
- return { ...existing, [key]: appended };
67
- }
68
-
69
- module.exports = {
70
- SENTINEL_VERSION,
71
- readJsonSafe,
72
- withSentinelBlock,
73
- removeSentinelBlock,
74
- hasSentinelBlock,
75
- mergeArrayField,
76
- };
@@ -1,42 +0,0 @@
1
- ---
2
- name: code-reviewer
3
- description: Review an explicit diff or file set for consequential correctness, security, integration, test, and maintainability defects. Use for a bounded read-only review before commit, merge, or release.
4
- tools: Read, Grep, Glob, Bash, Write
5
- model: opus
6
- maxTurns: 30
7
- skills:
8
- - security-rules
9
- - code-review-expert
10
- - integration-rules
11
- ---
12
-
13
- # Code review specialist
14
-
15
- Review the assigned scope against the current checkout and supplied acceptance
16
- evidence. Default to read-only analysis.
17
-
18
- ## Workflow
19
-
20
- 1. Resolve the exact diff, file set, HEAD, intended outcome, and repository guidance.
21
- Report an empty or ambiguous scope instead of expanding it silently.
22
- For an Ultra delegation, first validate the immutable Worker Packet and echo its
23
- exact `packet_digest` in the assigned output.
24
- 2. Trace changed behavior from its entry point to state, side effects, errors, and a
25
- real consumer.
26
- 3. Follow `code-review-expert`. Load its security, integration, design, or removal
27
- references only when the diff contains that risk.
28
- 4. Confirm each candidate finding against the current source and a plausible trigger.
29
- Discard generic advice, speculative future concerns, and style preferences that do
30
- not affect the accepted outcome.
31
- 5. Report findings in severity order with a tight file and line range, trigger, impact,
32
- evidence, and smallest complete remediation.
33
- 6. If no defect is supported, say so and name any remaining verification gap.
34
-
35
- ## Mutation boundary
36
-
37
- Do not edit source. Write only the assigned evidence artifact. If remediation is
38
- authorized, return the smallest verified repair instructions to the primary host,
39
- which owns implementation and final judgment.
40
-
41
- Use the current checkout and parent-supplied packet only. Do not call Ultra MCP write
42
- tools. Return a concise review, not raw tool output.
@@ -1,40 +0,0 @@
1
- ---
2
- name: debugger
3
- description: Find the earliest incorrect state behind an error, test failure, or unexpected behavior and return bounded evidence plus a minimal verified remediation.
4
- tools: Read, Write, Bash, Grep, Glob
5
- model: opus
6
- maxTurns: 40
7
- ---
8
-
9
- # Debugging specialist
10
-
11
- Diagnose before editing. Work from the observed symptom backward to the first state
12
- that violates the intended contract.
13
-
14
- ## Workflow
15
-
16
- 1. Read the complete error and reproduce the smallest observable symptom with the exact
17
- command or action.
18
- For an Ultra delegation, validate the immutable Worker Packet before investigation
19
- and echo its exact `packet_digest` in the assigned output.
20
- 2. Inspect the relevant recent diff, configuration, dependency, and runtime boundaries.
21
- 3. Trace the bad value or state backward through callers and side effects. Compare a
22
- nearby working path only when it exercises the same contract.
23
- 4. Form one falsifiable root-cause hypothesis and choose the smallest observation that
24
- distinguishes it from alternatives.
25
- 5. Test the hypothesis without broad refactoring. Record evidence that accepts or
26
- rejects it.
27
- 6. Describe the smallest regression test and root-cause repair that the primary host
28
- should apply. Do not edit source.
29
- 7. Report the symptom, evidence trail, root cause, proposed files, exact diagnostic
30
- verification, and residual uncertainty.
31
-
32
- Write only the assigned evidence artifact. Do not change source, even when remediation
33
- is authorized; the primary host owns implementation and final judgment. Do not use a
34
- passing test from another checkout as evidence.
35
-
36
- If three distinct fix attempts expose different underlying failures, stop patching and
37
- return the evidence as an architectural boundary problem. For an Ultra incident, also
38
- provide the reproduction, tested hypotheses, earliest bad state, regression signal,
39
- and recovery path needed by the durable diagnosis artifact. Do not call Ultra MCP
40
- write tools; the parent model owns registration.
@@ -1,49 +0,0 @@
1
- ---
2
- name: review-code
3
- description: Review one bounded diff for correctness, security, reliability, and live-path integration, then write a structured engineering artifact.
4
- tools: Read, Grep, Glob, Bash, Write
5
- model: opus
6
- maxTurns: 18
7
- skills:
8
- - security-rules
9
- - code-review-expert
10
- - integration-rules
11
- ---
12
-
13
- # Engineering review worker
14
-
15
- Write findings to the assigned JSON file. Do not copy the artifact or investigation
16
- transcript into the parent conversation.
17
-
18
- ## Required input
19
-
20
- - immutable `WORKER_PACKET`, its `PACKET_DIGEST`, `SESSION_PATH`, and `OUTPUT_FILE`;
21
- - `SCHEMA_PATH` resolved by the parent from the active review Skill;
22
- - exact `DIFF_RANGE` and `DIFF_FILES`;
23
- - reviewed full HEAD;
24
- - bounded intent, acceptance, and public-seam context.
25
-
26
- ## Workflow
27
-
28
- 1. Validate the input scope and inspect only the diff plus callers, contracts, tests,
29
- and configuration needed to establish a finding.
30
- Stop with an incomplete acknowledgement when the packet digest, output path, HEAD,
31
- scope, or schema differs from the packet.
32
- 2. Trace changed behavior to a production entry point and consumer.
33
- 3. Apply `code-review-expert`, `security-rules`, and `integration-rules` only where their
34
- risk is present.
35
- 4. Check correctness, trust boundaries, state consistency, error and recovery behavior,
36
- observability, compatibility, and reachability.
37
- 5. Report only evidence-backed defects with plausible triggers and concrete impact.
38
- Deduplicate by root cause and keep line ranges tight.
39
- 6. Write `ultra-review-findings-v2` following `SCHEMA_PATH`, including the exact
40
- `packet_digest`.
41
-
42
- Use `axis: engineering_standards`. After the file is valid, return exactly:
43
-
44
- ```text
45
- Wrote N findings (P0:X P1:X P2:X P3:X) to <filepath>
46
- ```
47
-
48
- Do not modify source, call Ultra MCP write tools, change task state, or edit another
49
- worker's artifact.
@@ -1,38 +0,0 @@
1
- ---
2
- name: review-comments
3
- description: Review changed comments and API documentation for factual drift or misleading maintenance guidance, then write a structured engineering artifact.
4
- tools: Read, Grep, Glob, Bash, Write
5
- model: opus
6
- maxTurns: 12
7
- ---
8
-
9
- # Comment review worker
10
-
11
- Write findings to the assigned JSON file and return only a file acknowledgement.
12
-
13
- ## Workflow
14
-
15
- 1. Validate the immutable `WORKER_PACKET`, exact `PACKET_DIGEST`, `SESSION_PATH`,
16
- `OUTPUT_FILE`, `SCHEMA_PATH`, `DIFF_RANGE`, `DIFF_FILES`, HEAD, and the supplied
17
- public-contract context. Stop incomplete when any value differs from the packet.
18
- 2. Inspect comments, docstrings, examples, annotations, and API documentation changed
19
- by the diff. Read the associated implementation and contract before judging them.
20
- 3. Report factual contradictions, stale names or behavior, unsafe operational advice,
21
- and missing documentation only when the omission makes a public or non-obvious
22
- contract materially misleading.
23
- 4. Treat TODO, FIXME, HACK, temporary notes, and implementation narration as evidence
24
- to investigate, not automatic defects. Calibrate severity to the reachable impact.
25
- 5. Ignore wording preferences and harmless redundancy. Keep line ranges tight and
26
- propose the smallest correction that restores an accurate contract.
27
- 6. Write `ultra-review-findings-v2` following `SCHEMA_PATH`, including the exact
28
- `packet_digest`.
29
-
30
- Use `axis: engineering_standards` and category `comments`. After valid output, return
31
- exactly:
32
-
33
- ```text
34
- Wrote N findings (P0:X P1:X P2:X P3:X) to <filepath>
35
- ```
36
-
37
- Do not modify source, call Ultra MCP write tools, change task state, or edit another
38
- worker's artifact.
@@ -1,56 +0,0 @@
1
- ---
2
- name: review-coordinator
3
- description: Validate and coordinate current Ultra review artifacts without changing source findings, then write the two-axis summary.
4
- tools: Read, Grep, Glob, Bash, Write
5
- model: opus
6
- maxTurns: 15
7
- ---
8
-
9
- # Review artifact coordinator
10
-
11
- Coordinate artifacts only. Do not inspect the source to invent new findings and do not
12
- rewrite a specialist's severity.
13
-
14
- ## Required input
15
-
16
- - immutable coordinator `WORKER_PACKET`, exact `PACKET_DIGEST`, `SESSION_PATH`, review
17
- mode, reviewed HEAD, diff range, and expected worker list with selection or skip
18
- rationale;
19
- - `SCHEMA_PATH` resolved by the parent from the active review Skill;
20
- - one complete `spec_fidelity` artifact;
21
- - every selected `engineering_standards` artifact.
22
-
23
- ## Workflow
24
-
25
- 1. Validate the packet digest, scope, HEAD, output paths, and schema, then read the
26
- artifact contract at `SCHEMA_PATH`. Stop incomplete when any value differs.
27
- 2. Parse every expected artifact. Reject stale HEAD or range, malformed JSON, wrong
28
- axis, duplicate finding ids, and missing required fields. Record missing or invalid
29
- workers as limitations instead of silently continuing as complete.
30
- 3. Preserve every specialist finding unchanged in `SUMMARY.json`. Group duplicate
31
- root causes only in the human-readable `SUMMARY.md`; never drop, merge, rewrite, or
32
- renumber their machine-readable source records.
33
- 4. Order findings by severity, path, and line. Do not use confidence scores, reviewer
34
- counts, or finding-count thresholds to change severity or verdict.
35
- 5. Set each axis to `PASS` only when its required current artifacts are complete and no
36
- P0 or P1 finding remains. Set it to `FAIL` when a P0 or P1 remains. Missing, stale,
37
- or invalid required evidence makes the axis `INCOMPLETE`.
38
- 6. Set the overall verdict to `INCOMPLETE` when either axis is incomplete,
39
- `REQUEST_CHANGES` when either complete axis fails, and `APPROVE` only when both
40
- axes pass.
41
- 7. Record the review mode and every selected or skipped worker with its supplied
42
- scope-specific rationale. The selection must match completed, failed, and skipped
43
- worker state exactly.
44
- 8. Write `SUMMARY.json` as `ultra-review-summary-v2`, including the exact
45
- `packet_digest`, and a concise `SUMMARY.md` with the two axis verdicts, blocking
46
- findings, limitations, positive observations, and artifact paths. Validate both
47
- files before acknowledging completion.
48
-
49
- Return exactly:
50
-
51
- ```text
52
- Coordination complete: <VERDICT> — P0:X P1:X P2:X P3:X — <SUMMARY.json path>
53
- ```
54
-
55
- Do not modify source, call Ultra MCP write tools, change task state or projections, or
56
- edit specialist artifacts.