@funnelsgrove/cli 0.1.140 → 0.1.143

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
@@ -30,13 +30,22 @@ fgrove publish --env preview
30
30
  Inside a synced folder, `fgrove` reads `.funnelsgrove-sync.json` first, so you do not need to run `fgrove use` when switching between local funnel directories. Use `fgrove use` only when you want a global fallback context for commands outside a synced folder.
31
31
 
32
32
  `fgrove sync down` refuses to overwrite local changes in an existing synced
33
- folder. If `fgrove sync up` says the remote draft changed since your local sync,
34
- run `fgrove sync rebase`: it performs a three-way merge from the recorded base,
35
- preserves CLI-managed files, and leaves the working tree untouched when it finds
36
- conflicts. Review the merged diff, rerun `fgrove validate`, then sync up again.
33
+ folder. `fgrove sync up` sends only changed and deleted paths in one atomic
34
+ draft patch. Disjoint concurrent edits are rebased automatically; if the same
35
+ path changed remotely, run `fgrove sync rebase`: it performs a three-way merge
36
+ from the recorded base, preserves CLI-managed files, and leaves the working tree
37
+ untouched when it finds conflicts. Review the merged diff, rerun `fgrove
38
+ validate`, then sync up again.
37
39
  `sync down --force` is the explicit discard path and writes an automatic source
38
40
  backup under `.funnelsgrove/rebase-backups/` before replacing hosted paths.
39
41
 
42
+ Changed images below `public/` are uploaded directly to asset storage, then the
43
+ small immutable asset references are included in the atomic patch. Sync retries
44
+ use a deterministic durable idempotency key, so a lost response cannot create a
45
+ second draft version. The CLI automatically falls back to candidate sync when
46
+ the compatible deployed API lacks the fast procedures or a change set exceeds
47
+ patch limits.
48
+
40
49
  `fgrove sync up` is for funnels without GitHub source sync. When GitHub is
41
50
  connected, commit and push source changes with normal git, then run `fgrove
42
51
  github pull` to sync GitHub into the hosted draft. Do not run `fgrove sync up`
@@ -18,6 +18,47 @@ export type FunnelSourceCandidateApiContext = {
18
18
  fetchFn?: FetchFn;
19
19
  signal?: AbortSignal;
20
20
  };
