@productbrain/cli 0.1.0-beta.7389 → 0.1.0-beta.7400

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 (47) hide show
  1. package/dist/__tests__/handshake-dormancy.test.js +6 -64
  2. package/dist/__tests__/handshake-dormancy.test.js.map +1 -1
  3. package/dist/__tests__/handshake-preview.test.js +41 -651
  4. package/dist/__tests__/handshake-preview.test.js.map +1 -1
  5. package/dist/__tests__/handshake.e2e.test.js +3 -262
  6. package/dist/__tests__/handshake.e2e.test.js.map +1 -1
  7. package/dist/__tests__/perimeter.test.js +1 -1
  8. package/dist/__tests__/perimeter.test.js.map +1 -1
  9. package/dist/__tests__/route-latency-budget.test.js +3 -1
  10. package/dist/__tests__/route-latency-budget.test.js.map +1 -1
  11. package/dist/commands/admin/seed.test.js +4 -9
  12. package/dist/commands/admin/seed.test.js.map +1 -1
  13. package/dist/commands/admin/seedRegistryEntries.generated.d.ts.map +1 -1
  14. package/dist/commands/admin/seedRegistryEntries.generated.js +0 -18
  15. package/dist/commands/admin/seedRegistryEntries.generated.js.map +1 -1
  16. package/dist/commands/admin/seedRegistryEntries.test.js +10 -7
  17. package/dist/commands/admin/seedRegistryEntries.test.js.map +1 -1
  18. package/dist/commands/connect-context.d.ts +8 -10
  19. package/dist/commands/connect-context.d.ts.map +1 -1
  20. package/dist/commands/connect-context.js +6 -8
  21. package/dist/commands/connect-context.js.map +1 -1
  22. package/dist/commands/connect-context.test.js +15 -10
  23. package/dist/commands/connect-context.test.js.map +1 -1
  24. package/dist/commands/connect-screens.d.ts +5 -4
  25. package/dist/commands/connect-screens.d.ts.map +1 -1
  26. package/dist/commands/connect-screens.js +7 -7
  27. package/dist/commands/connect-screens.js.map +1 -1
  28. package/dist/commands/handshake.d.ts +0 -19
  29. package/dist/commands/handshake.d.ts.map +1 -1
  30. package/dist/commands/handshake.js +67 -746
  31. package/dist/commands/handshake.js.map +1 -1
  32. package/dist/generated/routeLatencyBudget.generated.d.ts.map +1 -1
  33. package/dist/generated/routeLatencyBudget.generated.js +0 -25
  34. package/dist/generated/routeLatencyBudget.generated.js.map +1 -1
  35. package/dist/index.js +1 -2
  36. package/dist/index.js.map +1 -1
  37. package/dist/{setup/perimeter.d.ts → lib/writePerimeter.d.ts} +11 -11
  38. package/dist/lib/writePerimeter.d.ts.map +1 -0
  39. package/dist/{setup/perimeter.js → lib/writePerimeter.js} +11 -11
  40. package/dist/lib/writePerimeter.js.map +1 -0
  41. package/package.json +1 -1
  42. package/dist/setup/perimeter.d.ts.map +0 -1
  43. package/dist/setup/perimeter.js.map +0 -1
  44. package/dist/surfaces/__tests__/pb-setup-passthrough.test.d.ts +0 -2
  45. package/dist/surfaces/__tests__/pb-setup-passthrough.test.d.ts.map +0 -1
  46. package/dist/surfaces/__tests__/pb-setup-passthrough.test.js +0 -131
  47. package/dist/surfaces/__tests__/pb-setup-passthrough.test.js.map +0 -1
