peaks-loop 4.0.0-beta → 4.0.0-beta.3

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 (179) hide show
  1. package/CHANGELOG.md +105 -87
  2. package/README-en.md +17 -4
  3. package/README.md +17 -4
  4. package/dist/src/cli/commands/asset-commands.d.ts +45 -0
  5. package/dist/src/cli/commands/asset-commands.js +404 -0
  6. package/dist/src/cli/commands/bee-commands.d.ts +26 -0
  7. package/dist/src/cli/commands/bee-commands.js +169 -0
  8. package/dist/src/cli/commands/{solo-commands.d.ts → code-commands.d.ts} +24 -24
  9. package/dist/src/cli/commands/{solo-commands.js → code-commands.js} +78 -78
  10. package/dist/src/cli/commands/core/skill-command.js +1 -1
  11. package/dist/src/cli/commands/dispatch-from-dag.js +1 -1
  12. package/dist/src/cli/commands/evolution-commands.d.ts +27 -0
  13. package/dist/src/cli/commands/evolution-commands.js +393 -0
  14. package/dist/src/cli/commands/hook-handle.js +7 -7
  15. package/dist/src/cli/commands/job-commands.js +2 -2
  16. package/dist/src/cli/commands/loop-commands.d.ts +19 -13
  17. package/dist/src/cli/commands/loop-commands.js +147 -13
  18. package/dist/src/cli/commands/sediment-commands.js +9 -0
  19. package/dist/src/cli/commands/session-auto-compact-hook-command.js +2 -2
  20. package/dist/src/cli/commands/skill-loop-engineering-readiness-commands.d.ts +67 -0
  21. package/dist/src/cli/commands/skill-loop-engineering-readiness-commands.js +173 -0
  22. package/dist/src/cli/commands/sub-agent-shared.d.ts +1 -1
  23. package/dist/src/cli/commands/user-touchpoint-commands.d.ts +4 -4
  24. package/dist/src/cli/commands/user-touchpoint-commands.js +14 -14
  25. package/dist/src/cli/commands/workflow-commands.js +22 -22
  26. package/dist/src/cli/program.js +23 -6
  27. package/dist/src/services/artifacts/repair-cycle-service.js +1 -1
  28. package/dist/src/services/audit/enforcers/active-skill-resolver.d.ts +1 -1
  29. package/dist/src/services/audit/enforcers/active-skill-resolver.js +1 -1
  30. package/dist/src/services/audit/enforcers/{solo-code-ban.d.ts → code-ban.d.ts} +6 -6
  31. package/dist/src/services/audit/enforcers/{solo-code-ban.js → code-ban.js} +6 -6
  32. package/dist/src/services/audit/red-line-catalog.d.ts +2 -2
  33. package/dist/src/services/audit/red-line-catalog.js +5 -5
  34. package/dist/src/services/audit/types.d.ts +2 -2
  35. package/dist/src/services/{solo → code}/auto-compact-orchestrator.d.ts +1 -1
  36. package/dist/src/services/{solo → code}/auto-compact-orchestrator.js +3 -3
  37. package/dist/src/services/{solo → code}/dag-orchestrator.d.ts +1 -1
  38. package/dist/src/services/{solo → code}/dag-orchestrator.js +1 -1
  39. package/dist/src/services/{solo → code}/emit-handoff.d.ts +1 -1
  40. package/dist/src/services/{solo → code}/emit-handoff.js +1 -1
  41. package/dist/src/services/{solo → code}/job-shape-decision.d.ts +1 -1
  42. package/dist/src/services/{solo → code}/job-shape-decision.js +5 -5
  43. package/dist/src/services/{solo → code}/mode-gate.d.ts +9 -9
  44. package/dist/src/services/{solo → code}/mode-gate.js +5 -5
  45. package/dist/src/services/{solo → code}/post-compact-detector.d.ts +3 -3
  46. package/dist/src/services/{solo → code}/post-compact-detector.js +4 -4
  47. package/dist/src/services/{solo → code}/step-08-gate.d.ts +4 -4
  48. package/dist/src/services/{solo → code}/step-08-gate.js +4 -4
  49. package/dist/src/services/{solo → code}/user-touchpoint-classifier.d.ts +1 -1
  50. package/dist/src/services/{solo → code}/user-touchpoint-classifier.js +1 -1
  51. package/dist/src/services/context/auto-compact-dispatcher.d.ts +2 -2
  52. package/dist/src/services/context/auto-compact-dispatcher.js +2 -2
  53. package/dist/src/services/context/auto-compact-types.d.ts +1 -1
  54. package/dist/src/services/crystallization/crystallization-service.d.ts +239 -0
  55. package/dist/src/services/crystallization/crystallization-service.js +397 -0
  56. package/dist/src/services/crystallization/crystallization-store.d.ts +75 -0
  57. package/dist/src/services/crystallization/crystallization-store.js +193 -0
  58. package/dist/src/services/crystallization/crystallization-types.d.ts +313 -0
  59. package/dist/src/services/crystallization/crystallization-types.js +299 -0
  60. package/dist/src/services/crystallization/evidence-brief-builder.d.ts +237 -0
  61. package/dist/src/services/crystallization/evidence-brief-builder.js +240 -0
  62. package/dist/src/services/dispatch/slice-dag.d.ts +2 -2
  63. package/dist/src/services/dispatch/test-tool-detection.d.ts +1 -1
  64. package/dist/src/services/dispatch/test-tool-detection.js +1 -1
  65. package/dist/src/services/evolution/evolution-service.d.ts +137 -0
  66. package/dist/src/services/evolution/evolution-service.js +281 -0
  67. package/dist/src/services/evolution/evolution-store.d.ts +57 -0
  68. package/dist/src/services/evolution/evolution-store.js +232 -0
  69. package/dist/src/services/evolution/evolution-types.d.ts +706 -0
  70. package/dist/src/services/evolution/evolution-types.js +286 -0
  71. package/dist/src/services/evolution/independent-evaluator-runner.d.ts +90 -0
  72. package/dist/src/services/evolution/independent-evaluator-runner.js +106 -0
  73. package/dist/src/services/evolution/regression-skeptic-runner.d.ts +64 -0
  74. package/dist/src/services/evolution/regression-skeptic-runner.js +113 -0
  75. package/dist/src/services/feedback/feedback-promotion-service.js +2 -2
  76. package/dist/src/services/job/job-progress-store.d.ts +1 -1
  77. package/dist/src/services/job/job-progress-store.js +1 -1
  78. package/dist/src/services/loop/loop-bee-relation-service.d.ts +107 -0
  79. package/dist/src/services/loop/loop-bee-relation-service.js +211 -0
  80. package/dist/src/services/loop/loop-bee-relation-store.d.ts +53 -0
  81. package/dist/src/services/loop/loop-bee-relation-store.js +130 -0
  82. package/dist/src/services/loop/loop-bee-relation-types.d.ts +118 -0
  83. package/dist/src/services/loop/loop-bee-relation-types.js +114 -0
  84. package/dist/src/services/loop/loop-release-service.d.ts +46 -0
  85. package/dist/src/services/loop/loop-release-service.js +66 -0
  86. package/dist/src/services/loop/loop-release-store.d.ts +55 -0
  87. package/dist/src/services/loop/loop-release-store.js +134 -0
  88. package/dist/src/services/loop/loop-release-types.d.ts +250 -0
  89. package/dist/src/services/loop/loop-release-types.js +162 -0
  90. package/dist/src/services/preferences/preferences-service.d.ts +1 -1
  91. package/dist/src/services/preferences/preferences-types.d.ts +1 -1
  92. package/dist/src/services/rd/standards-diagnostic.d.ts +1 -1
  93. package/dist/src/services/rd/standards-diagnostic.js +2 -2
  94. package/dist/src/services/recommendations/capability-seed-items.js +1 -1
  95. package/dist/src/services/recommendations/capability-seed-mappings.js +1 -1
  96. package/dist/src/services/recommendations/recommendation-service.js +1 -1
  97. package/dist/src/services/refactor/refactor-service.d.ts +1 -1
  98. package/dist/src/services/share/bundle-reader.d.ts +100 -0
  99. package/dist/src/services/share/bundle-reader.js +434 -0
  100. package/dist/src/services/share/bundle-types.d.ts +392 -0
  101. package/dist/src/services/share/bundle-types.js +318 -0
  102. package/dist/src/services/share/bundle-writer.d.ts +97 -0
  103. package/dist/src/services/share/bundle-writer.js +429 -0
  104. package/dist/src/services/share/run-state-contract.d.ts +133 -0
  105. package/dist/src/services/share/run-state-contract.js +138 -0
  106. package/dist/src/services/signal/cancel-handler.js +3 -3
  107. package/dist/src/services/skill/resume-detector.js +1 -1
  108. package/dist/src/services/skillhub/release-import.js +7 -2
  109. package/dist/src/services/skillhub/release-retain.js +6 -1
  110. package/dist/src/services/skillhub/sqlite-store.js +17 -1
  111. package/dist/src/services/skillhub/types.d.ts +10 -0
  112. package/dist/src/services/skills/skill-presence-service.d.ts +1 -1
  113. package/dist/src/services/standards/loop-engineering-lint.d.ts +38 -0
  114. package/dist/src/services/standards/loop-engineering-lint.js +101 -0
  115. package/dist/src/services/standards/loop-engineering-readiness-lint.d.ts +111 -0
  116. package/dist/src/services/standards/loop-engineering-readiness-lint.js +248 -0
  117. package/dist/src/services/upgrade/1x-detector-service.js +1 -1
  118. package/dist/src/services/workflow/pipeline-verify-service.d.ts +1 -1
  119. package/dist/src/services/workflow/pipeline-verify-service.js +3 -3
  120. package/dist/src/services/workflow/workflow-autonomous-service.d.ts +3 -3
  121. package/dist/src/services/workflow/workflow-autonomous-service.js +2 -2
  122. package/dist/src/services/workflow/workflow-router-service.d.ts +6 -6
  123. package/dist/src/services/workflow/workflow-router-service.js +33 -33
  124. package/dist/src/services/workspace/claude-settings-template.d.ts +1 -1
  125. package/dist/src/services/workspace/claude-settings-template.js +5 -5
  126. package/dist/src/shared/version.d.ts +1 -1
  127. package/dist/src/shared/version.js +1 -1
  128. package/examples/video-demo/README.md +57 -0
  129. package/examples/video-demo/out/en-closing-960.png +0 -0
  130. package/examples/video-demo/out/zh-closing-960.png +0 -0
  131. package/examples/video-demo/preview/peaks-loop-demo-en.mp4 +0 -0
  132. package/examples/video-demo/preview/peaks-loop-demo.mp4 +0 -0
  133. package/output-styles/peaks-skill-swarm.md +3 -3
  134. package/package.json +6 -2
  135. package/skills/bee/peaks-qa/SKILL.md +1 -1
  136. package/skills/bee/peaks-qa/references/artifact-per-request.md +3 -3
  137. package/skills/bee/peaks-qa/references/qa-sub-agent-dispatch.md +6 -6
  138. package/skills/bee/peaks-rd/references/rd-fanout-contracts.md +1 -1
  139. package/skills/bee/peaks-rd/references/rd-runbook.md +1 -1
  140. package/skills/bee/peaks-rd/references/rd-sub-agent-dispatch.md +11 -11
  141. package/skills/bee/peaks-rd/references/rd-transition-gates.md +1 -1
  142. package/skills/bee/peaks-sc/SKILL.md +1 -1
  143. package/skills/bee/peaks-txt/SKILL.md +3 -3
  144. package/skills/bee/peaks-ui/SKILL.md +8 -8
  145. package/skills/peaks-code/SKILL.md +34 -21
  146. package/skills/peaks-code/references/anchoring-and-session-info.md +2 -2
  147. package/skills/peaks-code/references/artifact-contracts.md +1 -1
  148. package/skills/peaks-code/references/boundaries.md +3 -3
  149. package/skills/peaks-code/references/codegraph-orchestration.md +1 -1
  150. package/skills/peaks-code/references/dag-orchestrator.md +7 -7
  151. package/skills/peaks-code/references/external-references.md +2 -2
  152. package/skills/peaks-code/references/fanout-mandatory.md +3 -3
  153. package/skills/peaks-code/references/fast-mode.md +2 -2
  154. package/skills/peaks-code/references/frontend-only-mode.md +9 -9
  155. package/skills/peaks-code/references/job-loop.md +1 -1
  156. package/skills/peaks-code/references/local-artifact-workspace.md +2 -2
  157. package/skills/peaks-code/references/micro-cycle.md +14 -14
  158. package/skills/peaks-code/references/mode-selection-with-stale-presence.md +5 -5
  159. package/skills/peaks-code/references/mode-selection.md +3 -3
  160. package/skills/peaks-code/references/openspec-workflow.md +16 -16
  161. package/skills/peaks-code/references/periodic-checkpoint.md +4 -4
  162. package/skills/peaks-code/references/quality-gate-cheatsheet.md +1 -1
  163. package/skills/peaks-code/references/refactor-mode.md +1 -1
  164. package/skills/peaks-code/references/runbook.md +15 -15
  165. package/skills/peaks-code/references/step-0-55-1x-detection.md +1 -1
  166. package/skills/peaks-code/references/step-0-8-gate.md +11 -11
  167. package/skills/peaks-code/references/sub-agent-dispatch.md +8 -8
  168. package/skills/peaks-code/references/swarm-dispatch-contract.md +17 -17
  169. package/skills/peaks-code/references/workflow-gates-and-types.md +2 -2
  170. package/skills/peaks-code/references/workflow.md +5 -5
  171. package/skills/peaks-content/SKILL.md +272 -0
  172. package/skills/peaks-issue-fix-orchestrator/SKILL.md +307 -0
  173. package/skills/peaks-resume/SKILL.md +2 -2
  174. package/skills/peaks-status/SKILL.md +2 -2
  175. package/skills/peaks-test/SKILL.md +2 -2
  176. /package/dist/src/services/{solo → code}/batch-heartbeat-poller.d.ts +0 -0
  177. /package/dist/src/services/{solo → code}/batch-heartbeat-poller.js +0 -0
  178. /package/dist/src/services/{solo → code}/status-line-renderer.d.ts +0 -0
  179. /package/dist/src/services/{solo → code}/status-line-renderer.js +0 -0
