farseer-cli 1.8.1 → 1.8.3

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.
@@ -104,7 +104,7 @@ Examples:
104
104
  if (details.expectedArguments.length > 0) {
105
105
  console.log(` Arguments:`);
106
106
  for (const arg of details.expectedArguments) {
107
- console.log(` - ${arg.name}: ${import_chalk.default.dim(arg.defaultValue)}`);
107
+ console.log(` - ${arg.name}: ${import_chalk.default.dim(arg.defaultValue ?? "")}`);
108
108
  }
109
109
  }
110
110
  console.log();
@@ -120,7 +120,7 @@ Examples:
120
120
  }
121
121
  } catch (error) {
122
122
  import_logger.logger.error("Failed to list apps.");
123
- if (error?.message) {
123
+ if (error instanceof Error) {
124
124
  import_logger.logger.dim(error.message);
125
125
  }
126
126
  process.exit(1);
@@ -163,7 +163,7 @@ Examples:
163
163
  if (app.expectedArguments.length > 0) {
164
164
  console.log(" Arguments:");
165
165
  for (const arg of app.expectedArguments) {
166
- console.log(` - ${arg.name}: ${import_chalk.default.dim(arg.defaultValue)}`);
166
+ console.log(` - ${arg.name}: ${import_chalk.default.dim(arg.defaultValue ?? "")}`);
167
167
  }
168
168
  } else {
169
169
  console.log(" Arguments: None");
@@ -323,13 +323,11 @@ Examples:
323
323
  if (existingIdx >= 0) {
324
324
  const existing = newArgs[existingIdx];
325
325
  newArgs[existingIdx] = {
326
- name: existing.name,
327
- type: existing.type,
328
- defaultValue,
329
- ...existing.secret !== void 0 ? { secret: existing.secret } : {}
326
+ ...existing,
327
+ defaultValue
330
328
  };
331
329
  } else {
332
- newArgs.push({ name, type: "variable", defaultValue });
330
+ newArgs.push({ name, dataType: "string", defaultValue });
333
331
  }
334
332
  }
335
333
  update.expectedArguments = newArgs;
@@ -365,9 +363,15 @@ Examples:
365
363
  }
366
364
  if (update.expectedArguments) {
367
365
  console.log(
368
- ` Arguments: ${updated.expectedArguments.map(
369
- (a) => `${a.name}=${a.defaultValue ?? ""}${a.type === "constant" ? " (constant)" : ""}`
370
- ).join(", ")}`
366
+ ` Arguments: ${updated.expectedArguments.map((a) => {
367
+ const tags = [];
368
+ if (a.fixed) tags.push("locked");
369
+ if (a.dataType === "boolean") tags.push("boolean");
370
+ else if (a.options && a.options.length > 0) tags.push("dropdown");
371
+ if (a.secret) tags.push("secret");
372
+ const suffix = tags.length > 0 ? ` (${tags.join(", ")})` : "";
373
+ return `${a.name}=${a.defaultValue ?? ""}${suffix}`;
374
+ }).join(", ")}`
371
375
  );
372
376
  }
373
377
  } catch (error) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/commands/app.ts"],
