farseer-cli 1.0.8 → 1.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/dist/commands/app.js +349 -0
  2. package/dist/commands/app.js.map +7 -0
  3. package/dist/commands/apps.js +111 -0
  4. package/dist/commands/apps.js.map +7 -0
  5. package/dist/commands/checkout.js +142 -0
  6. package/dist/commands/checkout.js.map +7 -0
  7. package/dist/commands/config.js +139 -0
  8. package/dist/commands/config.js.map +7 -0
  9. package/dist/commands/diff.js +185 -0
  10. package/dist/commands/diff.js.map +7 -0
  11. package/dist/commands/dimensions.js +145 -0
  12. package/dist/commands/dimensions.js.map +7 -0
  13. package/dist/commands/files.js +99 -0
  14. package/dist/commands/files.js.map +7 -0
  15. package/dist/commands/install.js +79 -0
  16. package/dist/commands/install.js.map +7 -0
  17. package/dist/commands/list.js +92 -0
  18. package/dist/commands/list.js.map +7 -0
  19. package/dist/commands/login.js +134 -0
  20. package/dist/commands/login.js.map +7 -0
  21. package/dist/commands/logout.js +59 -0
  22. package/dist/commands/logout.js.map +7 -0
  23. package/dist/commands/mcp-server.js +41 -0
  24. package/dist/commands/mcp-server.js.map +7 -0
  25. package/dist/commands/model.js +189 -0
  26. package/dist/commands/model.js.map +7 -0
  27. package/dist/commands/pull.js +258 -0
  28. package/dist/commands/pull.js.map +7 -0
  29. package/dist/commands/push.js +213 -0
  30. package/dist/commands/push.js.map +7 -0
  31. package/dist/commands/run.js +288 -0
  32. package/dist/commands/run.js.map +7 -0
  33. package/dist/commands/status.js +155 -0
  34. package/dist/commands/status.js.map +7 -0
  35. package/dist/commands/variables.js +176 -0
  36. package/dist/commands/variables.js.map +7 -0
  37. package/dist/commands/whoami.js +63 -0
  38. package/dist/commands/whoami.js.map +7 -0
  39. package/dist/index.js +165 -0
  40. package/dist/index.js.map +7 -0
  41. package/dist/mcp/index.js +35 -0
  42. package/dist/mcp/index.js.map +7 -0
  43. package/dist/mcp/prompts/workflows.js +448 -0
  44. package/dist/mcp/prompts/workflows.js.map +7 -0
  45. package/dist/mcp/resources/documentation.js +167 -0
  46. package/dist/mcp/resources/documentation.js.map +7 -0
  47. package/dist/mcp/server.js +52 -0
  48. package/dist/mcp/server.js.map +7 -0
  49. package/dist/mcp/tools/appTools.js +377 -0
  50. package/dist/mcp/tools/appTools.js.map +7 -0
  51. package/dist/mcp/tools/authTools.js +159 -0
  52. package/dist/mcp/tools/authTools.js.map +7 -0
  53. package/dist/mcp/tools/dataTools.js +362 -0
  54. package/dist/mcp/tools/dataTools.js.map +7 -0
  55. package/dist/mcp/tools/modelTools.js +325 -0
  56. package/dist/mcp/tools/modelTools.js.map +7 -0
  57. package/dist/mcp/tools/runTools.js +233 -0
  58. package/dist/mcp/tools/runTools.js.map +7 -0
  59. package/dist/mcp/tools/syncTools.js +409 -0
  60. package/dist/mcp/tools/syncTools.js.map +7 -0
  61. package/dist/mcp/utils/helpers.js +135 -0
  62. package/dist/mcp/utils/helpers.js.map +7 -0
  63. package/dist/services/appSyncService.js +399 -0
  64. package/dist/services/appSyncService.js.map +7 -0
  65. package/dist/services/configService.js +196 -0
  66. package/dist/services/configService.js.map +7 -0
  67. package/dist/services/farseerApi.js +426 -0
  68. package/dist/services/farseerApi.js.map +7 -0
  69. package/dist/services/farseerFactory.js +231 -0
  70. package/dist/services/farseerFactory.js.map +7 -0
  71. package/dist/services/farseerService.js +614 -0
  72. package/dist/services/farseerService.js.map +7 -0
  73. package/dist/services/syncService.js +689 -0
  74. package/dist/services/syncService.js.map +7 -0
  75. package/dist/utils/constants.js +46 -0
  76. package/dist/utils/constants.js.map +7 -0
  77. package/dist/utils/helpers.js +413 -0
  78. package/dist/utils/helpers.js.map +7 -0
  79. package/dist/utils/logger.js +76 -0
  80. package/dist/utils/logger.js.map +7 -0
  81. package/package.json +1 -1
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/index.ts"],
4
+ "sourcesContent": ["#!/usr/bin/env node\n\n// Suppress punycode deprecation warning (comes from dependencies like axios)\nconst originalEmit = process.emit;\n// @ts-expect-error - overriding process.emit\nprocess.emit = function (name: string, data: unknown, ...args: unknown[]) {\n if (name === 'warning' && typeof data === 'object' && data !== null && 'name' in data && data.name === 'DeprecationWarning' && 'message' in data && typeof data.message === 'string' && data.message.includes('punycode')) {\n return false;\n }\n // @ts-expect-error - calling original emit\n return originalEmit.apply(process, [name, data, ...args]);\n};\n\nimport { Command } from 'commander';\nimport chalk from 'chalk';\nimport { CLI_VERSION } from './utils/constants';\nimport { registerLoginCommand } from './commands/login';\nimport { registerLogoutCommand } from './commands/logout';\nimport { registerConfigCommand } from './commands/config';\nimport { registerListCommand } from './commands/list';\nimport { registerFilesCommand } from './commands/files';\nimport { registerStatusCommand } from './commands/status';\nimport { registerDiffCommand } from './commands/diff';\nimport { registerPullCommand } from './commands/pull';\nimport { registerPushCommand } from './commands/push';\nimport { registerRunCommand } from './commands/run';\nimport { registerInstallCommand } from './commands/install';\nimport { registerWhoamiCommand } from './commands/whoami';\nimport { registerAppCommand } from './commands/app';\nimport { registerModelCommand } from './commands/model';\nimport { registerVariablesCommand } from './commands/variables';\nimport { registerDimensionsCommand } from './commands/dimensions';\nimport { registerCheckoutCommand } from './commands/checkout';\nimport { registerMcpServerCommand } from './commands/mcp-server';\n\nconst program = new Command();\n\n// Configure help to hide default command list (we show our own custom list)\nprogram.configureHelp({\n visibleCommands: () => [], // Hide all commands from default list\n});\n\nprogram\n .name('farseer')\n .description('CLI tool for syncing Farseer App scripts between local folder and Farseer instances')\n .version(CLI_VERSION)\n .addHelpText('after', `\n${chalk.bold.underline('Tenant Resolution')}\n Most commands accept ${chalk.cyan('[org] [tenant]')} arguments:\n ${chalk.green('$')} farseer checkout ${chalk.cyan('salvus-2 salvus-prodaja')} ${chalk.dim('First time: specify <org> <tenant>')}\n ${chalk.green('$')} farseer pull ${chalk.cyan('salvus-prodaja')} ${chalk.dim('After that: just <tenant> (org is remembered)')}\n ${chalk.green('$')} farseer push ${chalk.dim('Or omit entirely if checked out')}\n\n${chalk.bold.underline('Authentication')}\n login Login via browser (OAuth)\n logout [tenant] Logout and remove credentials\n whoami Show login status and configured tenants\n checkout [org] [tenant] Set default tenant (verifies auth & pulls)\n ${chalk.dim('--no-pull')} Skip automatic pull\n\n${chalk.bold.underline('Configuration')} ${chalk.dim('(farseer config <command>)')}\n config set <tenant> Set API key for a tenant\n ${chalk.dim('--api-key <key>')} API key (required)\n ${chalk.dim('--org <name>')} Organisation if different from tenant\n config remove <tenant> Remove credentials\n config list List all configured tenants\n config show <tenant> Show full credentials (incl. API key)\n config test <tenant> Test connection to tenant\n\n${chalk.bold.underline('Sync Operations')} ${chalk.dim('(tenant optional if checked out)')}\n pull [org] [tenant] Pull files and apps from remote\n ${chalk.dim('--all')} Download all files (not just .ts/.js)\n ${chalk.dim('--force')} Overwrite local changes on conflicts\n push [org] [tenant] Push local changes to remote\n ${chalk.dim('-y, --yes')} Skip confirmation prompt\n ${chalk.dim('--force')} Push even if remote has changes\n status [tenant] Show sync status (local vs remote)\n ${chalk.dim('--all')} Show all files (not just .ts/.js)\n diff [tenant] [file] Show file differences\n\n${chalk.bold.underline('App Management')} ${chalk.dim('(tenant optional if checked out)')}\n app list [tenant] List all apps\n ${chalk.dim('--details')} Show details for each app\n app show [tenant] <name> Show app details\n app create [tenant] <name> Create new app\n app configure [tenant] <name> Configure app\n ${chalk.dim('--entrypoint <script>')} Set main script\n ${chalk.dim('--scripts <list>')} Comma-separated scripts\n ${chalk.dim('--add-arg <Name=Value>')} Add argument (repeatable)\n ${chalk.dim('--description <text>')} Set description\n app delete [tenant] <name> Delete app (requires --force)\n\n${chalk.bold.underline('Running & Development')} ${chalk.dim('(tenant optional if checked out)')}\n run [tenant] <app> Run app locally with injected credentials\n ${chalk.dim('--arg <Name=Value>')} Override argument (repeatable)\n run-script [tenant] <file> Run script directly (no app wrapper)\n install [tenant] Install npm dependencies (npm install)\n\n${chalk.bold.underline('Variables')} ${chalk.dim('(tenant optional if checked out)')}\n variables list [tenant] List all variables\n variable details <name> Show variable details (dimensions, formula, etc.)\n variable export <name> Export variable data to CSV\n ${chalk.dim('--output <file>')} Output file path\n ${chalk.dim('--format <csv|json|xlsx>')} Output format (default: csv)\n ${chalk.dim('--limit <n>')} Limit number of rows\n\n${chalk.bold.underline('Dimensions')} ${chalk.dim('(tenant optional if checked out)')}\n dimensions list [tenant] List all dimension tables\n dimension details <name> Show table details (columns, members)\n ${chalk.dim('--members <n>')} Number of sample members (default: 10)\n\n${chalk.bold.underline('Model Inspection')} ${chalk.dim('(tenant optional if checked out)')}\n model [tenant] Show model structure (dimensions, variables)\n ${chalk.dim('--variables')} List all variables\n ${chalk.dim('--tables')} List all dimension tables\n ${chalk.dim('--variable <name>')} Show dimensions for variable\n\n${chalk.bold.underline('File Management')} ${chalk.dim('(farseer files <command>)')}\n files list [tenant] List files on remote\n ${chalk.dim('--all')} Show all files (not just scripts)\n\n${chalk.bold.underline('MCP Server')} ${chalk.dim('(AI assistant integration)')}\n mcp-server Start MCP server for Claude, Cursor, etc.\n\n${chalk.bold.underline('Examples')}\n ${chalk.green('$')} farseer login ${chalk.dim('Login via browser')}\n ${chalk.green('$')} farseer checkout salvus-2 salvus-prod ${chalk.dim('First time: org + tenant')}\n ${chalk.green('$')} farseer pull salvus-prod ${chalk.dim('Next time: just tenant')}\n ${chalk.green('$')} farseer push ${chalk.dim('If checked out: no args needed')}\n ${chalk.green('$')} farseer push -y ${chalk.dim('Push without confirmation')}\n ${chalk.green('$')} farseer run \"My App\" ${chalk.dim('Run app locally')}\n ${chalk.green('$')} farseer variables list ${chalk.dim('List all variables')}\n ${chalk.green('$')} farseer variable details \"Revenue\" ${chalk.dim('Show variable details')}\n ${chalk.green('$')} farseer dimensions list ${chalk.dim('List dimension tables')}\n`);\n\n// Register all commands (hidden from default help, shown in custom help above)\nregisterLoginCommand(program);\nregisterLogoutCommand(program);\nregisterCheckoutCommand(program);\nregisterConfigCommand(program);\nregisterListCommand(program);\nregisterFilesCommand(program);\nregisterAppCommand(program);\nregisterVariablesCommand(program);\nregisterDimensionsCommand(program);\nregisterModelCommand(program);\nregisterStatusCommand(program);\nregisterDiffCommand(program);\nregisterPullCommand(program);\nregisterPushCommand(program);\nregisterRunCommand(program);\nregisterInstallCommand(program);\nregisterWhoamiCommand(program);\nregisterMcpServerCommand(program);\n\n// Parse arguments\nprogram.parse();\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAaA,uBAAwB;AACxB,mBAAkB;AAClB,uBAA4B;AAC5B,mBAAqC;AACrC,oBAAsC;AACtC,oBAAsC;AACtC,kBAAoC;AACpC,mBAAqC;AACrC,oBAAsC;AACtC,kBAAoC;AACpC,kBAAoC;AACpC,kBAAoC;AACpC,iBAAmC;AACnC,qBAAuC;AACvC,oBAAsC;AACtC,iBAAmC;AACnC,mBAAqC;AACrC,uBAAyC;AACzC,wBAA0C;AAC1C,sBAAwC;AACxC,wBAAyC;AA9BzC,MAAM,eAAe,QAAQ;AAE7B,QAAQ,OAAO,SAAU,MAAc,SAAkB,MAAiB;AACtE,MAAI,SAAS,aAAa,OAAO,SAAS,YAAY,SAAS,QAAQ,UAAU,QAAQ,KAAK,SAAS,wBAAwB,aAAa,QAAQ,OAAO,KAAK,YAAY,YAAY,KAAK,QAAQ,SAAS,UAAU,GAAG;AACvN,WAAO;AAAA,EACX;AAEA,SAAO,aAAa,MAAM,SAAS,CAAC,MAAM,MAAM,GAAG,IAAI,CAAC;AAC5D;AAwBA,MAAM,UAAU,IAAI,yBAAQ;AAG5B,QAAQ,cAAc;AAAA,EAClB,iBAAiB,MAAM,CAAC;AAAA;AAC5B,CAAC;AAED,QACK,KAAK,SAAS,EACd,YAAY,qFAAqF,EACjG,QAAQ,4BAAW,EACnB,YAAY,SAAS;AAAA,EACxB,aAAAA,QAAM,KAAK,UAAU,mBAAmB,CAAC;AAAA,yBAClB,aAAAA,QAAM,KAAK,gBAAgB,CAAC;AAAA,M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C1B,uCAAuB,OAAO;AAAA,IAC9B,qCAAsB,OAAO;AAAA,IAC7B,4CAAyB,OAAO;AAGhC,QAAQ,MAAM;",
6
+ "names": ["chalk"]
7
+ }
@@ -0,0 +1,35 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var mcp_exports = {};
19
+ __export(mcp_exports, {
20
+ startMcpServer: () => startMcpServer
21
+ });
22
+ module.exports = __toCommonJS(mcp_exports);
23
+ var import_server = require("./server");
24
+ var import_stdio = require("@modelcontextprotocol/sdk/server/stdio.js");
25
+ async function startMcpServer() {
26
+ const server = (0, import_server.createMcpServer)();
27
+ const transport = new import_stdio.StdioServerTransport();
28
+ await server.connect(transport);
29
+ console.error("Farseer MCP server started");
30
+ }
31
+ // Annotate the CommonJS export names for ESM import in node:
32
+ 0 && (module.exports = {
33
+ startMcpServer
34
+ });
35
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/mcp/index.ts"],
4
+ "sourcesContent": ["/**\n * MCP Server Entry Point\n *\n * Starts the Farseer MCP server for AI assistant integration.\n * Uses stdio transport for CLI compatibility.\n */\n\nimport { createMcpServer } from './server';\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\n\nexport async function startMcpServer(): Promise<void> {\n const server = createMcpServer();\n\n // Use stdio transport for CLI integration\n const transport = new StdioServerTransport();\n await server.connect(transport);\n\n // Log to stderr since stdout is reserved for MCP protocol\n console.error('Farseer MCP server started');\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,oBAAgC;AAChC,mBAAqC;AAErC,eAAsB,iBAAgC;AAClD,QAAM,aAAS,+BAAgB;AAG/B,QAAM,YAAY,IAAI,kCAAqB;AAC3C,QAAM,OAAO,QAAQ,SAAS;AAG9B,UAAQ,MAAM,4BAA4B;AAC9C;",
6
+ "names": []
7
+ }
@@ -0,0 +1,448 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var workflows_exports = {};
19
+ __export(workflows_exports, {
20
+ registerWorkflowPrompts: () => registerWorkflowPrompts
21
+ });
22
+ module.exports = __toCommonJS(workflows_exports);
23
+ var import_zod = require("zod");
24
+ const setupTenantSchema = {
25
+ tenant: import_zod.z.string().describe("Tenant name to setup")
26
+ };
27
+ const createAppSchema = {
28
+ tenant: import_zod.z.string().describe("Tenant name"),
29
+ appName: import_zod.z.string().describe("Name for the new app"),
30
+ scriptName: import_zod.z.string().optional().describe("Main script filename (default: index.ts)")
31
+ };
32
+ const understandModelSchema = {
33
+ tenant: import_zod.z.string().describe("Tenant name")
34
+ };
35
+ const writeImportScriptSchema = {
36
+ tenant: import_zod.z.string().describe("Tenant name"),
37
+ variableName: import_zod.z.string().describe("Target variable to import into")
38
+ };
39
+ const copyAppSchema = {
40
+ tenant: import_zod.z.string().describe("Tenant name"),
41
+ sourceApp: import_zod.z.string().describe("Name of app to copy"),
42
+ newAppName: import_zod.z.string().describe("Name for the new app")
43
+ };
44
+ const exportDataSchema = {
45
+ tenant: import_zod.z.string().describe("Tenant name"),
46
+ variableName: import_zod.z.string().describe("Variable to export")
47
+ };
48
+ const debugSyncSchema = {
49
+ tenant: import_zod.z.string().describe("Tenant name")
50
+ };
51
+ function registerWorkflowPrompts(server) {
52
+ const anyServer = server;
53
+ anyServer.prompt(
54
+ "setup_new_tenant",
55
+ "Guide for setting up a new Farseer tenant: login, checkout, pull, install dependencies.",
56
+ setupTenantSchema,
57
+ async (params) => {
58
+ const { tenant } = params;
59
+ return {
60
+ messages: [
61
+ {
62
+ role: "user",
63
+ content: {
64
+ type: "text",
65
+ text: `You are setting up a new Farseer tenant "${tenant}".
66
+
67
+ Steps to follow:
68
+
69
+ 1. First, check authentication status with farseer_whoami
70
+ 2. If not logged in, inform the user to run "farseer login" in terminal (MCP cannot do browser login)
71
+ 3. Use farseer_checkout to set "${tenant}" as the default tenant (this also pulls files and apps)
72
+ 4. Tell user to run "farseer install ${tenant}" in terminal to install npm dependencies
73
+ 5. Use farseer_list_apps to show available apps
74
+ 6. Use farseer_export_model to understand the data structure
75
+
76
+ After setup, the user can:
77
+ - Run apps with farseer_run_app
78
+ - Edit scripts in apps/${tenant}/files/Scripts/
79
+ - Push changes with farseer_push
80
+ - Check model with farseer_get_variable or farseer_get_table`
81
+ }
82
+ }
83
+ ]
84
+ };
85
+ }
86
+ );
87
+ anyServer.prompt(
88
+ "create_new_app",
89
+ "Guide for creating a new Farseer app from scratch.",
90
+ createAppSchema,
91
+ async (params) => {
92
+ const { tenant, appName, scriptName } = params;
93
+ const script = scriptName || "index.ts";
94
+ return {
95
+ messages: [
96
+ {
97
+ role: "user",
98
+ content: {
99
+ type: "text",
100
+ text: `Creating a new Farseer app "${appName}" for tenant "${tenant}".
101
+
102
+ IMPORTANT: A Farseer App = a TypeScript script + an app config that tells Farseer which script to run and with what arguments.
103
+ The script uses \`farseer-client\` to interact with the Farseer API.
104
+ Authentication is automatic - \`new FarseerClient()\` reads credentials from environment variables injected by the CLI.
105
+ You NEVER hardcode credentials in scripts.
106
+
107
+ Steps to follow:
108
+
109
+ 1. Write the script file at farseer-apps/${tenant}/files/Scripts/${script}
110
+ Use the template below as a starting point.
111
+
112
+ 2. Push the script to remote with farseer_push
113
+ (Scripts must exist on remote before they can be assigned to an app)
114
+
115
+ 3. Create the app with farseer_create_app (name: "${appName}")
116
+
117
+ 4. Configure the app with farseer_configure_app:
118
+ - entrypoint: "${script}"
119
+ - scripts: ["${script}"]
120
+ - arguments: Add any arguments the script expects (they arrive via process.argv)
121
+
122
+ 5. Test with farseer_run_app
123
+ The CLI injects auth credentials as env vars and runs the script with npx tsx.
124
+
125
+ Script template:
126
+ \`\`\`typescript
127
+ import * as farseer from 'farseer-client';
128
+
129
+ // FarseerClient auto-configures from env vars injected by "farseer run"
130
+ // NEVER hardcode credentials - just use the empty constructor
131
+ const client = new farseer.FarseerClient();
132
+
133
+ // Arguments come via process.argv in the order defined by app config
134
+ const args = process.argv.slice(2);
135
+
136
+ async function main() {
137
+ // Load dimension/variable metadata
138
+ await client.initTagMap();
139
+
140
+ // Your code here
141
+ console.log('App running successfully');
142
+ }
143
+
144
+ main().catch(farseer.handleUnknownError);
145
+ \`\`\``
146
+ }
147
+ }
148
+ ]
149
+ };
150
+ }
151
+ );
152
+ anyServer.prompt(
153
+ "understand_model",
154
+ "Explore and understand the data model of a Farseer tenant.",
155
+ understandModelSchema,
156
+ async (params) => {
157
+ const { tenant } = params;
158
+ return {
159
+ messages: [
160
+ {
161
+ role: "user",
162
+ content: {
163
+ type: "text",
164
+ text: `Analyzing the data model for tenant "${tenant}".
165
+
166
+ Steps to follow:
167
+
168
+ 1. Use farseer_export_model to get the full model structure
169
+
170
+ 2. Review dimension tables:
171
+ - Use farseer_list_tables for overview
172
+ - Key dimensions usually include: Products, Regions, Time (Months, Years), Versions
173
+ - Check foreign key relationships between tables
174
+
175
+ 3. Review variables:
176
+ - Use farseer_list_variables for overview
177
+ - Use farseer_get_variable for specific variable details
178
+ - Note which dimensions each variable has
179
+
180
+ 4. For import scripts, you need to know:
181
+ - Target variable name
182
+ - All dimensions the variable has
183
+ - Valid members for each dimension
184
+
185
+ Key concepts:
186
+ - Dimensions structure the data (Product, Region, Month, Year, Version)
187
+ - Variables store values at dimension intersections
188
+ - Formulas calculate values automatically
189
+ - Roll-up types determine aggregation (SUM, AVERAGE, etc.)
190
+
191
+ Common dimension tables:
192
+ - Months, Years (time)
193
+ - Versions (Plan, Actual, Forecast)
194
+ - Products, Categories, Brands
195
+ - Regions, Entities, Cost Centers`
196
+ }
197
+ }
198
+ ]
199
+ };
200
+ }
201
+ );
202
+ anyServer.prompt(
203
+ "write_import_script",
204
+ "Guide for writing a data import script.",
205
+ writeImportScriptSchema,
206
+ async (params) => {
207
+ const { tenant, variableName } = params;
208
+ return {
209
+ messages: [
210
+ {
211
+ role: "user",
212
+ content: {
213
+ type: "text",
214
+ text: `Writing an import script for variable "${variableName}" in tenant "${tenant}".
215
+
216
+ Steps to follow:
217
+
218
+ 1. Use farseer_get_variable to understand the target variable:
219
+ - What dimensions does it have?
220
+ - What is the roll-up type?
221
+
222
+ 2. Use farseer_get_table for each dimension to see valid members
223
+
224
+ 3. Create the import script with this pattern:
225
+
226
+ \`\`\`typescript
227
+ import * as farseer from 'farseer-client';
228
+
229
+ const client = new farseer.FarseerClient();
230
+
231
+ async function main() {
232
+ await client.initTagMap();
233
+
234
+ // Create import job with column definitions
235
+ const importJob = await client.createImportJob({
236
+ title: 'Import ${variableName}',
237
+ columns: [
238
+ { type: 'DIMENSION_TABLE', dimensionTableName: 'Product' },
239
+ { type: 'DIMENSION_TABLE', dimensionTableName: 'Years' },
240
+ { type: 'DIMENSION_TABLE', dimensionTableName: 'Months' },
241
+ { type: 'DIMENSION_TABLE', dimensionTableName: 'Versions' },
242
+ { type: 'VARIABLE', variableName: '${variableName}' },
243
+ ],
244
+ labels: ['auto', 'import-${variableName.toLowerCase().replace(/\s+/g, "-")}']
245
+ });
246
+
247
+ // Add rows - each row matches column order
248
+ const rows = [
249
+ ['ProductA', 'Y2025', 'M1', 'Plan', 1000],
250
+ ['ProductB', 'Y2025', 'M1', 'Plan', 2000],
251
+ ];
252
+
253
+ await importJob.addRows(rows);
254
+ await importJob.flushRows();
255
+ await importJob.undoPrevious(); // Remove previous import
256
+ await importJob.commit();
257
+
258
+ console.log('Import completed!');
259
+ }
260
+
261
+ main().catch(farseer.handleUnknownError);
262
+ \`\`\`
263
+
264
+ 4. Save script to apps/${tenant}/files/Scripts/
265
+ 5. Push with farseer_push
266
+ 6. Create app with farseer_create_app
267
+ 7. Configure with farseer_configure_app
268
+ 8. Test with farseer_run_app
269
+
270
+ ALTERNATIVE: For simple imports without a script, use the farseer_create_import_job tool directly.
271
+ It handles the full workflow (create metadata, add rows, undo previous, commit) in a single call.
272
+ Use farseer_create_import_job when:
273
+ - Data is already available (no need to fetch from external source)
274
+ - The import is a one-time or simple operation
275
+ - You want to quickly import without creating a full script
276
+
277
+ Use a script when:
278
+ - Data comes from external sources (APIs, databases, files)
279
+ - Complex data transformation is needed
280
+ - The import runs on a schedule as an App`
281
+ }
282
+ }
283
+ ]
284
+ };
285
+ }
286
+ );
287
+ anyServer.prompt(
288
+ "copy_app",
289
+ "Guide for copying an existing app to create a new one.",
290
+ copyAppSchema,
291
+ async (params) => {
292
+ const { tenant, sourceApp, newAppName } = params;
293
+ return {
294
+ messages: [
295
+ {
296
+ role: "user",
297
+ content: {
298
+ type: "text",
299
+ text: `Copying app "${sourceApp}" to create "${newAppName}" for tenant "${tenant}".
300
+
301
+ Steps to follow:
302
+
303
+ 1. Pull latest with farseer_pull to get current app JSON
304
+
305
+ 2. Use farseer_get_app to see the source app configuration
306
+
307
+ 3. The app JSON files are in apps/${tenant}/apps/
308
+
309
+ Copy the source JSON file and modify:
310
+ - Change "name" to "${newAppName}"
311
+ - **IMPORTANT: Remove "_remote" field** (this makes it a new app)
312
+ - Modify arguments, description as needed
313
+
314
+ 4. JSON format for new app:
315
+ \`\`\`json
316
+ {
317
+ "name": "${newAppName}",
318
+ "description": "Copied from ${sourceApp}",
319
+ "entrypoint": "script.ts",
320
+ "scripts": ["script.ts"],
321
+ "arguments": [
322
+ { "name": "Year", "defaultValue": "2025" }
323
+ ]
324
+ }
325
+ \`\`\`
326
+
327
+ Note: Do NOT include "_remote" for new apps - CLI adds it after first push.
328
+
329
+ 5. Push with farseer_push to create the new app
330
+
331
+ 6. Test with farseer_run_app`
332
+ }
333
+ }
334
+ ]
335
+ };
336
+ }
337
+ );
338
+ anyServer.prompt(
339
+ "export_data",
340
+ "Guide for exporting variable data from Farseer.",
341
+ exportDataSchema,
342
+ async (params) => {
343
+ const { tenant, variableName } = params;
344
+ return {
345
+ messages: [
346
+ {
347
+ role: "user",
348
+ content: {
349
+ type: "text",
350
+ text: `Exporting data for variable "${variableName}" from tenant "${tenant}".
351
+
352
+ Steps to follow:
353
+
354
+ 1. Use farseer_get_variable to understand the variable:
355
+ - What dimensions does it span?
356
+ - What is its data type?
357
+
358
+ 2. Choose export method:
359
+
360
+ **Option A: Quick export (farseer_export_variable_data)**
361
+ - Uses ExportApi.exportFormula() internally
362
+ - Returns CSV/JSON data inline
363
+ - Good for quick inspection or small datasets
364
+ - Use 'limit' parameter for large datasets
365
+
366
+ **Option B: Structured export (farseer_load_variable_data)**
367
+ - Uses data.loadFarseerVariable() internally
368
+ - Can specify which dimensions to include as columns
369
+ - Returns structured CSV data
370
+ - Good when you need specific dimension breakdowns
371
+
372
+ **Option C: CLI export (farseer variable export)**
373
+ - Saves CSV/JSON/XLSX to a local file
374
+ - Best for saving data locally for analysis
375
+
376
+ 3. For analysis:
377
+ - Parse the CSV data returned by the tools
378
+ - Summarize, filter, or transform as needed`
379
+ }
380
+ }
381
+ ]
382
+ };
383
+ }
384
+ );
385
+ anyServer.prompt(
386
+ "debug_sync_issues",
387
+ "Troubleshoot synchronization problems between local and remote.",
388
+ debugSyncSchema,
389
+ async (params) => {
390
+ const { tenant } = params;
391
+ return {
392
+ messages: [
393
+ {
394
+ role: "user",
395
+ content: {
396
+ type: "text",
397
+ text: `Debugging sync issues for tenant "${tenant}".
398
+
399
+ Steps to follow:
400
+
401
+ 1. Check authentication: farseer_whoami
402
+ - Is JWT valid?
403
+ - Is tenant checked out?
404
+
405
+ 2. Check sync status: farseer_status
406
+ - Are there modified files?
407
+ - Are there only-local or only-remote files?
408
+
409
+ 3. If files show as modified:
410
+ - Use farseer_diff to see differences
411
+ - Decide: pull (accept remote) or push (upload local)
412
+
413
+ 4. Common issues and solutions:
414
+
415
+ **"No credentials found"**
416
+ \u2192 User needs to run "farseer login" in terminal
417
+ \u2192 Or configure API key: "farseer config set ${tenant} --api-key KEY"
418
+
419
+ **"Remote has changes"**
420
+ \u2192 Pull first with farseer_pull
421
+ \u2192 Then push with farseer_push
422
+
423
+ **"Token expired"**
424
+ \u2192 User needs to run "farseer login" again
425
+
426
+ **Apps not syncing**
427
+ \u2192 Need JWT login (browser), not API key
428
+ \u2192 API key only syncs files, not apps
429
+
430
+ 5. Force resolution:
431
+ - To accept all remote changes: farseer_pull with force=true (overwrites local)
432
+ - To accept all local changes: farseer_push with force=true (overwrites remote)
433
+ - For selective resolution: farseer_pull without force will skip conflicts (resolve via CLI)
434
+
435
+ 6. Check specific file diff:
436
+ - Use farseer_diff with file parameter to see exact changes`
437
+ }
438
+ }
439
+ ]
440
+ };
441
+ }
442
+ );
443
+ }
444
+ // Annotate the CommonJS export names for ESM import in node:
445
+ 0 && (module.exports = {
446
+ registerWorkflowPrompts
447
+ });
448
+ //# sourceMappingURL=workflows.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/mcp/prompts/workflows.ts"],
4
+ "sourcesContent": ["/**\n * Workflow Prompts\n *\n * Reusable prompt templates for common Farseer workflows.\n */\n\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { z } from 'zod';\n\n// Define schemas outside of prompt registration to avoid deep type instantiation\nconst setupTenantSchema = {\n tenant: z.string().describe('Tenant name to setup'),\n};\n\nconst createAppSchema = {\n tenant: z.string().describe('Tenant name'),\n appName: z.string().describe('Name for the new app'),\n scriptName: z.string().optional().describe('Main script filename (default: index.ts)'),\n};\n\nconst understandModelSchema = {\n tenant: z.string().describe('Tenant name'),\n};\n\nconst writeImportScriptSchema = {\n tenant: z.string().describe('Tenant name'),\n variableName: z.string().describe('Target variable to import into'),\n};\n\nconst copyAppSchema = {\n tenant: z.string().describe('Tenant name'),\n sourceApp: z.string().describe('Name of app to copy'),\n newAppName: z.string().describe('Name for the new app'),\n};\n\nconst exportDataSchema = {\n tenant: z.string().describe('Tenant name'),\n variableName: z.string().describe('Variable to export'),\n};\n\nconst debugSyncSchema = {\n tenant: z.string().describe('Tenant name'),\n};\n\nexport function registerWorkflowPrompts(server: McpServer): void {\n // Cast to any to avoid very deep generic type instantiation from the MCP SDK\n const anyServer = server as any;\n // Setup new tenant\n anyServer.prompt(\n 'setup_new_tenant',\n 'Guide for setting up a new Farseer tenant: login, checkout, pull, install dependencies.',\n setupTenantSchema,\n async (params: { tenant: string }) => {\n const { tenant } = params;\n return {\n messages: [\n {\n role: 'user',\n content: {\n type: 'text',\n text: `You are setting up a new Farseer tenant \"${tenant}\".\n\nSteps to follow:\n\n1. First, check authentication status with farseer_whoami\n2. If not logged in, inform the user to run \"farseer login\" in terminal (MCP cannot do browser login)\n3. Use farseer_checkout to set \"${tenant}\" as the default tenant (this also pulls files and apps)\n4. Tell user to run \"farseer install ${tenant}\" in terminal to install npm dependencies\n5. Use farseer_list_apps to show available apps\n6. Use farseer_export_model to understand the data structure\n\nAfter setup, the user can:\n- Run apps with farseer_run_app\n- Edit scripts in apps/${tenant}/files/Scripts/\n- Push changes with farseer_push\n- Check model with farseer_get_variable or farseer_get_table`,\n },\n },\n ],\n };\n },\n );\n\n // Create new app\n anyServer.prompt(\n 'create_new_app',\n 'Guide for creating a new Farseer app from scratch.',\n createAppSchema,\n async (params: { tenant: string; appName: string; scriptName?: string }) => {\n const { tenant, appName, scriptName } = params;\n const script = scriptName || 'index.ts';\n return {\n messages: [\n {\n role: 'user',\n content: {\n type: 'text',\n text: `Creating a new Farseer app \"${appName}\" for tenant \"${tenant}\".\n\nIMPORTANT: A Farseer App = a TypeScript script + an app config that tells Farseer which script to run and with what arguments.\nThe script uses \\`farseer-client\\` to interact with the Farseer API.\nAuthentication is automatic - \\`new FarseerClient()\\` reads credentials from environment variables injected by the CLI.\nYou NEVER hardcode credentials in scripts.\n\nSteps to follow:\n\n1. Write the script file at farseer-apps/${tenant}/files/Scripts/${script}\n Use the template below as a starting point.\n\n2. Push the script to remote with farseer_push\n (Scripts must exist on remote before they can be assigned to an app)\n\n3. Create the app with farseer_create_app (name: \"${appName}\")\n\n4. Configure the app with farseer_configure_app:\n - entrypoint: \"${script}\"\n - scripts: [\"${script}\"]\n - arguments: Add any arguments the script expects (they arrive via process.argv)\n\n5. Test with farseer_run_app\n The CLI injects auth credentials as env vars and runs the script with npx tsx.\n\nScript template:\n\\`\\`\\`typescript\nimport * as farseer from 'farseer-client';\n\n// FarseerClient auto-configures from env vars injected by \"farseer run\"\n// NEVER hardcode credentials - just use the empty constructor\nconst client = new farseer.FarseerClient();\n\n// Arguments come via process.argv in the order defined by app config\nconst args = process.argv.slice(2);\n\nasync function main() {\n // Load dimension/variable metadata\n await client.initTagMap();\n\n // Your code here\n console.log('App running successfully');\n}\n\nmain().catch(farseer.handleUnknownError);\n\\`\\`\\``,\n },\n },\n ],\n };\n },\n );\n\n // Understand model\n anyServer.prompt(\n 'understand_model',\n 'Explore and understand the data model of a Farseer tenant.',\n understandModelSchema,\n async (params: { tenant: string }) => {\n const { tenant } = params;\n return {\n messages: [\n {\n role: 'user',\n content: {\n type: 'text',\n text: `Analyzing the data model for tenant \"${tenant}\".\n\nSteps to follow:\n\n1. Use farseer_export_model to get the full model structure\n\n2. Review dimension tables:\n - Use farseer_list_tables for overview\n - Key dimensions usually include: Products, Regions, Time (Months, Years), Versions\n - Check foreign key relationships between tables\n\n3. Review variables:\n - Use farseer_list_variables for overview\n - Use farseer_get_variable for specific variable details\n - Note which dimensions each variable has\n\n4. For import scripts, you need to know:\n - Target variable name\n - All dimensions the variable has\n - Valid members for each dimension\n\nKey concepts:\n- Dimensions structure the data (Product, Region, Month, Year, Version)\n- Variables store values at dimension intersections\n- Formulas calculate values automatically\n- Roll-up types determine aggregation (SUM, AVERAGE, etc.)\n\nCommon dimension tables:\n- Months, Years (time)\n- Versions (Plan, Actual, Forecast)\n- Products, Categories, Brands\n- Regions, Entities, Cost Centers`,\n },\n },\n ],\n };\n },\n );\n\n // Write import script\n anyServer.prompt(\n 'write_import_script',\n 'Guide for writing a data import script.',\n writeImportScriptSchema,\n async (params: { tenant: string; variableName: string }) => {\n const { tenant, variableName } = params;\n return {\n messages: [\n {\n role: 'user',\n content: {\n type: 'text',\n text: `Writing an import script for variable \"${variableName}\" in tenant \"${tenant}\".\n\nSteps to follow:\n\n1. Use farseer_get_variable to understand the target variable:\n - What dimensions does it have?\n - What is the roll-up type?\n\n2. Use farseer_get_table for each dimension to see valid members\n\n3. Create the import script with this pattern:\n\n\\`\\`\\`typescript\nimport * as farseer from 'farseer-client';\n\nconst client = new farseer.FarseerClient();\n\nasync function main() {\n await client.initTagMap();\n\n // Create import job with column definitions\n const importJob = await client.createImportJob({\n title: 'Import ${variableName}',\n columns: [\n { type: 'DIMENSION_TABLE', dimensionTableName: 'Product' },\n { type: 'DIMENSION_TABLE', dimensionTableName: 'Years' },\n { type: 'DIMENSION_TABLE', dimensionTableName: 'Months' },\n { type: 'DIMENSION_TABLE', dimensionTableName: 'Versions' },\n { type: 'VARIABLE', variableName: '${variableName}' },\n ],\n labels: ['auto', 'import-${variableName.toLowerCase().replace(/\\s+/g, '-')}']\n });\n\n // Add rows - each row matches column order\n const rows = [\n ['ProductA', 'Y2025', 'M1', 'Plan', 1000],\n ['ProductB', 'Y2025', 'M1', 'Plan', 2000],\n ];\n\n await importJob.addRows(rows);\n await importJob.flushRows();\n await importJob.undoPrevious(); // Remove previous import\n await importJob.commit();\n\n console.log('Import completed!');\n}\n\nmain().catch(farseer.handleUnknownError);\n\\`\\`\\`\n\n4. Save script to apps/${tenant}/files/Scripts/\n5. Push with farseer_push\n6. Create app with farseer_create_app\n7. Configure with farseer_configure_app\n8. Test with farseer_run_app\n\nALTERNATIVE: For simple imports without a script, use the farseer_create_import_job tool directly.\nIt handles the full workflow (create metadata, add rows, undo previous, commit) in a single call.\nUse farseer_create_import_job when:\n- Data is already available (no need to fetch from external source)\n- The import is a one-time or simple operation\n- You want to quickly import without creating a full script\n\nUse a script when:\n- Data comes from external sources (APIs, databases, files)\n- Complex data transformation is needed\n- The import runs on a schedule as an App`,\n },\n },\n ],\n };\n },\n );\n\n // Copy existing app\n anyServer.prompt(\n 'copy_app',\n 'Guide for copying an existing app to create a new one.',\n copyAppSchema,\n async (params: { tenant: string; sourceApp: string; newAppName: string }) => {\n const { tenant, sourceApp, newAppName } = params;\n return {\n messages: [\n {\n role: 'user',\n content: {\n type: 'text',\n text: `Copying app \"${sourceApp}\" to create \"${newAppName}\" for tenant \"${tenant}\".\n\nSteps to follow:\n\n1. Pull latest with farseer_pull to get current app JSON\n\n2. Use farseer_get_app to see the source app configuration\n\n3. The app JSON files are in apps/${tenant}/apps/\n\n Copy the source JSON file and modify:\n - Change \"name\" to \"${newAppName}\"\n - **IMPORTANT: Remove \"_remote\" field** (this makes it a new app)\n - Modify arguments, description as needed\n\n4. JSON format for new app:\n\\`\\`\\`json\n{\n \"name\": \"${newAppName}\",\n \"description\": \"Copied from ${sourceApp}\",\n \"entrypoint\": \"script.ts\",\n \"scripts\": [\"script.ts\"],\n \"arguments\": [\n { \"name\": \"Year\", \"defaultValue\": \"2025\" }\n ]\n}\n\\`\\`\\`\n\nNote: Do NOT include \"_remote\" for new apps - CLI adds it after first push.\n\n5. Push with farseer_push to create the new app\n\n6. Test with farseer_run_app`,\n },\n },\n ],\n };\n },\n );\n\n // Export data\n anyServer.prompt(\n 'export_data',\n 'Guide for exporting variable data from Farseer.',\n exportDataSchema,\n async (params: { tenant: string; variableName: string }) => {\n const { tenant, variableName } = params;\n return {\n messages: [\n {\n role: 'user',\n content: {\n type: 'text',\n text: `Exporting data for variable \"${variableName}\" from tenant \"${tenant}\".\n\nSteps to follow:\n\n1. Use farseer_get_variable to understand the variable:\n - What dimensions does it span?\n - What is its data type?\n\n2. Choose export method:\n\n **Option A: Quick export (farseer_export_variable_data)**\n - Uses ExportApi.exportFormula() internally\n - Returns CSV/JSON data inline\n - Good for quick inspection or small datasets\n - Use 'limit' parameter for large datasets\n\n **Option B: Structured export (farseer_load_variable_data)**\n - Uses data.loadFarseerVariable() internally\n - Can specify which dimensions to include as columns\n - Returns structured CSV data\n - Good when you need specific dimension breakdowns\n\n **Option C: CLI export (farseer variable export)**\n - Saves CSV/JSON/XLSX to a local file\n - Best for saving data locally for analysis\n\n3. For analysis:\n - Parse the CSV data returned by the tools\n - Summarize, filter, or transform as needed`,\n },\n },\n ],\n };\n },\n );\n\n // Debug sync issues\n anyServer.prompt(\n 'debug_sync_issues',\n 'Troubleshoot synchronization problems between local and remote.',\n debugSyncSchema,\n async (params: { tenant: string }) => {\n const { tenant } = params;\n return {\n messages: [\n {\n role: 'user',\n content: {\n type: 'text',\n text: `Debugging sync issues for tenant \"${tenant}\".\n\nSteps to follow:\n\n1. Check authentication: farseer_whoami\n - Is JWT valid?\n - Is tenant checked out?\n\n2. Check sync status: farseer_status\n - Are there modified files?\n - Are there only-local or only-remote files?\n\n3. If files show as modified:\n - Use farseer_diff to see differences\n - Decide: pull (accept remote) or push (upload local)\n\n4. Common issues and solutions:\n\n **\"No credentials found\"**\n \u2192 User needs to run \"farseer login\" in terminal\n \u2192 Or configure API key: \"farseer config set ${tenant} --api-key KEY\"\n\n **\"Remote has changes\"**\n \u2192 Pull first with farseer_pull\n \u2192 Then push with farseer_push\n\n **\"Token expired\"**\n \u2192 User needs to run \"farseer login\" again\n\n **Apps not syncing**\n \u2192 Need JWT login (browser), not API key\n \u2192 API key only syncs files, not apps\n\n5. Force resolution:\n - To accept all remote changes: farseer_pull with force=true (overwrites local)\n - To accept all local changes: farseer_push with force=true (overwrites remote)\n - For selective resolution: farseer_pull without force will skip conflicts (resolve via CLI)\n\n6. Check specific file diff:\n - Use farseer_diff with file parameter to see exact changes`,\n },\n },\n ],\n };\n },\n );\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,iBAAkB;AAGlB,MAAM,oBAAoB;AAAA,EACtB,QAAQ,aAAE,OAAO,EAAE,SAAS,sBAAsB;AACtD;AAEA,MAAM,kBAAkB;AAAA,EACpB,QAAQ,aAAE,OAAO,EAAE,SAAS,aAAa;AAAA,EACzC,SAAS,aAAE,OAAO,EAAE,SAAS,sBAAsB;AAAA,EACnD,YAAY,aAAE,OAAO,EAAE,SAAS,EAAE,SAAS,0CAA0C;AACzF;AAEA,MAAM,wBAAwB;AAAA,EAC1B,QAAQ,aAAE,OAAO,EAAE,SAAS,aAAa;AAC7C;AAEA,MAAM,0BAA0B;AAAA,EAC5B,QAAQ,aAAE,OAAO,EAAE,SAAS,aAAa;AAAA,EACzC,cAAc,aAAE,OAAO,EAAE,SAAS,gCAAgC;AACtE;AAEA,MAAM,gBAAgB;AAAA,EAClB,QAAQ,aAAE,OAAO,EAAE,SAAS,aAAa;AAAA,EACzC,WAAW,aAAE,OAAO,EAAE,SAAS,qBAAqB;AAAA,EACpD,Y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