21
+ export type DraftPatchFile = {
22
+ path: string;
23
+ content: string;
24
+ contentType?: string;
25
+ };
26
+ export type ApplyDraftPatchInput = {
27
+ workspaceId: string;
28
+ funnelId: string;
29
+ baseDraftVersionId: string | null;
30
+ idempotencyKey: string;
31
+ message?: string;
32
+ changedFiles: DraftPatchFile[];
33
+ deletedPaths: string[];
34
+ };
35
+ export type ApplyDraftPatchResult = {
36
+ funnelId: string;
37
+ previousDraftVersionId: string | null;
38
+ draftVersionId: string;
39
+ draftVersionSeq: number;
40
+ rebasedFromVersionId: string | null;
41
+ changedPaths: string[];
42
+ deletedPaths: string[];
43
+ changedContentBytes: number;
44
+ idempotent: boolean;
45
+ };
46
+ export type DirectAssetUploadDescription = {
47
+ workspaceId: string;
48
+ funnelId: string;
49
+ path: string;
50
+ contentType: string;
51
+ sizeBytes: number;
52
+ sha256: string;
53
+ };
54
+ export type PreparedDirectAssetUpload = Omit<DirectAssetUploadDescription, 'workspaceId' | 'funnelId'> & {
55
+ uploadKey: string;
56
+ uploadUrl: string;
57
+ uploadHeaders: Record<string, string>;
58
+ };
59
+ export type FinalizeDirectAssetUploadInput = DirectAssetUploadDescription & {
60
+ uploadKey: string;
61
+ };
21
62
  export type CreateFunnelExperimentFromSpecInput = {
22
63
  workspaceId: string;
23
64
  funnelId: string;
@@ -96,6 +137,12 @@ export declare class FunnelContractApiError extends Error {
96
137
  readonly funnelContract: FunnelContractApiErrorData;
97
138
  constructor(message: string, funnelContract: FunnelContractApiErrorData);
98
139
  }
140
+ export declare class TrpcApiError extends Error {
141
+ readonly code: string | null;
142
+ readonly httpStatus: number | null;
143
+ constructor(message: string, code: string | null, httpStatus: number | null);
144
+ }
145
+ export declare const isMissingTrpcProcedureError: (error: unknown) => boolean;
99
146
  export declare const parseFunnelContractApiErrorData: (value: unknown) => FunnelContractApiErrorData | null;
100
147
  export declare function parseTrpcJsonResponse<T = unknown>(response: unknown): T;
101
148
  export declare function callTrpcProcedure<T = unknown>(input: TrpcCallInput): Promise<T>;
@@ -103,5 +150,8 @@ export declare const beginFunnelSourceCandidate: (context: FunnelSourceCandidate
103
150
  export declare const stageFunnelSourceCandidate: (context: FunnelSourceCandidateApiContext, input: StageFunnelSourceCandidateInput) => Promise<StageFunnelSourceCandidateResult>;
104
151
  export declare const finalizeFunnelSourceCandidate: (context: FunnelSourceCandidateApiContext, input: FinalizeFunnelSourceCandidateInput) => Promise<FinalizeFunnelSourceCandidateResult>;
105
152
  export declare const abortFunnelSourceCandidate: (context: FunnelSourceCandidateApiContext, input: FinishFunnelSourceCandidateInput) => Promise<FunnelSourceCandidateSummary>;
153
+ export declare const applyFunnelDraftPatch: (context: FunnelSourceCandidateApiContext, input: ApplyDraftPatchInput) => Promise<ApplyDraftPatchResult>;
154
+ export declare const prepareFunnelDirectAssetUpload: (context: FunnelSourceCandidateApiContext, input: DirectAssetUploadDescription) => Promise<PreparedDirectAssetUpload>;
155
+ export declare const finalizeFunnelDirectAssetUpload: (context: FunnelSourceCandidateApiContext, input: FinalizeDirectAssetUploadInput) => Promise<DraftPatchFile>;
106
156
  export declare const createFunnelExperimentFromSpec: (context: FunnelSourceCandidateApiContext, input: CreateFunnelExperimentFromSpecInput) => Promise<ExperimentCreateResponse>;
107
157
  export {};
package/dist/apiClient.js CHANGED
@@ -48,6 +48,19 @@ export class FunnelContractApiError extends Error {
48
48
  this.funnelContract = funnelContract;
49
49
  }
50
50
  }
51
+ export class TrpcApiError extends Error {
52
+ code;
53
+ httpStatus;
54
+ constructor(message, code, httpStatus) {
55
+ super(`tRPC request failed: ${message}`);
56
+ this.code = code;
57
+ this.httpStatus = httpStatus;
58
+ this.name = 'TrpcApiError';
59
+ }
60
+ }
61
+ export const isMissingTrpcProcedureError = (error) => (error instanceof TrpcApiError
62
+ && error.code === 'NOT_FOUND'
63
+ && /no procedure found on path/i.test(error.message));
51
64
  const ENVELOPE_KEYS = Object.freeze([
52
65
  'schemaVersion',
53
66
  'contractVersion',
@@ -238,7 +251,14 @@ export function parseTrpcJsonResponse(response) {
238
251
  if (funnelContract) {
239
252
  throw new FunnelContractApiError(message, funnelContract);
240
253
  }
241
- throw new Error(`tRPC request failed: ${message}`);
254
+ const data = ownDataValue(errorValue, 'data');
255
+ const code = isObject(data) && typeof ownDataValue(data, 'code') === 'string'
256
+ ? ownDataValue(data, 'code')
257
+ : null;
258
+ const httpStatus = isObject(data) && typeof ownDataValue(data, 'httpStatus') === 'number'
259
+ ? ownDataValue(data, 'httpStatus')
260
+ : null;
261
+ throw new TrpcApiError(message, code, httpStatus);
242
262
  }
243
263
  const result = ownDataValue(response, 'result');
244
264
  if (!isObject(result)) {
@@ -316,6 +336,9 @@ export const beginFunnelSourceCandidate = (context, input) => callFunnelSourceCa
316
336
  export const stageFunnelSourceCandidate = (context, input) => callFunnelSourceCandidateMutation(context, 'funnels.stageSourceCandidate', input);
317
337
  export const finalizeFunnelSourceCandidate = (context, input) => callFunnelSourceCandidateMutation(context, 'funnels.finalizeSourceCandidate', input);
318
338
  export const abortFunnelSourceCandidate = (context, input) => callFunnelSourceCandidateMutation(context, 'funnels.abortSourceCandidate', input);
339
+ export const applyFunnelDraftPatch = (context, input) => callFunnelSourceCandidateMutation(context, 'funnels.applyDraftPatch', input);
340
+ export const prepareFunnelDirectAssetUpload = (context, input) => callFunnelSourceCandidateMutation(context, 'funnels.prepareDirectAssetUpload', input);
341
+ export const finalizeFunnelDirectAssetUpload = (context, input) => callFunnelSourceCandidateMutation(context, 'funnels.finalizeDirectAssetUpload', input);
319
342
  export const createFunnelExperimentFromSpec = (context, input) => callTrpcProcedure({
320
343
  ...context,
321
344
  path: 'funnelExperiments.createFromSpec',
package/dist/cli.js CHANGED
@@ -8,13 +8,14 @@ import path from 'node:path';
8
8
  import { fileURLToPath } from 'node:url';
9
9
  import { Command } from 'commander';
10
10
  import { CURRENT_STEP_CONTRACT_VERSION, FUNNEL_CONTRACT_DIAGNOSTIC_CODES, PREVIOUS_STEP_CONTRACT_VERSION, createFunnelContractDiagnostic, } from '@funnelsgrove/runtime';
11
- import { abortFunnelSourceCandidate, beginFunnelSourceCandidate, callTrpcProcedure, createFunnelExperimentFromSpec, finalizeFunnelSourceCandidate, stageFunnelSourceCandidate, } from './apiClient.js';
11
+ import { abortFunnelSourceCandidate, applyFunnelDraftPatch, beginFunnelSourceCandidate, callTrpcProcedure, createFunnelExperimentFromSpec, finalizeFunnelDirectAssetUpload, finalizeFunnelSourceCandidate, prepareFunnelDirectAssetUpload, stageFunnelSourceCandidate, } from './apiClient.js';
12
12
  import { cliReleaseIdentity } from './cliIdentity.js';
13
13
  import { clearActiveContext, getDefaultAuthConfigPath, loadActiveContext, loadAuthToken, saveActiveContext, saveAuthToken, } from './authStore.js';
14
14
  import { buildCommittedSyncManifest, buildDownloadedSyncManifest, buildSourceCandidateOperations, collectChangedSourceFiles, collectSourceFiles, collectSourceSnapshot, ensureGitignore, formatSyncUploadSummary, hasLocalSourceChanges, rebaseSourceFiles, readSyncManifest, replaceSourceFiles, runSyncDownLocalLifecycle, runSourceCandidateSync, writeLocalEnvFile, writeSourceFiles, writeSourceRebaseBackup, writeSyncManifest, } from './localSync.js';
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 { executeFastDraftPatchSync, uploadDirectAssetWithFetch } from './draftPatchSync.js';
18
19
  import { executeExpensePublish, executeExpensePull } from './expenseCommands.js';
19
20
  import { executeEmailPull, executeEmailPush, executeEmailSend, executeEmailUpdateVariables, executeEmailSequenceAddStep, executeEmailSequenceCancel, executeEmailSequenceCreate, executeEmailSequencePublish, executeEmailSequenceSetActive, executeEmailTemplatePublish, executeEmailValidate, parseEmailVariablesJson, } from './emailCommands.js';
20
21
  import { formatGitHubConnectRows, formatGitHubJobRows, formatGitHubStatusRows, } from './githubOutput.js';
@@ -2666,7 +2667,7 @@ addExamples(envCommand
2666
2667
  });
2667
2668
  addExamples(syncCommand
2668
2669
  .command('up')
2669
- .description('Upload local source into a new funnel draft version for funnels without GitHub source sync')
2670
+ .description('Atomically upload changed local paths into the hosted draft for funnels without GitHub source sync')
2670
2671
  .option('--workspace <id-or-slug-or-name>', 'Workspace id, slug, or name')
2671
2672
  .option('--funnel <id-or-slug>', 'Funnel id or slug')
2672
2673
  .option('--dir <path>', 'Local source directory', '.')
@@ -2719,40 +2720,59 @@ addExamples(syncCommand
2719
2720
  process.once('SIGINT', cancel);
2720
2721
  process.once('SIGTERM', cancel);
2721
2722
  try {
2722
- const candidateResult = await runSourceCandidateSync({
2723
+ const apiContext = {
2724
+ apiUrl: getApiUrl(),
2725
+ token,
2726
+ signal: cancellation.signal,
2727
+ };
2728
+ const patchResult = await executeFastDraftPatchSync({
2723
2729
  workspaceId: target.workspaceId,
2724
2730
  funnelId: target.funnelId,
2725
2731
  baseDraftVersionId: changes.currentManifest.draftVersionId,
2726
2732
  message: options.message,
2727
- operations: buildSourceCandidateOperations({
2728
- previousFiles: target.manifest?.files ?? [],
2729
- files: changes.files,
2730
- deletedPaths: changes.deletedPaths,
2731
- }),
2733
+ files: changes.files,
2734
+ deletedPaths: changes.deletedPaths,
2732
2735
  signal: cancellation.signal,
2733
2736
  api: {
2734
- begin: (input) => beginFunnelSourceCandidate({
2735
- apiUrl: getApiUrl(),
2736
- token,
2737
- signal: cancellation.signal,
2738
- }, input),
2739
- stage: (input) => stageFunnelSourceCandidate({
2740
- apiUrl: getApiUrl(),
2741
- token,
2742
- signal: cancellation.signal,
2743
- }, input),
2744
- finalize: (input) => finalizeFunnelSourceCandidate({
2745
- apiUrl: getApiUrl(),
2746
- token,
2747
- signal: cancellation.signal,
2748
- }, input),
2749
- abort: (input) => abortFunnelSourceCandidate({
2750
- apiUrl: getApiUrl(),
2751
- token,
2752
- }, input),
2737
+ apply: (input) => applyFunnelDraftPatch(apiContext, input),
2738
+ prepareAsset: (input) => prepareFunnelDirectAssetUpload(apiContext, input),
2739
+ uploadAsset: uploadDirectAssetWithFetch,
2740
+ finalizeAsset: (input) => finalizeFunnelDirectAssetUpload(apiContext, input),
2753
2741
  },
2754
2742
  });
2755
- result = { versionId: candidateResult.versionId };
2743
+ if (patchResult.kind === 'committed') {
2744
+ result = { versionId: patchResult.result.draftVersionId };
2745
+ if (patchResult.directAssetCount > 0) {
2746
+ console.log(`Uploaded ${patchResult.directAssetCount} changed image${patchResult.directAssetCount === 1 ? '' : 's'} directly to asset storage.`);
2747
+ }
2748
+ }
2749
+ else {
2750
+ console.warn(patchResult.reason === 'legacy-api'
2751
+ ? 'The API does not support fast draft patches yet; using compatible source sync.'
2752
+ : 'This change set exceeds fast draft patch limits; using compatible source sync.');
2753
+ const candidateResult = await runSourceCandidateSync({
2754
+ workspaceId: target.workspaceId,
2755
+ funnelId: target.funnelId,
2756
+ baseDraftVersionId: changes.currentManifest.draftVersionId,
2757
+ message: options.message,
2758
+ operations: buildSourceCandidateOperations({
2759
+ previousFiles: target.manifest?.files ?? [],
2760
+ files: changes.files,
2761
+ deletedPaths: changes.deletedPaths,
2762
+ }),
2763
+ signal: cancellation.signal,
2764
+ api: {
2765
+ begin: (input) => beginFunnelSourceCandidate(apiContext, input),
2766
+ stage: (input) => stageFunnelSourceCandidate(apiContext, input),
2767
+ finalize: (input) => finalizeFunnelSourceCandidate(apiContext, input),
2768
+ abort: (input) => abortFunnelSourceCandidate({
2769
+ apiUrl: getApiUrl(),
2770
+ token,
2771
+ }, input),
2772
+ },
2773
+ });
2774
+ result = { versionId: candidateResult.versionId };
2775
+ }
2756
2776
  }
2757
2777
  finally {
2758
2778
  process.off('SIGINT', cancel);
@@ -0,0 +1,39 @@
1
+ import type { ApplyDraftPatchInput, ApplyDraftPatchResult, DirectAssetUploadDescription, DraftPatchFile, FinalizeDirectAssetUploadInput, PreparedDirectAssetUpload } from './apiClient.js';
2
+ import { type SourceFile } from './localSync.js';
3
+ export type DraftPatchSyncApi = {
4
+ apply: (input: ApplyDraftPatchInput) => Promise<ApplyDraftPatchResult>;
5
+ prepareAsset: (input: DirectAssetUploadDescription) => Promise<PreparedDirectAssetUpload>;
6
+ uploadAsset: (input: {
7
+ uploadUrl: string;
8
+ uploadHeaders: Record<string, string>;
9
+ body: Uint8Array;
10
+ signal?: AbortSignal;
11
+ }) => Promise<void>;
12
+ finalizeAsset: (input: FinalizeDirectAssetUploadInput) => Promise<DraftPatchFile>;
13
+ };
14
+ export type DraftPatchSyncResult = {
15
+ kind: 'committed';
16
+ result: ApplyDraftPatchResult;
17
+ directAssetCount: number;
18
+ } | {
19
+ kind: 'fallback';
20
+ reason: 'unsupported-patch' | 'legacy-api';
21
+ };
22
+ export declare const uploadDirectAssetWithFetch: (input: {
23
+ uploadUrl: string;
24
+ uploadHeaders: Record<string, string>;
25
+ body: Uint8Array;
26
+ signal?: AbortSignal;
27
+ fetchFn?: typeof fetch;
28
+ }) => Promise<void>;
29
+ export declare const executeFastDraftPatchSync: (input: {
30
+ workspaceId: string;
31
+ funnelId: string;
32
+ baseDraftVersionId: string | null;
33
+ message?: string;
34
+ files: readonly SourceFile[];
35
+ deletedPaths: readonly string[];
36
+ signal?: AbortSignal;
37
+ uploadConcurrency?: number;
38
+ api: DraftPatchSyncApi;
39
+ }) => Promise<DraftPatchSyncResult>;
@@ -0,0 +1,132 @@
1
+ import { createHash } from 'node:crypto';
2
+ import { isMissingTrpcProcedureError } from './apiClient.js';
3
+ import { sourceFileBytes } from './localSync.js';
4
+ const MAX_PATCH_FILES = 600;
5
+ const MAX_PATCH_FILE_CONTENT_CHARS = 3_000_000;
6
+ const MAX_PATCH_CONTENT_BYTES = 65_000_000;
7
+ const MAX_DIRECT_ASSET_BYTES = 25_000_000;
8
+ const MAX_DIRECT_ASSET_REF_BYTES = 1_024;
9
+ const DEFAULT_UPLOAD_CONCURRENCY = 4;
10
+ const isDirectImage = (file) => (file.path.startsWith('public/')
11
+ && Boolean(file.contentType?.toLowerCase().startsWith('image/')));
12
+ const hash = (value) => (createHash('sha256').update(value).digest('hex'));
13
+ const mapWithConcurrency = async (values, concurrency, worker) => {
14
+ const results = new Array(values.length);
15
+ let cursor = 0;
16
+ const run = async () => {
17
+ while (cursor < values.length) {
18
+ const index = cursor;
19
+ cursor += 1;
20
+ results[index] = await worker(values[index]);
21
+ }
22
+ };
23
+ await Promise.all(Array.from({ length: Math.min(concurrency, values.length) }, () => run()));
24
+ return results;
25
+ };
26
+ const createIdempotencyKey = (input) => {
27
+ const payload = JSON.stringify({
28
+ ...input,
29
+ changedFiles: [...input.changedFiles]
30
+ .map((file) => ({
31
+ path: file.path,
32
+ contentType: file.contentType || 'text/plain',
33
+ contentHash: hash(file.content),
34
+ }))
35
+ .sort((left, right) => left.path.localeCompare(right.path)),
36
+ deletedPaths: [...input.deletedPaths].sort((left, right) => left.localeCompare(right)),
37
+ });
38
+ return `cli-sync-patch:${hash(payload)}`;
39
+ };
40
+ const patchIsSupported = (files, deletedPaths) => {
41
+ if (files.length > MAX_PATCH_FILES || deletedPaths.length > MAX_PATCH_FILES)
42
+ return false;
43
+ let projectedBytes = 0;
44
+ for (const file of files) {
45
+ if (isDirectImage(file)) {
46
+ const sizeBytes = sourceFileBytes(file).byteLength;
47
+ if (sizeBytes < 1 || sizeBytes > MAX_DIRECT_ASSET_BYTES)
48
+ return false;
49
+ projectedBytes += MAX_DIRECT_ASSET_REF_BYTES;
50
+ continue;
51
+ }
52
+ if (file.content.length > MAX_PATCH_FILE_CONTENT_CHARS)
53
+ return false;
54
+ projectedBytes += Buffer.byteLength(file.content, 'utf8');
55
+ }
56
+ return projectedBytes <= MAX_PATCH_CONTENT_BYTES;
57
+ };
58
+ export const uploadDirectAssetWithFetch = async (input) => {
59
+ const response = await (input.fetchFn || fetch)(input.uploadUrl, {
60
+ method: 'PUT',
61
+ headers: input.uploadHeaders,
62
+ body: new Uint8Array(input.body).buffer,
63
+ signal: input.signal,
64
+ });
65
+ if (!response.ok) {
66
+ throw new Error(`Direct asset upload failed with HTTP ${response.status}.`);
67
+ }
68
+ };
69
+ export const executeFastDraftPatchSync = async (input) => {
70
+ if (!patchIsSupported(input.files, input.deletedPaths)) {
71
+ return { kind: 'fallback', reason: 'unsupported-patch' };
72
+ }
73
+ const directFiles = input.files.filter(isDirectImage);
74
+ let uploadedAssets;
75
+ try {
76
+ const uploadConcurrency = Number.isSafeInteger(input.uploadConcurrency)
77
+ ? Math.min(16, Math.max(1, input.uploadConcurrency))
78
+ : DEFAULT_UPLOAD_CONCURRENCY;
79
+ uploadedAssets = await mapWithConcurrency(directFiles, uploadConcurrency, async (file) => {
80
+ const body = sourceFileBytes(file);
81
+ const description = {
82
+ workspaceId: input.workspaceId,
83
+ funnelId: input.funnelId,
84
+ path: file.path,
85
+ contentType: file.contentType,
86
+ sizeBytes: body.byteLength,
87
+ sha256: hash(body),
88
+ };
89
+ const prepared = await input.api.prepareAsset(description);
90
+ await input.api.uploadAsset({
91
+ uploadUrl: prepared.uploadUrl,
92
+ uploadHeaders: prepared.uploadHeaders,
93
+ body,
94
+ signal: input.signal,
95
+ });
96
+ return input.api.finalizeAsset({ ...description, uploadKey: prepared.uploadKey });
97
+ });
98
+ }
99
+ catch (error) {
100
+ if (isMissingTrpcProcedureError(error)) {
101
+ return { kind: 'fallback', reason: 'legacy-api' };
102
+ }
103
+ throw error;
104
+ }
105
+ const uploadedByPath = new Map(uploadedAssets.map((file) => [file.path, file]));
106
+ const changedFiles = input.files.map((file) => (uploadedByPath.get(file.path) ?? {
107
+ path: file.path,
108
+ content: file.content,
109
+ contentType: file.contentType,
110
+ }));
111
+ const requestWithoutKey = {
112
+ workspaceId: input.workspaceId,
113
+ funnelId: input.funnelId,
114
+ baseDraftVersionId: input.baseDraftVersionId,
115
+ message: input.message,
116
+ changedFiles,
117
+ deletedPaths: [...input.deletedPaths],
118
+ };
119
+ try {
120
+ const result = await input.api.apply({
121
+ ...requestWithoutKey,
122
+ idempotencyKey: createIdempotencyKey(requestWithoutKey),
123
+ });
124
+ return { kind: 'committed', result, directAssetCount: directFiles.length };
125
+ }
126
+ catch (error) {
127
+ if (isMissingTrpcProcedureError(error)) {
128
+ return { kind: 'fallback', reason: 'legacy-api' };
129
+ }
130
+ throw error;
131
+ }
132
+ };
@@ -128,6 +128,7 @@ export declare function collectSourceSnapshot(rootDir: string): Promise<{
128
128
  sourceFiles: SourceFile[];
129
129
  }>;
130
130
  export declare function collectSourceFiles(rootDir: string): Promise<SourceFile[]>;
131
+ export declare const sourceFileBytes: (file: SourceFile) => Buffer;
131
132
  export declare function rebaseSourceFiles(input: {
132
133
  baseFiles: readonly SourceFile[];
133
134
  localFiles: readonly SourceFile[];
package/dist/localSync.js CHANGED
@@ -382,7 +382,7 @@ export async function collectSourceSnapshot(rootDir) {
382
382
  export async function collectSourceFiles(rootDir) {
383
383
  return (await collectSourceSnapshot(rootDir)).sourceFiles;
384
384
  }
385
- const sourceFileBytes = (file) => (decodeBinarySourceContent(file) ?? Buffer.from(file.content, 'utf8'));
385
+ export const sourceFileBytes = (file) => (decodeBinarySourceContent(file) ?? Buffer.from(file.content, 'utf8'));
386
386
  const sourceFilesEqual = (left, right) => {
387
387
  if (!left || !right)
388
388
  return left === right;
@@ -4,16 +4,16 @@
4
4
  "minimumCliVersion": "0.1.20",
5
5
  "entries": [
6
6
  {
7
- "repositoryCliVersion": "0.1.140",
7
+ "repositoryCliVersion": "0.1.143",
8
8
  "manifest": {
9
9
  "schemaVersion": 1,
10
- "bundleVersion": "2.0.130",
10
+ "bundleVersion": "2.0.133",
11
11
  "stepContractVersion": 3,
12
12
  "contractHash": "d761e91d5ac6ff9e72c6d49c5bcd014270912473a66f99c49d726c65998085cf",
13
13
  "managedFiles": [
14
14
  {
15
15
  "path": "AGENTS.md",
16
- "sha256": "952fbafb5841b8f2e6fadab5032374c98390ef90c1ca0ed27747a38d0cc009d7"
16
+ "sha256": "22118f0f909a747f8a27f4eed16ceb5ec2a9283fd9645114fda961c0405a2a6b"
17
17
  },
18
18
  {
19
19
  "path": "CLAUDE.md",
@@ -45,7 +45,7 @@
45
45
  },
46
46
  {
47
47
  "path": "docs/funnelsgrove/migrations/step-contract-v3.md",
48
- "sha256": "9988e6f7b4ecf3f4a73ff83cf3f3613f82d765c59d09e55e86b0560d1e3eafa5"
48
+ "sha256": "bb6f567146d9c70b209eff612ffcfb5e7c20b7ccb357beec47a187ead887a829"
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": "4e81bd56071fa38708c7f18488420038339c8cc984062ffd7e8a4930ab6b06f0"
148
+ "sha256": "7a7f556fc144e82469dbc56da7d4ce588c3bcc627ebf4b9aec9961f93d672f1f"
149
149
  }
150
150
  ]
151
151
  }
152
152
  },
153
153
  {
154
- "repositoryCliVersion": "0.1.139",
154
+ "repositoryCliVersion": "0.1.142",
155
155
  "manifest": {
156
156
  "schemaVersion": 1,
157
- "bundleVersion": "2.0.129",
157
+ "bundleVersion": "2.0.132",
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": "2a6ffbd2768cf73b049b4b067c003c81c2e3d3679fea6bf3f2865ddf419983f4"
195
+ "sha256": "33d225bcc4f6f7aaa473f3bebe81799b3ec4751c374a4c2d9159afc56415ba74"
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": "adda37f1991ccbb5e7abf2b9f1465688c116e6604b08a3d63f104b295a93140b"
295
+ "sha256": "ea5b05c7f28303245e358598f125a3a31c15175c2ef15ae8873b25be2ded133e"
296
296
  }
297
297
  ]
298
298
  }
299
299
  },
300
300
  {
301
- "repositoryCliVersion": "0.1.138",
301
+ "repositoryCliVersion": "0.1.141",
302
302
  "manifest": {
303
303
  "schemaVersion": 1,
304
- "bundleVersion": "2.0.128",
304
+ "bundleVersion": "2.0.131",
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": "ac3397d4724b3653080cb43f6b01bfc43e65da4acb867592974ef106d6833bcf"
342
+ "sha256": "015d013594cabb94c288bb39d7c717f531b68a1fe4754e6baefc0e08bbc5b872"
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": "793db126d3f299dfc98bd4dd715dfd5183d155557e32ec401491397364da5475"
442
+ "sha256": "7af952690a2b3c592ce6688b8524aa4c5fe111a0c798dc25106eb0d594c2452b"
443
443
  }
444
444
  ]
445
445
  }
446
446
  },
447
447
  {
448
- "repositoryCliVersion": "0.1.136",
448
+ "repositoryCliVersion": "0.1.140",
449
449
  "manifest": {
450
450
  "schemaVersion": 1,
451
- "bundleVersion": "2.0.126",
451
+ "bundleVersion": "2.0.130",
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": "6a7b8bea3fa6b4245307e96b51872fe04ab576c3a9161314f90c00cf6415465c"
489
+ "sha256": "9988e6f7b4ecf3f4a73ff83cf3f3613f82d765c59d09e55e86b0560d1e3eafa5"
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": "8b1218c5e5343b2c3e00079170da131aff33f5a808365700f8eab62dbf7433b9"
589
+ "sha256": "4e81bd56071fa38708c7f18488420038339c8cc984062ffd7e8a4930ab6b06f0"
590
590
  }
591
591
  ]
592
592
  }
593
593
  },
594
594
  {
595
- "repositoryCliVersion": "0.1.135",
595
+ "repositoryCliVersion": "0.1.139",
596
596
  "manifest": {
597
597
  "schemaVersion": 1,
598
- "bundleVersion": "2.0.125",
598
+ "bundleVersion": "2.0.129",
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": "c7a266bb4f6614daa2a1adcfb3248f99330a8d4184866a4611268b93a4352203"
636
+ "sha256": "2a6ffbd2768cf73b049b4b067c003c81c2e3d3679fea6bf3f2865ddf419983f4"
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": "ad9e79fd0ee9d6478567615d78e34efa272fc6a1c5f8016cd1aae64ba3e24679"
736
+ "sha256": "adda37f1991ccbb5e7abf2b9f1465688c116e6604b08a3d63f104b295a93140b"
737
737
  }
738
738
  ]
739
739
  }
740
740
  },
741
741
  {
742
- "repositoryCliVersion": "0.1.132",
742
+ "repositoryCliVersion": "0.1.138",
743
743
  "manifest": {
744
744
  "schemaVersion": 1,
745
- "bundleVersion": "2.0.122",
745
+ "bundleVersion": "2.0.128",
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": "46f46756190a6085c562b9ceb2fd4a0eac961ea4f985f85a1f6e715827e171a6"
783
+ "sha256": "ac3397d4724b3653080cb43f6b01bfc43e65da4acb867592974ef106d6833bcf"
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": "01ad9b12769dd8894b2aaeea0bf21e7b622c3e4ee4612987acdcb2ec5bf93d6f"
883
+ "sha256": "793db126d3f299dfc98bd4dd715dfd5183d155557e32ec401491397364da5475"
884
884
  }
885
885
  ]
886
886
  }
887
887
  },
888
888
  {
889
- "repositoryCliVersion": "0.1.131",
889
+ "repositoryCliVersion": "0.1.136",
890
890
  "manifest": {
891
891
  "schemaVersion": 1,
892
- "bundleVersion": "2.0.121",
892
+ "bundleVersion": "2.0.126",
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": "1a8d1f9bf73b24fc07d26b56fa4185fdc9183a45bcf98b9b1996d8e27792bd1e"
930
+ "sha256": "6a7b8bea3fa6b4245307e96b51872fe04ab576c3a9161314f90c00cf6415465c"
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": "de523557a1057d95aaaf9a535b518fb4d8ca6bd99eaafdd57aab56db17c7cf1e"
1030
+ "sha256": "8b1218c5e5343b2c3e00079170da131aff33f5a808365700f8eab62dbf7433b9"
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.140",
3
+ "version": "0.1.143",
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.26",
37
+ "@funnelsgrove/runtime": "0.7.27",
38
38
  "commander": "^12.0.0",
39
39
  "typescript": "^5.8.3"
40
40
  },
41
41
  "devDependencies": {
42
- "@funnelsgrove/analytics": "0.1.75",
42
+ "@funnelsgrove/analytics": "0.1.76",
43
43
  "@funnelsgrove/payments": "0.7.19",
44
44
  "vitest": "^3.0.0"
45
45
  }
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "bundleVersion": "2.0.130",
3
+ "bundleVersion": "2.0.133",
4
4
  "stepContractVersion": 3,
5
5
  "contractHash": "d761e91d5ac6ff9e72c6d49c5bcd014270912473a66f99c49d726c65998085cf",
6
6
  "managedFiles": [
7
7
  {
8
8
  "path": "AGENTS.md",
9
- "sha256": "952fbafb5841b8f2e6fadab5032374c98390ef90c1ca0ed27747a38d0cc009d7"
9
+ "sha256": "22118f0f909a747f8a27f4eed16ceb5ec2a9283fd9645114fda961c0405a2a6b"
10
10
  },
11
11
  {
12
12
  "path": "CLAUDE.md",
@@ -38,7 +38,7 @@
38
38
  },
39
39
  {
40
40
  "path": "docs/funnelsgrove/migrations/step-contract-v3.md",
41
- "sha256": "9988e6f7b4ecf3f4a73ff83cf3f3613f82d765c59d09e55e86b0560d1e3eafa5"
41
+ "sha256": "bb6f567146d9c70b209eff612ffcfb5e7c20b7ccb357beec47a187ead887a829"
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": "4e81bd56071fa38708c7f18488420038339c8cc984062ffd7e8a4930ab6b06f0"
141
+ "sha256": "7a7f556fc144e82469dbc56da7d4ce588c3bcc627ebf4b9aec9961f93d672f1f"
142
142
  }
143
143
  ]
144
144
  }
@@ -29,7 +29,7 @@ This file is generated from the FunnelsGrove step contract. Start at [the agent
29
29
 
30
30
  1. Before edits run `fgrove status`, `git status --short`, and `fgrove github status` when the funnel is GitHub-connected.
31
31
  2. Never run `fgrove sync down` over changed synced source. Use `--force` only to intentionally discard those local changes.
32
- 3. Sync-up uses remote compare-and-swap through the base draft version. On stale-draft rejection, download into a clean temporary directory, merge deliberately, rerun checks, and retry.
32
+ 3. Sync-up atomically patches changed paths through the base draft version, uploads changed `public/` images directly, and safely replays retries. Disjoint remote edits rebase automatically; on a same-path conflict, run `fgrove sync rebase`, review the merge, rerun checks, and retry.
33
33
  4. GitHub-connected changes use git push, `fgrove github pull`, terminal status, then publish; never use `fgrove sync up` for the same diff. Non-GitHub funnels use `fgrove sync up`.
34
34
  5. Use `fgrove env pull` when only the ignored `.env` must be refreshed. Environment files never belong in synced source.
35
35
 
@@ -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.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.
20
+ Release `@funnelsgrove/runtime` `0.7.27` first, then `@funnelsgrove/analytics` `0.1.76`, then `@funnelsgrove/payments` `0.7.19`. The production deploy verifies the zero-traffic API candidate, publishes and verifies `@funnelsgrove/cli` `0.1.143`, 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.130",
3
+ "bundleVersion": "2.0.133",
4
4
  "contractSource": "funnelsgrove-repository://apps/funnel-runtime/contracts/step-contract-v2.json",
5
5
  "fullyGenerated": [
6
6
  ".funnelsgrove-docs.json",
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "bundleVersion": "2.0.130",
3
+ "bundleVersion": "2.0.133",
4
4
  "stepContractVersion": 3,
5
5
  "contractHash": "d761e91d5ac6ff9e72c6d49c5bcd014270912473a66f99c49d726c65998085cf",
6
6
  "managedFiles": [
7
7
  {
8
8
  "path": "AGENTS.md",
9
- "sha256": "952fbafb5841b8f2e6fadab5032374c98390ef90c1ca0ed27747a38d0cc009d7"
9
+ "sha256": "22118f0f909a747f8a27f4eed16ceb5ec2a9283fd9645114fda961c0405a2a6b"
10
10
  },
11
11
  {
12
12
  "path": "CLAUDE.md",
@@ -38,7 +38,7 @@
38
38
  },
39
39
  {
40
40
  "path": "docs/funnelsgrove/migrations/step-contract-v3.md",
41
- "sha256": "9988e6f7b4ecf3f4a73ff83cf3f3613f82d765c59d09e55e86b0560d1e3eafa5"
41
+ "sha256": "bb6f567146d9c70b209eff612ffcfb5e7c20b7ccb357beec47a187ead887a829"
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": "4e81bd56071fa38708c7f18488420038339c8cc984062ffd7e8a4930ab6b06f0"
141
+ "sha256": "7a7f556fc144e82469dbc56da7d4ce588c3bcc627ebf4b9aec9961f93d672f1f"
142
142
  }
143
143
  ]
144
144
  }
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "sourceTreeHash": "edcad923cf6088e92c2b736308c60112afdbce89f96376d5d4dac820fc58996f",
3
+ "sourceTreeHash": "d2169824240f132d22d886aa9be81f9c4148f8166e9e49aa48534713c3dcd032",
4
4
  "stepContractVersion": 3,
5
- "docsBundleVersion": "2.0.130",
5
+ "docsBundleVersion": "2.0.133",
6
6
  "files": [
7
7
  {
8
8
  "path": ".env.example",
@@ -16,12 +16,12 @@
16
16
  },
17
17
  {
18
18
  "path": ".funnelsgrove-docs.json",
19
- "sha256": "b6b0910ffab65e7d3885aec9eba9fba72e9652e99d3b1e9e08d2253111820172",
19
+ "sha256": "050e0b96acb57586d7c373bf46598eccea5f409e9f655440a8e0346cdc764523",
20
20
  "mode": "100644"
21
21
  },
22
22
  {
23
23
  "path": "AGENTS.md",
24
- "sha256": "952fbafb5841b8f2e6fadab5032374c98390ef90c1ca0ed27747a38d0cc009d7",
24
+ "sha256": "22118f0f909a747f8a27f4eed16ceb5ec2a9283fd9645114fda961c0405a2a6b",
25
25
  "mode": "100644"
26
26
  },
27
27
  {
@@ -101,7 +101,7 @@
101
101
  },
102
102
  {
103
103
  "path": "docs/funnelsgrove/migrations/step-contract-v3.md",
104
- "sha256": "9988e6f7b4ecf3f4a73ff83cf3f3613f82d765c59d09e55e86b0560d1e3eafa5",
104
+ "sha256": "bb6f567146d9c70b209eff612ffcfb5e7c20b7ccb357beec47a187ead887a829",
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": "4e81bd56071fa38708c7f18488420038339c8cc984062ffd7e8a4930ab6b06f0",
239
+ "sha256": "7a7f556fc144e82469dbc56da7d4ce588c3bcc627ebf4b9aec9961f93d672f1f",
240
240
  "mode": "100644"
241
241
  },
242
242
  {
@@ -256,17 +256,17 @@
256
256
  },
257
257
  {
258
258
  "path": "next.config.ts",
259
- "sha256": "cd5ff10c989cf4ae5d54b78638843d56e32e3999f2334cb0cbc9277aae68356c",
259
+ "sha256": "9d2213c2270579568fa5ae409d5173594c08048bcaf91350b4d946293022ce74",
260
260
  "mode": "100644"
261
261
  },
262
262
  {
263
263
  "path": "package-lock.json",
264
- "sha256": "09e020ec8442cb7a0a87a1ffddec86d6caee3a54b494ed844407007063ff68a2",
264
+ "sha256": "8f60d0578889cf9433a5b383f9d243da0f36b22b50bc76354d44c35adf2eba56",
265
265
  "mode": "100644"
266
266
  },
267
267
  {
268
268
  "path": "package.json",
269
- "sha256": "a965a1abeef3d228a57be9f89275144d9530cafec0d85351cf541fdcc5b8d1ac",
269
+ "sha256": "931094eb8a5eb373bb956422ec4ba0d50abb25c4525867b22bad6b64ef034318",
270
270
  "mode": "100644"
271
271
  },
272
272
  {
@@ -29,7 +29,7 @@ This file is generated from the FunnelsGrove step contract. Start at [the agent
29
29
 
30
30
  1. Before edits run `fgrove status`, `git status --short`, and `fgrove github status` when the funnel is GitHub-connected.
31
31
  2. Never run `fgrove sync down` over changed synced source. Use `--force` only to intentionally discard those local changes.
32
- 3. Sync-up uses remote compare-and-swap through the base draft version. On stale-draft rejection, download into a clean temporary directory, merge deliberately, rerun checks, and retry.
32
+ 3. Sync-up atomically patches changed paths through the base draft version, uploads changed `public/` images directly, and safely replays retries. Disjoint remote edits rebase automatically; on a same-path conflict, run `fgrove sync rebase`, review the merge, rerun checks, and retry.
33
33
  4. GitHub-connected changes use git push, `fgrove github pull`, terminal status, then publish; never use `fgrove sync up` for the same diff. Non-GitHub funnels use `fgrove sync up`.
34
34
  5. Use `fgrove env pull` when only the ignored `.env` must be refreshed. Environment files never belong in synced source.
35
35
 
@@ -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.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.
20
+ Release `@funnelsgrove/runtime` `0.7.27` first, then `@funnelsgrove/analytics` `0.1.76`, then `@funnelsgrove/payments` `0.7.19`. The production deploy verifies the zero-traffic API candidate, publishes and verifies `@funnelsgrove/cli` `0.1.143`, 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.130",
3
+ "bundleVersion": "2.0.133",
4
4
  "contractSource": "funnelsgrove-repository://apps/funnel-runtime/contracts/step-contract-v2.json",
5
5
  "fullyGenerated": [
6
6
  ".funnelsgrove-docs.json",
@@ -3,6 +3,7 @@ import path from 'node:path';
3
3
  import type { NextConfig } from 'next';
4
4
 
5
5
  const isStaticExportBuild = process.env.NEXT_EXPORT === '1';
6
+ const runtimeConfigOrigin = process.env.FUNNEL_RUNTIME_CONFIG_ORIGIN?.trim().replace(/\/+$/, '') || '';
6
7
 
7
8
  // Inside the funnelsgrove monorepo, alias @funnelsgrove/* to the package
8
9
  // sources so changes there rebuild live. Standalone copies (funnels created
@@ -31,6 +32,12 @@ const nextConfig: NextConfig = {
31
32
  ? { output: 'export' as const }
32
33
  : {
33
34
  rewrites: async () => [
35
+ ...(runtimeConfigOrigin
36
+ ? [{
37
+ source: '/api/funnel-config/:path*',
38
+ destination: `${runtimeConfigOrigin}/api/funnel-config/:path*`,
39
+ }]
40
+ : []),
34
41
  {
35
42
  source: '/ingest/static/:path*',
36
43
  destination: 'https://us-assets.i.posthog.com/static/:path*',
@@ -8,9 +8,9 @@
8
8
  "name": "funnel-template",
9
9
  "version": "0.1.0",
10
10
  "dependencies": {
11
- "@funnelsgrove/analytics": "^0.1.75",
11
+ "@funnelsgrove/analytics": "^0.1.76",
12
12
  "@funnelsgrove/payments": "^0.7.19",
13
- "@funnelsgrove/runtime": "^0.7.26",
13
+ "@funnelsgrove/runtime": "^0.7.27",
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.75",
942
- "resolved": "https://registry.npmjs.org/@funnelsgrove/analytics/-/analytics-0.1.75.tgz",
943
- "integrity": "sha512-q7hOSmSuyHQEN/95MBcgjAwWqewUTUlbH3BgaSaYBPabGZyZxMC3Zopmyva/OieXmQ0f3J8JQlpxhdEB7ssftA==",
941
+ "version": "0.1.76",
942
+ "resolved": "https://registry.npmjs.org/@funnelsgrove/analytics/-/analytics-0.1.76.tgz",
943
+ "integrity": "sha512-5Zf0zxZ4GXRpwfHTAcJX1sk07tiFrfC7TVB1dZueyNosFcKl6+o9omVE5/euoJ0uJsblPGTzJDW8+wdyK2MbzA==",
944
944
  "dependencies": {
945
- "@funnelsgrove/runtime": "0.7.26"
945
+ "@funnelsgrove/runtime": "0.7.27"
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.26",
965
- "resolved": "https://registry.npmjs.org/@funnelsgrove/runtime/-/runtime-0.7.26.tgz",
966
- "integrity": "sha512-PbdmEC23bJpGo/dRNhhHTbp2y8a/IZ3Ggs3746UwZQOxxzV9ImkNVeWQl0zlmnGvBLWGOWcpTW48nuneR0uwuw==",
964
+ "version": "0.7.27",
965
+ "resolved": "https://registry.npmjs.org/@funnelsgrove/runtime/-/runtime-0.7.27.tgz",
966
+ "integrity": "sha512-FiVI6rmV8BhtRowV46Cm4bqgr2UvYUCI/yyW41lhiYYcnolVxNYyaO++j8FlkqXn99JvPPauSHC6dtLvmojeEg==",
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.75",
15
+ "@funnelsgrove/analytics": "^0.1.76",
16
16
  "@funnelsgrove/payments": "^0.7.19",
17
- "@funnelsgrove/runtime": "^0.7.26",
17
+ "@funnelsgrove/runtime": "^0.7.27",
18
18
  "@stripe/react-stripe-js": "^5.6.0",
19
19
  "@stripe/stripe-js": "^8.7.0",
20
20
  "lucide-react": "^0.553.0",