@funnelsgrove/cli 0.1.332 → 0.1.335

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/dist/cli.js CHANGED
@@ -24,6 +24,7 @@ import { createSetupSecretLink, formatSetupStatus, formatStepDocs, readSetupGuid
24
24
  import { buildAlertStatisticsReport, fetchAlertStatistics, fetchPreventSummary, formatAlertRows, formatAlertStatistics, formatPreventRows, formatPreventSummary, listAlerts, listPreventSearches, parseAlertMonth, toAlertJsonRow, } from './alertCommands.js';
25
25
  import { cancelUserSubscription, findUser, formatUserCancellation, formatUserFind, formatUserLookup, formatUserRefunds, formatRefundPreview, lookupUser, parseUserSelector, previewRefund, refundUserPayments, } from './userCommands.js';
26
26
  import { buildBugReport, formatBugReportPreview, resolveBugReportContext, submitBugReport, } from './bugReportCommands.js';
27
+ import { assignSupportTicketProject, cancelSupportSubscription, closeSupportTicket, escalateSupportTicket, formatSupportProjects, formatSupportWorkflowHistory, formatSupportWorkflowLoaded, formatSupportWorkflowPulled, formatSupportWorkflowPushed, getSupportWorkflowEditView, getSupportWorkflowVersionFiles, pullSupportWorkflowForEditing, readSupportWorkflowEdit, recordSupportWorkflowPush, saveSupportWorkflowFiles, formatTicketDetail, formatTicketLine, getSupportWorkflow, initSupportFolder, listCustomerTickets, listSupportProjects, lookupSupportBilling, openSupportTicket, parseBillingTarget, parseTicketNumber, refundSupportPayments, replyToSupportTicket, resolveSupportProject, setSupportInstructions, SUPPORT_ROUTINE_PROMPT, takeSupportQueue, writeSupportWorkflow, } from './supportCommands.js';
27
28
  import { executeOfferSetPrices, executeOfferSetPublish, executeOfferSetPull, formatOfferSetPriceCatalogs, } from './offerSetCommands.js';
28
29
  import { executeEmailPull, executeEmailPush, executeEmailSend, executeEmailUpdateVariables, executeEmailSequenceAddStep, executeEmailSequenceCancel, executeEmailSequenceCreate, executeEmailSequencePublish, executeEmailSequenceSetActive, executeEmailLibraryAdd, executeEmailLibraryList, executeEmailTemplatePublish, executeEmailValidate, parseEmailVariablesJson, } from './emailCommands.js';
29
30
  import { formatGitHubConnectRows, formatGitHubJobRows, formatGitHubStatusRows, } from './githubOutput.js';
@@ -2472,6 +2473,244 @@ addUserOptions(usersCommand
2472
2473
  }
2473
2474
  printValueRows(formatUserCancellation(result).map((line) => [line]));
2474
2475
  });
