farseer-cli 1.0.8 → 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 +377 -0
- package/dist/commands/apps.js +91 -0
- package/dist/commands/checkout.js +164 -0
- package/dist/commands/config.js +141 -0
- package/dist/commands/diff.js +210 -0
- package/dist/commands/dimensions.js +130 -0
- package/dist/commands/files.js +88 -0
- package/dist/commands/install.js +82 -0
- package/dist/commands/list.js +77 -0
- package/dist/commands/login.js +109 -0
- package/dist/commands/logout.js +44 -0
- package/dist/commands/mcp-server.js +26 -0
- package/dist/commands/model.js +181 -0
- package/dist/commands/pull.js +286 -0
- package/dist/commands/push.js +235 -0
- package/dist/commands/run.js +336 -0
- package/dist/commands/status.js +178 -0
- package/dist/commands/variables.js +200 -0
- package/dist/commands/whoami.js +47 -0
- package/dist/index.js +163 -0
- package/dist/mcp/index.js +19 -0
- package/dist/mcp/prompts/workflows.js +403 -0
- package/dist/mcp/resources/documentation.js +158 -0
- package/dist/mcp/server.js +36 -0
- package/dist/mcp/tools/appTools.js +348 -0
- package/dist/mcp/tools/authTools.js +152 -0
- package/dist/mcp/tools/dataTools.js +358 -0
- package/dist/mcp/tools/modelTools.js +293 -0
- package/dist/mcp/tools/runTools.js +239 -0
- package/dist/mcp/tools/syncTools.js +383 -0
- package/dist/mcp/utils/helpers.js +142 -0
- package/dist/services/appSyncService.js +458 -0
- package/dist/services/configService.js +186 -0
- package/dist/services/farseerApi.js +426 -0
- package/dist/services/farseerFactory.js +297 -0
- package/dist/services/farseerService.js +647 -0
- package/dist/services/syncService.js +764 -0
- package/dist/utils/constants.js +21 -0
- package/dist/utils/helpers.js +446 -0
- package/dist/utils/logger.js +45 -0
- package/package.json +8 -1
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.registerVariablesCommand = registerVariablesCommand;
|
|
40
|
+
const fs = __importStar(require("fs"));
|
|
41
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
42
|
+
const logger_1 = require("../utils/logger");
|
|
43
|
+
const farseerFactory_1 = require("../services/farseerFactory");
|
|
44
|
+
const helpers_1 = require("../utils/helpers");
|
|
45
|
+
function registerVariablesCommand(program) {
|
|
46
|
+
// farseer variables list
|
|
47
|
+
const variablesCmd = program.command('variables').description('List and manage variables');
|
|
48
|
+
variablesCmd
|
|
49
|
+
.command('list [org] [tenant]')
|
|
50
|
+
.description('List all variables')
|
|
51
|
+
.option('--json', 'Output raw JSON')
|
|
52
|
+
.action(async (first, second, options) => {
|
|
53
|
+
const { organisation, tenant } = (0, helpers_1.resolveTenantWithOrgMapping)(first, second);
|
|
54
|
+
const result = await (0, farseerFactory_1.getFarseerClientWithFallback)(organisation, tenant);
|
|
55
|
+
if (!result) {
|
|
56
|
+
(0, farseerFactory_1.showLoginPrompt)(tenant);
|
|
57
|
+
process.exit(1);
|
|
58
|
+
}
|
|
59
|
+
try {
|
|
60
|
+
const model = await result.client.exportModel();
|
|
61
|
+
if (options.json) {
|
|
62
|
+
console.log(JSON.stringify(model.variables, null, 2));
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
logger_1.logger.header(`Variables (${model.variables.length})`);
|
|
66
|
+
console.log();
|
|
67
|
+
for (const variable of model.variables) {
|
|
68
|
+
const flags = [];
|
|
69
|
+
if (variable.readonly)
|
|
70
|
+
flags.push('readonly');
|
|
71
|
+
if (variable.calculateOnDemand)
|
|
72
|
+
flags.push('on-demand');
|
|
73
|
+
const flagStr = flags.length > 0 ? chalk_1.default.dim(` [${flags.join(', ')}]`) : '';
|
|
74
|
+
console.log(` ${chalk_1.default.bold(variable.name)}${flagStr}`);
|
|
75
|
+
console.log(` Dimensions: ${variable.tables.join(', ')}`);
|
|
76
|
+
console.log(` Rollup: ${variable.rollupType} | Type: ${variable.dataType}`);
|
|
77
|
+
if (variable.formula) {
|
|
78
|
+
console.log(` Formula: ${chalk_1.default.dim(variable.formula.substring(0, 80))}${variable.formula.length > 80 ? '...' : ''}`);
|
|
79
|
+
}
|
|
80
|
+
console.log();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
catch (error) {
|
|
84
|
+
handleModelError(error, tenant);
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
// farseer variable details / export (singular)
|
|
88
|
+
const variableCmd = program.command('variable').description('Variable details and export');
|
|
89
|
+
variableCmd
|
|
90
|
+
.command('details <name>')
|
|
91
|
+
.description('Show variable details (dimensions, formula, rollup, etc.)')
|
|
92
|
+
.option('--json', 'Output raw JSON')
|
|
93
|
+
.action(async (name, options) => {
|
|
94
|
+
const { organisation, tenant } = (0, helpers_1.resolveTenantWithOrgMapping)();
|
|
95
|
+
const result = await (0, farseerFactory_1.getFarseerClientWithFallback)(organisation, tenant);
|
|
96
|
+
if (!result) {
|
|
97
|
+
(0, farseerFactory_1.showLoginPrompt)(tenant);
|
|
98
|
+
process.exit(1);
|
|
99
|
+
}
|
|
100
|
+
try {
|
|
101
|
+
const model = await result.client.exportModel();
|
|
102
|
+
const variable = model.variables.find((v) => v.name.toLowerCase() === name.toLowerCase());
|
|
103
|
+
if (!variable) {
|
|
104
|
+
logger_1.logger.error(`Variable "${name}" not found.`);
|
|
105
|
+
logger_1.logger.dim('Available variables:');
|
|
106
|
+
model.variables.slice(0, 10).forEach((v) => logger_1.logger.dim(` - ${v.name}`));
|
|
107
|
+
if (model.variables.length > 10) {
|
|
108
|
+
logger_1.logger.dim(` ... and ${model.variables.length - 10} more`);
|
|
109
|
+
}
|
|
110
|
+
process.exit(1);
|
|
111
|
+
}
|
|
112
|
+
if (options.json) {
|
|
113
|
+
console.log(JSON.stringify(variable, null, 2));
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
logger_1.logger.header(`Variable: ${variable.name}`);
|
|
117
|
+
console.log();
|
|
118
|
+
if (variable.description) {
|
|
119
|
+
console.log(` Description: ${variable.description}`);
|
|
120
|
+
}
|
|
121
|
+
if (variable.formula) {
|
|
122
|
+
console.log(` Formula: ${variable.formula}`);
|
|
123
|
+
}
|
|
124
|
+
console.log(` Dimensions: ${variable.tables.join(', ')}`);
|
|
125
|
+
if (variable.members.length > 0) {
|
|
126
|
+
console.log(` Specific members: ${variable.members.join(', ')}`);
|
|
127
|
+
}
|
|
128
|
+
console.log(` Roll-up type: ${variable.rollupType}`);
|
|
129
|
+
console.log(` Data type: ${variable.dataType}`);
|
|
130
|
+
if (variable.numberFormat) {
|
|
131
|
+
console.log(` Format: ${variable.numberFormat.type}${variable.numberFormat.formatString ? ` (${variable.numberFormat.formatString})` : ''}`);
|
|
132
|
+
}
|
|
133
|
+
console.log(` Readonly: ${variable.readonly}`);
|
|
134
|
+
console.log(` Calculate on demand: ${variable.calculateOnDemand}`);
|
|
135
|
+
if (variable.folderPath) {
|
|
136
|
+
console.log(` Folder: ${variable.folderPath.join(' / ')}`);
|
|
137
|
+
}
|
|
138
|
+
if (variable.cells && variable.cells.length > 0) {
|
|
139
|
+
console.log(` Cells with data: ${variable.cells.length}`);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
catch (error) {
|
|
143
|
+
handleModelError(error, tenant);
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
variableCmd
|
|
147
|
+
.command('export <name>')
|
|
148
|
+
.description('Export variable data to CSV file')
|
|
149
|
+
.option('--output <file>', 'Output file path')
|
|
150
|
+
.option('--format <format>', 'Output format: csv, json, xlsx', 'csv')
|
|
151
|
+
.option('--limit <n>', 'Limit number of rows', parseInt)
|
|
152
|
+
.action(async (name, options) => {
|
|
153
|
+
const { organisation, tenant } = (0, helpers_1.resolveTenantWithOrgMapping)();
|
|
154
|
+
const nativeClient = await (0, farseerFactory_1.getNativeFarseerClient)(organisation, tenant);
|
|
155
|
+
if (!nativeClient) {
|
|
156
|
+
(0, farseerFactory_1.showLoginPrompt)(tenant);
|
|
157
|
+
process.exit(1);
|
|
158
|
+
}
|
|
159
|
+
try {
|
|
160
|
+
logger_1.logger.info(`Exporting variable "${name}" from ${tenant}...`);
|
|
161
|
+
const exportRequest = {
|
|
162
|
+
formula: name,
|
|
163
|
+
format: options.format || 'csv',
|
|
164
|
+
};
|
|
165
|
+
if (options.limit) {
|
|
166
|
+
exportRequest.limit = options.limit;
|
|
167
|
+
}
|
|
168
|
+
const blob = await nativeClient.export.exportFormula(exportRequest);
|
|
169
|
+
const content = await blob.text();
|
|
170
|
+
const outputFile = options.output || `${name.replace(/[^a-zA-Z0-9_-]/g, '_')}.${options.format || 'csv'}`;
|
|
171
|
+
fs.writeFileSync(outputFile, content, 'utf-8');
|
|
172
|
+
logger_1.logger.success(`Exported to ${outputFile}`);
|
|
173
|
+
const lines = content.split('\n').filter((l) => l.trim()).length;
|
|
174
|
+
logger_1.logger.dim(`${lines - 1} data rows`);
|
|
175
|
+
}
|
|
176
|
+
catch (error) {
|
|
177
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
178
|
+
logger_1.logger.error(`Failed to export variable "${name}".`);
|
|
179
|
+
logger_1.logger.dim(errorMessage);
|
|
180
|
+
process.exit(1);
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
function handleModelError(error, tenant) {
|
|
185
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
186
|
+
if ((0, farseerFactory_1.isAuthError)(error)) {
|
|
187
|
+
(0, farseerFactory_1.showLoginPrompt)(tenant);
|
|
188
|
+
}
|
|
189
|
+
else if (errorMessage.includes('404')) {
|
|
190
|
+
logger_1.logger.error(`Tenant "${tenant}" not found or not accessible.`);
|
|
191
|
+
}
|
|
192
|
+
else if (errorMessage.includes('ENOTFOUND') || errorMessage.includes('ECONNREFUSED')) {
|
|
193
|
+
logger_1.logger.error('Failed to connect to Farseer.');
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
logger_1.logger.error('Failed to fetch model.');
|
|
197
|
+
logger_1.logger.dim(errorMessage);
|
|
198
|
+
}
|
|
199
|
+
process.exit(1);
|
|
200
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerWhoamiCommand = registerWhoamiCommand;
|
|
4
|
+
const logger_1 = require("../utils/logger");
|
|
5
|
+
const configService_1 = require("../services/configService");
|
|
6
|
+
function registerWhoamiCommand(program) {
|
|
7
|
+
program
|
|
8
|
+
.command('whoami')
|
|
9
|
+
.description('Show current login status and configured tenants')
|
|
10
|
+
.action(async () => {
|
|
11
|
+
logger_1.logger.header('Farseer Status');
|
|
12
|
+
// Check user auth (browser login)
|
|
13
|
+
const userAuth = (0, configService_1.getUserAuth)();
|
|
14
|
+
if (userAuth) {
|
|
15
|
+
if ((0, configService_1.isUserAuthValid)()) {
|
|
16
|
+
const expiresAt = new Date(userAuth.expiresAt);
|
|
17
|
+
logger_1.logger.success('Logged in via browser');
|
|
18
|
+
logger_1.logger.dim(`Token expires: ${expiresAt.toLocaleString()}`);
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
logger_1.logger.warning('Browser login expired');
|
|
22
|
+
logger_1.logger.dim('Run: farseer login');
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
logger_1.logger.dim('Not logged in via browser');
|
|
27
|
+
}
|
|
28
|
+
console.log();
|
|
29
|
+
// List configured tenants (API key)
|
|
30
|
+
const credentials = (0, configService_1.listCredentials)();
|
|
31
|
+
const tenants = Object.keys(credentials);
|
|
32
|
+
if (tenants.length > 0) {
|
|
33
|
+
logger_1.logger.info(`Configured tenants (${tenants.length}):`);
|
|
34
|
+
for (const tenant of tenants) {
|
|
35
|
+
const cred = credentials[tenant];
|
|
36
|
+
const keyPreview = cred.apiKey.substring(0, 8) + '...';
|
|
37
|
+
console.log(` ${tenant}`);
|
|
38
|
+
console.log(` Base: ${cred.basePath}`);
|
|
39
|
+
console.log(` Key: ${keyPreview}`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
logger_1.logger.dim('No tenants configured');
|
|
44
|
+
logger_1.logger.dim('Run: farseer config set <tenant> --api-key <key>');
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
// Suppress punycode deprecation warning (comes from dependencies like axios)
|
|
8
|
+
const originalEmit = process.emit;
|
|
9
|
+
// @ts-expect-error - overriding process.emit
|
|
10
|
+
process.emit = function (name, data, ...args) {
|
|
11
|
+
if (name === 'warning' &&
|
|
12
|
+
typeof data === 'object' &&
|
|
13
|
+
data !== null &&
|
|
14
|
+
'name' in data &&
|
|
15
|
+
data.name === 'DeprecationWarning' &&
|
|
16
|
+
'message' in data &&
|
|
17
|
+
typeof data.message === 'string' &&
|
|
18
|
+
data.message.includes('punycode')) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
// @ts-expect-error - calling original emit
|
|
22
|
+
return originalEmit.apply(process, [name, data, ...args]);
|
|
23
|
+
};
|
|
24
|
+
const commander_1 = require("commander");
|
|
25
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
26
|
+
const constants_1 = require("./utils/constants");
|
|
27
|
+
const login_1 = require("./commands/login");
|
|
28
|
+
const logout_1 = require("./commands/logout");
|
|
29
|
+
const config_1 = require("./commands/config");
|
|
30
|
+
const list_1 = require("./commands/list");
|
|
31
|
+
const files_1 = require("./commands/files");
|
|
32
|
+
const status_1 = require("./commands/status");
|
|
33
|
+
const diff_1 = require("./commands/diff");
|
|
34
|
+
const pull_1 = require("./commands/pull");
|
|
35
|
+
const push_1 = require("./commands/push");
|
|
36
|
+
const run_1 = require("./commands/run");
|
|
37
|
+
const install_1 = require("./commands/install");
|
|
38
|
+
const whoami_1 = require("./commands/whoami");
|
|
39
|
+
const app_1 = require("./commands/app");
|
|
40
|
+
const model_1 = require("./commands/model");
|
|
41
|
+
const variables_1 = require("./commands/variables");
|
|
42
|
+
const dimensions_1 = require("./commands/dimensions");
|
|
43
|
+
const checkout_1 = require("./commands/checkout");
|
|
44
|
+
const mcp_server_1 = require("./commands/mcp-server");
|
|
45
|
+
const program = new commander_1.Command();
|
|
46
|
+
// Configure help to hide default command list (we show our own custom list)
|
|
47
|
+
program.configureHelp({
|
|
48
|
+
visibleCommands: () => [], // Hide all commands from default list
|
|
49
|
+
});
|
|
50
|
+
program
|
|
51
|
+
.name('farseer')
|
|
52
|
+
.description('CLI tool for syncing Farseer App scripts between local folder and Farseer instances')
|
|
53
|
+
.version(constants_1.CLI_VERSION)
|
|
54
|
+
.addHelpText('after', `
|
|
55
|
+
${chalk_1.default.bold.underline('Tenant Resolution')}
|
|
56
|
+
Most commands accept ${chalk_1.default.cyan('[org] [tenant]')} arguments:
|
|
57
|
+
${chalk_1.default.green('$')} farseer checkout ${chalk_1.default.cyan('salvus-2 salvus-prodaja')} ${chalk_1.default.dim('First time: specify <org> <tenant>')}
|
|
58
|
+
${chalk_1.default.green('$')} farseer pull ${chalk_1.default.cyan('salvus-prodaja')} ${chalk_1.default.dim('After that: just <tenant> (org is remembered)')}
|
|
59
|
+
${chalk_1.default.green('$')} farseer push ${chalk_1.default.dim('Or omit entirely if checked out')}
|
|
60
|
+
|
|
61
|
+
${chalk_1.default.bold.underline('Authentication')}
|
|
62
|
+
login Login via browser (OAuth)
|
|
63
|
+
logout [tenant] Logout and remove credentials
|
|
64
|
+
whoami Show login status and configured tenants
|
|
65
|
+
checkout [org] [tenant] Set default tenant (verifies auth & pulls)
|
|
66
|
+
${chalk_1.default.dim('--no-pull')} Skip automatic pull
|
|
67
|
+
|
|
68
|
+
${chalk_1.default.bold.underline('Configuration')} ${chalk_1.default.dim('(farseer config <command>)')}
|
|
69
|
+
config set <tenant> Set API key for a tenant
|
|
70
|
+
${chalk_1.default.dim('--api-key <key>')} API key (required)
|
|
71
|
+
${chalk_1.default.dim('--org <name>')} Organisation if different from tenant
|
|
72
|
+
config remove <tenant> Remove credentials
|
|
73
|
+
config list List all configured tenants
|
|
74
|
+
config show <tenant> Show full credentials (incl. API key)
|
|
75
|
+
config test <tenant> Test connection to tenant
|
|
76
|
+
|
|
77
|
+
${chalk_1.default.bold.underline('Sync Operations')} ${chalk_1.default.dim('(tenant optional if checked out)')}
|
|
78
|
+
pull [org] [tenant] Pull files and apps from remote
|
|
79
|
+
${chalk_1.default.dim('--all')} Download all files (not just .ts/.js)
|
|
80
|
+
${chalk_1.default.dim('--force')} Overwrite local changes on conflicts
|
|
81
|
+
push [org] [tenant] Push local changes to remote
|
|
82
|
+
${chalk_1.default.dim('-y, --yes')} Skip confirmation prompt
|
|
83
|
+
${chalk_1.default.dim('--force')} Push even if remote has changes
|
|
84
|
+
status [tenant] Show sync status (local vs remote)
|
|
85
|
+
${chalk_1.default.dim('--all')} Show all files (not just .ts/.js)
|
|
86
|
+
diff [tenant] [file] Show file differences
|
|
87
|
+
|
|
88
|
+
${chalk_1.default.bold.underline('App Management')} ${chalk_1.default.dim('(tenant optional if checked out)')}
|
|
89
|
+
app list [tenant] List all apps
|
|
90
|
+
${chalk_1.default.dim('--details')} Show details for each app
|
|
91
|
+
app show [tenant] <name> Show app details
|
|
92
|
+
app create [tenant] <name> Create new app
|
|
93
|
+
app configure [tenant] <name> Configure app
|
|
94
|
+
${chalk_1.default.dim('--entrypoint <script>')} Set main script
|
|
95
|
+
${chalk_1.default.dim('--scripts <list>')} Comma-separated scripts
|
|
96
|
+
${chalk_1.default.dim('--add-arg <Name=Value>')} Add argument (repeatable)
|
|
97
|
+
${chalk_1.default.dim('--description <text>')} Set description
|
|
98
|
+
app delete [tenant] <name> Delete app (requires --force)
|
|
99
|
+
|
|
100
|
+
${chalk_1.default.bold.underline('Running & Development')} ${chalk_1.default.dim('(tenant optional if checked out)')}
|
|
101
|
+
run [tenant] <app> Run app locally with injected credentials
|
|
102
|
+
${chalk_1.default.dim('--arg <Name=Value>')} Override argument (repeatable)
|
|
103
|
+
run-script [tenant] <file> Run script directly (no app wrapper)
|
|
104
|
+
install [tenant] Install npm dependencies (npm install)
|
|
105
|
+
|
|
106
|
+
${chalk_1.default.bold.underline('Variables')} ${chalk_1.default.dim('(tenant optional if checked out)')}
|
|
107
|
+
variables list [tenant] List all variables
|
|
108
|
+
variable details <name> Show variable details (dimensions, formula, etc.)
|
|
109
|
+
variable export <name> Export variable data to CSV
|
|
110
|
+
${chalk_1.default.dim('--output <file>')} Output file path
|
|
111
|
+
${chalk_1.default.dim('--format <csv|json|xlsx>')} Output format (default: csv)
|
|
112
|
+
${chalk_1.default.dim('--limit <n>')} Limit number of rows
|
|
113
|
+
|
|
114
|
+
${chalk_1.default.bold.underline('Dimensions')} ${chalk_1.default.dim('(tenant optional if checked out)')}
|
|
115
|
+
dimensions list [tenant] List all dimension tables
|
|
116
|
+
dimension details <name> Show table details (columns, members)
|
|
117
|
+
${chalk_1.default.dim('--members <n>')} Number of sample members (default: 10)
|
|
118
|
+
|
|
119
|
+
${chalk_1.default.bold.underline('Model Inspection')} ${chalk_1.default.dim('(tenant optional if checked out)')}
|
|
120
|
+
model [tenant] Show model structure (dimensions, variables)
|
|
121
|
+
${chalk_1.default.dim('--variables')} List all variables
|
|
122
|
+
${chalk_1.default.dim('--tables')} List all dimension tables
|
|
123
|
+
${chalk_1.default.dim('--variable <name>')} Show dimensions for variable
|
|
124
|
+
|
|
125
|
+
${chalk_1.default.bold.underline('File Management')} ${chalk_1.default.dim('(farseer files <command>)')}
|
|
126
|
+
files list [tenant] List files on remote
|
|
127
|
+
${chalk_1.default.dim('--all')} Show all files (not just scripts)
|
|
128
|
+
|
|
129
|
+
${chalk_1.default.bold.underline('MCP Server')} ${chalk_1.default.dim('(AI assistant integration)')}
|
|
130
|
+
mcp-server Start MCP server for Claude, Cursor, etc.
|
|
131
|
+
|
|
132
|
+
${chalk_1.default.bold.underline('Examples')}
|
|
133
|
+
${chalk_1.default.green('$')} farseer login ${chalk_1.default.dim('Login via browser')}
|
|
134
|
+
${chalk_1.default.green('$')} farseer checkout salvus-2 salvus-prod ${chalk_1.default.dim('First time: org + tenant')}
|
|
135
|
+
${chalk_1.default.green('$')} farseer pull salvus-prod ${chalk_1.default.dim('Next time: just tenant')}
|
|
136
|
+
${chalk_1.default.green('$')} farseer push ${chalk_1.default.dim('If checked out: no args needed')}
|
|
137
|
+
${chalk_1.default.green('$')} farseer push -y ${chalk_1.default.dim('Push without confirmation')}
|
|
138
|
+
${chalk_1.default.green('$')} farseer run "My App" ${chalk_1.default.dim('Run app locally')}
|
|
139
|
+
${chalk_1.default.green('$')} farseer variables list ${chalk_1.default.dim('List all variables')}
|
|
140
|
+
${chalk_1.default.green('$')} farseer variable details "Revenue" ${chalk_1.default.dim('Show variable details')}
|
|
141
|
+
${chalk_1.default.green('$')} farseer dimensions list ${chalk_1.default.dim('List dimension tables')}
|
|
142
|
+
`);
|
|
143
|
+
// Register all commands (hidden from default help, shown in custom help above)
|
|
144
|
+
(0, login_1.registerLoginCommand)(program);
|
|
145
|
+
(0, logout_1.registerLogoutCommand)(program);
|
|
146
|
+
(0, checkout_1.registerCheckoutCommand)(program);
|
|
147
|
+
(0, config_1.registerConfigCommand)(program);
|
|
148
|
+
(0, list_1.registerListCommand)(program);
|
|
149
|
+
(0, files_1.registerFilesCommand)(program);
|
|
150
|
+
(0, app_1.registerAppCommand)(program);
|
|
151
|
+
(0, variables_1.registerVariablesCommand)(program);
|
|
152
|
+
(0, dimensions_1.registerDimensionsCommand)(program);
|
|
153
|
+
(0, model_1.registerModelCommand)(program);
|
|
154
|
+
(0, status_1.registerStatusCommand)(program);
|
|
155
|
+
(0, diff_1.registerDiffCommand)(program);
|
|
156
|
+
(0, pull_1.registerPullCommand)(program);
|
|
157
|
+
(0, push_1.registerPushCommand)(program);
|
|
158
|
+
(0, run_1.registerRunCommand)(program);
|
|
159
|
+
(0, install_1.registerInstallCommand)(program);
|
|
160
|
+
(0, whoami_1.registerWhoamiCommand)(program);
|
|
161
|
+
(0, mcp_server_1.registerMcpServerCommand)(program);
|
|
162
|
+
// Parse arguments
|
|
163
|
+
program.parse();
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* MCP Server Entry Point
|
|
4
|
+
*
|
|
5
|
+
* Starts the Farseer MCP server for AI assistant integration.
|
|
6
|
+
* Uses stdio transport for CLI compatibility.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.startMcpServer = startMcpServer;
|
|
10
|
+
const server_1 = require("./server");
|
|
11
|
+
const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
12
|
+
async function startMcpServer() {
|
|
13
|
+
const server = (0, server_1.createMcpServer)();
|
|
14
|
+
// Use stdio transport for CLI integration
|
|
15
|
+
const transport = new stdio_js_1.StdioServerTransport();
|
|
16
|
+
await server.connect(transport);
|
|
17
|
+
// Log to stderr since stdout is reserved for MCP protocol
|
|
18
|
+
console.error('Farseer MCP server started');
|
|
19
|
+
}
|