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
package/README.md ADDED
@@ -0,0 +1,741 @@
1
+ # Farseer CLI
2
+
3
+ Command-line tool for managing Farseer Apps and scripts. Includes AI assistant integration via MCP (Model Context Protocol).
4
+
5
+ [![npm version](https://img.shields.io/npm/v/farseer-cli.svg)](https://www.npmjs.com/package/farseer-cli)
6
+ [![License: ISC](https://img.shields.io/badge/License-ISC-blue.svg)](https://opensource.org/licenses/ISC)
7
+
8
+ ## Features
9
+
10
+ - **Bidirectional Sync** - Pull/push scripts and apps between local folder and Farseer instances
11
+ - **AI Assistant Integration** - Native MCP support for Claude, Cursor, and other AI tools
12
+ - **App Management** - Create, configure, and run Farseer apps from CLI
13
+ - **Model Inspection** - Explore dimensions, variables, and formulas
14
+ - **Multiple Auth Methods** - Browser OAuth (JWT) and API key authentication
15
+ - **Local Development** - Run apps locally with automatic credential injection
16
+
17
+ ---
18
+
19
+ ## Table of Contents
20
+
21
+ 1. [Installation](#installation)
22
+ 2. [Quick Start](#quick-start)
23
+ 3. [MCP Setup (AI Assistants)](#mcp-setup-ai-assistants)
24
+ 4. [Authentication](#authentication)
25
+ 5. [Commands Reference](#commands-reference)
26
+ 6. [App Management](#app-management)
27
+ 7. [Model Inspection](#model-inspection)
28
+ 8. [MCP Tools & Resources](#mcp-tools--resources)
29
+ 9. [File Structure](#file-structure)
30
+ 10. [Configuration](#configuration)
31
+ 11. [Troubleshooting](#troubleshooting)
32
+
33
+ ---
34
+
35
+ ## Installation
36
+
37
+ ### Global Installation (Recommended)
38
+
39
+ ```bash
40
+ npm install -g farseer-cli
41
+ ```
42
+
43
+ Verify installation:
44
+
45
+ ```bash
46
+ farseer --version
47
+ ```
48
+
49
+ ### Local Installation (for CI/CD)
50
+
51
+ ```bash
52
+ npm install farseer-cli
53
+ npx farseer --version
54
+ ```
55
+
56
+ ---
57
+
58
+ ## Quick Start
59
+
60
+ ### 1. Login
61
+
62
+ ```bash
63
+ farseer login
64
+ ```
65
+
66
+ This opens your browser for OAuth authentication. After successful login, your credentials are saved locally.
67
+
68
+ ### 2. Select Tenant
69
+
70
+ ```bash
71
+ farseer checkout my-tenant
72
+ ```
73
+
74
+ This sets `my-tenant` as your default tenant and automatically pulls all scripts and apps.
75
+
76
+ ### 3. Install Dependencies
77
+
78
+ ```bash
79
+ farseer install
80
+ ```
81
+
82
+ Installs npm packages required for local script execution.
83
+
84
+ ### 4. List Apps
85
+
86
+ ```bash
87
+ farseer app list
88
+ ```
89
+
90
+ ### 5. Run an App
91
+
92
+ ```bash
93
+ farseer run "My Import App"
94
+ ```
95
+
96
+ ---
97
+
98
+ ## MCP Setup (AI Assistants)
99
+
100
+ Enable AI assistants (Claude, Cursor) to directly interact with Farseer.
101
+
102
+ ### Claude Desktop
103
+
104
+ Add to config file:
105
+ - **macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`
106
+ - **Windows:** `%APPDATA%\Claude\claude_desktop_config.json`
107
+
108
+ ```json
109
+ {
110
+ "mcpServers": {
111
+ "farseer": {
112
+ "command": "farseer",
113
+ "args": ["mcp-server"]
114
+ }
115
+ }
116
+ }
117
+ ```
118
+
119
+ Restart Claude Desktop.
120
+
121
+ ### Cursor
122
+
123
+ Add to `.cursor/mcp_config.json` (project) or `~/.cursor/mcp_config.json` (global):
124
+
125
+ ```json
126
+ {
127
+ "mcpServers": {
128
+ "farseer": {
129
+ "command": "farseer",
130
+ "args": ["mcp-server"]
131
+ }
132
+ }
133
+ }
134
+ ```
135
+
136
+ ### Claude Code (CLI)
137
+
138
+ Add to `~/.claude/config.json`:
139
+
140
+ ```json
141
+ {
142
+ "mcpServers": {
143
+ "farseer": {
144
+ "command": "farseer",
145
+ "args": ["mcp-server"]
146
+ }
147
+ }
148
+ }
149
+ ```
150
+
151
+ Once configured, you can ask the AI assistant things like:
152
+ - *"List my Farseer apps"*
153
+ - *"Pull latest scripts from my-tenant"*
154
+ - *"Create an import script for Sales Amount variable"*
155
+
156
+ See [MCP Tools & Resources](#mcp-tools--resources) for full list of available tools.
157
+
158
+ ---
159
+
160
+ ## Authentication
161
+
162
+ Farseer CLI supports two authentication methods:
163
+
164
+ ### Browser Login (JWT) - Recommended
165
+
166
+ ```bash
167
+ # Default realm (master)
168
+ farseer login
169
+
170
+ # Specific realm (e.g., acme, corp)
171
+ farseer login --realm acme
172
+ ```
173
+
174
+ Opens Keycloak login in browser. Features:
175
+ - Automatic token refresh
176
+ - Access to all tenants you have permissions for
177
+ - Full functionality (scripts + apps)
178
+
179
+ ### API Key Login
180
+
181
+ ```bash
182
+ farseer login --api-key
183
+ ```
184
+
185
+ Interactive prompt for tenant, organisation, and API key. Useful for:
186
+ - CI/CD environments
187
+ - Headless servers
188
+ - Service accounts
189
+
190
+ **Note:** API keys can only sync files. For app management, use browser login.
191
+
192
+ ### Check Authentication Status
193
+
194
+ ```bash
195
+ farseer whoami
196
+ ```
197
+
198
+ Output:
199
+ ```
200
+ Authentication Status
201
+
202
+ User Token:
203
+ ✓ Valid JWT token
204
+ Email: john@example.com
205
+ Expires: 2025-01-28 10:00:00
206
+
207
+ Configured Tenants:
208
+ ✓ my-tenant (API key)
209
+ ```
210
+
211
+ ### Logout
212
+
213
+ ```bash
214
+ # Clear JWT token
215
+ farseer logout
216
+
217
+ # Remove specific tenant credentials
218
+ farseer logout my-tenant
219
+
220
+ # Remove all credentials
221
+ farseer logout --all
222
+ ```
223
+
224
+ ---
225
+
226
+ ## Commands Reference
227
+
228
+ ### Tenant Management
229
+
230
+ #### `farseer checkout [org] <tenant>`
231
+
232
+ Set default tenant. Automatically pulls files and apps.
233
+
234
+ ```bash
235
+ # When organisation = tenant name
236
+ farseer checkout my-tenant
237
+
238
+ # When organisation differs from tenant
239
+ farseer checkout my-org my-tenant
240
+
241
+ # Skip automatic pull
242
+ farseer checkout my-tenant --no-pull
243
+
244
+ # Show current checkout
245
+ farseer checkout
246
+ ```
247
+
248
+ ### Sync Operations
249
+
250
+ All sync commands use the checked-out tenant by default. You can specify a different tenant as argument.
251
+
252
+ #### `farseer pull [tenant]`
253
+
254
+ Download scripts and apps from Farseer instance.
255
+
256
+ ```bash
257
+ # Pull for checked-out tenant
258
+ farseer pull
259
+
260
+ # Pull for specific tenant
261
+ farseer pull other-tenant
262
+
263
+ # Download all files (not just .ts/.js)
264
+ farseer pull --all
265
+ ```
266
+
267
+ **What it does:**
268
+ 1. Fetches all files from `Files/` folder on instance
269
+ 2. Downloads app configurations
270
+ 3. Saves to `apps/<tenant>/files/` and `apps/<tenant>/apps/`
271
+ 4. Creates `package.json` if missing
272
+ 5. Updates sync tracking file
273
+
274
+ #### `farseer push [tenant]`
275
+
276
+ Upload local changes to Farseer instance.
277
+
278
+ ```bash
279
+ # Push changes
280
+ farseer push
281
+
282
+ # Force push (ignore remote changes)
283
+ farseer push --force
284
+ ```
285
+
286
+ **What it does:**
287
+ 1. Checks for unpulled remote changes (fails if found, unless `--force`)
288
+ 2. Shows diff and asks for confirmation
289
+ 3. Uploads/updates/deletes files on instance
290
+ 4. Uploads/updates app configurations
291
+
292
+ #### `farseer status [tenant]`
293
+
294
+ Compare local files with remote instance.
295
+
296
+ ```bash
297
+ # Check script files
298
+ farseer status
299
+
300
+ # Check all files
301
+ farseer status --all
302
+ ```
303
+
304
+ Output:
305
+ ```
306
+ Comparing local with remote...
307
+
308
+ Modified locally:
309
+ M Scripts/import-sales.ts
310
+
311
+ Modified on remote:
312
+ M Scripts/sync-actuals.ts
313
+
314
+ Only local (new):
315
+ + Scripts/new-script.ts
316
+
317
+ Only on remote:
318
+ - Data/old-file.xlsx
319
+ ```
320
+
321
+ #### `farseer diff [tenant] [file]`
322
+
323
+ Show file differences.
324
+
325
+ ```bash
326
+ # Diff all changed files
327
+ farseer diff
328
+
329
+ # Diff specific file
330
+ farseer diff Scripts/import-sales.ts
331
+
332
+ # Show only remote version
333
+ farseer diff Scripts/import-sales.ts --remote
334
+ ```
335
+
336
+ #### `farseer files list [tenant]`
337
+
338
+ List files on remote instance.
339
+
340
+ ```bash
341
+ # List script files only
342
+ farseer files list
343
+
344
+ # List all files
345
+ farseer files list --all
346
+ ```
347
+
348
+ ---
349
+
350
+ ## App Management
351
+
352
+ App names with spaces don't need quotes when tenant is checked out.
353
+
354
+ ### `farseer app list [tenant]`
355
+
356
+ List all apps.
357
+
358
+ ```bash
359
+ # Simple list
360
+ farseer app list
361
+
362
+ # With details (entrypoint, scripts, arguments)
363
+ farseer app list --details
364
+ ```
365
+
366
+ ### `farseer app show <name>`
367
+
368
+ Show app details.
369
+
370
+ ```bash
371
+ farseer app show My Import App
372
+ ```
373
+
374
+ Output:
375
+ ```json
376
+ {
377
+ "name": "My Import App",
378
+ "description": "Imports sales data",
379
+ "entrypoint": "import-sales.ts",
380
+ "scripts": ["import-sales.ts", "helpers.ts"],
381
+ "arguments": [
382
+ { "name": "Year", "defaultValue": "2025" },
383
+ { "name": "Version", "defaultValue": "Plan" }
384
+ ]
385
+ }
386
+ ```
387
+
388
+ ### `farseer app create <name>`
389
+
390
+ Create new app.
391
+
392
+ ```bash
393
+ farseer app create My New App
394
+ ```
395
+
396
+ Creates JSON file in `apps/<tenant>/apps/`. Use `push` to upload to instance.
397
+
398
+ ### `farseer app configure <name>`
399
+
400
+ Configure app settings.
401
+
402
+ ```bash
403
+ # Set entrypoint and scripts
404
+ farseer app configure My App --entrypoint index.ts --scripts "index.ts,helpers.ts"
405
+
406
+ # Add argument
407
+ farseer app configure My App --add-arg "Year=2025"
408
+
409
+ # Set description
410
+ farseer app configure My App --description "Imports data"
411
+ ```
412
+
413
+ ### `farseer app delete <name>`
414
+
415
+ Delete app (requires `--force`).
416
+
417
+ ```bash
418
+ farseer app delete My App --force
419
+ ```
420
+
421
+ ### `farseer run <app>`
422
+
423
+ Run app locally with injected credentials.
424
+
425
+ ```bash
426
+ # Run app
427
+ farseer run My Import App
428
+
429
+ # Override argument
430
+ farseer run My Import App --arg "Year=2026"
431
+
432
+ # Multiple arguments
433
+ farseer run My Import App --arg "Year=2026" --arg "Version=Forecast"
434
+ ```
435
+
436
+ **Prerequisites:**
437
+ - Run `farseer install` first
438
+ - Credentials configured (`farseer login`)
439
+
440
+ ### `farseer install [tenant]`
441
+
442
+ Install npm dependencies for local development.
443
+
444
+ ```bash
445
+ farseer install
446
+ ```
447
+
448
+ ---
449
+
450
+ ## Model Inspection
451
+
452
+ Explore your Farseer data model from the command line.
453
+
454
+ ### `farseer model [tenant]`
455
+
456
+ ```bash
457
+ # Show model overview
458
+ farseer model
459
+
460
+ # List all variables
461
+ farseer model --variables
462
+
463
+ # List dimension tables
464
+ farseer model --tables
465
+
466
+ # Show variable details
467
+ farseer model --variable "Sales Amount"
468
+ ```
469
+
470
+ Output for `--variable`:
471
+ ```
472
+ Variable: Sales Amount
473
+
474
+ Dimensions:
475
+ - Product
476
+ - Region
477
+ - Month
478
+ - Year
479
+ - Version
480
+
481
+ Roll-up Type: SUM
482
+ Number Format: #,##0.00
483
+ Formula: (none - data variable)
484
+ ```
485
+
486
+ ---
487
+
488
+ ## MCP Tools & Resources
489
+
490
+ Farseer CLI implements the [Model Context Protocol (MCP)](https://modelcontextprotocol.io). For setup instructions, see [MCP Setup](#mcp-setup-ai-assistants).
491
+
492
+ ### Available Tools
493
+
494
+ Once configured, AI assistants have access to:
495
+
496
+ **Authentication:**
497
+ - `farseer_whoami` - Check authentication status
498
+ - `farseer_checkout` - Set default tenant
499
+ - `farseer_checkout_clear` - Clear default tenant
500
+
501
+ **Sync Operations:**
502
+ - `farseer_pull` - Pull scripts and apps from remote
503
+ - `farseer_push` - Push local changes to remote
504
+ - `farseer_status` - Compare local vs remote state
505
+ - `farseer_diff` - Show file differences
506
+ - `farseer_list_files` - List remote files
507
+
508
+ **App Management:**
509
+ - `farseer_list_apps` - List all apps
510
+ - `farseer_get_app` - Get app details
511
+ - `farseer_create_app` - Create new app
512
+ - `farseer_configure_app` - Configure app
513
+ - `farseer_delete_app` - Delete app
514
+ - `farseer_run_app` - Run app locally
515
+
516
+ **Model Inspection:**
517
+ - `farseer_export_model` - Export full model structure
518
+ - `farseer_list_tables` - List dimension tables
519
+ - `farseer_list_variables` - List variables
520
+ - `farseer_get_table` - Get table details
521
+ - `farseer_get_variable` - Get variable details
522
+
523
+ ### Documentation Resources
524
+
525
+ AI assistants can read comprehensive documentation:
526
+ - How Farseer Works (Dimensions, Variables, Formulas)
527
+ - CLI Guide
528
+ - API Reference (farseer-client)
529
+ - New App Template
530
+ - Troubleshooting
531
+ - Import Workflows
532
+ - Arquero Patterns
533
+ - Query & Formulas
534
+ - Model Export
535
+
536
+ ### Workflow Prompts
537
+
538
+ Guided workflows for common tasks:
539
+ - **setup_new_tenant** - Setup new tenant from scratch
540
+ - **create_new_app** - Create new app with guidance
541
+ - **understand_model** - Explore data model
542
+ - **write_import_script** - Write import script
543
+ - **copy_app** - Copy and modify existing app
544
+ - **debug_sync_issues** - Troubleshoot sync problems
545
+
546
+ ### Example Conversations
547
+
548
+ **List apps:**
549
+ > "Show me all my Farseer apps"
550
+
551
+ **Create import script:**
552
+ > "Create a new import script for Sales Amount variable that reads from CSV"
553
+
554
+ The AI will:
555
+ 1. Check what dimensions Sales Amount has
556
+ 2. Create TypeScript import script
557
+ 3. Push script to Farseer
558
+ 4. Create and configure app
559
+
560
+ **Debug issues:**
561
+ > "Pull latest changes and show me what's different"
562
+
563
+ ---
564
+
565
+ ## File Structure
566
+
567
+ ```
568
+ apps/
569
+ └── my-tenant/
570
+ ├── package.json # Auto-generated dependencies
571
+ ├── .farseer-sync.json # Sync tracking
572
+ ├── files/ # Maps to Files/ folder on instance
573
+ │ ├── Scripts/
574
+ │ │ ├── import-sales.ts
575
+ │ │ └── helpers/
576
+ │ │ └── utils.ts
577
+ │ └── Data/
578
+ │ └── config.json
579
+ └── apps/ # App configurations (JSON)
580
+ ├── Import Sales.json
581
+ └── Sync Actuals.json
582
+ ```
583
+
584
+ ### App JSON Format
585
+
586
+ ```json
587
+ {
588
+ "name": "My Import App",
589
+ "description": "Imports sales data",
590
+ "entrypoint": "import-sales.ts",
591
+ "scripts": ["import-sales.ts", "helpers.ts"],
592
+ "arguments": [
593
+ { "name": "Year", "defaultValue": "2025" },
594
+ { "name": "Version", "defaultValue": "Plan" }
595
+ ],
596
+ "_remote": {
597
+ "id": 123,
598
+ "reference": "123"
599
+ }
600
+ }
601
+ ```
602
+
603
+ **Important:**
604
+ - For **new apps**: Don't add `_remote` - CLI adds it after first push
605
+ - For **existing apps**: `_remote` links local JSON to remote app
606
+ - Never edit `_remote` manually
607
+
608
+ ---
609
+
610
+ ## Configuration
611
+
612
+ ### Config File Location
613
+
614
+ `~/.farseer/config.json`
615
+
616
+ ### Config Structure
617
+
618
+ ```json
619
+ {
620
+ "credentials": {
621
+ "my-tenant": {
622
+ "type": "apiKey",
623
+ "tenantId": "my-tenant",
624
+ "apiKey": "sk_xxx123",
625
+ "basePath": "https://my-org.farseer.io/api/v3"
626
+ }
627
+ },
628
+ "userAuth": {
629
+ "accessToken": "...",
630
+ "refreshToken": "...",
631
+ "expiresAt": "2025-01-28T10:00:00Z",
632
+ "realm": "master"
633
+ },
634
+ "currentCheckout": {
635
+ "tenant": "my-tenant",
636
+ "organisation": "my-org"
637
+ }
638
+ }
639
+ ```
640
+
641
+ ### Managing Credentials
642
+
643
+ ```bash
644
+ # Set API key
645
+ farseer config set my-tenant --api-key sk_xxx123
646
+
647
+ # Set with custom organisation
648
+ farseer config set my-tenant --api-key sk_xxx123 --org my-org
649
+
650
+ # List configured tenants
651
+ farseer config list
652
+
653
+ # Show credentials (masked)
654
+ farseer config show my-tenant
655
+
656
+ # Test connection
657
+ farseer config test my-tenant
658
+
659
+ # Remove credentials
660
+ farseer config remove my-tenant
661
+ ```
662
+
663
+ ---
664
+
665
+ ## Troubleshooting
666
+
667
+ ### "No credentials found for tenant"
668
+
669
+ ```bash
670
+ # Login with browser
671
+ farseer login
672
+
673
+ # Or set API key
674
+ farseer config set my-tenant --api-key sk_xxx123
675
+ ```
676
+
677
+ ### "No tenant specified"
678
+
679
+ ```bash
680
+ # Set default tenant
681
+ farseer checkout my-tenant
682
+ ```
683
+
684
+ ### "Token expired"
685
+
686
+ JWT tokens auto-refresh. If refresh fails:
687
+
688
+ ```bash
689
+ farseer login
690
+ ```
691
+
692
+ ### "Remote has changes that are not synced locally"
693
+
694
+ Someone edited files on Farseer UI. Pull first:
695
+
696
+ ```bash
697
+ farseer pull
698
+ farseer push
699
+ ```
700
+
701
+ ### "Cannot find module 'farseer-client'"
702
+
703
+ ```bash
704
+ farseer install
705
+ ```
706
+
707
+ ### "Entry point needs to be defined"
708
+
709
+ ```bash
710
+ farseer app configure "My App" --entrypoint index.ts
711
+ ```
712
+
713
+ ### Login Issues with Different Realm
714
+
715
+ ```bash
716
+ # Try specific realm
717
+ farseer login --realm acme
718
+ farseer login --realm corp
719
+ ```
720
+
721
+ ---
722
+
723
+ ## Requirements
724
+
725
+ - Node.js >= 18
726
+ - Access to Farseer instance
727
+
728
+ ---
729
+
730
+ ## License
731
+
732
+ ISC
733
+
734
+ ---
735
+
736
+ ## Links
737
+
738
+ - [Farseer Platform](https://farseer.io)
739
+ - [Model Context Protocol](https://modelcontextprotocol.io)
740
+ - [Claude Desktop](https://claude.ai/download)
741
+ - [Cursor](https://cursor.sh)
@@ -0,0 +1,2 @@
1
+ import { Command } from 'commander';
2
+ export declare function registerAppCommand(program: Command): void;