@funnelsgrove/cli 0.1.132 → 0.1.140

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.
package/README.md CHANGED
@@ -107,5 +107,18 @@ fgrove analytics conversions --project claimbee --funnel claimbee-ios --date 202
107
107
  `conversions` downloads the one-day conversion totals, primary conversion metrics, full funnel path rows, and step transitions. `funnel-path` focuses on the ordered path report. `transitions` focuses on step-by-step advanced/drop-off counts. `cohort` downloads synced marketing cohort economics for the day. If the requested day has no synced data, or cohort source data is incomplete, the CLI exits non-zero with a human-readable explanation.
108
108
 
109
109
  The package also keeps the longer `funnelsgrove` command as a compatibility alias.
110
+
111
+ Edit profitability expenses through a local JSON file:
112
+
113
+ ```bash
114
+ fgrove expenses pull --project claimbee --file expenses.json
115
+ # edit expenses.json; omit id and updatedAt for new expenses
116
+ fgrove expenses publish --project claimbee --file expenses.json
117
+ ```
118
+
119
+ Publishing creates new rows and updates rows already present in the file. It never
120
+ deletes remote expenses that are absent from the file, and it refuses to overwrite
121
+ rows changed since the last pull. Pull again to resolve a concurrent edit.
122
+
110
123
  Use `--api-url` or `FUNNELSGROVE_API_URL` for non-production APIs.
111
124
  Use `--config` or `FUNNELSGROVE_CONFIG` to keep test credentials separate from the default `~/.funnelsgrove/config.json`.
package/dist/cli.js CHANGED
@@ -15,7 +15,8 @@ import { buildCommittedSyncManifest, buildDownloadedSyncManifest, buildSourceCan
15
15
  import { mergeTextSourceWithGit } from './sourceRebase.js';
16
16
  import { executeExperimentCreate, formatExperimentCreateSuccess, recoverExperimentCreateTransaction, } from './experimentCreate.js';
17
17
  import { pullEnvFile } from './envSync.js';
18
- import { executeEmailPull, executeEmailPush, executeEmailSend, executeEmailSequenceAddStep, executeEmailSequenceCreate, executeEmailSequencePublish, executeEmailSequenceSetActive, executeEmailTemplatePublish, executeEmailValidate, parseEmailVariablesJson, } from './emailCommands.js';
18
+ import { executeExpensePublish, executeExpensePull } from './expenseCommands.js';
19
+ import { executeEmailPull, executeEmailPush, executeEmailSend, executeEmailUpdateVariables, executeEmailSequenceAddStep, executeEmailSequenceCancel, executeEmailSequenceCreate, executeEmailSequencePublish, executeEmailSequenceSetActive, executeEmailTemplatePublish, executeEmailValidate, parseEmailVariablesJson, } from './emailCommands.js';
19
20
  import { formatGitHubConnectRows, formatGitHubJobRows, formatGitHubStatusRows, } from './githubOutput.js';
20
21
  import { GitHubSyncTimeoutError, syncGitHubDraftIfConnected, } from './githubSyncFlow.js';
21
22
  import { reskinFunnel } from './reskin.js';
@@ -1768,6 +1769,21 @@ emailCommand
1768
1769
  throw new Error(`Email delivery ${result.id} finished with status ${result.status}.`);
1769
1770
  }
1770
1771
  });
1772
+ emailCommand
1773
+ .command('update-variables <delivery-id>')
1774
+ .description('Update variables for a queued personalized sequence email')
1775
+ .requiredOption('--variables <json>', 'Variables to merge as a JSON object')
1776
+ .option('--api-url <url>', 'Emails SDK API URL', process.env.FUNNELSGROVE_EMAILS_API_URL || 'https://sdk-api.funnelsgrove.com')
1777
+ .option('--private-token <token>', 'Private project token (defaults to FUNNELSGROVE_PRIVATE_TOKEN)', process.env.FUNNELSGROVE_PRIVATE_TOKEN)
1778
+ .action(async (deliveryId, options) => {
1779
+ const result = await executeEmailUpdateVariables({
1780
+ apiUrl: options.apiUrl,
1781
+ privateToken: options.privateToken || '',
1782
+ deliveryId,
1783
+ variables: parseEmailVariablesJson(options.variables),
1784
+ });
1785
+ console.log(JSON.stringify(result, null, 2));
1786
+ });
1771
1787
  addEmailScopeOptions(emailCommand
1772
1788
  .command('pull')
1773
1789
  .description('Pull project email drafts into local files'))
@@ -1831,7 +1847,8 @@ addEmailScopeOptions(emailSequenceCommand
1831
1847
  .option('--funnel-id <uuid>', 'Limit the sequence to one project funnel')
1832
1848
  .option('--all-funnels', 'Apply the sequence to every funnel in the project')
1833
1849
  .option('--delay-hours <hours>', 'First-step delay in hours')
1834
- .option('--delay-days <days>', 'First-step delay in days'))
1850
+ .option('--delay-days <days>', 'First-step delay in days')
1851
+ .option('--personalize', 'Request a personalization webhook 20 minutes before sending'))
1835
1852
  .action(async (slug, options) => {
1836
1853
  if (Boolean(options.funnelId) === Boolean(options.allFunnels)) {
1837
1854
  throw new Error('Provide exactly one of --funnel-id or --all-funnels.');
@@ -1848,6 +1865,7 @@ addEmailScopeOptions(emailSequenceCommand
1848
1865
  firstStepKey: options.key,
1849
1866
  templateSlug: options.template,
1850
1867
  delaySeconds: parseEmailSequenceDelay(options),
1868
+ personalizationEnabled: options.personalize,
1851
1869
  });
1852
1870
  console.log(`Created local email sequence ${slug}.`);
1853
1871
  });
@@ -1859,12 +1877,15 @@ addEmailScopeOptions(emailSequenceCommand
1859
1877
  .option('--subject <subject>', 'Direct-copy subject')
1860
1878
  .option('--body <body>', 'Direct-copy plain-text body')
1861
1879
  .option('--delay-hours <hours>', 'Delay after the previous step in hours')
1862
- .option('--delay-days <days>', 'Delay after the previous step in days'))
1880
+ .option('--delay-days <days>', 'Delay after the previous step in days')
1881
+ .option('--personalize', 'Request a personalization webhook 20 minutes before sending'))
1863
1882
  .action(async (slug, options) => {
1864
1883
  const direct = options.subject !== undefined || options.body !== undefined;
1865
1884
  if (Boolean(options.template) === direct || (direct && (!options.subject || !options.body))) {
1866
1885
  throw new Error('Provide either --template or both --subject and --body.');
1867
1886
  }
1887
+ if (direct && options.personalize)
1888
+ throw new Error('--personalize is available only with --template.');
1868
1889
  await executeEmailSequenceAddStep({
1869
1890
  ...await resolveEmailCommandScope(options),
1870
1891
  slug,
@@ -1873,6 +1894,7 @@ addEmailScopeOptions(emailSequenceCommand
1873
1894
  subject: options.subject,
1874
1895
  body: options.body,
1875
1896
  delaySeconds: parseEmailSequenceDelay(options),
1897
+ personalizationEnabled: options.personalize,
1876
1898
  });
1877
1899
  console.log(`Added email sequence step ${options.key} to ${slug}.`);
1878
1900
  });
@@ -1900,6 +1922,25 @@ for (const active of [true, false]) {
1900
1922
  console.log(`${active ? 'Enabled' : 'Disabled'} email sequence ${slug}.`);
1901
1923
  });