@@ -0,0 +1,162 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * LoopRelease — spec §4.1 (Loop Engineering Asset).
4
+ *
5
+ * M1 scope was the §4.1 fields. M3 (this slice) ADDS the share /
6
+ * desktop extension fields from §4.1 / §7A:
7
+ * - shareable (boolean, default true)
8
+ * - share_excluded_paths (string[], default [])
9
+ * - desktop_visible (boolean, default true)
10
+ * - export_bundle_format ('peaks.bundle/1', CLI-written constant)
11
+ *
12
+ * The four M3 fields are added with `.default(...)` so an in-memory
13
+ * object built from a pre-M3 snapshot still parses after the
14
+ * migration runs. NO enforcement on `shareable=false` is added in M3
15
+ * — the schema-only addition is the contract; full export /
16
+ * desktop enforcement lands in M7 (see plan
17
+ * m3-bee-release-extension.md and spec §7A).
18
+ *
19
+ * Field semantics — see the spec for full prose. Highlights:
20
+ *
21
+ * - `id` is the stable kebab-case loop id; the storage key.
22
+ * - `schema_version` is the constant literal `"peaks.loop/1"`; a
23
+ * schema-version bump requires a new table / new enum case and a
24
+ * migration — never edit this literal in place.
25
+ * - `lifecycle_status` is `candidate` / `stable` / `retired`; the
26
+ * default on first crystallization is `candidate`. LLMs cannot
27
+ * auto-promote to `stable` (see spec §5.6).
28
+ * - `linked_bees` is a denormalized pointer list of bee ids; the
29
+ * authoritative loop↔bee relations live in `loop_bee_relation`
30
+ * (M2). Keeping it here matches the spec §4.1 row shape and lets
31
+ * M1 readers iterate the loop without an extra join.
32
+ * - `success_criteria` / `evaluator_policy` are NL strings, not
33
+ * machine-checked predicates; the evaluator definitions live in
34
+ * the M4 evolution layer.
35
+ * - `share_excluded_paths` is a JSON-encoded TEXT column at the
36
+ * SQLite layer; the Zod schema accepts a string[] and the store
37
+ * does the JSON.stringify/parse boundary work. Matches the
38
+ * existing `loop_release` style (success_criteria_json, …).
39
+ * - `export_bundle_format` is pinned to the literal
40
+ * `"peaks.bundle/1"` per the spec §7A.2 contract — no other
41
+ * value is accepted in this schema version.
42
+ */
43
+ export const LoopReleaseLifecycleStatusSchema = z.enum([
44
+ "candidate",
45
+ "stable",
46
+ "retired",
47
+ ]);
48
+ /**
49
+ * The M3 share / desktop extension fields, listed for code-search /
50
+ * lint discoverability. They are now part of the schema (with safe
51
+ * defaults) — see `LoopReleaseM3ExtensionSchema` below.
52
+ *
53
+ * - shareable: defaults to true.
54
+ * - share_excluded_paths: string[] (defaults to []).
55
+ * - desktop_visible: defaults to true.
56
+ * - export_bundle_format: constant "peaks.bundle/1" (CLI-written).
57
+ */
58
+ export const LOOP_RELEASE_M3_FIELDS = [
59
+ "shareable",
60
+ "share_excluded_paths",
61
+ "desktop_visible",
62
+ "export_bundle_format",
63
+ ];
64
+ /**
65
+ * M3 share / desktop extension schema. Added to `LoopReleaseInputSchema`
66
+ * via `.extend(...)` so existing callers that omit these fields still
67
+ * parse — the Zod defaults below supply the spec values
68
+ * (true / [] / true / "peaks.bundle/1").
69
+ *
70
+ * `export_bundle_format` is pinned to a literal per spec §7A.2: the
71
+ * CLI is the only writer and only `"peaks.bundle/1"` is accepted. A
72
+ * schema-version bump is required to introduce another value.
73
+ */
74
+ export const LoopReleaseM3ExtensionSchema = z.object({
75
+ shareable: z.boolean().default(true),
76
+ share_excluded_paths: z
77
+ .array(z.string().min(1).max(4096))
78
+ .default([]),
79
+ desktop_visible: z.boolean().default(true),
80
+ export_bundle_format: z
81
+ .literal("peaks.bundle/1")
82
+ .default("peaks.bundle/1"),
83
+ });
84
+ /**
85
+ * Zod schema for the create payload (LoopReleaseInput). Mirrors the
86
+ * §4.1 row shape; `schema_version` is defaulted (clients cannot
87
+ * override it) and `created_at` is not part of the input — the store
88
+ * stamps it from the server clock.
89
+ */
90
+ export const LoopReleaseInputSchema = z
91
+ .object({
92
+ id: z
93
+ .string()
94
+ .min(1)
95
+ .max(64)
96
+ .regex(/^[a-z][a-z0-9]*(-[a-z0-9]+)*$/, {
97
+ message: "id must be kebab-case starting with a lowercase letter (e.g. loop-onboarding-research)",
98
+ }),
99
+ name: z.string().min(1).max(200),
100
+ scenario: z.string().trim().min(1).max(4000),
101
+ trigger_policy: z.string().trim().min(1).max(2000),
102
+ success_criteria: z
103
+ .array(z.string().trim().min(1).max(1000))
104
+ .min(1, "success_criteria must list at least one declarative criterion"),
105
+ interaction_policy: z
106
+ .string()
107
+ .trim()
108
+ .min(1, "interaction_policy must declare human-NL-choice-only semantics")
109
+ .max(2000),
110
+ feedback_policy: z.string().trim().min(1).max(2000),
111
+ evolution_policy: z.string().trim().min(1).max(2000),
112
+ evaluator_policy: z.array(z.string().trim().min(1).max(1000)).min(1),
113
+ linked_bees: z.array(z.string().min(1).max(64)).default([]),
114
+ run_history: z.array(z.string().min(1).max(128)).default([]),
115
+ crystallization_evidence: z.array(z.string().min(1).max(128)).default([]),
116
+ lifecycle_status: LoopReleaseLifecycleStatusSchema,
117
+ version: z
118
+ .string()
119
+ .regex(/^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$/, {
120
+ message: "version must be a semver string (e.g. 0.1.0)",
121
+ }),
122
+ })
123
+ .extend(LoopReleaseM3ExtensionSchema.shape);
124
+ /**
125
+ * Full Zod schema for a LoopRelease row as persisted. Differs from the
126
+ * input schema only in that `schema_version` is exposed (and defaulted
127
+ * to the fixed literal). The literal constraint still rejects any
128
+ * client-supplied value other than `"peaks.loop/1"`; the default
129
+ * means omitting the key is fine and the output always carries the
130
+ * constant.
131
+ *
132
+ * We expose this as the canonical "row schema" used by lint and
133
+ * service.create/read paths.
134
+ */
135
+ export const LoopReleaseSchema = LoopReleaseInputSchema.extend({
136
+ schema_version: z
137
+ .literal("peaks.loop/1")
138
+ .default("peaks.loop/1"),
139
+ });
140
+ /**
141
+ * Convenience: strict-parse an unknown payload into a LoopRelease row.
142
+ * Throws ZodError on failure. This is the public validation boundary.
143
+ */
144
+ export function parseLoopRelease(input) {
145
+ return LoopReleaseSchema.parse(input);
146
+ }
147
+ /**
148
+ * Convenience: safe-parse that returns a Result-like shape so callers
149
+ * (CLI layer in M5) can render findings without try/catch noise.
150
+ */
151
+ export function safeParseLoopRelease(input) {
152
+ const r = LoopReleaseSchema.safeParse(input);
153
+ if (r.success)
154
+ return { ok: true, row: r.data };
155
+ return {
156
+ ok: false,
157
+ findings: r.error.issues.map((i) => ({
158
+ path: i.path.join("."),
159
+ message: i.message,
160
+ })),
161
+ };
162
+ }
@@ -22,7 +22,7 @@ export declare function writeAtomic(filePath: string, prefs: ProjectPreferences)
22
22
  * verbatim. v1's `agentShieldPrompt` and `loopAutonomousEnabled` were
