@productbrain/cli 0.1.0-beta.11644 → 0.1.0-beta.11656

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 (89) hide show
  1. package/dist/__tests__/kernel-value-sets-drift.test.js +3 -3
  2. package/dist/__tests__/kernel-value-sets-generator.test.js +1 -1
  3. package/dist/__tests__/kernel-value-sets-generator.test.js.map +1 -1
  4. package/dist/__tests__/login.test.js +1 -0
  5. package/dist/__tests__/login.test.js.map +1 -1
  6. package/dist/commands/admin/seed.d.ts +8 -15
  7. package/dist/commands/admin/seed.d.ts.map +1 -1
  8. package/dist/commands/admin/seed.js +24 -88
  9. package/dist/commands/admin/seed.js.map +1 -1
  10. package/dist/commands/admin/seed.test.js +11 -1
  11. package/dist/commands/admin/seed.test.js.map +1 -1
  12. package/dist/commands/admin/seedRegistryEntries.generated.d.ts +3 -1
  13. package/dist/commands/admin/seedRegistryEntries.generated.d.ts.map +1 -1
  14. package/dist/commands/admin/seedRegistryEntries.generated.js +34 -1
  15. package/dist/commands/admin/seedRegistryEntries.generated.js.map +1 -1
  16. package/dist/commands/admin/seedRegistryEntries.test.d.ts +1 -1
  17. package/dist/commands/admin/seedRegistryEntries.test.js +13 -5
  18. package/dist/commands/admin/seedRegistryEntries.test.js.map +1 -1
  19. package/dist/commands/connect-integration.test.js +1 -0
  20. package/dist/commands/connect-integration.test.js.map +1 -1
  21. package/dist/commands/connect.test.js +1 -0
  22. package/dist/commands/connect.test.js.map +1 -1
  23. package/dist/lib/privateFile.d.ts +3 -2
  24. package/dist/lib/privateFile.d.ts.map +1 -1
  25. package/dist/lib/privateFile.js +35 -3
  26. package/dist/lib/privateFile.js.map +1 -1
  27. package/dist/lib/privateFile.test.js +31 -1
  28. package/dist/lib/privateFile.test.js.map +1 -1
  29. package/dist/lib/workspaceVocabCache.d.ts +0 -6
  30. package/dist/lib/workspaceVocabCache.d.ts.map +1 -1
  31. package/dist/lib/workspaceVocabCache.js +0 -6
  32. package/dist/lib/workspaceVocabCache.js.map +1 -1
  33. package/package.json +1 -1
  34. package/dist/__tests__/experiment.test.d.ts +0 -6
  35. package/dist/__tests__/experiment.test.d.ts.map +0 -1
  36. package/dist/__tests__/experiment.test.js +0 -69
  37. package/dist/__tests__/experiment.test.js.map +0 -1
  38. package/dist/__tests__/repo-detect.test.d.ts +0 -2
  39. package/dist/__tests__/repo-detect.test.d.ts.map +0 -1
  40. package/dist/__tests__/repo-detect.test.js +0 -195
  41. package/dist/__tests__/repo-detect.test.js.map +0 -1
  42. package/dist/generated/sourceSurfaces.generated.d.ts +0 -12
  43. package/dist/generated/sourceSurfaces.generated.d.ts.map +0 -1
  44. package/dist/generated/sourceSurfaces.generated.js +0 -11
  45. package/dist/generated/sourceSurfaces.generated.js.map +0 -1
  46. package/dist/lib/commanderOptions.d.ts +0 -8
  47. package/dist/lib/commanderOptions.d.ts.map +0 -1
  48. package/dist/lib/commanderOptions.js +0 -10
  49. package/dist/lib/commanderOptions.js.map +0 -1
  50. package/dist/lib/experiment.d.ts +0 -18
  51. package/dist/lib/experiment.d.ts.map +0 -1
  52. package/dist/lib/experiment.js +0 -28
  53. package/dist/lib/experiment.js.map +0 -1
  54. package/dist/lib/normalizeMaterializedFilename.d.ts +0 -28
  55. package/dist/lib/normalizeMaterializedFilename.d.ts.map +0 -1
  56. package/dist/lib/normalizeMaterializedFilename.js +0 -56
  57. package/dist/lib/normalizeMaterializedFilename.js.map +0 -1
  58. package/dist/lib/normalizeMaterializedFilename.test.d.ts +0 -16
  59. package/dist/lib/normalizeMaterializedFilename.test.d.ts.map +0 -1
  60. package/dist/lib/normalizeMaterializedFilename.test.js +0 -90
  61. package/dist/lib/normalizeMaterializedFilename.test.js.map +0 -1
  62. package/dist/lib/repo-detect.d.ts +0 -39
  63. package/dist/lib/repo-detect.d.ts.map +0 -1
  64. package/dist/lib/repo-detect.js +0 -88
  65. package/dist/lib/repo-detect.js.map +0 -1
  66. package/dist/lib/startup-resolution-signals.d.ts +0 -34
  67. package/dist/lib/startup-resolution-signals.d.ts.map +0 -1
  68. package/dist/lib/startup-resolution-signals.js +0 -116
  69. package/dist/lib/startup-resolution-signals.js.map +0 -1
  70. package/dist/lib/startup-resolution-signals.test.d.ts +0 -2
  71. package/dist/lib/startup-resolution-signals.test.d.ts.map +0 -1
  72. package/dist/lib/startup-resolution-signals.test.js +0 -113
  73. package/dist/lib/startup-resolution-signals.test.js.map +0 -1
  74. package/dist/lib/wizard-surfaces.d.ts +0 -47
  75. package/dist/lib/wizard-surfaces.d.ts.map +0 -1
  76. package/dist/lib/wizard-surfaces.js +0 -176
  77. package/dist/lib/wizard-surfaces.js.map +0 -1
  78. package/dist/lib/wizard-surfaces.test.d.ts +0 -2
  79. package/dist/lib/wizard-surfaces.test.d.ts.map +0 -1
  80. package/dist/lib/wizard-surfaces.test.js +0 -127
  81. package/dist/lib/wizard-surfaces.test.js.map +0 -1
  82. package/dist/lib/wizard-trust.d.ts +0 -31
  83. package/dist/lib/wizard-trust.d.ts.map +0 -1
  84. package/dist/lib/wizard-trust.js +0 -66
  85. package/dist/lib/wizard-trust.js.map +0 -1
  86. package/dist/lib/wizard-trust.test.d.ts +0 -2
  87. package/dist/lib/wizard-trust.test.d.ts.map +0 -1
  88. package/dist/lib/wizard-trust.test.js +0 -32
  89. package/dist/lib/wizard-trust.test.js.map +0 -1