1902
1924
  }
1925
+ emailSequenceCommand
1926
+ .command('cancel <slug>')
1927
+ .description('Idempotently cancel active enrollments for one funnel user')
1928
+ .requiredOption('--user-id <uuid>', 'FunnelsGrove funnel end-user ID')
1929
+ .option('--reason <reason>', 'Cancellation reason', 'manual')
1930
+ .option('--dir <path>', 'Directory containing the emails folder', '.')
1931
+ .option('--api-url <url>', 'Emails SDK API URL', process.env.FUNNELSGROVE_EMAILS_API_URL || 'https://sdk-api.funnelsgrove.com')
1932
+ .option('--private-token <token>', 'Private project token (defaults to FUNNELSGROVE_PRIVATE_TOKEN)', process.env.FUNNELSGROVE_PRIVATE_TOKEN)
1933
+ .action(async (slug, options) => {
1934
+ const result = await executeEmailSequenceCancel({
1935
+ apiUrl: options.apiUrl,
1936
+ privateToken: options.privateToken || '',
1937
+ sourceDir: path.resolve(process.cwd(), options.dir),
1938
+ slug,
1939
+ funnelEndUserId: options.userId,
1940
+ reason: options.reason,
1941
+ });
1942
+ console.log(JSON.stringify(result, null, 2));
1943
+ });
1903
1944
  const projectsCommand = addExamples(program.command('projects').description('Manage projects'), [
1904
1945
  'fgrove projects list',
1905
1946
  'fgrove projects list --workspace acme',
@@ -1917,6 +1958,42 @@ addExamples(projectsCommand
1917
1958
  const projects = await listProjects(token, workspaceId);
1918
1959
  printRows(projects, ['id', 'name', 'slug']);
1919
1960
  });
1961
+ const addExpenseScopeOptions = (command) => command
1962
+ .option('--workspace <id-or-slug-or-name>', 'Workspace id, slug, or name')
1963
+ .option('--project <id-or-slug-or-name>', 'Project id, slug, or name')
1964
+ .option('--file <path>', 'Expense JSON file', 'expenses.json');
1965
+ const resolveExpenseCommandScope = async (options) => {
1966
+ const token = await readAuthToken();
1967
+ const workspaceId = await resolveWorkspaceId(token, options.workspace);
1968
+ const project = await resolveAnalyticsProject({ token, workspaceId, project: options.project });
1969
+ return {
1970
+ callApi,
1971
+ token,
1972
+ workspaceId,
1973
+ projectId: project.id,
1974
+ filePath: path.resolve(process.cwd(), options.file),
1975
+ };
1976
+ };
1977
+ const expensesCommand = addExamples(program.command('expenses').description('Edit project profitability expenses'), [
1978
+ 'fgrove expenses pull --project claimbee',
1979
+ 'fgrove expenses publish --project claimbee',
1980
+ ]);
1981
+ addExpenseScopeOptions(expensesCommand
1982
+ .command('pull')
1983
+ .description('Download profitability expenses to an editable JSON file'))
1984
+ .action(async (options) => {
1985
+ const scope = await resolveExpenseCommandScope(options);
1986
+ const count = await executeExpensePull(scope);
1987
+ console.log(`Pulled ${count} expense${count === 1 ? '' : 's'} to ${scope.filePath}.`);
1988
+ });
1989
+ addExpenseScopeOptions(expensesCommand
1990
+ .command('publish')
1991
+ .description('Create and update expenses from an edited JSON file'))
1992
+ .action(async (options) => {
1993
+ const scope = await resolveExpenseCommandScope(options);
1994
+ const result = await executeExpensePublish(scope);
1995
+ console.log(`Published expenses: ${result.created} created, ${result.updated} updated.`);
1996
+ });
1920
1997
  const funnelsCommand = addExamples(program.command('funnels').description('Manage funnels'), [
1921
1998
  'fgrove funnels list',
1922
1999
  'fgrove funnels clone --funnel claimbee --name claimbee-ios',
@@ -38,6 +38,28 @@ export declare function executeEmailSend(input: {
38
38
  sleep?: (durationMs: number) => Promise<void>;
39
39
  now?: () => number;
40
40
  }): Promise<EmailSendStatus>;
41
+ export declare function executeEmailUpdateVariables(input: {
42
+ apiUrl: string;
43
+ privateToken: string;
44
+ deliveryId: string;
45
+ variables: Record<string, string | number | boolean>;
46
+ }, dependencies?: {
47
+ fetchImpl?: EmailSendFetch;
48
+ }): Promise<Record<string, unknown>>;
49
+ export declare function executeEmailSequenceCancel(input: {
50
+ apiUrl: string;
51
+ privateToken: string;
52
+ sourceDir: string;
53
+ slug: string;
54
+ funnelEndUserId: string;
55
+ reason: string;
56
+ }, dependencies?: {
57
+ fetchImpl?: EmailSendFetch;
58
+ }): Promise<{
59
+ sequenceId: string;
60
+ funnelEndUserId: string;
61
+ cancelled: number;
62
+ }>;
41
63
  export declare function executeEmailPull(scope: EmailCommandScope): Promise<{
42
64
  templates: number;
43
65
  sequences: number;
@@ -56,6 +78,7 @@ export declare function executeEmailSequenceAddStep(input: EmailCommandScope & {
56
78
  subject?: string;
57
79
  body?: string;
58
80
  delaySeconds: number;
81
+ personalizationEnabled?: boolean;
59
82
  }): Promise<void>;
60
83
  export declare function executeEmailSequenceCreate(input: EmailCommandScope & {
61
84
  slug: string;
@@ -65,6 +88,7 @@ export declare function executeEmailSequenceCreate(input: EmailCommandScope & {
65
88
  firstStepKey: string;
66
89
  templateSlug: string;
67
90
  delaySeconds: number;
91
+ personalizationEnabled?: boolean;
68
92
  }): Promise<void>;
69
93
  export declare function executeEmailSequenceSetActive(input: EmailCommandScope & {
70
94
  slug: string;
@@ -84,6 +84,59 @@ export async function executeEmailSend(input, dependencies = {}) {
84
84
  }
85
85
  throw new Error(`Timed out waiting for email delivery ${receipt.id}.`);
86
86
  }
87
+ export async function executeEmailUpdateVariables(input, dependencies = {}) {
88
+ if (!input.privateToken.trim())
89
+ throw new Error('A private project token is required.');
90
+ if (!UUID.test(input.deliveryId))
91
+ throw new Error('Delivery ID must be a UUID.');
92
+ return emailApiRequest({
93
+ apiUrl: input.apiUrl,
94
+ privateToken: input.privateToken,
95
+ path: `/sdk/private/emails/${encodeURIComponent(input.deliveryId)}/variables`,
96
+ method: 'PATCH',
97
+ body: { variables: input.variables },
98
+ fetchImpl: dependencies.fetchImpl || fetch,
99
+ });
100
+ }
101
+ export async function executeEmailSequenceCancel(input, dependencies = {}) {
102
+ if (!input.privateToken.trim())
103
+ throw new Error('A private project token is required.');
104
+ if (!UUID.test(input.funnelEndUserId))
105
+ throw new Error('Funnel end-user ID must be a UUID.');
106
+ const files = await readEmailFiles(input.sourceDir);
107
+ assertValidFiles(files);
108
+ const sequence = files.sequences.find((item) => item.slug === input.slug);
109
+ if (!sequence)
110
+ throw new Error(`Email sequence "${input.slug}" was not found locally.`);
111
+ if (!sequence.id)
112
+ throw new Error(`Push email sequence "${input.slug}" before cancelling an enrollment.`);
113
+ const remote = await emailApiRequest({
114
+ apiUrl: input.apiUrl,
115
+ privateToken: input.privateToken,
116
+ path: `/sdk/private/sequences/${encodeURIComponent(sequence.id)}`,
117
+ fetchImpl: dependencies.fetchImpl || fetch,
118
+ });
119
+ if (!isRecord(remote.sequence)
120
+ || remote.sequence.id !== sequence.id
121
+ || remote.sequence.slug !== sequence.slug) {
122
+ throw new Error(`Email identity mismatch: ID ${sequence.id} does not match local sequence slug "${sequence.slug}".`);
123
+ }
124
+ const response = await emailApiRequest({
125
+ apiUrl: input.apiUrl,
126
+ privateToken: input.privateToken,
127
+ path: `/sdk/private/sequences/${encodeURIComponent(sequence.id)}/enrollments/${encodeURIComponent(input.funnelEndUserId)}/cancel`,
128
+ method: 'POST',
129
+ body: { reason: input.reason },
130
+ fetchImpl: dependencies.fetchImpl || fetch,
131
+ });
132
+ if (response.sequenceId !== sequence.id
133
+ || response.funnelEndUserId !== input.funnelEndUserId
134
+ || !Number.isInteger(response.cancelled)
135
+ || Number(response.cancelled) < 0) {
136
+ throw new Error('Email API returned an invalid sequence cancellation result.');
137
+ }
138
+ return response;
139
+ }
87
140
  const hasDraft = (value) => (isRecord(value) && isRecord(value.draft));
88
141
  const assertRemoteResource = (value, resource) => {
89
142
  if (!isRecord(value)
@@ -169,11 +222,13 @@ const canonicalResource = (kind, value) => {
169
222
  mode: 'template',
170
223
  templateVersionId: step.templateVersionId,
171
224
  variables: isRecord(step.variables) ? step.variables : {},
225
+ personalizationEnabled: step.personalizationEnabled === true,
172
226
  }
173
227
  : step),
174
228
  exitEventTypes: Array.isArray(value.draft.exitEventTypes)
175
229
  ? [...new Set(value.draft.exitEventTypes)].sort()
176
230
  : [],
231
+ unsubscribeEnabled: value.draft.unsubscribeEnabled !== false,
177
232
  });
178
233
  };
179
234
  const loadCompleteItems = async (scope, input) => {
@@ -333,6 +388,7 @@ export async function executeEmailSequenceAddStep(input) {
333
388
  mode: 'template',
334
389
  templateVersionId,
335
390
  variables: {},
391
+ ...(input.personalizationEnabled ? { personalizationEnabled: true } : {}),
336
392
  });
337
393
  }
338
394
  await writeEmailSequenceFile(input.sourceDir, sequence);
@@ -382,10 +438,12 @@ export async function executeEmailSequenceCreate(input) {
382
438
  mode: 'template',
383
439
  templateVersionId,
384
440
  variables: {},
441
+ ...(input.personalizationEnabled ? { personalizationEnabled: true } : {}),
385
442
  }],
386
443
  exitEventTypes: input.triggerEventType === 'purchase_completed'
387
444
  ? []
388
445
  : ['purchase_completed'],
446
+ unsubscribeEnabled: true,
389
447
  },
390
448
  });