4
- "sourcesContent": ["import { Command } from 'commander';\nimport chalk from 'chalk';\nimport { logger } from '../utils/logger';\nimport { getFarseerClientWithFallback, showLoginPrompt, IFarseerClient } from '../services/farseerFactory';\nimport { AppArgument } from '../services/farseerApi';\nimport { parseAppArgs, resolveTenantWithOrgMapping } from '../utils/helpers';\n\nexport function registerAppCommand(program: Command): void {\n const appCmd = program\n .command('app')\n .description('Manage apps on a Farseer instance')\n .addHelpText(\n 'after',\n `\nCommands:\n list [tenant] List all apps\n show [tenant] <name...> Show app details\n create [tenant] <name...> Create a new app\n configure [tenant] <name...> Configure app (entrypoint, scripts, arguments)\n delete [tenant] <name...> Delete an app (requires --force)\n\nNote: App names with spaces don't need quotes if tenant is checked out.\n\nExamples:\n $ farseer app list mycompany # List all apps\n $ farseer app show mycompany \"My App\" # Explicit tenant\n $ farseer app show My App # Uses checked-out tenant\n $ farseer app configure \"My App\" --entrypoint index.ts\n`,\n );\n\n // List apps\n appCmd\n .command('list [tenant]')\n .description('List all apps on a Farseer instance')\n .option('--details', 'Show detailed information for each app')\n .action(async (tenantArg, options) => {\n const { organisation, tenant } = resolveTenantWithOrgMapping(tenantArg);\n\n const result = await getFarseerClientWithFallback(organisation, tenant);\n if (!result) {\n showLoginPrompt(tenant);\n process.exit(1);\n }\n\n const api = result.client;\n const authLabel = result.authType === 'apiKey' ? 'API key' : 'browser login';\n logger.info(`Fetching apps from ${tenant} (using ${authLabel})...`);\n\n try {\n const apps = await api.listApps();\n\n if (apps.length === 0) {\n logger.warning('No apps found.');\n logger.dim('Create an app with: farseer app create <name>');\n return;\n }\n\n logger.header(`Apps on ${tenant}`);\n console.log();\n\n if (options.details) {\n // Fetch full details for each app\n for (const app of apps) {\n const details = await api.getApp(app.reference);\n if (details) {\n console.log(` \uD83D\uDCE6 ${chalk.bold(details.name)}`);\n if (details.description) {\n console.log(` ${chalk.dim(details.description)}`);\n }\n console.log(\n ` Status: ${details.status === 'AVAILABLE' ? chalk.green(details.status) : chalk.yellow(details.status)}`,\n );\n const detailScripts = details.scriptFiles ?? [];\n if (detailScripts.length > 0) {\n const mainScript = detailScripts.find((s) => s.id === details.mainScriptFileId);\n console.log(\n ` Entrypoint: ${mainScript ? chalk.cyan(mainScript.name) : chalk.red('Not set')}`,\n );\n console.log(` Scripts:`);\n for (const script of detailScripts) {\n const isMain = script.id === details.mainScriptFileId;\n console.log(\n ` ${isMain ? chalk.green('\u25B6') : ' '} ${script.name}${isMain ? chalk.dim(' (entrypoint)') : ''}`,\n );\n }\n } else {\n console.log(` Scripts: ${chalk.dim('None')}`);\n }\n if (details.expectedArguments.length > 0) {\n console.log(` Arguments:`);\n for (const arg of details.expectedArguments) {\n console.log(` - ${arg.name}: ${chalk.dim(arg.defaultValue)}`);\n }\n }\n console.log();\n }\n }\n } else {\n // Simple list\n for (const app of apps) {\n console.log(` \uD83D\uDCE6 ${app.name}`);\n }\n console.log();\n logger.dim(`Total: ${apps.length} app(s)`);\n logger.dim('Use --details to see more information.');\n }\n } catch (error: any) {\n logger.error('Failed to list apps.');\n if (error?.message) {\n logger.dim(error.message);\n }\n process.exit(1);\n }\n });\n\n // Show app details\n appCmd\n .command('show <args...>')\n .description('Show details of an app')\n .action(async (args: string[]) => {\n const { organisation, tenant, appName } = parseAppArgs(args);\n const result = await getFarseerClientWithFallback(organisation, tenant);\n if (!result) {\n showLoginPrompt(tenant);\n process.exit(1);\n }\n\n const api: IFarseerClient = result.client;\n const app = await api.getAppByName(appName);\n\n if (!app) {\n logger.error(`App not found: ${appName}`);\n process.exit(1);\n }\n\n logger.header(`App: ${app.name}`);\n console.log();\n console.log(` ID: ${app.id}`);\n console.log(` Status: ${app.status}`);\n if (app.description) {\n console.log(` Description: ${app.description}`);\n }\n console.log();\n\n const appScripts = app.scriptFiles ?? [];\n if (appScripts.length > 0) {\n console.log(' Scripts:');\n for (const script of appScripts) {\n const isMain = script.id === app.mainScriptFileId;\n console.log(\n ` ${isMain ? chalk.green('\u25B6') : ' '} ${script.name}${isMain ? chalk.dim(' (entrypoint)') : ''}`,\n );\n }\n } else {\n console.log(' Scripts: None');\n }\n console.log();\n\n if (app.expectedArguments.length > 0) {\n console.log(' Arguments:');\n for (const arg of app.expectedArguments) {\n console.log(` - ${arg.name}: ${chalk.dim(arg.defaultValue)}`);\n }\n } else {\n console.log(' Arguments: None');\n }\n console.log();\n });\n\n // Create app\n appCmd\n .command('create <args...>')\n .description('Create a new app')\n .action(async (args: string[]) => {\n const { organisation, tenant, appName } = parseAppArgs(args);\n const result = await getFarseerClientWithFallback(organisation, tenant);\n if (!result) {\n showLoginPrompt(tenant);\n process.exit(1);\n }\n\n const api: IFarseerClient = result.client;\n\n // Check if app already exists\n const existing = await api.getAppByName(appName);\n if (existing) {\n logger.error(`App already exists: ${appName}`);\n process.exit(1);\n }\n\n logger.info(`Creating app: ${appName}...`);\n\n try {\n const app = await api.createApp(appName);\n logger.success(`App created: ${app.name} (ID: ${app.id})`);\n logger.dim('Configure it with: farseer app configure \"' + appName + '\"');\n } catch (error) {\n logger.error('Failed to create app.');\n if (error instanceof Error) {\n logger.dim(error.message);\n }\n process.exit(1);\n }\n });\n\n // Delete app\n appCmd\n .command('delete <args...>')\n .description('Delete an app')\n .option('--force', 'Skip confirmation')\n .action(async (args: string[], options) => {\n const { organisation, tenant, appName } = parseAppArgs(args);\n const result = await getFarseerClientWithFallback(organisation, tenant);\n if (!result) {\n showLoginPrompt(tenant);\n process.exit(1);\n }\n\n const api: IFarseerClient = result.client;\n\n // Find app\n const apps = await api.listApps();\n const app = apps.find((a: { name: string }) => a.name.toLowerCase() === appName.toLowerCase());\n if (!app) {\n logger.error(`App not found: ${appName}`);\n process.exit(1);\n }\n\n if (!options.force) {\n logger.warning(`This will permanently delete app: ${app.name}`);\n logger.dim('Use --force to skip this confirmation.');\n process.exit(1);\n }\n\n logger.info(`Deleting app: ${app.name}...`);\n\n try {\n await api.deleteApp(app.reference);\n logger.success(`App deleted: ${app.name}`);\n } catch (error) {\n logger.error('Failed to delete app.');\n if (error instanceof Error) {\n logger.dim(error.message);\n }\n process.exit(1);\n }\n });\n\n // Configure app\n appCmd\n .command('configure <args...>')\n .description('Configure an app (set entrypoint, scripts, arguments)')\n .option('--entrypoint <script>', 'Set the entrypoint script (e.g., \"index.ts\")')\n .option('--scripts <scripts>', 'Comma-separated list of scripts to include')\n .option(\n '--add-arg <arg>',\n 'Add argument in format \"Name=DefaultValue\" (can be used multiple times)',\n collectArgs,\n [],\n )\n .option('--description <desc>', 'Set app description')\n .option('--name <name>', 'Rename the app')\n .action(async (args: string[], options) => {\n const { organisation, tenant, appName } = parseAppArgs(args);\n const result = await getFarseerClientWithFallback(organisation, tenant);\n if (!result) {\n showLoginPrompt(tenant);\n process.exit(1);\n }\n\n const api: IFarseerClient = result.client;\n\n // Find app\n const apps = await api.listApps();\n const appListItem = apps.find((a: { name: string }) => a.name.toLowerCase() === appName.toLowerCase());\n if (!appListItem) {\n logger.error(`App not found: ${appName}`);\n process.exit(1);\n }\n\n const app = await api.getApp(appListItem.reference);\n if (!app) {\n logger.error(`Failed to load app details: ${appName}`);\n process.exit(1);\n }\n\n // Build update object\n const update: {\n name?: string;\n description?: string;\n expectedArguments?: AppArgument[];\n mainScriptFileId?: string | null;\n scriptFileIds?: string[];\n } = {};\n\n if (options.name) {\n update.name = options.name;\n }\n\n if (options.description !== undefined) {\n update.description = options.description;\n }\n\n // Handle scripts and entrypoint\n if (options.scripts || options.entrypoint) {\n const availableScripts = await api.getScriptFiles();\n let autoSetEntrypoint = false;\n let autoEntrypointName = '';\n\n if (options.scripts) {\n const scriptNames = options.scripts.split(',').map((s: string) => s.trim());\n const scriptIds: string[] = [];\n const resolvedScripts: { id: string; name: string }[] = [];\n\n for (const name of scriptNames) {\n const script = availableScripts.find(\n (s: { name: string }) => s.name.toLowerCase() === name.toLowerCase(),\n );\n if (!script) {\n logger.error(`Script not found: ${name}`);\n logger.dim(\n 'Available scripts: ' +\n availableScripts.map((s: { name: string }) => s.name).join(', '),\n );\n process.exit(1);\n }\n scriptIds.push(script.id);\n resolvedScripts.push({ id: script.id, name: script.name });\n }\n\n update.scriptFileIds = scriptIds;\n\n // Auto-set first script as entrypoint if no entrypoint specified and app has none\n if (!options.entrypoint && !app.mainScriptFileId && resolvedScripts.length > 0) {\n update.mainScriptFileId = resolvedScripts[0].id;\n autoSetEntrypoint = true;\n autoEntrypointName = resolvedScripts[0].name;\n }\n }\n\n if (options.entrypoint) {\n const entryScript = availableScripts.find(\n (s: { name: string }) => s.name.toLowerCase() === options.entrypoint.toLowerCase(),\n );\n if (!entryScript) {\n logger.error(`Entrypoint script not found: ${options.entrypoint}`);\n logger.dim(\n 'Available scripts: ' + availableScripts.map((s: { name: string }) => s.name).join(', '),\n );\n process.exit(1);\n }\n update.mainScriptFileId = entryScript.id;\n\n // If setting entrypoint but no scripts specified, include the entrypoint in scripts\n if (!update.scriptFileIds) {\n update.scriptFileIds = [entryScript.id];\n } else if (!update.scriptFileIds.includes(entryScript.id)) {\n update.scriptFileIds.push(entryScript.id);\n }\n }\n\n // Notify user about auto-set entrypoint\n if (autoSetEntrypoint) {\n logger.info(`Auto-set \"${autoEntrypointName}\" as entrypoint (first script).`);\n logger.dim(`Change with: farseer app configure \"${appName}\" --entrypoint <script>`);\n }\n }\n\n // Handle arguments\n if (options.addArg && options.addArg.length > 0) {\n const newArgs: AppArgument[] = [...app.expectedArguments];\n\n for (const arg of options.addArg) {\n const [name, defaultValue] = arg.split('=');\n if (!name || defaultValue === undefined) {\n logger.error(`Invalid argument format: ${arg}`);\n logger.dim('Use format: --add-arg \"Name=DefaultValue\"');\n process.exit(1);\n }\n\n // Check if arg already exists. Lookup is case-insensitive\n // (user-friendly: --add-arg JOBNAME=x updates an existing\n // jobName), but the written name uses the backend's stored\n // casing \u2014 validateExpectedArguments on the server is\n // case-sensitive, and writing the caller-supplied case\n // would silently rename the arg.\n const existingIdx = newArgs.findIndex((a) => a.name.toLowerCase() === name.toLowerCase());\n if (existingIdx >= 0) {\n // Preserve existing type/secret on update \u2014 overwriting\n // them would silently flip a 'constant' arg to 'variable'.\n const existing = newArgs[existingIdx];\n newArgs[existingIdx] = {\n name: existing.name,\n type: existing.type,\n defaultValue,\n ...(existing.secret !== undefined ? { secret: existing.secret } : {}),\n };\n } else {\n newArgs.push({ name, type: 'variable', defaultValue });\n }\n }\n\n update.expectedArguments = newArgs;\n }\n\n if (Object.keys(update).length === 0) {\n logger.warning('No changes specified.');\n logger.dim('Use --entrypoint, --scripts, --add-arg, --description, or --name to configure the app.');\n return;\n }\n\n logger.info(`Updating app: ${app.name}...`);\n\n try {\n // API requires name field to be present\n if (!update.name) {\n update.name = app.name;\n }\n if (update.description === undefined) {\n update.description = app.description || '';\n }\n const updated = await api.updateApp(appListItem.reference, update);\n logger.success(`App updated: ${updated.name}`);\n\n // Show summary of changes\n if (update.name) console.log(` Name: ${updated.name}`);\n if (update.description !== undefined) console.log(` Description: ${updated.description || '(empty)'}`);\n if (update.mainScriptFileId) {\n const updatedScripts = updated.scriptFiles ?? [];\n const mainScript = updatedScripts.find(\n (s: { id: string | number }) => s.id === updated.mainScriptFileId,\n );\n console.log(` Entrypoint: ${mainScript?.name}`);\n }\n if (update.scriptFileIds) {\n console.log(\n ` Scripts: ${(updated.scriptFiles ?? []).map((s: { name: string }) => s.name).join(', ')}`,\n );\n }\n if (update.expectedArguments) {\n console.log(\n ` Arguments: ${updated.expectedArguments\n .map(\n (a) => `${a.name}=${a.defaultValue ?? ''}${a.type === 'constant' ? ' (constant)' : ''}`,\n )\n .join(', ')}`,\n );\n }\n } catch (error) {\n logger.error('Failed to update app.');\n if (error instanceof Error) {\n logger.dim(error.message);\n }\n process.exit(1);\n }\n });\n}\n\n// Helper to collect multiple --add-arg options\nfunction collectArgs(value: string, previous: string[]): string[] {\n return previous.concat([value]);\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAkB;AAClB,oBAAuB;AACvB,4BAA8E;AAE9E,qBAA0D;AAEnD,SAAS,mBAAmB,SAAwB;AACvD,QAAM,SAAS,QACV,QAAQ,KAAK,EACb,YAAY,mCAAmC,EAC/C;AAAA,IACG;AAAA,IACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAgBJ;AAGJ,SACK,QAAQ,eAAe,EACvB,YAAY,qCAAqC,EACjD,OAAO,aAAa,wCAAwC,EAC5D,OAAO,OAAO,WAAW,YAAY;AAClC,UAAM,EAAE,cAAc,OAAO,QAAI,4CAA4B,SAAS;AAEtE,UAAM,SAAS,UAAM,oDAA6B,cAAc,MAAM;AACtE,QAAI,CAAC,QAAQ;AACT,iDAAgB,MAAM;AACtB,cAAQ,KAAK,CAAC;AAAA,IAClB;AAEA,UAAM,MAAM,OAAO;AACnB,UAAM,YAAY,OAAO,aAAa,WAAW,YAAY;AAC7D,yBAAO,KAAK,sBAAsB,MAAM,WAAW,SAAS,MAAM;AAElE,QAAI;AACA,YAAM,OAAO,MAAM,IAAI,SAAS;AAEhC,UAAI,KAAK,WAAW,GAAG;AACnB,6BAAO,QAAQ,gBAAgB;AAC/B,6BAAO,IAAI,+CAA+C;AAC1D;AAAA,MACJ;AAEA,2BAAO,OAAO,WAAW,MAAM,EAAE;AACjC,cAAQ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AACA,YAAM,UAAU,MAAM,IAAI,UAAU,YAAY,WAAW,MAAM;AACjE,2BAAO,QAAQ,gBAAgB,QAAQ,IAAI,EAAE;AAG7C,UAAI,OAAO,KAAM,SAAQ,IAAI,WAAW,QAAQ,IAAI,EAAE;AACtD,UAAI,OAAO,gBAAgB,OAAW,SAAQ,IAAI,kBAAkB,QAAQ,eAAe,SAAS,EAAE;AACtG,UAAI,OAAO,kBAAkB;AACzB,cAAM,iBAAiB,QAAQ,eAAe,CAAC;AAC/C,cAAM,aAAa,eAAe;AAAA,UAC9B,CAAC,MAA+B,EAAE,OAAO,QAAQ;AAAA,QACrD;AACA,gBAAQ,IAAI,iBAAiB,YAAY,IAAI,EAAE;AAAA,MACnD;AACA,UAAI,OAAO,eAAe;AACtB,gBAAQ;AAAA,UACJ,eAAe,QAAQ,eAAe,CAAC,GAAG,IAAI,CAAC,MAAwB,EAAE,IAAI,EAAE,KAAK,IAAI,CAAC;AAAA,QAC7F;AAAA,MACJ;AACA,UAAI,OAAO,mBAAmB;AAC1B,gBAAQ;AAAA,UACJ,gBAAgB,QAAQ,kBACnB;AAAA,YACG,CAAC,MAAM,GAAG,EAAE,IAAI,IAAI,EAAE,gBAAgB,EAAE,GAAG,EAAE,SAAS,aAAa,gBAAgB,EAAE;AAAA,UACzF,EACC,KAAK,IAAI,CAAC;AAAA,QACnB;AAAA,MACJ;AAAA,IACJ,SAAS,OAAO;AACZ,2BAAO,MAAM,uBAAuB;AACpC,UAAI,iBAAiB,OAAO;AACxB,6BAAO,IAAI,MAAM,OAAO;AAAA,MAC5B;AACA,cAAQ,KAAK,CAAC;AAAA,IAClB;AAAA,EACJ,CAAC;AACT;AAGA,SAAS,YAAY,OAAe,UAA8B;AAC9D,SAAO,SAAS,OAAO,CAAC,KAAK,CAAC;AAClC;",
4
+ "sourcesContent": ["import { Command } from 'commander';\nimport chalk from 'chalk';\nimport { logger } from '../utils/logger';\nimport { getFarseerClientWithFallback, showLoginPrompt, IFarseerClient } from '../services/farseerFactory';\nimport { AppArgument } from '../services/farseerApi';\nimport { parseAppArgs, resolveTenantWithOrgMapping } from '../utils/helpers';\n\nexport function registerAppCommand(program: Command): void {\n const appCmd = program\n .command('app')\n .description('Manage apps on a Farseer instance')\n .addHelpText(\n 'after',\n `\nCommands:\n list [tenant] List all apps\n show [tenant] <name...> Show app details\n create [tenant] <name...> Create a new app\n configure [tenant] <name...> Configure app (entrypoint, scripts, arguments)\n delete [tenant] <name...> Delete an app (requires --force)\n\nNote: App names with spaces don't need quotes if tenant is checked out.\n\nExamples:\n $ farseer app list mycompany # List all apps\n $ farseer app show mycompany \"My App\" # Explicit tenant\n $ farseer app show My App # Uses checked-out tenant\n $ farseer app configure \"My App\" --entrypoint index.ts\n`,\n );\n\n // List apps\n appCmd\n .command('list [tenant]')\n .description('List all apps on a Farseer instance')\n .option('--details', 'Show detailed information for each app')\n .action(async (tenantArg, options) => {\n const { organisation, tenant } = resolveTenantWithOrgMapping(tenantArg);\n\n const result = await getFarseerClientWithFallback(organisation, tenant);\n if (!result) {\n showLoginPrompt(tenant);\n process.exit(1);\n }\n\n const api = result.client;\n const authLabel = result.authType === 'apiKey' ? 'API key' : 'browser login';\n logger.info(`Fetching apps from ${tenant} (using ${authLabel})...`);\n\n try {\n const apps = await api.listApps();\n\n if (apps.length === 0) {\n logger.warning('No apps found.');\n logger.dim('Create an app with: farseer app create <name>');\n return;\n }\n\n logger.header(`Apps on ${tenant}`);\n console.log();\n\n if (options.details) {\n // Fetch full details for each app\n for (const app of apps) {\n const details = await api.getApp(app.reference);\n if (details) {\n console.log(` \uD83D\uDCE6 ${chalk.bold(details.name)}`);\n if (details.description) {\n console.log(` ${chalk.dim(details.description)}`);\n }\n console.log(\n ` Status: ${details.status === 'AVAILABLE' ? chalk.green(details.status) : chalk.yellow(details.status)}`,\n );\n const detailScripts = details.scriptFiles ?? [];\n if (detailScripts.length > 0) {\n const mainScript = detailScripts.find((s) => s.id === details.mainScriptFileId);\n console.log(\n ` Entrypoint: ${mainScript ? chalk.cyan(mainScript.name) : chalk.red('Not set')}`,\n );\n console.log(` Scripts:`);\n for (const script of detailScripts) {\n const isMain = script.id === details.mainScriptFileId;\n console.log(\n ` ${isMain ? chalk.green('\u25B6') : ' '} ${script.name}${isMain ? chalk.dim(' (entrypoint)') : ''}`,\n );\n }\n } else {\n console.log(` Scripts: ${chalk.dim('None')}`);\n }\n if (details.expectedArguments.length > 0) {\n console.log(` Arguments:`);\n for (const arg of details.expectedArguments) {\n console.log(` - ${arg.name}: ${chalk.dim(arg.defaultValue ?? '')}`);\n }\n }\n console.log();\n }\n }\n } else {\n // Simple list\n for (const app of apps) {\n console.log(` \uD83D\uDCE6 ${app.name}`);\n }\n console.log();\n logger.dim(`Total: ${apps.length} app(s)`);\n logger.dim('Use --details to see more information.');\n }\n } catch (error) {\n logger.error('Failed to list apps.');\n if (error instanceof Error) {\n logger.dim(error.message);\n }\n process.exit(1);\n }\n });\n\n // Show app details\n appCmd\n .command('show <args...>')\n .description('Show details of an app')\n .action(async (args: string[]) => {\n const { organisation, tenant, appName } = parseAppArgs(args);\n const result = await getFarseerClientWithFallback(organisation, tenant);\n if (!result) {\n showLoginPrompt(tenant);\n process.exit(1);\n }\n\n const api: IFarseerClient = result.client;\n const app = await api.getAppByName(appName);\n\n if (!app) {\n logger.error(`App not found: ${appName}`);\n process.exit(1);\n }\n\n logger.header(`App: ${app.name}`);\n console.log();\n console.log(` ID: ${app.id}`);\n console.log(` Status: ${app.status}`);\n if (app.description) {\n console.log(` Description: ${app.description}`);\n }\n console.log();\n\n const appScripts = app.scriptFiles ?? [];\n if (appScripts.length > 0) {\n console.log(' Scripts:');\n for (const script of appScripts) {\n const isMain = script.id === app.mainScriptFileId;\n console.log(\n ` ${isMain ? chalk.green('\u25B6') : ' '} ${script.name}${isMain ? chalk.dim(' (entrypoint)') : ''}`,\n );\n }\n } else {\n console.log(' Scripts: None');\n }\n console.log();\n\n if (app.expectedArguments.length > 0) {\n console.log(' Arguments:');\n for (const arg of app.expectedArguments) {\n console.log(` - ${arg.name}: ${chalk.dim(arg.defaultValue ?? '')}`);\n }\n } else {\n console.log(' Arguments: None');\n }\n console.log();\n });\n\n // Create app\n appCmd\n .command('create <args...>')\n .description('Create a new app')\n .action(async (args: string[]) => {\n const { organisation, tenant, appName } = parseAppArgs(args);\n const result = await getFarseerClientWithFallback(organisation, tenant);\n if (!result) {\n showLoginPrompt(tenant);\n process.exit(1);\n }\n\n const api: IFarseerClient = result.client;\n\n // Check if app already exists\n const existing = await api.getAppByName(appName);\n if (existing) {\n logger.error(`App already exists: ${appName}`);\n process.exit(1);\n }\n\n logger.info(`Creating app: ${appName}...`);\n\n try {\n const app = await api.createApp(appName);\n logger.success(`App created: ${app.name} (ID: ${app.id})`);\n logger.dim('Configure it with: farseer app configure \"' + appName + '\"');\n } catch (error) {\n logger.error('Failed to create app.');\n if (error instanceof Error) {\n logger.dim(error.message);\n }\n process.exit(1);\n }\n });\n\n // Delete app\n appCmd\n .command('delete <args...>')\n .description('Delete an app')\n .option('--force', 'Skip confirmation')\n .action(async (args: string[], options) => {\n const { organisation, tenant, appName } = parseAppArgs(args);\n const result = await getFarseerClientWithFallback(organisation, tenant);\n if (!result) {\n showLoginPrompt(tenant);\n process.exit(1);\n }\n\n const api: IFarseerClient = result.client;\n\n // Find app\n const apps = await api.listApps();\n const app = apps.find((a: { name: string }) => a.name.toLowerCase() === appName.toLowerCase());\n if (!app) {\n logger.error(`App not found: ${appName}`);\n process.exit(1);\n }\n\n if (!options.force) {\n logger.warning(`This will permanently delete app: ${app.name}`);\n logger.dim('Use --force to skip this confirmation.');\n process.exit(1);\n }\n\n logger.info(`Deleting app: ${app.name}...`);\n\n try {\n await api.deleteApp(app.reference);\n logger.success(`App deleted: ${app.name}`);\n } catch (error) {\n logger.error('Failed to delete app.');\n if (error instanceof Error) {\n logger.dim(error.message);\n }\n process.exit(1);\n }\n });\n\n // Configure app\n appCmd\n .command('configure <args...>')\n .description('Configure an app (set entrypoint, scripts, arguments)')\n .option('--entrypoint <script>', 'Set the entrypoint script (e.g., \"index.ts\")')\n .option('--scripts <scripts>', 'Comma-separated list of scripts to include')\n .option(\n '--add-arg <arg>',\n 'Add argument in format \"Name=DefaultValue\" (can be used multiple times)',\n collectArgs,\n [],\n )\n .option('--description <desc>', 'Set app description')\n .option('--name <name>', 'Rename the app')\n .action(async (args: string[], options) => {\n const { organisation, tenant, appName } = parseAppArgs(args);\n const result = await getFarseerClientWithFallback(organisation, tenant);\n if (!result) {\n showLoginPrompt(tenant);\n process.exit(1);\n }\n\n const api: IFarseerClient = result.client;\n\n // Find app\n const apps = await api.listApps();\n const appListItem = apps.find((a: { name: string }) => a.name.toLowerCase() === appName.toLowerCase());\n if (!appListItem) {\n logger.error(`App not found: ${appName}`);\n process.exit(1);\n }\n\n const app = await api.getApp(appListItem.reference);\n if (!app) {\n logger.error(`Failed to load app details: ${appName}`);\n process.exit(1);\n }\n\n // Build update object\n const update: {\n name?: string;\n description?: string;\n expectedArguments?: AppArgument[];\n mainScriptFileId?: string | null;\n scriptFileIds?: string[];\n } = {};\n\n if (options.name) {\n update.name = options.name;\n }\n\n if (options.description !== undefined) {\n update.description = options.description;\n }\n\n // Handle scripts and entrypoint\n if (options.scripts || options.entrypoint) {\n const availableScripts = await api.getScriptFiles();\n let autoSetEntrypoint = false;\n let autoEntrypointName = '';\n\n if (options.scripts) {\n const scriptNames = options.scripts.split(',').map((s: string) => s.trim());\n const scriptIds: string[] = [];\n const resolvedScripts: { id: string; name: string }[] = [];\n\n for (const name of scriptNames) {\n const script = availableScripts.find(\n (s: { name: string }) => s.name.toLowerCase() === name.toLowerCase(),\n );\n if (!script) {\n logger.error(`Script not found: ${name}`);\n logger.dim(\n 'Available scripts: ' +\n availableScripts.map((s: { name: string }) => s.name).join(', '),\n );\n process.exit(1);\n }\n scriptIds.push(script.id);\n resolvedScripts.push({ id: script.id, name: script.name });\n }\n\n update.scriptFileIds = scriptIds;\n\n // Auto-set first script as entrypoint if no entrypoint specified and app has none\n if (!options.entrypoint && !app.mainScriptFileId && resolvedScripts.length > 0) {\n update.mainScriptFileId = resolvedScripts[0].id;\n autoSetEntrypoint = true;\n autoEntrypointName = resolvedScripts[0].name;\n }\n }\n\n if (options.entrypoint) {\n const entryScript = availableScripts.find(\n (s: { name: string }) => s.name.toLowerCase() === options.entrypoint.toLowerCase(),\n );\n if (!entryScript) {\n logger.error(`Entrypoint script not found: ${options.entrypoint}`);\n logger.dim(\n 'Available scripts: ' + availableScripts.map((s: { name: string }) => s.name).join(', '),\n );\n process.exit(1);\n }\n update.mainScriptFileId = entryScript.id;\n\n // If setting entrypoint but no scripts specified, include the entrypoint in scripts\n if (!update.scriptFileIds) {\n update.scriptFileIds = [entryScript.id];\n } else if (!update.scriptFileIds.includes(entryScript.id)) {\n update.scriptFileIds.push(entryScript.id);\n }\n }\n\n // Notify user about auto-set entrypoint\n if (autoSetEntrypoint) {\n logger.info(`Auto-set \"${autoEntrypointName}\" as entrypoint (first script).`);\n logger.dim(`Change with: farseer app configure \"${appName}\" --entrypoint <script>`);\n }\n }\n\n // Handle arguments\n if (options.addArg && options.addArg.length > 0) {\n const newArgs: AppArgument[] = [...app.expectedArguments];\n\n for (const arg of options.addArg) {\n const [name, defaultValue] = arg.split('=');\n if (!name || defaultValue === undefined) {\n logger.error(`Invalid argument format: ${arg}`);\n logger.dim('Use format: --add-arg \"Name=DefaultValue\"');\n process.exit(1);\n }\n\n // Check if arg already exists. Lookup is case-insensitive\n // (user-friendly: --add-arg JOBNAME=x updates an existing\n // jobName), but the written name uses the backend's stored\n // casing \u2014 validateExpectedArguments on the server is\n // case-sensitive, and writing the caller-supplied case\n // would silently rename the arg.\n //\n // --add-arg only sets the defaultValue on a string arg; any\n // existing axes (`dataType`, `fixed`, `options`, `secret`)\n // are preserved so updating a boolean/dropdown/locked arg\n // with --add-arg doesn't silently demote it.\n const existingIdx = newArgs.findIndex((a) => a.name.toLowerCase() === name.toLowerCase());\n if (existingIdx >= 0) {\n const existing = newArgs[existingIdx];\n newArgs[existingIdx] = {\n ...existing,\n defaultValue,\n };\n } else {\n newArgs.push({ name, dataType: 'string', defaultValue });\n }\n }\n\n update.expectedArguments = newArgs;\n }\n\n if (Object.keys(update).length === 0) {\n logger.warning('No changes specified.');\n logger.dim('Use --entrypoint, --scripts, --add-arg, --description, or --name to configure the app.');\n return;\n }\n\n logger.info(`Updating app: ${app.name}...`);\n\n try {\n // API requires name field to be present\n if (!update.name) {\n update.name = app.name;\n }\n if (update.description === undefined) {\n update.description = app.description || '';\n }\n const updated = await api.updateApp(appListItem.reference, update);\n logger.success(`App updated: ${updated.name}`);\n\n // Show summary of changes\n if (update.name) console.log(` Name: ${updated.name}`);\n if (update.description !== undefined) console.log(` Description: ${updated.description || '(empty)'}`);\n if (update.mainScriptFileId) {\n const updatedScripts = updated.scriptFiles ?? [];\n const mainScript = updatedScripts.find(\n (s: { id: string | number }) => s.id === updated.mainScriptFileId,\n );\n console.log(` Entrypoint: ${mainScript?.name}`);\n }\n if (update.scriptFileIds) {\n console.log(\n ` Scripts: ${(updated.scriptFiles ?? []).map((s: { name: string }) => s.name).join(', ')}`,\n );\n }\n if (update.expectedArguments) {\n console.log(\n ` Arguments: ${updated.expectedArguments\n .map((a) => {\n const tags: string[] = [];\n if (a.fixed) tags.push('locked');\n if (a.dataType === 'boolean') tags.push('boolean');\n else if (a.options && a.options.length > 0) tags.push('dropdown');\n if (a.secret) tags.push('secret');\n const suffix = tags.length > 0 ? ` (${tags.join(', ')})` : '';\n return `${a.name}=${a.defaultValue ?? ''}${suffix}`;\n })\n .join(', ')}`,\n );\n }\n } catch (error) {\n logger.error('Failed to update app.');\n if (error instanceof Error) {\n logger.dim(error.message);\n }\n process.exit(1);\n }\n });\n}\n\n// Helper to collect multiple --add-arg options\nfunction collectArgs(value: string, previous: string[]): string[] {\n return previous.concat([value]);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AA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AI,EAAE;AAAA,MACnD;AACA,UAAI,OAAO,eAAe;AACtB,gBAAQ;AAAA,UACJ,eAAe,QAAQ,eAAe,CAAC,GAAG,IAAI,CAAC,MAAwB,EAAE,IAAI,EAAE,KAAK,IAAI,CAAC;AAAA,QAC7F;AAAA,MACJ;AACA,UAAI,OAAO,mBAAmB;AAC1B,gBAAQ;AAAA,UACJ,gBAAgB,QAAQ,kBACnB,IAAI,CAAC,MAAM;AACR,kBAAM,OAAiB,CAAC;AACxB,gBAAI,EAAE,MAAO,MAAK,KAAK,QAAQ;AAC/B,gBAAI,EAAE,aAAa,UAAW,MAAK,KAAK,SAAS;AAAA,qBACxC,EAAE,WAAW,EAAE,QAAQ,SAAS,EAAG,MAAK,KAAK,UAAU;AAChE,gBAAI,EAAE,OAAQ,MAAK,KAAK,QAAQ;AAChC,kBAAM,SAAS,KAAK,SAAS,IAAI,KAAK,KAAK,KAAK,IAAI,CAAC,MAAM;AAC3D,mBAAO,GAAG,EAAE,IAAI,IAAI,EAAE,gBAAgB,EAAE,GAAG,MAAM;AAAA,UACrD,CAAC,EACA,KAAK,IAAI,CAAC;AAAA,QACnB;AAAA,MACJ;AAAA,IACJ,SAAS,OAAO;AACZ,2BAAO,MAAM,uBAAuB;AACpC,UAAI,iBAAiB,OAAO;AACxB,6BAAO,IAAI,MAAM,OAAO;AAAA,MAC5B;AACA,cAAQ,KAAK,CAAC;AAAA,IAClB;AAAA,EACJ,CAAC;AACT;AAGA,SAAS,YAAY,OAAe,UAA8B;AAC9D,SAAO,SAAS,OAAO,CAAC,KAAK,CAAC;AAClC;",
6
6
  "names": ["chalk"]
7
7
  }
@@ -85,7 +85,7 @@ function registerAppsCommand(program) {
85
85
  if (details.expectedArguments.length > 0) {
86
86
  console.log(` Arguments:`);
87
87
  for (const arg of details.expectedArguments) {
88
- console.log(` - ${arg.name}: ${import_chalk.default.dim(arg.defaultValue)}`);
88
+ console.log(` - ${arg.name}: ${import_chalk.default.dim(arg.defaultValue ?? "")}`);
89
89
  }
90
90
  }
91
91
  console.log();
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/commands/apps.ts"],
4
- "sourcesContent": ["import { Command } from 'commander';\nimport chalk from 'chalk';\nimport { logger } from '../utils/logger';\nimport { getFarseerClientWithFallback, showLoginPrompt, isAuthError } from '../services/farseerFactory';\nimport { resolveTenantWithOrgMapping } from '../utils/helpers';\n\nexport function registerAppsCommand(program: Command): void {\n program\n .command('apps [tenant]')\n .description('List all apps on a Farseer instance')\n .option('--details', 'Show detailed information for each app')\n .action(async (tenantArg, options) => {\n const { organisation, tenant } = resolveTenantWithOrgMapping(tenantArg);\n const result = await getFarseerClientWithFallback(organisation, tenant);\n\n if (!result) {\n showLoginPrompt(tenant);\n process.exit(1);\n }\n\n const api = result.client;\n const authLabel = result.authType === 'apiKey' ? 'API key' : 'browser login';\n logger.info(`Fetching apps from ${tenant} (using ${authLabel})...`);\n\n try {\n const apps = await api.listApps();\n\n if (apps.length === 0) {\n logger.warning('No apps found.');\n logger.dim('Create an app with: farseer app create <app-name>');\n return;\n }\n\n logger.header(`Apps on ${tenant}`);\n console.log();\n\n if (options.details) {\n // Fetch full details for each app\n for (const app of apps) {\n const details = await api.getApp(app.reference);\n if (details) {\n console.log(` \uD83D\uDCE6 ${chalk.bold(details.name)}`);\n if (details.description) {\n console.log(` ${chalk.dim(details.description)}`);\n }\n console.log(\n ` Status: ${details.status === 'AVAILABLE' ? chalk.green(details.status) : chalk.yellow(details.status)}`,\n );\n const detailScripts = details.scriptFiles ?? [];\n if (detailScripts.length > 0) {\n const mainScript = detailScripts.find((s) => s.id === details.mainScriptFileId);\n console.log(\n ` Entrypoint: ${mainScript ? chalk.cyan(mainScript.name) : chalk.red('Not set')}`,\n );\n console.log(` Scripts:`);\n for (const script of detailScripts) {\n const isMain = script.id === details.mainScriptFileId;\n console.log(\n ` ${isMain ? chalk.green('\u25B6') : ' '} ${script.name}${isMain ? chalk.dim(' (entrypoint)') : ''}`,\n );\n }\n } else {\n console.log(` Scripts: ${chalk.dim('None')}`);\n }\n if (details.expectedArguments.length > 0) {\n console.log(` Arguments:`);\n for (const arg of details.expectedArguments) {\n console.log(` - ${arg.name}: ${chalk.dim(arg.defaultValue)}`);\n }\n }\n console.log();\n }\n }\n } else {\n // Simple list\n for (const app of apps) {\n console.log(` \uD83D\uDCE6 ${app.name}`);\n }\n console.log();\n logger.dim(`Total: ${apps.length} app(s)`);\n logger.dim('Use --details to see more information.');\n }\n } catch (error) {\n if (isAuthError(error)) {\n showLoginPrompt(tenant);\n } else {\n logger.error('Failed to list apps.');\n if (error instanceof Error) {\n logger.dim(error.message);\n }\n }\n process.exit(1);\n }\n });\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAkB;AAClB,oBAAuB;AACvB,4BAA2E;AAC3E,qBAA4C;AAErC,SAAS,oBAAoB,SAAwB;AACxD,UACK,QAAQ,eAAe,EACvB,YAAY,qCAAqC,EACjD,OAAO,aAAa,wCAAwC,EAC5D,OAAO,OAAO,WAAW,YAAY;AAClC,UAAM,EAAE,cAAc,OAAO,QAAI,4CAA4B,SAAS;AACtE,UAAM,SAAS,UAAM,oDAA6B,cAAc,MAAM;AAEtE,QAAI,CAAC,QAAQ;AACT,iDAAgB,MAAM;AACtB,cAAQ,KAAK,CAAC;AAAA,IAClB;AAEA,UAAM,MAAM,OAAO;AACnB,UAAM,YAAY,OAAO,aAAa,WAAW,YAAY;AAC7D,yBAAO,KAAK,sBAAsB,MAAM,WAAW,SAAS,MAAM;AAElE,QAAI;AACA,YAAM,OAAO,MAAM,IAAI,SAAS;AAEhC,UAAI,KAAK,WAAW,GAAG;AACnB,6BAAO,QAAQ,gBAAgB;AAC/B,6BAAO,IAAI,mDAAmD;AAC9D;AAAA,MACJ;AAEA,2BAAO,OAAO,WAAW,MAAM,EAAE;AACjC,cAAQ,IAAI;AAEZ,UAAI,QA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AY,CAAC,EAAE;AAAA,cACtE;AAAA,YACJ;AACA,oBAAQ,IAAI;AAAA,UAChB;AAAA,QACJ;AAAA,MACJ,OAAO;AAEH,mBAAW,OAAO,MAAM;AACpB,kBAAQ,IAAI,eAAQ,IAAI,IAAI,EAAE;AAAA,QAClC;AACA,gBAAQ,IAAI;AACZ,6BAAO,IAAI,UAAU,KAAK,MAAM,SAAS;AACzC,6BAAO,IAAI,wCAAwC;AAAA,MACvD;AAAA,IACJ,SAAS,OAAO;AACZ,cAAI,mCAAY,KAAK,GAAG;AACpB,mDAAgB,MAAM;AAAA,MAC1B,OAAO;AACH,6BAAO,MAAM,sBAAsB;AACnC,YAAI,iBAAiB,OAAO;AACxB,+BAAO,IAAI,MAAM,OAAO;AAAA,QAC5B;AAAA,MACJ;AACA,cAAQ,KAAK,CAAC;AAAA,IAClB;AAAA,EACJ,CAAC;AACT;",
4
+ "sourcesContent": ["import { Command } from 'commander';\nimport chalk from 'chalk';\nimport { logger } from '../utils/logger';\nimport { getFarseerClientWithFallback, showLoginPrompt, isAuthError } from '../services/farseerFactory';\nimport { resolveTenantWithOrgMapping } from '../utils/helpers';\n\nexport function registerAppsCommand(program: Command): void {\n program\n .command('apps [tenant]')\n .description('List all apps on a Farseer instance')\n .option('--details', 'Show detailed information for each app')\n .action(async (tenantArg, options) => {\n const { organisation, tenant } = resolveTenantWithOrgMapping(tenantArg);\n const result = await getFarseerClientWithFallback(organisation, tenant);\n\n if (!result) {\n showLoginPrompt(tenant);\n process.exit(1);\n }\n\n const api = result.client;\n const authLabel = result.authType === 'apiKey' ? 'API key' : 'browser login';\n logger.info(`Fetching apps from ${tenant} (using ${authLabel})...`);\n\n try {\n const apps = await api.listApps();\n\n if (apps.length === 0) {\n logger.warning('No apps found.');\n logger.dim('Create an app with: farseer app create <app-name>');\n return;\n }\n\n logger.header(`Apps on ${tenant}`);\n console.log();\n\n if (options.details) {\n // Fetch full details for each app\n for (const app of apps) {\n const details = await api.getApp(app.reference);\n if (details) {\n console.log(` \uD83D\uDCE6 ${chalk.bold(details.name)}`);\n if (details.description) {\n console.log(` ${chalk.dim(details.description)}`);\n }\n console.log(\n ` Status: ${details.status === 'AVAILABLE' ? chalk.green(details.status) : chalk.yellow(details.status)}`,\n );\n const detailScripts = details.scriptFiles ?? [];\n if (detailScripts.length > 0) {\n const mainScript = detailScripts.find((s) => s.id === details.mainScriptFileId);\n console.log(\n ` Entrypoint: ${mainScript ? chalk.cyan(mainScript.name) : chalk.red('Not set')}`,\n );\n console.log(` Scripts:`);\n for (const script of detailScripts) {\n const isMain = script.id === details.mainScriptFileId;\n console.log(\n ` ${isMain ? chalk.green('\u25B6') : ' '} ${script.name}${isMain ? chalk.dim(' (entrypoint)') : ''}`,\n );\n }\n } else {\n console.log(` Scripts: ${chalk.dim('None')}`);\n }\n if (details.expectedArguments.length > 0) {\n console.log(` Arguments:`);\n for (const arg of details.expectedArguments) {\n console.log(` - ${arg.name}: ${chalk.dim(arg.defaultValue ?? '')}`);\n }\n }\n console.log();\n }\n }\n } else {\n // Simple list\n for (const app of apps) {\n console.log(` \uD83D\uDCE6 ${app.name}`);\n }\n console.log();\n logger.dim(`Total: ${apps.length} app(s)`);\n logger.dim('Use --details to see more information.');\n }\n } catch (error) {\n if (isAuthError(error)) {\n showLoginPrompt(tenant);\n } else {\n logger.error('Failed to list apps.');\n if (error instanceof Error) {\n logger.dim(error.message);\n }\n }\n process.exit(1);\n }\n });\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAkB;AAClB,oBAAuB;AACvB,4BAA2E;AAC3E,qBAA4C;AAErC,SAAS,oBAAoB,SAAwB;AACxD,UACK,QAAQ,eAAe,EACvB,YAAY,qCAAqC,EACjD,OAAO,aAAa,wCAAwC,EAC5D,OAAO,OAAO,WAAW,YAAY;AAClC,UAAM,EAAE,cAAc,OAAO,QAAI,4CAA4B,SAAS;AACtE,UAAM,SAAS,U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OAAO,QAAQ;AACrC,wBAAQ;AAAA,kBACJ,UAAU,SAAS,aAAAA,QAAM,MAAM,QAAG,IAAI,GAAG,IAAI,OAAO,IAAI,GAAG,SAAS,aAAAA,QAAM,IAAI,eAAe,IAAI,EAAE;AAAA,gBACvG;AAAA,cACJ;AAAA,YACJ,OAAO;AACH,sBAAQ,IAAI,iBAAiB,aAAAA,QAAM,IAAI,MAAM,CAAC,EAAE;AAAA,YACpD;AACA,gBAAI,QAAQ,kBAAkB,SAAS,GAAG;AACtC,sBAAQ,IAAI,iBAAiB;AAC7B,yBAAW,OAAO,QAAQ,mBAAmB;AACzC,wBAAQ,IAAI,YAAY,IAAI,IAAI,KAAK,aAAAA,QAAM,IAAI,IAAI,gBAAgB,EAAE,CAAC,EAAE;AAAA,cAC5E;AAAA,YACJ;AACA,oBAAQ,IAAI;AAAA,UAChB;AAAA,QACJ;AAAA,MACJ,OAAO;AAEH,mBAAW,OAAO,MAAM;AACpB,kBAAQ,IAAI,eAAQ,IAAI,IAAI,EAAE;AAAA,QAClC;AACA,gBAAQ,IAAI;AACZ,6BAAO,IAAI,UAAU,KAAK,MAAM,SAAS;AACzC,6BAAO,IAAI,wCAAwC;AAAA,MACvD;AAAA,IACJ,SAAS,OAAO;AACZ,cAAI,mCAAY,KAAK,GAAG;AACpB,mDAAgB,MAAM;AAAA,MAC1B,OAAO;AACH,6BAAO,MAAM,sBAAsB;AACnC,YAAI,iBAAiB,OAAO;AACxB,+BAAO,IAAI,MAAM,OAAO;AAAA,QAC5B;AAAA,MACJ;AACA,cAAQ,KAAK,CAAC;AAAA,IAClB;AAAA,EACJ,CAAC;AACT;",
6
6
  "names": ["chalk"]
7
7
  }
@@ -55,7 +55,10 @@ function registerPullCommand(program) {
55
55
  ).option(
56
56
  "--force",
57
57
  "Hard reset local to remote within the current sync scope: overwrite local edits, delete local-only files. Files outside scope (data files like .csv on a default run without --include-ext .csv) are NOT touched. Always asks for confirmation."
58
- ).option("-y, --yes", "Skip confirmation when local has uncommitted changes (ignored under --force)").option("--include-ext <ext>", "Include extra file extension (repeatable)", import_cliOptions.collectValues, []).option("--include-folder <folder>", "Include all files in folder (repeatable)", import_cliOptions.collectValues, []).action(async (arg1, arg2, options) => {
58
+ ).option(
59
+ "-y, --yes",
60
+ "Skip confirmation when local has uncommitted changes OR remote has deletions that would remove local files/apps (ignored under --force)"
61
+ ).option("--include-ext <ext>", "Include extra file extension (repeatable)", import_cliOptions.collectValues, []).option("--include-folder <folder>", "Include all files in folder (repeatable)", import_cliOptions.collectValues, []).action(async (arg1, arg2, options) => {
59
62
  const { organisation, tenant } = (0, import_helpers.resolveTenantWithOrgMapping)(arg1, arg2);
60
63
  const clientResult = await (0, import_farseerFactory.getFarseerClientWithFallback)(organisation, tenant);
61
64
  if (!clientResult) {
@@ -90,7 +93,15 @@ function registerPullCommand(program) {
90
93
  import_logger.logger.dim(`Could not compute pre-pull status: ${preStatusError.message}`);
91
94
  }
92
95
  }
96
+ const appSyncService = new import_appSyncService.AppSyncService(tenant, clientResult.client);
97
+ let appDeletions = [];
98
+ try {
99
+ appDeletions = await appSyncService.getRemoteDeletions();
100
+ } catch (error) {
101
+ import_logger.logger.dim(`Could not compute pre-pull app deletions: ${error.message}`);
102
+ }
93
103
  const localChanges = preStatus ? preStatus.addedLocally.length + preStatus.modifiedLocally.length + preStatus.deletedLocally.length + preStatus.conflicts.length : 0;
104
+ const remoteDeletions = (preStatus?.deletedRemotely.length ?? 0) + appDeletions.length;
94
105
  if (options.force) {
95
106
  console.log();
96
107
  console.log(import_chalk.default.red.bold("--force will hard-reset local to match remote."));
@@ -119,18 +130,28 @@ function registerPullCommand(program) {
119
130
  import_logger.logger.info("Pull cancelled.");
120
131
  return;
121
132
  }
122
- } else if (localChanges > 0 && !options.yes) {
133
+ } else if ((localChanges > 0 || remoteDeletions > 0) && !options.yes) {
123
134
  console.log();
124
- import_logger.logger.warning(`Local has ${localChanges} unsynced change(s).`);
125
- summarisePreStatus(preStatus);
126
- import_logger.logger.dim("Pull will keep your edits and merge remote-side changes around them.");
127
- import_logger.logger.dim("To wipe local and reset to remote: re-run with --force.");
135
+ if (localChanges > 0) {
136
+ import_logger.logger.warning(`Local has ${localChanges} unsynced change(s).`);
137
+ summarisePreStatus(preStatus);
138
+ import_logger.logger.dim("Pull will keep your edits and merge remote-side changes around them.");
139
+ }
140
+ if (remoteDeletions > 0) {
141
+ import_logger.logger.warning(`Pull will remove ${remoteDeletions} local item(s) that were deleted on remote:`);
142
+ summariseRemoteDeletions(preStatus?.deletedRemotely ?? [], appDeletions);
143
+ import_logger.logger.dim("Decline to abort and keep your local copies (you can push them back to restore).");
144
+ }
145
+ if (localChanges > 0 && remoteDeletions === 0) {
146
+ import_logger.logger.dim("To wipe local and reset to remote: re-run with --force.");
147
+ }
148
+ const promptMessage = remoteDeletions > 0 && localChanges > 0 ? `Continue pull (merge into dirty tree AND delete ${remoteDeletions} local item(s))?` : remoteDeletions > 0 ? `Continue pull and delete ${remoteDeletions} local item(s)?` : `Continue pulling into a dirty working tree?`;
128
149
  const confirm = await import_inquirer.default.prompt([
129
150
  {
130
151
  type: "confirm",
131
152
  name: "proceed",
132
- message: `Continue pulling into a dirty working tree?`,
133
- default: true
153
+ message: promptMessage,
154
+ default: remoteDeletions === 0
134
155
  }
135
156
  ]);
136
157
  if (!confirm.proceed) {
@@ -237,7 +258,6 @@ function registerPullCommand(program) {
237
258
  console.log();
238
259
  console.log(import_chalk.default.bold("\u2550\u2550\u2550 Apps \u2550\u2550\u2550"));
239
260
  import_logger.logger.info(`Pulling apps from ${tenant}...`);
240
- const appSyncService = new import_appSyncService.AppSyncService(tenant, clientResult.client);
241
261
  const appResult = await appSyncService.pull();
242
262
  if (appResult.created.length > 0) {
243
263
  console.log(import_chalk.default.green("New apps:"));
@@ -300,6 +320,21 @@ function summarisePreStatus(status) {
300
320
  }
301
321
  console.log();
302
322
  }
323
+ function summariseRemoteDeletions(deletedFiles, deletedApps) {
324
+ const MAX_PATHS_PER_SECTION = 20;
325
+ const renderSection = (label, paths) => {
326
+ if (paths.length === 0) return;
327
+ console.log(import_chalk.default.red(` ${label} (${paths.length}):`));
328
+ const visible = paths.slice(0, MAX_PATHS_PER_SECTION);
329
+ for (const p of visible) console.log(import_chalk.default.red(` - ${p}`));
330
+ if (paths.length > MAX_PATHS_PER_SECTION) {
331
+ console.log(import_chalk.default.dim(` ... and ${paths.length - MAX_PATHS_PER_SECTION} more`));
332
+ }
333
+ };
334
+ renderSection("file(s) deleted on remote", deletedFiles);
335
+ renderSection("app(s) deleted on remote", deletedApps);
336
+ console.log();
337
+ }
303
338
  async function wipeLocalOnly(syncService, filesDir, filterOptions) {
304
339
  const status = await syncService.getStatus({ ...filterOptions, deep: false });
305
340
  const removed = [];
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/commands/pull.ts"],
4
- "sourcesContent": ["import { Command } from 'commander';\nimport chalk from 'chalk';\nimport inquirer from 'inquirer';\nimport { logger } from '../utils/logger';\nimport { fileLogger } from '../utils/fileLogger';\nimport { getFarseerClientWithFallback, showLoginPrompt } from '../services/farseerFactory';\nimport { SyncService, ConflictResolutions, SyncStatus } from '../services/syncService';\nimport { AppSyncService } from '../services/appSyncService';\nimport {\n getTenantDir,\n getTenantFilesDir,\n ensureDirectoryExists,\n resolveTenantWithOrgMapping,\n appendToAuditLog,\n AuditLogEntry,\n safeResolveWithinBase,\n} from '../utils/helpers';\nimport { formatClientError } from '../utils/errorFormatter';\nimport { isLikelyTextFile } from '../utils/fileValidation';\nimport { collectValues, normalizeExtensions } from '../utils/cliOptions';\nimport { FARSEER_CLIENT_URL, FARSEER_CLIENT_AXIOS_URL } from '../utils/constants';\nimport { ensureGitignoreEntries } from '../utils/workspace';\nimport * as fs from 'fs';\nimport * as path from 'path';\n\n/**\n * Pull semantics:\n *\n * farseer pull\n * 1. Show local-vs-remote diff. If you have unsynced local edits the\n * command stops here and asks for confirmation before doing\n * anything (we don't merge silently).\n * 2. Apply remote-side changes (downloads, deletions, modifications).\n * Per-file conflicts are resolved interactively.\n *\n * farseer pull --force\n * Hard reset to remote. After it runs, the working tree mirrors what's\n * on remote: any file that exists locally but not on remote is deleted,\n * remote versions overwrite local edits, deletions are accepted. Always\n * asks for confirmation because the operation is destructive.\n */\nexport function registerPullCommand(program: Command): void {\n program\n .command('pull [org] [tenant]')\n .description(\n 'Pull files from Farseer instance to local\\n\\nUsage: pull <org> <tenant> OR pull <tenant> (if org is known)',\n )\n .option(\n '--all',\n 'Pull every non-hidden, non-blocklisted file (default: developer files (.ts, .js, .py, .yml, .yaml, .md, .json) outside hidden directories and the folder blocklist). Data files (.csv, .xlsx, .parquet, \u2026) are backend-accepted but excluded from default \u2014 opt in via --include-ext .csv or `farseer config include --ext .csv`.',\n )\n .option(\n '--force',\n 'Hard reset local to remote within the current sync scope: overwrite local edits, delete local-only files. Files outside scope (data files like .csv on a default run without --include-ext .csv) are NOT touched. Always asks for confirmation.',\n )\n .option('-y, --yes', 'Skip confirmation when local has uncommitted changes (ignored under --force)')\n .option('--include-ext <ext>', 'Include extra file extension (repeatable)', collectValues, [])\n .option('--include-folder <folder>', 'Include all files in folder (repeatable)', collectValues, [])\n .action(async (arg1, arg2, options) => {\n const { organisation, tenant } = resolveTenantWithOrgMapping(arg1, arg2);\n const clientResult = await getFarseerClientWithFallback(organisation, tenant);\n\n if (!clientResult) {\n showLoginPrompt(tenant);\n process.exit(1);\n }\n\n const syncService = new SyncService(tenant, clientResult.client);\n\n const tenantDir = getTenantDir(tenant);\n ensureDirectoryExists(tenantDir);\n\n // Ensure .gitignore covers `.farseer-sync.json` on every direct\n // pull, not only checkout-driven pulls. A workspace that\n // initializes with `farseer pull` (no prior checkout, or\n // `checkout --no-pull` then `pull`) would otherwise commit the\n // per-machine baseline and reproduce the cross-machine drift\n // bug the gitignore exists to prevent.\n ensureGitignoreEntries(path.join(tenantDir, '.gitignore'));\n\n await createDefaultPackageJson(tenantDir, tenant);\n\n const includeExtensions = normalizeExtensions(options.includeExt);\n const includeFolders = options.includeFolder as string[];\n const filterOptions = {\n includeExtensions: includeExtensions.length > 0 ? includeExtensions : undefined,\n includeFolders: includeFolders.length > 0 ? includeFolders : undefined,\n };\n const syncOptions = {\n all: options.all,\n force: options.force,\n ...filterOptions,\n };\n\n // Step 1: Inspect current state. We do this BEFORE mutating\n // anything so the user can decide whether to bail.\n const filesDir = getTenantFilesDir(tenant);\n const folderInitialised = fs.existsSync(filesDir);\n let preStatus: SyncStatus | null = null;\n let preStatusError: Error | null = null;\n if (folderInitialised) {\n try {\n preStatus = await syncService.getStatus({ ...filterOptions, all: options.all, deep: false });\n } catch (error) {\n preStatusError = error as Error;\n logger.dim(`Could not compute pre-pull status: ${preStatusError.message}`);\n }\n }\n\n const localChanges = preStatus\n ? preStatus.addedLocally.length +\n preStatus.modifiedLocally.length +\n preStatus.deletedLocally.length +\n preStatus.conflicts.length\n : 0;\n\n // Step 2: Decide whether to confirm. The matrix:\n // --force \u2192 always confirm (destructive reset).\n // uncommitted changes + not -y \u2192 confirm (avoid silent merge).\n // clean tree \u2192 just go.\n if (options.force) {\n console.log();\n console.log(chalk.red.bold('--force will hard-reset local to match remote.'));\n if (preStatus) {\n summarisePreStatus(preStatus);\n } else if (preStatusError) {\n // Without a local diff we'd be confirming a destructive\n // mirror operation blind. Refuse rather than press on \u2014\n // the cost of failing here is one re-run; the cost of\n // pressing on is silent loss of in-progress files.\n console.log(\n chalk.red(\n 'Cannot show what will be lost \u2014 pre-pull status failed (see line above). Refusing to --force without visibility.',\n ),\n );\n logger.dim('Re-run after the underlying issue clears, or use a non-force pull to merge.');\n process.exit(1);\n } else {\n // Folder isn't initialised yet \u2014 first --force pull on a\n // brand-new tenant. Nothing local to lose; proceed.\n logger.dim('No local files yet \u2014 nothing to discard.');\n }\n const confirm = await inquirer.prompt([\n {\n type: 'confirm',\n name: 'proceed',\n message: `Discard local changes and reset ${tenant} to remote?`,\n default: false,\n },\n ]);\n if (!confirm.proceed) {\n logger.info('Pull cancelled.');\n return;\n }\n } else if (localChanges > 0 && !options.yes) {\n console.log();\n logger.warning(`Local has ${localChanges} unsynced change(s).`);\n summarisePreStatus(preStatus!);\n logger.dim('Pull will keep your edits and merge remote-side changes around them.');\n logger.dim('To wipe local and reset to remote: re-run with --force.');\n const confirm = await inquirer.prompt([\n {\n type: 'confirm',\n name: 'proceed',\n message: `Continue pulling into a dirty working tree?`,\n default: true,\n },\n ]);\n if (!confirm.proceed) {\n logger.info('Pull cancelled.');\n return;\n }\n }\n\n console.log();\n console.log(chalk.bold('\u2550\u2550\u2550 Files \u2550\u2550\u2550'));\n logger.info(`Pulling files from ${tenant}...`);\n\n try {\n let result = await syncService.pull(syncOptions);\n\n // Conflicts: prompt per file (only when not --force).\n if (result.conflicts.length > 0 && !options.force) {\n console.log();\n console.log(chalk.red.bold(`${result.conflicts.length} conflict(s) detected:`));\n console.log();\n for (const conflict of result.conflicts) {\n console.log(chalk.red(` ! ${conflict.filePath}`));\n console.log(chalk.dim(` ${conflict.description}`));\n }\n console.log();\n\n const resolutions: ConflictResolutions = {};\n for (const conflict of result.conflicts) {\n let choices: { name: string; value: string }[];\n if (conflict.type === 'local_modified_remote_deleted') {\n choices = [\n { name: 'Keep local (keep your modified file)', value: 'keep_local' },\n { name: 'Accept deletion (delete local file)', value: 'keep_remote' },\n ];\n } else if (conflict.type === 'local_deleted_remote_modified') {\n choices = [\n { name: \"Keep deleted (don't restore file)\", value: 'keep_local' },\n { name: 'Restore remote version', value: 'keep_remote' },\n ];\n } else {\n choices = [\n { name: 'Keep local version', value: 'keep_local' },\n { name: 'Use remote version (overwrite local)', value: 'keep_remote' },\n { name: 'Keep both (save remote as .remote file)', value: 'keep_both' },\n ];\n // Only offer git-style merge for files we know\n // are text. Binary blobs would just get\n // corrupted by UTF-8 splicing. The service has\n // a defensive fallback for binary anyway, but\n // not showing the option avoids the confusing\n // \"I picked merge_markers but got keep_both\"\n // experience.\n if (isLikelyTextFile(conflict.filePath)) {\n choices.push({\n name: 'Merge with markers (git-style \u2014 edit file, then push to finish)',\n value: 'merge_markers',\n });\n }\n }\n const answer = await inquirer.prompt([\n {\n type: 'list',\n name: 'resolution',\n message: `${conflict.filePath} - ${conflict.description}`,\n choices,\n },\n ]);\n resolutions[conflict.filePath] = answer.resolution;\n }\n result = await syncService.pull({ ...syncOptions, conflictResolutions: resolutions });\n }\n\n if (result.downloaded.length > 0) {\n console.log(chalk.green('Downloaded:'));\n for (const file of result.downloaded) console.log(chalk.green(` + ${file}`));\n }\n\n if (result.deleted.length > 0) {\n console.log(chalk.red('Deleted (removed from remote):'));\n for (const file of result.deleted) console.log(chalk.red(` - ${file}`));\n }\n\n if (result.conflictFilesWritten.length > 0) {\n console.log(chalk.yellow('Conflict files created:'));\n for (const file of result.conflictFilesWritten) console.log(chalk.yellow(` ~ ${file}`));\n if (result.conflictFilesWritten.some((f) => f.includes('(merge markers)'))) {\n console.log();\n logger.dim('Files marked with \"(merge markers)\" contain git-style <<<<<<</=======/>>>>>>>');\n logger.dim('blocks. Open them, pick which version to keep, remove the marker lines,');\n logger.dim(`then run \\`farseer push ${tenant}\\` to upload the resolved version.`);\n }\n }\n\n logger.dim(\n `Files: +${result.downloaded.length} -${result.deleted.length} (${result.unchanged.length} unchanged)`,\n );\n\n // --force extra: also delete any local-only files. The\n // service-level pull keeps `local_new` files unchanged\n // (it's the right default for a non-destructive pull),\n // but --force at the command layer means \"mirror remote\",\n // so remove those locally.\n let extraLocalDeletes: string[] = [];\n if (options.force) {\n // Forward `--all` so `pull --force --all` wipes every\n // local-only file in scope, not just those that match\n // the default sync scope.\n extraLocalDeletes = await wipeLocalOnly(syncService, filesDir, {\n ...filterOptions,\n all: options.all,\n });\n if (extraLocalDeletes.length > 0) {\n console.log(chalk.red('Local-only files removed (mirror remote):'));\n for (const file of extraLocalDeletes) console.log(chalk.red(` - ${file}`));\n }\n }\n\n // Audit log\n if (result.downloaded.length > 0) {\n const syncState = syncService.loadSyncState();\n const auditEntries: AuditLogEntry[] = result.downloaded.map((filePath) => ({\n operation: 'pulled' as const,\n filePath,\n uploadTime: syncState.files[filePath]?.metadata?.uploadTime,\n uploaderEmail: syncState.files[filePath]?.metadata?.uploaderEmail,\n uploaderName: syncState.files[filePath]?.metadata?.uploaderName,\n }));\n appendToAuditLog(tenant, auditEntries);\n }\n\n let hasChanges =\n result.downloaded.length > 0 || result.deleted.length > 0 || extraLocalDeletes.length > 0;\n\n console.log();\n console.log(chalk.bold('\u2550\u2550\u2550 Apps \u2550\u2550\u2550'));\n logger.info(`Pulling apps from ${tenant}...`);\n\n const appSyncService = new AppSyncService(tenant, clientResult.client);\n const appResult = await appSyncService.pull();\n\n if (appResult.created.length > 0) {\n console.log(chalk.green('New apps:'));\n for (const app of appResult.created) console.log(chalk.green(` + ${app}`));\n }\n if (appResult.updated.length > 0) {\n console.log(chalk.yellow('Updated apps:'));\n for (const app of appResult.updated) console.log(chalk.yellow(` ~ ${app}`));\n }\n if (appResult.deleted.length > 0) {\n console.log(chalk.red('Deleted apps (removed from remote):'));\n for (const app of appResult.deleted) console.log(chalk.red(` - ${app}`));\n }\n\n logger.dim(\n `Apps: +${appResult.created.length} ~${appResult.updated.length} -${appResult.deleted.length} (${appResult.unchanged.length} unchanged)`,\n );\n\n hasChanges =\n hasChanges ||\n appResult.created.length > 0 ||\n appResult.updated.length > 0 ||\n appResult.deleted.length > 0;\n\n if (!hasChanges) {\n logger.success('Already up to date.');\n return;\n }\n\n console.log();\n console.log(chalk.bold('\u2550\u2550\u2550 Summary \u2550\u2550\u2550'));\n logger.success('Pull complete!');\n logger.dim(\n `Files: +${result.downloaded.length} -${result.deleted.length} ${\n extraLocalDeletes.length > 0 ? `(${extraLocalDeletes.length} local-only removed) ` : ''\n }(${result.unchanged.length} unchanged)`,\n );\n logger.dim(\n `Apps: +${appResult.created.length} ~${appResult.updated.length} -${appResult.deleted.length} (${appResult.unchanged.length} unchanged)`,\n );\n } catch (error) {\n fileLogger.error('pull', error);\n logger.error('Pull failed.');\n logger.error(await formatClientError(error));\n const logPath = fileLogger.getLogPath();\n if (logPath) {\n logger.dim(`Debug log: ${logPath}`);\n }\n process.exit(1);\n }\n });\n}\n\n/**\n * Print actual paths (not just counts) so the user can see what local\n * changes a `pull --force` is about to overwrite. Counts alone hid the\n * destructive blast radius: under `--force --all` someone could lose\n * dozens of in-progress files without knowing which ones. Cap at\n * MAX_PATHS_PER_SECTION per section to avoid scrollback floods on huge\n * trees \u2014 anything beyond that collapses into \"+ N more\".\n */\nfunction summarisePreStatus(status: SyncStatus): void {\n const MAX_PATHS_PER_SECTION = 20;\n const renderSection = (label: string, paths: string[], color: (s: string) => string) => {\n if (paths.length === 0) return;\n console.log(color(` ${label} (${paths.length}):`));\n const visible = paths.slice(0, MAX_PATHS_PER_SECTION);\n for (const p of visible) console.log(color(` ${p}`));\n if (paths.length > MAX_PATHS_PER_SECTION) {\n console.log(chalk.dim(` ... and ${paths.length - MAX_PATHS_PER_SECTION} more`));\n }\n };\n renderSection('+ new local file(s)', status.addedLocally, chalk.green);\n renderSection('M locally modified file(s)', status.modifiedLocally, chalk.yellow);\n renderSection('- locally deleted file(s)', status.deletedLocally, chalk.red);\n if (status.conflicts.length > 0) {\n const conflictPaths = status.conflicts.map((c) => c.filePath);\n renderSection('! conflict(s)', conflictPaths, chalk.red.bold);\n }\n console.log();\n}\n\n/**\n * Hard-reset helper for `pull --force`. Removes local files that have no\n * remote counterpart (the regular pull keeps them \u2014 see service comment).\n * Cleans up the syncState entry too so the next status doesn't show ghosts.\n */\nasync function wipeLocalOnly(\n syncService: SyncService,\n filesDir: string,\n filterOptions: { all?: boolean; includeExtensions?: string[]; includeFolders?: string[] },\n): Promise<string[]> {\n // `all` matters: under `pull --force --all` the user expects every\n // local-only file to be wiped, not just files in the default sync\n // scope. Without it, getStatus filters down to the curated developer\n // files (.ts, .js, .py, .yml, .yaml, .md, .json) outside hidden\n // directories and the folder blocklist, so the wipe loop never sees\n // anything those rules exclude.\n const status = await syncService.getStatus({ ...filterOptions, deep: false });\n const removed: string[] = [];\n const failed: { file: string; reason: string }[] = [];\n const syncState = syncService.loadSyncState();\n for (const file of status.addedLocally) {\n const fullPath = safeResolveWithinBase(filesDir, file);\n if (fs.existsSync(fullPath)) {\n // Wrap each unlink so a single permission error / file lock\n // doesn't strand the rest of the wipe. syncState is saved\n // incrementally as each unlink succeeds so a mid-run failure\n // leaves a consistent record for the next run, and the failed\n // list is surfaced at the end for manual cleanup.\n try {\n fs.unlinkSync(fullPath);\n removed.push(file);\n delete syncState.files[file];\n syncService.saveSyncState(syncState);\n } catch (err) {\n failed.push({ file, reason: err instanceof Error ? err.message : String(err) });\n }\n } else {\n // File was already gone \u2014 just drop the syncState entry.\n delete syncState.files[file];\n syncService.saveSyncState(syncState);\n }\n }\n if (failed.length > 0) {\n logger.warning(`${failed.length} local-only file(s) could not be removed:`);\n for (const f of failed) logger.dim(` ${f.file} \u2014 ${f.reason}`);\n }\n return removed;\n}\n\nasync function createDefaultPackageJson(tenantDir: string, tenant: string): Promise<void> {\n const packageJsonPath = path.join(tenantDir, 'package.json');\n\n if (fs.existsSync(packageJsonPath)) {\n return;\n }\n\n const packageJson = {\n name: `farseer-scripts-${tenant}`,\n version: '1.0.0',\n description: `Farseer App scripts for ${tenant}`,\n main: 'src/index.ts',\n scripts: {},\n keywords: ['farseer', 'scripts', tenant],\n author: 'Farseer',\n license: 'ISC',\n dependencies: {\n '@google-cloud/bigquery': '^7.9.0',\n '@google-cloud/storage': '^7.12.1',\n '@googleapis/sheets': '^5.0.5',\n '@sendgrid/mail': '^7.7.0',\n '@types/node-forge': '^1.3.11',\n '@xmldom/xmldom': '^0.9.8',\n arquero: '^5.4.1',\n axios: '^1.10.0',\n 'axios-retry': '^3.9.1',\n 'basic-ftp': '^5.0.5',\n 'client-oauth2': '^4.3.3',\n 'csv-parser': '^3.0.0',\n dotenv: '^16.4.5',\n 'draft-js': '^0.11.7',\n exceljs: '^4.4.0',\n 'farseer-client': FARSEER_CLIENT_URL,\n 'farseer-client-axios': FARSEER_CLIENT_AXIOS_URL,\n 'fast-xml-parser': '^4.5.0',\n 'form-data': '^4.0.0',\n googleapis: '^144.0.0',\n heapdump: '^0.3.15',\n 'image-size': '^1.1.1',\n jszip: '^3.10.1',\n 'lossless-json': '^4.0.1',\n mssql: '^10.0.4',\n 'node-fetch': '^2.7.0',\n 'node-forge': '^1.3.1',\n 'node-sp-auth': '^3.0.8',\n numeral: '^2.0.6',\n oracledb: '^6.6.0',\n papaparse: '^5.5.1',\n pdfkit: '^0.14.0',\n pdfmake: '^0.2.20',\n soap: '^1.1.11',\n 'ssh2-sftp-client': '^11.0.0',\n 'strong-soap': '^4.1.13',\n 'ts-node': '^10.9.2',\n typescript: '^5.5.4',\n undici: '^6.19.8',\n uuid: '^11.1.0',\n winston: '^3.17.0',\n xlsx: 'https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz',\n 'xml-crypto': '^6.1.2',\n },\n devDependencies: {\n '@types/draft-js': '^0.11.18',\n '@types/heapdump': '^0.3.4',\n '@types/mssql': '^9.1.5',\n '@types/node': '^18.19.50',\n '@types/node-fetch': '^2.6.11',\n '@types/numeral': '^2.0.5',\n '@types/oracledb': '^6.5.3',\n '@types/papaparse': '^5.3.15',\n '@types/pdfmake': '^0.2.11',\n '@types/soap': '^0.18.0',\n '@types/ssh2-sftp-client': '^9.0.4',\n '@types/tough-cookie': '^4.0.5',\n '@types/uuid': '^10.0.0',\n '@types/xmldom': '^0.1.34',\n 'ts-node': '^10.9.2',\n typescript: '^5.5.4',\n },\n };\n\n fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2), 'utf-8');\n logger.dim(`Created package.json for ${tenant}`);\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAkB;AAClB,sBAAqB;AACrB,oBAAuB;AACvB,wBAA2B;AAC3B,4BAA8D;AAC9D,yBAA6D;AAC7D,4BAA+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AAkB;AAAA,MAClB,wBAAwB;AAAA,MACxB,mBAAmB;AAAA,MACnB,aAAa;AAAA,MACb,YAAY;AAAA,MACZ,UAAU;AAAA,MACV,cAAc;AAAA,MACd,OAAO;AAAA,MACP,iBAAiB;AAAA,MACjB,OAAO;AAAA,MACP,cAAc;AAAA,MACd,cAAc;AAAA,MACd,gBAAgB;AAAA,MAChB,SAAS;AAAA,MACT,UAAU;AAAA,MACV,WAAW;AAAA,MACX,QAAQ;AAAA,MACR,SAAS;AAAA,MACT,MAAM;AAAA,MACN,oBAAoB;AAAA,MACpB,eAAe;AAAA,MACf,WAAW;AAAA,MACX,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,MAAM;AAAA,MACN,SAAS;AAAA,MACT,MAAM;AAAA,MACN,cAAc;AAAA,IAClB;AAAA,IACA,iBAAiB;AAAA,MACb,mBAAmB;AAAA,MACnB,mBAAmB;AAAA,MACnB,gBAAgB;AAAA,MAChB,eAAe;AAAA,MACf,qBAAqB;AAAA,MACrB,kBAAkB;AAAA,MAClB,mBAAmB;AAAA,MACnB,oBAAoB;AAAA,MACpB,kBAAkB;AAAA,MAClB,eAAe;AAAA,MACf,2BAA2B;AAAA,MAC3B,uBAAuB;AAAA,MACvB,eAAe;AAAA,MACf,iBAAiB;AAAA,MACjB,WAAW;AAAA,MACX,YAAY;AAAA,IAChB;AAAA,EACJ;AAEA,KAAG,cAAc,iBAAiB,KAAK,UAAU,aAAa,MAAM,CAAC,GAAG,OAAO;AAC/E,uBAAO,IAAI,4BAA4B,MAAM,EAAE;AACnD;",
4
+ "sourcesContent": ["import { Command } from 'commander';\nimport chalk from 'chalk';\nimport inquirer from 'inquirer';\nimport { logger } from '../utils/logger';\nimport { fileLogger } from '../utils/fileLogger';\nimport { getFarseerClientWithFallback, showLoginPrompt } from '../services/farseerFactory';\nimport { SyncService, ConflictResolutions, SyncStatus } from '../services/syncService';\nimport { AppSyncService } from '../services/appSyncService';\nimport {\n getTenantDir,\n getTenantFilesDir,\n ensureDirectoryExists,\n resolveTenantWithOrgMapping,\n appendToAuditLog,\n AuditLogEntry,\n safeResolveWithinBase,\n} from '../utils/helpers';\nimport { formatClientError } from '../utils/errorFormatter';\nimport { isLikelyTextFile } from '../utils/fileValidation';\nimport { collectValues, normalizeExtensions } from '../utils/cliOptions';\nimport { FARSEER_CLIENT_URL, FARSEER_CLIENT_AXIOS_URL } from '../utils/constants';\nimport { ensureGitignoreEntries } from '../utils/workspace';\nimport * as fs from 'fs';\nimport * as path from 'path';\n\n/**\n * Pull semantics:\n *\n * farseer pull\n * 1. Show local-vs-remote diff. If you have unsynced local edits OR\n * remote has deletions that would remove local files/apps, the\n * command stops here and asks for confirmation before doing\n * anything (we don't merge or delete silently).\n * 2. Apply remote-side changes (downloads, deletions, modifications).\n * Per-file conflicts are resolved interactively.\n *\n * farseer pull --force\n * Hard reset to remote. After it runs, the working tree mirrors what's\n * on remote: any file that exists locally but not on remote is deleted,\n * remote versions overwrite local edits, deletions are accepted. Always\n * asks for confirmation because the operation is destructive.\n */\nexport function registerPullCommand(program: Command): void {\n program\n .command('pull [org] [tenant]')\n .description(\n 'Pull files from Farseer instance to local\\n\\nUsage: pull <org> <tenant> OR pull <tenant> (if org is known)',\n )\n .option(\n '--all',\n 'Pull every non-hidden, non-blocklisted file (default: developer files (.ts, .js, .py, .yml, .yaml, .md, .json) outside hidden directories and the folder blocklist). Data files (.csv, .xlsx, .parquet, \u2026) are backend-accepted but excluded from default \u2014 opt in via --include-ext .csv or `farseer config include --ext .csv`.',\n )\n .option(\n '--force',\n 'Hard reset local to remote within the current sync scope: overwrite local edits, delete local-only files. Files outside scope (data files like .csv on a default run without --include-ext .csv) are NOT touched. Always asks for confirmation.',\n )\n .option(\n '-y, --yes',\n 'Skip confirmation when local has uncommitted changes OR remote has deletions that would remove local files/apps (ignored under --force)',\n )\n .option('--include-ext <ext>', 'Include extra file extension (repeatable)', collectValues, [])\n .option('--include-folder <folder>', 'Include all files in folder (repeatable)', collectValues, [])\n .action(async (arg1, arg2, options) => {\n const { organisation, tenant } = resolveTenantWithOrgMapping(arg1, arg2);\n const clientResult = await getFarseerClientWithFallback(organisation, tenant);\n\n if (!clientResult) {\n showLoginPrompt(tenant);\n process.exit(1);\n }\n\n const syncService = new SyncService(tenant, clientResult.client);\n\n const tenantDir = getTenantDir(tenant);\n ensureDirectoryExists(tenantDir);\n\n // Ensure .gitignore covers `.farseer-sync.json` on every direct\n // pull, not only checkout-driven pulls. A workspace that\n // initializes with `farseer pull` (no prior checkout, or\n // `checkout --no-pull` then `pull`) would otherwise commit the\n // per-machine baseline and reproduce the cross-machine drift\n // bug the gitignore exists to prevent.\n ensureGitignoreEntries(path.join(tenantDir, '.gitignore'));\n\n await createDefaultPackageJson(tenantDir, tenant);\n\n const includeExtensions = normalizeExtensions(options.includeExt);\n const includeFolders = options.includeFolder as string[];\n const filterOptions = {\n includeExtensions: includeExtensions.length > 0 ? includeExtensions : undefined,\n includeFolders: includeFolders.length > 0 ? includeFolders : undefined,\n };\n const syncOptions = {\n all: options.all,\n force: options.force,\n ...filterOptions,\n };\n\n // Step 1: Inspect current state. We do this BEFORE mutating\n // anything so the user can decide whether to bail.\n const filesDir = getTenantFilesDir(tenant);\n const folderInitialised = fs.existsSync(filesDir);\n let preStatus: SyncStatus | null = null;\n let preStatusError: Error | null = null;\n if (folderInitialised) {\n try {\n preStatus = await syncService.getStatus({ ...filterOptions, all: options.all, deep: false });\n } catch (error) {\n preStatusError = error as Error;\n logger.dim(`Could not compute pre-pull status: ${preStatusError.message}`);\n }\n }\n\n // Preview app deletions too. Without this the destructive\n // prompt only covers files and the user discovers (post-pull)\n // that an app JSON was wiped because someone deleted the app\n // on remote. Uses listApps only \u2014 no per-app fetch \u2014 so this\n // doesn't double the network cost of the apps pull below.\n //\n // Best-effort: a failure here shouldn't block the pull. Worst\n // case the user gets the legacy behaviour (silent app\n // deletion) on this run.\n const appSyncService = new AppSyncService(tenant, clientResult.client);\n let appDeletions: string[] = [];\n try {\n appDeletions = await appSyncService.getRemoteDeletions();\n } catch (error) {\n logger.dim(`Could not compute pre-pull app deletions: ${(error as Error).message}`);\n }\n\n const localChanges = preStatus\n ? preStatus.addedLocally.length +\n preStatus.modifiedLocally.length +\n preStatus.deletedLocally.length +\n preStatus.conflicts.length\n : 0;\n const remoteDeletions = (preStatus?.deletedRemotely.length ?? 0) + appDeletions.length;\n\n // Step 2: Decide whether to confirm. The matrix:\n // --force \u2192 always confirm (destructive reset).\n // local edits OR remote deletions \u2192 confirm unless -y.\n // clean tree, no deletes \u2192 just go.\n //\n // Remote deletions are gated because pull would silently\n // remove a previously-synced local file/app if someone deleted\n // it on remote \u2014 a real script could vanish without warning.\n // Local edits stay gated for the existing reason: we don't\n // want to merge into a dirty tree without an opt-in.\n if (options.force) {\n console.log();\n console.log(chalk.red.bold('--force will hard-reset local to match remote.'));\n if (preStatus) {\n summarisePreStatus(preStatus);\n } else if (preStatusError) {\n // Without a local diff we'd be confirming a destructive\n // mirror operation blind. Refuse rather than press on \u2014\n // the cost of failing here is one re-run; the cost of\n // pressing on is silent loss of in-progress files.\n console.log(\n chalk.red(\n 'Cannot show what will be lost \u2014 pre-pull status failed (see line above). Refusing to --force without visibility.',\n ),\n );\n logger.dim('Re-run after the underlying issue clears, or use a non-force pull to merge.');\n process.exit(1);\n } else {\n // Folder isn't initialised yet \u2014 first --force pull on a\n // brand-new tenant. Nothing local to lose; proceed.\n logger.dim('No local files yet \u2014 nothing to discard.');\n }\n const confirm = await inquirer.prompt([\n {\n type: 'confirm',\n name: 'proceed',\n message: `Discard local changes and reset ${tenant} to remote?`,\n default: false,\n },\n ]);\n if (!confirm.proceed) {\n logger.info('Pull cancelled.');\n return;\n }\n } else if ((localChanges > 0 || remoteDeletions > 0) && !options.yes) {\n console.log();\n if (localChanges > 0) {\n logger.warning(`Local has ${localChanges} unsynced change(s).`);\n summarisePreStatus(preStatus!);\n logger.dim('Pull will keep your edits and merge remote-side changes around them.');\n }\n if (remoteDeletions > 0) {\n logger.warning(`Pull will remove ${remoteDeletions} local item(s) that were deleted on remote:`);\n summariseRemoteDeletions(preStatus?.deletedRemotely ?? [], appDeletions);\n logger.dim('Decline to abort and keep your local copies (you can push them back to restore).');\n }\n if (localChanges > 0 && remoteDeletions === 0) {\n logger.dim('To wipe local and reset to remote: re-run with --force.');\n }\n const promptMessage =\n remoteDeletions > 0 && localChanges > 0\n ? `Continue pull (merge into dirty tree AND delete ${remoteDeletions} local item(s))?`\n : remoteDeletions > 0\n ? `Continue pull and delete ${remoteDeletions} local item(s)?`\n : `Continue pulling into a dirty working tree?`;\n // Dirty-tree-only keeps the soft default (Enter = continue\n // merge). The moment remote deletions are on the table we\n // flip to default-false: a wrong \"yes\" wipes local items\n // for good, same calculus as `pull --force` below.\n const confirm = await inquirer.prompt([\n {\n type: 'confirm',\n name: 'proceed',\n message: promptMessage,\n default: remoteDeletions === 0,\n },\n ]);\n if (!confirm.proceed) {\n logger.info('Pull cancelled.');\n return;\n }\n }\n\n console.log();\n console.log(chalk.bold('\u2550\u2550\u2550 Files \u2550\u2550\u2550'));\n logger.info(`Pulling files from ${tenant}...`);\n\n try {\n let result = await syncService.pull(syncOptions);\n\n // Conflicts: prompt per file (only when not --force).\n if (result.conflicts.length > 0 && !options.force) {\n console.log();\n console.log(chalk.red.bold(`${result.conflicts.length} conflict(s) detected:`));\n console.log();\n for (const conflict of result.conflicts) {\n console.log(chalk.red(` ! ${conflict.filePath}`));\n console.log(chalk.dim(` ${conflict.description}`));\n }\n console.log();\n\n const resolutions: ConflictResolutions = {};\n for (const conflict of result.conflicts) {\n let choices: { name: string; value: string }[];\n if (conflict.type === 'local_modified_remote_deleted') {\n choices = [\n { name: 'Keep local (keep your modified file)', value: 'keep_local' },\n { name: 'Accept deletion (delete local file)', value: 'keep_remote' },\n ];\n } else if (conflict.type === 'local_deleted_remote_modified') {\n choices = [\n { name: \"Keep deleted (don't restore file)\", value: 'keep_local' },\n { name: 'Restore remote version', value: 'keep_remote' },\n ];\n } else {\n choices = [\n { name: 'Keep local version', value: 'keep_local' },\n { name: 'Use remote version (overwrite local)', value: 'keep_remote' },\n { name: 'Keep both (save remote as .remote file)', value: 'keep_both' },\n ];\n // Only offer git-style merge for files we know\n // are text. Binary blobs would just get\n // corrupted by UTF-8 splicing. The service has\n // a defensive fallback for binary anyway, but\n // not showing the option avoids the confusing\n // \"I picked merge_markers but got keep_both\"\n // experience.\n if (isLikelyTextFile(conflict.filePath)) {\n choices.push({\n name: 'Merge with markers (git-style \u2014 edit file, then push to finish)',\n value: 'merge_markers',\n });\n }\n }\n const answer = await inquirer.prompt([\n {\n type: 'list',\n name: 'resolution',\n message: `${conflict.filePath} - ${conflict.description}`,\n choices,\n },\n ]);\n resolutions[conflict.filePath] = answer.resolution;\n }\n result = await syncService.pull({ ...syncOptions, conflictResolutions: resolutions });\n }\n\n if (result.downloaded.length > 0) {\n console.log(chalk.green('Downloaded:'));\n for (const file of result.downloaded) console.log(chalk.green(` + ${file}`));\n }\n\n if (result.deleted.length > 0) {\n console.log(chalk.red('Deleted (removed from remote):'));\n for (const file of result.deleted) console.log(chalk.red(` - ${file}`));\n }\n\n if (result.conflictFilesWritten.length > 0) {\n console.log(chalk.yellow('Conflict files created:'));\n for (const file of result.conflictFilesWritten) console.log(chalk.yellow(` ~ ${file}`));\n if (result.conflictFilesWritten.some((f) => f.includes('(merge markers)'))) {\n console.log();\n logger.dim('Files marked with \"(merge markers)\" contain git-style <<<<<<</=======/>>>>>>>');\n logger.dim('blocks. Open them, pick which version to keep, remove the marker lines,');\n logger.dim(`then run \\`farseer push ${tenant}\\` to upload the resolved version.`);\n }\n }\n\n logger.dim(\n `Files: +${result.downloaded.length} -${result.deleted.length} (${result.unchanged.length} unchanged)`,\n );\n\n // --force extra: also delete any local-only files. The\n // service-level pull keeps `local_new` files unchanged\n // (it's the right default for a non-destructive pull),\n // but --force at the command layer means \"mirror remote\",\n // so remove those locally.\n let extraLocalDeletes: string[] = [];\n if (options.force) {\n // Forward `--all` so `pull --force --all` wipes every\n // local-only file in scope, not just those that match\n // the default sync scope.\n extraLocalDeletes = await wipeLocalOnly(syncService, filesDir, {\n ...filterOptions,\n all: options.all,\n });\n if (extraLocalDeletes.length > 0) {\n console.log(chalk.red('Local-only files removed (mirror remote):'));\n for (const file of extraLocalDeletes) console.log(chalk.red(` - ${file}`));\n }\n }\n\n // Audit log\n if (result.downloaded.length > 0) {\n const syncState = syncService.loadSyncState();\n const auditEntries: AuditLogEntry[] = result.downloaded.map((filePath) => ({\n operation: 'pulled' as const,\n filePath,\n uploadTime: syncState.files[filePath]?.metadata?.uploadTime,\n uploaderEmail: syncState.files[filePath]?.metadata?.uploaderEmail,\n uploaderName: syncState.files[filePath]?.metadata?.uploaderName,\n }));\n appendToAuditLog(tenant, auditEntries);\n }\n\n let hasChanges =\n result.downloaded.length > 0 || result.deleted.length > 0 || extraLocalDeletes.length > 0;\n\n console.log();\n console.log(chalk.bold('\u2550\u2550\u2550 Apps \u2550\u2550\u2550'));\n logger.info(`Pulling apps from ${tenant}...`);\n\n const appResult = await appSyncService.pull();\n\n if (appResult.created.length > 0) {\n console.log(chalk.green('New apps:'));\n for (const app of appResult.created) console.log(chalk.green(` + ${app}`));\n }\n if (appResult.updated.length > 0) {\n console.log(chalk.yellow('Updated apps:'));\n for (const app of appResult.updated) console.log(chalk.yellow(` ~ ${app}`));\n }\n if (appResult.deleted.length > 0) {\n console.log(chalk.red('Deleted apps (removed from remote):'));\n for (const app of appResult.deleted) console.log(chalk.red(` - ${app}`));\n }\n\n logger.dim(\n `Apps: +${appResult.created.length} ~${appResult.updated.length} -${appResult.deleted.length} (${appResult.unchanged.length} unchanged)`,\n );\n\n hasChanges =\n hasChanges ||\n appResult.created.length > 0 ||\n appResult.updated.length > 0 ||\n appResult.deleted.length > 0;\n\n if (!hasChanges) {\n logger.success('Already up to date.');\n return;\n }\n\n console.log();\n console.log(chalk.bold('\u2550\u2550\u2550 Summary \u2550\u2550\u2550'));\n logger.success('Pull complete!');\n logger.dim(\n `Files: +${result.downloaded.length} -${result.deleted.length} ${\n extraLocalDeletes.length > 0 ? `(${extraLocalDeletes.length} local-only removed) ` : ''\n }(${result.unchanged.length} unchanged)`,\n );\n logger.dim(\n `Apps: +${appResult.created.length} ~${appResult.updated.length} -${appResult.deleted.length} (${appResult.unchanged.length} unchanged)`,\n );\n } catch (error) {\n fileLogger.error('pull', error);\n logger.error('Pull failed.');\n logger.error(await formatClientError(error));\n const logPath = fileLogger.getLogPath();\n if (logPath) {\n logger.dim(`Debug log: ${logPath}`);\n }\n process.exit(1);\n }\n });\n}\n\n/**\n * Print actual paths (not just counts) so the user can see what local\n * changes a `pull --force` is about to overwrite. Counts alone hid the\n * destructive blast radius: under `--force --all` someone could lose\n * dozens of in-progress files without knowing which ones. Cap at\n * MAX_PATHS_PER_SECTION per section to avoid scrollback floods on huge\n * trees \u2014 anything beyond that collapses into \"+ N more\".\n */\nfunction summarisePreStatus(status: SyncStatus): void {\n const MAX_PATHS_PER_SECTION = 20;\n const renderSection = (label: string, paths: string[], color: (s: string) => string) => {\n if (paths.length === 0) return;\n console.log(color(` ${label} (${paths.length}):`));\n const visible = paths.slice(0, MAX_PATHS_PER_SECTION);\n for (const p of visible) console.log(color(` ${p}`));\n if (paths.length > MAX_PATHS_PER_SECTION) {\n console.log(chalk.dim(` ... and ${paths.length - MAX_PATHS_PER_SECTION} more`));\n }\n };\n renderSection('+ new local file(s)', status.addedLocally, chalk.green);\n renderSection('M locally modified file(s)', status.modifiedLocally, chalk.yellow);\n renderSection('- locally deleted file(s)', status.deletedLocally, chalk.red);\n if (status.conflicts.length > 0) {\n const conflictPaths = status.conflicts.map((c) => c.filePath);\n renderSection('! conflict(s)', conflictPaths, chalk.red.bold);\n }\n console.log();\n}\n\n/**\n * Print the file + app paths that pull is about to delete because remote\n * removed them. Same cap as `summarisePreStatus` so a huge purge doesn't\n * flood the scrollback \u2014 the user still gets the count above.\n */\nfunction summariseRemoteDeletions(deletedFiles: string[], deletedApps: string[]): void {\n const MAX_PATHS_PER_SECTION = 20;\n const renderSection = (label: string, paths: string[]) => {\n if (paths.length === 0) return;\n console.log(chalk.red(` ${label} (${paths.length}):`));\n const visible = paths.slice(0, MAX_PATHS_PER_SECTION);\n for (const p of visible) console.log(chalk.red(` - ${p}`));\n if (paths.length > MAX_PATHS_PER_SECTION) {\n console.log(chalk.dim(` ... and ${paths.length - MAX_PATHS_PER_SECTION} more`));\n }\n };\n renderSection('file(s) deleted on remote', deletedFiles);\n renderSection('app(s) deleted on remote', deletedApps);\n console.log();\n}\n\n/**\n * Hard-reset helper for `pull --force`. Removes local files that have no\n * remote counterpart (the regular pull keeps them \u2014 see service comment).\n * Cleans up the syncState entry too so the next status doesn't show ghosts.\n */\nasync function wipeLocalOnly(\n syncService: SyncService,\n filesDir: string,\n filterOptions: { all?: boolean; includeExtensions?: string[]; includeFolders?: string[] },\n): Promise<string[]> {\n // `all` matters: under `pull --force --all` the user expects every\n // local-only file to be wiped, not just files in the default sync\n // scope. Without it, getStatus filters down to the curated developer\n // files (.ts, .js, .py, .yml, .yaml, .md, .json) outside hidden\n // directories and the folder blocklist, so the wipe loop never sees\n // anything those rules exclude.\n const status = await syncService.getStatus({ ...filterOptions, deep: false });\n const removed: string[] = [];\n const failed: { file: string; reason: string }[] = [];\n const syncState = syncService.loadSyncState();\n for (const file of status.addedLocally) {\n const fullPath = safeResolveWithinBase(filesDir, file);\n if (fs.existsSync(fullPath)) {\n // Wrap each unlink so a single permission error / file lock\n // doesn't strand the rest of the wipe. syncState is saved\n // incrementally as each unlink succeeds so a mid-run failure\n // leaves a consistent record for the next run, and the failed\n // list is surfaced at the end for manual cleanup.\n try {\n fs.unlinkSync(fullPath);\n removed.push(file);\n delete syncState.files[file];\n syncService.saveSyncState(syncState);\n } catch (err) {\n failed.push({ file, reason: err instanceof Error ? err.message : String(err) });\n }\n } else {\n // File was already gone \u2014 just drop the syncState entry.\n delete syncState.files[file];\n syncService.saveSyncState(syncState);\n }\n }\n if (failed.length > 0) {\n logger.warning(`${failed.length} local-only file(s) could not be removed:`);\n for (const f of failed) logger.dim(` ${f.file} \u2014 ${f.reason}`);\n }\n return removed;\n}\n\nasync function createDefaultPackageJson(tenantDir: string, tenant: string): Promise<void> {\n const packageJsonPath = path.join(tenantDir, 'package.json');\n\n if (fs.existsSync(packageJsonPath)) {\n return;\n }\n\n const packageJson = {\n name: `farseer-scripts-${tenant}`,\n version: '1.0.0',\n description: `Farseer App scripts for ${tenant}`,\n main: 'src/index.ts',\n scripts: {},\n keywords: ['farseer', 'scripts', tenant],\n author: 'Farseer',\n license: 'ISC',\n dependencies: {\n '@google-cloud/bigquery': '^7.9.0',\n '@google-cloud/storage': '^7.12.1',\n '@googleapis/sheets': '^5.0.5',\n '@sendgrid/mail': '^7.7.0',\n '@types/node-forge': '^1.3.11',\n '@xmldom/xmldom': '^0.9.8',\n arquero: '^5.4.1',\n axios: '^1.10.0',\n 'axios-retry': '^3.9.1',\n 'basic-ftp': '^5.0.5',\n 'client-oauth2': '^4.3.3',\n 'csv-parser': '^3.0.0',\n dotenv: '^16.4.5',\n 'draft-js': '^0.11.7',\n exceljs: '^4.4.0',\n 'farseer-client': FARSEER_CLIENT_URL,\n 'farseer-client-axios': FARSEER_CLIENT_AXIOS_URL,\n 'fast-xml-parser': '^4.5.0',\n 'form-data': '^4.0.0',\n googleapis: '^144.0.0',\n heapdump: '^0.3.15',\n 'image-size': '^1.1.1',\n jszip: '^3.10.1',\n 'lossless-json': '^4.0.1',\n mssql: '^10.0.4',\n 'node-fetch': '^2.7.0',\n 'node-forge': '^1.3.1',\n 'node-sp-auth': '^3.0.8',\n numeral: '^2.0.6',\n oracledb: '^6.6.0',\n papaparse: '^5.5.1',\n pdfkit: '^0.14.0',\n pdfmake: '^0.2.20',\n soap: '^1.1.11',\n 'ssh2-sftp-client': '^11.0.0',\n 'strong-soap': '^4.1.13',\n 'ts-node': '^10.9.2',\n typescript: '^5.5.4',\n undici: '^6.19.8',\n uuid: '^11.1.0',\n winston: '^3.17.0',\n xlsx: 'https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz',\n 'xml-crypto': '^6.1.2',\n },\n devDependencies: {\n '@types/draft-js': '^0.11.18',\n '@types/heapdump': '^0.3.4',\n '@types/mssql': '^9.1.5',\n '@types/node': '^18.19.50',\n '@types/node-fetch': '^2.6.11',\n '@types/numeral': '^2.0.5',\n '@types/oracledb': '^6.5.3',\n '@types/papaparse': '^5.3.15',\n '@types/pdfmake': '^0.2.11',\n '@types/soap': '^0.18.0',\n '@types/ssh2-sftp-client': '^9.0.4',\n '@types/tough-cookie': '^4.0.5',\n '@types/uuid': '^10.0.0',\n '@types/xmldom': '^0.1.34',\n 'ts-node': '^10.9.2',\n typescript: '^5.5.4',\n },\n };\n\n fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2), 'utf-8');\n logger.dim(`Created package.json for ${tenant}`);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAkB;AAClB,sBAAqB;AACrB,oBAAuB;AACvB,wBAA2B;AAC3B,4BAA8D;AAC9D,yBAA6D;AAC7D,4BAA+B;AAC/B,qBAQO;AACP,4BAAkC;AAClC,4BAAiC;AACjC,wBAAmD;AACnD,uBAA6D;AAC7D,uBAAuC;AACvC,SAAoB;AACpB,WAAsB;AAmBf,SAAS,oBAAoB,SAAwB;AACxD,UACK,QAAQ,qBAAqB,EAC7B;AAAA,IACG;AAAA,EACJ,EACC;AAAA,IACG;AAAA,IACA;AAAA,EACJ,EACC;AAAA,IACG;AAAA,IACA;AAAA,EACJ,EACC;AAAA,IACG;AAAA,IACA;AAAA,EACJ,EACC,OAAO,uBAAuB,6CAA6C,iCAAe,CAAC,CAAC,EAC5F,OAAO,6BAA6B,4CAA4C,iCAAe,CAAC,CAAC,EACjG,OAAO,OAAO,MAAM,MAAM,YAAY;AACnC,UAAM,EAAE,cAAc,OAAO,QAAI,4C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