farseer-cli 1.0.9 → 1.0.10

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 +344 -316
  2. package/dist/commands/apps.js +83 -103
  3. package/dist/commands/checkout.js +156 -134
  4. package/dist/commands/config.js +126 -124
  5. package/dist/commands/diff.js +194 -169
  6. package/dist/commands/dimensions.js +122 -137
  7. package/dist/commands/files.js +77 -88
  8. package/dist/commands/install.js +77 -74
  9. package/dist/commands/list.js +74 -89
  10. package/dist/commands/login.js +101 -126
  11. package/dist/commands/logout.js +42 -57
  12. package/dist/commands/mcp-server.js +24 -39
  13. package/dist/commands/model.js +176 -184
  14. package/dist/commands/pull.js +276 -248
  15. package/dist/commands/push.js +222 -200
  16. package/dist/commands/run.js +322 -274
  17. package/dist/commands/status.js +170 -147
  18. package/dist/commands/variables.js +192 -168
  19. package/dist/commands/whoami.js +45 -61
  20. package/dist/index.js +115 -117
  21. package/dist/mcp/index.js +17 -33
  22. package/dist/mcp/prompts/workflows.js +146 -191
  23. package/dist/mcp/resources/documentation.js +149 -158
  24. package/dist/mcp/server.js +34 -50
  25. package/dist/mcp/tools/appTools.js +278 -307
  26. package/dist/mcp/tools/authTools.js +123 -130
  27. package/dist/mcp/tools/dataTools.js +271 -275
  28. package/dist/mcp/tools/modelTools.js +233 -265
  29. package/dist/mcp/tools/runTools.js +205 -199
  30. package/dist/mcp/tools/syncTools.js +315 -341
  31. package/dist/mcp/utils/helpers.js +124 -117
  32. package/dist/services/appSyncService.js +438 -379
  33. package/dist/services/configService.js +144 -154
  34. package/dist/services/farseerApi.js +401 -401
  35. package/dist/services/farseerFactory.js +274 -208
  36. package/dist/services/farseerService.js +488 -455
  37. package/dist/services/syncService.js +732 -657
  38. package/dist/utils/constants.js +20 -45
  39. package/dist/utils/helpers.js +366 -333
  40. package/dist/utils/logger.js +43 -74
  41. package/package.json +8 -1
  42. package/dist/commands/app.js.map +0 -7
  43. package/dist/commands/apps.js.map +0 -7
  44. package/dist/commands/checkout.js.map +0 -7
  45. package/dist/commands/config.js.map +0 -7
  46. package/dist/commands/diff.js.map +0 -7
  47. package/dist/commands/dimensions.js.map +0 -7
  48. package/dist/commands/files.js.map +0 -7
  49. package/dist/commands/install.js.map +0 -7
  50. package/dist/commands/list.js.map +0 -7
  51. package/dist/commands/login.js.map +0 -7
  52. package/dist/commands/logout.js.map +0 -7
  53. package/dist/commands/mcp-server.js.map +0 -7
  54. package/dist/commands/model.js.map +0 -7
  55. package/dist/commands/pull.js.map +0 -7
  56. package/dist/commands/push.js.map +0 -7
  57. package/dist/commands/run.js.map +0 -7
  58. package/dist/commands/status.js.map +0 -7
  59. package/dist/commands/variables.js.map +0 -7
  60. package/dist/commands/whoami.js.map +0 -7
  61. package/dist/index.js.map +0 -7
  62. package/dist/mcp/index.js.map +0 -7
  63. package/dist/mcp/prompts/workflows.js.map +0 -7
  64. package/dist/mcp/resources/documentation.js.map +0 -7
  65. package/dist/mcp/server.js.map +0 -7
  66. package/dist/mcp/tools/appTools.js.map +0 -7
  67. package/dist/mcp/tools/authTools.js.map +0 -7
  68. package/dist/mcp/tools/dataTools.js.map +0 -7
  69. package/dist/mcp/tools/modelTools.js.map +0 -7
  70. package/dist/mcp/tools/runTools.js.map +0 -7
  71. package/dist/mcp/tools/syncTools.js.map +0 -7
  72. package/dist/mcp/utils/helpers.js.map +0 -7
  73. package/dist/services/appSyncService.js.map +0 -7
  74. package/dist/services/configService.js.map +0 -7
  75. package/dist/services/farseerApi.js.map +0 -7
  76. package/dist/services/farseerFactory.js.map +0 -7
  77. package/dist/services/farseerService.js.map +0 -7
  78. package/dist/services/syncService.js.map +0 -7
  79. package/dist/utils/constants.js.map +0 -7
  80. package/dist/utils/helpers.js.map +0 -7
  81. package/dist/utils/logger.js.map +0 -7
