peaks-loop-mut 0.1.52 → 0.1.55

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 (34) hide show
  1. package/dist/index.d.ts +3 -3
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +3 -3
  4. package/dist/services/agent/ecc-materialize.d.ts +32 -0
  5. package/dist/services/agent/ecc-materialize.d.ts.map +1 -0
  6. package/dist/services/agent/ecc-materialize.js +76 -0
  7. package/dist/services/agent/ecc-materialized-readers.d.ts +49 -0
  8. package/dist/services/agent/ecc-materialized-readers.d.ts.map +1 -0
  9. package/dist/services/agent/ecc-materialized-readers.js +169 -0
  10. package/dist/services/agent/ecc-package-service.d.ts +38 -0
  11. package/dist/services/agent/ecc-package-service.d.ts.map +1 -0
  12. package/dist/services/agent/ecc-package-service.js +41 -0
  13. package/dist/services/agent/ecc-package-source.d.ts +97 -0
  14. package/dist/services/agent/ecc-package-source.d.ts.map +1 -0
  15. package/dist/services/agent/ecc-package-source.js +130 -0
  16. package/dist/services/mut/assert-scanner.d.ts.map +1 -1
  17. package/dist/services/mut/assert-scanner.js +8 -4
  18. package/dist/services/mut/index.d.ts +3 -3
  19. package/dist/services/mut/index.d.ts.map +1 -1
  20. package/dist/services/mut/index.js +2 -2
  21. package/dist/services/mut/mut-runner.js +4 -4
  22. package/dist/services/mut/production-stryker.d.ts.map +1 -1
  23. package/dist/services/mut/production-stryker.js +17 -13
  24. package/dist/services/mut/report-builder.d.ts.map +1 -1
  25. package/dist/services/mut/report-builder.js +6 -6
  26. package/dist/services/mut/report-loader.d.ts.map +1 -1
  27. package/dist/services/mut/report-loader.js +2 -1
  28. package/dist/services/mut/thresholds.js +4 -4
  29. package/dist/services/mut/types.d.ts.map +1 -1
  30. package/dist/services/mut/types.js +14 -10
  31. package/package.json +2 -1
  32. package/dist/services/agent/ecc-cache-service.d.ts +0 -172
  33. package/dist/services/agent/ecc-cache-service.d.ts.map +0 -1
  34. package/dist/services/agent/ecc-cache-service.js +0 -735