2476
+ const supportScope = async () => ({ callApi, token: await readAuthToken() });
2477
+ const printSupportOutput = (json, value, lines) => {
2478
+ console.log(json ? JSON.stringify(value, null, 2) : lines.join('\n'));
2479
+ };
2480
+ const supportCommand = addExamples(program.command('support').description('Work support tickets as a Support Agent (replies and actions go through FunnelsGrove)'), [
2481
+ 'fgrove support projects',
2482
+ 'fgrove support workflow --project claimbee',
2483
+ 'fgrove support workflow-pull --project claimbee',
2484
+ 'fgrove support workflow-push --dir fgrove-support-edit/<project-id>',
2485
+ 'fgrove support queue --take 10',
2486
+ 'fgrove support open TCK-42',
2487
+ 'fgrove support reply TCK-42 --body-file reply.md',
2488
+ 'fgrove support escalate TCK-42 --note "chargeback threat"',
2489
+ ]);
2490
+ supportCommand
2491
+ .command('projects')
2492
+ .description('Projects you can work, with whether support is on')
2493
+ .option('--json', 'Print machine-readable JSON')
2494
+ .action(async (options) => {
2495
+ const projects = await listSupportProjects(await supportScope());
2496
+ printSupportOutput(options.json, { projects }, formatSupportProjects(projects));
2497
+ });
2498
+ supportCommand
2499
+ .command('workflow')
2500
+ .description('Write the project\'s Support Workflow and your personal instructions into a folder for Claude Code to follow')
2501
+ .requiredOption('--project <name-or-id>', 'Support project')
2502
+ .option('--out <dir>', 'Folder to write into (default: ./fgrove-support/<project-id>)')
2503
+ .option('--json', 'Print the files as JSON and write nothing')
2504
+ .action(async (options) => {
2505
+ const scope = await supportScope();
2506
+ const project = resolveSupportProject(await listSupportProjects(scope), options.project);
2507
+ const workflow = await getSupportWorkflow(scope, project.id);
2508
+ if (options.json) {
2509
+ console.log(JSON.stringify({ projectId: project.id, projectName: project.name, ...workflow }, null, 2));
2510
+ return;
2511
+ }
2512
+ const entryPath = await writeSupportWorkflow(options.out ?? path.join(process.cwd(), 'fgrove-support', project.id), workflow);
2513
+ console.log(formatSupportWorkflowLoaded(project, workflow, entryPath).join('\n'));
2514
+ });
2515
+ /** A project to edit by ID in any workspace (the server checks the rights), or by name or slug in a workspace. */
2516
+ const resolveSupportEditProject = async (options) => {
2517
+ if (options.project && UUID_PATTERN.test(options.project.trim())) {
2518
+ return { scope: await supportScope(), projectId: options.project.trim() };
2519
+ }
2520
+ const { callApi: api, token, projectId } = await resolveProjectCommandScope(options);
2521
+ return { scope: { callApi: api, token }, projectId };
2522
+ };
2523
+ supportCommand
2524
+ .command('workflow-pull')
2525
+ .description('Download a project\'s Support Workflow to edit it (organization owners and admins, Super Admins): its own files, the template and editing instructions')
2526
+ .option('--workspace <id-or-slug-or-name>', 'Workspace id, slug, or name')
2527
+ .option('--project <id-or-slug-or-name>', 'Project id (any workspace), or slug or name within the workspace')
2528
+ .option('--dir <dir>', 'New folder to write into (default: ./fgrove-support-edit/<project-id>)')
2529
+ .option('--from-version <n>', 'Start from this earlier version instead of the latest, to restore it')
2530
+ .option('--force', 'Replace an existing folder and the unpushed edits in it')
2531
+ .action(async (options) => {
2532
+ const { scope, projectId } = await resolveSupportEditProject(options);
2533
+ const version = options.fromVersion === undefined ? undefined : Number(options.fromVersion);
2534
+ if (version !== undefined && (!Number.isInteger(version) || version < 1))
2535
+ throw new Error('--from-version must be a version number such as 3.');
2536
+ const view = await getSupportWorkflowEditView(scope, projectId);
2537
+ const files = version === undefined ? undefined : await getSupportWorkflowVersionFiles(scope, projectId, version);
2538
+ const dir = await pullSupportWorkflowForEditing(options.dir ?? path.join(process.cwd(), 'fgrove-support-edit', projectId), {
2539
+ projectId, view, files, force: options.force,
2540
+ });
2541
+ console.log(formatSupportWorkflowPulled(dir, view, version ?? view.workflow.projectVersion).join('\n'));
2542
+ });
2543
+ supportCommand
2544
+ .command('workflow-push')
2545
+ .description('Save the edited project files as the Support Workflow\'s next version; nothing is saved while a check fails')
2546
+ .requiredOption('--dir <dir>', 'Folder made by workflow-pull')
2547
+ .action(async (options) => {
2548
+ const scope = await supportScope();
2549
+ const { state, files } = await readSupportWorkflowEdit(options.dir);
2550
+ const result = await saveSupportWorkflowFiles(scope, state.projectId, files, state.basedOnVersion).catch((error) => {
2551
+ if (!/Someone saved a newer version/.test(error.message))
2552
+ throw error;
2553
+ throw new Error(`${error.message}\nNothing was saved. Pull the latest into a new folder with \`fgrove support workflow-pull --project ${state.projectId} --dir <new folder>\`, carry your change over and push from there.`);
2554
+ });
2555
+ if (result.version !== null)
2556
+ await recordSupportWorkflowPush(options.dir, result.version);
2557
+ const view = result.version === null ? undefined : await getSupportWorkflowEditView(scope, state.projectId);
2558
+ console.log(formatSupportWorkflowPushed(result, state.basedOnVersion, view).join('\n'));
2559
+ if (result.version === null)
2560
+ process.exitCode = 1;
2561
+ });
2562
+ supportCommand
2563
+ .command('workflow-history')
2564
+ .description('Saved versions of a project\'s Support Workflow, newest first')
2565
+ .option('--workspace <id-or-slug-or-name>', 'Workspace id, slug, or name')
2566
+ .option('--project <id-or-slug-or-name>', 'Project id (any workspace), or slug or name within the workspace')
2567
+ .option('--json', 'Print machine-readable JSON')
2568
+ .action(async (options) => {
2569
+ const { scope, projectId } = await resolveSupportEditProject(options);
2570
+ const view = await getSupportWorkflowEditView(scope, projectId);
2571
+ printSupportOutput(options.json, { projectVersion: view.workflow.projectVersion, versions: view.versions }, formatSupportWorkflowHistory(view));
2572
+ });
2573
+ supportCommand
2574
+ .command('init')
2575
+ .description('Make this folder a support folder: writes the CLAUDE.md that tells Claude Code how to load each project\'s Support Workflow')
2576
+ .option('--dir <dir>', 'Folder to set up (default: the current folder)')
2577
+ .option('--force', 'Replace an existing CLAUDE.md')
2578
+ .action(async (options) => {
2579
+ const target = await initSupportFolder(options.dir ?? process.cwd(), options.force);
2580
+ console.log([
2581
+ `Wrote ${target}.`,
2582
+ 'Start Claude Code in this folder and ask it to work the support tickets.',
2583
+ `For a Support Routine, schedule a task in this folder with the prompt: ${SUPPORT_ROUTINE_PROMPT}`,
2584
+ ].join('\n'));
2585
+ });
2586
+ supportCommand
2587
+ .command('instructions')
2588
+ .description('Replace your personal support instructions with the contents of a file')
2589
+ .requiredOption('--file <path>', 'Markdown file with your instructions; an empty file clears them')
2590
+ .action(async (options) => {
2591
+ await setSupportInstructions(await supportScope(), await readFile(path.resolve(process.cwd(), options.file), 'utf8'));
2592
+ console.log('Personal instructions saved.');
2593
+ });
2594
+ supportCommand
2595
+ .command('queue')
2596
+ .description('Take tickets to work: oldest first, held for you for 30 minutes')
2597
+ .option('--take <count>', 'How many tickets to take', '10')
2598
+ .option('--project <name-or-id>', 'Only this project')
2599
+ .option('--needs-person', 'Take tickets that wait for a person\'s decision instead of new ones')
2600
+ .option('--json', 'Print machine-readable JSON')
2601
+ .action(async (options) => {
2602
+ const scope = await supportScope();
2603
+ const take = Number(options.take);
2604
+ if (!Number.isInteger(take) || take < 1 || take > 50)
2605
+ throw new Error('--take must be a whole number from 1 to 50.');
2606
+ const projectId = options.project ? resolveSupportProject(await listSupportProjects(scope), options.project).id : undefined;
2607
+ const tickets = await takeSupportQueue(scope, { statuses: options.needsPerson ? ['needs_person'] : ['new'], take, ...(projectId ? { projectId } : {}) });
2608
+ printSupportOutput(options.json, { tickets }, tickets.length ? tickets.map(formatTicketLine) : ['The queue is empty.']);
2609
+ });
2610
+ supportCommand
2611
+ .command('open <ticket>')
2612
+ .description('Print a ticket: messages, actions and the customer\'s other tickets')
2613
+ .option('--json', 'Print machine-readable JSON')
2614
+ .action(async (ticket, options) => {
2615
+ const detail = await openSupportTicket(await supportScope(), parseTicketNumber(ticket));
2616
+ printSupportOutput(options.json, detail, formatTicketDetail(detail));
2617
+ });
2618
+ supportCommand
2619
+ .command('customer <email>')
2620
+ .description('List every ticket of a customer you can see')
2621
+ .option('--json', 'Print machine-readable JSON')
2622
+ .action(async (email, options) => {
2623
+ if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email.trim()))
2624
+ throw new Error(`"${email}" is not an email address.`);
2625
+ const tickets = await listCustomerTickets(await supportScope(), email);
2626
+ printSupportOutput(options.json, { tickets }, tickets.length ? tickets.map(formatTicketLine) : ['No tickets for this customer.']);
2627
+ });
2628
+ supportCommand
2629
+ .command('reply <ticket>')
2630
+ .description('Reply to the customer in the ticket\'s email thread')
2631
+ .option('--body <text>', 'Reply text')
2632
+ .option('--body-file <path>', 'File with the reply text')
2633
+ .action(async (ticket, options) => {
2634
+ if (Boolean(options.body) === Boolean(options.bodyFile))
2635
+ throw new Error('Pass exactly one of --body or --body-file.');
2636
+ const body = options.body ?? await readFile(path.resolve(process.cwd(), options.bodyFile), 'utf8');
2637
+ if (!body.trim())
2638
+ throw new Error('The reply is empty. Write the reply text in --body or --body-file.');
2639
+ const result = await replyToSupportTicket(await supportScope(), parseTicketNumber(ticket), body);
2640
+ console.log(`Reply sent for ${result.id}; the ticket now waits for the customer.`);
2641
+ });
2642
+ supportCommand
2643
+ .command('escalate <ticket>')
2644
+ .description('Leave the ticket for a person\'s decision')
2645
+ .requiredOption('--note <text>', 'Why a person must decide')
2646
+ .action(async (ticket, options) => {
2647
+ const result = await escalateSupportTicket(await supportScope(), parseTicketNumber(ticket), options.note);
2648
+ console.log(`${result.id} now needs a person.`);
2649
+ });
2650
+ supportCommand
2651
+ .command('close <ticket>')
2652
+ .description('Close the ticket; the customer\'s next message starts a new one')
2653
+ .option('--note <text>', 'Why the ticket is closed')
2654
+ .action(async (ticket, options) => {
2655
+ const result = await closeSupportTicket(await supportScope(), parseTicketNumber(ticket), options.note);
2656
+ console.log(`${result.id} closed.`);
2657
+ });
2658
+ supportCommand
2659
+ .command('assign-project <ticket>')
2660
+ .description('Assign a project to an Unassigned Ticket')
2661
+ .requiredOption('--project <name-or-id>', 'Support project')
2662
+ .action(async (ticket, options) => {
2663
+ const scope = await supportScope();
2664
+ const project = resolveSupportProject(await listSupportProjects(scope), options.project);
2665
+ const result = await assignSupportTicketProject(scope, parseTicketNumber(ticket), project.id);
2666
+ console.log(`${result.id} now belongs to ${result.projectName}.`);
2667
+ });
2668
+ const addSupportBillingTargetOptions = (command) => command
2669
+ .option('--ticket <ticket>', 'Ticket whose customer to use (TCK-42)')
2670
+ .option('--project <name-or-id>', 'Support project, with --email')
2671
+ .option('--email <email>', 'Customer email, with --project')
2672
+ .option('--json', 'Print machine-readable JSON');
2673
+ const resolveSupportBillingTarget = async (options) => {
2674
+ const scope = await supportScope();
2675
+ return { scope, target: await parseBillingTarget(options, () => listSupportProjects(scope)) };
2676
+ };
2677
+ addSupportBillingTargetOptions(supportCommand
2678
+ .command('billing')
2679
+ .description('Show the customer\'s live subscriptions and payments with refund eligibility'))
2680
+ .action(async (options) => {
2681
+ const { scope, target } = await resolveSupportBillingTarget(options);
2682
+ const lookup = await lookupSupportBilling(scope, target);
2683
+ printSupportOutput(options.json, lookup, formatUserLookup(lookup));
2684
+ });
2685
+ addSupportBillingTargetOptions(supportCommand
2686
+ .command('refund')
2687
+ .description('Fully refund the remaining amount of each chosen payment (IDs from support billing)')
2688
+ .requiredOption('--payment <id>', 'Payment ID; repeat for several', (value, previous = []) => [...previous, value])
2689
+ .option('--dry-run', 'Show what would be refunded without refunding'))
2690
+ .action(async (options) => {
2691
+ const { scope, target } = await resolveSupportBillingTarget(options);
2692
+ if (options.dryRun) {
2693
+ const preview = previewRefund(await lookupSupportBilling(scope, target), options.payment);
2694
+ printSupportOutput(options.json, { dryRun: true, refunds: preview }, formatRefundPreview(preview));
2695
+ return;
2696
+ }
2697
+ const { refunds } = await refundSupportPayments(scope, target, options.payment);
2698
+ if (refunds.some((refund) => refund.outcome === 'failed'))
2699
+ process.exitCode = 1;
2700
+ printSupportOutput(options.json, { refunds }, formatUserRefunds(refunds));
2701
+ });
2702
+ addSupportBillingTargetOptions(supportCommand
2703
+ .command('cancel')
2704
+ .description('Cancel the customer\'s billing subscription at period end, or immediately with --now')
2705
+ .option('--subscription <id>', 'Subscription ID; required when several subscriptions are still billing')
2706
+ .option('--now', 'Cancel immediately; the paid remainder is forfeited without a refund'))
2707
+ .action(async (options) => {
2708
+ const { scope, target } = await resolveSupportBillingTarget(options);
2709
+ if (options.now)
2710
+ console.error('Cancelling immediately: access ends now and the paid remainder is not refunded.');
2711
+ const result = await cancelSupportSubscription(scope, target, { subscriptionId: options.subscription, now: options.now });
2712
+ printSupportOutput(options.json, result, formatUserCancellation(result));
2713
+ });
2475
2714
  const bugCommand = addExamples(program.command('bug').description('Report a FunnelsGrove bug to the FunnelsGrove team'), [
2476
2715
  'fgrove bug report "sync up fails with ENOENT after renaming a step"',
2477
2716
  'fgrove bug report "publish hangs at image optimization" --log ./publish.log --dir ./claimbee-ios',
@@ -0,0 +1,197 @@
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 SupportScope = {
8
+ callApi: CallApi;
9
+ token: string;
10
+ };
11
+ export type SupportProject = {
12
+ id: string;
13
+ name: string;
14
+ workspaceId: string;
15
+ workspaceName: string;
16
+ supportEnabled: boolean;
17
+ };
18
+ export type SupportTicketStatus = 'new' | 'in_progress' | 'needs_person' | 'waiting_for_customer' | 'closed';
19
+ export type SupportTicketSummary = {
20
+ id: string;
21
+ number: number;
22
+ subject: string;
23
+ status: SupportTicketStatus;
24
+ projectId: string | null;
25
+ projectName: string | null;
26
+ customerEmail: string;
27
+ supportAddress: string;
28
+ preview: string;
29
+ updatedAt: string;
30
+ };
31
+ export type SupportTicketEntry = {
32
+ kind: 'message';
33
+ id: string;
34
+ direction: 'inbound' | 'outbound';
35
+ deliveryStatus: 'pending' | 'sent' | 'failed' | null;
36
+ author: string;
37
+ at: string;
38
+ body: string;
39
+ } | {
40
+ kind: 'action';
41
+ id: string;
42
+ actor: string;
43
+ at: string;
44
+ text: string;
45
+ needsAttention: boolean;
46
+ statusFrom?: SupportTicketStatus | null;
47
+ statusTo?: SupportTicketStatus | null;
48
+ };
49
+ export type SupportTicketDetail = {
50
+ ticket: SupportTicketSummary & {
51
+ entries: SupportTicketEntry[];
52
+ };
53
+ customerTickets: SupportTicketSummary[];
54
+ };
55
+ export type SupportWorkflow = {
56
+ supportEnabled: boolean;
57
+ templateVersion: string;
58
+ projectVersion: number | null;
59
+ files: Array<{
60
+ path: string;
61
+ layer: 'template' | 'project' | 'replaced';
62
+ content: string;
63
+ }>;
64
+ personalInstructions: string;
65
+ };
66
+ export declare const SUPPORT_WORKFLOW_ENTRY = "WORKFLOW.md";
67
+ /** Accepts `TCK-42` or `42`. */
68
+ export declare const parseTicketNumber: (value: string) => number;
69
+ /** Finds one of the person's support projects by ID or by name (case-insensitive). */
70
+ export declare const resolveSupportProject: (projects: SupportProject[], value: string) => SupportProject;
71
+ export declare const listSupportProjects: (scope: SupportScope) => Promise<SupportProject[]>;
72
+ export declare const getSupportWorkflow: (scope: SupportScope, projectId: string) => Promise<SupportWorkflow>;
73
+ export declare const setSupportInstructions: (scope: SupportScope, content: string) => Promise<{
74
+ saved: true;
75
+ }>;
76
+ export declare const openSupportTicket: (scope: SupportScope, number: number) => Promise<SupportTicketDetail>;
77
+ export declare const listCustomerTickets: (scope: SupportScope, email: string) => Promise<SupportTicketSummary[]>;
78
+ export declare const takeSupportQueue: (scope: SupportScope, input: {
79
+ statuses: Array<"new" | "needs_person" | "in_progress">;
80
+ take: number;
81
+ projectId?: string;
82
+ }) => Promise<SupportTicketSummary[]>;
83
+ export declare const replyToSupportTicket: (scope: SupportScope, number: number, body: string) => Promise<SupportTicketSummary>;
84
+ export declare const escalateSupportTicket: (scope: SupportScope, number: number, note: string) => Promise<SupportTicketSummary>;
85
+ export declare const closeSupportTicket: (scope: SupportScope, number: number, note?: string) => Promise<SupportTicketSummary>;
86
+ export declare const assignSupportTicketProject: (scope: SupportScope, number: number, projectId: string) => Promise<SupportTicketSummary>;
87
+ export declare const formatSupportProjects: (projects: SupportProject[]) => string[];
88
+ export declare const formatTicketLine: (ticket: SupportTicketSummary) => string;
89
+ export declare const formatTicketDetail: ({ ticket, customerTickets }: SupportTicketDetail) => string[];
90
+ /** Replaces `dir` with the workflow's files and PERSONAL.md. Returns the entry file's path. */
91
+ export declare const writeSupportWorkflow: (dir: string, workflow: SupportWorkflow) => Promise<string>;
92
+ export declare const formatSupportWorkflowLoaded: (project: SupportProject, workflow: SupportWorkflow, entryPath: string) => string[];
93
+ /** The support folder's CLAUDE.md: the same for every agent, reviewed with the CLI, never edited per project. */
94
+ export declare const SUPPORT_FOLDER_INSTRUCTIONS = "# FunnelsGrove support folder\n\nThis folder is for working FunnelsGrove Support Tickets with the `fgrove support` CLI. Each project has its own Support Workflow, which `fgrove` writes to `fgrove-support/<project-id>/`.\n\nWhen the person asks to work, check or decide support tickets, in any wording or language, or a task prompt starts with `Support Routine run`:\n\n1. `fgrove support projects` lists the projects you may work and whether support is on for each.\n2. Work the projects the person or the prompt names; otherwise every project with support on, one at a time.\n3. For each project, run `fgrove support workflow --project <id>`, read the WORKFLOW.md it names in full, and follow it for that project's tickets only.\n4. Finish one project before loading the next. Never apply one project's workflow to another project's ticket.\n\nUnassigned Tickets have no project and so no workflow. Work them only when the person or the prompt asks: `fgrove support queue --take 5` without `--project`. A ticket that has a project: load its workflow first (step 3). An Unassigned one: assign it only when its Support Address alias or the product it names points to exactly one of your projects, and `fgrove support billing --project <id> --email <customer> --json` finds the customer there. Then run `fgrove support assign-project TCK-N --project <id>` and follow that project's workflow. Otherwise escalate it with the note \"Project unclear:\" and the candidates and evidence. Never reply to an Unassigned Ticket.\n\nTalk to the person in their language. Files under `fgrove-support/` are replaced on every load: don't edit them. A project's Support Workflow changes through `fgrove support workflow-pull` and `workflow-push`, which the project's organization owners and admins and Super Admins run; when a ticket shows the workflow should change, say so in your summary.\n";
95
+ /** The prompt of a Support Routine's scheduled task. */
96
+ export declare const SUPPORT_ROUTINE_PROMPT = "Support Routine run. Work the support queue of every project in my Support Access that has support on, following each project's Support Workflow. Nobody is present to answer questions.";
97
+ /** Writes the support folder's CLAUDE.md; an existing one stays unless `force`. Returns its path. */
98
+ export declare const initSupportFolder: (dir: string, force?: boolean) => Promise<string>;
99
+ export type SupportWorkflowIssue = {
100
+ path: string | null;
101
+ message: string;
102
+ };
103
+ /** The project's Support settings as organization owners and admins see them; the CLI uses the workflow part. */
104
+ export type SupportWorkflowEditView = {
105
+ workflow: {
106
+ templateVersion: string;
107
+ projectVersion: number | null;
108
+ templateFiles: Array<{
109
+ path: string;
110
+ content: string;
111
+ locked: boolean;
112
+ }>;
113
+ projectFiles: Array<{
114
+ path: string;
115
+ content: string;
116
+ }>;
117
+ warnings: SupportWorkflowIssue[];
118
+ fillIns: Array<{
119
+ path: string;
120
+ key: string;
121
+ hint: string | null;
122
+ }>;
123
+ };
124
+ versions: Array<{
125
+ version: number;
126
+ editedBy: string;
127
+ editedAt: string;
128
+ }>;
129
+ };
130
+ /** What `workflow-pull` records so `workflow-push` saves to the same project on top of the same version. */
131
+ type SupportWorkflowEditState = {
132
+ projectId: string;
133
+ basedOnVersion: number | null;
134
+ };
135
+ export declare const getSupportWorkflowEditView: (scope: SupportScope, projectId: string) => Promise<SupportWorkflowEditView>;
136
+ export declare const getSupportWorkflowVersionFiles: (scope: SupportScope, projectId: string, version: number) => Promise<{
137
+ path: string;
138
+ content: string;
139
+ }[]>;
140
+ export declare const saveSupportWorkflowFiles: (scope: SupportScope, projectId: string, files: Array<{
141
+ path: string;
142
+ content: string;
143
+ }>, basedOnVersion: number | null) => Promise<{
144
+ version: number | null;
145
+ errors: SupportWorkflowIssue[];
146
+ }>;
147
+ /** The edit folder's CLAUDE.md: how Claude Code changes a project's Support Workflow. Shipped with the CLI. */
148
+ export declare const SUPPORT_WORKFLOW_EDIT_INSTRUCTIONS = "# Editing a FunnelsGrove Support Workflow\n\nThis folder holds one project's Support Workflow for editing. Support Agents' Claude Code sessions follow it on every ticket of this project, so a change here changes how real customers are answered and refunded.\n\n- `project/`: the project's own files. Edit, add and delete files here; this is what `workflow-push` sends.\n- `template/`: the FunnelsGrove template, for reference only: a push never sends it. The agent reads the template with `project/` laid over it.\n- `.fgrove-workflow.json`: the project and the version this edit started from. Leave it as it is; the commands below use its `projectId`.\n\n## Steps\n\n1. Read `template/WORKFLOW.md` in full: it is the entry point and its map says which file covers what. Product facts, refund policy, settings and voice live in `project.md`; other topics live in the file the map names. Read every file the change touches, in `project/` if it exists there, otherwise in `template/`.\n2. Make the change in `project/`:\n - To change a template file, copy it from `template/` to the same path in `project/` and edit the copy. The copy replaces the whole file.\n - To add a topic, add a new file in `project/` and link it with a relative Markdown link from a file the agent already reads, such as `project.md` (copied from the template first).\n - Fill a `{{KEY: hint}}` by replacing the whole placeholder with the fact. Leave a placeholder only for a fact nobody gave you: the agent treats it as unknown and escalates tickets that need it.\n3. From this folder, run `fgrove support workflow-push --dir .`. It saves a new version only when the files pass FunnelsGrove's checks; otherwise it lists each problem by file and saves nothing. Fix and push again until it prints `Saved version N`.\n4. Tell the person what changed, the version number, and the warnings and placeholders the push printed.\n\n## Rules the checks enforce\n\n- `WORKFLOW.md` and `untrusted-content.md` hold the rules every project shares and stay as the template has them. Every other template file can be replaced.\n- A template file can't be removed. To retire one, replace it with a short file that says what applies instead.\n- Plain Markdown: `.md` files, UTF-8, with no front matter, raw HTML, or lines starting with `@` or with `!` followed by a backtick.\n- Paths: folders as deep as needed, at most 200 characters in all. Each name has up to 64 ASCII letters, digits, `.`, `_` and `-`, starts with a letter or digit, and only file names end in `.md`. A path that replaces a template file matches it letter for letter.\n- Reserved names, in any letter case: `PERSONAL.md` at the root, and `CLAUDE.md`, `CLAUDE.local.md`, `AGENTS.md` and `SKILL.md` anywhere. Dot-files and dot-folders in `project/` are never sent.\n- Links are relative and stay inside the workflow; each one points to a file that exists in it, or to `PERSONAL.md`.\n- Size: 16 KB per file; 60 files and 256 KB for the whole workflow, template files included.\n\nThe push also warns, without blocking, about a file no link reaches from `WORKFLOW.md` (Claude never reads it; files under `checks/` are read only when someone asks to check the workflow), a file over 200 lines, and a command that downloads or runs code: a workflow names `fgrove support` commands and the project's own tools from `project.md` only.\n\n## When the push says someone saved a newer version\n\nSomeone saved while you were editing; nothing of yours was saved. Pull the latest into a new folder (`fgrove support workflow-pull --project <projectId> --dir <new folder>`), carry your change over, and push from there.\n\n## History and restoring\n\n`fgrove support workflow-history --project <projectId>` lists the saved versions. To restore one, pull it with `--from-version N` into a new folder and push it: it is saved as the newest version.\n";
149
+ /**
150
+ * Writes the project's editable files, the template for reference and the edit instructions into a
151
+ * new folder. An existing folder stays untouched unless `force`, so unpushed edits are never lost.
152
+ */
153
+ export declare const pullSupportWorkflowForEditing: (dir: string, input: {
154
+ projectId: string;
155
+ view: SupportWorkflowEditView;
156
+ files?: Array<{
157
+ path: string;
158
+ content: string;
159
+ }>;
160
+ force?: boolean;
161
+ }) => Promise<string>;
162
+ /** The edit state and every plain file under `project/`, with `/` paths as the server expects; dot entries stay local. */
163
+ export declare const readSupportWorkflowEdit: (dir: string) => Promise<{
164
+ state: SupportWorkflowEditState;
165
+ files: {
166
+ path: string;
167
+ content: string;
168
+ }[];
169
+ }>;
170
+ /** Records the saved version as the base of the next push from the same folder. */
171
+ export declare const recordSupportWorkflowPush: (dir: string, version: number) => Promise<void>;
172
+ export declare const formatSupportWorkflowPulled: (dir: string, view: SupportWorkflowEditView, pulledVersion: number | null) => string[];
173
+ /** The push result; `basedOnVersion` tells a new version from a push that changed nothing. */
174
+ export declare const formatSupportWorkflowPushed: (result: {
175
+ version: number | null;
176
+ errors: SupportWorkflowIssue[];
177
+ }, basedOnVersion: number | null, view?: SupportWorkflowEditView) => string[];
178
+ export declare const formatSupportWorkflowHistory: (view: SupportWorkflowEditView) => string[];
179
+ export type SupportBillingTarget = {
180
+ ticket: number;
181
+ } | {
182
+ projectId: string;
183
+ email: string;
184
+ };
185
+ /** `--ticket TCK-42`, or `--project` with `--email`; the server checks access and that support is on. */
186
+ export declare const parseBillingTarget: (options: {
187
+ ticket?: string;
188
+ project?: string;
189
+ email?: string;
190
+ }, loadProjects: () => Promise<SupportProject[]>) => Promise<SupportBillingTarget>;
191
+ export declare const lookupSupportBilling: <T>(scope: SupportScope, target: SupportBillingTarget) => Promise<T>;
192
+ export declare const refundSupportPayments: <T>(scope: SupportScope, target: SupportBillingTarget, paymentIds: string[]) => Promise<T>;
193
+ export declare const cancelSupportSubscription: <T>(scope: SupportScope, target: SupportBillingTarget, input: {
194
+ subscriptionId?: string;
195
+ now?: boolean;
196
+ }) => Promise<T>;
197
+ export {};
@@ -0,0 +1,306 @@
1
+ import { randomUUID } from 'node:crypto';
2
+ import { mkdir, readdir, readFile, rename, rm, stat, writeFile } from 'node:fs/promises';
3
+ import path from 'node:path';
4
+ export const SUPPORT_WORKFLOW_ENTRY = 'WORKFLOW.md';
5
+ const SUPPORT_WORKFLOW_PERSONAL = 'PERSONAL.md';
6
+ /** Accepts `TCK-42` or `42`. */
7
+ export const parseTicketNumber = (value) => {
8
+ const match = value.trim().match(/^(?:TCK-)?(\d+)$/i);
9
+ const number = match ? Number(match[1]) : NaN;
10
+ if (!Number.isSafeInteger(number) || number <= 0)
11
+ throw new Error(`"${value}" is not a ticket number. Use TCK-42 or 42.`);
12
+ return number;
13
+ };
14
+ /** Finds one of the person's support projects by ID or by name (case-insensitive). */
15
+ export const resolveSupportProject = (projects, value) => {
16
+ const needle = value.trim().toLowerCase();
17
+ const byId = projects.find((project) => project.id === value.trim());
18
+ if (byId)
19
+ return byId;
20
+ const byName = projects.filter((project) => project.name.toLowerCase() === needle);
21
+ if (byName.length === 1)
22
+ return byName[0];
23
+ if (byName.length > 1) {
24
+ throw new Error(`Several projects are named "${value}": ${byName.map((project) => `${project.id} (${project.workspaceName})`).join(', ')}. Pass the project ID.`);
25
+ }
26
+ throw new Error(`No support project "${value}". Run \`fgrove support projects\` to see yours.`);
27
+ };
28
+ const query = (scope, path, data) => scope.callApi({ path, type: 'query', token: scope.token, data });
29
+ const mutate = (scope, path, data) => scope.callApi({ path, type: 'mutation', token: scope.token, data });
30
+ export const listSupportProjects = async (scope) => (await query(scope, 'support.myProjects')).projects;
31
+ export const getSupportWorkflow = (scope, projectId) => query(scope, 'support.workflow', { projectId });
32
+ export const setSupportInstructions = (scope, content) => mutate(scope, 'support.setInstructions', { content });
33
+ export const openSupportTicket = (scope, number) => query(scope, 'support.ticket', { number });
34
+ export const listCustomerTickets = async (scope, email) => ((await query(scope, 'support.customer', { email: email.trim().toLowerCase() })).tickets);
35
+ export const takeSupportQueue = async (scope, input) => ((await mutate(scope, 'support.queue', input)).tickets);
36
+ export const replyToSupportTicket = (scope, number, body) => mutate(scope, 'support.reply', { number, body });
37
+ export const escalateSupportTicket = (scope, number, note) => mutate(scope, 'support.escalate', { number, note });
38
+ export const closeSupportTicket = (scope, number, note) => mutate(scope, 'support.close', { number, ...(note ? { note } : {}) });
39
+ export const assignSupportTicketProject = (scope, number, projectId) => (mutate(scope, 'support.assignProject', { number, projectId }));
40
+ const STATUS_LABELS = {
41
+ new: 'new',
42
+ in_progress: 'in progress',
43
+ needs_person: 'needs person',
44
+ waiting_for_customer: 'waiting for customer',
45
+ closed: 'closed',
46
+ };
47
+ export const formatSupportProjects = (projects) => (projects.length
48
+ ? projects.map((project) => `${project.name}\t${project.workspaceName}\t${project.supportEnabled ? 'support on' : 'support off'}\t${project.id}`)
49
+ : ['No support projects. Ask a super admin for Support Access.']);
50
+ export const formatTicketLine = (ticket) => (`${ticket.id}\t${STATUS_LABELS[ticket.status]}\t${ticket.projectName ?? 'Unassigned'}\t${ticket.customerEmail}\t${ticket.subject}`);
51
+ export const formatTicketDetail = ({ ticket, customerTickets }) => [
52
+ `${ticket.id} · ${STATUS_LABELS[ticket.status]} · ${ticket.projectName ?? 'Unassigned'}`,
53
+ `Subject: ${ticket.subject}`,
54
+ `Customer: ${ticket.customerEmail}`,
55
+ `Support address: ${ticket.supportAddress}`,
56
+ '',
57
+ ...ticket.entries.flatMap((entry) => (entry.kind === 'message'
58
+ ? [
59
+ `--- ${entry.direction === 'inbound' ? `From ${entry.author}` : `Reply by ${entry.author}`} · ${entry.at}${entry.deliveryStatus === 'pending' ? ' · not sent yet' : entry.deliveryStatus === 'failed' ? ' · sending failed' : ''}`,
60
+ entry.body,
61
+ '',
62
+ ]
63
+ : [`[${entry.needsAttention ? 'attention' : 'action'}] ${entry.actor} · ${entry.at}: ${entry.text}${entry.statusFrom && entry.statusTo ? ` (status ${STATUS_LABELS[entry.statusFrom]} → ${STATUS_LABELS[entry.statusTo]})` : ''}`, ''])),
64
+ customerTickets.length ? 'Other tickets from this customer:' : 'This is the customer’s only ticket.',
65
+ ...customerTickets.map((other) => ` ${formatTicketLine(other)}`),
66
+ ];
67
+ const WORKFLOW_SEGMENT = /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/;
68
+ const REJECTED_WORKFLOW_NAMES = ['claude.md', 'claude.local.md', 'agents.md', 'skill.md'];
69
+ /** The CLI writes only plain Markdown inside the folder, whatever the server sends: the same path rules the server checks. */
70
+ const assertSafeWorkflowPath = (filePath) => {
71
+ const segments = filePath.split('/');
72
+ if (filePath.length > 200
73
+ || segments.some((segment) => !WORKFLOW_SEGMENT.test(segment) || REJECTED_WORKFLOW_NAMES.includes(segment.toLowerCase()))
74
+ || !segments.at(-1).endsWith('.md')
75
+ || segments.slice(0, -1).some((segment) => segment.toLowerCase().endsWith('.md'))
76
+ || filePath.toLowerCase() === SUPPORT_WORKFLOW_PERSONAL.toLowerCase()) {
77
+ throw new Error(`Refusing to write workflow file "${filePath}".`);
78
+ }
79
+ };
80
+ /**
81
+ * Writes `files` into a sibling folder, then swaps it in for `target` in one rename, so a reader never
82
+ * sees half a tree and files dropped from a newer version disappear. A failed swap restores the old folder.
83
+ */
84
+ const replaceFolder = async (target, files) => {
85
+ const staging = `${target}.tmp-${randomUUID()}`;
86
+ const previous = `${target}.old-${randomUUID()}`;
87
+ let moved = false;
88
+ try {
89
+ await mkdir(staging, { recursive: true });
90
+ for (const file of files) {
91
+ const destination = path.join(staging, ...file.path.split('/'));
92
+ await mkdir(path.dirname(destination), { recursive: true });
93
+ await writeFile(destination, file.content, { mode: 0o644 });
94
+ }
95
+ await mkdir(path.dirname(target), { recursive: true });
96
+ moved = await rename(target, previous).then(() => true, (error) => {
97
+ if (error.code !== 'ENOENT')
98
+ throw error;
99
+ return false;
100
+ });
101
+ await rename(staging, target).catch(async (error) => {
102
+ if (moved)
103
+ await rename(previous, target);
104
+ moved = false;
105
+ throw error;
106
+ });
107
+ }
108
+ finally {
109
+ await rm(staging, { recursive: true, force: true });
110
+ if (moved)
111
+ await rm(previous, { recursive: true, force: true });
112
+ }
113
+ };
114
+ /** Replaces `dir` with the workflow's files and PERSONAL.md. Returns the entry file's path. */
115
+ export const writeSupportWorkflow = async (dir, workflow) => {
116
+ workflow.files.forEach((file) => assertSafeWorkflowPath(file.path));
117
+ const target = path.resolve(dir);
118
+ await replaceFolder(target, [...workflow.files, { path: SUPPORT_WORKFLOW_PERSONAL, content: workflow.personalInstructions.trim() || '(none)\n' }]);
119
+ return path.join(target, SUPPORT_WORKFLOW_ENTRY);
120
+ };
121
+ export const formatSupportWorkflowLoaded = (project, workflow, entryPath) => [
122
+ `Support Workflow for ${project.name} (project ${project.id}): template ${workflow.templateVersion}`
123
+ + `${workflow.projectVersion ? ` + project v${workflow.projectVersion}` : ', no project files yet'}. `
124
+ + (workflow.supportEnabled ? 'Support is on.' : 'Support is off: every reply and action for this project will fail.'),
125
+ `Read ${entryPath} in full and follow it for this project's tickets.`,
126
+ ];
127
+ /** The support folder's CLAUDE.md: the same for every agent, reviewed with the CLI, never edited per project. */
128
+ export const SUPPORT_FOLDER_INSTRUCTIONS = `# FunnelsGrove support folder
129
+
130
+ This folder is for working FunnelsGrove Support Tickets with the \`fgrove support\` CLI. Each project has its own Support Workflow, which \`fgrove\` writes to \`fgrove-support/<project-id>/\`.
131
+
132
+ When the person asks to work, check or decide support tickets, in any wording or language, or a task prompt starts with \`Support Routine run\`:
133
+
134
+ 1. \`fgrove support projects\` lists the projects you may work and whether support is on for each.
135
+ 2. Work the projects the person or the prompt names; otherwise every project with support on, one at a time.
136
+ 3. For each project, run \`fgrove support workflow --project <id>\`, read the WORKFLOW.md it names in full, and follow it for that project's tickets only.
137
+ 4. Finish one project before loading the next. Never apply one project's workflow to another project's ticket.
138
+
139
+ Unassigned Tickets have no project and so no workflow. Work them only when the person or the prompt asks: \`fgrove support queue --take 5\` without \`--project\`. A ticket that has a project: load its workflow first (step 3). An Unassigned one: assign it only when its Support Address alias or the product it names points to exactly one of your projects, and \`fgrove support billing --project <id> --email <customer> --json\` finds the customer there. Then run \`fgrove support assign-project TCK-N --project <id>\` and follow that project's workflow. Otherwise escalate it with the note "Project unclear:" and the candidates and evidence. Never reply to an Unassigned Ticket.
140
+
141
+ Talk to the person in their language. Files under \`fgrove-support/\` are replaced on every load: don't edit them. A project's Support Workflow changes through \`fgrove support workflow-pull\` and \`workflow-push\`, which the project's organization owners and admins and Super Admins run; when a ticket shows the workflow should change, say so in your summary.
142
+ `;
143
+ /** The prompt of a Support Routine's scheduled task. */
144
+ export const SUPPORT_ROUTINE_PROMPT = "Support Routine run. Work the support queue of every project in my Support Access that has support on, following each project's Support Workflow. Nobody is present to answer questions.";
145
+ /** Writes the support folder's CLAUDE.md; an existing one stays unless `force`. Returns its path. */
146
+ export const initSupportFolder = async (dir, force = false) => {
147
+ const target = path.join(path.resolve(dir), 'CLAUDE.md');
148
+ await mkdir(path.dirname(target), { recursive: true });
149
+ await writeFile(target, SUPPORT_FOLDER_INSTRUCTIONS, { flag: force ? 'w' : 'wx', mode: 0o644 }).catch((error) => {
150
+ if (error.code === 'EEXIST')
151
+ throw new Error(`${target} already exists. Pass --force to replace it.`);
152
+ throw error;
153
+ });
154
+ return target;
155
+ };
156
+ const EDIT_STATE_FILE = '.fgrove-workflow.json';
157
+ const EDIT_PROJECT_DIR = 'project';
158
+ const EDIT_TEMPLATE_DIR = 'template';
159
+ // The server's limits on one save, checked here so a too-large folder gets a readable error.
160
+ const EDIT_MAX_FILES = 60;
161
+ const EDIT_MAX_FILE_CHARS = 40000;
162
+ export const getSupportWorkflowEditView = (scope, projectId) => (query(scope, 'support.projectSettings', { projectId }));
163
+ export const getSupportWorkflowVersionFiles = async (scope, projectId, version) => ((await query(scope, 'support.workflowVersion', { projectId, version })).files);
164
+ export const saveSupportWorkflowFiles = (scope, projectId, files, basedOnVersion) => mutate(scope, 'support.saveWorkflow', { projectId, files, basedOnVersion });
165
+ /** The edit folder's CLAUDE.md: how Claude Code changes a project's Support Workflow. Shipped with the CLI. */
166
+ export const SUPPORT_WORKFLOW_EDIT_INSTRUCTIONS = `# Editing a FunnelsGrove Support Workflow
167
+
168
+ This folder holds one project's Support Workflow for editing. Support Agents' Claude Code sessions follow it on every ticket of this project, so a change here changes how real customers are answered and refunded.
169
+
170
+ - \`project/\`: the project's own files. Edit, add and delete files here; this is what \`workflow-push\` sends.
171
+ - \`template/\`: the FunnelsGrove template, for reference only: a push never sends it. The agent reads the template with \`project/\` laid over it.
172
+ - \`${EDIT_STATE_FILE}\`: the project and the version this edit started from. Leave it as it is; the commands below use its \`projectId\`.
173
+
174
+ ## Steps
175
+
176
+ 1. Read \`template/WORKFLOW.md\` in full: it is the entry point and its map says which file covers what. Product facts, refund policy, settings and voice live in \`project.md\`; other topics live in the file the map names. Read every file the change touches, in \`project/\` if it exists there, otherwise in \`template/\`.
177
+ 2. Make the change in \`project/\`:
178
+ - To change a template file, copy it from \`template/\` to the same path in \`project/\` and edit the copy. The copy replaces the whole file.
179
+ - To add a topic, add a new file in \`project/\` and link it with a relative Markdown link from a file the agent already reads, such as \`project.md\` (copied from the template first).
180
+ - Fill a \`{{KEY: hint}}\` by replacing the whole placeholder with the fact. Leave a placeholder only for a fact nobody gave you: the agent treats it as unknown and escalates tickets that need it.
181
+ 3. From this folder, run \`fgrove support workflow-push --dir .\`. It saves a new version only when the files pass FunnelsGrove's checks; otherwise it lists each problem by file and saves nothing. Fix and push again until it prints \`Saved version N\`.
182
+ 4. Tell the person what changed, the version number, and the warnings and placeholders the push printed.
183
+
184
+ ## Rules the checks enforce
185
+
186
+ - \`WORKFLOW.md\` and \`untrusted-content.md\` hold the rules every project shares and stay as the template has them. Every other template file can be replaced.
187
+ - A template file can't be removed. To retire one, replace it with a short file that says what applies instead.
188
+ - Plain Markdown: \`.md\` files, UTF-8, with no front matter, raw HTML, or lines starting with \`@\` or with \`!\` followed by a backtick.
189
+ - Paths: folders as deep as needed, at most 200 characters in all. Each name has up to 64 ASCII letters, digits, \`.\`, \`_\` and \`-\`, starts with a letter or digit, and only file names end in \`.md\`. A path that replaces a template file matches it letter for letter.
190
+ - Reserved names, in any letter case: \`PERSONAL.md\` at the root, and \`CLAUDE.md\`, \`CLAUDE.local.md\`, \`AGENTS.md\` and \`SKILL.md\` anywhere. Dot-files and dot-folders in \`project/\` are never sent.
191
+ - Links are relative and stay inside the workflow; each one points to a file that exists in it, or to \`PERSONAL.md\`.
192
+ - Size: 16 KB per file; 60 files and 256 KB for the whole workflow, template files included.
193
+
194
+ The push also warns, without blocking, about a file no link reaches from \`WORKFLOW.md\` (Claude never reads it; files under \`checks/\` are read only when someone asks to check the workflow), a file over 200 lines, and a command that downloads or runs code: a workflow names \`fgrove support\` commands and the project's own tools from \`project.md\` only.
195
+
196
+ ## When the push says someone saved a newer version
197
+
198
+ Someone saved while you were editing; nothing of yours was saved. Pull the latest into a new folder (\`fgrove support workflow-pull --project <projectId> --dir <new folder>\`), carry your change over, and push from there.
199
+
200
+ ## History and restoring
201
+
202
+ \`fgrove support workflow-history --project <projectId>\` lists the saved versions. To restore one, pull it with \`--from-version N\` into a new folder and push it: it is saved as the newest version.
203
+ `;
204
+ /**
205
+ * Writes the project's editable files, the template for reference and the edit instructions into a
206
+ * new folder. An existing folder stays untouched unless `force`, so unpushed edits are never lost.
207
+ */
208
+ export const pullSupportWorkflowForEditing = async (dir, input) => {
209
+ const target = path.resolve(dir);
210
+ const exists = await stat(target).then(() => true, (error) => {
211
+ if (error.code === 'ENOENT')
212
+ return false;
213
+ throw error;
214
+ });
215
+ if (exists && !input.force) {
216
+ throw new Error(`${target} already exists. Push or move the edits in it first, or pass --force to replace it.`);
217
+ }
218
+ const projectFiles = input.files ?? input.view.workflow.projectFiles;
219
+ [...projectFiles, ...input.view.workflow.templateFiles].forEach((file) => assertSafeWorkflowPath(file.path));
220
+ const state = { projectId: input.projectId, basedOnVersion: input.view.workflow.projectVersion };
221
+ await replaceFolder(target, [
222
+ ...projectFiles.map((file) => ({ ...file, path: `${EDIT_PROJECT_DIR}/${file.path}` })),
223
+ ...input.view.workflow.templateFiles.map((file) => ({ path: `${EDIT_TEMPLATE_DIR}/${file.path}`, content: file.content })),
224
+ { path: 'CLAUDE.md', content: SUPPORT_WORKFLOW_EDIT_INSTRUCTIONS },
225
+ { path: EDIT_STATE_FILE, content: `${JSON.stringify(state, null, 2)}\n` },
226
+ ]);
227
+ await mkdir(path.join(target, EDIT_PROJECT_DIR), { recursive: true });
228
+ return target;
229
+ };
230
+ /** The edit state and every plain file under `project/`, with `/` paths as the server expects; dot entries stay local. */
231
+ export const readSupportWorkflowEdit = async (dir) => {
232
+ const root = path.resolve(dir);
233
+ const state = JSON.parse(await readFile(path.join(root, EDIT_STATE_FILE), 'utf8').catch((error) => {
234
+ if (error.code === 'ENOENT')
235
+ throw new Error(`${root} is not a workflow edit folder. Run \`fgrove support workflow-pull\` first.`);
236
+ throw error;
237
+ }));
238
+ const files = [];
239
+ const walk = async (relative) => {
240
+ for (const entry of await readdir(path.join(root, EDIT_PROJECT_DIR, relative), { withFileTypes: true })) {
241
+ if (entry.name.startsWith('.'))
242
+ continue;
243
+ const child = relative ? `${relative}/${entry.name}` : entry.name;
244
+ if (entry.isDirectory())
245
+ await walk(child);
246
+ else if (entry.isFile())
247
+ files.push({ path: child, content: await readFile(path.join(root, EDIT_PROJECT_DIR, ...child.split('/')), 'utf8') });
248
+ else
249
+ throw new Error(`project/${child} is not a plain file. Workflow files are plain Markdown files; replace links and other entries with copies.`);
250
+ }
251
+ };
252
+ await walk('');
253
+ if (files.length > EDIT_MAX_FILES)
254
+ throw new Error(`project/ holds ${files.length} files; a workflow has at most ${EDIT_MAX_FILES}.`);
255
+ const large = files.find((file) => file.content.length > EDIT_MAX_FILE_CHARS);
256
+ if (large)
257
+ throw new Error(`project/${large.path} is too large; a workflow file is at most 16 KB.`);
258
+ return { state, files: files.sort((a, b) => a.path.localeCompare(b.path)) };
259
+ };
260
+ /** Records the saved version as the base of the next push from the same folder. */
261
+ export const recordSupportWorkflowPush = async (dir, version) => {
262
+ const file = path.join(path.resolve(dir), EDIT_STATE_FILE);
263
+ const state = JSON.parse(await readFile(file, 'utf8'));
264
+ await writeFile(file, `${JSON.stringify({ ...state, basedOnVersion: version }, null, 2)}\n`);
265
+ };
266
+ const issueLine = (issue) => `- ${issue.path ?? 'workflow'}: ${issue.message}`;
267
+ export const formatSupportWorkflowPulled = (dir, view, pulledVersion) => [
268
+ `Pulled ${pulledVersion ? `project version ${pulledVersion}` : 'no project files yet'} over template ${view.workflow.templateVersion} into ${dir}.`,
269
+ `Read ${path.join(dir, 'CLAUDE.md')} before editing; edit files in ${path.join(dir, EDIT_PROJECT_DIR)}, then run \`fgrove support workflow-push --dir ${dir}\`.`,
270
+ ];
271
+ /** The push result; `basedOnVersion` tells a new version from a push that changed nothing. */
272
+ export const formatSupportWorkflowPushed = (result, basedOnVersion, view) => {
273
+ if (result.version === null) {
274
+ return ['Nothing saved. Fix these and push again:', ...result.errors.map(issueLine)];
275
+ }
276
+ const fillIns = new Map();
277
+ for (const fill of view?.workflow.fillIns ?? [])
278
+ fillIns.set(fill.path, [...(fillIns.get(fill.path) ?? []), fill.key]);
279
+ const warnings = view?.workflow.warnings ?? [];
280
+ return [
281
+ result.version === basedOnVersion ? `No changes: version ${result.version} stays current.` : `Saved version ${result.version}.`,
282
+ ...(warnings.length ? ['Warnings:', ...warnings.map(issueLine)] : []),
283
+ ...(fillIns.size ? ['Placeholders still open (the agent treats these facts as unknown):', ...[...fillIns].map(([file, keys]) => `- ${file}: ${keys.join(', ')}`)] : []),
284
+ ];
285
+ };
286
+ export const formatSupportWorkflowHistory = (view) => (view.versions.length
287
+ ? view.versions.map((version) => `v${version.version}\t${version.editedAt}\t${version.editedBy}${version.version === view.workflow.projectVersion ? '\tcurrent' : ''}`)
288
+ : [`No project files saved yet: the project uses template ${view.workflow.templateVersion} as it is.`]);
289
+ /** `--ticket TCK-42`, or `--project` with `--email`; the server checks access and that support is on. */
290
+ export const parseBillingTarget = async (options, loadProjects) => {
291
+ if (options.ticket) {
292
+ if (options.project || options.email)
293
+ throw new Error('Pass --ticket, or --project with --email, not both.');
294
+ return { ticket: parseTicketNumber(options.ticket) };
295
+ }
296
+ if (!options.project || !options.email)
297
+ throw new Error('Pass --ticket TCK-42, or --project with --email.');
298
+ return { projectId: resolveSupportProject(await loadProjects(), options.project).id, email: options.email.trim().toLowerCase() };
299
+ };
300
+ export const lookupSupportBilling = (scope, target) => query(scope, 'support.billing', target);
301
+ export const refundSupportPayments = (scope, target, paymentIds) => (mutate(scope, 'support.refund', { ...target, paymentIds }));
302
+ export const cancelSupportSubscription = (scope, target, input) => (mutate(scope, 'support.cancel', {
303
+ ...target,
304
+ ...(input.subscriptionId ? { subscriptionId: input.subscriptionId } : {}),
305
+ mode: input.now ? 'immediate' : 'period_end',
306
+ }));
@@ -4,10 +4,10 @@
4
4
  "minimumCliVersion": "0.1.20",
5
5
  "entries": [
6
6
  {
7
- "repositoryCliVersion": "0.1.332",
7
+ "repositoryCliVersion": "0.1.335",
8
8
  "manifest": {
9
9
  "schemaVersion": 1,
10
- "bundleVersion": "2.0.325",
10
+ "bundleVersion": "2.0.328",
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": "25501d23626a603c4311821098d304215259aec8838d63d6da24605457a756e6"
48
+ "sha256": "25554d39400ca431ef34bfd28df81537c14f054388d45cd35688ace6629753cb"
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": "c64d15291255c5f574d4874d27dfdf3cf3f635688dff641ea3713106fe37aaf4"
148
+ "sha256": "367524a24085c1ab367401a9ce2cefe9cbe66a6d663c633c5dec439d53b780f4"
149
149
  }
150
150
  ]
151
151
  }
152
152
  },
153
153
  {
154
- "repositoryCliVersion": "0.1.331",
154
+ "repositoryCliVersion": "0.1.333",
155
155
  "manifest": {
156
156
  "schemaVersion": 1,
157
- "bundleVersion": "2.0.324",
157
+ "bundleVersion": "2.0.326",
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": "301cf088be042bccf7384efda6ac3e0ded320411116f97870e880968ec3ef1a6"
195
+ "sha256": "289a2f231f7af2d4fcac7bb34680c3e480dd4046a8d04b70fd9c4bc2e27b2925"
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": "0181f6714d853b9b524da809435968b18262ae2284718b88c6c3343b95d0fbd6"
295
+ "sha256": "9c70fc77cda23c3f2855751149b45022181a8921090959d8a00673f1b64c093d"
296
296
  }
297
297
  ]
298
298
  }
