peaks-loop 4.0.48 → 4.0.50

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 (156) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/README-en.md +1 -1
  3. package/README.md +1 -1
  4. package/dist/cli/commands/audit-commands.js +1 -0
  5. package/dist/cli/commands/baseline-commands.js +163 -25
  6. package/dist/cli/commands/compact-command.js +1 -3
  7. package/dist/cli/commands/core/skill-command.js +53 -4
  8. package/dist/cli/commands/core/standards-command.d.ts +24 -0
  9. package/dist/cli/commands/core/standards-command.js +74 -0
  10. package/dist/cli/commands/feedback-commands.d.ts +11 -7
  11. package/dist/cli/commands/feedback-commands.js +49 -17
  12. package/dist/cli/commands/final-review-commands.js +12 -0
  13. package/dist/cli/commands/hooks-commands.js +55 -38
  14. package/dist/cli/commands/loop-eval-commands.js +22 -6
  15. package/dist/cli/commands/share-commands.js +37 -11
  16. package/dist/cli/commands/slice-integrate-commands.js +17 -0
  17. package/dist/cli/commands/web-commands.js +8 -1
  18. package/dist/cli/commands/workflow-lifecycle-commands.d.ts +6 -0
  19. package/dist/cli/commands/workflow-lifecycle-commands.js +64 -3
  20. package/dist/services/adapter/adapter.d.ts +30 -0
  21. package/dist/services/adapter/auto-adapter.d.ts +13 -0
  22. package/dist/services/adapter/claude-adapter.js +12 -0
  23. package/dist/services/adapter/codex-adapter.d.ts +12 -0
  24. package/dist/services/adapter/codex-adapter.js +12 -0
  25. package/dist/services/adapter/copilot-adapter.d.ts +12 -0
  26. package/dist/services/adapter/copilot-adapter.js +12 -0
  27. package/dist/services/artifacts/artifact-prerequisites.js +10 -0
  28. package/dist/services/artifacts/request-artifact-service.js +59 -38
  29. package/dist/services/audit/backing-detector.d.ts +25 -7
  30. package/dist/services/audit/backing-detector.js +33 -17
  31. package/dist/services/audit/enforcer-liveness.d.ts +12 -0
  32. package/dist/services/audit/enforcer-liveness.js +100 -0
  33. package/dist/services/audit/enforcers/active-skill-resolver.js +14 -1
  34. package/dist/services/audit/enforcers/lint-catalog-governance.d.ts +23 -11
  35. package/dist/services/audit/enforcers/lint-catalog-governance.js +10 -14
  36. package/dist/services/audit/enforcers/lint-rd-handoff-coverage.d.ts +5 -15
  37. package/dist/services/audit/enforcers/lint-rd-handoff-coverage.js +94 -25
  38. package/dist/services/audit/enforcers/lint-style.d.ts +9 -1
  39. package/dist/services/audit/enforcers/lint-style.js +38 -2
  40. package/dist/services/audit/prose-ratio-calculator.d.ts +28 -17
  41. package/dist/services/audit/prose-ratio-calculator.js +25 -18
  42. package/dist/services/audit/red-line-catalog-p2-a.js +1 -1
  43. package/dist/services/audit/red-lines-service.js +51 -7
  44. package/dist/services/capability-audit-service/independent-checker.d.ts +15 -0
  45. package/dist/services/capability-audit-service/independent-checker.js +140 -0
  46. package/dist/services/capability-audit-service/index.d.ts +3 -1
  47. package/dist/services/capability-audit-service/index.js +1 -0
  48. package/dist/services/capability-audit-service/runner.d.ts +17 -13
  49. package/dist/services/capability-audit-service/runner.js +76 -15
  50. package/dist/services/capability-audit-service/types.d.ts +48 -0
  51. package/dist/services/capability-guard-runner/contracts/J01.js +21 -22
  52. package/dist/services/capability-guard-runner/contracts/J02.d.ts +1 -1
  53. package/dist/services/capability-guard-runner/contracts/J02.js +114 -28
  54. package/dist/services/capability-guard-runner/contracts/J03.d.ts +13 -0
  55. package/dist/services/capability-guard-runner/contracts/J03.js +72 -21
  56. package/dist/services/capability-guard-runner/contracts/J04.d.ts +6 -0
  57. package/dist/services/capability-guard-runner/contracts/J04.js +65 -32
  58. package/dist/services/capability-guard-runner/contracts/J05.js +118 -16
  59. package/dist/services/capability-guard-runner/contracts/J06.d.ts +14 -0
  60. package/dist/services/capability-guard-runner/contracts/J06.js +57 -39
  61. package/dist/services/capability-guard-runner/contracts/J07.d.ts +9 -0
  62. package/dist/services/capability-guard-runner/contracts/J07.js +76 -47
  63. package/dist/services/capability-guard-runner/contracts/J08.d.ts +11 -0
  64. package/dist/services/capability-guard-runner/contracts/J08.js +66 -39
  65. package/dist/services/capability-guard-runner/contracts/J09.d.ts +13 -0
  66. package/dist/services/capability-guard-runner/contracts/J09.js +95 -39
  67. package/dist/services/capability-guard-runner/contracts/J10.d.ts +12 -0
  68. package/dist/services/capability-guard-runner/contracts/J10.js +69 -35
  69. package/dist/services/capability-guard-runner/contracts/J11.d.ts +8 -0
  70. package/dist/services/capability-guard-runner/contracts/J11.js +73 -33
  71. package/dist/services/capability-guard-runner/contracts/J12.d.ts +12 -0
  72. package/dist/services/capability-guard-runner/contracts/J12.js +66 -30
  73. package/dist/services/capability-guard-runner/contracts/J13.d.ts +11 -0
  74. package/dist/services/capability-guard-runner/contracts/J13.js +62 -40
  75. package/dist/services/capability-guard-runner/contracts/J14.d.ts +11 -0
  76. package/dist/services/capability-guard-runner/contracts/J14.js +60 -31
  77. package/dist/services/capability-guard-runner/contracts/J15.d.ts +11 -0
  78. package/dist/services/capability-guard-runner/contracts/J15.js +70 -35
  79. package/dist/services/capability-guard-runner/contracts/_shared.d.ts +24 -0
  80. package/dist/services/capability-guard-runner/contracts/_shared.js +67 -0
  81. package/dist/services/capability-guard-runner/registry.d.ts +5 -0
  82. package/dist/services/capability-guard-runner/registry.js +140 -0
  83. package/dist/services/capability-guard-runner/runner.d.ts +26 -0
  84. package/dist/services/capability-guard-runner/runner.js +63 -6
  85. package/dist/services/code/auto-compact-lifecycle.d.ts +75 -0
  86. package/dist/services/code/auto-compact-lifecycle.js +65 -16
  87. package/dist/services/code/auto-compact-modes.d.ts +13 -2
  88. package/dist/services/code/auto-compact-modes.js +20 -4
  89. package/dist/services/code/auto-compact-orchestrator.js +119 -19
  90. package/dist/services/code/compact-event-settle.d.ts +20 -8
  91. package/dist/services/code/compact-event-settle.js +21 -0
  92. package/dist/services/code/post-compact-detector.js +20 -11
  93. package/dist/services/code/step-08-gate.js +21 -6
  94. package/dist/services/compact-statusline/compact-statusline-service.js +56 -22
  95. package/dist/services/config/config-safety.js +11 -9
  96. package/dist/services/context/auto-compact-types.d.ts +20 -2
  97. package/dist/services/feedback/feedback-promotion-service.d.ts +137 -14
  98. package/dist/services/feedback/feedback-promotion-service.js +341 -20
  99. package/dist/services/feedback/promotion-artifact-evidence.d.ts +69 -0
  100. package/dist/services/feedback/promotion-artifact-evidence.js +332 -0
  101. package/dist/services/final-review/pre-post-diff.js +10 -2
  102. package/dist/services/job/job-progress-store.js +18 -3
  103. package/dist/services/observability/jsonl-store.d.ts +19 -0
  104. package/dist/services/observability/jsonl-store.js +27 -2
  105. package/dist/services/observability/observability-service.d.ts +11 -4
  106. package/dist/services/observability/observability-service.js +16 -3
  107. package/dist/services/prd/handoff-service.js +43 -0
  108. package/dist/services/qa/qa-business-review-state.js +19 -5
  109. package/dist/services/sc/sc-service.d.ts +8 -0
  110. package/dist/services/sc/sc-service.js +8 -1
  111. package/dist/services/scan/api-diff-types.js +20 -2
  112. package/dist/services/security/safe-settings-path.js +19 -1
  113. package/dist/services/session/getSessionDir.d.ts +33 -0
  114. package/dist/services/session/getSessionDir.js +60 -0
  115. package/dist/services/skill/skill-search-service.d.ts +3 -3
  116. package/dist/services/slice/slice-review-state.js +19 -4
  117. package/dist/services/standards/loop-engineering-lint.d.ts +1 -1
  118. package/dist/services/standards/loop-engineering-lint.js +6 -0
  119. package/dist/services/web/daemon-registry.js +27 -2
  120. package/dist/services/workflow/pipeline-verify-gate-support.js +10 -11
  121. package/dist/services/workflow/pipeline-verify-service.d.ts +1 -1
  122. package/dist/services/workflow/pipeline-verify-service.js +23 -10
  123. package/dist/services/workflow/pipeline-verify-types.d.ts +5 -3
  124. package/dist/services/workspace/claude-settings-template.d.ts +53 -37
  125. package/dist/services/workspace/claude-settings-template.js +105 -83
  126. package/dist/services/workspace/generated-artifacts-stamp.d.ts +119 -0
  127. package/dist/services/workspace/generated-artifacts-stamp.js +167 -0
  128. package/dist/services/workspace/workspace-claude-settings-materializer.d.ts +8 -0
  129. package/dist/services/workspace/workspace-claude-settings-materializer.js +38 -3
  130. package/dist/services/workspace/workspace-service.js +11 -1
  131. package/dist/shared/fs-utils.d.ts +26 -0
  132. package/dist/shared/fs-utils.js +35 -0
  133. package/dist/shared/runtime-root.d.ts +73 -0
  134. package/dist/shared/runtime-root.js +77 -0
  135. package/package.json +9 -7
  136. package/scripts/copy-templates.mjs +0 -12
  137. package/scripts/install-skills.mjs +154 -53
  138. package/skills/bee/peaks-qa/SKILL.md +0 -1
  139. package/skills/bee/peaks-rd/SKILL.md +0 -1
  140. package/skills/peaks-code/SKILL.md +12 -10
  141. package/skills/peaks-code/references/periodic-checkpoint.md +2 -2
  142. package/skills/peaks-code/references/runbook.md +3 -0
  143. package/skills/peaks-code/references/session-overload-signal-index.md +4 -2
  144. package/skills/peaks-code/references/startup-sequence.md +2 -2
  145. package/skills/peaks-code/references/step-0-8-gate.md +1 -1
  146. package/skills/peaks-code/references/sub-agent-dispatch.md +19 -19
  147. package/dist/cli/commands/context-builder-commands.d.ts +0 -11
  148. package/dist/cli/commands/context-builder-commands.js +0 -85
  149. package/dist/services/hooks/write-gate.js +0 -111
  150. package/skills/bee/peaks-prd/references/command-migration.md +0 -3
  151. package/skills/bee/peaks-qa/references/command-migration.md +0 -3
  152. package/skills/bee/peaks-rd/references/command-migration.md +0 -3
  153. package/skills/bee/peaks-sc/references/command-migration.md +0 -3
  154. package/skills/bee/peaks-txt/references/command-migration.md +0 -3
  155. package/skills/bee/peaks-ui/references/command-migration.md +0 -3
  156. package/skills/peaks-code/references/command-migration.md +0 -3