391
449
  }
@@ -1,6 +1,7 @@
1
1
  import { type FunnelValidationDiagnostic } from './diagnosticOutput.js';
2
2
  export type EmailTemplateVariableType = 'string' | 'number' | 'boolean';
3
3
  export type EmailEventType = 'email_captured' | 'purchase_completed' | 'registration_completed';
4
+ export type EmailSequenceExitEventType = Exclude<EmailEventType, 'email_captured'>;
4
5
  export type EmailTemplateDraft = {
5
6
  subject: string;
6
7
  previewText: string | null;
@@ -20,6 +21,7 @@ export type EmailSequenceTemplateStep = {
20
21
  mode: 'template';
21
22
  templateVersionId: string;
22
23
  variables: Record<string, string | number | boolean>;
24
+ personalizationEnabled?: boolean;
23
25
  };
24
26
  export type EmailSequenceDirectStep = {
25
27
  key: string;
@@ -33,7 +35,8 @@ export type EmailSequenceDraft = {
33
35
  triggerEventType: EmailEventType;
34
36
  funnelIds: string[];
35
37
  steps: EmailSequenceStep[];
36
- exitEventTypes: EmailEventType[];
38
+ exitEventTypes: EmailSequenceExitEventType[];
39
+ unsubscribeEnabled: boolean;
37
40
  };
38
41
  export type EmailSequenceFile = {
39
42
  id: string | null;
@@ -7,6 +7,10 @@ const EMAIL_EVENTS = new Set([
7
7
  'purchase_completed',
8
8
  'registration_completed',
9
9
  ]);
10
+ const EMAIL_EXIT_EVENTS = new Set([
11
+ 'purchase_completed',
12
+ 'registration_completed',
13
+ ]);
10
14
  const VARIABLE_TYPES = new Set(['string', 'number', 'boolean']);
11
15
  const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
12
16
  const SLUG = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
@@ -29,9 +33,10 @@ const SEQUENCE_KEYS = new Set([
29
33
  'funnelIds',
30
34
  'steps',
31
35
  'exitEventTypes',
36
+ 'unsubscribeEnabled',
32
37
  ]);
33
38
  const LEGACY_SEQUENCE_STEP_KEYS = new Set(['key', 'delaySeconds', 'templateVersionId']);
34
- const TEMPLATE_SEQUENCE_STEP_KEYS = new Set(['key', 'delaySeconds', 'mode', 'templateVersionId', 'variables']);
39
+ const TEMPLATE_SEQUENCE_STEP_KEYS = new Set(['key', 'delaySeconds', 'mode', 'templateVersionId', 'variables', 'personalizationEnabled']);
35
40
  const DIRECT_SEQUENCE_STEP_KEYS = new Set(['key', 'delaySeconds', 'mode', 'subject', 'body']);
36
41
  const isRecord = (value) => (typeof value === 'object' && value !== null && !Array.isArray(value));
37
42
  const assertNoSymlinkPath = async (root, relativePath = '') => {
@@ -285,6 +290,9 @@ const validateSequence = (value, pathSlug, file, diagnostics) => {
285
290
  diagnostics.push(schemaDiagnostic(file, `steps[${index}].templateVersionId`, 'UUID', step.templateVersionId));
286
291
  }
287
292
  if (stepMode === 'template') {
293
+ if (step.personalizationEnabled !== undefined && typeof step.personalizationEnabled !== 'boolean') {
294
+ diagnostics.push(schemaDiagnostic(file, `steps[${index}].personalizationEnabled`, 'boolean', step.personalizationEnabled));
295
+ }
288
296
  if (!isRecord(step.variables)) {
289
297
  diagnostics.push(schemaDiagnostic(file, `steps[${index}].variables`, 'object', step.variables));
290
298
  }
@@ -302,19 +310,22 @@ const validateSequence = (value, pathSlug, file, diagnostics) => {
302
310
  }
303
311
  });
304
312
  }
305
- if (!Array.isArray(value.exitEventTypes) || value.exitEventTypes.length > EMAIL_EVENTS.size) {
306
- diagnostics.push(schemaDiagnostic(file, 'exitEventTypes', 'up to 3 event types', value.exitEventTypes));
313
+ if (!Array.isArray(value.exitEventTypes) || value.exitEventTypes.length > EMAIL_EXIT_EVENTS.size) {
314
+ diagnostics.push(schemaDiagnostic(file, 'exitEventTypes', 'up to 2 event types', value.exitEventTypes));
307
315
  }
308
316
  else {
309
317
  value.exitEventTypes.forEach((event, index) => {
310
- if (!EMAIL_EVENTS.has(event)) {
311
- diagnostics.push(schemaDiagnostic(file, `exitEventTypes[${index}]`, [...EMAIL_EVENTS], event));
318
+ if (!EMAIL_EXIT_EVENTS.has(event)) {
319
+ diagnostics.push(schemaDiagnostic(file, `exitEventTypes[${index}]`, [...EMAIL_EXIT_EVENTS], event));
312
320
  }
313
321
  });
314
322
  if (value.exitEventTypes.includes(value.triggerEventType)) {
315
323
  diagnostics.push(schemaDiagnostic(file, 'exitEventTypes', 'events excluding triggerEventType', value.exitEventTypes));
316
324
  }
317
325
  }
326
+ if (value.unsubscribeEnabled !== undefined && typeof value.unsubscribeEnabled !== 'boolean') {
327
+ diagnostics.push(schemaDiagnostic(file, 'unsubscribeEnabled', 'boolean', value.unsubscribeEnabled));
328
+ }
318
329
  if (diagnostics.length !== initialCount)
319
330
  return null;
320
331
  return {
@@ -338,8 +349,10 @@ const validateSequence = (value, pathSlug, file, diagnostics) => {
338
349
  mode: 'template',
339
350
  templateVersionId: step.templateVersionId,
340
351
  variables: (step.variables || {}),
352
+ ...(step.personalizationEnabled === true ? { personalizationEnabled: true } : {}),
341
353
  }),
342
354
  exitEventTypes: value.exitEventTypes,
355
+ unsubscribeEnabled: value.unsubscribeEnabled ?? true,
343
356
  },
344
357
  };
345
358
  };
@@ -507,8 +520,10 @@ export async function writeEmailSequenceFile(sourceDir, sequence) {
507
520
  mode: 'template',
508
521
  templateVersionId: step.templateVersionId,
509
522
  variables: step.variables || {},
523
+ ...(step.personalizationEnabled ? { personalizationEnabled: true } : {}),
510
524
  }),