299
299
  },
300
300
  {
301
- "repositoryCliVersion": "0.1.330",
301
+ "repositoryCliVersion": "0.1.332",
302
302
  "manifest": {
303
303
  "schemaVersion": 1,
304
- "bundleVersion": "2.0.323",
304
+ "bundleVersion": "2.0.325",
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": "2e5d50b19342ff77251e9579f79c75408105ce6ab23d6e9394fa21bf2c1a5b60"
342
+ "sha256": "25501d23626a603c4311821098d304215259aec8838d63d6da24605457a756e6"
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": "507aabae6446b0bbce087baf1e506e58d5411336fe3189d60a256f920bec2b9b"
442
+ "sha256": "c64d15291255c5f574d4874d27dfdf3cf3f635688dff641ea3713106fe37aaf4"
443
443
  }
444
444
  ]
445
445
  }
446
446
  },
447
447
  {
448
- "repositoryCliVersion": "0.1.329",
448
+ "repositoryCliVersion": "0.1.331",
449
449
  "manifest": {
450
450
  "schemaVersion": 1,
451
- "bundleVersion": "2.0.322",
451
+ "bundleVersion": "2.0.324",
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": "562b86f8b2f0e64523d6961cc7e948de8079fd087f9f81199b8fb8141e4aae20"
489
+ "sha256": "301cf088be042bccf7384efda6ac3e0ded320411116f97870e880968ec3ef1a6"
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": "79d1d2f25a13c7328e1e273c1ea4a503545962293a6a5edfd45b8748e7d592f2"
589
+ "sha256": "0181f6714d853b9b524da809435968b18262ae2284718b88c6c3343b95d0fbd6"
590
590
  }
591
591
  ]
