@productbrain/cli 0.1.0-beta.11522 → 0.1.0-beta.11531

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 (166) hide show
  1. package/README.md +1 -1
  2. package/dist/commands/scoreboard.d.ts +1 -1
  3. package/dist/commands/scoreboard.d.ts.map +1 -1
  4. package/dist/commands/scoreboard.js +3 -2
  5. package/dist/commands/scoreboard.js.map +1 -1
  6. package/dist/commands/scoreboard.test.d.ts +2 -0
  7. package/dist/commands/scoreboard.test.d.ts.map +1 -0
  8. package/dist/commands/scoreboard.test.js +54 -0
  9. package/dist/commands/scoreboard.test.js.map +1 -0
  10. package/dist/formatters/scoreboard.test.js +0 -1
  11. package/dist/formatters/scoreboard.test.js.map +1 -1
  12. package/dist/lib/ruleListRender.d.ts +0 -5
  13. package/dist/lib/ruleListRender.d.ts.map +1 -1
  14. package/dist/lib/ruleListRender.js +1 -26
  15. package/dist/lib/ruleListRender.js.map +1 -1
  16. package/dist/scoreboard/diagnose.d.ts +0 -6
  17. package/dist/scoreboard/diagnose.d.ts.map +1 -1
  18. package/dist/scoreboard/diagnose.js +1 -1
  19. package/dist/scoreboard/diagnose.js.map +1 -1
  20. package/dist/scoreboard/diagnose.test.js +0 -1
  21. package/dist/scoreboard/diagnose.test.js.map +1 -1
  22. package/package.json +1 -1
  23. package/dist/__tests__/adapters.test.d.ts +0 -2
  24. package/dist/__tests__/adapters.test.d.ts.map +0 -1
  25. package/dist/__tests__/adapters.test.js +0 -443
  26. package/dist/__tests__/adapters.test.js.map +0 -1
  27. package/dist/__tests__/batch-transformations.test.d.ts +0 -2
  28. package/dist/__tests__/batch-transformations.test.d.ts.map +0 -1
  29. package/dist/__tests__/batch-transformations.test.js +0 -239
  30. package/dist/__tests__/batch-transformations.test.js.map +0 -1
  31. package/dist/__tests__/hook-intents.test.d.ts +0 -2
  32. package/dist/__tests__/hook-intents.test.d.ts.map +0 -1
  33. package/dist/__tests__/hook-intents.test.js +0 -172
  34. package/dist/__tests__/hook-intents.test.js.map +0 -1
  35. package/dist/__tests__/manifest.test.d.ts +0 -6
  36. package/dist/__tests__/manifest.test.d.ts.map +0 -1
  37. package/dist/__tests__/manifest.test.js +0 -255
  38. package/dist/__tests__/manifest.test.js.map +0 -1
  39. package/dist/__tests__/perimeter.test.d.ts +0 -2
  40. package/dist/__tests__/perimeter.test.d.ts.map +0 -1
  41. package/dist/__tests__/perimeter.test.js +0 -165
  42. package/dist/__tests__/perimeter.test.js.map +0 -1
  43. package/dist/__tests__/personal-layer.test.d.ts +0 -11
  44. package/dist/__tests__/personal-layer.test.d.ts.map +0 -1
  45. package/dist/__tests__/personal-layer.test.js +0 -268
  46. package/dist/__tests__/personal-layer.test.js.map +0 -1
  47. package/dist/__tests__/surface-profiles.test.d.ts +0 -2
  48. package/dist/__tests__/surface-profiles.test.d.ts.map +0 -1
  49. package/dist/__tests__/surface-profiles.test.js +0 -233
  50. package/dist/__tests__/surface-profiles.test.js.map +0 -1
  51. package/dist/__tests__/surfaces.test.d.ts +0 -2
  52. package/dist/__tests__/surfaces.test.d.ts.map +0 -1
  53. package/dist/__tests__/surfaces.test.js +0 -45
  54. package/dist/__tests__/surfaces.test.js.map +0 -1
  55. package/dist/generators/adapters.d.ts +0 -77
  56. package/dist/generators/adapters.d.ts.map +0 -1
  57. package/dist/generators/adapters.js +0 -286
  58. package/dist/generators/adapters.js.map +0 -1
  59. package/dist/generators/adapters.test.d.ts +0 -2
  60. package/dist/generators/adapters.test.d.ts.map +0 -1
  61. package/dist/generators/adapters.test.js +0 -36
  62. package/dist/generators/adapters.test.js.map +0 -1
  63. package/dist/generators/boundary-manifest.d.ts +0 -29
  64. package/dist/generators/boundary-manifest.d.ts.map +0 -1
  65. package/dist/generators/boundary-manifest.js +0 -183
  66. package/dist/generators/boundary-manifest.js.map +0 -1
  67. package/dist/generators/boundary-manifest.test.d.ts +0 -2
  68. package/dist/generators/boundary-manifest.test.d.ts.map +0 -1
  69. package/dist/generators/boundary-manifest.test.js +0 -91
  70. package/dist/generators/boundary-manifest.test.js.map +0 -1
  71. package/dist/generators/briefing-projections.test.d.ts +0 -2
  72. package/dist/generators/briefing-projections.test.d.ts.map +0 -1
  73. package/dist/generators/briefing-projections.test.js +0 -71
  74. package/dist/generators/briefing-projections.test.js.map +0 -1
  75. package/dist/generators/manifest.d.ts +0 -115
  76. package/dist/generators/manifest.d.ts.map +0 -1
  77. package/dist/generators/manifest.js +0 -277
  78. package/dist/generators/manifest.js.map +0 -1
  79. package/dist/generators/noProjectionAssets.d.ts +0 -15
  80. package/dist/generators/noProjectionAssets.d.ts.map +0 -1
  81. package/dist/generators/noProjectionAssets.js +0 -6
  82. package/dist/generators/noProjectionAssets.js.map +0 -1
  83. package/dist/generators/portable-knowledge.d.ts +0 -142
  84. package/dist/generators/portable-knowledge.d.ts.map +0 -1
  85. package/dist/generators/portable-knowledge.js +0 -482
  86. package/dist/generators/portable-knowledge.js.map +0 -1
  87. package/dist/generators/portable-knowledge.test.d.ts +0 -2
  88. package/dist/generators/portable-knowledge.test.d.ts.map +0 -1
  89. package/dist/generators/portable-knowledge.test.js +0 -742
  90. package/dist/generators/portable-knowledge.test.js.map +0 -1
  91. package/dist/generators/region-projections.d.ts +0 -17
  92. package/dist/generators/region-projections.d.ts.map +0 -1
  93. package/dist/generators/region-projections.js +0 -51
  94. package/dist/generators/region-projections.js.map +0 -1
  95. package/dist/generators/region-projections.test.d.ts +0 -2
  96. package/dist/generators/region-projections.test.d.ts.map +0 -1
  97. package/dist/generators/region-projections.test.js +0 -58
  98. package/dist/generators/region-projections.test.js.map +0 -1
  99. package/dist/generators/region.d.ts +0 -24
  100. package/dist/generators/region.d.ts.map +0 -1
  101. package/dist/generators/region.js +0 -87
  102. package/dist/generators/region.js.map +0 -1
  103. package/dist/generators/region.test.d.ts +0 -2
  104. package/dist/generators/region.test.d.ts.map +0 -1
  105. package/dist/generators/region.test.js +0 -125
  106. package/dist/generators/region.test.js.map +0 -1
  107. package/dist/generators/surface-profiles.d.ts +0 -48
  108. package/dist/generators/surface-profiles.d.ts.map +0 -1
  109. package/dist/generators/surface-profiles.js +0 -98
  110. package/dist/generators/surface-profiles.js.map +0 -1
  111. package/dist/lib/frontmatter.d.ts +0 -55
  112. package/dist/lib/frontmatter.d.ts.map +0 -1
  113. package/dist/lib/frontmatter.js +0 -92
  114. package/dist/lib/frontmatter.js.map +0 -1
  115. package/dist/lib/frontmatter.test.d.ts +0 -15
  116. package/dist/lib/frontmatter.test.d.ts.map +0 -1
  117. package/dist/lib/frontmatter.test.js +0 -98
  118. package/dist/lib/frontmatter.test.js.map +0 -1
  119. package/dist/lib/hook-intents.d.ts +0 -56
  120. package/dist/lib/hook-intents.d.ts.map +0 -1
  121. package/dist/lib/hook-intents.js +0 -84
  122. package/dist/lib/hook-intents.js.map +0 -1
  123. package/dist/lib/writePerimeter.d.ts +0 -72
  124. package/dist/lib/writePerimeter.d.ts.map +0 -1
  125. package/dist/lib/writePerimeter.js +0 -128
  126. package/dist/lib/writePerimeter.js.map +0 -1
  127. package/dist/surfaces/__tests__/adapter.test.d.ts +0 -2
  128. package/dist/surfaces/__tests__/adapter.test.d.ts.map +0 -1
  129. package/dist/surfaces/__tests__/adapter.test.js +0 -86
  130. package/dist/surfaces/__tests__/adapter.test.js.map +0 -1
  131. package/dist/surfaces/__tests__/claude-skill-pointer-drift.test.d.ts +0 -2
  132. package/dist/surfaces/__tests__/claude-skill-pointer-drift.test.d.ts.map +0 -1
  133. package/dist/surfaces/__tests__/claude-skill-pointer-drift.test.js +0 -180
  134. package/dist/surfaces/__tests__/claude-skill-pointer-drift.test.js.map +0 -1
  135. package/dist/surfaces/__tests__/telemetry.test.d.ts +0 -2
  136. package/dist/surfaces/__tests__/telemetry.test.d.ts.map +0 -1
  137. package/dist/surfaces/__tests__/telemetry.test.js +0 -44
  138. package/dist/surfaces/__tests__/telemetry.test.js.map +0 -1
  139. package/dist/surfaces/adapter.d.ts +0 -70
  140. package/dist/surfaces/adapter.d.ts.map +0 -1
  141. package/dist/surfaces/adapter.js +0 -2
  142. package/dist/surfaces/adapter.js.map +0 -1
  143. package/dist/surfaces/adapters/claude.d.ts +0 -3
  144. package/dist/surfaces/adapters/claude.d.ts.map +0 -1
  145. package/dist/surfaces/adapters/claude.js +0 -72
  146. package/dist/surfaces/adapters/claude.js.map +0 -1
  147. package/dist/surfaces/adapters/codex.d.ts +0 -3
  148. package/dist/surfaces/adapters/codex.d.ts.map +0 -1
  149. package/dist/surfaces/adapters/codex.js +0 -61
  150. package/dist/surfaces/adapters/codex.js.map +0 -1
  151. package/dist/surfaces/adapters/copilot.d.ts +0 -3
  152. package/dist/surfaces/adapters/copilot.d.ts.map +0 -1
  153. package/dist/surfaces/adapters/copilot.js +0 -59
  154. package/dist/surfaces/adapters/copilot.js.map +0 -1
  155. package/dist/surfaces/adapters/cursor.d.ts +0 -3
  156. package/dist/surfaces/adapters/cursor.d.ts.map +0 -1
  157. package/dist/surfaces/adapters/cursor.js +0 -78
  158. package/dist/surfaces/adapters/cursor.js.map +0 -1
  159. package/dist/surfaces/registry.d.ts +0 -76
  160. package/dist/surfaces/registry.d.ts.map +0 -1
  161. package/dist/surfaces/registry.js +0 -117
  162. package/dist/surfaces/registry.js.map +0 -1
  163. package/dist/surfaces/telemetry.d.ts +0 -24
  164. package/dist/surfaces/telemetry.d.ts.map +0 -1
  165. package/dist/surfaces/telemetry.js +0 -25
  166. package/dist/surfaces/telemetry.js.map +0 -1