511
525
  exitEventTypes: sortedUnique(sequence.draft.exitEventTypes),
526
+ unsubscribeEnabled: sequence.draft.unsubscribeEnabled,
512
527
  };
513
528
  await writeAtomic(path.join(sequenceRoot, `${sequence.slug}.json`), `${JSON.stringify(serialized, null, 2)}\n`);
514
529
  }
@@ -0,0 +1,51 @@
1
+ type CallApi = <T>(input: {
2
+ path: string;
3
+ type: 'query' | 'mutation';
4
+ data?: unknown;
5
+ token?: string | null;
6
+ }) => Promise<T>;
7
+ export type ExpenseApiRow = {
8
+ id: string;
9
+ project_id: string;
10
+ expense_date: string | null;
11
+ expense_month: string;
12
+ category: string;
13
+ vendor: string | null;
14
+ description: string | null;
15
+ amount_minor: number;
16
+ currency: string;
17
+ updated_at: string;
18
+ };
19
+ export type ExpenseFileItem = {
20
+ id?: string;
21
+ updatedAt?: string;
22
+ date: string;
23
+ category: string;
24
+ vendor: string | null;
25
+ description: string | null;
26
+ amount: string;
27
+ currency: string;
28
+ };
29
+ export type ExpenseFile = {
30
+ schemaVersion: 1;
31
+ projectId: string;
32
+ expenses: ExpenseFileItem[];
33
+ };
34
+ type ExpenseCommandScope = {
35
+ callApi: CallApi;
36
+ token: string;
37
+ workspaceId: string;
38
+ projectId: string;
39
+ };
40
+ export declare const amountToMinor: (amount: string) => number;
41
+ export declare const parseExpenseFile: (contents: string, expectedProjectId: string) => ExpenseFile;
42
+ export declare const executeExpensePull: (input: ExpenseCommandScope & {
43
+ filePath: string;
44
+ }) => Promise<number>;
45
+ export declare const executeExpensePublish: (input: ExpenseCommandScope & {
46
+ filePath: string;
47
+ }) => Promise<{
48
+ created: number;
49
+ updated: number;
50
+ }>;
51
+ export {};
@@ -0,0 +1,183 @@
1
+ import { readFile, writeFile } from 'node:fs/promises';
2
+ const DATE_PATTERN = /^\d{4}-\d{2}-\d{2}$/;
3
+ const UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
4
+ const MONEY_PATTERN = /^(0|[1-9]\d*)(\.\d{1,2})?$/;
5
+ const asObject = (value, label) => {
6
+ if (!value || typeof value !== 'object' || Array.isArray(value)) {
7
+ throw new Error(`${label} must be an object.`);
8
+ }
9
+ return value;
10
+ };
11
+ const requiredString = (value, label) => {
12
+ if (typeof value !== 'string' || !value.trim())
13
+ throw new Error(`${label} must be a non-empty string.`);
14
+ return value.trim();
15
+ };
16
+ const nullableString = (value, label) => {
17
+ if (value === null || value === undefined || value === '')
18
+ return null;
19
+ if (typeof value !== 'string')
20
+ throw new Error(`${label} must be a string or null.`);
21
+ return value.trim() || null;
22
+ };
23
+ export const amountToMinor = (amount) => {
24
+ if (!MONEY_PATTERN.test(amount))
25
+ throw new Error(`Invalid expense amount "${amount}". Use a non-negative value with at most two decimals.`);
26
+ const [whole, fraction = ''] = amount.split('.');
27
+ const minor = Number(whole) * 100 + Number(fraction.padEnd(2, '0'));
28
+ if (!Number.isSafeInteger(minor))
29
+ throw new Error(`Expense amount "${amount}" is too large.`);
30
+ return minor;
31
+ };
32
+ const formatAmount = (amountMinor) => {
33
+ const whole = Math.floor(amountMinor / 100);
34
+ return `${whole}.${String(amountMinor % 100).padStart(2, '0')}`;
35
+ };
36
+ const rowToFileItem = (row) => ({
37
+ id: row.id,
38
+ updatedAt: row.updated_at,
39
+ date: row.expense_date || row.expense_month,
40
+ category: row.category,
41
+ vendor: row.vendor,
42
+ description: row.description,
43
+ amount: formatAmount(row.amount_minor),
44
+ currency: row.currency,
45
+ });
46
+ export const parseExpenseFile = (contents, expectedProjectId) => {
47
+ let parsed;
48
+ try {
49
+ parsed = JSON.parse(contents);
50
+ }
51
+ catch {
52
+ throw new Error('Expense file is not valid JSON.');
53
+ }
54
+ const root = asObject(parsed, 'Expense file');
55
+ if (root.schemaVersion !== 1)
56
+ throw new Error('Expense file schemaVersion must be 1.');
57
+ const projectId = requiredString(root.projectId, 'projectId');
58
+ if (projectId !== expectedProjectId) {
59
+ throw new Error(`Expense file belongs to project ${projectId}, not ${expectedProjectId}.`);
60
+ }
61
+ if (!Array.isArray(root.expenses))
62
+ throw new Error('expenses must be an array.');
63
+ const seenIds = new Set();
64
+ const expenses = root.expenses.map((value, index) => {
65
+ const label = `expenses[${index}]`;
66
+ const item = asObject(value, label);
67
+ const id = item.id === undefined ? undefined : requiredString(item.id, `${label}.id`);
68
+ if (id && !UUID_PATTERN.test(id))
69
+ throw new Error(`${label}.id must be a UUID.`);
70
+ if (id && seenIds.has(id))
71
+ throw new Error(`Duplicate expense id ${id}.`);
72
+ if (id)
73
+ seenIds.add(id);
74
+ const updatedAt = item.updatedAt === undefined
75
+ ? undefined
76
+ : requiredString(item.updatedAt, `${label}.updatedAt`);
77
+ if (id && !updatedAt)
78
+ throw new Error(`${label}.updatedAt is required when id is present.`);
79
+ if (!id && updatedAt)
80
+ throw new Error(`${label}.updatedAt is only valid when id is present.`);
81
+ const date = requiredString(item.date, `${label}.date`);
82
+ if (!DATE_PATTERN.test(date))
83
+ throw new Error(`${label}.date must use YYYY-MM-DD.`);
84
+ const category = requiredString(item.category, `${label}.category`);
85
+ if (category.length > 80)
86
+ throw new Error(`${label}.category must be at most 80 characters.`);
87
+ const vendor = nullableString(item.vendor, `${label}.vendor`);
88
+ if (vendor && vendor.length > 160)
89
+ throw new Error(`${label}.vendor must be at most 160 characters.`);
90
+ const description = nullableString(item.description, `${label}.description`);
91
+ if (description && description.length > 500)
92
+ throw new Error(`${label}.description must be at most 500 characters.`);
93
+ const amount = requiredString(item.amount, `${label}.amount`);
94
+ amountToMinor(amount);
95
+ const currency = requiredString(item.currency, `${label}.currency`).toUpperCase();
96
+ if (!/^[A-Z]{3}$/.test(currency))
97
+ throw new Error(`${label}.currency must be a three-letter code.`);
98
+ return { id, updatedAt, date, category, vendor, description, amount, currency };
99
+ });
100
+ return { schemaVersion: 1, projectId, expenses };
101
+ };
102
+ const listExpenses = async (scope) => {
103
+ const result = await scope.callApi({
104
+ path: 'projects.profitabilityExpenses',
105
+ type: 'query',
106
+ token: scope.token,
107
+ data: { workspaceId: scope.workspaceId, projectId: scope.projectId },
108
+ });
109
+ return result.expenses;
110
+ };
111
+ const serializeExpenseFile = (file) => `${JSON.stringify(file, null, 2)}\n`;
112
+ export const executeExpensePull = async (input) => {
113
+ const expenses = await listExpenses(input);
114
+ await writeFile(input.filePath, serializeExpenseFile({
115
+ schemaVersion: 1,
116
+ projectId: input.projectId,
117
+ expenses: expenses.map(rowToFileItem),
118
+ }), 'utf8');
119
+ return expenses.length;
120
+ };
121
+ const writeInput = (scope, item) => ({
122
+ workspaceId: scope.workspaceId,
123
+ projectId: scope.projectId,
124
+ expenseDate: item.date,
125
+ expenseMonth: item.date.slice(0, 7),
126
+ category: item.category,
127
+ vendor: item.vendor,
128
+ description: item.description,
129
+ amountMinor: amountToMinor(item.amount),
130
+ currency: item.currency,
131
+ });
132
+ const matchesRemote = (item, row) => (item.date === (row.expense_date || row.expense_month)
133
+ && item.category === row.category
134
+ && item.vendor === row.vendor
135
+ && item.description === row.description
136
+ && amountToMinor(item.amount) === row.amount_minor
137
+ && item.currency === row.currency);
138
+ export const executeExpensePublish = async (input) => {
139
+ const file = parseExpenseFile(await readFile(input.filePath, 'utf8'), input.projectId);
140
+ const remote = await listExpenses(input);
141
+ const remoteById = new Map(remote.map((expense) => [expense.id, expense]));
142
+ for (const item of file.expenses) {
143
+ if (!item.id)
144
+ continue;
145
+ const current = remoteById.get(item.id);
146
+ if (!current)
147
+ throw new Error(`Expense ${item.id} no longer exists. Pull expenses again before publishing.`);
148
+ if (current.updated_at !== item.updatedAt) {
149
+ throw new Error(`Expense ${item.id} changed remotely. Pull expenses again before publishing.`);
150
+ }
151
+ }
152
+ let created = 0;
153
+ let updated = 0;
154
+ const published = [...file.expenses];
155
+ for (const [index, item] of file.expenses.entries()) {
156
+ const current = item.id ? remoteById.get(item.id) : undefined;
157
+ if (current && matchesRemote(item, current)) {
158
+ published[index] = rowToFileItem(current);
159
+ continue;
160
+ }
161
+ const common = writeInput(input, item);
162
+ const row = item.id
163
+ ? await input.callApi({
164
+ path: 'projects.updateProfitabilityExpense',
165
+ type: 'mutation',
166
+ token: input.token,
167
+ data: { ...common, id: item.id, expectedUpdatedAt: item.updatedAt },
168
+ })
169
+ : await input.callApi({
170
+ path: 'projects.createProfitabilityExpense',
171
+ type: 'mutation',
172
+ token: input.token,
173
+ data: common,
174
+ });
175
+ if (item.id)
176
+ updated += 1;
177
+ else
178
+ created += 1;
179
+ published[index] = rowToFileItem(row);
180
+ await writeFile(input.filePath, serializeExpenseFile({ ...file, expenses: published }), 'utf8');
181
+ }
182
+ return { created, updated };
183
+ };
@@ -4,10 +4,10 @@
4
4
  "minimumCliVersion": "0.1.20",