592
592
  }
593
593
  },
594
594
  {
595
- "repositoryCliVersion": "0.1.328",
595
+ "repositoryCliVersion": "0.1.330",
596
596
  "manifest": {
597
597
  "schemaVersion": 1,
598
- "bundleVersion": "2.0.321",
598
+ "bundleVersion": "2.0.323",
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": "b7f5450a5520349717fa5d601f4d061a11cdb9ac1db2ea0dc10ec6d521689a96"
636
+ "sha256": "2e5d50b19342ff77251e9579f79c75408105ce6ab23d6e9394fa21bf2c1a5b60"
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": "71aa9aaedf4483f7df6df4ad13cde478646710d8da41a6ae0cd85e14885217a6"
736
+ "sha256": "507aabae6446b0bbce087baf1e506e58d5411336fe3189d60a256f920bec2b9b"
737
737
  }
738
738
  ]
739
739
  }
740
740
  },
741
741
  {
742
- "repositoryCliVersion": "0.1.327",
742
+ "repositoryCliVersion": "0.1.329",
743
743
  "manifest": {
744
744
  "schemaVersion": 1,
745
- "bundleVersion": "2.0.320",
745
+ "bundleVersion": "2.0.322",
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": "64f0e149684f5d4a4cf024b38e5c7c77f4acaa34817bed9bb36745ca6b61b5d1"
783
+ "sha256": "562b86f8b2f0e64523d6961cc7e948de8079fd087f9f81199b8fb8141e4aae20"
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": "d47a44ae4d874e59083cee011b0bfcf2dba4713935cece3d7a87b070e6651ba8"
883
+ "sha256": "79d1d2f25a13c7328e1e273c1ea4a503545962293a6a5edfd45b8748e7d592f2"
884
884
  }
885
885
  ]
