farseer-cli 1.0.0

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 (120) hide show
  1. package/LICENSE +15 -0
  2. package/README.md +741 -0
  3. package/dist/commands/app.d.ts +2 -0
  4. package/dist/commands/app.js +349 -0
  5. package/dist/commands/app.js.map +7 -0
  6. package/dist/commands/apps.d.ts +2 -0
  7. package/dist/commands/apps.js +111 -0
  8. package/dist/commands/apps.js.map +7 -0
  9. package/dist/commands/checkout.d.ts +2 -0
  10. package/dist/commands/checkout.js +166 -0
  11. package/dist/commands/checkout.js.map +7 -0
  12. package/dist/commands/config.d.ts +2 -0
  13. package/dist/commands/config.js +139 -0
  14. package/dist/commands/config.js.map +7 -0
  15. package/dist/commands/diff.d.ts +2 -0
  16. package/dist/commands/diff.js +183 -0
  17. package/dist/commands/diff.js.map +7 -0
  18. package/dist/commands/files.js +99 -0
  19. package/dist/commands/files.js.map +7 -0
  20. package/dist/commands/install.d.ts +2 -0
  21. package/dist/commands/install.js +79 -0
  22. package/dist/commands/install.js.map +7 -0
  23. package/dist/commands/list.d.ts +2 -0
  24. package/dist/commands/list.js +92 -0
  25. package/dist/commands/list.js.map +7 -0
  26. package/dist/commands/login.d.ts +2 -0
  27. package/dist/commands/login.js +134 -0
  28. package/dist/commands/login.js.map +7 -0
  29. package/dist/commands/logout.d.ts +2 -0
  30. package/dist/commands/logout.js +59 -0
  31. package/dist/commands/logout.js.map +7 -0
  32. package/dist/commands/mcp-server.d.ts +8 -0
  33. package/dist/commands/mcp-server.js +41 -0
  34. package/dist/commands/mcp-server.js.map +7 -0
  35. package/dist/commands/model.d.ts +2 -0
  36. package/dist/commands/model.js +189 -0
  37. package/dist/commands/model.js.map +7 -0
  38. package/dist/commands/pull.d.ts +2 -0
  39. package/dist/commands/pull.js +287 -0
  40. package/dist/commands/pull.js.map +7 -0
  41. package/dist/commands/push.d.ts +2 -0
  42. package/dist/commands/push.js +251 -0
  43. package/dist/commands/push.js.map +7 -0
  44. package/dist/commands/run.d.ts +2 -0
  45. package/dist/commands/run.js +246 -0
  46. package/dist/commands/run.js.map +7 -0
  47. package/dist/commands/setup.d.ts +2 -0
  48. package/dist/commands/setup.js +137 -0
  49. package/dist/commands/status.d.ts +2 -0
  50. package/dist/commands/status.js +145 -0
  51. package/dist/commands/status.js.map +7 -0
  52. package/dist/commands/unsetup.d.ts +2 -0
  53. package/dist/commands/unsetup.js +122 -0
  54. package/dist/commands/whoami.d.ts +2 -0
  55. package/dist/commands/whoami.js +63 -0
  56. package/dist/commands/whoami.js.map +7 -0
  57. package/dist/index.d.ts +2 -0
  58. package/dist/index.js +135 -0
  59. package/dist/index.js.map +7 -0
  60. package/dist/mcp/index.d.ts +7 -0
  61. package/dist/mcp/index.js +35 -0
  62. package/dist/mcp/index.js.map +7 -0
  63. package/dist/mcp/prompts/workflows.d.ts +7 -0
  64. package/dist/mcp/prompts/workflows.js +374 -0
  65. package/dist/mcp/prompts/workflows.js.map +7 -0
  66. package/dist/mcp/resources/documentation.d.ts +8 -0
  67. package/dist/mcp/resources/documentation.js +167 -0
  68. package/dist/mcp/resources/documentation.js.map +7 -0
  69. package/dist/mcp/server.d.ts +7 -0
  70. package/dist/mcp/server.js +49 -0
  71. package/dist/mcp/server.js.map +7 -0
  72. package/dist/mcp/tools/appTools.d.ts +7 -0
  73. package/dist/mcp/tools/appTools.js +377 -0
  74. package/dist/mcp/tools/appTools.js.map +7 -0
  75. package/dist/mcp/tools/authTools.d.ts +7 -0
  76. package/dist/mcp/tools/authTools.js +158 -0
  77. package/dist/mcp/tools/authTools.js.map +7 -0
  78. package/dist/mcp/tools/modelTools.d.ts +7 -0
  79. package/dist/mcp/tools/modelTools.js +331 -0
  80. package/dist/mcp/tools/modelTools.js.map +7 -0
  81. package/dist/mcp/tools/runTools.d.ts +7 -0
  82. package/dist/mcp/tools/runTools.js +231 -0
  83. package/dist/mcp/tools/runTools.js.map +7 -0
  84. package/dist/mcp/tools/syncTools.d.ts +7 -0
  85. package/dist/mcp/tools/syncTools.js +382 -0
  86. package/dist/mcp/tools/syncTools.js.map +7 -0
  87. package/dist/mcp/utils/helpers.d.ts +69 -0
  88. package/dist/mcp/utils/helpers.js +113 -0
  89. package/dist/mcp/utils/helpers.js.map +7 -0
  90. package/dist/services/appSyncService.d.ts +75 -0
  91. package/dist/services/appSyncService.js +370 -0
  92. package/dist/services/appSyncService.js.map +7 -0
  93. package/dist/services/configService.d.ts +39 -0
  94. package/dist/services/configService.js +196 -0
  95. package/dist/services/configService.js.map +7 -0
  96. package/dist/services/farseerApi.d.ts +166 -0
  97. package/dist/services/farseerApi.js +378 -0
  98. package/dist/services/farseerApi.js.map +7 -0
  99. package/dist/services/farseerFactory.d.ts +88 -0
  100. package/dist/services/farseerFactory.js +179 -0
  101. package/dist/services/farseerFactory.js.map +7 -0
  102. package/dist/services/farseerService.d.ts +96 -0
  103. package/dist/services/farseerService.js +614 -0
  104. package/dist/services/farseerService.js.map +7 -0
  105. package/dist/services/gitService.d.ts +31 -0
  106. package/dist/services/gitService.js +134 -0
  107. package/dist/services/gitService.js.map +7 -0
  108. package/dist/services/syncService.d.ts +44 -0
  109. package/dist/services/syncService.js +320 -0
  110. package/dist/services/syncService.js.map +7 -0
  111. package/dist/utils/constants.d.ts +7 -0
  112. package/dist/utils/constants.js +46 -0
  113. package/dist/utils/constants.js.map +7 -0
  114. package/dist/utils/helpers.d.ts +69 -0
  115. package/dist/utils/helpers.js +413 -0
  116. package/dist/utils/helpers.js.map +7 -0
  117. package/dist/utils/logger.d.ts +14 -0
  118. package/dist/utils/logger.js +76 -0
  119. package/dist/utils/logger.js.map +7 -0
  120. package/package.json +62 -0