5
5
  "entries": [
6
6
  {
7
- "repositoryCliVersion": "0.1.132",
7
+ "repositoryCliVersion": "0.1.140",
8
8
  "manifest": {
9
9
  "schemaVersion": 1,
10
- "bundleVersion": "2.0.122",
10
+ "bundleVersion": "2.0.130",
11
11
  "stepContractVersion": 3,
12
12
  "contractHash": "d761e91d5ac6ff9e72c6d49c5bcd014270912473a66f99c49d726c65998085cf",
13
13
  "managedFiles": [
@@ -45,7 +45,7 @@
45
45
  },
46
46
  {
47
47
  "path": "docs/funnelsgrove/migrations/step-contract-v3.md",
48
- "sha256": "46f46756190a6085c562b9ceb2fd4a0eac961ea4f985f85a1f6e715827e171a6"
48
+ "sha256": "9988e6f7b4ecf3f4a73ff83cf3f3613f82d765c59d09e55e86b0560d1e3eafa5"
49
49
  },
50
50
  {
51
51
  "path": "docs/funnelsgrove/qa/analytics.md",
@@ -145,16 +145,16 @@
145
145
  },
146
146
  {
147
147
  "path": "funnel-docs.config.json",
148
- "sha256": "01ad9b12769dd8894b2aaeea0bf21e7b622c3e4ee4612987acdcb2ec5bf93d6f"
148
+ "sha256": "4e81bd56071fa38708c7f18488420038339c8cc984062ffd7e8a4930ab6b06f0"
149
149
  }
150
150
  ]
151
151
  }
152
152
  },