886
886
  }
887
887
  },
888
888
  {
889
- "repositoryCliVersion": "0.1.326",
889
+ "repositoryCliVersion": "0.1.328",
890
890
  "manifest": {
891
891
  "schemaVersion": 1,
892
- "bundleVersion": "2.0.319",
892
+ "bundleVersion": "2.0.321",
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": "0b7842793fe4ae286fef1fd46f3ed6207ab0ba265607a2f48360a09ffe2ebfa6"
930
+ "sha256": "b7f5450a5520349717fa5d601f4d061a11cdb9ac1db2ea0dc10ec6d521689a96"
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": "67934bae7d434f963b2432017ea7e6c2ea6de3711741b445588934fd39568054"
1030
+ "sha256": "71aa9aaedf4483f7df6df4ad13cde478646710d8da41a6ae0cd85e14885217a6"
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.332",
3
+ "version": "0.1.335",
4
4
  "description": "FunnelsGrove command-line tools for editing, syncing, and publishing funnels",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "bundleVersion": "2.0.325",
3
+ "bundleVersion": "2.0.328",
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": "25501d23626a603c4311821098d304215259aec8838d63d6da24605457a756e6"
41
+ "sha256": "25554d39400ca431ef34bfd28df81537c14f054388d45cd35688ace6629753cb"
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": "c64d15291255c5f574d4874d27dfdf3cf3f635688dff641ea3713106fe37aaf4"
141
+ "sha256": "367524a24085c1ab367401a9ce2cefe9cbe66a6d663c633c5dec439d53b780f4"
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/sdk` `0.4.0` first, then `@funnelsgrove/runtime` `0.43.0`, then `@funnelsgrove/analytics` `0.26.0`, then `@funnelsgrove/payments` `0.66.0`. The production deploy verifies the zero-traffic API candidate, publishes and verifies `@funnelsgrove/cli` `0.1.332`, 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/sdk` `0.4.0` first, then `@funnelsgrove/runtime` `0.43.0`, then `@funnelsgrove/analytics` `0.26.0`, then `@funnelsgrove/payments` `0.67.0`. The production deploy verifies the zero-traffic API candidate, publishes and verifies `@funnelsgrove/cli` `0.1.335`, 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.325",
3
+ "bundleVersion": "2.0.328",
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.325",
3
+ "bundleVersion": "2.0.328",
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": "25501d23626a603c4311821098d304215259aec8838d63d6da24605457a756e6"
41
+ "sha256": "25554d39400ca431ef34bfd28df81537c14f054388d45cd35688ace6629753cb"
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": "c64d15291255c5f574d4874d27dfdf3cf3f635688dff641ea3713106fe37aaf4"
141
+ "sha256": "367524a24085c1ab367401a9ce2cefe9cbe66a6d663c633c5dec439d53b780f4"
142
142
  }
143
143
  ]