@@ -1,68 +1,53 @@
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");
1
+ "use strict";
2
+ /**
3
+ * Workflow Prompts
4
+ *
5
+ * Reusable prompt templates for common Farseer workflows.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.registerWorkflowPrompts = registerWorkflowPrompts;
9
+ const zod_1 = require("zod");
10
+ // Define schemas outside of prompt registration to avoid deep type instantiation
24
11
  const setupTenantSchema = {
25
- tenant: import_zod.z.string().describe("Tenant name to setup")
12
+ tenant: zod_1.z.string().describe('Tenant name to setup'),
26
13
  };
27
14
  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)")
15
+ tenant: zod_1.z.string().describe('Tenant name'),
16
+ appName: zod_1.z.string().describe('Name for the new app'),
17
+ scriptName: zod_1.z.string().optional().describe('Main script filename (default: index.ts)'),
31
18
  };
32
19
  const understandModelSchema = {
33
- tenant: import_zod.z.string().describe("Tenant name")
20
+ tenant: zod_1.z.string().describe('Tenant name'),
34
21
  };
35
22
  const writeImportScriptSchema = {
36
- tenant: import_zod.z.string().describe("Tenant name"),
37
- variableName: import_zod.z.string().describe("Target variable to import into")
23
+ tenant: zod_1.z.string().describe('Tenant name'),
24
+ variableName: zod_1.z.string().describe('Target variable to import into'),
38
25
  };
39
26
  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")
27
+ tenant: zod_1.z.string().describe('Tenant name'),
28
+ sourceApp: zod_1.z.string().describe('Name of app to copy'),
29
+ newAppName: zod_1.z.string().describe('Name for the new app'),
43
30
  };
44
31
  const exportDataSchema = {
45
- tenant: import_zod.z.string().describe("Tenant name"),
46
- variableName: import_zod.z.string().describe("Variable to export")
32
+ tenant: zod_1.z.string().describe('Tenant name'),
33
+ variableName: zod_1.z.string().describe('Variable to export'),
47
34
  };
48
35
  const debugSyncSchema = {
49
- tenant: import_zod.z.string().describe("Tenant name")
36
+ tenant: zod_1.z.string().describe('Tenant name'),
50
37
  };
51
38
  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}".
39
+ // Cast to any to avoid very deep generic type instantiation from the MCP SDK
40
+ const anyServer = server;
41
+ // Setup new tenant
42
+ anyServer.prompt('setup_new_tenant', 'Guide for setting up a new Farseer tenant: login, checkout, pull, install dependencies.', setupTenantSchema, async (params) => {
43
+ const { tenant } = params;
44
+ return {
45
+ messages: [
46
+ {
47
+ role: 'user',
48
+ content: {
49
+ type: 'text',
50
+ text: `You are setting up a new Farseer tenant "${tenant}".
66
51
 
67
52
  Steps to follow:
68
53
 
@@ -77,27 +62,23 @@ After setup, the user can:
77
62
  - Run apps with farseer_run_app
78
63
  - Edit scripts in apps/${tenant}/files/Scripts/
79
64
  - 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}".
65
+ - Check model with farseer_get_variable or farseer_get_table`,
66
+ },
67
+ },
68
+ ],
69
+ };
70
+ });
71
+ // Create new app
72
+ anyServer.prompt('create_new_app', 'Guide for creating a new Farseer app from scratch.', createAppSchema, async (params) => {
73
+ const { tenant, appName, scriptName } = params;
74
+ const script = scriptName || 'index.ts';
75
+ return {
76
+ messages: [
77
+ {
78
+ role: 'user',
79
+ content: {
80
+ type: 'text',
81
+ text: `Creating a new Farseer app "${appName}" for tenant "${tenant}".
101
82
 
102
83
  IMPORTANT: A Farseer App = a TypeScript script + an app config that tells Farseer which script to run and with what arguments.
103
84
  The script uses \`farseer-client\` to interact with the Farseer API.
@@ -142,26 +123,22 @@ async function main() {
142
123
  }
143
124
 
144
125
  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}".
126
+ \`\`\``,
127
+ },
128
+ },
129
+ ],
130
+ };
131
+ });
132
+ // Understand model
133
+ anyServer.prompt('understand_model', 'Explore and understand the data model of a Farseer tenant.', understandModelSchema, async (params) => {
134
+ const { tenant } = params;
135
+ return {
136
+ messages: [
137
+ {
138
+ role: 'user',
139
+ content: {
140
+ type: 'text',
141
+ text: `Analyzing the data model for tenant "${tenant}".
165
142
 
166
143
  Steps to follow:
167
144
 
@@ -192,26 +169,22 @@ Common dimension tables:
192
169
  - Months, Years (time)
193
170
  - Versions (Plan, Actual, Forecast)
194
171
  - 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}".
172
+ - Regions, Entities, Cost Centers`,
173
+ },
174
+ },
175
+ ],
176
+ };
177
+ });
178
+ // Write import script
179
+ anyServer.prompt('write_import_script', 'Guide for writing a data import script.', writeImportScriptSchema, async (params) => {
180
+ const { tenant, variableName } = params;
181
+ return {
182
+ messages: [
183
+ {
184
+ role: 'user',
185
+ content: {
186
+ type: 'text',
187
+ text: `Writing an import script for variable "${variableName}" in tenant "${tenant}".
215
188
 
216
189
  Steps to follow:
217
190
 
@@ -241,7 +214,7 @@ async function main() {
241
214
  { type: 'DIMENSION_TABLE', dimensionTableName: 'Versions' },
242
215
  { type: 'VARIABLE', variableName: '${variableName}' },
243
216
  ],
244
- labels: ['auto', 'import-${variableName.toLowerCase().replace(/\s+/g, "-")}']
217
+ labels: ['auto', 'import-${variableName.toLowerCase().replace(/\s+/g, '-')}']
245
218
  });
246
219
 
247
220
  // Add rows - each row matches column order
@@ -277,26 +250,22 @@ Use farseer_create_import_job when:
277
250
  Use a script when:
278
251
  - Data comes from external sources (APIs, databases, files)
279
252
  - 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}".
253
+ - The import runs on a schedule as an App`,
254
+ },
255
+ },
256
+ ],
257
+ };
258
+ });
259
+ // Copy existing app
260
+ anyServer.prompt('copy_app', 'Guide for copying an existing app to create a new one.', copyAppSchema, async (params) => {
261
+ const { tenant, sourceApp, newAppName } = params;
262
+ return {
263
+ messages: [
264
+ {
265
+ role: 'user',
266
+ content: {
267
+ type: 'text',
268
+ text: `Copying app "${sourceApp}" to create "${newAppName}" for tenant "${tenant}".
300
269
 
301
270
  Steps to follow:
302
271
 
@@ -328,26 +297,22 @@ Note: Do NOT include "_remote" for new apps - CLI adds it after first push.
328
297
 
329
298
  5. Push with farseer_push to create the new app
330
299
 
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}".
300
+ 6. Test with farseer_run_app`,
301
+ },
302
+ },
303
+ ],
304
+ };
305
+ });
306
+ // Export data
307
+ anyServer.prompt('export_data', 'Guide for exporting variable data from Farseer.', exportDataSchema, async (params) => {
308
+ const { tenant, variableName } = params;
309
+ return {
310
+ messages: [
311
+ {
312
+ role: 'user',
313
+ content: {
314
+ type: 'text',
315
+ text: `Exporting data for variable "${variableName}" from tenant "${tenant}".
351
316
 
352
317
  Steps to follow:
353
318
 
@@ -375,26 +340,22 @@ Steps to follow:
375
340
 
376
341
  3. For analysis:
377
342
  - 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}".
343
+ - Summarize, filter, or transform as needed`,
344
+ },
345
+ },
346
+ ],
347
+ };
348
+ });
349
+ // Debug sync issues
350
+ anyServer.prompt('debug_sync_issues', 'Troubleshoot synchronization problems between local and remote.', debugSyncSchema, async (params) => {
351
+ const { tenant } = params;
352
+ return {
353
+ messages: [
354
+ {
355
+ role: 'user',
356
+ content: {
357
+ type: 'text',
358
+ text: `Debugging sync issues for tenant "${tenant}".
398
359
 
399
360
  Steps to follow:
400
361
 
@@ -413,19 +374,19 @@ Steps to follow:
413
374
  4. Common issues and solutions:
414
375
 
415
376
  **"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"
377
+ → User needs to run "farseer login" in terminal
378
+ → Or configure API key: "farseer config set ${tenant} --api-key KEY"
418
379
 
419
380
  **"Remote has changes"**
420
- \u2192 Pull first with farseer_pull
421
- \u2192 Then push with farseer_push
381
+ → Pull first with farseer_pull
382
+ → Then push with farseer_push
422
383
 
423
384
  **"Token expired"**
424
- \u2192 User needs to run "farseer login" again
385
+ → User needs to run "farseer login" again
425
386
 
426
387
  **Apps not syncing**
427
- \u2192 Need JWT login (browser), not API key
428
- \u2192 API key only syncs files, not apps
388
+ → Need JWT login (browser), not API key
389
+ → API key only syncs files, not apps
429
390
 
430
391
  5. Force resolution:
431
392
  - To accept all remote changes: farseer_pull with force=true (overwrites local)
@@ -433,16 +394,10 @@ Steps to follow:
433
394
  - For selective resolution: farseer_pull without force will skip conflicts (resolve via CLI)
434
395
 
435
396
  6. Check specific file diff:
436
- - Use farseer_diff with file parameter to see exact changes`
437
- }
438
- }
439
- ]
440
- };
441
- }
442
- );
397
+ - Use farseer_diff with file parameter to see exact changes`,
398
+ },
399
+ },
400
+ ],
401
+ };
402
+ });
443
403
  }
444
- // Annotate the CommonJS export names for ESM import in node:
445
- 0 && (module.exports = {
446
- registerWorkflowPrompts
447
- });
448
- //# sourceMappingURL=workflows.js.map