153
153
  {
154
- "repositoryCliVersion": "0.1.131",
154
+ "repositoryCliVersion": "0.1.139",
155
155
  "manifest": {
156
156
  "schemaVersion": 1,
157
- "bundleVersion": "2.0.121",
157
+ "bundleVersion": "2.0.129",
158
158
  "stepContractVersion": 3,
159
159
  "contractHash": "d761e91d5ac6ff9e72c6d49c5bcd014270912473a66f99c49d726c65998085cf",
160
160
  "managedFiles": [
@@ -192,7 +192,7 @@
192
192
  },
193
193
  {
194
194
  "path": "docs/funnelsgrove/migrations/step-contract-v3.md",
195
- "sha256": "1a8d1f9bf73b24fc07d26b56fa4185fdc9183a45bcf98b9b1996d8e27792bd1e"
195
+ "sha256": "2a6ffbd2768cf73b049b4b067c003c81c2e3d3679fea6bf3f2865ddf419983f4"
196
196
  },
197
197
  {
198
198
  "path": "docs/funnelsgrove/qa/analytics.md",
@@ -292,16 +292,16 @@
292
292
  },
293
293
  {
294
294
  "path": "funnel-docs.config.json",
295
- "sha256": "de523557a1057d95aaaf9a535b518fb4d8ca6bd99eaafdd57aab56db17c7cf1e"
295
+ "sha256": "adda37f1991ccbb5e7abf2b9f1465688c116e6604b08a3d63f104b295a93140b"
296
296
  }
297
297
  ]
298
298
  }
299
299
  },
300
300
  {
301
- "repositoryCliVersion": "0.1.130",
301
+ "repositoryCliVersion": "0.1.138",
302
302
  "manifest": {
303
303
  "schemaVersion": 1,
304
- "bundleVersion": "2.0.120",
304
+ "bundleVersion": "2.0.128",
305
305
  "stepContractVersion": 3,
306
306
  "contractHash": "d761e91d5ac6ff9e72c6d49c5bcd014270912473a66f99c49d726c65998085cf",
307
307
  "managedFiles": [
@@ -339,7 +339,7 @@
339
339
  },
340
340
  {
341
341
  "path": "docs/funnelsgrove/migrations/step-contract-v3.md",
342
- "sha256": "875b31938089b6c1542a3210c198e5ff8441d7f1c1b9c462fb9b7539a9b5914f"
342
+ "sha256": "ac3397d4724b3653080cb43f6b01bfc43e65da4acb867592974ef106d6833bcf"
343
343
  },
344
344
  {
345
345
  "path": "docs/funnelsgrove/qa/analytics.md",
@@ -439,16 +439,16 @@
439
439
  },
440
440
  {
441
441
  "path": "funnel-docs.config.json",
442
- "sha256": "af6994cd686529a6ec4d1c52020a729196bd6d7722f404ea4d35e8fd1e187467"
442
+ "sha256": "793db126d3f299dfc98bd4dd715dfd5183d155557e32ec401491397364da5475"
443
443
  }
444
444
  ]
445
445
  }
446
446
  },
447
447
  {
448
- "repositoryCliVersion": "0.1.129",
448
+ "repositoryCliVersion": "0.1.136",
449
449
  "manifest": {
450
450
  "schemaVersion": 1,
451
- "bundleVersion": "2.0.119",
451
+ "bundleVersion": "2.0.126",
452
452
  "stepContractVersion": 3,
453
453
  "contractHash": "d761e91d5ac6ff9e72c6d49c5bcd014270912473a66f99c49d726c65998085cf",
454
454
  "managedFiles": [
@@ -486,7 +486,7 @@
486
486
  },
487
487
  {
488
488
  "path": "docs/funnelsgrove/migrations/step-contract-v3.md",
489
- "sha256": "9533a1fbc6ed324a102781a38b959eda3ef757f4a4c5641d1d8e11817f717d29"
489
+ "sha256": "6a7b8bea3fa6b4245307e96b51872fe04ab576c3a9161314f90c00cf6415465c"
490
490
  },
491
491
  {
492
492
  "path": "docs/funnelsgrove/qa/analytics.md",
@@ -586,16 +586,16 @@
586
586
  },
587
587
  {
588
588
  "path": "funnel-docs.config.json",
589
- "sha256": "4147b73766033401edcadbb4a651437d7874bee47fb53e3b5c7561b479bd74f5"
589
+ "sha256": "8b1218c5e5343b2c3e00079170da131aff33f5a808365700f8eab62dbf7433b9"
590
590
  }
591
591
  ]
592
592
  }
593
593
  },
594
594
  {
595
- "repositoryCliVersion": "0.1.128",
595
+ "repositoryCliVersion": "0.1.135",
596
596
  "manifest": {
597
597
  "schemaVersion": 1,
598
- "bundleVersion": "2.0.118",
598
+ "bundleVersion": "2.0.125",
599
599
  "stepContractVersion": 3,
600
600
  "contractHash": "d761e91d5ac6ff9e72c6d49c5bcd014270912473a66f99c49d726c65998085cf",
601
601
  "managedFiles": [
@@ -633,7 +633,7 @@
633
633
  },
634
634
  {
635
635
  "path": "docs/funnelsgrove/migrations/step-contract-v3.md",
636
- "sha256": "9fda9058abbc36cd358c7ec85a94e2d1b4271557aac049f6725791e46f4ee3c7"
636
+ "sha256": "c7a266bb4f6614daa2a1adcfb3248f99330a8d4184866a4611268b93a4352203"
637
637
  },
638
638
  {
639
639
  "path": "docs/funnelsgrove/qa/analytics.md",
@@ -733,16 +733,16 @@
733
733
  },
734
734
  {
735
735
  "path": "funnel-docs.config.json",
736
- "sha256": "9d15e82c7dc8628d4177779b20f1171b5d10baa4700f080a5541faf50fa35427"
736
+ "sha256": "ad9e79fd0ee9d6478567615d78e34efa272fc6a1c5f8016cd1aae64ba3e24679"
737
737
  }
738
738
  ]
739
739
  }
740
740
  },
741
741
  {
742
- "repositoryCliVersion": "0.1.127",
742
+ "repositoryCliVersion": "0.1.132",
743
743
  "manifest": {
744
744
  "schemaVersion": 1,
745
- "bundleVersion": "2.0.117",
745
+ "bundleVersion": "2.0.122",
746
746
  "stepContractVersion": 3,
747
747
  "contractHash": "d761e91d5ac6ff9e72c6d49c5bcd014270912473a66f99c49d726c65998085cf",
748
748
  "managedFiles": [
@@ -780,7 +780,7 @@
780
780
  },
781
781
  {
782
782
  "path": "docs/funnelsgrove/migrations/step-contract-v3.md",
783
- "sha256": "5527d83fd379876fc35270889c1b1c7852197446c6b2fcf2fb7ab2210fd45ade"
783
+ "sha256": "46f46756190a6085c562b9ceb2fd4a0eac961ea4f985f85a1f6e715827e171a6"
784
784
  },
785
785
  {
786
786
  "path": "docs/funnelsgrove/qa/analytics.md",
@@ -880,16 +880,16 @@
880
880
  },
881
881
  {
882
882
  "path": "funnel-docs.config.json",
883
- "sha256": "d41b8f198f39f8ae337b55857c633e0a5b1affbc52b9acf1456c79805be4c8a4"
883
+ "sha256": "01ad9b12769dd8894b2aaeea0bf21e7b622c3e4ee4612987acdcb2ec5bf93d6f"
884
884
  }
885
885
  ]
886
886
  }