@@ -0,0 +1,167 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+ var documentation_exports = {};
29
+ __export(documentation_exports, {
30
+ registerDocumentationResources: () => registerDocumentationResources
31
+ });
32
+ module.exports = __toCommonJS(documentation_exports);
33
+ var fs = __toESM(require("fs"));
34
+ var path = __toESM(require("path"));
35
+ const DOCS = [
36
+ {
37
+ name: "how-farseer-works",
38
+ uri: "farseer://docs/how-farseer-works",
39
+ title: "How Farseer Works",
40
+ description: "Core Farseer concepts: Dimensions, Variables, Formulas, Versions. ESSENTIAL reading for understanding the data model.",
41
+ filePath: "../../../docs/how-farseer-works.md"
42
+ },
43
+ {
44
+ name: "cli-guide",
45
+ uri: "farseer://docs/cli-guide",
46
+ title: "CLI Guide",
47
+ description: "Complete guide to Farseer CLI commands: pull, push, apps, run, model, checkout.",
48
+ filePath: "../../../docs/cli-guide.md"
49
+ },
50
+ {
51
+ name: "api-reference",
52
+ uri: "farseer://docs/api-reference",
53
+ title: "farseer-client API Reference",
54
+ description: "Full API documentation for farseer-client: FarseerClient, queries, imports, dimensions, variables.",
55
+ filePath: "../../../docs/api-reference.md"
56
+ },
57
+ {
58
+ name: "new-app-template",
59
+ uri: "farseer://docs/new-app-template",
60
+ title: "New App Template",
61
+ description: "Template and structure for creating new Farseer apps (Remote Jobs).",
62
+ filePath: "../../../docs/new-app-template.md"
63
+ },
64
+ {
65
+ name: "troubleshooting",
66
+ uri: "farseer://docs/troubleshooting",
67
+ title: "Troubleshooting Guide",
68
+ description: "Common issues and solutions: auth errors, sync conflicts, API errors, performance.",
69
+ filePath: "../../../docs/troubleshooting.md"
70
+ },
71
+ {
72
+ name: "import-workflows",
73
+ uri: "farseer://docs/import-workflows",
74
+ title: "Import Workflows",
75
+ description: "Patterns for data imports: CSV, Excel, API, batch processing, error handling.",
76
+ filePath: "../../../docs/import-workflows.md"
77
+ },
78
+ {
79
+ name: "arquero-patterns",
80
+ uri: "farseer://docs/arquero-patterns",
81
+ title: "Arquero Data Processing",
82
+ description: "Using Arquero for data transformation: filtering, grouping, pivoting, joins.",
83
+ filePath: "../../../docs/arquero-patterns.md"
84
+ },
85
+ {
86
+ name: "query-formulas",
87
+ uri: "farseer://docs/query-formulas",
88
+ title: "Query and Formula Guide",
89
+ description: "Querying data and understanding formulas: filters, aggregations, formula syntax.",
90
+ filePath: "../../../docs/query-formulas.md"
91
+ },
92
+ {
93
+ name: "model-export",
94
+ uri: "farseer://docs/model-export",
95
+ title: "Model Export Guide",
96
+ description: "Understanding model exports: tables, variables, relationships, folder structure.",
97
+ filePath: "../../../docs/model-export.md"
98
+ }
99
+ ];
100
+ function loadDocContent(doc) {
101
+ try {
102
+ const fullPath = path.resolve(__dirname, doc.filePath);
103
+ return fs.readFileSync(fullPath, "utf-8");
104
+ } catch (error) {
105
+ return `# ${doc.title}
106
+
107
+ [Documentation file not found: ${doc.filePath}]
108
+
109
+ This may happen if the CLI was installed globally and documentation files were not included in the package.`;
110
+ }
111
+ }
112
+ function registerDocumentationResources(server) {
113
+ server.resource(
114
+ "farseer-docs-list",
115
+ "farseer://docs",
116
+ {
117
+ description: "List of all available Farseer documentation",
118
+ mimeType: "application/json"
119
+ },
120
+ () => {
121
+ return {
122
+ contents: [
123
+ {
124
+ uri: "farseer://docs",
125
+ mimeType: "application/json",
126
+ text: JSON.stringify(
127
+ DOCS.map((doc) => ({
128
+ name: doc.name,
129
+ uri: doc.uri,
130
+ title: doc.title,
131
+ description: doc.description
132
+ })),
133
+ null,
134
+ 2
135
+ )
136
+ }
137
+ ]
138
+ };
139
+ }
140
+ );
141
+ for (const doc of DOCS) {
142
+ server.resource(
143
+ doc.name,
144
+ doc.uri,
145
+ {
146
+ description: doc.description,
147
+ mimeType: "text/markdown"
148
+ },
149
+ () => {
150
+ return {
151
+ contents: [
152
+ {
153
+ uri: doc.uri,
154
+ mimeType: "text/markdown",
155
+ text: loadDocContent(doc)
156
+ }
157
+ ]
158
+ };
159
+ }
160
+ );
161
+ }
162
+ }
163
+ // Annotate the CommonJS export names for ESM import in node:
164
+ 0 && (module.exports = {
165
+ registerDocumentationResources
166
+ });
167
+ //# sourceMappingURL=documentation.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/mcp/resources/documentation.ts"],
4
+ "sourcesContent": ["/**\n * Documentation Resources\n *\n * Exposes Farseer documentation as MCP resources for AI assistants.\n * Documentation is read from files at runtime (bundled with npm package).\n */\n\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport * as fs from 'fs';\nimport * as path from 'path';\n\ninterface DocResource {\n name: string;\n uri: string;\n title: string;\n description: string;\n filePath: string;\n}\n\n// Documentation metadata - actual content loaded on demand\nconst DOCS: DocResource[] = [\n {\n name: 'how-farseer-works',\n uri: 'farseer://docs/how-farseer-works',\n title: 'How Farseer Works',\n description:\n 'Core Farseer concepts: Dimensions, Variables, Formulas, Versions. ESSENTIAL reading for understanding the data model.',\n filePath: '../../../docs/how-farseer-works.md',\n },\n {\n name: 'cli-guide',\n uri: 'farseer://docs/cli-guide',\n title: 'CLI Guide',\n description: 'Complete guide to Farseer CLI commands: pull, push, apps, run, model, checkout.',\n filePath: '../../../docs/cli-guide.md',\n },\n {\n name: 'api-reference',\n uri: 'farseer://docs/api-reference',\n title: 'farseer-client API Reference',\n description:\n 'Full API documentation for farseer-client: FarseerClient, queries, imports, dimensions, variables.',\n filePath: '../../../docs/api-reference.md',\n },\n {\n name: 'new-app-template',\n uri: 'farseer://docs/new-app-template',\n title: 'New App Template',\n description: 'Template and structure for creating new Farseer apps (Remote Jobs).',\n filePath: '../../../docs/new-app-template.md',\n },\n {\n name: 'troubleshooting',\n uri: 'farseer://docs/troubleshooting',\n title: 'Troubleshooting Guide',\n description: 'Common issues and solutions: auth errors, sync conflicts, API errors, performance.',\n filePath: '../../../docs/troubleshooting.md',\n },\n {\n name: 'import-workflows',\n uri: 'farseer://docs/import-workflows',\n title: 'Import Workflows',\n description: 'Patterns for data imports: CSV, Excel, API, batch processing, error handling.',\n filePath: '../../../docs/import-workflows.md',\n },\n {\n name: 'arquero-patterns',\n uri: 'farseer://docs/arquero-patterns',\n title: 'Arquero Data Processing',\n description: 'Using Arquero for data transformation: filtering, grouping, pivoting, joins.',\n filePath: '../../../docs/arquero-patterns.md',\n },\n {\n name: 'query-formulas',\n uri: 'farseer://docs/query-formulas',\n title: 'Query and Formula Guide',\n description: 'Querying data and understanding formulas: filters, aggregations, formula syntax.',\n filePath: '../../../docs/query-formulas.md',\n },\n {\n name: 'model-export',\n uri: 'farseer://docs/model-export',\n title: 'Model Export Guide',\n description: 'Understanding model exports: tables, variables, relationships, folder structure.',\n filePath: '../../../docs/model-export.md',\n },\n];\n\nfunction loadDocContent(doc: DocResource): string {\n try {\n const fullPath = path.resolve(__dirname, doc.filePath);\n return fs.readFileSync(fullPath, 'utf-8');\n } catch (error) {\n return `# ${doc.title}\\n\\n[Documentation file not found: ${doc.filePath}]\\n\\nThis may happen if the CLI was installed globally and documentation files were not included in the package.`;\n }\n}\n\nexport function registerDocumentationResources(server: McpServer): void {\n // Register list of all docs\n server.resource(\n 'farseer-docs-list',\n 'farseer://docs',\n {\n description: 'List of all available Farseer documentation',\n mimeType: 'application/json',\n },\n () => {\n return {\n contents: [\n {\n uri: 'farseer://docs',\n mimeType: 'application/json',\n text: JSON.stringify(\n DOCS.map((doc) => ({\n name: doc.name,\n uri: doc.uri,\n title: doc.title,\n description: doc.description,\n })),\n null,\n 2\n ),\n },\n ],\n };\n }\n );\n\n // Register each doc individually\n for (const doc of DOCS) {\n server.resource(\n doc.name,\n doc.uri,\n {\n description: doc.description,\n mimeType: 'text/markdown',\n },\n () => {\n return {\n contents: [\n {\n uri: doc.uri,\n mimeType: 'text/markdown',\n text: loadDocContent(doc),\n },\n ],\n };\n }\n );\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA,SAAoB;AACpB,WAAsB;AAWtB,MAAM,OAAsB;AAAA,EACxB;AAAA,IACI,MAAM;AAAA,IACN,KAAK;AAAA,IACL,OAAO;AAAA,IACP,aACI;AAAA,IACJ,UAAU;AAAA,EACd;AAAA,EACA;AAAA,IACI,MAAM;AAAA,IACN,KAAK;AAAA,IACL,OAAO;AAAA,IACP,aAAa;AAAA,IACb,UAAU;AAAA,EACd;AAAA,EACA;AAAA,IACI,MAAM;AAAA,IACN,KAAK;AAAA,IACL,OAAO;AAAA,IACP,aACI;AAAA,IACJ,UAAU;AAAA,EACd;AAAA,EACA;AAAA,IACI,MAAM;AAAA,IACN,KAAK;AAAA,IACL,OAAO;AAAA,IACP,aAAa;AAAA,IACb,UAAU;AAAA,EACd;AAAA,EACA;AAAA,IACI,MAAM;AAAA,IACN,KAAK;AAAA,IACL,OAAO;AAAA,IACP,aAAa;AAAA,IACb,UAAU;AAAA,EACd;AAAA,EACA;AAAA,IACI,MAAM;AAAA,IACN,KAAK;AAAA,IACL,OAAO;AAAA,IACP,aAAa;AAAA,IACb,UAAU;AAAA,EACd;AAAA,EACA;AAAA,IACI,MAAM;AAAA,IACN,KAAK;AAAA,IACL,OAAO;AAAA,IACP,aAAa;AAAA,IACb,UAAU;AAAA,EACd;AAAA,EACA;AAAA,IACI,MAAM;AAAA,IACN,KAAK;AAAA,IACL,OAAO;AAAA,IACP,aAAa;AAAA,IACb,UAAU;AAAA,EACd;AAAA,EACA;AAAA,IACI,MAAM;AAAA,IACN,KAAK;AAAA,IACL,OAAO;AAAA,IACP,aAAa;AAAA,IACb,UAAU;AAAA,EACd;AACJ;AAEA,SAAS,eAAe,KAA0B;AAC9C,MAAI;AACA,UAAM,WAAW,KAAK,QAAQ,WAAW,IAAI,QAAQ;AACrD,WAAO,GAAG,aAAa,UAAU,OAAO;AAAA,EAC5C,SAAS,OAAO;AACZ,WAAO,KAAK,IAAI,KAAK;AAAA;AAAA,iCAAsC,IAAI,QAAQ;AAAA;AAAA;AAAA,EAC3E;AACJ;AAEO,SAAS,+BAA+B,QAAyB;AAEpE,SAAO;AAAA,IACH;AAAA,IACA;AAAA,IACA;AAAA,MACI,aAAa;AAAA,MACb,UAAU;AAAA,IACd;AAAA,IACA,MAAM;AACF,aAAO;AAAA,QACH,UAAU;AAAA,UACN;AAAA,YACI,KAAK;AAAA,YACL,UAAU;AAAA,YACV,MAAM,KAAK;AAAA,cACP,KAAK,IAAI,CAAC,SAAS;AAAA,gBACf,MAAM,IAAI;AAAA,gBACV,KAAK,IAAI;AAAA,gBACT,OAAO,IAAI;AAAA,gBACX,aAAa,IAAI;AAAA,cACrB,EAAE;AAAA,cACF;AAAA,cACA;AAAA,YACJ;AAAA,UACJ;AAAA,QACJ;AAAA,MACJ;AAAA,IACJ;AAAA,EACJ;AAGA,aAAW,OAAO,MAAM;AACpB,WAAO;AAAA,MACH,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ;AAAA,QACI,aAAa,IAAI;AAAA,QACjB,UAAU;AAAA,MACd;AAAA,MACA,MAAM;AACF,eAAO;AAAA,UACH,UAAU;AAAA,YACN;AAAA,cACI,KAAK,IAAI;AAAA,cACT,UAAU;AAAA,cACV,MAAM,eAAe,GAAG;AAAA,YAC5B;AAAA,UACJ;AAAA,QACJ;AAAA,MACJ;AAAA,IACJ;AAAA,EACJ;AACJ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * MCP Server Configuration
3
+ *
4
+ * Creates and configures the Farseer MCP server with all tools, resources, and prompts.
5
+ */
6
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
7
+ export declare function createMcpServer(): McpServer;
@@ -0,0 +1,49 @@
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 server_exports = {};
19
+ __export(server_exports, {
20
+ createMcpServer: () => createMcpServer
21
+ });
22
+ module.exports = __toCommonJS(server_exports);
23
+ var import_mcp = require("@modelcontextprotocol/sdk/server/mcp.js");
24
+ var import_authTools = require("./tools/authTools");
25
+ var import_syncTools = require("./tools/syncTools");
26
+ var import_appTools = require("./tools/appTools");
27
+ var import_modelTools = require("./tools/modelTools");
28
+ var import_runTools = require("./tools/runTools");
29
+ var import_documentation = require("./resources/documentation");
30
+ var import_workflows = require("./prompts/workflows");
31
+ function createMcpServer() {
32
+ const server = new import_mcp.McpServer({
33
+ name: "farseer-cli",
34
+ version: "1.0.0"
35
+ });
36
+ (0, import_authTools.registerAuthTools)(server);
37
+ (0, import_syncTools.registerSyncTools)(server);
38
+ (0, import_appTools.registerAppTools)(server);
39
+ (0, import_modelTools.registerModelTools)(server);
40
+ (0, import_runTools.registerRunTools)(server);
41
+ (0, import_documentation.registerDocumentationResources)(server);
42
+ (0, import_workflows.registerWorkflowPrompts)(server);
43
+ return server;
44
+ }
45
+ // Annotate the CommonJS export names for ESM import in node:
46
+ 0 && (module.exports = {
47
+ createMcpServer
48
+ });
49
+ //# sourceMappingURL=server.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/mcp/server.ts"],
4
+ "sourcesContent": ["/**\n * MCP Server Configuration\n *\n * Creates and configures the Farseer MCP server with all tools, resources, and prompts.\n */\n\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { registerAuthTools } from './tools/authTools';\nimport { registerSyncTools } from './tools/syncTools';\nimport { registerAppTools } from './tools/appTools';\nimport { registerModelTools } from './tools/modelTools';\nimport { registerRunTools } from './tools/runTools';\nimport { registerDocumentationResources } from './resources/documentation';\nimport { registerWorkflowPrompts } from './prompts/workflows';\n\nexport function createMcpServer(): McpServer {\n const server = new McpServer({\n name: 'farseer-cli',\n version: '1.0.0',\n });\n\n // Register all tools\n registerAuthTools(server);\n registerSyncTools(server);\n registerAppTools(server);\n registerModelTools(server);\n registerRunTools(server);\n\n // Register resources (documentation)\n registerDocumentationResources(server);\n\n // Register prompts (workflow templates)\n registerWorkflowPrompts(server);\n\n return server;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,iBAA0B;AAC1B,uBAAkC;AAClC,uBAAkC;AAClC,sBAAiC;AACjC,wBAAmC;AACnC,sBAAiC;AACjC,2BAA+C;AAC/C,uBAAwC;AAEjC,SAAS,kBAA6B;AACzC,QAAM,SAAS,IAAI,qBAAU;AAAA,IACzB,MAAM;AAAA,IACN,SAAS;AAAA,EACb,CAAC;AAGD,0CAAkB,MAAM;AACxB,0CAAkB,MAAM;AACxB,wCAAiB,MAAM;AACvB,4CAAmB,MAAM;AACzB,wCAAiB,MAAM;AAGvB,2DAA+B,MAAM;AAGrC,gDAAwB,MAAM;AAE9B,SAAO;AACX;",
6
+ "names": []
7
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * App Management Tools
3
+ *
4
+ * Tools for managing Farseer apps (Remote Jobs).
5
+ */
6
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
7
+ export declare function registerAppTools(server: McpServer): void;
@@ -0,0 +1,377 @@
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 appTools_exports = {};
19
+ __export(appTools_exports, {
20
+ registerAppTools: () => registerAppTools
21
+ });
22
+ module.exports = __toCommonJS(appTools_exports);
23
+ var import_zod = require("zod");
24
+ var import_farseerFactory = require("../../services/farseerFactory");
25
+ var import_configService = require("../../services/configService");
26
+ var import_helpers = require("../utils/helpers");
27
+ const listAppsSchema = {
28
+ tenant: import_zod.z.string().optional().describe("Tenant name"),
29
+ details: import_zod.z.boolean().optional().describe("Include full details for each app")
30
+ };
31
+ const getAppSchema = {
32
+ tenant: import_zod.z.string().optional().describe("Tenant name"),
33
+ appName: import_zod.z.string().describe("Name of the app (can include spaces)")
34
+ };
35
+ const createAppSchema = {
36
+ tenant: import_zod.z.string().optional().describe("Tenant name"),
37
+ appName: import_zod.z.string().describe("Name for the new app")
38
+ };
39
+ const argumentSchema = import_zod.z.object({
40
+ name: import_zod.z.string(),
41
+ defaultValue: import_zod.z.string()
42
+ });
43
+ const configureAppSchema = {
44
+ tenant: import_zod.z.string().optional().describe("Tenant name"),
45
+ appName: import_zod.z.string().describe("Name of the app to configure"),
46
+ entrypoint: import_zod.z.string().optional().describe('Main script filename (e.g., "index.ts")'),
47
+ scripts: import_zod.z.array(import_zod.z.string()).optional().describe("List of script filenames to include"),
48
+ description: import_zod.z.string().optional().describe("App description"),
49
+ arguments: import_zod.z.array(argumentSchema).optional().describe("App arguments with default values"),
50
+ newName: import_zod.z.string().optional().describe("Rename the app")
51
+ };
52
+ const deleteAppSchema = {
53
+ tenant: import_zod.z.string().optional().describe("Tenant name"),
54
+ appName: import_zod.z.string().describe("Name of the app to delete")
55
+ };
56
+ function registerAppTools(server) {
57
+ server.tool(
58
+ "farseer_list_apps",
59
+ `List all apps (Remote Jobs) configured on a Farseer tenant.
60
+
61
+ Apps are executable script configurations that include:
62
+ - Entry point script
63
+ - List of included scripts
64
+ - Expected arguments with default values
65
+
66
+ Use details=true to include full information for each app.
67
+
68
+ If no tenant is specified, uses the currently checked-out tenant.`,
69
+ listAppsSchema,
70
+ async (params) => {
71
+ const { tenant: tenantArg, details } = params;
72
+ const checkout = (0, import_configService.getCurrentCheckout)();
73
+ const tenant = tenantArg || checkout?.tenant;
74
+ const organisation = tenantArg || checkout?.organisation;
75
+ if (!tenant || !organisation) {
76
+ return (0, import_helpers.tenantRequiredResponse)();
77
+ }
78
+ const clientResult = await (0, import_farseerFactory.getFarseerClientWithFallback)(organisation, tenant);
79
+ if (!clientResult) {
80
+ return (0, import_helpers.authRequiredResponse)(tenant);
81
+ }
82
+ try {
83
+ const appList = await clientResult.client.listApps();
84
+ if (!details) {
85
+ return (0, import_helpers.successResponse)({
86
+ tenant,
87
+ totalApps: appList.length,
88
+ apps: appList.map((a) => ({
89
+ name: a.name,
90
+ id: a.id,
91
+ reference: a.reference
92
+ }))
93
+ });
94
+ }
95
+ const appsWithDetails = [];
96
+ for (const item of appList) {
97
+ const app = await clientResult.client.getApp(item.reference);
98
+ if (app) {
99
+ const mainScript = app.scriptFiles.find((s) => s.id === app.mainScriptFileId);
100
+ appsWithDetails.push({
101
+ name: app.name,
102
+ id: app.id,
103
+ description: app.description || "",
104
+ entrypoint: mainScript?.name || null,
105
+ scripts: app.scriptFiles.map((s) => s.name),
106
+ arguments: app.expectedArguments.map((a) => ({
107
+ name: a.name,
108
+ defaultValue: a.defaultValue
109
+ }))
110
+ });
111
+ }
112
+ }
113
+ return (0, import_helpers.successResponse)({
114
+ tenant,
115
+ totalApps: appsWithDetails.length,
116
+ apps: appsWithDetails
117
+ });
118
+ } catch (error) {
119
+ return (0, import_helpers.errorResponse)(
120
+ `List apps failed: ${error instanceof Error ? error.message : "Unknown error"}`,
121
+ "NETWORK_ERROR"
122
+ );
123
+ }
124
+ }
125
+ );
126
+ server.tool(
127
+ "farseer_get_app",
128
+ `Get detailed information about a specific Farseer app.
129
+
130
+ Returns:
131
+ - App name and description
132
+ - Entry point script (main script that runs)
133
+ - List of all included scripts
134
+ - Expected arguments with their default values
135
+
136
+ If no tenant is specified, uses the currently checked-out tenant.`,
137
+ getAppSchema,
138
+ async (params) => {
139
+ const { tenant: tenantArg, appName } = params;
140
+ const checkout = (0, import_configService.getCurrentCheckout)();
141
+ const tenant = tenantArg || checkout?.tenant;
142
+ const organisation = tenantArg || checkout?.organisation;
143
+ if (!tenant || !organisation) {
144
+ return (0, import_helpers.tenantRequiredResponse)();
145
+ }
146
+ const clientResult = await (0, import_farseerFactory.getFarseerClientWithFallback)(organisation, tenant);
147
+ if (!clientResult) {
148
+ return (0, import_helpers.authRequiredResponse)(tenant);
149
+ }
150
+ try {
151
+ const app = await clientResult.client.getAppByName(appName);
152
+ if (!app) {
153
+ return (0, import_helpers.errorResponse)(`App "${appName}" not found`, "NOT_FOUND");
154
+ }
155
+ const mainScript = app.scriptFiles.find((s) => s.id === app.mainScriptFileId);
156
+ return (0, import_helpers.successResponse)({
157
+ tenant,
158
+ app: {
159
+ id: app.id,
160
+ name: app.name,
161
+ description: app.description || "",
162
+ entrypoint: mainScript?.name || null,
163
+ scripts: app.scriptFiles.map((s) => ({
164
+ id: s.id,
165
+ name: s.name,
166
+ isEntrypoint: s.id === app.mainScriptFileId
167
+ })),
168
+ arguments: app.expectedArguments.map((a) => ({
169
+ name: a.name,
170
+ type: a.type,
171
+ defaultValue: a.defaultValue
172
+ })),
173
+ status: app.status,
174
+ lastHeartbeat: app.lastHeartbeat
175
+ }
176
+ });
177
+ } catch (error) {
178
+ return (0, import_helpers.errorResponse)(
179
+ `Get app failed: ${error instanceof Error ? error.message : "Unknown error"}`,
180
+ "NETWORK_ERROR"
181
+ );
182
+ }
183
+ }
184
+ );
185
+ server.tool(
186
+ "farseer_create_app",
187
+ `Create a new app (Remote Job) on a Farseer tenant.
188
+
189
+ This creates an empty app shell. After creation, use farseer_configure_app to:
190
+ - Set the entry point script
191
+ - Add scripts to the app
192
+ - Configure arguments
193
+
194
+ Scripts must exist on the remote (push them first if they're new).
195
+
196
+ If no tenant is specified, uses the currently checked-out tenant.`,
197
+ createAppSchema,
198
+ async (params) => {
199
+ const { tenant: tenantArg, appName } = params;
200
+ const checkout = (0, import_configService.getCurrentCheckout)();
201
+ const tenant = tenantArg || checkout?.tenant;
202
+ const organisation = tenantArg || checkout?.organisation;
203
+ if (!tenant || !organisation) {
204
+ return (0, import_helpers.tenantRequiredResponse)();
205
+ }
206
+ const clientResult = await (0, import_farseerFactory.getFarseerClientWithFallback)(organisation, tenant);
207
+ if (!clientResult) {
208
+ return (0, import_helpers.authRequiredResponse)(tenant);
209
+ }
210
+ try {
211
+ const existing = await clientResult.client.getAppByName(appName);
212
+ if (existing) {
213
+ return (0, import_helpers.errorResponse)(`App "${appName}" already exists`, "VALIDATION_ERROR");
214
+ }
215
+ const app = await clientResult.client.createApp(appName);
216
+ return (0, import_helpers.successResponse)({
217
+ tenant,
218
+ app: {
219
+ id: app.id,
220
+ name: app.name
221
+ },
222
+ message: `App "${appName}" created. Use farseer_configure_app to set entrypoint, scripts, and arguments.`
223
+ });
224
+ } catch (error) {
225
+ return (0, import_helpers.errorResponse)(
226
+ `Create app failed: ${error instanceof Error ? error.message : "Unknown error"}`,
227
+ "NETWORK_ERROR"
228
+ );
229
+ }
230
+ }
231
+ );
232
+ server.tool(
233
+ "farseer_configure_app",
234
+ `Configure an existing Farseer app.
235
+
236
+ You can set:
237
+ - entrypoint: Main script to execute (e.g., "index.ts")
238
+ - scripts: List of scripts to include in the app
239
+ - description: App description
240
+ - arguments: List of expected arguments with default values
241
+ - newName: Rename the app
242
+
243
+ Important:
244
+ - Scripts must exist on the remote (push them first)
245
+ - If you set scripts but not entrypoint, the first script becomes entrypoint
246
+ - Arguments are passed to the script via command line
247
+
248
+ If no tenant is specified, uses the currently checked-out tenant.`,
249
+ configureAppSchema,
250
+ async (params) => {
251
+ const { tenant: tenantArg, appName, entrypoint, scripts, description, arguments: args, newName } = params;
252
+ const checkout = (0, import_configService.getCurrentCheckout)();
253
+ const tenant = tenantArg || checkout?.tenant;
254
+ const organisation = tenantArg || checkout?.organisation;
255
+ if (!tenant || !organisation) {
256
+ return (0, import_helpers.tenantRequiredResponse)();
257
+ }
258
+ const clientResult = await (0, import_farseerFactory.getFarseerClientWithFallback)(organisation, tenant);
259
+ if (!clientResult) {
260
+ return (0, import_helpers.authRequiredResponse)(tenant);
261
+ }
262
+ try {
263
+ const app = await clientResult.client.getAppByName(appName);
264
+ if (!app) {
265
+ return (0, import_helpers.errorResponse)(`App "${appName}" not found`, "NOT_FOUND");
266
+ }
267
+ const availableScripts = await clientResult.client.getScriptFiles();
268
+ const scriptIdMap = new Map(availableScripts.map((s) => [s.name.toLowerCase(), s.id]));
269
+ const update = {};
270
+ if (newName) {
271
+ update.name = newName;
272
+ }
273
+ if (description !== void 0) {
274
+ update.description = description;
275
+ }
276
+ if (args) {
277
+ update.expectedArguments = args.map((a) => ({
278
+ name: a.name,
279
+ type: "variable",
280
+ defaultValue: a.defaultValue
281
+ }));
282
+ }
283
+ if (scripts && scripts.length > 0) {
284
+ const scriptIds = [];
285
+ const notFound = [];
286
+ for (const scriptName of scripts) {
287
+ const id = scriptIdMap.get(scriptName.toLowerCase());
288
+ if (id) {
289
+ scriptIds.push(id);
290
+ } else {
291
+ notFound.push(scriptName);
292
+ }
293
+ }
294
+ if (notFound.length > 0) {
295
+ return (0, import_helpers.errorResponse)(
296
+ `Scripts not found on remote: ${notFound.join(", ")}. Push them first.`,
297
+ "VALIDATION_ERROR"
298
+ );
299
+ }
300
+ update.scriptFileIds = scriptIds;
301
+ if (!entrypoint && scriptIds.length > 0) {
302
+ update.mainScriptFileId = scriptIds[0];
303
+ }
304
+ }
305
+ if (entrypoint) {
306
+ const entrypointId = scriptIdMap.get(entrypoint.toLowerCase());
307
+ if (!entrypointId) {
308
+ return (0, import_helpers.errorResponse)(
309
+ `Entrypoint script "${entrypoint}" not found on remote. Push it first.`,
310
+ "VALIDATION_ERROR"
311
+ );
312
+ }
313
+ update.mainScriptFileId = entrypointId;
314
+ }
315
+ const reference = app.id.toString();
316
+ await clientResult.client.updateApp(reference, update);
317
+ return (0, import_helpers.successResponse)({
318
+ tenant,
319
+ appName: newName || appName,
320
+ updated: Object.keys(update),
321
+ message: `App "${appName}" configured successfully`
322
+ });
323
+ } catch (error) {
324
+ return (0, import_helpers.errorResponse)(
325
+ `Configure app failed: ${error instanceof Error ? error.message : "Unknown error"}`,
326
+ "NETWORK_ERROR"
327
+ );
328
+ }
329
+ }
330
+ );
331
+ server.tool(
332
+ "farseer_delete_app",
333
+ `Delete an app from a Farseer tenant.
334
+
335
+ WARNING: This is irreversible - the app will be permanently removed from the remote instance.
336
+
337
+ This does NOT delete the script files, only the app configuration.
338
+
339
+ If no tenant is specified, uses the currently checked-out tenant.`,
340
+ deleteAppSchema,
341
+ async (params) => {
342
+ const { tenant: tenantArg, appName } = params;
343
+ const checkout = (0, import_configService.getCurrentCheckout)();
344
+ const tenant = tenantArg || checkout?.tenant;
345
+ const organisation = tenantArg || checkout?.organisation;
346
+ if (!tenant || !organisation) {
347
+ return (0, import_helpers.tenantRequiredResponse)();
348
+ }
349
+ const clientResult = await (0, import_farseerFactory.getFarseerClientWithFallback)(organisation, tenant);
350
+ if (!clientResult) {
351
+ return (0, import_helpers.authRequiredResponse)(tenant);
352
+ }
353
+ try {
354
+ const app = await clientResult.client.getAppByName(appName);
355
+ if (!app) {
356
+ return (0, import_helpers.errorResponse)(`App "${appName}" not found`, "NOT_FOUND");
357
+ }
358
+ await clientResult.client.deleteApp(app.id.toString());
359
+ return (0, import_helpers.successResponse)({
360
+ tenant,
361
+ deletedApp: appName,
362
+ message: `App "${appName}" has been deleted`
363
+ });
364
+ } catch (error) {
365
+ return (0, import_helpers.errorResponse)(
366
+ `Delete app failed: ${error instanceof Error ? error.message : "Unknown error"}`,
367
+ "NETWORK_ERROR"
368
+ );
369
+ }
370
+ }
371
+ );
372
+ }
373
+ // Annotate the CommonJS export names for ESM import in node:
374
+ 0 && (module.exports = {
375
+ registerAppTools
376
+ });
377
+ //# sourceMappingURL=appTools.js.map