@@ -0,0 +1,130 @@
1
+ /**
2
+ * Where ECC's agent definitions come from: the installed `ecc-universal`
3
+ * npm package.
4
+ *
5
+ * THIS REPLACED A NETWORK ACQUISITION LAYER. Until 2026-10-04 peaks-loop
6
+ * downloaded ECC at runtime — `api.github.com/repos/affaan-m/ECC/releases/latest`
7
+ * → `codeload` tarball → selective extract into `~/.peaks/cache/ecc-<sha>/`
8
+ * — guarded by a tarball-safety module, a cache manifest, a sha-directory
9
+ * cleanup sweep and a log-retention leg that swept it. Every one of those
10
+ * existed to make up for a premise that turned out to be false: three places in
11
+ * this repository asserted that `affaan-m/ECC` was NOT on npm
12
+ * (`src/services/audit/static-service.ts`, `CHANGELOG.md:1630`,
13
+ * `src/services/code-review/ecc-bridge.ts`), and `ecc-universal` IS that
14
+ * repository — `npm view ecc-universal repository.url` answers
15
+ * `git+https://github.com/affaan-m/ECC.git`. A dependency ships its own files,
16
+ * so there is nothing left to fetch, verify, extract, cache or sweep.
17
+ *
18
+ * WHAT REMAINS AND WHY: `ecc-universal` is a normal dependency of
19
+ * `peaks-loop-mut`, its `agents/*.md` are read here, and the plugin-free copy
20
+ * under `~/.peaks/agents/ecc/` (see `ecc-materialize.ts`) is kept because that
21
+ * path is what the RD fan-out and Gate B3 read, what the skill docs tell the LLM
22
+ * to open, and it survives a peaks-loop upgrade that changes the version-pinned
23
+ * path below.
24
+ *
25
+ * The resolved path is version-PINNED under pnpm
26
+ * (`.../.pnpm/ecc-universal@2.2.3/node_modules/ecc-universal`), which is exactly
27
+ * why it is not a stable read target for a human opening a path by hand — hence
28
+ * materialize, and hence this module never hands out its own directory except to
29
+ * the copy step.
30
+ */
31
+ import { chmodSync, existsSync, readFileSync } from 'node:fs';
32
+ import { homedir } from 'node:os';
33
+ import { dirname, join } from 'node:path';
34
+ import { createRequire } from 'node:module';
35
+ export const ECC_PACKAGE_NAME = 'ecc-universal';
36
+ export const ECC_AGENTS_SUBDIR = 'agents';
37
+ /** Manifest shape for the plugin-free copy. */
38
+ export const ECC_MATERIALIZE_VERSION = '2';
39
+ export class EccSourceError extends Error {
40
+ failure;
41
+ constructor(failure, detail) {
42
+ super(`ecc-universal: ${failure} — ${detail}`);
43
+ this.name = 'EccSourceError';
44
+ this.failure = failure;
45
+ }
46
+ }
47
+ /**
48
+ * The package root, resolved through Node's own algorithm rather than a
49
+ * hand-built `node_modules` path.
50
+ *
51
+ * `require.resolve('ecc-universal/package.json')` is the join point: it honors
52
+ * the pnpm store layout, an npm flat install, a global install of peaks-loop,
53
+ * and a linked workspace alike. A hardcoded `../../node_modules/ecc-universal`
54
+ * would resolve in exactly one of those and fail in the others with an error
55
+ * that looks like "ECC is not installed".
56
+ */
57
+ export function resolveEccPackageRoot() {
58
+ let packageJson;
59
+ try {
60
+ packageJson = createRequire(import.meta.url).resolve(`${ECC_PACKAGE_NAME}/package.json`);
61
+ }
62
+ catch (error) {
63
+ const message = error instanceof Error ? error.message : String(error);
64
+ throw new EccSourceError('not-installed', `cannot resolve ${ECC_PACKAGE_NAME}/package.json from peaks-loop-mut (${message}). ` +
65
+ 'Reinstall peaks-loop; the ECC agents ship with that dependency.');
66
+ }
67
+ return dirname(packageJson);
68
+ }
69
+ /** The `version` the package declares — the identity a materialized copy records. */
70
+ export function readEccPackageVersion(root = resolveEccPackageRoot()) {
71
+ try {
72
+ const parsed = JSON.parse(readFileSync(join(root, 'package.json'), 'utf8'));
73
+ return typeof parsed.version === 'string' ? parsed.version : 'unknown';
74
+ }
75
+ catch {
76
+ return 'unknown';
77
+ }
78
+ }
79
+ /** `<package>/agents` — the flat `*.md` definitions the LLM consumes. */
80
+ export function resolveEccAgentsDir(root = resolveEccPackageRoot()) {
81
+ const agentsDir = join(root, ECC_AGENTS_SUBDIR);
82
+ if (!existsSync(agentsDir)) {
83
+ throw new EccSourceError('no-agents-dir', `${agentsDir} does not exist; this ${ECC_PACKAGE_NAME} build ships no agents/ subtree`);
84
+ }
85
+ return agentsDir;
86
+ }
87
+ /**
88
+ * Plugin-free materialize target: `~/.peaks/agents/ecc/`.
89
+ *
90
+ * Deliberately NOT under `~/.claude/` — peaks-loop must never write into the
91
+ * user's Claude Code tree (user direction 2026-09-09). The LLM reads
92
+ * `<target>/<agent-name>.md` directly when the ECC Claude Code plugin is
93
+ * absent, then dispatches a generic sub-agent with that body.
94
+ */
95
+ export function resolveEccMaterializedDir() {
96
+ return join(homedir(), '.peaks', 'agents', 'ecc');
97
+ }
98
+ export function resolveEccMaterializedManifestPath(dirOverride) {
99
+ return join(dirOverride ?? resolveEccMaterializedDir(), 'ecc-agents.json');
100
+ }
101
+ /**
102
+ * Agent names are used to build filenames, so the whitelist is the escape
103
+ * check. Kept as a positive allowlist rather than a denylist: anything outside
104
+ * `^[a-z][a-z0-9-]*$` never reaches a path, whatever upstream adds later.
105
+ */
106
+ export function isSafeAgentName(name) {
107
+ return /^[a-z][a-z0-9-]*$/.test(name);
108
+ }
109
+ /**
110
+ * Owner-only mode for the peaks-owned dirs this writes. `0o700` is a POSIX mode
111
+ * literal, not a tunable: anything wider lets another local user read the agent
112
+ * definitions the LLM is about to be handed.
113
+ */
114
+ // eslint-disable-next-line no-magic-numbers -- POSIX mode bits are notation, not a quantity
115
+ const PEAKS_DIR_MODE = 0o700;
116
+ /**
117
+ * Best-effort chmod 0o700 on POSIX; no-op on Windows (NTFS uses ACLs, not POSIX
118
+ * mode bits). Errors are swallowed with WARN so a permissions failure never
119
+ * blocks the CLI — the files are public agent definitions, not secrets.
120
+ */
121
+ export function setPeaksDirPermissions(dir) {
122
+ if (process.platform === 'win32')
123
+ return;
124
+ try {
125
+ chmodSync(dir, PEAKS_DIR_MODE);
126
+ }
127
+ catch {
128
+ /* best-effort */
129
+ }
130
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"assert-scanner.d.ts","sourceRoot":"","sources":["../../../src/services/mut/assert-scanner.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EACV,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAepB,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CAC3C;AA6BD,wBAAsB,cAAc,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAqEhF"}
1
+ {"version":3,"file":"assert-scanner.d.ts","sourceRoot":"","sources":["../../../src/services/mut/assert-scanner.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,gBAAgB,EAA8C,MAAM,YAAY,CAAC;AAe/F,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CAC3C;AA6BD,wBAAsB,cAAc,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAyEhF"}
@@ -18,7 +18,7 @@ import { join } from 'node:path';
18
18
  const WEAK_PATTERNS = [
19
19
  { pattern: 'toBeDefined', regex: /\.toBeDefined\s*\(\s*\)/g },
20
20
  { pattern: 'toBeTruthy', regex: /\.toBeTruthy\s*\(\s*\)/g },
21
- { pattern: 'expect-anything', regex: /expect\.anything\s*\(\s*\)/g },
21
+ { pattern: 'expect-anything', regex: /expect\.anything\s*\(\s*\)/g }
22
22
  // Self-equality patterns require matched-pair parsing; handled below.
23
23
  ];
24
24
  const TO_EQUAL_SELF = /\.toEqual\s*\(\s*([a-zA-Z_$][\w$]*)\s*\)/g;
@@ -73,7 +73,9 @@ export async function scanAssertions(input) {
73
73
  // toEqual-self: needs receiver extraction.
74
74
  const eqSelf = [...content.matchAll(TO_EQUAL_SELF)];
75
75
  for (const m of eqSelf) {
76
- const receiverMatch = content.slice(0, m.index ?? 0).match(/expect\s*\(\s*([a-zA-Z_$][\w$]*)\s*\)/g);
76
+ const receiverMatch = content
77
+ .slice(0, m.index ?? 0)
78
+ .match(/expect\s*\(\s*([a-zA-Z_$][\w$]*)\s*\)/g);
77
79
  if (receiverMatch && receiverMatch.length > 0) {
78
80
  const lastReceiver = receiverMatch[receiverMatch.length - 1];
79
81
  const receiverName = lastReceiver?.match(/expect\s*\(\s*([a-zA-Z_$][\w$]*)\s*\)/)?.[1];
@@ -89,7 +91,9 @@ export async function scanAssertions(input) {
89
91
  // toBe-self: same pattern.
90
92
  const beSelf = [...content.matchAll(TO_BE_SELF)];
91
93
  for (const m of beSelf) {
92
- const receiverMatch = content.slice(0, m.index ?? 0).match(/expect\s*\(\s*([a-zA-Z_$][\w$]*)\s*\)/g);
94
+ const receiverMatch = content
95
+ .slice(0, m.index ?? 0)
96
+ .match(/expect\s*\(\s*([a-zA-Z_$][\w$]*)\s*\)/g);
93
97
  if (receiverMatch && receiverMatch.length > 0) {
94
98
  const lastReceiver = receiverMatch[receiverMatch.length - 1];
95
99
  const receiverName = lastReceiver?.match(/expect\s*\(\s*([a-zA-Z_$][\w$]*)\s*\)/)?.[1];
@@ -111,6 +115,6 @@ export async function scanAssertions(input) {
111
115
  totalAssertions: total,
112
116
  weakAssertions: weak,
113
117
  weakRate: total === 0 ? 0 : weak / total,
114
- weakPatterns,
118
+ weakPatterns
115
119
  };
116
120
  }
@@ -1,9 +1,9 @@
1
1
  export { MutReportSchema } from './types.js';
2
2
  export { scanAssertions, type ScanInput } from './assert-scanner.js';
3
- export { runMutation, type RunMutationInput, type RunMutationOutput, type StrykerInvoker, type StrykerRawResult, } from './mut-runner.js';
3
+ export { runMutation, type RunMutationInput, type RunMutationOutput, type StrykerInvoker, type StrykerRawResult } from './mut-runner.js';
4
4
  export { createProductionStrykerInvoker } from './production-stryker.js';
5
5
  export { buildMutReport, type BuildMutInput } from './report-builder.js';
6
6
  export { loadMutReport, mutReportPath, MUT_REPORT_RELATIVE_PATH } from './report-loader.js';
7
- export { DEFAULT_THRESHOLDS, evaluateThresholds, type Thresholds, type ThresholdEvaluation, type ThresholdViolation, type ThresholdViolationKind, } from './thresholds.js';
8
- export type { MutReportJson, MutationReport, AssertionsReport, WeakPattern, WeakPatternCount, Followup, } from './types.js';
7
+ export { DEFAULT_THRESHOLDS, evaluateThresholds, type Thresholds, type ThresholdEvaluation, type ThresholdViolation, type ThresholdViolationKind } from './thresholds.js';
8
+ export type { MutReportJson, MutationReport, AssertionsReport, WeakPattern, WeakPatternCount, Followup } from './types.js';
9
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/mut/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,EACL,WAAW,EACX,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,gBAAgB,GACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,8BAA8B,EAAE,MAAM,yBAAyB,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC5F,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,KAAK,UAAU,EACf,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,GAC5B,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,aAAa,EAAE,cAAc,EAAE,gBAAgB,EAC/C,WAAW,EAAE,gBAAgB,EAAE,QAAQ,GACxC,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/mut/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,EACL,WAAW,EACX,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,8BAA8B,EAAE,MAAM,yBAAyB,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC5F,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,KAAK,UAAU,EACf,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC5B,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,WAAW,EACX,gBAAgB,EAChB,QAAQ,EACT,MAAM,YAAY,CAAC"}
@@ -1,7 +1,7 @@
1
1
  export { MutReportSchema } from './types.js';
2
2
  export { scanAssertions } from './assert-scanner.js';
3
- export { runMutation, } from './mut-runner.js';
3
+ export { runMutation } from './mut-runner.js';
4
4
  export { createProductionStrykerInvoker } from './production-stryker.js';
5
5
  export { buildMutReport } from './report-builder.js';
6
6
  export { loadMutReport, mutReportPath, MUT_REPORT_RELATIVE_PATH } from './report-loader.js';
7
- export { DEFAULT_THRESHOLDS, evaluateThresholds, } from './thresholds.js';
7
+ export { DEFAULT_THRESHOLDS, evaluateThresholds } from './thresholds.js';
@@ -3,7 +3,7 @@ export async function runMutation(input) {
3
3
  try {
4
4
  raw = await input.invokeStryker({
5
5
  project: input.project,
6
- testFiles: input.testFiles,
6
+ testFiles: input.testFiles
7
7
  });
8
8
  }
9
9
  catch (err) {
@@ -22,8 +22,8 @@ export async function runMutation(input) {
22
22
  byFile: raw.perFile.map((f) => ({
23
23
  file: f.file,
24
24
  killRate: f.killRate,
25
- survived: f.survived,
26
- })),
27
- },
25
+ survived: f.survived
26
+ }))
27
+ }
28
28
  };
29
29
  }
@@ -1 +1 @@
1
- {"version":3,"file":"production-stryker.d.ts","sourceRoot":"","sources":["../../../src/services/mut/production-stryker.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,cAAc,EAAoB,MAAM,iBAAiB,CAAC;AAcxE,wBAAgB,8BAA8B,IAAI,cAAc,CAY/D"}
1
+ {"version":3,"file":"production-stryker.d.ts","sourceRoot":"","sources":["../../../src/services/mut/production-stryker.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,cAAc,EAAoB,MAAM,iBAAiB,CAAC;AAsBxE,wBAAgB,8BAA8B,IAAI,cAAc,CAY/D"}
@@ -18,17 +18,7 @@ export function createProductionStrykerInvoker() {
18
18
  };
19
19
  }
20
20
  function normalize(mutants, project) {
21
- let mutantsKilled = 0;
22
- let mutantsSurvived = 0;
23
- let mutantsTimeout = 0;
24
- for (const m of mutants) {
25
- if (m.status === 'Killed')
26
- mutantsKilled++;
27
- else if (m.status === 'Survived')
28
- mutantsSurvived++;
29
- else if (m.status === 'Timeout')
30
- mutantsTimeout++;
31
- }
21
+ const { mutantsKilled, mutantsSurvived, mutantsTimeout } = countStatuses(mutants);
32
22
  // Bucket mutants by fileName to populate perFile. deriveFollowups iterates
33
23
  // m.byFile to emit per-file followups (e.g. low_kill_rate) — leaving this
34
24
  // empty (as v0 did) silently swallowed those followups in production.
@@ -53,7 +43,7 @@ function normalize(mutants, project) {
53
43
  bucket.survivedEntries.push({
54
44
  line: m.location.start.line + 1, // Stryker is 0-based; reports are 1-based.
55
45
  mutation: m.replacement,
56
- survivedBecause: m.statusReason ?? '',
46
+ survivedBecause: m.statusReason ?? ''
57
47
  });
58
48
  }
59
49
  }
@@ -70,6 +60,20 @@ function normalize(mutants, project) {
70
60
  mutantsKilled,
71
61
  mutantsSurvived,
72
62
  mutantsTimeout,
73
- perFile,
63
+ perFile
74
64
  };
75
65
  }
66
+ function countStatuses(mutants) {
67
+ let mutantsKilled = 0;
68
+ let mutantsSurvived = 0;
69
+ let mutantsTimeout = 0;
70
+ for (const m of mutants) {
71
+ if (m.status === 'Killed')
72
+ mutantsKilled++;
73
+ else if (m.status === 'Survived')
74
+ mutantsSurvived++;
75
+ else if (m.status === 'Timeout')
76
+ mutantsTimeout++;
77
+ }
78
+ return { mutantsKilled, mutantsSurvived, mutantsTimeout };
79
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"report-builder.d.ts","sourceRoot":"","sources":["../../../src/services/mut/report-builder.ts"],"names":[],"mappings":"AAcA,OAAO,EAEL,KAAK,gBAAgB,EAErB,KAAK,cAAc,EACnB,KAAK,aAAa,EACnB,MAAM,YAAY,CAAC;AACpB,OAAO,EAGL,KAAK,UAAU,EAChB,MAAM,iBAAiB,CAAC;AAEzB,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC,QAAQ,CAAC,UAAU,EAAE,gBAAgB,CAAC;IACtC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,UAAU,CAAC,EAAE,UAAU,CAAC;IACjC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B;AAuED,wBAAsB,cAAc,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC,CAuCjF"}
1
+ {"version":3,"file":"report-builder.d.ts","sourceRoot":"","sources":["../../../src/services/mut/report-builder.ts"],"names":[],"mappings":"AAcA,OAAO,EAEL,KAAK,gBAAgB,EAErB,KAAK,cAAc,EACnB,KAAK,aAAa,EACnB,MAAM,YAAY,CAAC;AACpB,OAAO,EAA0C,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE1F,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC,QAAQ,CAAC,UAAU,EAAE,gBAAgB,CAAC;IACtC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,UAAU,CAAC,EAAE,UAAU,CAAC;IACjC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B;AAuED,wBAAsB,cAAc,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC,CAuCjF"}
@@ -12,8 +12,8 @@
12
12
  import { createHash } from 'node:crypto';
13
13
  import { mkdir, rename, unlink, writeFile } from 'node:fs/promises';
14
14
  import { dirname } from 'node:path';
15
- import { MutReportSchema, } from './types.js';
16
- import { DEFAULT_THRESHOLDS, evaluateThresholds, } from './thresholds.js';
15
+ import { MutReportSchema } from './types.js';
16
+ import { DEFAULT_THRESHOLDS, evaluateThresholds } from './thresholds.js';
17
17
  function deriveFollowups(m, a, t) {
18
18
  const out = [];
19
19
  if (m.killRate < t.mutationKillRateMin) {
@@ -23,7 +23,7 @@ function deriveFollowups(m, a, t) {
23
23
  file: f.file,
24
24
  issue: 'low_kill_rate',
25
25
  severity: 'soft',
26
- suggestion: `Add tests for ${f.survived.length} survived mutants in ${f.file}`,
26
+ suggestion: `Add tests for ${f.survived.length} survived mutants in ${f.file}`
27
27
  });
28
28
  }
29
29
  }
@@ -36,7 +36,7 @@ function deriveFollowups(m, a, t) {
36
36
  file: exampleFile,
37
37
  issue: 'high_weak_assertions',
38
38
  severity: 'hard',
39
- suggestion: `Replace ${p.count} weak assertions of type "${p.pattern}" with concrete value checks`,
39
+ suggestion: `Replace ${p.count} weak assertions of type "${p.pattern}" with concrete value checks`
40
40
  });
41
41
  }