887
887
  },
888
888
  {
889
- "repositoryCliVersion": "0.1.126",
889
+ "repositoryCliVersion": "0.1.131",
890
890
  "manifest": {
891
891
  "schemaVersion": 1,
892
- "bundleVersion": "2.0.116",
892
+ "bundleVersion": "2.0.121",
893
893
  "stepContractVersion": 3,
894
894
  "contractHash": "d761e91d5ac6ff9e72c6d49c5bcd014270912473a66f99c49d726c65998085cf",
895
895
  "managedFiles": [
@@ -927,7 +927,7 @@
927
927
  },
928
928
  {
929
929
  "path": "docs/funnelsgrove/migrations/step-contract-v3.md",
930
- "sha256": "dbcc2a36828773b8c744079703ea1c9572acae06da3fe17dbb4f42fe42197c90"
930
+ "sha256": "1a8d1f9bf73b24fc07d26b56fa4185fdc9183a45bcf98b9b1996d8e27792bd1e"
931
931
  },
932
932
  {
933
933
  "path": "docs/funnelsgrove/qa/analytics.md",
@@ -1027,7 +1027,7 @@
1027
1027
  },
1028
1028
  {
1029
1029
  "path": "funnel-docs.config.json",
1030
- "sha256": "9ec65369cf3fd8f5683e43e69344fd93b185e54c2ddc1963ad942d33b75df4f0"
1030
+ "sha256": "de523557a1057d95aaaf9a535b518fb4d8ca6bd99eaafdd57aab56db17c7cf1e"
1031
1031
  }
1032
1032
  ]
1033
1033
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funnelsgrove/cli",
3
- "version": "0.1.132",
3
+ "version": "0.1.140",
4
4
  "description": "FunnelsGrove command-line tools for editing, syncing, and publishing funnels",
5
5
  "repository": {
6
6
  "type": "git",
@@ -34,12 +34,12 @@
34
34
  "test": "vitest run"
35
35
  },
36
36
  "dependencies": {
37
- "@funnelsgrove/runtime": "0.7.25",
37
+ "@funnelsgrove/runtime": "0.7.26",
38
38
  "commander": "^12.0.0",
39
39
  "typescript": "^5.8.3"
40
40
  },
41
41
  "devDependencies": {
42
- "@funnelsgrove/analytics": "0.1.74",
42
+ "@funnelsgrove/analytics": "0.1.75",
43
43
  "@funnelsgrove/payments": "0.7.19",
44
44
  "vitest": "^3.0.0"
45
45
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "bundleVersion": "2.0.122",
3
+ "bundleVersion": "2.0.130",
4
4
  "stepContractVersion": 3,
5
5
  "contractHash": "d761e91d5ac6ff9e72c6d49c5bcd014270912473a66f99c49d726c65998085cf",
6
6
  "managedFiles": [
@@ -38,7 +38,7 @@
38
38
  },
39
39
  {
40
40
  "path": "docs/funnelsgrove/migrations/step-contract-v3.md",
41
- "sha256": "46f46756190a6085c562b9ceb2fd4a0eac961ea4f985f85a1f6e715827e171a6"
41
+ "sha256": "9988e6f7b4ecf3f4a73ff83cf3f3613f82d765c59d09e55e86b0560d1e3eafa5"
42
42
  },
43
43
  {
44
44
  "path": "docs/funnelsgrove/qa/analytics.md",
@@ -138,7 +138,7 @@
138
138
  },
139
139
  {
140
140
  "path": "funnel-docs.config.json",
141
- "sha256": "01ad9b12769dd8894b2aaeea0bf21e7b622c3e4ee4612987acdcb2ec5bf93d6f"
141
+ "sha256": "4e81bd56071fa38708c7f18488420038339c8cc984062ffd7e8a4930ab6b06f0"
142
142
  }
143
143
  ]
144
144
  }
@@ -17,7 +17,7 @@ Supported read versions: `1`, `2`, `3`. Authoring and publish target version `3`
17
17
 
18
18
  ### Package release order
19
19
 
20
- Release `@funnelsgrove/runtime` `0.7.25` first, then `@funnelsgrove/analytics` `0.1.74`, then `@funnelsgrove/payments` `0.7.19`. The production deploy verifies the zero-traffic API candidate, publishes and verifies `@funnelsgrove/cli` `0.1.132`, and only then promotes the candidate to production traffic. The serving API must never advertise an unpublished preferred CLI. Publishing packages and deploying production remain separately approved operational actions.
20
+ Release `@funnelsgrove/runtime` `0.7.26` first, then `@funnelsgrove/analytics` `0.1.75`, then `@funnelsgrove/payments` `0.7.19`. The production deploy verifies the zero-traffic API candidate, publishes and verifies `@funnelsgrove/cli` `0.1.140`, and only then promotes the candidate to production traffic. The serving API must never advertise an unpublished preferred CLI. Publishing packages and deploying production remain separately approved operational actions.
21
21
  <!-- funnelsgrove:generated:end contract-v3/migration/step-contract-v3 -->
22
22
 
23
23
  ## Version-last policy
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "bundleVersion": "2.0.122",
3
+ "bundleVersion": "2.0.130",
4
4
  "contractSource": "funnelsgrove-repository://apps/funnel-runtime/contracts/step-contract-v2.json",
5
5
  "fullyGenerated": [
6
6
  ".funnelsgrove-docs.json",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "bundleVersion": "2.0.122",
3
+ "bundleVersion": "2.0.130",
4
4
  "stepContractVersion": 3,
5
5
  "contractHash": "d761e91d5ac6ff9e72c6d49c5bcd014270912473a66f99c49d726c65998085cf",
6
6
  "managedFiles": [
@@ -38,7 +38,7 @@
38
38
  },
39
39
  {
40
40
  "path": "docs/funnelsgrove/migrations/step-contract-v3.md",
41
- "sha256": "46f46756190a6085c562b9ceb2fd4a0eac961ea4f985f85a1f6e715827e171a6"
41
+ "sha256": "9988e6f7b4ecf3f4a73ff83cf3f3613f82d765c59d09e55e86b0560d1e3eafa5"
42
42
  },
43
43
  {
44
44
  "path": "docs/funnelsgrove/qa/analytics.md",
@@ -138,7 +138,7 @@
138
138
  },
139
139
  {
140
140
  "path": "funnel-docs.config.json",
141
- "sha256": "01ad9b12769dd8894b2aaeea0bf21e7b622c3e4ee4612987acdcb2ec5bf93d6f"
141
+ "sha256": "4e81bd56071fa38708c7f18488420038339c8cc984062ffd7e8a4930ab6b06f0"
142
142
  }
143
143
  ]
144
144
  }
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "sourceTreeHash": "b2180f5ae2945d936d54e08b648e016b4e61b83a90fc3c06a369e2b10d08fdff",
3
+ "sourceTreeHash": "edcad923cf6088e92c2b736308c60112afdbce89f96376d5d4dac820fc58996f",
4
4
  "stepContractVersion": 3,
