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.
- package/dist/commands/app.js +344 -316
- package/dist/commands/apps.js +83 -103
- package/dist/commands/checkout.js +156 -134
- package/dist/commands/config.js +126 -124
- package/dist/commands/diff.js +194 -169
- package/dist/commands/dimensions.js +122 -137
- package/dist/commands/files.js +77 -88
- package/dist/commands/install.js +77 -74
- package/dist/commands/list.js +74 -89
- package/dist/commands/login.js +101 -126
- package/dist/commands/logout.js +42 -57
- package/dist/commands/mcp-server.js +24 -39
- package/dist/commands/model.js +176 -184
- package/dist/commands/pull.js +276 -248
- package/dist/commands/push.js +222 -200
- package/dist/commands/run.js +322 -274
- package/dist/commands/status.js +170 -147
- package/dist/commands/variables.js +192 -168
- package/dist/commands/whoami.js +45 -61
- package/dist/index.js +115 -117
- package/dist/mcp/index.js +17 -33
- package/dist/mcp/prompts/workflows.js +146 -191
- package/dist/mcp/resources/documentation.js +149 -158
- package/dist/mcp/server.js +34 -50
- package/dist/mcp/tools/appTools.js +278 -307
- package/dist/mcp/tools/authTools.js +123 -130
- package/dist/mcp/tools/dataTools.js +271 -275
- package/dist/mcp/tools/modelTools.js +233 -265
- package/dist/mcp/tools/runTools.js +205 -199
- package/dist/mcp/tools/syncTools.js +315 -341
- package/dist/mcp/utils/helpers.js +124 -117
- package/dist/services/appSyncService.js +438 -379
- package/dist/services/configService.js +144 -154
- package/dist/services/farseerApi.js +401 -401
- package/dist/services/farseerFactory.js +274 -208
- package/dist/services/farseerService.js +488 -455
- package/dist/services/syncService.js +732 -657
- package/dist/utils/constants.js +20 -45
- package/dist/utils/helpers.js +366 -333
- package/dist/utils/logger.js +43 -74
- package/package.json +8 -1
- package/dist/commands/app.js.map +0 -7
- package/dist/commands/apps.js.map +0 -7
- package/dist/commands/checkout.js.map +0 -7
- package/dist/commands/config.js.map +0 -7
- package/dist/commands/diff.js.map +0 -7
- package/dist/commands/dimensions.js.map +0 -7
- package/dist/commands/files.js.map +0 -7
- package/dist/commands/install.js.map +0 -7
- package/dist/commands/list.js.map +0 -7
- package/dist/commands/login.js.map +0 -7
- package/dist/commands/logout.js.map +0 -7
- package/dist/commands/mcp-server.js.map +0 -7
- package/dist/commands/model.js.map +0 -7
- package/dist/commands/pull.js.map +0 -7
- package/dist/commands/push.js.map +0 -7
- package/dist/commands/run.js.map +0 -7
- package/dist/commands/status.js.map +0 -7
- package/dist/commands/variables.js.map +0 -7
- package/dist/commands/whoami.js.map +0 -7
- package/dist/index.js.map +0 -7
- package/dist/mcp/index.js.map +0 -7
- package/dist/mcp/prompts/workflows.js.map +0 -7
- package/dist/mcp/resources/documentation.js.map +0 -7
- package/dist/mcp/server.js.map +0 -7
- package/dist/mcp/tools/appTools.js.map +0 -7
- package/dist/mcp/tools/authTools.js.map +0 -7
- package/dist/mcp/tools/dataTools.js.map +0 -7
- package/dist/mcp/tools/modelTools.js.map +0 -7
- package/dist/mcp/tools/runTools.js.map +0 -7
- package/dist/mcp/tools/syncTools.js.map +0 -7
- package/dist/mcp/utils/helpers.js.map +0 -7
- package/dist/services/appSyncService.js.map +0 -7
- package/dist/services/configService.js.map +0 -7
- package/dist/services/farseerApi.js.map +0 -7
- package/dist/services/farseerFactory.js.map +0 -7
- package/dist/services/farseerService.js.map +0 -7
- package/dist/services/syncService.js.map +0 -7
- package/dist/utils/constants.js.map +0 -7
- package/dist/utils/helpers.js.map +0 -7
- package/dist/utils/logger.js.map +0 -7
|
@@ -1,68 +1,53 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
-
|
|
12
|
+
tenant: zod_1.z.string().describe('Tenant name to setup'),
|
|
26
13
|
};
|
|
27
14
|
const createAppSchema = {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
-
|
|
20
|
+
tenant: zod_1.z.string().describe('Tenant name'),
|
|
34
21
|
};
|
|
35
22
|
const writeImportScriptSchema = {
|
|
36
|
-
|
|
37
|
-
|
|
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
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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
|
-
|
|
46
|
-
|
|
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
|
-
|
|
36
|
+
tenant: zod_1.z.string().describe('Tenant name'),
|
|
50
37
|
};
|
|
51
38
|
function registerWorkflowPrompts(server) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
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
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
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
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
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
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
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
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
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
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
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
|
-
|
|
417
|
-
|
|
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
|
-
|
|
421
|
-
|
|
381
|
+
→ Pull first with farseer_pull
|
|
382
|
+
→ Then push with farseer_push
|
|
422
383
|
|
|
423
384
|
**"Token expired"**
|
|
424
|
-
|
|
385
|
+
→ User needs to run "farseer login" again
|
|
425
386
|
|
|
426
387
|
**Apps not syncing**
|
|
427
|
-
|
|
428
|
-
|
|
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
|