42
42
  }
@@ -89,9 +89,9 @@ export async function buildMutReport(input) {
89
89
  thresholds: {
90
90
  mutationKillRateMin: thresholds.mutationKillRateMin,
91
91
  weakAssertionRateMax: thresholds.weakAssertionRateMax,
92
- passed: evalResult.passed,
92
+ passed: evalResult.passed
93
93
  },
94
- followups,
94
+ followups
95
95
  };
96
96
  const sha256 = computeMutSig(partial);
97
97
  const final = { ...partial, sha256 };
@@ -1 +1 @@
1
- {"version":3,"file":"report-loader.d.ts","sourceRoot":"","sources":["../../../src/services/mut/report-loader.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAmB,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAEjE,eAAO,MAAM,wBAAwB,wBAAwB,CAAC;AAE9D;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CA8BpF"}
1
+ {"version":3,"file":"report-loader.d.ts","sourceRoot":"","sources":["../../../src/services/mut/report-loader.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAmB,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAEjE,eAAO,MAAM,wBAAwB,wBAAwB,CAAC;AAE9D;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CA+BpF"}
@@ -56,7 +56,8 @@ export async function loadMutReport(sessionId) {
56
56
  try {
57
57
  raw = await readFile(path, 'utf8');
58
58
  }
59
- catch { // TODO(g2): legacy silent catch — grace: 1 minor release (v2.14.0)
59
+ catch {
60
+ // TODO(g2): legacy silent catch — grace: 1 minor release (v2.14.0)
60
61
  // ENOENT or permission denied — both treated as "not run".
61
62
  return null;
62
63
  }
@@ -1,6 +1,6 @@
1
1
  export const DEFAULT_THRESHOLDS = Object.freeze({
2
- mutationKillRateMin: 0.80,
3
- weakAssertionRateMax: 0.05,
2
+ mutationKillRateMin: 0.8,
3
+ weakAssertionRateMax: 0.05
4
4
  });
5
5
  export function evaluateThresholds(t, actualKillRate, actualWeakRate) {
6
6
  const violations = [];
@@ -8,14 +8,14 @@ export function evaluateThresholds(t, actualKillRate, actualWeakRate) {
8
8
  violations.push({
9
9
  kind: 'mutationKillRateMin',
10
10
  actual: actualKillRate,
11
- threshold: t.mutationKillRateMin,
11
+ threshold: t.mutationKillRateMin
12
12
  });
13
13
  }
14
14
  if (actualWeakRate > t.weakAssertionRateMax) {
15
15
  violations.push({
16
16
  kind: 'weakAssertionRateMax',
17
17
  actual: actualWeakRate,
18
- threshold: t.weakAssertionRateMax,
18
+ threshold: t.weakAssertionRateMax
19
19
  });
20
20
  }
21
21
  return { passed: violations.length === 0, violations };
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/services/mut/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,MAAM,UAAU,GAAG,KAAK,CAAC;AAC/B,MAAM,MAAM,OAAO,GAAG,SAAS,GAAG,QAAQ,GAAG,cAAc,CAAC;AAE5D,MAAM,MAAM,WAAW,GACnB,aAAa,GAAG,YAAY,GAAG,cAAc,GAAG,iBAAiB,GAAG,WAAW,CAAC;AAEpF,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;CAClC;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC,cAAc,CAAC,CAAC;CAClD;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CA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,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,MAAM,CAAC;AAC/C,MAAM,MAAM,aAAa,GAAG,eAAe,GAAG,sBAAsB,CAAC;AAErE,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;IACpC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC,QAAQ,CAAC,UAAU,EAAE,gBAAgB,CAAC;IACtC,QAAQ,CAAC,UAAU,EAAE,gBAAgB,CAAC;IACtC,QAAQ,CAAC,SAAS,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;CAC7C;AAED,eAAO,MAAM,iBAAiB;;;;;;EAM5B,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAyD1B,CAAC"}
@@ -7,7 +7,11 @@
7
7
  */
8
8
  import { z } from 'zod';
9
9
  export const WeakPatternSchema = z.enum([
10
- 'toBeDefined', 'toBeTruthy', 'toEqual-self', 'expect-anything', 'toBe-self',
10
+ 'toBeDefined',
11
+ 'toBeTruthy',
12
+ 'toEqual-self',
13
+ 'expect-anything',
14
+ 'toBe-self'
11
15
  ]);
12
16
  export const MutReportSchema = z.object({
13
17
  version: z.literal('1.0'),
@@ -27,9 +31,9 @@ export const MutReportSchema = z.object({
27
31
  survived: z.array(z.object({
28
32
  line: z.number().int(),
29
33
  mutation: z.string(),
30
- survivedBecause: z.string(),
31
- })),
32
- })),
34
+ survivedBecause: z.string()
35
+ }))
36
+ }))
33
37
  }),