@@ -1,85 +0,0 @@
1
- /**
2
- * `peaks context <sub>` — CLI surface for the ContextBuilder.
3
- * Per spec §4.1 — these commands are the only sanctioned entry point;
4
- * peaks-rd / peaks-qa / peaks-mut invoke them programmatically.
5
- */
6
- import { Command } from 'commander';
7
- import { readFile } from 'node:fs/promises';
8
- import { buildContext } from '../../services/context/context-builder.js';
9
- import { ContextJsonSchema } from '../../services/context/context-schema.js';
10
- export function createContextCommands(options) {
11
- const context = new Command('context').description('peaks-context: build versioned, version-locked context.json (spec §4.1)');
12
- context
13
- .command('build')
14
- .requiredOption('--goal <text>', 'user request goal')
15
- .requiredOption('--project <path>', 'project root')
16
- .option('--audience <role>', 'peaks-rd | peaks-qa | peaks-mut | all', 'all')
17
- .option('--deps-mode <mode>', 'locked | latest', 'locked')
18
- .option('--doc-budget-tokens <n>', 'token budget for renderer', '8000')
19
- .requiredOption('--out <path>', 'output path for context.json')
20
- .option('--json', 'machine-readable output', false)
21
- .action(async (opts) => {
22
- const ctx = await buildContext({
23
- goal: opts.goal,
24
- project: opts.project,
25
- audience: opts.audience,
26
- depsMode: opts.depsMode,
27
- docBudgetTokens: Number(opts.docBudgetTokens),
28
- out: opts.out,
29
- fetcher: options.fetcher,
30
- });
31
- if (opts.json) {
32
- process.stdout.write(JSON.stringify({ ok: true, sha256: ctx.sha256 }) + '\n');
33
- }
34
- else {
35
- process.stdout.write(`context.json written: ${opts.out}\nsha256: ${ctx.sha256}\n`);
36
- }
37
- });
38
- context
39
- .command('validate <file>')
40
- .action(async (file) => {
41
- const raw = await readFile(file, 'utf8');
42
- const parsed = JSON.parse(raw);
43
- const result = ContextJsonSchema.safeParse(parsed);
44
- if (!result.success) {
45
- process.stderr.write(`INVALID: ${result.error.message}\n`);
46
- process.exit(2);
47
- }
48
- process.stdout.write(`OK: ${file}\n`);
49
- });
50
- context
51
- .command('inspect <file>')
52
- .action(async (file) => {
53
- const raw = await readFile(file, 'utf8');
54
- const ctx = JSON.parse(raw);
55
- process.stdout.write([
56
- `version: ${ctx.version}`,
57
- `goal: ${ctx.goal}`,
58
- `sha256: ${ctx.sha256}`,
59
- `deps: ${Object.keys(ctx.collector.deps).join(', ')}`,
60
- `fetchedDocs: ${ctx.docRetriever.fetchedDocs.length}`,
61
- `skipped: ${ctx.docRetriever.skipped.length}`,
62
- `truncated: ${ctx.renderer.truncated}`,
63
- `audience: ${ctx.renderer.audience}`,
64
- ].join('\n') + '\n');
65
- });
66
- context
67
- .command('schema')
68
- .action(async () => {
69
- // Pre-flight fix #3: read from the canonical schemas/context.schema.json
70
- // (generated by Task 12) instead of serializing Zod internals at runtime.
71
- // Both files must agree; if schema.json is missing, this command fails
72
- // with a clear message pointing at Task 12.
73
- const fs = await import('node:fs/promises');
74
- try {
75
- const content = await fs.readFile('schemas/context.schema.json', 'utf8');
76
- process.stdout.write(content + '\n');
77
- }
78
- catch {
79
- process.stderr.write('BLOCKED: schemas/context.schema.json not found.\n' +
80
- 'Run Task 12 of Plan 1 to generate it.\n');
81
- process.exit(2);
82
- }
83
- });
84
- return context;
85
- }
@@ -1,111 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * write-gate.js — peaks Write|Edit|MultiEdit PreToolUse path gate.
4
- *
5
- * Slice c5-write-hook-exec-form (session 2026-09-10-session-528a63).
6
- * VERBATIM RELOCATION: the predicate chain below was character-for-character
7
- * the chain that used to be inlined into `claude-settings-template.ts` as a
8
- * `node -e "<js>"` one-liner.
9
- *
10
- * Slice c5b-write-gate-polarity (same session) NARROWED the decision to match
11
- * the contract `.claude/HOOKS.md` documents for this handler. The relocated
12
- * chain read its eight directory names as an EXCLUSION list, so `_runtime`
13
- * AND every other `.peaks/<slug>/` were allowed; it now allows only paths
14
- * under `.peaks/_runtime/` and falls through on everything else. That earlier
15
- * polarity also permitted a top-level `.peaks/<change-id>/` write, which
16
- * `CLAUDE.md`'s hard ban forbids outright.
17
- *
18
- * Why it moved into a file: the inlined form was shell-dialect-coupled. Its
19
- * escaping contract was defined in terms of bash reducing `\\` to `\` inside a
20
- * `"..."` wrapper, which PowerShell does NOT do — so the handler could not take
21
- * the platform `shell` pin its Bash siblings carry. `node <path>` has no inline
22
- * payload, so there is nothing left to escape and no dialect to couple to.
23
- *
24
- * Why `.js` and not `.sh` (the convention for the other hook scripts here):
25
- * - `.sh` needs `bash`; on Windows that means Git Bash, so it is itself a
26
- * shell dependency and the escaping problem merely moves to the
27
- * `bash <script>` boundary.
28
- * - `node` is already a hard dependency — the previous form invoked it.
29
- * - A plain `.js` needs no compile step, so the SAME relative filename
30
- * exists in `src/` (used by `tsx` + vitest) and in `dist/` (copied by
31
- * `scripts/copy-templates.mjs`), which lets one emitted path string be
32
- * valid for both the repo and an installed consumer.
33
- *
34
- * Contract (`.claude/HOOKS.md`): this handler ALWAYS ABSTAINS: exit 0, no
35
- * output, on every path. Only exit 2 blocks a tool call, and this handler
36
- * never returns it, so any other non-zero exit is a non-blocking ERROR
37
- * rather than a decision. See `decide` below for the correction this file
38
- * went through.
39
- *
40
- * Path source: the hook payload arrives as JSON on STDIN (Claude Code's
41
- * documented channel; it appends no argv). `process.argv[2]` is honoured as a
42
- * fallback so a positional-arg invocation keeps working.
43
- */
44
-
45
- /** First string found at any of the candidate keys of `root`. */
46
- function pathFrom(root) {
47
- if (!root || typeof root !== 'object') return '';
48
- for (const key of ['file_path', 'path', 'notebook_path']) {
49
- if (typeof root[key] === 'string') return root[key];
50
- }
51
- return '';
52
- }
53
-
54
- /** Pull the candidate file path out of a parsed hook payload. */
55
- function candidatePath(payload) {
56
- if (!payload || typeof payload !== 'object') return '';
57
- return pathFrom(payload.tool_input) || pathFrom(payload);
58
- }
59
-
60
- /**
61
- * This handler ABSTAINS on every path, including `.peaks/_runtime/`.
62
- *
63
- * It used to return 1 for anything outside `.peaks/_runtime/`, documented as
64
- * "fall through to the gate". That concept does not exist in the Claude Code
65
- * hook protocol. Exit 2 is the only code that blocks; every other non-zero
66
- * exit is a NON-BLOCKING ERROR — the action still proceeds, but the transcript
67
- * shows `<hook> hook error` followed by `Failed with non-blocking status code:
68
- * No stderr output`. The "silent fall-through" was therefore the LOUDEST
69
- * available outcome, reported once per edit for every path a developer
70
- * actually touches.
71
- *
72
- * The documented abstention is exit 0 with no output: "no decision". All
73
- * matching PreToolUse hooks run in parallel and their results are merged
74
- * (`deny` > `defer` > `ask` > `allow`), so abstaining neither approves the call
75
- * nor suppresses a sibling's deny — the fact gate still applies to every path
76
- * it always applied to.
77
- *
78
- * Runtime behaviour is unchanged for every path. What changes is that the
79
- * handler stops reporting a spurious error while abstaining.
80
- */
81
- function decide(p) {
82
- // The path is still read (it is the payload's whole point) but no longer
83
- // branches: every path abstains.
84
- void p;
85
- return 0;
86
- }
87
-
88
- const ARGV_PATH = typeof process.argv[2] === 'string' ? process.argv[2] : '';
89
-
90
- // No stdin to read (a human running this by hand): decide on argv alone
91
- // instead of blocking forever waiting for an 'end' that never comes.
92
- if (process.stdin.isTTY) {
93
- process.exit(decide(ARGV_PATH));
94
- }
95
-
96
- let raw = '';
97
- process.stdin.setEncoding('utf8');
98
- process.stdin.on('data', (chunk) => { raw += chunk; });
99
- process.stdin.on('end', () => {
100
- let payload;
101
- try {
102
- payload = JSON.parse(raw);
103
- } catch {
104
- // Malformed or empty payload → no path. This is NOT a deny: `decide`
105
- // abstains for every input including the empty string, and a deny would
106
- // take exit 2. The old comment here said "deny" while returning 1, which
107
- // is the non-blocking error — the same misreading this file corrects.
108
- payload = undefined;
109
- }
110
- process.exit(decide(candidatePath(payload) || ARGV_PATH));
111
- });
@@ -1,3 +0,0 @@
1
- # command-migration.md
2
-
3
- This reference documents command-migration.md for peaks-prd.
@@ -1,3 +0,0 @@
1
- # command-migration.md
2
-
3
- This reference documents command-migration.md for peaks-qa.
@@ -1,3 +0,0 @@
1
- # command-migration.md
2
-
3
- This reference documents command-migration.md for peaks-rd.
@@ -1,3 +0,0 @@
1
- # command-migration.md
2
-
3
- This reference documents command-migration.md for peaks-sc.
@@ -1,3 +0,0 @@
1
- # command-migration.md
2
-
3
- This reference documents command-migration.md for peaks-txt.
@@ -1,3 +0,0 @@
1
- # command-migration.md
2
-
3
- This reference documents command-migration.md for peaks-ui.
@@ -1,3 +0,0 @@
1
- # command-migration.md
2
-
3
- This reference documents command-migration.md for peaks-code.