23
23
  * already present, so they carry through unchanged. The `fanout` field
24
24
  * is new in v2 — it defaults to `{ defaultMode: 'fan-out' }` so the
25
- * pre-v2 behavior (peak-solo SKILL instructed fan-out when ≥ 2 leaves)
25
+ * pre-v2 behavior (peak-code SKILL instructed fan-out when ≥ 2 leaves)
26
26
  * is preserved.
27
27
  */
28
28
  export type MigrateResult = {
@@ -68,7 +68,7 @@ export interface ProjectPreferences {
68
68
  */
69
69
  readonly schema_version: typeof PREFERENCES_SCHEMA_VERSION;
70
70
  /**
71
- * Slice 2026-06-28-solo-mode-bypass-fix: economyMode is a
71
+ * Slice 2026-06-28-code-mode-bypass-fix: economyMode is a
72
72
  * **MODEL-SELECTION** knob only — it chooses between the cheap
73
73
  * configured provider (`getConfiguredExecutionModelId`) and the
74
74
  * strongest planner/reviewer model (`STRONGEST_MODEL_ID`). It does
@@ -60,7 +60,7 @@ export declare function buildRdStandardsGateList(input: {
60
60
  readonly missing: boolean;
61
61
  }): ReadonlyArray<RdStandardGate>;
62
62
  /**
63
- * Single entry point for the RD / QA / Solo bootstrap. Returns the
63
+ * Single entry point for the RD / QA / Code bootstrap. Returns the
64
64
  * exit code + error code + diagnostic + gate list. The CLI wrapper is
65
65
  * responsible for `process.stderr.write(diagnostic ?? '')` and
66
66
  * `process.exit(result.exitCode)`.
@@ -20,7 +20,7 @@
20
20
  * G4 The remediation string is the exact copy-pasteable CLI invocation.
21
21
  *
22
22
  * This module is a pure-function helper. The `peaks rd` / `peaks qa` /
23
- * `peaks solo` runtime hooks call `resolveRdStartupStandardsCheck` at
23
+ * `peaks code` runtime hooks call `resolveRdStartupStandardsCheck` at
24
24
  * bootstrap and decide whether to write `process.stderr` + JSON envelope
25
25
  * + exit. The bootstrap is intentionally side-effect-free here so unit
26
26
  * tests can run it without spawning child processes.
@@ -112,7 +112,7 @@ export function buildRdStandardsGateList(input) {
112
112
  ];
113
113
  }
114
114
  /**
115
- * Single entry point for the RD / QA / Solo bootstrap. Returns the
115
+ * Single entry point for the RD / QA / Code bootstrap. Returns the
116
116
  * exit code + error code + diagnostic + gate list. The CLI wrapper is
117
117
  * responsible for `process.stderr.write(diagnostic ?? '')` and
118
118
  * `process.exit(result.exitCode)`.
@@ -86,7 +86,7 @@ export const seedCapabilityItems = [
86
86
  capability('codegraph.project-indexing', 'codegraph', 'Codegraph Project Indexing', 'cli', 'project-analysis', ['engineer'], 'medium', 'peaks-rd-local-scan', 'Use Peaks RD local project scanning when codegraph is unavailable.', 'Codegraph Project Indexing', 'Codegraph 项目索引', 'Indexes a local project through the peaks codegraph execution boundary for role-skill analysis.', '通过 peaks codegraph 执行边界索引本地项目,辅助角色 skill 分析。'),
87
87
  capability('codegraph.semantic-query', 'codegraph', 'Codegraph Semantic Query', 'cli', 'project-analysis', ['engineer'], 'medium', 'peaks-rd-local-scan', 'Use local Grep/Glob and RD scanning when codegraph semantic query is unavailable.', 'Codegraph Semantic Query', 'Codegraph 语义查询', 'Queries local symbols and project relationships for RD planning evidence.', '查询本地符号和项目关系,为 RD 规划提供证据。'),
88
88
  capability('codegraph.impact-analysis', 'codegraph', 'Codegraph Impact Analysis', 'cli', 'impact-analysis', ['engineer', 'qa'], 'medium', 'peaks-rd-qa-impact-review', 'Use RD changed-file analysis and QA regression planning when codegraph affected output is unavailable.', 'Codegraph Impact Analysis', 'Codegraph 影响面分析', 'Analyzes likely impact for changed files so RD and QA can focus planning and regression scope.', '分析变更文件的可能影响面,帮助 RD 与 QA 聚焦规划和回归范围。'),
89
- capability('codegraph.context-pack', 'codegraph', 'Codegraph Context Pack', 'cli', 'context-pack', ['engineer', 'qa', 'product'], 'medium', 'peaks-txt-context-capsule', 'Use Peaks TXT context capsules and role-skill handoffs when codegraph context output is unavailable.', 'Codegraph Context Pack', 'Codegraph 上下文包', 'Builds task-specific local context that Solo, RD, and TXT can use as supporting evidence.', '生成任务相关的本地上下文,作为 Solo、RD 与 TXT 的辅助证据。'),
89
+ capability('codegraph.context-pack', 'codegraph', 'Codegraph Context Pack', 'cli', 'context-pack', ['engineer', 'qa', 'product'], 'medium', 'peaks-txt-context-capsule', 'Use Peaks TXT context capsules and role-skill handoffs when codegraph context output is unavailable.', 'Codegraph Context Pack', 'Codegraph 上下文包', 'Builds task-specific local context that Code, RD, and TXT can use as supporting evidence.', '生成任务相关的本地上下文,作为 Code、RD 与 TXT 的辅助证据。'),
90
90
  capability('playwright-mcp.browser-validation', 'playwright-mcp', 'Playwright MCP Browser Validation', 'mcp', 'browser-validation', ['engineer', 'qa'], 'medium', 'manual-browser-test', 'Use local Playwright or manual browser verification.', 'Playwright Browser Validation', 'Playwright 浏览器验证', 'Validates UI flows through controlled browser automation.', '通过受控浏览器自动化验证 UI 流程。'),
91
91
  capability('chrome-devtools-mcp.browser-debug', 'chrome-devtools-mcp', 'Chrome DevTools Browser Debug', 'mcp', 'browser-debug', ['engineer', 'qa'], 'medium', 'manual-devtools-inspection', 'Use browser screenshots, console logs, and network traces supplied by the user.', 'Chrome DevTools Debug', 'Chrome DevTools 调试', 'Inspects runtime UI, console, network, and performance behavior.', '检查运行时 UI、控制台、网络和性能行为。'),
92
92
  capability('figma-context-mcp.design-context', 'figma-context-mcp', 'Figma Design Context', 'mcp', 'design-context', ['designer', 'engineer'], 'medium', 'manual-design-input', 'Ask the user for screenshots, tokens, or exported design notes.', 'Figma Design Context', 'Figma 设计上下文', 'Reads design context for UI implementation planning.', '读取设计上下文以辅助 UI 实现规划。'),
@@ -6,7 +6,7 @@ export const seedCapabilityLandingMappings = [
6
6
  mapping({ capabilityId: 'codegraph.impact-analysis', sourceId: 'codegraph', sourceGroup: 'access-repo', landingKind: 'skill', target: 'peaks-rd', skillName: 'peaks-rd', guidance: 'Dry-run reference only: peaks-rd may use peaks codegraph affected --project <path> <files...> --json to inspect likely impact before slice planning and red-line checks when execution is approved.' }),
7
7
  mapping({ capabilityId: 'codegraph.impact-analysis', sourceId: 'codegraph', sourceGroup: 'access-repo', landingKind: 'skill', target: 'peaks-qa', skillName: 'peaks-qa', guidance: 'Use affected output as regression-surface evidence only; QA validation and test evidence remain authoritative.' }),
8
8
  mapping({ capabilityId: 'codegraph.context-pack', sourceId: 'codegraph', sourceGroup: 'access-repo', landingKind: 'skill', target: 'peaks-rd', skillName: 'peaks-rd', guidance: 'Dry-run reference only: peaks-rd may use peaks codegraph context --project <path> <task> to gather local evidence for RD analysis when execution is approved, without replacing standards dry-runs.' }),
9
- mapping({ capabilityId: 'codegraph.context-pack', sourceId: 'codegraph', sourceGroup: 'access-repo', landingKind: 'skill', target: 'peaks-code', skillName: 'peaks-code', guidance: 'Solo may attach local context packs or affected summaries before role handoff so RD, QA, and TXT share the same project evidence.' }),
9
+ mapping({ capabilityId: 'codegraph.context-pack', sourceId: 'codegraph', sourceGroup: 'access-repo', landingKind: 'skill', target: 'peaks-code', skillName: 'peaks-code', guidance: 'Code may attach local context packs or affected summaries before role handoff so RD, QA, and TXT share the same project evidence.' }),
10
10
  mapping({ capabilityId: 'codegraph.context-pack', sourceId: 'codegraph', sourceGroup: 'access-repo', landingKind: 'skill', target: 'peaks-txt', skillName: 'peaks-txt', guidance: 'TXT may summarize recorded codegraph context packs into handoffs while treating them as supporting evidence only.' }),
11
11
  mapping({ capabilityId: 'playwright-mcp.browser-validation', sourceId: 'playwright-mcp', sourceGroup: 'access-repo', landingKind: 'skill', target: 'peaks-qa', skillName: 'peaks-qa', guidance: 'Use for browser and E2E validation after user-approved app targets are available.' }),
12
12
  mapping({ capabilityId: 'chrome-devtools-mcp.browser-debug', sourceId: 'chrome-devtools-mcp', sourceGroup: 'access-repo', landingKind: 'skill', target: 'peaks-ui', skillName: 'peaks-ui', guidance: 'Use for runtime UI, console, network, and performance inspection.' }),
@@ -75,7 +75,7 @@ export function createRecommendationPlan(options) {
75
75
  return {
76
76
  intent: options.workflow,
77
77
  workflow: options.workflow,
78
- profile: 'solo-guided-auto',
78
+ profile: 'code-guided-auto',
79
79
  audience: ['engineer'],
80
80
  options: [recommendedOption],
81
81
  requiredCapabilities,
@@ -1,4 +1,4 @@
1
- export type RefactorMode = 'solo' | 'rd';
1
+ export type RefactorMode = 'code' | 'rd';
2
2
  export type RefactorDryRun = {
3
3
  mode: RefactorMode;
4
4
  implementationAllowed: false;
@@ -0,0 +1,100 @@
1
+ /**
2
+ * bundle-reader.ts — readBundle(inPath) (spec §7A.2).
3
+ *
4
+ * M7 / spec §7A.2 / §10 RL-9 / acceptance AC-25 / AC-26.
5
+ *
6
+ * Reads a `peaks.bundle/1` tar.gz and lands the contained release
7
+ * on the local SkillHub. The reader is the symmetrical counterpart
8
+ * of `bundle-writer.ts` — same layout, same content-addressed
9
+ * blobs/, but with three hard guards:
10
+ *
11
+ * 1. `format_version_major !== 1` is a HARD block. The reader
12
+ * throws `SHARE_BUNDLE_MAJOR_VERSION_MISMATCH` before any
13
+ * SQL side-effect. (Major-version bumps are reserved for
14
+ * breaking schema changes; the receiver is not assumed to
15
+ * know how to translate.)
16
+ * 2. `format_version_minor` mismatch is a non-fatal warn (the
17
+ * reader collects it as a warning on the return envelope).
18
+ * 3. The imported release ALWAYS lands as `candidate`. The
19
+ * reader refuses to write any other status; the receiver
20
+ * MUST run an independent evaluation before promoting the
21
+ * imported release to `stable` (AC-26 — peaks loop promote
22
+ * reads evolution_evaluation rows).
23
+ *
24
+ * The reader is also the integration point for AC-26 — the loop
25
+ * promote path (which lives in a future slice / CLI command) checks
26
+ * `evolution_evaluation.independent_scorer_verdict` before allowing
27
+ * a candidate → stable transition; this slice does not add a new
28
+ * `peaks loop promote` because `peaks asset crystallize` already
29
+ * enforces the brief-section + pre-run gates and creates the
30
+ * initial `candidate` row. The integration test for AC-26 verifies
31
+ * that a freshly imported bundle has no `evolution_evaluation`
32
+ * row and that promotion therefore cannot proceed.
33
+ */
34
+ import type Database from "better-sqlite3";
35
+ import { SHARE_BUNDLE_ERROR_CODES, type PeaksBundleKind } from "./bundle-types.js";
36
+ /**
37
+ * Thrown when `format_version_major !== 1`. This is the explicit
38
+ * HARD block per spec §7A.2 (major mismatch).
39
+ */
40
+ export declare class BundleMajorVersionMismatchError extends Error {
41
+ readonly code: typeof SHARE_BUNDLE_ERROR_CODES.MAJOR_VERSION_MISMATCH;
42
+ readonly receivedMajor: number;
43
+ constructor(receivedMajor: number);
44
+ }
45
+ /**
46
+ * Thrown when the schema-versions mapping is missing or carries
47
+ * non-canonical literals.
48
+ */
49
+ export declare class BundleSchemaVersionsMismatchError extends Error {
50
+ readonly code: typeof SHARE_BUNDLE_ERROR_CODES.SCHEMA_VERSIONS_MISMATCH;
51
+ readonly received: Record<string, unknown> | undefined;
52
+ constructor(received: Record<string, unknown> | undefined);
53
+ }
54
+ /**
55
+ * Thrown when the caller asks to land as anything other than
56
+ * `candidate` (the only allowed target status).
57
+ */
58
+ export declare class BundleImportToStableForbiddenError extends Error {
59
+ readonly code: typeof SHARE_BUNDLE_ERROR_CODES.IMPORT_TO_STABLE_FORBIDDEN;
60
+ constructor(receivedStatus: string);
61
+ }
62
+ /**
63
+ * Thrown when the bundle tarball is malformed (no manifest.json,
64
+ * bad JSON, etc.). Distinct from a ZodError so the CLI can map
65
+ * to a single BUNDLE_MALFORMED code.
66
+ */
67
+ export declare class BundleMalformedError extends Error {
68
+ readonly code: typeof SHARE_BUNDLE_ERROR_CODES.BUNDLE_MALFORMED;
69
+ constructor(message: string);
70
+ }
71
+ export type ReadBundleArgs = {
72
+ db: Database.Database;
73
+ /** Blobs root for content-addressed file write-back. */
74
+ blobsDir: string;
75
+ /** Input `.tar.gz` bundle path. */
76
+ inPath: string;
77
+ /**
78
+ * Optional rename for the anchor asset on import. For `loop`
79
+ * bundles this is the loop id to overwrite the source id; for
80
+ * `bee` bundles this is the `--as` bee name.
81
+ */
82
+ asName?: string;
83
+ };
84
+ /**
85
+ * Successful read result. The reader lands the bundle as a
86
+ * `candidate` regardless of any other lifecycle status on the
87
+ * source — this is the hard import rule per spec §7A.2 / AC-25.
88
+ */
89
+ export type ReadBundleResult = {
90
+ /** Anchor asset id actually written. */
91
+ assetId: string | number;
92
+ kind: PeaksBundleKind;
93
+ /** Always `candidate` — the reader does not honor any other status. */
94
+ importedAs: "candidate";
95
+ /** Non-fatal warnings (e.g. minor-version mismatch). */
96
+ warnings: string[];
97
+ /** Count of crystallization_event rows imported. */
98
+ evidenceBriefCount: number;
99
+ };
100
+ export declare function readBundle(args: ReadBundleArgs): ReadBundleResult;