34
38
  assertions: z.object({
35
39
  totalAssertions: z.number().int().gte(0),
@@ -41,19 +45,19 @@ export const MutReportSchema = z.object({
41
45
  examples: z.array(z.object({
42
46
  file: z.string(),
43
47
  line: z.number().int(),
44
- code: z.string(),
45
- })),
46
- })),
48
+ code: z.string()
49
+ }))
50
+ }))
47
51
  }),
48
52
  thresholds: z.object({
49
53
  mutationKillRateMin: z.number().min(0).max(1),
50
54
  weakAssertionRateMax: z.number().min(0).max(1),
51
- passed: z.boolean(),
55
+ passed: z.boolean()
52
56
  }),
53
57
  followups: z.array(z.object({
54
58
  file: z.string(),
55
59
  issue: z.enum(['low_kill_rate', 'high_weak_assertions']),
56
60
  severity: z.enum(['soft', 'hard']),
57
- suggestion: z.string(),
58
- })),
61
+ suggestion: z.string()
62
+ }))
59
63
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "peaks-loop-mut",
3
- "version": "0.1.52",
3
+ "version": "0.1.55",
4
4
  "description": "Mutation testing + assertion scanning + ECC cache for peaks-loop (workspace-internal)",
5
5
  "keywords": [
6
6
  "peaks-loop",
@@ -28,6 +28,7 @@
28
28
  "node": ">=20.0.0"
29
29
  },