@@ -1,72 +0,0 @@
1
- /**
2
- * Claude Code SurfaceAdapter — WP-421 S2c (DEC-952).
3
- *
4
- * Projects:
5
- * - hooks → .claude/settings.json (handled outside the per-asset transform path)
6
- *
7
- * The skill kind has no claude WRITE projection (E4b, WP-761/TASK-249): the repo's one
8
- * statement of where a Claude skill is written is the directory-form pointer file
9
- * (.claude/skills/<name>/SKILL.md, E4a); canonicalPathFor below still reverse-maps the
10
- * legacy flat form for orphan detection.
11
- *
12
- * Rules (`.claude/rules/<name>.md`) and the skill router (`.claude/rules/skill-router.md`)
13
- * are NOT projected here or anywhere else — DEC-1736 (WP-759/TASK-234): pb writes no
14
- * `.claude/rules/*`.
15
- */
16
- import { existsSync } from 'fs';
17
- import { join } from 'path';
18
- function transform(input) {
19
- const { canonical } = input;
20
- if (canonical.kind === 'rule') {
21
- // The rule kind has no claude projection (DEC-1736, WP-759/TASK-234) — an unhandled kind
22
- // here is a caller bug, not a silent no-op.
23
- throw new Error('claude adapter does not project the rule kind');
24
- }
25
- // Skill kind: transform still returns the canonical body verbatim (used by goldens and by
26
- // callers projecting through other means); there is no claude WRITE path for it (see paths()).
27
- return canonical.body;
28
- }
29
- function paths(asset) {
30
- switch (asset.kind) {
31
- case 'hook':
32
- return { projectionPath: '.claude/settings.json' };
33
- default:
34
- // DEC-1736: the rule kind has no claude projection path.
35
- // E4b (WP-761/TASK-249): the skill kind has no claude WRITE path either — the
36
- // flat .claude/skills/<name>.md declaration is deleted so the repo holds exactly
37
- // one statement of where a Claude skill is written (the E4a directory-form pointer).
38
- throw new Error(`claude adapter has no projection path for asset kind "${asset.kind}"`);
39
- }
40
- }
41
- const goldenSkill = {
42
- name: 'sample-skill',
43
- description: 'Sample skill for golden test',
44
- triggers: ['/sample'],
45
- body: 'Reference .productbrain/skills/other.md inside the body.\n',
46
- sourcePath: '/abs/.productbrain/skills/sample-skill.md',
47
- };
48
- const goldens = [
49
- {
50
- name: 'skill-verbatim-body',
51
- canonical: { kind: 'skill', ...goldenSkill },
52
- expected: goldenSkill.body,
53
- },
54
- ];
55
- function canonicalPathFor(projectionPath) {
56
- // Normalize: accept paths with or without leading "./".
57
- const p = projectionPath.replace(/^\.\//, '');
58
- const m = p.match(/^\.claude\/skills\/(.+)\.md$/);
59
- if (m)
60
- return `.productbrain/skills/${m[1]}.md`;
61
- return null;
62
- }
63
- export const claudeAdapter = {
64
- name: 'claude',
65
- displayName: 'Claude Code',
66
- detect: (repoRoot) => existsSync(join(repoRoot, '.claude')),
67
- paths,
68
- transform,
69
- goldens,
70
- canonicalPathFor,
71
- };
72
- //# sourceMappingURL=claude.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"claude.js","sourceRoot":"","sources":["../../../src/surfaces/adapters/claude.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAW5B,SAAS,SAAS,CAAC,KAA2E;IAC5F,MAAM,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;IAC5B,IAAI,SAAS,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;QAC9B,yFAAyF;QACzF,4CAA4C;QAC5C,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;IACnE,CAAC;IACD,0FAA0F;IAC1F,+FAA+F;IAC/F,OAAO,SAAS,CAAC,IAAI,CAAC;AACxB,CAAC;AAED,SAAS,KAAK,CAAC,KAAsB;IACnC,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;QACnB,KAAK,MAAM;YACT,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,CAAC;QACrD;YACE,yDAAyD;YACzD,8EAA8E;YAC9E,iFAAiF;YACjF,qFAAqF;YACrF,MAAM,IAAI,KAAK,CAAC,yDAAyD,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC;IAC5F,CAAC;AACH,CAAC;AAED,MAAM,WAAW,GAAmB;IAClC,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,8BAA8B;IAC3C,QAAQ,EAAE,CAAC,SAAS,CAAC;IACrB,IAAI,EAAE,4DAA4D;IAClE,UAAU,EAAE,2CAA2C;CACxD,CAAC;AAEF,MAAM,OAAO,GAAoB;IAC/B;QACE,IAAI,EAAE,qBAAqB;QAC3B,SAAS,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,WAAW,EAAE;QAC5C,QAAQ,EAAE,WAAW,CAAC,IAAI;KAC3B;CACF,CAAC;AAEF,SAAS,gBAAgB,CAAC,cAAsB;IAC9C,wDAAwD;IACxD,MAAM,CAAC,GAAG,cAAc,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IAC9C,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAC;IAClD,IAAI,CAAC;QAAE,OAAO,wBAAwB,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IAChD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,CAAC,MAAM,aAAa,GAAmB;IAC3C,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,aAAa;IAC1B,MAAM,EAAE,CAAC,QAAgB,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IACnE,KAAK;IACL,SAAS;IACT,OAAO;IACP,gBAAgB;CACjB,CAAC"}
@@ -1,3 +0,0 @@
1
- import type { SurfaceAdapter } from '../adapter.js';
2
- export declare const codexAdapter: SurfaceAdapter;
3
- //# sourceMappingURL=codex.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"codex.d.ts","sourceRoot":"","sources":["../../../src/surfaces/adapters/codex.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAGV,cAAc,EAIf,MAAM,eAAe,CAAC;AA8CvB,eAAO,MAAM,YAAY,EAAE,cAS1B,CAAC"}
@@ -1,61 +0,0 @@
1
- /**
2
- * Codex SurfaceAdapter — WP-421 S2c (DEC-952).
3
- *
4
- * Projects:
5
- * - skills → .codex/skills/<name>.md
6
- * - rules: not projected (codex consumes AGENTS.md instead).
7
- * - hooks → AGENTS.md (handled outside per-asset transform path).
8
- */
9
- import { existsSync } from 'fs';
10
- import { join } from 'path';
11
- import { generateCodexSkill } from '../../generators/portable-knowledge.js';
12
- function transform(input) {
13
- const { canonical } = input;
14
- if (canonical.kind === 'skill')
15
- return generateCodexSkill(canonical);
16
- // Rules are not projected to codex; pass body through unchanged for completeness.
17
- return canonical.body;
18
- }
19
- function paths(asset) {
20
- switch (asset.kind) {
21
- case 'skill':
22
- return { projectionPath: `.codex/skills/${asset.basename}.md` };
23
- case 'rule':
24
- // Codex has no per-rule projection target — return AGENTS.md for callers
25
- // that need a path; handshake won't actually write rules here.
26
- return { projectionPath: 'AGENTS.md' };
27
- case 'hook':
28
- return { projectionPath: 'AGENTS.md' };
29
- }
30
- }
31
- const goldenSkill = {
32
- name: 'sample-skill',
33
- description: 'Sample skill for golden test',
34
- triggers: ['/sample'],
35
- body: 'Reference .productbrain/skills/other.md inside the body.\n',
36
- sourcePath: '/abs/.productbrain/skills/sample-skill.md',
37
- };
38
- const goldens = [
39
- {
40
- name: 'skill-with-canonical-path-rewrite',
41
- canonical: { kind: 'skill', ...goldenSkill },
42
- expected: generateCodexSkill(goldenSkill),
43
- },
44
- ];
45
- function canonicalPathFor(projectionPath) {
46
- const p = projectionPath.replace(/^\.\//, '');
47
- const m = p.match(/^\.codex\/skills\/(.+)\.md$/);
48
- if (m)
49
- return `.productbrain/skills/${m[1]}.md`;
50
- return null;
51
- }
52
- export const codexAdapter = {
53
- name: 'codex',
54
- displayName: 'Codex',
55
- detect: (repoRoot) => existsSync(join(repoRoot, '.codex')) || existsSync(join(repoRoot, 'AGENTS.md')),
56
- paths,
57
- transform,
58
- goldens,
59
- canonicalPathFor,
60
- };
61
- //# sourceMappingURL=codex.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"codex.js","sourceRoot":"","sources":["../../../src/surfaces/adapters/codex.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAW5E,SAAS,SAAS,CAAC,KAA2E;IAC5F,MAAM,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;IAC5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,OAAO;IACpB,MAAM,EAAE,CAAC,QAAgB,EAAE,EAAE,CAC3B,UAAU,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;IACjF,KAAK;IACL,SAAS;IACT,OAAO;IACP,gBAAgB;CACjB,CAAC"}
@@ -1,3 +0,0 @@
1
- import type { SurfaceAdapter } from '../adapter.js';
2
- export declare const copilotAdapter: SurfaceAdapter;
3
- //# sourceMappingURL=copilot.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"copilot.d.ts","sourceRoot":"","sources":["../../../src/surfaces/adapters/copilot.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAGV,cAAc,EAIf,MAAM,eAAe,CAAC;AA2CvB,eAAO,MAAM,cAAc,EAAE,cAS5B,CAAC"}
@@ -1,59 +0,0 @@
1
- /**
2
- * Copilot SurfaceAdapter — WP-421 S2c (DEC-952).
3
- *
4
- * Copilot has only one projection target — `.github/copilot-instructions.md` — which
5
- * concatenates rule summaries. Per-skill projection is unsupported.
6
- *
7
- * canonicalPathFor returns null for the aggregate file: there is no 1:1 reverse map
8
- * (the file is generated from many sources). Consumers fall back to the generic
9
- * "edit upstream in .productbrain/{skills,rules,hooks}/" message and emit
10
- * `surface-reverse-map-missing` telemetry — see surfaces/telemetry.ts.
11
- */
12
- import { existsSync } from 'fs';
13
- import { join } from 'path';
14
- function transform(input) {
15
- // Copilot aggregates rule summaries inside copilot-instructions.md; the
16
- // single-asset transform emits the rule's summary block. Skills are not
17
- // included (matches handshake.ts behavior).
18
- const { canonical } = input;
19
- if (canonical.kind === 'rule') {
20
- return `### ${canonical.name}\n${canonical.description}\n`;
21
- }
22
- return '';
23
- }
24
- function paths(_asset) {
25
- return { projectionPath: '.github/copilot-instructions.md' };
26
- }
27
- const goldenRule = {
28
- name: 'sample-rule',
29
- description: 'Sample rule for golden test',
30
- scope: undefined,
31
- autoApply: true,
32
- body: 'unused for copilot summary',
33
- sourcePath: '/abs/.productbrain/rules/sample-rule.md',
34
- };
35
- const goldens = [
36
- {
37
- name: 'rule-summary-block',
38
- canonical: { kind: 'rule', ...goldenRule },
39
- expected: `### ${goldenRule.name}\n${goldenRule.description}\n`,
40
- },
41
- ];
42
- function canonicalPathFor(projectionPath) {
43
- // Copilot's only target file aggregates many canonical sources — no defensible
44
- // 1:1 reverse map. Return null and let consumers emit the telemetry fallback.
45
- const p = projectionPath.replace(/^\.\//, '');
46
- if (p === '.github/copilot-instructions.md')
47
- return null;
48
- return null;
49
- }
50
- export const copilotAdapter = {
51
- name: 'copilot',
52
- displayName: 'GitHub Copilot',
53
- detect: (repoRoot) => existsSync(join(repoRoot, '.github', 'copilot-instructions.md')),
54
- paths,
55
- transform,
56
- goldens,
57
- canonicalPathFor,
58
- };
59
- //# sourceMappingURL=copilot.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"copilot.js","sourceRoot":"","sources":["../../../src/surfaces/adapters/copilot.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAW5B,SAAS,SAAS,CAAC,KAA2E;IAC5F,wEAAwE;IACxE,wEAAwE;IACxE,4CAA4C;IAC5C,MAAM,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;IAC5B,IAAI,SAAS,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;QAC9B,OAAO,OAAO,SAAS,CAAC,IAAI,KAAK,SAAS,CAAC,WAAW,IAAI,CAAC;IAC7D,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,SAAS,KAAK,CAAC,MAAuB;IACpC,OAAO,EAAE,cAAc,EAAE,iCAAiC,EAAE,CAAC;AAC/D,CAAC;AAED,MAAM,UAAU,GAAkB;IAChC,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,6BAA6B;IAC1C,KAAK,EAAE,SAAS;IAChB,SAAS,EAAE,IAAI;IACf,IAAI,EAAE,4BAA4B;IAClC,UAAU,EAAE,yCAAyC;CACtD,CAAC;AAEF,MAAM,OAAO,GAAoB;IAC/B;QACE,IAAI,EAAE,oBAAoB;QAC1B,SAAS,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,UAAU,EAAE;QAC1C,QAAQ,EAAE,OAAO,UAAU,CAAC,IAAI,KAAK,UAAU,CAAC,WAAW,IAAI;KAChE;CACF,CAAC;AAEF,SAAS,gBAAgB,CAAC,cAAsB;IAC9C,+EAA+E;IAC/E,8EAA8E;IAC9E,MAAM,CAAC,GAAG,cAAc,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IAC9C,IAAI,CAAC,KAAK,iCAAiC;QAAE,OAAO,IAAI,CAAC;IACzD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,CAAC,MAAM,cAAc,GAAmB;IAC5C,IAAI,EAAE,SAAS;IACf,WAAW,EAAE,gBAAgB;IAC7B,MAAM,EAAE,CAAC,QAAgB,EAAE,EAAE,CAC3B,UAAU,CAAC,IAAI,CAAC,QAAQ,EAAE,SAAS,EAAE,yBAAyB,CAAC,CAAC;IAClE,KAAK;IACL,SAAS;IACT,OAAO;IACP,gBAAgB;CACjB,CAAC"}
@@ -1,3 +0,0 @@
1
- import type { SurfaceAdapter } from '../adapter.js';
2
- export declare const cursorAdapter: SurfaceAdapter;
3
- //# sourceMappingURL=cursor.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cursor.d.ts","sourceRoot":"","sources":["../../../src/surfaces/adapters/cursor.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAGV,cAAc,EAIf,MAAM,eAAe,CAAC;AA+DvB,eAAO,MAAM,aAAa,EAAE,cAQ3B,CAAC"}
@@ -1,78 +0,0 @@
1
- /**
2
- * Cursor SurfaceAdapter — WP-421 S2c (DEC-952).
3
- *
4
- * Projects:
5
- * - rules → .cursor/rules/<name>.mdc (note the .md → .mdc extension flip)
6
- * - skills → .cursor/skills/<name>/SKILL.md
7
- * - hooks: not supported (INS-740 — empty hookEvents)
8
- */
9
- import { existsSync } from 'fs';
10
- import { join } from 'path';
11
- import { generateCursorRule, generateCursorSkill, } from '../../generators/portable-knowledge.js';
12
- function transform(input) {
13
- const { canonical } = input;
14
- if (canonical.kind === 'rule')
15
- return generateCursorRule(canonical);
16
- return generateCursorSkill(canonical);
17
- }
18
- function paths(asset) {
19
- switch (asset.kind) {
20
- case 'rule':
21
- // .md → .mdc extension flip is the cursor-specific signature.
22
- return { projectionPath: `.cursor/rules/${asset.basename}.mdc` };
23
- case 'skill':
24
- return { projectionPath: `.cursor/skills/${asset.basename}/SKILL.md` };
25
- case 'hook':
26
- // INS-740: cursor has no native hook events. Path returned for completeness;
27
- // handshake never writes here by default.
28
- return { projectionPath: '.cursor/settings.json' };
29
- }
30
- }
31
- const goldenRule = {
32
- name: 'sample-rule',
33
- description: 'Sample rule for golden test',
34
- scope: undefined,
35
- autoApply: true,
36
- body: 'Body referencing .productbrain/rules/other.md and .productbrain/skills/x.md\n',
37
- sourcePath: '/abs/.productbrain/rules/sample-rule.md',
38
- };
39
- const goldenSkill = {
40
- name: 'sample-skill',
41
- description: 'Sample skill for golden test',
42
- triggers: ['/sample'],
43
- body: 'Reference .productbrain/skills/other.md inside the body.\n',
44
- sourcePath: '/abs/.productbrain/skills/sample-skill.md',
45
- };
46
- const goldens = [
47
- {
48
- name: 'rule-mdc-frontmatter',
49
- canonical: { kind: 'rule', ...goldenRule },
50
- expected: generateCursorRule(goldenRule),
51
- },
52
- {
53
- name: 'skill-trigger-injection',
54
- canonical: { kind: 'skill', ...goldenSkill },
55
- expected: generateCursorSkill(goldenSkill),
56
- },
57
- ];
58
- function canonicalPathFor(projectionPath) {
59
- const p = projectionPath.replace(/^\.\//, '');
60
- // Reverse the .md → .mdc extension flip on the rule projection.
61
- let m = p.match(/^\.cursor\/rules\/(.+)\.mdc$/);
62
- if (m)
63
- return `.productbrain/rules/${m[1]}.md`;
64
- m = p.match(/^\.cursor\/skills\/(.+)\/SKILL\.md$/);
65
- if (m)
66
- return `.productbrain/skills/${m[1]}.md`;
67
- return null;
68
- }
69
- export const cursorAdapter = {
70
- name: 'cursor',
71
- displayName: 'Cursor',
72
- detect: (repoRoot) => existsSync(join(repoRoot, '.cursor')),
73
- paths,
74
- transform,
75
- goldens,
76
- canonicalPathFor,
77
- };
78
- //# sourceMappingURL=cursor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cursor.js","sourceRoot":"","sources":["../../../src/surfaces/adapters/cursor.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EACL,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,wCAAwC,CAAC;AAWhD,SAAS,SAAS,CAAC,KAA2E;IAC5F,MAAM,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;IAC5B,IAAI,SAAS,CAAC,IAAI,KAAK,MAAM;QAAE,OAAO,kBAAkB,CAAC,SAAS,CAAC,CAAC;IACpE,OAAO,mBAAmB,CAAC,SAAS,CAAC,CAAC;AACxC,CAAC;AAED,SAAS,KAAK,CAAC,KAAsB;IACnC,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;QACnB,KAAK,MAAM;YACT,8DAA8D;YAC9D,OAAO,EAAE,cAAc,EAAE,iBAAiB,KAAK,CAAC,QAAQ,MAAM,EAAE,CAAC;QACnE,KAAK,OAAO;YACV,OAAO,EAAE,cAAc,EAAE,kBAAkB,KAAK,CAAC,QAAQ,WAAW,EAAE,CAAC;QACzE,KAAK,MAAM;YACT,6EAA6E;YAC7E,0CAA0C;YAC1C,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,CAAC;IACvD,CAAC;AACH,CAAC;A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AAQ;IACrB,MAAM,EAAE,CAAC,QAAgB,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IACnE,KAAK;IACL,SAAS;IACT,OAAO;IACP,gBAAgB;CACjB,CAAC"}
@@ -1,76 +0,0 @@
1
- /**
2
- * Surface Capability Registry — WP-310 S0 (FEAT-959), extended in WP-421 S2c (DEC-952).
3
- *
4
- * Static typed record of per-surface capabilities consumed by E1–E4 and the
5
- * SurfaceAdapter set introduced in WP-421 S2c. The legacy `SURFACE_REGISTRY`
6
- * shape is preserved verbatim for callers (handshake hook plumbing,
7
- * `lib/hook-intents.ts`, existing tests).
8
- *
9
- * INS-740: Cursor and Copilot had confirmed double-fire risk with Claude Code hooks.
10
- * Their hookEvents arrays MUST be empty in v1. Only 'claude' gets hook events by default.
11
- */
12
- import type { SurfaceAdapter } from './adapter.js';
13
- export type SurfaceName = 'claude' | 'cursor' | 'copilot' | 'codex';
14
- export interface SurfaceCapability {
15
- rulesFormat: 'markdown' | 'mdc';
16
- skillsFormat: 'markdown' | 'none';
17
- /** Hook events to project. Empty array = no default hook writes (INS-740 double-fire risk). */
18
- hookEvents: string[];
19
- /** Path to the surface's personal config file. */
20
- hookFilePath: string;
21
- personalConfigMechanism: 'settings_json' | 'none';
22
- supportsAgentsMd: boolean;
23
- }
24
- export declare const SURFACE_REGISTRY: Record<SurfaceName, SurfaceCapability>;
25
- /**
26
- * Per-surface adapter registry. New surface = new adapter file + line here.
27
- * Adapters expose detect/paths/transform/goldens/canonicalPathFor — one canonical
28
- * asset, many surface projections.
29
- */
30
- export declare const SURFACE_ADAPTERS: Record<SurfaceName, SurfaceAdapter>;
31
- /** Convenience array view for iteration (e.g. detect-all). */
32
- export declare const SURFACE_ADAPTER_LIST: SurfaceAdapter[];
33
- /**
34
- * Lookup the canonical authoring path for a projection path on any surface.
35
- * Returns the first non-null mapping; if every adapter returns null, returns null
36
- * and the caller MUST emit `surface-reverse-map-missing` telemetry via
37
- * `surfaces/telemetry.ts:reportReverseMapMissing`.
38
- */
39
- export declare function canonicalPathForAnySurface(projectionPath: string): {
40
- surface: SurfaceName;
41
- canonicalPath: string;
42
- } | null;
43
- /** Govern mode declared with empty surfaces[]. Hard error (handshake refuses). */
44
- export declare const SURFACE_GOVERN_NO_SURFACES: "govern-no-surfaces";
45
- /** Surface name in manifest is not registered. Advisory flag for drift report. */
46
- export declare const SURFACE_ADAPTER_MISSING: "surface-adapter-missing";
47
- /**
48
- * Result of the surfaces validation for a given authority mode.
49
- *
50
- * - `error` is set when the configuration is invalid for the requested mode
51
- * (today: only Govern + empty surfaces). Caller should refuse to proceed.
52
- * - `unregisteredSurfaces` enumerates manifest surface names that are not in
53
- * SURFACE_ADAPTERS; emit one `SURFACE_ADAPTER_MISSING` flag per entry but
54
- * do NOT fail.
55
- */
56
- export interface SurfacesValidationResult {
57
- error?: typeof SURFACE_GOVERN_NO_SURFACES;
58
- unregisteredSurfaces: string[];
59
- /** Subset of `manifest.surfaces` that resolve to a known SurfaceName. */
60
- registeredSurfaces: SurfaceName[];
61
- }
62
- /**
63
- * Validate `manifest.surfaces[]` against the requested authority mode.
64
- *
65
- * Govern + empty surfaces → `{ error: SURFACE_GOVERN_NO_SURFACES }`.
66
- * Any other mode is permitted with any (possibly empty) surface list.
67
- *
68
- * Unregistered surface names are reported via `unregisteredSurfaces` so the
69
- * caller can flag them in the drift report. Pure: no I/O, no Convex calls.
70
- *
71
- * Surface name normalization: this validator strips a leading `.` from each
72
- * entry (e.g. `.cursor` → `cursor`) so manifests can declare either form.
73
- * The canonical SurfaceName values in SURFACE_ADAPTERS use the bare name.
74
- */
75
- export declare function validateSurfacesForMode(mode: 'off' | 'observe' | 'project' | 'govern', surfacesFromManifest: string[]): SurfacesValidationResult;
76
- //# sourceMappingURL=registry.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/surfaces/registry.ts"],"names":[],"mappings":"AAAA;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AAG,SAAS,GAAG,QAAQ,EAC9C,oBAAoB,EAAE,MAAM,EAAE,GAC7B,wBAAwB,CAuB1B"}
@@ -1,117 +0,0 @@
1
- import { claudeAdapter } from './adapters/claude.js';
2
- import { cursorAdapter } from './adapters/cursor.js';
3
- import { copilotAdapter } from './adapters/copilot.js';
4
- import { codexAdapter } from './adapters/codex.js';
5
- export const SURFACE_REGISTRY = {
6
- claude: {
7
- rulesFormat: 'markdown',
8
- skillsFormat: 'markdown',
9
- hookEvents: ['SessionStart', 'SessionEnd'],
10
- hookFilePath: '.claude/settings.json',
11
- personalConfigMechanism: 'settings_json',
12
- supportsAgentsMd: false,
13
- },
14
- cursor: {
15
- rulesFormat: 'mdc',
16
- skillsFormat: 'markdown',
17
- hookEvents: [], // empty per INS-740 — no default Cursor hook writes
18
- hookFilePath: '.cursor/settings.json',
19
- personalConfigMechanism: 'none',
20
- supportsAgentsMd: false,
21
- },
22
- copilot: {
23
- rulesFormat: 'markdown',
24
- skillsFormat: 'none',
25
- hookEvents: [], // empty per INS-740
26
- hookFilePath: '.github/copilot-instructions.md',
27
- personalConfigMechanism: 'none',
28
- supportsAgentsMd: false,
29
- },
30
- codex: {
31
- rulesFormat: 'markdown',
32
- skillsFormat: 'markdown',
33
- hookEvents: [],
34
- hookFilePath: 'AGENTS.md',
35
- personalConfigMechanism: 'none',
36
- supportsAgentsMd: true,
37
- },
38
- };
39
- // ── SurfaceAdapter registry — WP-421 S2c (DEC-952) ──────────────────────────
40
- /**
41
- * Per-surface adapter registry. New surface = new adapter file + line here.
42
- * Adapters expose detect/paths/transform/goldens/canonicalPathFor — one canonical
43
- * asset, many surface projections.
44
- */
45
- export const SURFACE_ADAPTERS = {
46
- claude: claudeAdapter,
47
- cursor: cursorAdapter,
48
- copilot: copilotAdapter,
49
- codex: codexAdapter,
50
- };
51
- /** Convenience array view for iteration (e.g. detect-all). */
52
- export const SURFACE_ADAPTER_LIST = Object.values(SURFACE_ADAPTERS);
53
- /**
54
- * Lookup the canonical authoring path for a projection path on any surface.
55
- * Returns the first non-null mapping; if every adapter returns null, returns null
56
- * and the caller MUST emit `surface-reverse-map-missing` telemetry via
57
- * `surfaces/telemetry.ts:reportReverseMapMissing`.
58
- */
59
- export function canonicalPathForAnySurface(projectionPath) {
60
- for (const surface of Object.keys(SURFACE_ADAPTERS)) {
61
- const result = SURFACE_ADAPTERS[surface].canonicalPathFor(projectionPath);
62
- if (result)
63
- return { surface, canonicalPath: result };
64
- }
65
- return null;
66
- }
67
- // ── WP-421 S7: mode × surfaces matrix (doneWhen #19) ─────────────────────────
68
- //
69
- // Two stable error/flag codes (consumer-stable contract):
70
- // - SURFACE_GOVERN_NO_SURFACES — Govern mode requires a non-empty surfaces[].
71
- // Emitted by `validateSurfacesForMode` when `materialize: govern` and no
72
- // surfaces declared. CLI surfaces this as a hard error.
73
- // - SURFACE_ADAPTER_MISSING — A surface name in `manifest.surfaces[]` is not
74
- // registered in SURFACE_ADAPTERS. Emitted by `flagUnregisteredSurfaces` for
75
- // the drift report. The handshake MUST NOT crash on this — the flag is
76
- // advisory and the handshake skips the unknown surface.
77
- /** Govern mode declared with empty surfaces[]. Hard error (handshake refuses). */
78
- export const SURFACE_GOVERN_NO_SURFACES = 'govern-no-surfaces';
79
- /** Surface name in manifest is not registered. Advisory flag for drift report. */
80
- export const SURFACE_ADAPTER_MISSING = 'surface-adapter-missing';
81
- /**
82
- * Validate `manifest.surfaces[]` against the requested authority mode.
83
- *
84
- * Govern + empty surfaces → `{ error: SURFACE_GOVERN_NO_SURFACES }`.
85
- * Any other mode is permitted with any (possibly empty) surface list.
86
- *
87
- * Unregistered surface names are reported via `unregisteredSurfaces` so the
88
- * caller can flag them in the drift report. Pure: no I/O, no Convex calls.
89
- *
90
- * Surface name normalization: this validator strips a leading `.` from each
91
- * entry (e.g. `.cursor` → `cursor`) so manifests can declare either form.
92
- * The canonical SurfaceName values in SURFACE_ADAPTERS use the bare name.
93
- */
94
- export function validateSurfacesForMode(mode, surfacesFromManifest) {
95
- const knownNames = new Set(Object.keys(SURFACE_ADAPTERS));
96
- const registeredSurfaces = [];
97
- const unregisteredSurfaces = [];
98
- for (const raw of surfacesFromManifest) {
99
- if (typeof raw !== 'string' || raw.length === 0)
100
- continue;
101
- const stripped = raw.startsWith('.') ? raw.slice(1) : raw;
102
- const normalized = stripped === 'github' ? 'copilot' : stripped;
103
- if (knownNames.has(normalized)) {
104
- registeredSurfaces.push(normalized);
105
- }
106
- else {
107
- unregisteredSurfaces.push(raw);
108
- }
109
- }
110
- // Govern requires at least one registered surface. Unregistered surface names
111
- // do NOT count toward this minimum (they're advisory).
112
- if (mode === 'govern' && registeredSurfaces.length === 0) {
113
- return { error: SURFACE_GOVERN_NO_SURFACES, unregisteredSurfaces, registeredSurfaces };
114
- }
115
- return { unregisteredSurfaces, registeredSurfaces };
116
- }
117
- //# sourceMappingURL=registry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/surfaces/registry.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAenD,MAAM,CAAC,MAAM,gBAAgB,GAA2C;IACtE,MAAM,EAAE;QACN,WAAW,EAAE,UAAU;QACvB,YAAY,EAAE,UAAU;QACxB,UAAU,EAAE,CAAC,cAAc,EAAE,YAAY,CAAC;QAC1C,YAAY,EAAE,uBAAuB;QACrC,uBAAuB,EAAE,eAAe;QACxC,gBAAgB,EAAE,KAAK;KACxB;IACD,MAAM,EAAE;QACN,WAAW,EAAE,KAAK;QAClB,YAAY,EAAE,UAAU;QACxB,UAAU,EAAE,EAAE,EAAE,oDAAoD;QACpE,YAAY,EAAE,uBAAuB;QACrC,uBAAuB,EAAE,MAAM;QAC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Surface telemetry — WP-421 S2c.
3
- *
4
- * Tagged log for unmapped projection paths. When a SurfaceAdapter's
5
- * canonicalPathFor returns null, the consumer falls back to a generic
6
- * "edit upstream in .productbrain/{skills,rules,hooks}/" message and writes a
7
- * `surface-reverse-map-missing` warning to stderr. Nothing leaves the machine (TASK-982).
8
- */
9
- export interface ReverseMapMissingEvent {
10
- surface: string;
11
- projectionPath: string;
12
- }
13
- /**
14
- * Stable, copy-paste-able fallback message used by tampered-bucket prompts when
15
- * an adapter cannot reverse-map a projection path. Centralized so every consumer
16
- * surfaces the exact same instruction string.
17
- */
18
- export declare function getReverseMapFallbackMessage(): string;
19
- /**
20
- * Report that an adapter returned null for canonicalPathFor: writes a tagged
21
- * warning to stderr so developers see it during local handshake runs.
22
- */
23
- export declare function reportReverseMapMissing(evt: ReverseMapMissingEvent, warn?: (msg: string) => void): void;
24
- //# sourceMappingURL=telemetry.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"telemetry.d.ts","sourceRoot":"","sources":["../../src/surfaces/telemetry.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;CACxB;AAKD;;;;GAIG;AACH,wBAAgB,4BAA4B,IAAI,MAAM,CAErD;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,sBAAsB,EAC3B,IAAI,GAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAgD,GACtE,IAAI,CAIN"}
@@ -1,25 +0,0 @@
1
- /**
2
- * Surface telemetry — WP-421 S2c.
3
- *
4
- * Tagged log for unmapped projection paths. When a SurfaceAdapter's
5
- * canonicalPathFor returns null, the consumer falls back to a generic
6
- * "edit upstream in .productbrain/{skills,rules,hooks}/" message and writes a
7
- * `surface-reverse-map-missing` warning to stderr. Nothing leaves the machine (TASK-982).
8
- */
9
- const FALLBACK_MESSAGE = 'edit upstream in .productbrain/skills|rules|hooks/';
10
- /**
11
- * Stable, copy-paste-able fallback message used by tampered-bucket prompts when
12
- * an adapter cannot reverse-map a projection path. Centralized so every consumer
13
- * surfaces the exact same instruction string.
14
- */
15
- export function getReverseMapFallbackMessage() {
16
- return FALLBACK_MESSAGE;
17
- }
18
- /**
19
- * Report that an adapter returned null for canonicalPathFor: writes a tagged
20
- * warning to stderr so developers see it during local handshake runs.
21
- */
22
- export function reportReverseMapMissing(evt, warn = (msg) => process.stderr.write(msg + '\n')) {
23
- warn(`[surface-reverse-map-missing] ${evt.surface} cannot reverse-map ${evt.projectionPath} — ${FALLBACK_MESSAGE}`);
24
- }
25
- //# sourceMappingURL=telemetry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"telemetry.js","sourceRoot":"","sources":["../../src/surfaces/telemetry.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAOH,MAAM,gBAAgB,GACpB,oDAAoD,CAAC;AAEvD;;;;GAIG;AACH,MAAM,UAAU,4BAA4B;IAC1C,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CACrC,GAA2B,EAC3B,OAA8B,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,GAAG,IAAI,CAAC;IAEvE,IAAI,CACF,iCAAiC,GAAG,CAAC,OAAO,uBAAuB,GAAG,CAAC,cAAc,MAAM,gBAAgB,EAAE,CAC9G,CAAC;AACJ,CAAC"}