@@ -1,8 +1,13 @@
1
1
  /**
2
- * Setup write perimeter — WP-421 S7 (STD-236, doneWhen #22).
2
+ * Write perimeter — WP-421 S7 (STD-236, doneWhen #22). Re-homed from
3
+ * `setup/perimeter.ts` in WP-776 S3d/S3f: despite its original name, this guard was never
4
+ * setup-asset-specific — its job ("PB never writes outside its declared surfaces," STD-234)
5
+ * covers every handshake adapter write (`.claude/`, `.cursor/`, `.codex/`, etc.), which is why
6
+ * it survives the deletion of the setup-assets system while the module it used to live under
7
+ * does not.
3
8
  *
4
- * Single runtime guard for every disk write the setup machinery makes. Writes
5
- * are permitted ONLY within paths that the manifest explicitly declares safe:
9
+ * Single runtime guard for every disk write `pb handshake` makes. Writes are
10
+ * permitted ONLY within paths that the manifest explicitly declares safe:
6
11
  *
7
12
  * - `path.resolve(process.cwd(), '.productbrain')` — hard-coded canonical
8
13
  * authoring root. Always allowed regardless of manifest contents (this is
@@ -10,17 +15,12 @@
10
15
  * - `path.resolve(process.cwd(), surface)` for every `surface` in
11
16
  * `manifest.surfaces[]` — explicit per-workspace allowlist.
12
17
  *
13
- * Anything else throws `setup-perimeter-violation`. This is the single
18
+ * Anything else throws `setup-perimeter-violation` (name kept stable for tests —
19
+ * renaming the error code is a separate, non-mechanical change). This is the single
14
20
  * choke point the S7 perimeter fixtures exercise (HOME-sandboxed) and is the
15
21
  * only place we encode the "PB never writes outside its declared surfaces"
16
22
  * promise (STD-234) as RUNTIME enforcement rather than convention.
17
23
  *
18
- * Wiring follow-up: this module is NEW in S7. Adapter writers in
19
- * `packages/cli/src/surfaces/adapters/*.ts` and the dormant-marker
20
- * `appendFileSync` paths in `commands/handshake.ts` should call this guard
21
- * before each write. That cross-cutting wiring is intentionally out of scope
22
- * for S7 — see TEN capture in the slice notes (residual finding).
23
- *
24
24
  * Chain: STD-234 (write perimeter), STD-236 (this guard), DEC-952 (adapters),
25
25
  * DEC-955 (manifest defaults).
26
26
  */
@@ -125,4 +125,4 @@ function createPerimeterError(reason, path) {
125
125
  err.path = path;
126
126
  return err;
127
127
  }
128
- //# sourceMappingURL=perimeter.js.map
128
+ //# sourceMappingURL=writePerimeter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"writePerimeter.js","sourceRoot":"","sources":["../../src/lib/writePerimeter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAWpC,2EAA2E;AAC3E,MAAM,CAAC,MAAM,yBAAyB,GAAG,2BAAoC,CAAC;AAE9E;;;;GAIG;AACH,MAAM,kBAAkB,GAAG,eAAe,CAAC;AAE3C;;;;GAIG;AACH,SAAS,YAAY,CAAC,IAAY,EAAE,QAAgB;IAClD,OAAO,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AACjC,CAAC;AAED;;;;;GAKG;AACH,SAAS,QAAQ,CAAC,IAAY,EAAE,SAAiB;IAC/C,IAAI,SAAS,KAAK,IAAI;QAAE,OAAO,IAAI,CA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CAAC,CAAC;IAExC,2EAA2E;IAC3E,2EAA2E;IAC3E,6EAA6E;IAC7E,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;IACzC,MAAM,YAAY,GAAa,CAAC,YAAY,CAAC,GAAG,EAAE,kBAAkB,CAAC,CAAC,CAAC;IAEvE,MAAM,QAAQ,GAAG,QAAQ,CAAC,QAAQ,IAAI,EAAE,CAAC;IACzC,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;YAAE,SAAS;QAClE,YAAY,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC;IAChD,CAAC;IAED,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC,CAAC;AACrE,CAAC;AAED;;;GAGG;AACH,SAAS,oBAAoB,CAAC,MAAc,EAAE,IAAa;IACzD,MAAM,GAAG,GAAG,IAAI,KAAK,CAAC,GAAG,MAAM,UAAU,MAAM,CAAC,IAAI,CAAC,GAAG,CAGvD,CAAC;IACF,GAAG,CAAC,IAAI,GAAG,yBAAyB,CAAC;IACrC,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC;IAChB,OAAO,GAAG,CAAC;AACb,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@productbrain/cli",
3
- "version": "0.1.0-beta.7389",
3
+ "version": "0.1.0-beta.7400",
4
4
  "description": "Product Brain — Chain knowledge and write-back CLI",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1 +0,0 @@