144
144
  }
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "sourceTreeHash": "eb91b1cd723e5d76190e0ce239901f203b7bce108d54bac37419ceba256ef45c",
3
+ "sourceTreeHash": "ea25521c19f55819ab90b4f75644379cd3c1062edb7d986c42b327963c895bfc",
4
4
  "stepContractVersion": 3,
5
- "docsBundleVersion": "2.0.325",
5
+ "docsBundleVersion": "2.0.328",
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": "680f3b99ef75cc6e6bbc7abf3b37014f093a7aafc86e87ebc5d55161d5cfb81f",
19
+ "sha256": "48377481405f340adcd622893cfe56a2d56ba040f9de02fb53b5237468d16c3f",
20
20
  "mode": "100644"
21
21
  },
22
22
  {
@@ -76,7 +76,7 @@
76
76
  },
77
77
  {
78
78
  "path": "docs/funnelsgrove/migrations/step-contract-v3.md",
79
- "sha256": "25501d23626a603c4311821098d304215259aec8838d63d6da24605457a756e6",
79
+ "sha256": "25554d39400ca431ef34bfd28df81537c14f054388d45cd35688ace6629753cb",
80
80
  "mode": "100644"
81
81
  },
82
82
  {
@@ -206,7 +206,7 @@
206
206
  },