5
- "docsBundleVersion": "2.0.122",
5
+ "docsBundleVersion": "2.0.130",
6
6
  "files": [
7
7
  {
8
8
  "path": ".env.example",
@@ -16,7 +16,7 @@
16
16
  },
17
17
  {
18
18
  "path": ".funnelsgrove-docs.json",
19
- "sha256": "4405f94970dda9ceaece5edea5cf2c8d6f62313df42e5885bcde5c5beaf2a70e",
19
+ "sha256": "b6b0910ffab65e7d3885aec9eba9fba72e9652e99d3b1e9e08d2253111820172",
20
20
  "mode": "100644"
21
21
  },
22
22
  {
@@ -101,7 +101,7 @@
101
101
  },
102
102
  {
103
103
  "path": "docs/funnelsgrove/migrations/step-contract-v3.md",
104
- "sha256": "46f46756190a6085c562b9ceb2fd4a0eac961ea4f985f85a1f6e715827e171a6",
104
+ "sha256": "9988e6f7b4ecf3f4a73ff83cf3f3613f82d765c59d09e55e86b0560d1e3eafa5",
105
105
  "mode": "100644"
106
106
  },
107
107
  {
@@ -236,7 +236,7 @@
236
236
  },
237
237
  {
238
238
  "path": "funnel-docs.config.json",
239
- "sha256": "01ad9b12769dd8894b2aaeea0bf21e7b622c3e4ee4612987acdcb2ec5bf93d6f",
239
+ "sha256": "4e81bd56071fa38708c7f18488420038339c8cc984062ffd7e8a4930ab6b06f0",
240
240
  "mode": "100644"
241
241
  },
242
242
  {
@@ -261,12 +261,12 @@
261
261
  },
262
262
  {
263
263
  "path": "package-lock.json",
264
- "sha256": "cb2fa59e86a439220effda7a4383a4d3bb840e99db9679330b028048c5ed87d8",
264
+ "sha256": "09e020ec8442cb7a0a87a1ffddec86d6caee3a54b494ed844407007063ff68a2",
265
265
  "mode": "100644"
266
266
  },
267
267
  {
268
268
  "path": "package.json",
269
- "sha256": "b791dad2cb55568b486e733a6fe03cbc26ac3da547640a1e70e8538004b682ba",
269
+ "sha256": "a965a1abeef3d228a57be9f89275144d9530cafec0d85351cf541fdcc5b8d1ac",
270
270
  "mode": "100644"
271
271
  },
272
272
  {
@@ -17,7 +17,7 @@ Supported read versions: `1`, `2`, `3`. Authoring and publish target version `3`
17
17
 
18
18
  ### Package release order
19
19
 
20
- Release `@funnelsgrove/runtime` `0.7.25` first, then `@funnelsgrove/analytics` `0.1.74`, then `@funnelsgrove/payments` `0.7.19`. The production deploy verifies the zero-traffic API candidate, publishes and verifies `@funnelsgrove/cli` `0.1.132`, and only then promotes the candidate to production traffic. The serving API must never advertise an unpublished preferred CLI. Publishing packages and deploying production remain separately approved operational actions.
20
+ Release `@funnelsgrove/runtime` `0.7.26` first, then `@funnelsgrove/analytics` `0.1.75`, then `@funnelsgrove/payments` `0.7.19`. The production deploy verifies the zero-traffic API candidate, publishes and verifies `@funnelsgrove/cli` `0.1.140`, and only then promotes the candidate to production traffic. The serving API must never advertise an unpublished preferred CLI. Publishing packages and deploying production remain separately approved operational actions.
21
21
  <!-- funnelsgrove:generated:end contract-v3/migration/step-contract-v3 -->
22
22
 
23
23
  ## Version-last policy
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "bundleVersion": "2.0.122",
3
+ "bundleVersion": "2.0.130",
4
4
  "contractSource": "funnelsgrove-repository://apps/funnel-runtime/contracts/step-contract-v2.json",
5
5
  "fullyGenerated": [
6
6
  ".funnelsgrove-docs.json",
@@ -8,9 +8,9 @@
8
8
  "name": "funnel-template",
9
9
  "version": "0.1.0",
10
10
  "dependencies": {
11
- "@funnelsgrove/analytics": "^0.1.74",
11
+ "@funnelsgrove/analytics": "^0.1.75",
12
12
  "@funnelsgrove/payments": "^0.7.19",
13
- "@funnelsgrove/runtime": "^0.7.25",
13
+ "@funnelsgrove/runtime": "^0.7.26",
14
14
  "@stripe/react-stripe-js": "^5.6.0",
15
15
  "@stripe/stripe-js": "^8.7.0",
16
16
  "lucide-react": "^0.553.0",
@@ -938,11 +938,11 @@
938
938
  }
939
939
  },
940
940
  "node_modules/@funnelsgrove/analytics": {
941
- "version": "0.1.74",
942
- "resolved": "https://registry.npmjs.org/@funnelsgrove/analytics/-/analytics-0.1.74.tgz",
943
- "integrity": "sha512-ZWEeAUhYdWdcHROR17mLy9mKrRCnbM3JgkzPsNSBRvfiwPocBBkEaizpIOubKBwTfIjsdc10lPkRQKrx/9VlUQ==",
941
+ "version": "0.1.75",
942
+ "resolved": "https://registry.npmjs.org/@funnelsgrove/analytics/-/analytics-0.1.75.tgz",
943
+ "integrity": "sha512-q7hOSmSuyHQEN/95MBcgjAwWqewUTUlbH3BgaSaYBPabGZyZxMC3Zopmyva/OieXmQ0f3J8JQlpxhdEB7ssftA==",
944
944
  "dependencies": {
945
- "@funnelsgrove/runtime": "0.7.25"
945
+ "@funnelsgrove/runtime": "0.7.26"
946
946
  }
947
947
  },
948
948
  "node_modules/@funnelsgrove/payments": {
@@ -961,9 +961,9 @@
961
961
  }
962
962
  },
963
963
  "node_modules/@funnelsgrove/runtime": {
964
- "version": "0.7.25",
965
- "resolved": "https://registry.npmjs.org/@funnelsgrove/runtime/-/runtime-0.7.25.tgz",
966
- "integrity": "sha512-CBW4LGeBM3k/DeCZ1Kl0/5+nkw1IjQVe+qU04qiIqhTt8uH0YxvuVUnzkijVutc7H2soutVFUDYomFAvZgf76w==",
964
+ "version": "0.7.26",
965
+ "resolved": "https://registry.npmjs.org/@funnelsgrove/runtime/-/runtime-0.7.26.tgz",
966
+ "integrity": "sha512-PbdmEC23bJpGo/dRNhhHTbp2y8a/IZ3Ggs3746UwZQOxxzV9ImkNVeWQl0zlmnGvBLWGOWcpTW48nuneR0uwuw==",
967
967
  "dependencies": {
968
968
  "posthog-js": "^1.369.2",
969
969
  "react": "19.2.3",
@@ -12,9 +12,9 @@
12
12
  "validate:funnel": "vite-node --config src/contract/funnel-validator.vite.config.ts src/contract/validate-funnel.cli.ts"
13
13
  },
14
14
  "dependencies": {
15
- "@funnelsgrove/analytics": "^0.1.74",
15
+ "@funnelsgrove/analytics": "^0.1.75",
16
16
  "@funnelsgrove/payments": "^0.7.19",
17
- "@funnelsgrove/runtime": "^0.7.25",
17
+ "@funnelsgrove/runtime": "^0.7.26",
18
18
  "@stripe/react-stripe-js": "^5.6.0",
19
19
  "@stripe/stripe-js": "^8.7.0",
20
20
  "lucide-react": "^0.553.0",