1
- {"version":3,"file":"perimeter.d.ts","sourceRoot":"","sources":["../../src/setup/perimeter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;A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,GAAa,CAAC,YAAY,CAAC,GAAG,EAAE,kBAAkB,CAAC,CAAC,CAAC;IAEvE,MAAM,QAAQ,GAAG,QAAQ,CAAC,QAAQ,IAAI,EAAE,CAAC;IACzC,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;YAAE,SAAS;QAClE,YAAY,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC;IAChD,CAAC;IAED,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC,CAAC;AACrE,CAAC;AAED;;;GAGG;AACH,SAAS,oBAAoB,CAAC,MAAc,EAAE,IAAa;IACzD,MAAM,GAAG,GAAG,IAAI,KAAK,CAAC,GAAG,MAAM,UAAU,MAAM,CAAC,IAAI,CAAC,GAAG,CAGvD,CAAC;IACF,GAAG,CAAC,IAAI,GAAG,yBAAyB,CAAC;IACrC,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC;IAChB,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=pb-setup-passthrough.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pb-setup-passthrough.test.d.ts","sourceRoot":"","sources":["../../../src/surfaces/__tests__/pb-setup-passthrough.test.ts"],"names":[],"mappings":""}
@@ -1,131 +0,0 @@
1
- /**
2
- * pb-setup canonical skill — SurfaceAdapter passthrough goldens (WP-431 S4).
3
- *
4
- * doneWhen #1: the canonical .productbrain/skills/pb-setup.md projects through
5
- * each adapter's `transform` such that the body content is preserved verbatim
6
- * (no surface-specific rewriting of the body). Per DEC-997, the skill body is
7
- * the universal SSOT and uses the in-body surface-routing block to drive both
8
- * CLI and chat-only flows; the adapter's job is wrapping (frontmatter,
9
- * marker), not rewriting the body itself.
10
- *
11
- * Parity assertions per adapter:
12
- * - claude: body emitted verbatim (no wrapping). No claude WRITE path for the skill kind
13
- * (E4b, WP-761/TASK-249) — path assertion removed, not exercised.
14
- * - cursor: body preserved inside a Cursor SKILL.md wrapper. Path matches
15
- * `.cursor/skills/pb-setup/SKILL.md`. Triggers appear in the
16
- * wrapper's description.
17
- * - codex: body preserved inside a Codex skill projection wrapper. Path
18
- * matches `.codex/skills/pb-setup.md`. Triggers appear in the
19
- * wrapper.
20
- * - copilot: skills not projected (skillsFormat: 'none'). Transform returns
21
- * empty string for skill kind (matches handshake.ts behavior).
22
- *
23
- * The test reads the canonical file from disk so a content drift in the
24
- * source markdown surfaces here.
25
- */
26
- import { describe, expect, it } from 'vitest';
27
- import { readFileSync, existsSync } from 'fs';
28
- import { join } from 'path';
29
- import { fileURLToPath } from 'url';
30
- import { dirname } from 'path';
31
- import { claudeAdapter } from '../adapters/claude.js';
32
- import { cursorAdapter } from '../adapters/cursor.js';
33
- import { codexAdapter } from '../adapters/codex.js';
34
- import { copilotAdapter } from '../adapters/copilot.js';
35
- const __dirname = dirname(fileURLToPath(import.meta.url));
36
- // repo root: packages/cli/src/surfaces/__tests__ -> ../../../../..
37
- const REPO_ROOT = join(__dirname, '..', '..', '..', '..', '..');
38
- const CANONICAL_PATH = join(REPO_ROOT, '.productbrain', 'skills', 'pb-setup.md');
39
- /**
40
- * Minimal frontmatter parser tuned to the pb-setup skill shape. We avoid
41
- * importing the production parser to keep this test independent of internal
42
- * helper drift (the goldens are about the `transform` contract, not the
43
- * parser).
44
- */
45
- function loadCanonicalPbSetup() {
46
- if (!existsSync(CANONICAL_PATH)) {
47
- throw new Error(`Canonical pb-setup.md not found at ${CANONICAL_PATH}`);
48
- }
49
- const raw = readFileSync(CANONICAL_PATH, 'utf8');
50
- const match = raw.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/);
51
- if (!match)
52
- throw new Error('pb-setup.md missing frontmatter');
53
- const yaml = match[1];
54
- const body = match[2];
55
- const nameMatch = yaml.match(/^name:\s*(.+)$/m);
56
- const descMatch = yaml.match(/description:\s*>-\s*\n((?:\s+.+\n?)+?)(?=^\w|^---|\Z)/m);
57
- const triggers = [];
58
- const trigBlock = yaml.match(/^triggers:\s*\n((?:\s+-\s.+\n?)+)/m);
59
- if (trigBlock) {
60
- for (const line of trigBlock[1].split('\n')) {
61
- const m = line.match(/^\s+-\s+(.+)$/);
62
- if (m)
63
- triggers.push(m[1].trim().replace(/^["']|["']$/g, ''));
64
- }
65
- }
66
- return {
67
- name: (nameMatch?.[1] ?? 'pb-setup').trim(),
68
- description: descMatch
69
- ? descMatch[1].split('\n').map((l) => l.trim()).filter(Boolean).join(' ')
70
- : '',
71
- triggers,
72
- body,
73
- sourcePath: CANONICAL_PATH,
74
- };
75
- }
76
- describe('pb-setup canonical skill — SurfaceAdapter passthrough', () => {
77
- const canonical = loadCanonicalPbSetup();
78
- it('canonical file exists with expected name and triggers', () => {
79
- expect(canonical.name).toBe('pb-setup');
80
- expect(canonical.triggers).toContain('pb setup');
81
- expect(canonical.body.length).toBeGreaterThan(500);
82
- });
83
- it('claude adapter: body verbatim (no claude WRITE path for the skill kind, E4b)', () => {
84
- const out = claudeAdapter.transform({ canonical: { kind: 'skill', ...canonical } });
85
- expect(out).toBe(canonical.body);
86
- });
87
- it('cursor adapter: body content preserved inside wrapper, triggers injected, path .cursor/skills/pb-setup/SKILL.md', () => {
88
- const out = cursorAdapter.transform({ canonical: { kind: 'skill', ...canonical } });
89
- // Body content must appear verbatim (the cursor regex does not match
90
- // `.productbrain/{skills,rules,hooks}/...md` — the body has no
91
- // `.productbrain/skills/<name>.md` literal references that would be
92
- // rewritten, so passthrough holds).
93
- expect(out).toContain(canonical.body);
94
- // Cursor wraps with its own frontmatter + marker comment.
95
- expect(out.startsWith('---\nname: pb-setup')).toBe(true);
96
- expect(out).toContain('source: .productbrain/skills/pb-setup.md');
97
- // Triggers travel into the description per Cursor's convention.
98
- expect(out).toContain('"pb setup"');
99
- const path = cursorAdapter.paths({ kind: 'skill', basename: canonical.name }).projectionPath;
100
- expect(path).toBe('.cursor/skills/pb-setup/SKILL.md');
101
- });
102
- it('codex adapter: body content preserved inside wrapper, triggers attached, path .codex/skills/pb-setup.md', () => {
103
- const out = codexAdapter.transform({ canonical: { kind: 'skill', ...canonical } });
104
- expect(out).toContain(canonical.body);
105
- expect(out).toContain('source: .productbrain/skills/pb-setup.md');
106
- // Codex wraps with a `# <name>` heading, description, and a Triggers line.
107
- expect(out).toContain('# pb-setup');
108
- expect(out).toContain('**Triggers:**');
109
- expect(out).toContain('`pb setup`');
110
- const path = codexAdapter.paths({ kind: 'skill', basename: canonical.name }).projectionPath;
111
- expect(path).toBe('.codex/skills/pb-setup.md');
112
- });
113
- it('copilot adapter: skills not projected (skillsFormat: none), transform returns empty', () => {
114
- const out = copilotAdapter.transform({ canonical: { kind: 'skill', ...canonical } });
115
- expect(out).toBe('');
116
- // Copilot's only target file is the aggregate copilot-instructions.md.
117
- const path = copilotAdapter.paths({ kind: 'skill', basename: canonical.name }).projectionPath;
118
- expect(path).toBe('.github/copilot-instructions.md');
119
- });
120
- it('canonical body is free of `.productbrain/{skills,rules}/<name>.md` literal refs that would trigger surface path rewrites', () => {
121
- // Per DEC-997, the canonical skill body should not depend on adapter path
122
- // rewriting — the in-body surface-routing block carries all surface logic.
123
- // Guard: if a future edit adds such a literal reference, this test catches
124
- // it BEFORE the cursor/codex transform mangles it through the regex.
125
- const skillsRefs = canonical.body.match(/\.productbrain\/skills\/[\w.-]+\.md/g) ?? [];
126
- const rulesRefs = canonical.body.match(/\.productbrain\/rules\/[\w.-]+\.md/g) ?? [];
127
- expect(skillsRefs).toEqual([]);
128
- expect(rulesRefs).toEqual([]);
129
- });
130
- });
131
- //# sourceMappingURL=pb-setup-passthrough.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pb-setup-passthrough.test.js","sourceRoot":"","sources":["../../../src/surfaces/__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