30
30
  "dependencies": {
31
+ "ecc-universal": "^2.2.3",
31
32
  "zod": "^4.4.3"
32
33
  },
33
34
  "publishConfig": {
@@ -1,172 +0,0 @@
1
- /**
2
- * ECC cache service — Slice 3 of 4.0.0-beta.11.
3
- *
4
- * Drop-in replacement for the deleted `ecc-agent-service.ts`. The
5
- * pre-Slice-3 implementation shelled out to `npx ecc agent run ...`,
6
- * but the upstream `affaan-m/everything-claude-code` v2.0.0 release
7
- * has NO `ecc` binary — the repo is `agents/*.md` flat files plus
8
- * SKILL.md descriptors. The peaks-loop path is therefore download
9
- * + cache only; the LLM consumes cached `agents/*.md` directly
10
- * through `peaks ecc show <name>`.
11
- *
12
- * Six cache exports per RD §2:
13
- * - setCacheDirPermissions
14
- * - downloadToCache
15
- * - readCacheManifest
16
- * - listCachedAgents
17
- * - readAgentSkill
18
- * - cleanupStaleCache
19
- *
20
- * Slice A of 2026-09-09-ecc-dynamic adds the plugin-free materialize
21
- * layer (`materializeEccAgents` + readers) that copies the active sha's
22
- * `agents/*.md` into `~/.peaks/agents/ecc/` so the RD fan-out works on a
23
- * machine with no ECC Claude Code plugin.
24
- *
25
- * The cache layout is `~/.peaks/cache/ecc-installed.json` (manifest)
26
- * + `~/.peaks/cache/ecc-<sha>/agents/<name>.md`. The manifest is
27
- * the active-cache pointer; cleanupStaleCache iterates the on-disk
28
- * sha directories and decides based on the manifest's `fetchedAt`
29
- * (active) vs `mtimeMs` (orphan).
30
- *
31
- * Hard contracts (Karpathy #2 Simplicity First):
32
- * - No subprocess plumbing. Network is `fetch()` only.
33
- * - No factory; one module, six functions, six dependencies.
34
- * - Strict selective extract: agents/*.md only, no symlinks, no
35
- * `..`, no absolute paths, no devices.
36
- * - D-009 fallback: parseFrontmatter throws on malformed input —
37
- * wrap it in try/catch and synthesize `{name, description}`
38
- * from the file name + first non-empty body line.
39
- * - D-010 fallback order (2026-09-09, leads with what actually works):
40
- * 1. `tarball_url` from `releases/tags/<ref>` — the only path that
41
- * serves a tarball on upstream v2.2.0. Must be fetched with
42
- * `accept: application/vnd.github+json`; GitHub's API tarball
43
- * endpoint answers 415 to `application/octet-stream`.
44
- * 2. release asset named `ecc.tar.gz` or any `.tgz` / `.tar.gz`.
45
- * 3. PRD's `ecc.tar.gz` asset URL — dead today (v2.2.0 ships only
46
- * `.png` assets) but kept as last resort in case a future
47
- * release ships the asset again.
48
- */
49
- export declare const ECC_REPO_OWNER = "affaan-m";
50
- export declare const ECC_REPO_NAME = "ECC";
51
- export type CacheManifest = {
52
- version: string;
53
- sha: string;
54
- fetchedAt: string;
55
- agents: string[];
56
- };
57
- export type DownloadResult = {
58
- sha: string;
59
- agents: number;
60
- };
61
- /**
62
- * Peaks-owned materialize manifest. Written next to the normalized
63
- * agent copies under `~/.peaks/agents/ecc/`. Unlike the cache manifest
64
- * (which points at a sha dir), this one records the *stable* copy the
65
- * plugin-free dispatch path reads when no ECC Claude Code plugin is
66
- * installed.
67
- */
68
- export type EccMaterializeManifest = {
69
- version: string;
70
- sha: string;
71
- materializedAt: string;
72
- agents: string[];
73
- };
74
- /**
75
- * Cache dir resolution — single source of truth. Tests inject
76
- * via `dirOverride` on the functions that take one.
77
- */
78
- export declare function resolveEccCacheDir(): string;
79
- export declare function resolveManifestPath(dirOverride?: string): string;
80
- export declare function resolveShaDir(sha: string, dirOverride?: string): string;
81
- export declare function resolveAgentsDir(sha: string, dirOverride?: string): string;
82
- /**
83
- * Plugin-free materialize target: `~/.peaks/agents/ecc/`.
84
- *
85
- * Deliberately NOT under `~/.claude/` — peaks-loop must never write into
86
- * the user's Claude Code tree (user direction 2026-09-09). The LLM reads
87
- * `<target>/<agent-name>.md` directly when the ECC Claude Code plugin is
88
- * absent, then dispatches a generic sub-agent with that body.
89
- */
90
- export declare function resolveEccMaterializedDir(): string;
91
- export declare function resolveEccMaterializedManifestPath(dirOverride?: string): string;
92
- /**
93
- * Best-effort chmod 0o700 on POSIX; no-op on Windows (NTFS uses
94
- * ACLs, not POSIX mode bits). Swallows errors with WARN so a
95
- * permissions failure never blocks the CLI.
96
- */
97
- export declare function setCacheDirPermissions(cacheDir: string): void;
98
- /**
99
- * Download ECC into `~/.peaks/cache/ecc-<sha>/agents/`. Returns
100
- * the resolved SHA + the number of agents extracted.
101
- *
102
- * Throws `Error('fetch-failed')` on network failure so the CLI
103
- * layer can render the manual-install instructions.
104
- */
105
- export declare function downloadToCache({ ref }?: {
106
- ref?: string;
107
- }): Promise<DownloadResult>;
108
- export declare function readCacheManifest(): CacheManifest | null;
109
- export declare function listCachedAgents(): {
110
- name: string;
111
- description: string;
112
- }[];
113
- export declare function readAgentSkill(name: string): string | null;
114
- export declare function readEccMaterializeManifest(dirOverride?: string): EccMaterializeManifest | null;
115
- export declare function listMaterializedAgents(dirOverride?: string): string[];
116
- export declare function hasMaterializedEccAgents(dirOverride?: string): boolean;
117
- /**
118
- * Resolve the materialized ECC agent name for a logical role.
119
- *
120
- * Upstream ECC names its agents `<lang>-reviewer` (`code-reviewer.md`),
121
- * NOT `code-review.md` — so no caller may hardcode a single filename.
122
- * Resolution order (deterministic; `listMaterializedAgents` is sorted):
123
- * 1. the caller's explicit candidates, in declared priority order
124
- * (e.g. `['code-reviewer', 'code-review']` — real upstream name
125
- * first, legacy/forward-compat second);
126
- * 2. a fallback over the materialized list: the exact
127
- * `<stem>-reviewer`, else the first `<stem>-*` whose name contains
128
- * `reviewer`, where `stem` is the candidate minus a `-reviewer`
129
- * suffix (`code-reviewer` -> `code`).
130
- *
131
- * Returns `null` when nothing matches — the caller degrades to inline
132
- * review instead of dispatching a non-existent agent.
133
- */
134
- export declare function resolveMaterializedAgentName(candidates: readonly string[], dirOverride?: string): string | null;
135
- export declare function readMaterializedAgent(name: string, dirOverride?: string): string | null;
136
- /**
137
- * Copy the active cache's `agents/*.md` into a stable, peaks-owned
138
- * directory (`~/.peaks/agents/ecc/` by default) and write a small
139
- * manifest. Fail-soft: an empty/missing cache yields
140
- * `{ sha: null, materialized: [] }` and never throws — `peaks ecc install`
141
- * must not fail because materialization did.
142
- *
143
- * `targetDir` is the ONLY write root (plus `mkdirSync` on it). Nothing in
144
- * this function can reach `~/.claude/`.
145
- */
146
- export declare function materializeEccAgents({ cacheDir, targetDir }?: {
147
- cacheDir?: string;
148
- targetDir?: string;
149
- }): {
150
- targetDir: string;
151
- sha: string | null;
152
- materialized: string[];
153
- };
154
- /**
155
- * 7-day TTL sweep over `ecc-<sha>/` directories.
156
- *
157
- * - Active cache (per manifest `sha`): use `fetchedAt` as the
158
- * age source; remove if older than `retentionDays`.
159
- * - Orphan caches (any other `ecc-<40hex>` directory): use
160
- * directory `mtimeMs` as the age source.
161
- * - If the active cache is removed, invalidate the manifest.
162
- *
163
- * Returns the absolute paths of the removed directories.
164
- */
165
- export declare function cleanupStaleCache({ retentionDays, nowMs, dirOverride, }: {
166
- retentionDays: number;
167
- nowMs: number;
168
- dirOverride?: string;
169
- }): {
170
- removed: string[];
171
- };
172
- //# sourceMappingURL=ecc-cache-service.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ecc-cache-service.d.ts","sourceRoot":"","sources":["../../../src/services/agent/ecc-cache-service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAgBH,eAAO,MAAM,cAAc,aAAa,CAAC;AAGzC,eAAO,MAAM,aAAa,QAAQ,CAAC;AAOnC,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAEF;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C;AAED,wBAAgB,mBAAmB,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAEhE;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAEvE;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAA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