207
207
  {
208
208
  "path": "funnel-docs.config.json",
209
- "sha256": "c64d15291255c5f574d4874d27dfdf3cf3f635688dff641ea3713106fe37aaf4",
209
+ "sha256": "367524a24085c1ab367401a9ce2cefe9cbe66a6d663c633c5dec439d53b780f4",
210
210
  "mode": "100644"
211
211
  },
212
212
  {
@@ -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/sdk` `0.4.0` first, then `@funnelsgrove/runtime` `0.43.0`, then `@funnelsgrove/analytics` `0.26.0`, then `@funnelsgrove/payments` `0.66.0`. The production deploy verifies the zero-traffic API candidate, publishes and verifies `@funnelsgrove/cli` `0.1.332`, 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/sdk` `0.4.0` first, then `@funnelsgrove/runtime` `0.43.0`, then `@funnelsgrove/analytics` `0.26.0`, then `@funnelsgrove/payments` `0.67.0`. The production deploy verifies the zero-traffic API candidate, publishes and verifies `@funnelsgrove/cli` `0.1.335`, 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.325",
3
+ "bundleVersion": "2.0.328",
4
4
  "contractSource": "funnelsgrove-repository://apps/funnel-runtime/contracts/step-contract-v2.json",
5
5
  "fullyGenerated": [
6
6
  ".funnelsgrove-docs.json",