@@ -1,195 +0,0 @@
1
- /**
2
- * repo-detect — filesystem-based repo detection.
3
- * Tests cover: package.json parsing, git remote extraction, stack detection, fallbacks.
4
- */
5
- import { beforeEach, describe, expect, it, vi } from 'vitest';
6
- import { detectRepo, extractWorkspaceProfile } from '../lib/repo-detect.js';
7
- // Mock fs and child_process so tests don't touch the real filesystem.
8
- const existsSyncMock = vi.fn();
9
- const readFileSyncMock = vi.fn();
10
- const execSyncMock = vi.fn();
11
- vi.mock('fs', () => ({
12
- existsSync: (path) => existsSyncMock(path),
13
- readFileSync: (path, encoding) => readFileSyncMock(path, encoding),
14
- }));
15
- vi.mock('child_process', () => ({
16
- execSync: (cmd, opts) => execSyncMock(cmd, opts),
17
- }));
18
- describe('detectRepo', () => {
19
- beforeEach(() => {
20
- existsSyncMock.mockReset();
21
- readFileSyncMock.mockReset();
22
- execSyncMock.mockReset();
23
- });
24
- it('strips @scope/ prefix from package.json name', () => {
25
- existsSyncMock.mockImplementation((p) => String(p).endsWith('package.json'));
26
- readFileSyncMock.mockReturnValue(JSON.stringify({ name: '@scope/my-app', description: 'A test app' }));
27
- execSyncMock.mockImplementation(() => { throw new Error('no git'); });
28
- const result = detectRepo('/fake/dir');
29
- // Verify scope stripping logic — '@scope/my-app' → 'my-app'
30
- expect(result.name).toBe('my-app');
31
- expect(result.description).toBe('A test app');
32
- // Verify existsSync was called with the resolved package.json path
33
- expect(existsSyncMock).toHaveBeenCalledWith(expect.stringContaining('package.json'));
34
- expect(readFileSyncMock).toHaveBeenCalledWith(expect.stringContaining('package.json'), 'utf8');
35
- });
36
- it('preserves unscoped package name as-is', () => {
37
- existsSyncMock.mockImplementation((p) => String(p).endsWith('package.json'));
38
- readFileSyncMock.mockReturnValue(JSON.stringify({ name: 'plain-name' }));
39
- execSyncMock.mockImplementation(() => { throw new Error('no git'); });
40
- const result = detectRepo('/fake/dir');
41
- expect(result.name).toBe('plain-name');
42
- });
43
- it('extracts repoSlug from HTTPS git remote', () => {
44
- existsSyncMock.mockReturnValue(false);
45
- execSyncMock.mockReturnValue('https://github.com/acme/my-repo.git\n');
46
- const result = detectRepo('/fake/dir');
47
- expect(result.gitRemote).toBe('https://github.com/acme/my-repo.git');
48
- expect(result.repoSlug).toBe('acme/my-repo');
49
- });
50
- it('extracts repoSlug from SSH git remote', () => {
51
- existsSyncMock.mockReturnValue(false);
52
- execSyncMock.mockReturnValue('git@github.com:acme/my-repo.git\n');
53
- const result = detectRepo('/fake/dir');
54
- expect(result.repoSlug).toBe('acme/my-repo');
55
- });
56
- it('detects stack technologies from marker files', () => {
57
- const markerFiles = new Set([
58
- '/fake/dir/svelte.config.ts',
59
- '/fake/dir/tsconfig.json',
60
- '/fake/dir/vite.config.ts',
61
- ]);
62
- existsSyncMock.mockImplementation((p) => markerFiles.has(String(p)));
63
- execSyncMock.mockImplementation(() => { throw new Error('no git'); });
64
- const result = detectRepo('/fake/dir');
65
- expect(result.detectedStack).toContain('sveltekit');
66
- expect(result.detectedStack).toContain('typescript');
67
- expect(result.detectedStack).toContain('vite');
68
- expect(result.detectedStack).not.toContain('nextjs');
69
- });
70
- it('detects monorepo from workspaces field', () => {
71
- existsSyncMock.mockImplementation((p) => String(p).endsWith('package.json'));
72
- readFileSyncMock.mockReturnValue(JSON.stringify({ name: 'mono', workspaces: ['packages/*'] }));
73
- execSyncMock.mockImplementation(() => { throw new Error('no git'); });
74
- const result = detectRepo('/fake/dir');
75
- expect(result.isMonorepo).toBe(true);
76
- });
77
- it('falls back to directory basename when no package.json name', () => {
78
- existsSyncMock.mockReturnValue(false);
79
- execSyncMock.mockImplementation(() => { throw new Error('no git'); });
80
- const result = detectRepo('/fake/my-project');
81
- expect(result.name).toBe('my-project');
82
- });
83
- it('handles malformed package.json gracefully', () => {
84
- existsSyncMock.mockImplementation((p) => String(p).endsWith('package.json'));
85
- readFileSyncMock.mockReturnValue('not valid json {{{');
86
- execSyncMock.mockImplementation(() => { throw new Error('no git'); });
87
- const result = detectRepo('/fake/dir');
88
- // Should not throw, falls back to directory name
89
- expect(result.name).toBe('dir');
90
- expect(result.description).toBeNull();
91
- });
92
- it('returns empty detectedStack when no marker files exist', () => {
93
- existsSyncMock.mockReturnValue(false);
94
- execSyncMock.mockImplementation(() => { throw new Error('no git'); });
95
- const result = detectRepo('/fake/dir');
96
- expect(result.detectedStack).toEqual([]);
97
- });
98
- it('handles git remote without .git suffix', () => {
99
- existsSyncMock.mockReturnValue(false);
100
- execSyncMock.mockReturnValue('https://github.com/acme/my-repo\n');
101
- const result = detectRepo('/fake/dir');
102
- expect(result.repoSlug).toBe('acme/my-repo');
103
- });
104
- it('returns null repoSlug for malformed git remote URL', () => {
105
- existsSyncMock.mockReturnValue(false);
106
- execSyncMock.mockReturnValue('not-a-url\n');
107
- const result = detectRepo('/fake/dir');
108
- expect(result.gitRemote).toBe('not-a-url');
109
- expect(result.repoSlug).toBeNull();
110
- });
111
- it('sets isMonorepo false when workspaces field is absent', () => {
112
- existsSyncMock.mockImplementation((p) => String(p).endsWith('package.json'));
113
- readFileSyncMock.mockReturnValue(JSON.stringify({ name: 'single-pkg' }));
114
- execSyncMock.mockImplementation(() => { throw new Error('no git'); });
115
- const result = detectRepo('/fake/dir');
116
- expect(result.isMonorepo).toBe(false);
117
- });
118
- });
119
- describe('extractWorkspaceProfile', () => {
120
- // WP-751 M3a-5b (TASK-210, DEC-1700): governanceMode is deleted from every fixture and
121
- // assertion below, and the "returns null when governanceMode is missing" test is deleted
122
- // outright — the backend workspaceReadiness response no longer carries the field at all
123
- // (role is the only governance mode now), so a response never has it, never a "missing"
124
- // case to distinguish.
125
- //
126
- // WP-762 C4e-3 (DEC-1800): the `stage` ladder is deleted from the backend response. Every
127
- // fixture below drops `stage`.
128
- it('does not use incomplete readiness to filter guidance or publish workspace maturity', () => {
129
- expect(extractWorkspaceProfile({ sampleTruncated: true, stats: { totalEntries: 0 } })).toBeNull();
130
- });
131
- it('is importable and WorkspaceProfile type is usable', () => {
132
- // Type-level: ensure the interface compiles and is usable as a type annotation
133
- const profile = {
134
- totalEntries: 42,
135
- totalRelations: 10,
136
- collectionCount: 5,
137
- activeCount: 30,
138
- draftCount: 8,
139
- orphanedCount: 4,
140
- };
141
- expect(profile.totalEntries).toBe(42);
142
- });
143
- it('returns null for null input', () => {
144
- expect(extractWorkspaceProfile(null)).toBeNull();
145
- });
146
- it('returns null for non-object input', () => {
147
- expect(extractWorkspaceProfile('string')).toBeNull();
148
- expect(extractWorkspaceProfile(42)).toBeNull();
149
- expect(extractWorkspaceProfile(undefined)).toBeNull();
150
- });
151
- it('returns null when stats.totalEntries is missing', () => {
152
- const response = {
153
- stats: {},
154
- };
155
- expect(extractWorkspaceProfile(response)).toBeNull();
156
- });
157
- it('returns null when stats is missing entirely', () => {
158
- const response = {};
159
- expect(extractWorkspaceProfile(response)).toBeNull();
160
- });
161
- it('extracts all fields from a well-formed response, with no `stage` in the input or output', () => {
162
- const response = {
163
- stats: {
164
- totalEntries: 100,
165
- totalRelations: 50,
166
- collectionCount: 8,
167
- activeCount: 70,
168
- draftCount: 20,
169
- orphanedCount: 10,
170
- },
171
- };
172
- const profile = extractWorkspaceProfile(response);
173
- expect(profile).not.toBeNull();
174
- expect(profile).not.toHaveProperty('stage');
175
- expect(profile.totalEntries).toBe(100);
176
- expect(profile.totalRelations).toBe(50);
177
- expect(profile.collectionCount).toBe(8);
178
- expect(profile.activeCount).toBe(70);
179
- expect(profile.draftCount).toBe(20);
180
- expect(profile.orphanedCount).toBe(10);
181
- });
182
- it('defaults missing numeric stats to 0', () => {
183
- const response = {
184
- stats: { totalEntries: 5 },
185
- };
186
- const profile = extractWorkspaceProfile(response);
187
- expect(profile).not.toBeNull();
188
- expect(profile.totalRelations).toBe(0);
189
- expect(profile.collectionCount).toBe(0);
190
- expect(profile.activeCount).toBe(0);
191
- expect(profile.draftCount).toBe(0);
192
- expect(profile.orphanedCount).toBe(0);
193
- });
194
- });
195
- //# sourceMappingURL=repo-detect.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"repo-detect.test.js","sourceRoot":"","sources":["../../src/__tests__/repo-detect.test.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAG5E,sEAAsE;AACtE,MAAM,cAAc,GAAG,EAAE,CAAC,EAAE,EAA6B,CAAC;AAC1D,MAAM,gBAAgB,GAAG,EAAE,CAAC,EAAE,EAA8C,CAAC;AAC7E,MAAM,Y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UAAU,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACpC,MAAM,CAAC,OAAQ,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACzC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,12 +0,0 @@
1
- /**
2
- * GENERATED — DO NOT EDIT BY HAND.
3
- *
4
- * Source of truth: `kernel/telemetry/contextServed.ts` (CONTEXT_SERVED_SOURCES).
5
- * Regenerate via: `npm run codegen` from `packages/cli`.
6
- *
7
- * Drift guard: src/__tests__/kernel-value-sets-drift.test.ts re-extracts the
8
- * members from the source and fails CI when this file is stale.
9
- */
10
- export declare const STARTUP_RESOLUTION_SIGNAL_SOURCE_SURFACES: readonly ["cli", "mcp", "app", "rest", "internal", "api"];
11
- export type StartupResolutionSourceSurface = (typeof STARTUP_RESOLUTION_SIGNAL_SOURCE_SURFACES)[number];
12
- //# sourceMappingURL=sourceSurfaces.generated.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sourceSurfaces.generated.d.ts","sourceRoot":"","sources":["../../src/generated/sourceSurfaces.generated.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,eAAO,MAAM,yCAAyC,2DAA4D,CAAC;AACnH,MAAM,MAAM,8BAA8B,GAAG,CAAC,OAAO,yCAAyC,CAAC,CAAC,MAAM,CAAC,CAAC"}
@@ -1,11 +0,0 @@
1
- /**
2
- * GENERATED — DO NOT EDIT BY HAND.
3
- *
4
- * Source of truth: `kernel/telemetry/contextServed.ts` (CONTEXT_SERVED_SOURCES).
5
- * Regenerate via: `npm run codegen` from `packages/cli`.
6
- *
7
- * Drift guard: src/__tests__/kernel-value-sets-drift.test.ts re-extracts the
8
- * members from the source and fails CI when this file is stale.
9
- */
10
- export const STARTUP_RESOLUTION_SIGNAL_SOURCE_SURFACES = ['cli', 'mcp', 'app', 'rest', 'internal', 'api'];
11
- //# sourceMappingURL=sourceSurfaces.generated.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sourceSurfaces.generated.js","sourceRoot":"","sources":["../../src/generated/sourceSurfaces.generated.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,CAAC,MAAM,yCAAyC,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,CAAU,CAAC"}
@@ -1,8 +0,0 @@
1
- /**
2
- * Small commander.js `.option()` callback helpers. Extracted out of index.ts (not inline) —
3
- * STD-2/DEC-1504: index.ts is a grandfathered, shrink-only file; this extraction is the WP-582 B1
4
- * offset for that PR's `pb direction` command registration (import + addCommand, two lines).
5
- */
6
- /** Accumulate a repeatable `--flag <value>` option into an array (commander's variadic-flag idiom). */
7
- export declare function collectRepeatableOption(value: string, previous: string[] | undefined): string[];
8
- //# sourceMappingURL=commanderOptions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"commanderOptions.d.ts","sourceRoot":"","sources":["../../src/lib/commanderOptions.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,uGAAuG;AACvG,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,SAAS,GAAG,MAAM,EAAE,CAE/F"}
@@ -1,10 +0,0 @@
1
- /**
2
- * Small commander.js `.option()` callback helpers. Extracted out of index.ts (not inline) —
3
- * STD-2/DEC-1504: index.ts is a grandfathered, shrink-only file; this extraction is the WP-582 B1
4
- * offset for that PR's `pb direction` command registration (import + addCommand, two lines).
5
- */
6
- /** Accumulate a repeatable `--flag <value>` option into an array (commander's variadic-flag idiom). */
7
- export function collectRepeatableOption(value, previous) {
8
- return [...(previous ?? []), value];
9
- }
10
- //# sourceMappingURL=commanderOptions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"commanderOptions.js","sourceRoot":"","sources":["../../src/lib/commanderOptions.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,uGAAuG;AACvG,MAAM,UAAU,uBAAuB,CAAC,KAAa,EAAE,QAA8B;IACnF,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC;AACtC,CAAC"}
@@ -1,18 +0,0 @@
1
- /**
2
- * Experiment assignment — deterministic path selection for A/B experiments.
3
- * WP-304: Dormant until PB_EXPERIMENT_304=1. When active, overrides PB_ONBOARDING_PATH.
4
- */
5
- export type ExperimentPath = 'A' | 'B';
6
- /**
7
- * Deterministic assignment based on workspace ID.
8
- * FNV-1a hash mod 2 — same workspace always gets the same path.
9
- */
10
- export declare function assignOnboardingPath(workspaceId: string): ExperimentPath;
11
- /** Check if the WP-304 experiment is active. */
12
- export declare function isExperimentActive(): boolean;
13
- /**
14
- * FNV-1a hash — fast, deterministic, good distribution for short strings.
15
- * Returns a positive 32-bit integer.
16
- */
17
- export declare function fnv1aHash(str: string): number;
18
- //# sourceMappingURL=experiment.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"experiment.d.ts","sourceRoot":"","sources":["../../src/lib/experiment.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,MAAM,cAAc,GAAG,GAAG,GAAG,GAAG,CAAC;AAEvC;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,MAAM,GAAG,cAAc,CAExE;AAED,gDAAgD;AAChD,wBAAgB,kBAAkB,IAAI,OAAO,CAE5C;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAO7C"}
@@ -1,28 +0,0 @@
1
- /**
2
- * Experiment assignment — deterministic path selection for A/B experiments.
3
- * WP-304: Dormant until PB_EXPERIMENT_304=1. When active, overrides PB_ONBOARDING_PATH.
4
- */
5
- /**
6
- * Deterministic assignment based on workspace ID.
7
- * FNV-1a hash mod 2 — same workspace always gets the same path.
8
- */
9
- export function assignOnboardingPath(workspaceId) {
10
- return fnv1aHash(workspaceId) % 2 === 0 ? 'A' : 'B';
11
- }
12
- /** Check if the WP-304 experiment is active. */
13
- export function isExperimentActive() {
14
- return process.env.PB_EXPERIMENT_304 === '1';
15
- }
16
- /**
17
- * FNV-1a hash — fast, deterministic, good distribution for short strings.
18
- * Returns a positive 32-bit integer.
19
- */
20
- export function fnv1aHash(str) {
21
- let hash = 0x811c9dc5; // FNV offset basis
22
- for (let i = 0; i < str.length; i++) {
23
- hash ^= str.charCodeAt(i);
24
- hash = (hash * 0x01000193) >>> 0; // FNV prime, keep as unsigned 32-bit
25
- }
26
- return hash >>> 0;
27
- }
28
- //# sourceMappingURL=experiment.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"experiment.js","sourceRoot":"","sources":["../../src/lib/experiment.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAC,WAAmB;IACtD,OAAO,SAAS,CAAC,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;AACtD,CAAC;AAED,gDAAgD;AAChD,MAAM,UAAU,kBAAkB;IAChC,OAAO,OAAO,CAAC,GAAG,CAAC,iBAAiB,KAAK,GAAG,CAAC;AAC/C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAC,GAAW;IACnC,IAAI,IAAI,GAAG,UAAU,CAAC,CAAC,mBAAmB;IAC1C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACpC,IAAI,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QAC1B,IAAI,GAAG,CAAC,IAAI,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,qCAAqC;IACzE,CAAC;IACD,OAAO,IAAI,KAAK,CAAC,CAAC;AACpB,CAAC"}
@@ -1,28 +0,0 @@
1
- /**
2
- * normalizeMaterializedFilename — WP-379 S5b
3
- *
4
- * Produces a lowercase, slug-friendly filename from an asset name.
5
- * Used by findLeftoverProjections/findLeftoverCursorSkills to compare on-disk filenames (which
6
- * may have been projected with a non-normalized case) against the canonical lowercase form
7
- * that handshake now writes.
8
- *
9
- * Contract:
10
- * - Output is lowercase.
11
- * - Non-alphanumeric, non-dot characters are replaced with hyphens.
12
- * - Leading dots (hidden-file convention) are stripped.
13
- * - Multiple consecutive hyphens are collapsed to a single hyphen.
14
- * - Leading and trailing hyphens are trimmed.
15
- * - Unicode characters that don't map to ASCII letters/digits are dropped.
16
- * - Idempotent: applying the function twice yields the same result.
17
- * - Empty input → empty output.
18
- *
19
- * Chain: WP-379 S5b.
20
- */
21
- /**
22
- * Normalize a materializedFilename to its canonical lowercase slug form.
23
- *
24
- * @param name The raw filename (e.g. "Setup-ProductBrain.mdc").
25
- * @returns The normalized filename (e.g. "setup-productbrain.mdc").
26
- */
27
- export declare function normalizeMaterializedFilename(name: string): string;
28
- //# sourceMappingURL=normalizeMaterializedFilename.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"normalizeMaterializedFilename.d.ts","sourceRoot":"","sources":["../../src/lib/normalizeMaterializedFilename.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAkClE"}
@@ -1,56 +0,0 @@
1
- /**
2
- * normalizeMaterializedFilename — WP-379 S5b
3
- *
4
- * Produces a lowercase, slug-friendly filename from an asset name.
5
- * Used by findLeftoverProjections/findLeftoverCursorSkills to compare on-disk filenames (which
6
- * may have been projected with a non-normalized case) against the canonical lowercase form
7
- * that handshake now writes.
8
- *
9
- * Contract:
10
- * - Output is lowercase.
11
- * - Non-alphanumeric, non-dot characters are replaced with hyphens.
12
- * - Leading dots (hidden-file convention) are stripped.
13
- * - Multiple consecutive hyphens are collapsed to a single hyphen.
14
- * - Leading and trailing hyphens are trimmed.
15
- * - Unicode characters that don't map to ASCII letters/digits are dropped.
16
- * - Idempotent: applying the function twice yields the same result.
17
- * - Empty input → empty output.
18
- *
19
- * Chain: WP-379 S5b.
20
- */
21
- /**
22
- * Normalize a materializedFilename to its canonical lowercase slug form.
23
- *
24
- * @param name The raw filename (e.g. "Setup-ProductBrain.mdc").
25
- * @returns The normalized filename (e.g. "setup-productbrain.mdc").
26
- */
27
- export function normalizeMaterializedFilename(name) {
28
- if (!name)
29
- return '';
30
- // 1. Strip leading dots (hidden-file prefix, e.g. ".cursor/rules/.hidden.mdc").
31
- // We only strip a single leading dot cluster at the start of the basename,
32
- // not dots that are part of extensions or internal names.
33
- const stripped = name.startsWith('.') ? name.replace(/^\.+/, '') : name;
34
- if (!stripped)
35
- return '';
36
- // 2. Lowercase the entire name (covers ASCII + Unicode basic-latin).
37
- const lowered = stripped.toLowerCase();
38
- // 3. Normalize Unicode: decompose then remove non-ASCII code points that
39
- // didn't map cleanly (e.g. accented chars become their base form via NFD
40
- // decomposition, then the combining diacritics are removed).
41
- // NFKD decomposes ligatures and compatibility forms as well.
42
- const ascii = lowered
43
- .normalize('NFKD')
44
- .replace(/[̀-ͯ]/g, '') // strip combining diacritics
45
- .replace(/[^\x00-\x7F]/g, ''); // drop remaining non-ASCII
46
- // 4. Replace any sequence of non-alphanumeric + non-dot characters with a
47
- // single hyphen. We preserve dots so that ".mdc" and ".md" extensions
48
- // are maintained in the output.
49
- const slugged = ascii.replace(/[^a-z0-9.]+/g, '-');
50
- // 5. Collapse consecutive hyphens → single hyphen.
51
- const collapsed = slugged.replace(/-{2,}/g, '-');
52
- // 6. Trim leading and trailing hyphens.
53
- const trimmed = collapsed.replace(/^-+|-+$/g, '');
54
- return trimmed;
55
- }
56
- //# sourceMappingURL=normalizeMaterializedFilename.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"normalizeMaterializedFilename.js","sourceRoot":"","sources":["../../src/lib/normalizeMaterializedFilename.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH;;;;;GAKG;AACH,MAAM,UAAU,6BAA6B,CAAC,IAAY;IACxD,IAAI,CAAC,IAAI;QAAE,OAAO,EAAE,CAAC;IAErB,gFAAgF;IAChF,8EAA8E;IAC9E,6DAA6D;IAC7D,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAExE,IAAI,CAAC,QAAQ;QAAE,OAAO,EAAE,CAAC;IAEzB,qEAAqE;IACrE,MAAM,OAAO,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC;IAEvC,yEAAyE;IACzE,4EAA4E;IAC5E,gEAAgE;IAChE,gEAAgE;IAChE,MAAM,KAAK,GAAG,OAAO;SAClB,SAAS,CAAC,MAAM,CAAC;SACjB,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,6BAA6B;SACnD,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC,CAAG,2BAA2B;IAE9D,0EAA0E;IAC1E,0EAA0E;IAC1E,mCAAmC;IACnC,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,cAAc,EAAE,GAAG,CAAC,CAAC;IAEnD,mDAAmD;IACnD,MAAM,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;IAEjD,wCAAwC;IACxC,MAAM,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;IAElD,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -1,16 +0,0 @@
1
- /**
2
- * normalizeMaterializedFilename unit tests — WP-379 S5b.
3
- *
4
- * Contract assertions:
5
- * - Setup-ProductBrain.mdc → setup-productbrain.mdc
6
- * - Already-normalized input is idempotent
7
- * - Unicode chars that map to ASCII (via NFKD) retain base form; others dropped
8
- * - Leading dot stripped; file is otherwise preserved
9
- * - Empty input returns empty string
10
- * - Extension dots are preserved
11
- * - Non-alphanumeric sequences → single hyphen
12
- *
13
- * Chain: WP-379 S5b.
14
- */
15
- export {};
16
- //# sourceMappingURL=normalizeMaterializedFilename.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"normalizeMaterializedFilename.test.d.ts","sourceRoot":"","sources":["../../src/lib/normalizeMaterializedFilename.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG"}
@@ -1,90 +0,0 @@
1
- /**
2
- * normalizeMaterializedFilename unit tests — WP-379 S5b.
3
- *
4
- * Contract assertions:
5
- * - Setup-ProductBrain.mdc → setup-productbrain.mdc
6
- * - Already-normalized input is idempotent
7
- * - Unicode chars that map to ASCII (via NFKD) retain base form; others dropped
8
- * - Leading dot stripped; file is otherwise preserved
9
- * - Empty input returns empty string
10
- * - Extension dots are preserved
11
- * - Non-alphanumeric sequences → single hyphen
12
- *
13
- * Chain: WP-379 S5b.
14
- */
15
- import { describe, expect, it } from 'vitest';
16
- import { normalizeMaterializedFilename } from './normalizeMaterializedFilename.js';
17
- describe('normalizeMaterializedFilename', () => {
18
- // ── Primary contract test (from bet spec) ───────────────────────────────────
19
- it('Setup-ProductBrain.mdc → setup-productbrain.mdc', () => {
20
- expect(normalizeMaterializedFilename('Setup-ProductBrain.mdc')).toBe('setup-productbrain.mdc');
21
- });
22
- // ── Idempotency ──────────────────────────────────────────────────────────────
23
- it('already-normalized input is idempotent', () => {
24
- const normalized = 'setup-productbrain.mdc';
25
- expect(normalizeMaterializedFilename(normalized)).toBe(normalized);
26
- });
27
- it('applying twice produces the same result', () => {
28
- const input = 'My Rule File.md';
29
- const once = normalizeMaterializedFilename(input);
30
- const twice = normalizeMaterializedFilename(once);
31
- expect(once).toBe(twice);
32
- });
33
- // ── Uppercase handling ────────────────────────────────────────────────────────
34
- it('lowercases all ASCII letters', () => {
35
- expect(normalizeMaterializedFilename('CHAIN-RULES.mdc')).toBe('chain-rules.mdc');
36
- });
37
- it('mixed case with spaces → lowercase with hyphens', () => {
38
- expect(normalizeMaterializedFilename('My Custom Rule.md')).toBe('my-custom-rule.md');
39
- });
40
- // ── Unicode normalization ─────────────────────────────────────────────────────
41
- it('accented chars via NFKD → base ASCII (é → e)', () => {
42
- expect(normalizeMaterializedFilename('Régle.md')).toBe('regle.md');
43
- });
44
- it('non-ASCII chars that cannot normalize → dropped', () => {
45
- // Chinese chars don't map to ASCII — they're dropped, hyphens collapsed.
46
- const result = normalizeMaterializedFilename('设置规则.md');
47
- // No Chinese remains; just the extension part
48
- expect(result).toBe('.md');
49
- });
50
- it('ligature "fi" decomposes to "fi"', () => {
51
- // NFKD decomposes fi (fi ligature, U+FB01) to 'f' + 'i'
52
- expect(normalizeMaterializedFilename('file.md')).toBe('file.md');
53
- });
54
- // ── Leading dots ──────────────────────────────────────────────────────────────
55
- it('single leading dot is stripped', () => {
56
- expect(normalizeMaterializedFilename('.hidden-rule.md')).toBe('hidden-rule.md');
57
- });
58
- it('multiple leading dots are stripped', () => {
59
- expect(normalizeMaterializedFilename('..doubly-hidden.md')).toBe('doubly-hidden.md');
60
- });
61
- it('dot-only input returns empty string', () => {
62
- expect(normalizeMaterializedFilename('.')).toBe('');
63
- });
64
- it('extension dot mid-name is preserved', () => {
65
- // "foo.bar.mdc" → "foo.bar.mdc"
66
- expect(normalizeMaterializedFilename('foo.bar.mdc')).toBe('foo.bar.mdc');
67
- });
68
- // ── Empty input ──────────────────────────────────────────────────────────────
69
- it('empty string returns empty string', () => {
70
- expect(normalizeMaterializedFilename('')).toBe('');
71
- });
72
- // ── Special character sequences ───────────────────────────────────────────────
73
- it('multiple consecutive spaces → single hyphen', () => {
74
- expect(normalizeMaterializedFilename('a b.md')).toBe('a-b.md');
75
- });
76
- it('underscores replaced with hyphens', () => {
77
- expect(normalizeMaterializedFilename('my_rule_file.mdc')).toBe('my-rule-file.mdc');
78
- });
79
- it('leading and trailing hyphens are trimmed', () => {
80
- expect(normalizeMaterializedFilename('-foo-')).toBe('foo');
81
- });
82
- it('mixed special chars collapse to single hyphen', () => {
83
- expect(normalizeMaterializedFilename('foo!@#bar.mdc')).toBe('foo-bar.mdc');
84
- });
85
- // ── No extension ────────────────────────────────────────────────────────────
86
- it('name without extension is normalized', () => {
87
- expect(normalizeMaterializedFilename('MyRule')).toBe('myrule');
88
- });
89
- });
90
- //# sourceMappingURL=normalizeMaterializedFilename.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"normalizeMaterializedFilename.test.js","sourceRoot":"","sources":["../../src/lib/normalizeMaterializedFilename.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AAEnF,QAAQ,CAAC,+BAA+B,EAAE,GAAG,EAAE;IAC7C,+EAA+E;IAC/E,EAAE,CAAC,iDAAiD,EAAE,GAAG,EAAE;QACzD,MAAM,CAAC,6BAA6B,CAAC,wBAAwB,CAAC,CAAC,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;IACjG,CAAC,CAAC,CAAC;IAEH,gFAAgF;IAChF,EAAE,CAAC,wCAAwC,EAAE,GAAG,EAAE;QAChD,MAAM,UAAU,GAAG,wBAAwB,CAAC;QAC5C,MAAM,CAAC,6BAA6B,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACrE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,yCAAyC,EAAE,GAAG,EAAE;QACjD,MAAM,KAAK,GAAG,iBAAiB,CAAC;QAChC,MAAM,IAAI,GAAG,6BAA6B,CAAC,KAAK,CAAC,CAAC;QAClD,MAAM,KAAK,GAAG,6BAA6B,CAAC,IAAI,CAAC,CAAC;QAClD,MAAM,CAAC,IAAI,CAAC,CA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CAAC,sCAAsC,EAAE,GAAG,EAAE;QAC9C,MAAM,CAAC,6BAA6B,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACjE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,39 +0,0 @@
1
- /**
2
- * Local repo detection — reads filesystem signals to build a RepoContext.
3
- * No API calls. Pure filesystem inspection.
4
- */
5
- /**
6
- * Workspace maturity profile derived from the Chain's workspaceReadiness signal.
7
- * Used by handshake to tailor generated context files (BET-170, DEC-291).
8
- *
9
- * WP-762 C4e-3 (DEC-1800): the `stage` ladder ('blank' | 'seeded' | 'grounded' | 'connected')
10
- * is deleted from the backend response — no field on this profile derives from it any more.
11
- */
12
- export interface WorkspaceProfile {
13
- totalEntries: number;
14
- totalRelations: number;
15
- collectionCount: number;
16
- activeCount: number;
17
- draftCount: number;
18
- orphanedCount: number;
19
- }
20
- /**
21
- * Extract a WorkspaceProfile from the raw workspaceReadiness API response.
22
- * Returns null on any failure — callers must handle null (fail-open pattern).
23
- *
24
- * WP-751 M3a-5b (TASK-210, DEC-1700): governanceMode is deleted from the required-fields
25
- * gate below and the returned profile — the backend workspaceReadiness response no longer
26
- * carries it at all (role is the only governance mode now), so requiring it truthy would
27
- * have made this function return null unconditionally instead of just dropping one field.
28
- */
29
- export declare function extractWorkspaceProfile(response: unknown): WorkspaceProfile | null;
30
- export interface RepoContext {
31
- name: string | null;
32
- description: string | null;
33
- gitRemote: string | null;
34
- repoSlug: string | null;
35
- detectedStack: string[];
36
- isMonorepo: boolean;
37
- }
38
- export declare function detectRepo(cwd?: string): RepoContext;
39
- //# sourceMappingURL=repo-detect.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"repo-detect.d.ts","sourceRoot":"","sources":["../../src/lib/repo-detect.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,OAAO,GAAG,gBAAgB,GAAG,IAAI,CAoBlF;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,wBAAgB,UAAU,CAAC,GAAG,SAAgB,GAAG,WAAW,CAiD3D"}