farseer-cli 1.17.0 → 1.19.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 (161) hide show
  1. package/README.md +3 -3
  2. package/dist/commands/app.js.map +0 -1
  3. package/dist/commands/apps.js.map +0 -1
  4. package/dist/commands/cells.js.map +0 -1
  5. package/dist/commands/code.js.map +0 -1
  6. package/dist/commands/config.js.map +0 -1
  7. package/dist/commands/dashboards.js.map +0 -1
  8. package/dist/commands/diff.js.map +0 -1
  9. package/dist/commands/dimensions.js.map +0 -1
  10. package/dist/commands/files.js.map +0 -1
  11. package/dist/commands/formula.js +16 -7
  12. package/dist/commands/formula.js.map +1 -2
  13. package/dist/commands/install.js.map +0 -1
  14. package/dist/commands/list.js.map +0 -1
  15. package/dist/commands/login.js +3 -3
  16. package/dist/commands/login.js.map +1 -2
  17. package/dist/commands/logout.js.map +0 -1
  18. package/dist/commands/mcp-server.js.map +0 -1
  19. package/dist/commands/model.js.map +0 -1
  20. package/dist/commands/pipeline.js.map +0 -1
  21. package/dist/commands/pull.js +1 -1
  22. package/dist/commands/pull.js.map +1 -2
  23. package/dist/commands/push.js +2 -2
  24. package/dist/commands/push.js.map +1 -2
  25. package/dist/commands/refresh.js.map +0 -1
  26. package/dist/commands/run.js.map +0 -1
  27. package/dist/commands/sheets.js.map +0 -1
  28. package/dist/commands/status.js.map +0 -1
  29. package/dist/commands/tool.js +120 -0
  30. package/dist/commands/tool.js.map +6 -0
  31. package/dist/commands/variables.js.map +0 -1
  32. package/dist/commands/whoami.js.map +0 -1
  33. package/dist/index.js +29 -12
  34. package/dist/index.js.map +1 -2
  35. package/dist/mcp/index.js.map +0 -1
  36. package/dist/mcp/prompts/workflows.js.map +0 -1
  37. package/dist/mcp/resources/documentation.js.map +0 -1
  38. package/dist/mcp/server.js.map +0 -1
  39. package/dist/mcp/skills.js.map +0 -1
  40. package/dist/mcp/tools/appTools.js.map +0 -1
  41. package/dist/mcp/tools/authTools.js +1 -1
  42. package/dist/mcp/tools/authTools.js.map +1 -2
  43. package/dist/mcp/tools/cellTools.js.map +0 -1
  44. package/dist/mcp/tools/dashboardTools.js.map +0 -1
  45. package/dist/mcp/tools/dataTools.js.map +0 -1
  46. package/dist/mcp/tools/folderTools.js.map +0 -1
  47. package/dist/mcp/tools/modelTools.js +65 -23
  48. package/dist/mcp/tools/modelTools.js.map +2 -3
  49. package/dist/mcp/tools/pipelineContract.js.map +0 -1
  50. package/dist/mcp/tools/pipelineTools.js.map +0 -1
  51. package/dist/mcp/tools/runTools.js +6 -2
  52. package/dist/mcp/tools/runTools.js.map +1 -2
  53. package/dist/mcp/tools/sheetTools.js.map +0 -1
  54. package/dist/mcp/tools/syncTools.js +2 -2
  55. package/dist/mcp/tools/syncTools.js.map +1 -2
  56. package/dist/mcp/utils/helpers.js.map +0 -1
  57. package/dist/mcp/utils/launchPin.js +1 -1
  58. package/dist/mcp/utils/launchPin.js.map +1 -2
  59. package/dist/mcp/utils/registerTool.js.map +0 -1
  60. package/dist/mcp/utils/session.js.map +0 -1
  61. package/dist/mcp/utils/tenantPin.js.map +0 -1
  62. package/dist/pipeline/compatibility.js.map +0 -1
  63. package/dist/pipeline/connect.js.map +0 -1
  64. package/dist/pipeline/create.js.map +0 -1
  65. package/dist/pipeline/errors.js.map +0 -1
  66. package/dist/pipeline/generated-reference.json +22 -10
  67. package/dist/pipeline/guide.js.map +0 -1
  68. package/dist/pipeline/init.js.map +0 -1
  69. package/dist/pipeline/operations.js.map +0 -1
  70. package/dist/pipeline/query.js.map +0 -1
  71. package/dist/pipeline/queryDownloads.js.map +0 -1
  72. package/dist/pipeline/queryWorker.js.map +0 -1
  73. package/dist/pipeline/readiness.js.map +0 -1
  74. package/dist/pipeline/reference.js.map +0 -1
  75. package/dist/pipeline/requests.js.map +0 -1
  76. package/dist/pipeline/runArguments.js.map +0 -1
  77. package/dist/pipeline/runtime.js.map +0 -1
  78. package/dist/pipeline/service.js.map +0 -1
  79. package/dist/services/agentApprovalFetch.js +7 -3
  80. package/dist/services/agentApprovalFetch.js.map +1 -2
  81. package/dist/services/appSyncService.js.map +0 -1
  82. package/dist/services/apps.js.map +0 -1
  83. package/dist/services/authErrors.js.map +0 -1
  84. package/dist/services/codefirst/api.js +38 -5
  85. package/dist/services/codefirst/api.js.map +1 -2
  86. package/dist/services/codefirst/binaryDisk.js.map +0 -1
  87. package/dist/services/codefirst/byteHashes.js +5 -0
  88. package/dist/services/codefirst/byteHashes.js.map +1 -2
  89. package/dist/services/codefirst/documents.js +41 -15
  90. package/dist/services/codefirst/documents.js.map +1 -2
  91. package/dist/services/codefirst/layoutBinaryProjection.js +24 -13
  92. package/dist/services/codefirst/layoutBinaryProjection.js.map +1 -2
  93. package/dist/services/codefirst/layoutCompose.js +44 -38
  94. package/dist/services/codefirst/layoutCompose.js.map +1 -2
  95. package/dist/services/codefirst/layoutCore.js +14 -1
  96. package/dist/services/codefirst/layoutCore.js.map +1 -2
  97. package/dist/services/codefirst/layoutPaths.js +80 -4
  98. package/dist/services/codefirst/layoutPaths.js.map +1 -2
  99. package/dist/services/codefirst/layoutProjection.js +73 -39
  100. package/dist/services/codefirst/layoutProjection.js.map +1 -2
  101. package/dist/services/codefirst/layoutReadback.js +357 -130
  102. package/dist/services/codefirst/layoutReadback.js.map +2 -3
  103. package/dist/services/codefirst/layoutReadbackPlacement.js +94 -57
  104. package/dist/services/codefirst/layoutReadbackPlacement.js.map +2 -3
  105. package/dist/services/codefirst/layoutReceipt.js +283 -243
  106. package/dist/services/codefirst/layoutReceipt.js.map +2 -3
  107. package/dist/services/codefirst/layoutScan.js +208 -110
  108. package/dist/services/codefirst/layoutScan.js.map +1 -2
  109. package/dist/services/codefirst/output.js +76 -10
  110. package/dist/services/codefirst/output.js.map +1 -2
  111. package/dist/services/codefirst/types.js.map +0 -1
  112. package/dist/services/codefirst/workflow.js +65 -29
  113. package/dist/services/codefirst/workflow.js.map +2 -3
  114. package/dist/services/codefirst/workspace.js.map +0 -1
  115. package/dist/services/codefirst/workspaceLock.js.map +0 -1
  116. package/dist/services/codefirst/workspaceRoot.js +2 -1
  117. package/dist/services/codefirst/workspaceRoot.js.map +1 -2
  118. package/dist/services/configService.js.map +0 -1
  119. package/dist/services/credentials.js.map +0 -1
  120. package/dist/services/farseerService.js +3 -1
  121. package/dist/services/farseerService.js.map +1 -2
  122. package/dist/services/httpError.js.map +0 -1
  123. package/dist/services/modelExport.js.map +0 -1
  124. package/dist/services/organisation.js.map +0 -1
  125. package/dist/services/preflight.js.map +0 -1
  126. package/dist/services/realms.js.map +0 -1
  127. package/dist/services/syncService.js +3 -3
  128. package/dist/services/syncService.js.map +1 -2
  129. package/dist/skills/pipeline.js.map +0 -1
  130. package/dist/utils/agentSandbox.js.map +0 -1
  131. package/dist/utils/cliOptions.js.map +0 -1
  132. package/dist/utils/constants.js.map +0 -1
  133. package/dist/utils/entityResolver.js.map +0 -1
  134. package/dist/utils/errorFormatter.js +59 -11
  135. package/dist/utils/errorFormatter.js.map +1 -2
  136. package/dist/utils/fileLogger.js.map +0 -1
  137. package/dist/utils/fileValidation.js.map +0 -1
  138. package/dist/utils/folderMatch.js.map +0 -1
  139. package/dist/utils/formulaFilters.js +48 -0
  140. package/dist/utils/formulaFilters.js.map +6 -0
  141. package/dist/utils/helpers.js.map +0 -1
  142. package/dist/utils/logger.js.map +0 -1
  143. package/dist/utils/nameResolver.js.map +0 -1
  144. package/dist/utils/packageManager.js.map +0 -1
  145. package/dist/utils/syncReporting.js.map +0 -1
  146. package/dist/utils/syncScope.js.map +0 -1
  147. package/dist/utils/updateCheck.js.map +0 -1
  148. package/dist/utils/variableValues.js.map +0 -1
  149. package/dist/utils/workspace.js.map +0 -1
  150. package/docs/cli-guide.md +14 -1
  151. package/docs/import-workflows.md +14 -14
  152. package/docs/new-app-template.md +1 -1
  153. package/docs/pipeline-client-guide.md +1 -1
  154. package/docs/pipeline-reference.md +292 -3
  155. package/package.json +2 -2
  156. package/skills/farseer-analysis/SKILL.md +132 -0
  157. package/skills/farseer-dashboards/SKILL.md +40 -0
  158. package/skills/farseer-formulas/SKILL.md +165 -0
  159. package/skills/farseer-model/SKILL.md +119 -0
  160. package/skills/pipeline-authoring/SKILL.md +6 -4
  161. package/skills/pipeline-authoring/practices.md +6 -5
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/commands/mcp-server.ts"],
4
- "sourcesContent": ["/**\n * MCP Server Command\n *\n * Starts the Farseer MCP (Model Context Protocol) server for AI assistant integration.\n * This allows Claude, Cursor, and other AI assistants to directly use Farseer functionality.\n *\n * The server binds to a single tenant per invocation \u2014 via --tenant/--org or the\n * FARSEER_TENANT/FARSEER_ORG env \u2014 so a host can run one server per tenant\n * concurrently without them colliding on the global checkout.\n */\n\nimport { Command } from 'commander';\nimport { startMcpServer } from '../mcp';\n\nexport function registerMcpServerCommand(program: Command): void {\n program\n .command('mcp-server')\n .description('Start MCP server for AI assistant integration (Claude, Cursor, etc.)')\n .option(\n '--tenant <slug>',\n 'Tenant to bind this server to at launch (or set FARSEER_TENANT). If omitted, an agent binds it once via farseer_select_tenant.',\n )\n .option(\n '--org <org>',\n 'Organisation subdomain (or FARSEER_ORG). Defaults to the saved mapping for the tenant, else the tenant name.',\n )\n .action(async (options: { tenant?: string; org?: string }) => {\n try {\n await startMcpServer({ tenant: options.tenant, org: options.org });\n } catch (error) {\n // MCP servers communicate errors via JSON-RPC, not stderr\n // Only log to stderr for unexpected startup failures\n console.error('Failed to start MCP server:', error instanceof Error ? error.message : 'Unknown error');\n process.exit(1);\n }\n });\n}\n"],
5
4
  "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAYA,iBAA+B;AAExB,SAAS,yBAAyB,SAAwB;AAC7D,UACK,QAAQ,YAAY,EACpB,YAAY,sEAAsE,EAClF;AAAA,IACG;AAAA,IACA;AAAA,EACJ,EACC;AAAA,IACG;AAAA,IACA;AAAA,EACJ,EACC,OAAO,OAAO,YAA+C;AAC1D,QAAI;AACA,gBAAM,2BAAe,EAAE,QAAQ,QAAQ,QAAQ,KAAK,QAAQ,IAAI,CAAC;AAAA,IACrE,SAAS,OAAO;AAGZ,cAAQ,MAAM,+BAA+B,iBAAiB,QAAQ,MAAM,UAAU,eAAe;AACrG,cAAQ,KAAK,CAAC;AAAA,IAClB;AAAA,EACJ,CAAC;AACT;",
6
5
  "names": []
7
6
  }
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/commands/model.ts"],
4
- "sourcesContent": ["import { Command } from 'commander';\nimport { logger } from '../utils/logger';\nimport { showLoginPrompt, isAuthError } from '../services/authErrors';\nimport { preflight } from '../services/preflight';\nimport { formatVariableMembers } from '../services/modelExport';\nimport { formatAmbiguous, matchByName } from '../utils/nameResolver';\n\nexport function registerModelCommand(program: Command): void {\n program\n .command('model [tenant]')\n .description('Export and display the model structure (dimensions, variables)')\n .option('--json', 'Output raw JSON')\n .option('--tables', 'Show only dimension tables')\n .option('--variables', 'Show only variables')\n .option('--variable <name>', 'Show details for specific variable')\n .option('--table <name>', 'Show details for specific dimension table')\n .action(async (tenantArg, options) => {\n const { tenant, client: api } = await preflight(tenantArg);\n\n try {\n // Pick the smallest scope that satisfies the requested\n // output. An unscoped DTAB+DMEM+VAR fetch breaks the\n // response limit on large tenants; `--json` is the\n // worst case because it asks for the whole thing.\n let model;\n if (options.variable || options.variables) {\n model = await api.exportModel({ types: ['VAR'] });\n } else if (options.table) {\n // Single-table member fetch via entities API.\n // `/model/export` with `tableGids` 500s for some\n // tables on large tenants (separate backend bug);\n // the entities path is reliable.\n const table = await api.loadDimensionTableWithMembers(options.table);\n if (!table) {\n logger.error(`Table \"${options.table}\" not found.`);\n const summary = await api.exportModel({ types: ['DTAB'] });\n logger.dim('Available tables:');\n summary.tables.slice(0, 10).forEach((t) => logger.dim(` - ${t.name}`));\n if (summary.tables.length > 10) {\n logger.dim(` ... and ${summary.tables.length - 10} more`);\n }\n process.exit(1);\n }\n model = {\n tables: [table],\n variables: [],\n dependencies: { tables: [], members: [], variables: [] },\n };\n } else if (options.tables) {\n model = await api.exportModel({ types: ['DTAB'] });\n } else {\n // Default summary view \u2014 counts of tables /\n // variables and a name preview, no member rows.\n model = await api.exportModel({ types: ['DTAB', 'VAR'] });\n }\n\n // Raw JSON output; a requested variable is narrowed to first, below.\n if (options.json && !options.variable) {\n console.log(JSON.stringify(model, null, 2));\n return;\n }\n\n // Specific variable details\n if (options.variable) {\n const matches = matchByName(model.variables, options.variable);\n if (matches.length > 1) {\n logger.error(\n formatAmbiguous('variables', options.variable, matches, (v) => String(v.gid ?? v.name)),\n );\n process.exit(1);\n }\n const variable = matches[0];\n if (!variable) {\n logger.error(`Variable \"${options.variable}\" not found.`);\n logger.dim('Available variables:');\n model.variables.slice(0, 10).forEach((v) => logger.dim(` - ${v.name}`));\n if (model.variables.length > 10) {\n logger.dim(` ... and ${model.variables.length - 10} more`);\n }\n process.exit(1);\n }\n if (options.json) {\n console.log(JSON.stringify(variable, null, 2));\n return;\n }\n\n logger.header(`Variable: ${variable.name}`);\n console.log();\n if (variable.description) {\n console.log(` Description: ${variable.description}`);\n }\n if (variable.formula) {\n console.log(` Formula: ${variable.formula}`);\n }\n console.log(` Dimensions: ${variable.tables.join(', ')}`);\n if (variable.members.length > 0) {\n console.log(` Specific members: ${formatVariableMembers(variable.members)}`);\n }\n console.log(` Roll-up type: ${variable.rollupType}`);\n console.log(` Data type: ${variable.dataType}`);\n if (variable.numberFormat) {\n console.log(\n ` Format: ${variable.numberFormat.type}${variable.numberFormat.formatString ? ` (${variable.numberFormat.formatString})` : ''}`,\n );\n }\n console.log(` Readonly: ${variable.readonly}`);\n console.log(` Calculate on demand: ${variable.calculateOnDemand}`);\n if (variable.folderPath) {\n console.log(` Folder: ${variable.folderPath.join(' / ')}`);\n }\n return;\n }\n\n // Specific table details. The dispatch above already\n // resolved name \u2192 single-table fetch and exited if the\n // table didn't exist, so model.tables is exactly [target].\n if (options.table) {\n const table = model.tables[0];\n\n logger.header(`Dimension Table: ${table.name}`);\n console.log();\n console.log(` Columns:`);\n table.columns.forEach((col, i) => {\n let colInfo = ` ${i + 1}. ${col.type}`;\n if (col.name) colInfo += ` (${col.name})`;\n if (col.foreignKeyTableName) colInfo += ` \u2192 ${col.foreignKeyTableName}`;\n console.log(colInfo);\n });\n console.log(` Members: ${table.rows.length}`);\n if (table.folderPath) {\n console.log(` Folder: ${table.folderPath.join(' / ')}`);\n }\n if (table.rows.length > 0) {\n console.log(` Sample members:`);\n table.rows.slice(0, 5).forEach((row) => {\n console.log(` - ${row[0]}`);\n });\n if (table.rows.length > 5) {\n console.log(` ... and ${table.rows.length - 5} more`);\n }\n }\n return;\n }\n\n // Tables only\n if (options.tables) {\n logger.header(`Dimension Tables (${model.tables.length})`);\n console.log();\n for (const table of model.tables) {\n const fkColumns = table.columns.filter((c) => c.type === 'FOREIGN_KEY');\n let info = ` \uD83D\uDCCB ${table.name}`;\n if (fkColumns.length > 0) {\n info += ` \u2192 ${fkColumns.map((c) => c.foreignKeyTableName).join(', ')}`;\n }\n console.log(info);\n }\n logger.dim('Run with --table <name> to see members for a specific table.');\n return;\n }\n\n // Variables only\n if (options.variables) {\n logger.header(`Variables (${model.variables.length})`);\n console.log();\n for (const variable of model.variables) {\n console.log(` \uD83D\uDCCA ${variable.name}`);\n console.log(` Dimensions: ${variable.tables.join(', ')}`);\n if (variable.formula) {\n console.log(\n ` Formula: ${variable.formula.substring(0, 50)}${variable.formula.length > 50 ? '...' : ''}`,\n );\n }\n console.log();\n }\n return;\n }\n\n // Default: summary\n logger.header(`Model Summary for ${tenant}`);\n console.log();\n console.log(` Dimension Tables: ${model.tables.length}`);\n console.log(` Variables: ${model.variables.length}`);\n console.log();\n\n logger.dim('Dimension Tables:');\n model.tables.slice(0, 10).forEach((t) => {\n logger.dim(` - ${t.name}`);\n });\n if (model.tables.length > 10) {\n logger.dim(` ... and ${model.tables.length - 10} more`);\n }\n console.log();\n\n logger.dim('Variables (first 10):');\n model.variables.slice(0, 10).forEach((v) => {\n logger.dim(` - ${v.name} [${v.tables.join(', ')}]`);\n });\n if (model.variables.length > 10) {\n logger.dim(` ... and ${model.variables.length - 10} more`);\n }\n console.log();\n\n logger.dim('Use --tables, --variables, --table <name>, or --variable <name> for details.');\n logger.dim('Use --json for raw JSON output.');\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : String(error);\n\n if (isAuthError(error)) {\n showLoginPrompt(tenant);\n } else if (errorMessage.includes('404')) {\n logger.error(`Tenant \"${tenant}\" not found or not accessible.`);\n logger.dim('Check that the tenant name is correct.');\n } else if (errorMessage.includes('ENOTFOUND') || errorMessage.includes('ECONNREFUSED')) {\n logger.error('Failed to connect to Farseer.');\n logger.dim('Check your network connection.');\n } else {\n logger.error('Failed to export model.');\n logger.dim(errorMessage);\n }\n process.exit(1);\n }\n });\n}\n"],
5
4
  "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,oBAAuB;AACvB,wBAA6C;AAC7C,uBAA0B;AAC1B,yBAAsC;AACtC,0BAA6C;AAEtC,SAAS,qBAAqB,SAAwB;AACzD,UACK,QAAQ,gBAAgB,EACxB,YAAY,gEAAgE,EAC5E,OAAO,UAAU,iBAAiB,EAClC,OAAO,YAAY,4BAA4B,EAC/C,OAAO,eAAe,qBAAqB,EAC3C,OAAO,qBAAqB,oCAAoC,EAChE,OAAO,kBAAkB,2CAA2C,EACpE,OAAO,OAAO,WAAW,YAAY;AAClC,UAAM,EAAE,QAAQ,QAAQ,IAAI,IAAI,UAAM,4BAAU,SAAS;AAEzD,QAAI;AAKA,UAAI;AACJ,UAAI,QAAQ,YAAY,QAAQ,WAAW;AACvC,gBAAQ,MAAM,IAAI,YAAY,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC;AAAA,MACpD,WAAW,QAAQ,OAAO;AAKtB,cAAM,QAAQ,MAAM,IAAI,8BAA8B,QAAQ,KAAK;AACn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;AAAA,MACvD,CAAC;AACD,UAAI,MAAM,UAAU,SAAS,IAAI;AAC7B,6BAAO,IAAI,aAAa,MAAM,UAAU,SAAS,EAAE,OAAO;AAAA,MAC9D;AACA,cAAQ,IAAI;AAEZ,2BAAO,IAAI,8EAA8E;AACzF,2BAAO,IAAI,iCAAiC;AAAA,IAChD,SAAS,OAAO;AACZ,YAAM,eAAe,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AAE1E,cAAI,+BAAY,KAAK,GAAG;AACpB,+CAAgB,MAAM;AAAA,MAC1B,WAAW,aAAa,SAAS,KAAK,GAAG;AACrC,6BAAO,MAAM,WAAW,MAAM,gCAAgC;AAC9D,6BAAO,IAAI,wCAAwC;AAAA,MACvD,WAAW,aAAa,SAAS,WAAW,KAAK,aAAa,SAAS,cAAc,GAAG;AACpF,6BAAO,MAAM,+BAA+B;AAC5C,6BAAO,IAAI,gCAAgC;AAAA,MAC/C,OAAO;AACH,6BAAO,MAAM,yBAAyB;AACtC,6BAAO,IAAI,YAAY;AAAA,MAC3B;AACA,cAAQ,KAAK,CAAC;AAAA,IAClB;AAAA,EACJ,CAAC;AACT;",
6
5
  "names": []
7
6
  }
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/commands/pipeline.ts"],
4
- "sourcesContent": ["import { Command } from 'commander';\nimport * as fs from 'fs';\nimport { connectPipeline, openPipelineConnection, pipelinePaths } from '../pipeline/connect';\nimport { PIPELINE_OPERATIONS, runPipelineInit, runPipelineOperation } from '../pipeline/operations';\nimport { pipelineGuide } from '../pipeline/reference';\nimport { PipelineError } from '../pipeline/errors';\nimport { redact } from '../pipeline/service';\nimport { withPipelineRequests } from '../pipeline/requests';\nimport { PIPELINE_SKILL_PATH } from '../skills/pipeline';\nimport { resolveTenantWithOrgMapping } from '../utils/helpers';\n\nconst PROFILE_HELP = 'Prepared local profile (default: the one profile under tenant/.pipelines/)';\nconst PIPELINE_HELP = 'Pipeline folder name; selects tenant/.pipelines/<name>.json';\n\n/** What a shell user sees for a failed operation: the error, and the next step when it has one. */\nexport function shellError(error: unknown): string {\n if (!(error instanceof PipelineError)) return redact(String(error));\n const next = error.nextAction ? `\\nNext: ${error.nextAction}` : '';\n return redact(`Error: ${error.message}${next}`);\n}\n\nexport function registerPipelineCommand(program: Command) {\n const command = program\n .command('pipeline')\n .description('Prepared pipeline authoring')\n .configureHelp({ visibleCommands: (cmd) => [...cmd.commands] });\n command\n .command('guide')\n .option('--topic <name>', 'method, practices, grammar, or a Pydantic model name', 'method')\n .option('--skill-path', 'Print the bundled SKILL.md path for native skill installation')\n .action((options) => {\n try {\n console.log(options.skillPath ? PIPELINE_SKILL_PATH : pipelineGuide(options.topic));\n } catch (error) {\n console.error(shellError(error));\n process.exitCode = 1;\n }\n });\n command\n .command('init <org> <tenant> [jobId]')\n .description(\n 'Derive a local profile from a prepared job (changes nothing remotely), or with --new create a pipeline from nothing',\n )\n .option('--new <name>', 'Create folder, job and profile for a new pipeline named after its folder')\n .option('--workspace <dir>', 'Tenant-relative source folder (default: the folder of the job main script)')\n .option('--force', 'Overwrite an existing profile for this job')\n .action(async (org, tenant, jobId, options) => {\n try {\n const selection = {\n organisation: org,\n tenant,\n jobId: jobId === undefined ? undefined : Number(jobId),\n name: options.new,\n workspace: options.workspace,\n force: options.force,\n };\n await withPipelineRequests(async () => {\n const result = await runPipelineInit(\n selection,\n () => openPipelineConnection(org, tenant),\n pipelinePaths(tenant),\n );\n console.log(JSON.stringify(result, null, 2));\n });\n } catch (error) {\n console.error(shellError(error));\n process.exitCode = 1;\n }\n });\n command\n .command('runs [org] [tenant]')\n .description('List the runs of the profile job, newest first')\n .option('--profile <path>', PROFILE_HELP)\n .option('--pipeline <name>', PIPELINE_HELP)\n .option('--limit <number>', 'Runs to show', '20')\n .action(async (org, tenant, options) => {\n try {\n await withPipelineRequests(async () => {\n const checkout = resolveTenantWithOrgMapping(org, tenant);\n const service = await connectPipeline(checkout.organisation, checkout.tenant, {\n profile: options.profile,\n pipeline: options.pipeline,\n });\n const result = await runPipelineOperation(service, 'runs', { limit: Number(options.limit) });\n console.log(JSON.stringify(result, null, 2));\n });\n } catch (error) {\n console.error(shellError(error));\n process.exitCode = 1;\n }\n });\n // recover and unlock resolve local state after a crash; they are CLI-only on purpose.\n const operations = [...PIPELINE_OPERATIONS.filter((o) => o !== 'runs'), 'recover', 'unlock'] as const;\n for (const operation of operations) {\n command\n .command(`${operation} <org> <tenant>`)\n .option('--profile <path>', PROFILE_HELP)\n .option('--pipeline <name>', PIPELINE_HELP)\n .option('--uuid <uuid>', 'Exact run UUID')\n .option('--dataset-id <uuid>', 'Dataset identifier')\n .option('--version-id <uuid>', 'Retained version identifier')\n .option('--expected-current <uuid>', 'Current version observed before restore')\n .option('--import-id <number>', 'Import ID from a run observation')\n .option('--offset <number>', 'Log offset', '0')\n .option(\n '--arg <NAME=value>',\n 'Job argument for this run, by name; repeat for several. Others keep their defaults',\n (value: string, all: string[]) => [...all, value],\n [] as string[],\n )\n .option('--bindings <json>', 'Version bindings [{name,datasetId,versionId}]', '[]')\n .option('--sql-file <path>', 'Local inspection SQL file')\n .action(async (org, tenant, options) => {\n const controller = new AbortController();\n const cancel = () => controller.abort();\n process.once('SIGINT', cancel);\n try {\n await withPipelineRequests(async () => {\n const service = await connectPipeline(org, tenant, {\n profile: options.profile,\n pipeline: options.pipeline,\n });\n let result: unknown;\n if (operation === 'recover') result = await service.recover(options.uuid);\n else if (operation === 'unlock') result = service.unlockAbandonedOperation();\n else {\n if (operation === 'query' && !options.sqlFile) throw new Error('--sql-file is required');\n result = await runPipelineOperation(\n service,\n operation,\n {\n uuid: options.uuid,\n datasetId: options.datasetId,\n versionId: options.versionId,\n expectedCurrent: options.expectedCurrent,\n importId: options.importId === undefined ? undefined : Number(options.importId),\n offset: Number(options.offset),\n args: options.arg,\n bindings: JSON.parse(options.bindings),\n sql: options.sqlFile && fs.readFileSync(options.sqlFile, 'utf8'),\n },\n controller.signal,\n );\n }\n console.log(JSON.stringify(result, null, 2));\n }, controller.signal);\n } catch (error) {\n console.error(shellError(error));\n process.exitCode = 1;\n } finally {\n process.removeListener('SIGINT', cancel);\n }\n });\n }\n}\n"],
5
4
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,SAAoB;AACpB,qBAAuE;AACvE,wBAA2E;AAC3E,uBAA8B;AAC9B,oBAA8B;AAC9B,qBAAuB;AACvB,sBAAqC;AACrC,sBAAoC;AACpC,qBAA4C;AAE5C,MAAM,eAAe;AACrB,MAAM,gBAAgB;AAGf,SAAS,WAAW,OAAwB;AAC/C,MAAI,EAAE,iBAAiB,6BAAgB,YAAO,uBAAO,OAAO,KAAK,CAAC;AAClE,QAAM,OAAO,MAAM,aAAa;AAAA,QAAW,MAAM,UAAU,KAAK;AAChE,aAAO,uBAAO,UAAU,MAAM,OAAO,GAAG,IAAI,EAAE;AAClD;AAEO,SAAS,wBAAwB,SAAkB;AACtD,QAAM,UAAU,QACX,QAAQ,UAAU,EAClB,YAAY,6BAA6B,EACzC,cAAc,EAAE,iBAAiB,CAAC,QAAQ,CAAC,GAAG,IAAI,QAAQ,EAAE,CAAC;AAClE,UACK,QAAQ,OAAO,EACf,OAAO,kBAAkB,wDAAwD,QAAQ,EACzF,OAAO,gBAAgB,+DAA+D,EACtF,OAAO,CAAC,YAAY;AACjB,QAAI;AACA,cAAQ,IAAI,QAAQ,YAAY,0CAAsB,gCAAc,QAAQ,KAAK,CAAC;AAAA,IACtF,SAAS,OAAO;AACZ,cAAQ,MAAM,WAAW,KAAK,CAAC;AAC/B,cAAQ,WAAW;AAAA,IACvB;AAAA,EACJ,CAAC;AACL,UACK,QAAQ,6BAA6B,EACrC;AAAA,IACG;AAAA,EACJ,EACC,OAAO,gBAAgB,0EAA0E,EACjG,OAAO,qBAAqB,4EAA4E,EACxG,OAAO,WAAW,4CAA4C,EAC9D,OAAO,OAAO,KAAK,QAAQ,OAA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gBAC9E,QAAQ,OAAO,QAAQ,MAAM;AAAA,gBAC7B,MAAM,QAAQ;AAAA,gBACd,UAAU,KAAK,MAAM,QAAQ,QAAQ;AAAA,gBACrC,KAAK,QAAQ,WAAW,GAAG,aAAa,QAAQ,SAAS,MAAM;AAAA,cACnE;AAAA,cACA,WAAW;AAAA,YACf;AAAA,UACJ;AACA,kBAAQ,IAAI,KAAK,UAAU,QAAQ,MAAM,CAAC,CAAC;AAAA,QAC/C,GAAG,WAAW,MAAM;AAAA,MACxB,SAAS,OAAO;AACZ,gBAAQ,MAAM,WAAW,KAAK,CAAC;AAC/B,gBAAQ,WAAW;AAAA,MACvB,UAAE;AACE,gBAAQ,eAAe,UAAU,MAAM;AAAA,MAC3C;AAAA,IACJ,CAAC;AAAA,EACT;AACJ;",
6
5
  "names": []
7
6
  }
@@ -305,7 +305,7 @@ function registerPullCommand(program) {
305
305
  } catch (error) {
306
306
  import_fileLogger.fileLogger.error("pull", error);
307
307
  import_logger.logger.error("Pull failed.");
308
- import_logger.logger.error(await (0, import_errorFormatter.formatClientError)(error));
308
+ import_logger.logger.error(await (0, import_errorFormatter.formatSyncError)(error));
309
309
  const logPath = import_fileLogger.fileLogger.getLogPath();
310
310
  if (logPath) {
311
311
  import_logger.logger.dim(`Debug log: ${logPath}`);
@@ -1,7 +1,6 @@
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 { preflight } from '../services/preflight';\nimport { SyncService, ConflictResolutions, SyncStatus } from '../services/syncService';\nimport { AppSyncService } from '../services/appSyncService';\nimport {\n getTenantDir,\n getTenantFilesDir,\n ensureDirectoryExists,\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_DEPENDENCY } from '../utils/constants';\nimport { ensureGitignoreEntries } from '../utils/workspace';\nimport { updatePackageJson } from '../utils/packageManager';\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 // preflight resolves the target, authenticates, and confirms the\n // org owns the tenant (the guard that used to live only in\n // `checkout`). pull is the setup path now, so scaffolding follows.\n const target = await preflight(arg1, arg2);\n const { organisation, tenant, client } = target;\n\n const syncService = new SyncService(tenant, client);\n\n const tenantDir = getTenantDir(tenant);\n ensureDirectoryExists(tenantDir);\n\n // Ensure .gitignore covers `.farseer-sync.json` on the first pull\n // into a fresh workspace. Without it, a workspace initialized by\n // `farseer pull` would commit the per-machine baseline and\n // reproduce the cross-machine drift bug the gitignore prevents.\n ensureGitignoreEntries(path.join(tenantDir, '.gitignore'));\n\n await createDefaultPackageJson(tenantDir, tenant);\n const packageChanges = updatePackageJson(tenantDir);\n if (packageChanges.length > 0) {\n logger.info(`Updated package.json: ${packageChanges.join(', ')}`);\n logger.dim(`Run \"farseer install ${tenant}\" to update node_modules.`);\n }\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\n // With `checkout` gone, a first pull IS the setup \u2014 so it has to\n // close by naming the one step the CLI can't do itself: a child\n // process can't export into the shell that launched it. Gated on a\n // fresh workspace; on every routine pull this would just be noise.\n const printShellHint = (): void => {\n if (folderInitialised) return;\n console.log();\n logger.success(`Workspace ready for ${chalk.bold(tenant)}.`);\n logger.dim('To target this tenant in this shell, set:');\n logger.info(\n organisation === tenant\n ? ` export FARSEER_TENANT=${tenant}`\n : ` export FARSEER_TENANT=${tenant} FARSEER_ORG=${organisation}`,\n );\n logger.dim(`Or pass it explicitly each time: farseer status ${tenant}`);\n };\n\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, 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 printShellHint();\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 printShellHint();\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_DEPENDENCY,\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,uBAA0B;AAC1B,yBAA6D;AAC7D,4BAA+B;AAC/B,qBAOO;AACP,4BAAkC;AAClC,4BAAiC;AACjC,wBAAmD;AACnD,uBAA0C;AAC1C,uBAAuC;AACvC,4BAAkC;AAClC,SAAoB;AACpB,WAAsB;AAmBf,SAAS,oBAAoB,SAAwB;AACxD,UACK,QAAQ,qBAAqB,EAC7B;AAA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GAAG,OAAO;AAC/E,uBAAO,IAAI,4BAA4B,MAAM,EAAE;AACnD;",
6
5
  "names": ["chalk", "inquirer"]
7
6
  }
@@ -264,7 +264,7 @@ function registerPushCommand(program) {
264
264
  console.log(import_chalk.default.red.bold(`${result.failed.length} file(s) failed during push:`));
265
265
  for (const failure of result.failed) {
266
266
  console.log(import_chalk.default.red(` ! ${failure.filePath} (${failure.operation})`));
267
- console.log(import_chalk.default.dim(` ${failure.reason}`));
267
+ console.log(import_chalk.default.dim(` ${failure.reason.replace(/\n/g, "\n ")}`));
268
268
  }
269
269
  console.log();
270
270
  }
@@ -334,7 +334,7 @@ function registerPushCommand(program) {
334
334
  } catch (error) {
335
335
  import_fileLogger.fileLogger.error("push", error, { tenant, organisation });
336
336
  import_logger.logger.error("Push failed.");
337
- import_logger.logger.error(await (0, import_errorFormatter.formatClientError)(error));
337
+ import_logger.logger.error(await (0, import_errorFormatter.formatSyncError)(error));
338
338
  const logPath = import_fileLogger.fileLogger.getLogPath();
339
339
  if (logPath) {
340
340
  import_logger.logger.dim(`Debug log: ${logPath}`);
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/commands/push.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 { preflight } from '../services/preflight';\nimport { SyncService } from '../services/syncService';\nimport { AppSyncService } from '../services/appSyncService';\nimport {\n getTenantFilesDir,\n orExit,\n safeResolveWithinBase,\n validateOnlyFilePaths,\n displayLocalPath,\n} from '../utils/helpers';\nimport { formatClientError } from '../utils/errorFormatter';\nimport { ValidationFailure, partitionForUpload } from '../utils/fileValidation';\nimport { collectValues, normalizeExtensions, normalizeRelativePath } from '../utils/cliOptions';\nimport { reportIgnoredLocal } from '../utils/syncReporting';\nimport type { SyncStatus } from '../services/syncService';\nimport * as fs from 'fs';\n\n/**\n * Push semantics (in plain English, since this is the easiest part of the\n * CLI to misunderstand):\n *\n * farseer push\n * 1. Pre-flight: refuse local files that the backend will reject\n * (extension whitelist, name length, empty body). Print them and\n * exit non-zero so the user fixes them before we touch the network.\n * 2. Compare local vs remote (no remote download \u2014 we trust the\n * recorded sync baseline). If remote diverged from baseline,\n * refuse and ask the user to pull first.\n * 3. Show a diff (added / modified / deleted).\n * 4. Confirm.\n * 5. Upload modified files. Re-check each one against current remote\n * right before overwrite to avoid clobbering a concurrent edit.\n *\n * farseer push --force\n * Same as above, but:\n * \u2022 Skip step 2 (allow pushing over remote drift).\n * \u2022 Make remote mirror local: also delete any remote files that\n * have no local counterpart (not just ones you previously pulled).\n * Because --force is destructive, we always show the full plan\n * (including deletions of remote-only files) and require an explicit\n * \"yes\". `-y` won't bypass --force confirmation; you must answer the\n * prompt.\n */\nexport function registerPushCommand(program: Command): void {\n program\n .command('push [org] [tenant]')\n .description(\n 'Push local files to Farseer instance\\n\\nUsage: push <org> <tenant> OR push <tenant> (if org is known)',\n )\n .option(\n '--force',\n 'Force-mirror remote to local: overwrite remote drift AND delete remote files with no local counterpart (always asks for confirmation)',\n )\n .option('-y, --yes', 'Skip confirmation prompt for non-destructive pushes (ignored under --force)')\n .option(\n '--shallow',\n 'Skip the remote-content hash check in the pre-flight (faster on big tenants; trusts the last-pull baseline). Ignored under --force, where deep is required for correct mirror semantics.',\n )\n // Accept `--deep` as a no-op alias so 1.6.1-era scripts keep\n // working \u2014 deep is now the default; see status.ts for context.\n .option('--deep', '(Deprecated; now the default) Force the deep remote-content hash pre-flight')\n .option('--include-ext <ext>', 'Include extra file extension (repeatable)', collectValues, [])\n .option('--include-folder <folder>', 'Include all files in folder (repeatable)', collectValues, [])\n .option(\n '--only <path>',\n 'Only push the listed file(s) (repeatable, paths relative to tenant files dir, e.g. Scripts/foo.ts). Other local edits are not touched; the drift check still fires on these paths if remote has changed them.',\n collectValues,\n [],\n )\n .action(async (arg1, arg2, options) => {\n const { organisation, tenant, client } = await preflight(arg1, arg2);\n\n const filesDir = getTenantFilesDir(tenant);\n\n if (!fs.existsSync(filesDir)) {\n logger.error(`Local folder not found: ${displayLocalPath(filesDir)}`);\n logger.dim('Run \"farseer pull <tenant>\" first to initialize the folder.');\n process.exit(1);\n }\n\n const syncService = new SyncService(tenant, client);\n const includeExtensions = normalizeExtensions(options.includeExt);\n const includeFolders = options.includeFolder as string[];\n // POSIX-normalise: the sync engine canonicalises every candidate\n // to forward slashes before include/onlyFiles matching, so a\n // Windows user typing `--only Scripts\\foo.ts` would otherwise\n // miss the comparison and the file would silently fall out of\n // scope.\n const onlyFiles = (options.only as string[]).map(normalizeRelativePath);\n const syncFilterOptions = {\n includeExtensions: includeExtensions.length > 0 ? includeExtensions : undefined,\n includeFolders: includeFolders.length > 0 ? includeFolders : undefined,\n onlyFiles: onlyFiles.length > 0 ? onlyFiles : undefined,\n };\n\n // --only is a surgical-push escape hatch. Skip the apps path\n // entirely (which has its own drift logic that doesn't know\n // about file whitelists) and skip the remote-drift check \u2014\n // the user has narrowed the blast radius to a known set of\n // files, that's the whole point. Without this short-circuit\n // both the drift gate and apps push could touch things\n // outside the requested scope, defeating --only.\n const onlyMode = onlyFiles.length > 0;\n\n // Pre-flight: every --only path must resolve to a real file\n // under filesDir. Without this check, a typo (wrong case,\n // double slash, deleted file) silently produces \"Nothing to\n // push. Everything is in sync.\" \u2014 same exit code as a real\n // no-op, and the user assumes the push went through.\n // Traversal paths (`--only ../x`) join the same missing list\n // so the user gets one consolidated error.\n if (onlyMode) {\n const { missing } = validateOnlyFilePaths(filesDir, onlyFiles);\n if (missing.length > 0) {\n logger.error(`--only path(s) not found under ${filesDir}:`);\n for (const m of missing) console.log(chalk.red(` ${m}`));\n logger.dim('Paths are relative to the tenant files dir and case-sensitive.');\n process.exit(1);\n }\n }\n\n // Build a single status snapshot \u2014 same buckets the\n // `farseer status` command uses, so the user sees the same\n // categorisation in both places.\n //\n // Run a DEEP pre-flight by default. Shallow status can't see\n // remote-side content drift (it trusts our recorded baseline),\n // so without it we'd silently overwrite remote edits that\n // landed since the last pull. `--shallow` opts out for users\n // who explicitly want the faster path on large tenants.\n //\n // --force ALWAYS implies deep, overriding --shallow. Mirror\n // mode means \"make remote = local\" \u2014 we need to know the\n // current remote content to decide what to overwrite. A\n // shallow status would miss remote-side content drift and\n // silently no-op when local matches the baseline. Force +\n // shallow is a contradiction, so deep wins.\n const deep = !!options.force || !options.shallow;\n // Both status reads sit ahead of the push's own try block, and both\n // reach the network. Nothing is uploaded yet, so a failure here means\n // the push did not start \u2014 which has to be said, and said with a\n // non-zero exit, rather than falling through to an empty plan that\n // reads as \"everything is in sync\".\n const status = await orExit(\n syncService.getStatus({ ...syncFilterOptions, deep }),\n 'Failed to compare local files with the tenant.',\n );\n\n // Drift gate: non-force push must not silently overwrite\n // remote-side drift. Block here, after deep status has run,\n // so the user sees the actual remote drift paths and can\n // choose between pull (merge remote) or --force (mirror,\n // overwrite remote). All three remote-side buckets count as\n // drift \u2014 adds, deletes, and content edits.\n //\n // Suppressed under --only: that's an explicit narrow-scope\n // push and only fires the block if a remote-drift path\n // overlaps the requested set.\n if (!options.force) {\n const conflictingAdded = onlyMode\n ? status.addedRemotely.filter((p) => onlyFiles.includes(p))\n : status.addedRemotely;\n const conflictingDeleted = onlyMode\n ? status.deletedRemotely.filter((p) => onlyFiles.includes(p))\n : status.deletedRemotely;\n const conflictingModified = onlyMode\n ? status.modifiedRemotely.filter((p) => onlyFiles.includes(p))\n : status.modifiedRemotely;\n const totalConflicts = conflictingAdded.length + conflictingDeleted.length + conflictingModified.length;\n if (totalConflicts > 0) {\n logger.error(`Remote has changes for ${totalConflicts} file(s) since last pull:`);\n if (conflictingAdded.length > 0) {\n console.log(chalk.cyan(' New on remote (need to pull):'));\n for (const f of conflictingAdded) console.log(chalk.cyan(` + ${f}`));\n }\n if (conflictingDeleted.length > 0) {\n console.log(chalk.red(' Removed on remote (need to pull to clean local):'));\n for (const f of conflictingDeleted) console.log(chalk.red(` - ${f}`));\n }\n if (conflictingModified.length > 0) {\n console.log(chalk.yellow(' Modified on remote (need to pull to merge):'));\n for (const f of conflictingModified) console.log(chalk.yellow(` M ${f}`));\n }\n // Echo back the same scope flags the user passed so the\n // suggested pull command actually fetches the files\n // causing the drift. Without this, `farseer pull` runs\n // in default scope and the drift remains blocking.\n const scopeFlags: string[] = [];\n for (const ext of options.includeExt as string[]) scopeFlags.push(`--include-ext ${ext}`);\n for (const folder of options.includeFolder as string[])\n scopeFlags.push(`--include-folder \"${folder}\"`);\n const pullCmd = ['farseer pull', tenant, ...scopeFlags].filter(Boolean).join(' ');\n logger.dim(`Run \\`${pullCmd}\\` to merge remote changes, then push.`);\n logger.dim('Or use --force to mirror (overwrite remote with local).');\n process.exit(1);\n }\n }\n\n const plan = buildPushPlan(status, { force: !!options.force });\n const { filesToUpload, filesToDelete, remoteOnlyFiles, filesToRecreate, filesToOverwrite } = plan;\n\n // Apps are independent of the file pre-flight gate.\n // In --only mode we deliberately don't touch apps at all\n // (the user asked for a file-scoped push). Stub the app\n // status to \"nothing to do\" so downstream code can treat\n // the two modes uniformly.\n const appSyncService = new AppSyncService(tenant, client);\n const appStatus = onlyMode\n ? { newLocal: [], newRemote: [], modified: [], synced: [] }\n : await orExit(appSyncService.getStatus(), \"Failed to read the tenant's apps.\");\n\n const hasConflicts = status.conflicts.length > 0;\n const hasFileChanges =\n filesToUpload.length > 0 || filesToDelete.length > 0 || remoteOnlyFiles.length > 0 || hasConflicts;\n const hasAppChanges = appStatus.newLocal.length > 0 || appStatus.modified.length > 0;\n\n if (!hasFileChanges && !hasAppChanges) {\n // Print the out-of-scope warning BEFORE the success line\n // so the \"within current scope\" qualifier reads as a\n // follow-up to the count the user just saw, not a\n // contradiction of a bare \"Nothing to push\" message.\n reportIgnoredLocal(status.ignoredLocal, status.ignoredLocalTotal);\n if (status.ignoredLocalTotal > 0) {\n logger.success('Everything is in sync within current scope.');\n logger.dim(\n `(${status.ignoredLocalTotal} file(s) outside scope were not compared \u2014 see warning above for details.)`,\n );\n } else {\n logger.success('Nothing to push. Everything is in sync.');\n }\n return;\n }\n\n console.log();\n logger.header(options.force ? 'Mirror plan (--force):' : 'Changes to push:');\n\n if (status.addedLocally.length > 0) {\n for (const file of status.addedLocally) console.log(chalk.green(` + ${file}`));\n }\n if (status.modifiedLocally.length > 0) {\n for (const file of status.modifiedLocally) console.log(chalk.yellow(` M ${file}`));\n }\n if (filesToDelete.length > 0) {\n for (const file of filesToDelete) console.log(chalk.red(` - ${file}`));\n }\n if (remoteOnlyFiles.length > 0) {\n console.log(chalk.red.bold('Remote-only files that will be DELETED on remote:'));\n for (const file of remoteOnlyFiles) console.log(chalk.red(` - ${file} (remote only)`));\n }\n if (filesToRecreate.length > 0) {\n console.log(chalk.green.bold('Files deleted on remote that will be RECREATED:'));\n for (const file of filesToRecreate) console.log(chalk.green(` + ${file} (re-uploading local copy)`));\n }\n if (filesToOverwrite.length > 0) {\n console.log(chalk.yellow.bold('Files where remote drifted \u2014 local will OVERWRITE:'));\n for (const file of filesToOverwrite)\n console.log(chalk.yellow(` M ${file} (remote content drift; local wins)`));\n }\n\n // Surface scope-skipped files BEFORE the confirmation prompt so\n // the user never confirms a push thinking it covers everything in\n // the workspace when in fact .md / .json / .py etc. were silently\n // excluded by the default whitelist.\n reportIgnoredLocal(status.ignoredLocal, status.ignoredLocalTotal);\n\n // Conflicts surface BEFORE the confirmation prompt so the user\n // never confirms a plan that secretly contains skipped files.\n // Without --force these will be skipped (and the user can re-run\n // with `farseer pull` to resolve); under --force the upload step\n // will overwrite local\u2192remote anyway, but the user still deserves\n // to see what's affected.\n if (hasConflicts) {\n const headerText = options.force\n ? 'Conflicts (will be force-overwritten on remote):'\n : 'Conflicts (will be SKIPPED \u2014 pull first to resolve):';\n console.log(chalk.red.bold(headerText));\n for (const conflict of status.conflicts) {\n console.log(chalk.red(` ! ${conflict.filePath}`));\n console.log(chalk.dim(` ${conflict.description}`));\n }\n }\n\n if (appStatus.newLocal.length > 0) {\n console.log(chalk.green('New apps:'));\n for (const app of appStatus.newLocal) console.log(chalk.green(` + ${app}`));\n }\n if (appStatus.modified.length > 0) {\n console.log(chalk.yellow('Modified apps:'));\n for (const app of appStatus.modified) console.log(chalk.yellow(` ~ ${app}`));\n }\n\n // Pre-flight in the preview, BEFORE the confirm prompt. README\n // promises rejections show up in the plan; running pre-flight\n // only inside syncService.push() pushed them to AFTER the user\n // had already said \"yes\". Cost: every upload candidate is read\n // twice (preview + push). For big tenants this is measurable\n // but predictability is the user-visible contract \u2014 they'd\n // rather know about a 256-char-name reject before pressing\n // ENTER on a 200-file mirror push.\n const previewCandidates = [...filesToUpload, ...filesToRecreate, ...filesToOverwrite];\n const previewRejections = previewPushPlan(filesDir, previewCandidates);\n if (previewRejections.length > 0) {\n console.log();\n console.log(chalk.red.bold('Files that pre-flight will reject (skipped from upload):'));\n for (const r of previewRejections) {\n console.log(chalk.red(` \u2717 ${r.filePath}`));\n console.log(chalk.dim(` ${r.detail}`));\n if (r.hint) console.log(chalk.dim(` ${r.hint}`));\n }\n }\n\n console.log();\n\n // filesToUpload already includes filesToRecreate under --force,\n // so don't double-count.\n const totalChanges =\n filesToUpload.length +\n filesToDelete.length +\n remoteOnlyFiles.length +\n appStatus.newLocal.length +\n appStatus.modified.length;\n\n // Step 3: Confirm. --force always confirms (cannot be skipped\n // with -y) because mirror mode includes destructive deletes.\n //\n // Spell out every bucket in the prompt itself, not just the\n // total. A 200-overwrite + 2-delete mirror with the old\n // \"Mirror N change(s) (including K remote deletion(s))\"\n // headline read like \"small change\" \u2014 the eye-catching K\n // hid the bigger blast radius. The plan above the prompt is\n // already explicit; the prompt-line should match it.\n const confirmMessage = options.force\n ? `Mirror to ${tenant}: ${remoteOnlyFiles.length} remote deletion(s), ` +\n `${filesToOverwrite.length} drift overwrite(s), ${filesToRecreate.length} recreation(s), ` +\n `${status.addedLocally.length} new upload(s), ${status.modifiedLocally.length} local edit(s), ` +\n `${filesToDelete.length} local-rm deletion(s). This is destructive.`\n : `Push ${totalChanges} change(s) to ${tenant}?`;\n\n if (options.force || !options.yes) {\n const confirm = await inquirer.prompt([\n {\n type: 'confirm',\n name: 'proceed',\n message: confirmMessage,\n default: !options.force,\n },\n ]);\n\n if (!confirm.proceed) {\n logger.info('Push cancelled.');\n return;\n }\n }\n\n try {\n // Mirror the service's actual return type so every field is\n // present and non-optional. The earlier hand-rolled inline\n // type marked conflicts/rejected/failed as optional, which\n // forced `?.length ?? 0` defensiveness at every read site\n // even though the service always returns those arrays.\n let result: Awaited<ReturnType<SyncService['push']>> = {\n uploaded: [],\n updated: [],\n deleted: [],\n unchanged: [],\n conflicts: [],\n rejected: [],\n failed: [],\n ignoredLocal: [],\n ignoredLocalTotal: 0,\n ignoredLocalTotalByReason: { unsupportedExtension: 0, blocklistedFolder: 0 },\n };\n\n if (hasFileChanges) {\n logger.info(`Pushing files to ${tenant}...`);\n // Pass syncFilterOptions so mirror-mode deletes honour\n // --include-folder / --include-ext scope. Without this\n // the preview's \"remote-only DELETE\" line and the actual\n // mirror step diverged for non-default extensions.\n //\n // Hand `status.remoteHashes` (populated when deep status\n // ran above, i.e. under --force) into service.push so\n // the candidate-content fetch skips files we already\n // have hashes for. Without it, --force re-downloaded\n // every remote file a second time inside push().\n result = await syncService.push({\n force: options.force,\n mirror: options.force,\n ...syncFilterOptions,\n precomputedRemoteHashes: status.remoteHashes,\n });\n\n console.log();\n\n if (result.rejected.length > 0) {\n console.log(chalk.red.bold('Files skipped (backend would reject):'));\n renderRejections(result.rejected);\n }\n\n if (result.conflicts.length > 0) {\n console.log(chalk.red.bold(`${result.conflicts.length} conflict(s) detected:`));\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 logger.dim(`Resolve conflicts by pulling first: farseer pull ${tenant}`);\n logger.dim('Or use --force to push anyway (overwrites remote and mirrors deletions).');\n console.log();\n }\n\n if (result.uploaded.length > 0) {\n console.log(chalk.green('Uploaded files (new):'));\n for (const file of result.uploaded) console.log(chalk.green(` + ${file}`));\n console.log();\n }\n\n if (result.updated.length > 0) {\n console.log(chalk.yellow('Updated files:'));\n for (const file of result.updated) console.log(chalk.yellow(` M ${file}`));\n console.log();\n }\n\n if (result.deleted.length > 0) {\n console.log(chalk.red('Deleted files:'));\n for (const file of result.deleted) console.log(chalk.red(` - ${file}`));\n console.log();\n }\n\n if (result.failed.length > 0) {\n // Per-file errors that the backend rejected mid-flight\n // (5xx, validation we couldn't pre-flight, etc.).\n // Distinct from `rejected` (pre-flight) \u2014 these\n // already attempted the call. State for files that\n // succeeded before the failure has been saved.\n console.log(chalk.red.bold(`${result.failed.length} file(s) failed during push:`));\n for (const failure of result.failed) {\n console.log(chalk.red(` ! ${failure.filePath} (${failure.operation})`));\n console.log(chalk.dim(` ${failure.reason}`));\n }\n console.log();\n }\n }\n\n let appResult = {\n created: [] as string[],\n updated: [] as string[],\n deleted: [] as string[],\n unchanged: [] as string[],\n };\n\n if (hasAppChanges) {\n logger.info(`Pushing apps to ${tenant}...`);\n appResult = await appSyncService.push();\n\n if (appResult.created.length > 0) {\n console.log(chalk.green('Created apps:'));\n for (const app of appResult.created) console.log(chalk.green(` + ${app}`));\n console.log();\n }\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 console.log();\n }\n\n if (appResult.deleted.length > 0) {\n console.log(chalk.red('Deleted apps:'));\n for (const app of appResult.deleted) console.log(chalk.red(` - ${app}`));\n console.log();\n }\n }\n\n console.log();\n const fileSideEffects = result.uploaded.length + result.updated.length + result.deleted.length;\n const appSideEffects = appResult.created.length + appResult.updated.length + appResult.deleted.length;\n const conflictCount = result.conflicts.length;\n const rejectedCount = result.rejected.length;\n const failedCount = result.failed.length;\n if (fileSideEffects + appSideEffects === 0 && (conflictCount > 0 || rejectedCount > 0)) {\n // Nothing was actually pushed (every candidate hit a\n // conflict or pre-flight rejection). Surface as a\n // warning + EXIT 1 so CI and shell scripts can branch\n // \u2014 the bare \"Push complete!\" line was misleading.\n if (rejectedCount > 0 && conflictCount === 0) {\n logger.warning(`Push did nothing \u2014 ${rejectedCount} file(s) rejected by pre-flight.`);\n logger.dim('Fix the issues listed above and re-run `farseer push`.');\n } else if (conflictCount > 0 && rejectedCount === 0) {\n logger.warning(`Push did nothing \u2014 ${conflictCount} conflict(s) blocked the upload.`);\n logger.dim(`Resolve via 'farseer pull ${tenant}' or rerun with --force.`);\n } else {\n logger.warning(\n `Push did nothing \u2014 ${rejectedCount} file(s) rejected and ${conflictCount} conflict(s) blocked the upload.`,\n );\n }\n process.exit(1);\n }\n logger.success('Push complete!');\n logger.dim(`Files: +${result.uploaded.length} ~${result.updated.length} -${result.deleted.length}`);\n logger.dim(\n `Apps: +${appResult.created.length} ~${appResult.updated.length} -${appResult.deleted.length}`,\n );\n if (rejectedCount > 0 || failedCount > 0) {\n // Partial success: at least some side effects landed\n // but some candidates were skipped (rejected pre-flight)\n // or failed mid-push (network/backend error). EXIT 1\n // (not 2 \u2014 the previous split was undocumented and most\n // CI scripts treat any non-zero as failure anyway).\n if (rejectedCount > 0 && failedCount > 0) {\n logger.warning(\n `${rejectedCount} file(s) skipped pre-flight, ${failedCount} failed mid-push \u2014 see above and rerun.`,\n );\n } else if (rejectedCount > 0) {\n logger.warning(`${rejectedCount} file(s) skipped (see above) \u2014 fix and rerun.`);\n } else {\n logger.warning(`${failedCount} file(s) failed during push (see above) \u2014 rerun to retry.`);\n }\n process.exit(1);\n }\n } catch (error) {\n fileLogger.error('push', error, { tenant, organisation });\n logger.error('Push 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 * Translate a SyncStatus + force flag into the buckets the push command\n * actually acts on. Pure: takes a status, returns lists. Lives at the\n * top level (not inside the action closure) so it can be exported and\n * unit-tested directly \u2014 the status engine has its own coverage, and\n * before this extraction the bucket logic was inline in the action and\n * only reachable via mocking commander + inquirer + fs.\n *\n * Default push: upload the added/modified locally, delete the locally-\n * removed. Remote-side activity is not in scope (drift check refuses\n * before we reach this).\n *\n * Force push (mirror): also re-upload files the remote has lost\n * (deletedRemotely \u2192 recreate) and files the remote has drifted away\n * from (modifiedRemotely \u2192 local wins, overwrite). Plus mirror-deletes\n * remote files that have no local counterpart (addedRemotely).\n */\nexport function buildPushPlan(\n status: SyncStatus,\n options: { force: boolean },\n): {\n filesToUpload: string[];\n filesToDelete: string[];\n remoteOnlyFiles: string[];\n filesToRecreate: string[];\n filesToOverwrite: string[];\n} {\n return {\n filesToUpload: [\n ...status.addedLocally,\n ...status.modifiedLocally,\n ...(options.force ? status.deletedRemotely : []),\n ...(options.force ? status.modifiedRemotely : []),\n ],\n filesToDelete: [...status.deletedLocally],\n remoteOnlyFiles: options.force ? [...status.addedRemotely] : [],\n filesToRecreate: options.force ? [...status.deletedRemotely] : [],\n filesToOverwrite: options.force ? [...status.modifiedRemotely] : [],\n };\n}\n\nfunction renderRejections(rejections: ValidationFailure[]): void {\n for (const r of rejections) {\n console.log(chalk.red(` x ${r.filePath}`));\n console.log(chalk.dim(` ${r.detail}`));\n if (r.hint) console.log(chalk.dim(` ${r.hint}`));\n }\n console.log();\n}\n\n/**\n * Run pre-flight against a list of upload candidates and return only the\n * rejections so the preview can show them BEFORE the confirm prompt. We\n * read each file once here; syncService.push() reads them again at upload\n * time. The duplicate read is the price of putting rejections into the\n * confirmation plan \u2014 without this, the user only learned about rejected\n * files after pressing ENTER, which contradicted the README.\n *\n * Files that fail to read (permission errors, race with deletion) get\n * skipped \u2014 push() will surface that as a real failure if the file\n * actually still mattered.\n */\nfunction previewPushPlan(filesDir: string, candidates: string[]): ValidationFailure[] {\n const validationInputs: { filePath: string; size: number; content: Buffer }[] = [];\n for (const filePath of candidates) {\n try {\n const fullPath = safeResolveWithinBase(filesDir, filePath);\n const content = fs.readFileSync(fullPath);\n validationInputs.push({ filePath, size: content.length, content });\n } catch {\n // Race: file disappeared between getStatus and the preview\n // read, or unreadable. Push() will see the same condition\n // and surface a real error. Don't pretend to know more here.\n continue;\n }\n }\n const { rejected } = partitionForUpload(validationInputs);\n return rejected;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAkB;AAClB,sBAAqB;AACrB,oBAAuB;AACvB,wBAA2B;AAC3B,uBAA0B;AAC1B,yBAA4B;AAC5B,4BAA+B;AAC/B,qBAMO;AACP,4BAAkC;AAClC,4BAAsD;AACtD,wBAA0E;AAC1E,2BAAmC;AAEnC,SAAoB;AA4Bb,SAAS,oBAAoB,SAAwB;AACxD,UACK,QAAQ,qBAAqB,EAC7B;AAAA,IACG;AAAA,EACJ,EACC;AAAA,IACG;AAAA,IACA;AAAA,EACJ,EACC,OAAO,aAAa,6EAA6E,EACjG;AAAA,IACG;AAAA,IACA;AAAA,EACJ,EAGC,OAAO,UAAU,6EAA6E,EAC9F,OAAO,uBAAuB,6CAA6C,iCAAe,CAAC,CAAC,EAC5F,OAAO,6BAA6B,4CAA4C,iCAAe,CAAC,CAAC,EACjG;AAAA,IACG;AAAA,IACA;AAAA,IACA;AAAA,IACA,CAAC;AAAA,EACL,EACC,OAAO,OAAO,MAAM,MAAM,YAAY;AACnC,UAAM,EAAE,cAAc,QAAQ,OAAO,IAAI,UAAM,4BAAU,MAAM,IAAI;AAEnE,UAAM,eAAW,kCAAkB,MAAM;AAEzC,QAAI,CAAC,GAAG,WAAW,QAAQ,GAAG;AAC1B,2BAAO,MAAM,+BAA2B,iCAAiB,QAAQ,CAAC,EAAE;AACpE,2BAAO,IAAI,6DAA6D;AACxE,cAAQ,KAAK,CAAC;AAAA,IAClB;AAEA,UAAM,cAAc,IAAI,+BAAY,QAAQ,MAAM;AAClD,UAAM,wBAAoB,uCAAoB,QAAQ,UAAU;AAChE,UAA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AAAA,EACtE;AACJ;AAEA,SAAS,iBAAiB,YAAuC;AAC7D,aAAW,KAAK,YAAY;AACxB,YAAQ,IAAI,aAAAA,QAAM,IAAI,OAAO,EAAE,QAAQ,EAAE,CAAC;AAC1C,YAAQ,IAAI,aAAAA,QAAM,IAAI,OAAO,EAAE,MAAM,EAAE,CAAC;AACxC,QAAI,EAAE,KAAM,SAAQ,IAAI,aAAAA,QAAM,IAAI,OAAO,EAAE,IAAI,EAAE,CAAC;AAAA,EACtD;AACA,UAAQ,IAAI;AAChB;AAcA,SAAS,gBAAgB,UAAkB,YAA2C;AAClF,QAAM,mBAA0E,CAAC;AACjF,aAAW,YAAY,YAAY;AAC/B,QAAI;AACA,YAAM,eAAW,sCAAsB,UAAU,QAAQ;AACzD,YAAM,UAAU,GAAG,aAAa,QAAQ;AACxC,uBAAiB,KAAK,EAAE,UAAU,MAAM,QAAQ,QAAQ,QAAQ,CAAC;AAAA,IACrE,QAAQ;AAIJ;AAAA,IACJ;AAAA,EACJ;AACA,QAAM,EAAE,SAAS,QAAI,0CAAmB,gBAAgB;AACxD,SAAO;AACX;",
6
5
  "names": ["chalk", "inquirer"]
7
6
  }
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/commands/refresh.ts"],
4
- "sourcesContent": ["import { Command } from 'commander';\nimport * as fs from 'fs';\nimport { logger } from '../utils/logger';\nimport { preflight } from '../services/preflight';\nimport { SyncService, SyncState, shouldIncludeFile } from '../services/syncService';\nimport {\n calculateHash,\n ensureDirectoryExists,\n getAllFilesInDir,\n getSyncFilePath,\n getTenantFilesDir,\n safeResolveWithinBase,\n} from '../utils/helpers';\nimport { collectValues, normalizeExtensions } from '../utils/cliOptions';\nimport * as path from 'path';\n\nexport interface RefreshSummary {\n matched: number;\n divergent: number;\n localOnly: number;\n remoteOnly: number;\n state: SyncState;\n}\n\n/**\n * Pure baseline-build step of `farseer refresh` \u2014 separated from the\n * commander wiring so tests exercise the EXACT production logic (and\n * mutation-testing the rule below actually breaks the test suite).\n *\n * Contract: only writes a baseline entry for both-sided files when\n * `localHash === remoteHash`. Divergent both-sided pairs are omitted\n * so the next `status` surfaces them as `conflict_both_new` rather\n * than silently picking local-as-truth (see `compareFiles`).\n */\nexport function buildRefreshedState(args: {\n tenant: string;\n filesDir: string;\n filesDirExists: boolean;\n localPaths: string[];\n remoteHashes: Map<string, string>;\n now?: () => Date;\n}): RefreshSummary {\n const { filesDir, filesDirExists, localPaths, remoteHashes } = args;\n const state: SyncState = { lastSync: (args.now ?? (() => new Date()))().toISOString(), files: {} };\n\n let matched = 0;\n let divergent = 0;\n\n if (filesDirExists) {\n for (const relPath of localPaths) {\n const buf = fs.readFileSync(safeResolveWithinBase(filesDir, relPath));\n const localHash = calculateHash(buf);\n const remoteHash = remoteHashes.get(relPath);\n if (remoteHash !== undefined) {\n if (localHash === remoteHash) {\n state.files[relPath] = { localHash, remoteHash };\n matched++;\n } else {\n divergent++;\n }\n }\n // Local-only: omitted \u2014 next status sees `!hadBaseline` and\n // emits `local_new`.\n }\n }\n // Remote-only: omitted \u2014 next status sees `!hadBaseline` and emits\n // `remote_new`.\n\n const localOnly = localPaths.filter((p) => !remoteHashes.has(p)).length;\n const remoteOnly = Array.from(remoteHashes.keys()).filter((p) => !localPaths.includes(p)).length;\n\n return { matched, divergent, localOnly, remoteOnly, state };\n}\n\n/**\n * `farseer refresh` \u2014 rebuild the local sync baseline (.farseer-sync.json)\n * to match the current on-disk + remote state.\n *\n * Operational escape hatch for when the baseline gets out of step:\n * - the workspace was checked into git and another machine's baseline\n * got committed (now reports phantom drift after a clone)\n * - manual edits to the sync file\n * - inherited workspace from another machine\n *\n * Mechanism: walk local files + fetch current remote hashes (via the\n * existing deep-mode getStatus), then write a fresh SyncState that\n * records each file's hash ONLY when it exists on both sides AND the\n * local and remote hashes already match (an actual in-sync pair).\n *\n * Files are LEFT OUT of the baseline in three cases \u2014 each maps to a\n * `!hadBaseline` branch in compareFiles that classifies the file\n * correctly on the next status:\n *\n * - Local-only file \u2192 `local_new` (NOT `remote_deleted`).\n * - Remote-only file \u2192 `remote_new` (NOT `local_deleted`).\n * - Both-sided but divergent hashes \u2192 `conflict_both_new` so the\n * user is forced to choose via pull/push, not silently overwritten.\n * If we instead recorded `{localHash, remoteHash}` for divergent\n * pairs, the next status would treat current state as matching\n * baseline \u2192 `local_modified` (via the `baselineDivergent` branch),\n * and `push -y` would happily overwrite the real remote edit.\n * Refresh has no way to know which side is \"the truth\" when\n * hashes already differ, so it refuses to bake either side in.\n *\n * Recording a synthetic baseline (empty-string or self-hash) trips the\n * `hadBaseline=true` path and flips the meaning \u2014 the exact failure\n * this command exists to cure.\n *\n * Difference from `pull --force`:\n * - `refresh` mutates only the baseline (.farseer-sync.json). Local\n * and remote files are untouched. Use it when the diff state is\n * wrong but the actual files are fine.\n * - `pull --force` discards local edits and mirrors remote into the\n * working tree. Destructive. Use it when local is wrong.\n */\nexport function registerRefreshCommand(program: Command): void {\n program\n .command('refresh [org] [tenant]')\n .description('Rebuild the local sync baseline (.farseer-sync.json) from current on-disk + remote state')\n .option(\n '--all',\n 'Include all non-hidden, non-blocklisted files outside the default scope (matches pull/status)',\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 { tenant, client } = await preflight(arg1, arg2);\n\n const includeExtensions = normalizeExtensions(options.includeExt);\n const includeFolders = options.includeFolder as string[];\n const filterOptions = {\n all: options.all,\n includeExtensions: includeExtensions.length > 0 ? includeExtensions : undefined,\n includeFolders: includeFolders.length > 0 ? includeFolders : undefined,\n };\n\n try {\n const syncService = new SyncService(tenant, client);\n logger.info('Hashing local files and fetching remote hashes...');\n\n // Fetch remote hashes first (deep). If this throws we keep\n // the existing baseline file untouched \u2014 see the atomic\n // write below for the symmetric guarantee on the write\n // side.\n const status = await syncService.getStatus({ ...filterOptions, deep: true });\n\n const filesDir = getTenantFilesDir(tenant);\n const filesDirExists = fs.existsSync(filesDir);\n if (!filesDirExists) {\n logger.warning(\n `Local files directory not found: ${filesDir} \u2014 baseline will be empty and all remote files will be reported as new on next status.`,\n );\n }\n const localPaths = filesDirExists\n ? getAllFilesInDir(filesDir).filter((f) => shouldIncludeFile(f, tenant, filterOptions))\n : [];\n const remoteHashes = status.remoteHashes ?? new Map<string, string>();\n\n const summary = buildRefreshedState({\n tenant,\n filesDir,\n filesDirExists,\n localPaths,\n remoteHashes,\n });\n\n // Atomic write: tmp + rename. rename(2) on POSIX is atomic\n // for the destination \u2014 a Ctrl-C between the fetch above\n // and a successful rename leaves the previous baseline\n // intact rather than nuking it and leaving the workspace\n // with NO baseline.\n const syncFilePath = getSyncFilePath(tenant);\n ensureDirectoryExists(path.dirname(syncFilePath));\n const tmpPath = `${syncFilePath}.tmp`;\n fs.writeFileSync(tmpPath, JSON.stringify(summary.state, null, 2), 'utf-8');\n fs.renameSync(tmpPath, syncFilePath);\n\n logger.success(\n `Baseline rebuilt \u2014 ${summary.matched} matched, ${summary.divergent} divergent (will be reported as conflicts), ${summary.localOnly} local-only, ${summary.remoteOnly} remote-only.`,\n );\n logger.dim(\n 'Divergent, local-only, and remote-only entries are deliberately absent from the baseline; the next `farseer status` will report them as conflicts / added locally / added remotely so you can choose how to resolve them.',\n );\n logger.dim('Run `farseer status` to see the new diff.');\n } catch (error) {\n logger.error('Refresh failed.');\n if (error instanceof Error) logger.dim(error.message);\n process.exit(1);\n }\n });\n}\n"],
5
4
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,SAAoB;AACpB,oBAAuB;AACvB,uBAA0B;AAC1B,yBAA0D;AAC1D,qBAOO;AACP,wBAAmD;AACnD,WAAsB;AAoBf,SAAS,oBAAoB,MAOjB;AACf,QAAM,EAAE,UAAU,gBAAgB,YAAY,aAAa,IAAI;AAC/D,QAAM,QAAmB,EAAE,WAAW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/run.ts"],
4
- "sourcesContent": ["import { Command } from 'commander';\nimport { inAgentSandbox, LOCAL_APP_RUNS_UNAVAILABLE } from '../utils/agentSandbox';\nimport { logger } from '../utils/logger';\nimport { getCredential, generateBasePath } from '../services/configService';\nimport { getFreshAccessToken } from '../services/farseerService';\nimport { realmForOrganisation } from '../services/realms';\nimport { showLoginPrompt } from '../services/authErrors';\nimport { preflightForPair } from '../services/preflight';\nimport { getTenantDir, getTenantSrcDir, getTenantFilesDir, parseAppArgs, resolveAppOrExit } from '../utils/helpers';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { spawn } from 'child_process';\n\n/**\n * Find a script file recursively in a directory.\n * Returns the relative path from baseDir if found, null otherwise.\n */\nfunction findScriptRecursively(baseDir: string, scriptName: string): string | null {\n if (!fs.existsSync(baseDir)) {\n return null;\n }\n\n const search = (dir: string, relativePath: string = ''): string | null => {\n const items = fs.readdirSync(dir, { withFileTypes: true });\n\n for (const item of items) {\n const itemRelPath = relativePath ? `${relativePath}/${item.name}` : item.name;\n\n if (item.isFile() && item.name === scriptName) {\n return itemRelPath;\n }\n\n if (item.isDirectory()) {\n const found = search(path.join(dir, item.name), itemRelPath);\n if (found) return found;\n }\n }\n\n return null;\n };\n\n return search(baseDir);\n}\n\ninterface RunCredentials {\n tenantId: string;\n apiKey?: string;\n accessToken?: string;\n basePath: string;\n}\n\nasync function getRunCredentials(\n organisation: string,\n tenant: string,\n tenantIdOverride?: string,\n): Promise<RunCredentials | null> {\n // 1. Prefer API key when one is saved for this tenant \u2014 it's already the\n // canonical credential, has the correct basePath, and doesn't expire\n // during a long-running script.\n const credential = getCredential(tenant);\n if (credential) {\n return {\n tenantId: tenantIdOverride || credential.tenantId,\n apiKey: credential.apiKey,\n basePath: credential.basePath,\n };\n }\n\n // 2. Fall back to the browser login for the organisation's realm, refreshed if expired.\n const accessToken = await getFreshAccessToken(await realmForOrganisation(organisation));\n if (accessToken) {\n return {\n tenantId: tenantIdOverride || tenant,\n accessToken,\n basePath: generateBasePath(organisation),\n };\n }\n return null;\n}\n\n// Helper to collect multiple --arg options\nfunction collectArgs(value: string, previous: string[]): string[] {\n return previous.concat([value]);\n}\n\nexport function registerRunCommand(program: Command): void {\n program\n .command('run [args...]')\n .description('Run an app locally with injected credentials')\n .option('--tenant-id <id>', 'Tenant ID for env variables (defaults to tenant name)')\n .option('--arg <value>', 'Pass argument in format \"Name=Value\" (can be used multiple times)', collectArgs, [])\n .option('--id <id>', 'Select the app by its numeric id (use when names collide)')\n .action(async (args: string[], options) => {\n if (inAgentSandbox()) {\n logger.error(LOCAL_APP_RUNS_UNAVAILABLE);\n process.exit(1);\n }\n const { organisation, tenant, appName } = parseAppArgs(args, {\n allowEmptyName: !!options.id,\n command: 'run',\n });\n // Guard (auth + org\u220Btenant) first, then fetch the app details.\n const { client: api } = await preflightForPair(organisation, tenant);\n\n // Find the app\n logger.info(appName ? `Loading app: ${appName}...` : `Loading app by id: ${options.id}...`);\n const app = await resolveAppOrExit(api, { appName, id: options.id, tenant });\n\n const runScripts = app.scriptFiles ?? [];\n if (!app.mainScriptFileId || runScripts.length === 0) {\n logger.error(`App \"${app.name}\" has no scripts configured.`);\n logger.dim('Configure the app with: farseer app configure \"' + app.name + '\" --entrypoint <script>');\n process.exit(1);\n }\n\n // Find the entrypoint script name\n const mainScript = runScripts.find((s) => s.id === app.mainScriptFileId);\n if (!mainScript) {\n logger.error(`Entrypoint script not found for app \"${app.name}\".`);\n process.exit(1);\n }\n\n // Normalize script name - handle both \"test.ts\" and \"Scripts/test.ts\" formats\n let scriptName = mainScript.name;\n if (scriptName.toLowerCase().startsWith('scripts/')) {\n scriptName = scriptName.substring('scripts/'.length);\n }\n\n // Get credentials for running\n const credentials = await getRunCredentials(organisation, tenant, options.tenantId);\n\n if (!credentials) {\n showLoginPrompt(tenant, organisation);\n process.exit(1);\n }\n\n const tenantDir = getTenantDir(tenant);\n const srcDir = getTenantSrcDir(tenant);\n const filesDir = getTenantFilesDir(tenant);\n\n // Script path is relative to files/Scripts/ folder\n // First try direct path, then search recursively if not found\n let scriptPath = path.resolve(srcDir, scriptName);\n let relativeScriptPath = `files/Scripts/${scriptName}`;\n\n if (!fs.existsSync(scriptPath)) {\n // Try to find the script recursively in the files directory\n const foundPath = findScriptRecursively(filesDir, path.basename(scriptName));\n if (foundPath) {\n scriptPath = path.resolve(filesDir, foundPath);\n relativeScriptPath = `files/${foundPath}`;\n logger.dim(`Found script at: ${foundPath}`);\n }\n }\n\n if (!fs.existsSync(scriptPath)) {\n logger.error(`Script not found locally: ${scriptPath}`);\n logger.dim('Run \"farseer pull ' + tenant + '\" to download scripts first.');\n process.exit(1);\n }\n\n // Check if node_modules exists\n const nodeModulesPath = path.join(tenantDir, 'node_modules');\n if (!fs.existsSync(nodeModulesPath)) {\n logger.error(`Dependencies not installed for ${tenant}`);\n logger.dim(`Run: farseer install ${tenant}`);\n process.exit(1);\n }\n\n // Parse arguments\n const appArgs: Record<string, string> = {};\n\n // Start with default values from app config.\n // defaultValue is optional on the API type; treat missing as ''\n // so we always hand a string to the runner.\n for (const arg of app.expectedArguments) {\n appArgs[arg.name] = arg.defaultValue ?? '';\n }\n\n // Override with provided arguments\n for (const argStr of options.arg) {\n const eqIndex = argStr.indexOf('=');\n if (eqIndex === -1) {\n logger.error(`Invalid argument format: ${argStr}`);\n logger.dim('Use format: --arg \"Name=Value\"');\n process.exit(1);\n }\n const name = argStr.substring(0, eqIndex);\n const value = argStr.substring(eqIndex + 1);\n appArgs[name] = value;\n }\n\n const authType = credentials.apiKey ? 'API key' : 'access token';\n logger.info(`Running app \"${app.name}\" (${scriptName}) for tenant ${tenant} (using ${authType})...`);\n\n // Show arguments being used\n if (Object.keys(appArgs).length > 0) {\n logger.dim('Arguments:');\n for (const [key, value] of Object.entries(appArgs)) {\n logger.dim(` ${key}: ${value}`);\n }\n }\n console.log();\n\n // Build environment variables based on auth type\n const envVars: Record<string, string> = {\n ...(process.env as Record<string, string>),\n TENANT_ID: credentials.tenantId,\n FARSEER_URL: credentials.basePath,\n };\n\n if (credentials.apiKey) {\n envVars.FARSEER_API_KEY = credentials.apiKey;\n }\n if (credentials.accessToken) {\n envVars.FARSEER_TOKEN = credentials.accessToken;\n }\n\n // Build command line arguments from app arguments (in order)\n const cmdArgs: string[] = [];\n for (const arg of app.expectedArguments) {\n cmdArgs.push(appArgs[arg.name] ?? arg.defaultValue ?? '');\n }\n\n // Run with credentials injected via environment variables, arguments via command line\n const quotedScriptPath = `\"${relativeScriptPath}\"`;\n const child = spawn('npx', ['tsx', quotedScriptPath, ...cmdArgs], {\n stdio: 'inherit',\n cwd: tenantDir,\n shell: true,\n env: envVars,\n });\n\n child.on('close', (code) => {\n if (code !== 0) {\n logger.error(`Script exited with code ${code}`);\n process.exit(code || 1);\n }\n });\n\n child.on('error', (err) => {\n logger.error(`Failed to run script: ${err.message}`);\n logger.dim('Make sure tsx is installed: npm install -g tsx');\n process.exit(1);\n });\n });\n\n // Keep the old script-based run as a separate command\n program\n .command('run-script <args...>')\n .description('Run a script directly (without app wrapper)')\n .option('--tenant-id <id>', 'Tenant ID for env variables (defaults to tenant name)')\n .action(async (args: string[], options) => {\n if (inAgentSandbox()) {\n logger.error(LOCAL_APP_RUNS_UNAVAILABLE);\n process.exit(1);\n }\n const { organisation, tenant, appName } = parseAppArgs(args);\n // Same guard as `run`, but the result is discarded: run-script needs\n // no client of its own. It's here for the gate alone \u2014 the script is\n // handed live credentials for this tenant a few lines down, so the\n // pair has to be proven before that happens. That makes it the one\n // command that trades zero network calls for one.\n await preflightForPair(organisation, tenant);\n let script = appName;\n const credentials = await getRunCredentials(organisation, tenant, options.tenantId);\n\n if (!credentials) {\n showLoginPrompt(tenant, organisation);\n process.exit(1);\n }\n\n // Normalize script path - strip Scripts/ prefix if present\n if (script.toLowerCase().startsWith('scripts/')) {\n script = script.substring('scripts/'.length);\n }\n\n const tenantDir = getTenantDir(tenant);\n const srcDir = getTenantSrcDir(tenant);\n const filesDir = getTenantFilesDir(tenant);\n\n // Script path is relative to files/Scripts/ folder\n // First try direct path, then search recursively if not found\n let scriptPath = path.resolve(srcDir, script);\n let relativeScriptPath = `files/Scripts/${script}`;\n\n if (!fs.existsSync(scriptPath)) {\n // Try to find the script recursively in the files directory\n const foundPath = findScriptRecursively(filesDir, path.basename(script));\n if (foundPath) {\n scriptPath = path.resolve(filesDir, foundPath);\n relativeScriptPath = `files/${foundPath}`;\n logger.dim(`Found script at: ${foundPath}`);\n }\n }\n\n if (!fs.existsSync(scriptPath)) {\n logger.error(`Script not found: ${scriptPath}`);\n process.exit(1);\n }\n\n // Check if node_modules exists\n const nodeModulesPath = path.join(tenantDir, 'node_modules');\n if (!fs.existsSync(nodeModulesPath)) {\n logger.error(`Dependencies not installed for ${tenant}`);\n logger.dim(`Run: farseer install ${tenant}`);\n process.exit(1);\n }\n\n const authType = credentials.apiKey ? 'API key' : 'access token';\n logger.info(`Running ${script} for tenant ${tenant} (using ${authType})...`);\n console.log();\n\n // Build environment variables based on auth type\n const envVars: Record<string, string> = {\n ...(process.env as Record<string, string>),\n TENANT_ID: credentials.tenantId,\n FARSEER_URL: credentials.basePath,\n };\n\n if (credentials.apiKey) {\n envVars.FARSEER_API_KEY = credentials.apiKey;\n }\n if (credentials.accessToken) {\n envVars.FARSEER_TOKEN = credentials.accessToken;\n }\n\n const quotedScriptPath = `\"${relativeScriptPath}\"`;\n const child = spawn('npx', ['tsx', quotedScriptPath], {\n stdio: 'inherit',\n cwd: tenantDir,\n shell: true,\n env: envVars,\n });\n\n child.on('close', (code) => {\n if (code !== 0) {\n logger.error(`Script exited with code ${code}`);\n process.exit(code || 1);\n }\n });\n\n child.on('error', (err) => {\n logger.error(`Failed to run script: ${err.message}`);\n logger.dim('Make sure tsx is installed: npm install -g tsx');\n process.exit(1);\n });\n });\n}\n"],
5
4
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,0BAA2D;AAC3D,oBAAuB;AACvB,2BAAgD;A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Ae,GAAG;AACjC,2BAAO,MAAM,kCAAkC,MAAM,EAAE;AACvD,2BAAO,IAAI,wBAAwB,MAAM,EAAE;AAC3C,cAAQ,KAAK,CAAC;AAAA,IAClB;AAEA,UAAM,WAAW,YAAY,SAAS,YAAY;AAClD,yBAAO,KAAK,WAAW,MAAM,eAAe,MAAM,WAAW,QAAQ,MAAM;AAC3E,YAAQ,IAAI;AAGZ,UAAM,UAAkC;AAAA,MACpC,GAAI,QAAQ;AAAA,MACZ,WAAW,YAAY;AAAA,MACvB,aAAa,YAAY;AAAA,IAC7B;AAEA,QAAI,YAAY,QAAQ;AACpB,cAAQ,kBAAkB,YAAY;AAAA,IAC1C;AACA,QAAI,YAAY,aAAa;AACzB,cAAQ,gBAAgB,YAAY;AAAA,IACxC;AAEA,UAAM,mBAAmB,IAAI,kBAAkB;AAC/C,UAAM,YAAQ,4BAAM,OAAO,CAAC,OAAO,gBAAgB,GAAG;AAAA,MAClD,OAAO;AAAA,MACP,KAAK;AAAA,MACL,OAAO;AAAA,MACP,KAAK;AAAA,IACT,CAAC;AAED,UAAM,GAAG,SAAS,CAAC,SAAS;AACxB,UAAI,SAAS,GAAG;AACZ,6BAAO,MAAM,2BAA2B,IAAI,EAAE;AAC9C,gBAAQ,KAAK,QAAQ,CAAC;AAAA,MAC1B;AAAA,IACJ,CAAC;AAED,UAAM,GAAG,SAAS,CAAC,QAAQ;AACvB,2BAAO,MAAM,yBAAyB,IAAI,OAAO,EAAE;AACnD,2BAAO,IAAI,gDAAgD;AAC3D,cAAQ,KAAK,CAAC;AAAA,IAClB,CAAC;AAAA,EACL,CAAC;AACT;",
6
5
  "names": []
7
6
  }
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/commands/sheets.ts"],
4
- "sourcesContent": ["import { Command } from 'commander';\nimport * as fs from 'fs';\nimport * as farseer from 'farseer-client';\nimport chalk from 'chalk';\nimport { logger } from '../utils/logger';\nimport { showLoginPrompt, isAuthError } from '../services/authErrors';\nimport { preflight } from '../services/preflight';\nimport { resolveSheet, describeAmbiguity, listSheets } from '../utils/entityResolver';\n\nexport function registerSheetsCommand(program: Command): void {\n const sheetsCmd = program.command('sheets').description('List and inspect sheets');\n\n // farseer sheets list [org] [tenant]\n sheetsCmd\n .command('list [org] [tenant]')\n .description('List all sheets')\n .option('--json', 'Output raw JSON')\n .action(async (first, second, options) => {\n const { native: nativeClient, tenant } = await preflight(first, second);\n\n try {\n const sheets = await listSheets(nativeClient);\n\n if (options.json) {\n console.log(JSON.stringify(sheets, null, 2));\n return;\n }\n\n logger.header(`Sheets (${sheets.length})`);\n if (sheets.length === 0) {\n logger.dim(' No sheets found.');\n return;\n }\n for (const sheet of sheets) {\n const folder = sheet.folderPath?.length ? chalk.dim(` (${sheet.folderPath.join(' / ')})`) : '';\n console.log(` ${chalk.dim(String(sheet.id).padEnd(8))} ${chalk.bold(sheet.name)}${folder}`);\n }\n } catch (error) {\n handleSheetError(error, tenant);\n }\n });\n\n // farseer sheets show <nameOrId> [org] [tenant]\n sheetsCmd\n .command('show <nameOrId> [org] [tenant]')\n .description('Show sheet configuration')\n .option('--json', 'Output raw JSON')\n .action(async (nameOrId, first, second, options) => {\n const { native: nativeClient, tenant } = await preflight(first, second);\n\n try {\n const selection = await resolveSheet(nativeClient, nameOrId);\n if (selection.kind === 'ambiguous') {\n logger.error(\n await describeAmbiguity(\n nativeClient,\n 'sheets',\n nameOrId,\n selection.matches,\n farseer.FolderItemType.Sheet,\n ),\n );\n process.exit(1);\n }\n if (selection.kind === 'notFound') {\n logger.error(`Sheet \"${nameOrId}\" not found.`);\n process.exit(1);\n }\n const resolved = selection.entity;\n\n const sheet = await nativeClient.sheets.get(resolved.id);\n\n if (options.json) {\n console.log(JSON.stringify(sheet, null, 2));\n return;\n }\n\n logger.header(`Sheet: ${sheet.name}`);\n console.log(` ID: ${sheet.id}`);\n console.log(` Stacked: ${sheet.stacked}`);\n if (sheet.rows) {\n console.log(` Rows: ${JSON.stringify(sheet.rows)}`);\n }\n if (sheet.columns) {\n console.log(` Columns: ${JSON.stringify(sheet.columns)}`);\n }\n } catch (error) {\n handleSheetError(error, tenant);\n }\n });\n\n // farseer sheets data <nameOrId> [org] [tenant]\n sheetsCmd\n .command('data <nameOrId> [org] [tenant]')\n .description('Get sheet data')\n .option('--json', 'Output raw JSON')\n .option('--limit <n>', 'Limit number of rows', parseInt)\n .action(async (nameOrId, first, second, options) => {\n const { native: nativeClient, tenant } = await preflight(first, second);\n\n try {\n const selection = await resolveSheet(nativeClient, nameOrId);\n if (selection.kind === 'ambiguous') {\n logger.error(\n await describeAmbiguity(\n nativeClient,\n 'sheets',\n nameOrId,\n selection.matches,\n farseer.FolderItemType.Sheet,\n ),\n );\n process.exit(1);\n }\n if (selection.kind === 'notFound') {\n logger.error(`Sheet \"${nameOrId}\" not found.`);\n process.exit(1);\n }\n const resolved = selection.entity;\n\n const sheet = await nativeClient.sheets.get(resolved.id);\n const dataRequest: any = {\n path: `/${resolved.id}`,\n includeData: true,\n stacked: sheet.stacked,\n rows: sheet.rows,\n columns: sheet.columns,\n sharing: sheet.sharing,\n };\n\n const data = await nativeClient.sheets.getData(dataRequest);\n\n if (options.json) {\n console.log(JSON.stringify(data, null, 2));\n return;\n }\n\n logger.header(`Sheet Data: ${resolved.name}`);\n const dataObj = data as any;\n if (dataObj.cells && Array.isArray(dataObj.cells)) {\n const limit = options.limit || dataObj.cells.length;\n const cells = dataObj.cells.slice(0, limit);\n console.log(\n ` Cells: ${cells.length}${dataObj.cells.length > limit ? ` (of ${dataObj.cells.length})` : ''}`,\n );\n for (const cell of cells) {\n console.log(` ${JSON.stringify(cell)}`);\n }\n } else {\n console.log(JSON.stringify(data, null, 2));\n }\n } catch (error) {\n handleSheetError(error, tenant);\n }\n });\n\n // farseer sheets set-data [org] [tenant]\n sheetsCmd\n .command('set-data [org] [tenant]')\n .description('Set sheet data from JSON file')\n .requiredOption('--sheet <nameOrId>', 'Sheet name or ID')\n .requiredOption('--input <file>', 'JSON file with sheet data')\n .option('-y, --yes', 'Skip confirmation')\n .action(async (first, second, options) => {\n const { native: nativeClient, tenant } = await preflight(first, second);\n\n try {\n const selection = await resolveSheet(nativeClient, options.sheet);\n if (selection.kind === 'ambiguous') {\n logger.error(\n await describeAmbiguity(\n nativeClient,\n 'sheets',\n options.sheet,\n selection.matches,\n farseer.FolderItemType.Sheet,\n ),\n );\n process.exit(1);\n }\n if (selection.kind === 'notFound') {\n logger.error(`Sheet \"${options.sheet}\" not found.`);\n process.exit(1);\n }\n const resolved = selection.entity;\n\n if (!fs.existsSync(options.input)) {\n logger.error(`File not found: ${options.input}`);\n process.exit(1);\n }\n\n const inputData = JSON.parse(fs.readFileSync(options.input, 'utf-8'));\n\n if (!options.yes) {\n logger.warning(`This will update data in sheet \"${resolved.name}\" (ID: ${resolved.id}).`);\n logger.dim('Use -y to skip confirmation.');\n process.exit(0);\n }\n\n const setDataRequest: any = {\n sheetId: resolved.id,\n ...inputData,\n };\n\n await nativeClient.sheets.setData(setDataRequest);\n logger.success(`Sheet data updated for \"${resolved.name}\".`);\n } catch (error) {\n handleSheetError(error, tenant);\n }\n });\n}\n\nfunction handleSheetError(error: unknown, tenant: string): void {\n const errorMessage = error instanceof Error ? error.message : String(error);\n\n if (isAuthError(error)) {\n showLoginPrompt(tenant);\n } else if (errorMessage.includes('404')) {\n logger.error('Sheet not found or tenant not accessible.');\n } else if (errorMessage.includes('ENOTFOUND') || errorMessage.includes('ECONNREFUSED')) {\n logger.error('Failed to connect to Farseer.');\n } else {\n logger.error('Sheet operation failed.');\n logger.dim(errorMessage);\n }\n process.exit(1);\n}\n"],
5
4
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,SAAoB;AACpB,cAAyB;AACzB,mBAAkB;AAClB,oBAAuB;AACvB,wBAA6C;AAC7C,uBAA0B;AAC1B,4BAA4D;AAErD,SAAS,sBAAsB,SAAwB;AAC1D,QAAM,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AAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AAE1E,UAAI,+BAAY,KAAK,GAAG;AACpB,2CAAgB,MAAM;AAAA,EAC1B,WAAW,aAAa,SAAS,KAAK,GAAG;AACrC,yBAAO,MAAM,2CAA2C;AAAA,EAC5D,WAAW,aAAa,SAAS,WAAW,KAAK,aAAa,SAAS,cAAc,GAAG;AACpF,yBAAO,MAAM,+BAA+B;AAAA,EAChD,OAAO;AACH,yBAAO,MAAM,yBAAyB;AACtC,yBAAO,IAAI,YAAY;AAAA,EAC3B;AACA,UAAQ,KAAK,CAAC;AAClB;",
6
5
  "names": ["chalk"]
7
6
  }
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/commands/status.ts"],
4
- "sourcesContent": ["import { Command } from 'commander';\nimport chalk from 'chalk';\nimport { logger } from '../utils/logger';\nimport { preflight } from '../services/preflight';\nimport { SyncService } from '../services/syncService';\nimport { AppSyncService } from '../services/appSyncService';\nimport { getTenantFilesDir, displayLocalPath } from '../utils/helpers';\nimport { collectValues, normalizeExtensions } from '../utils/cliOptions';\nimport { reportIgnoredLocal } from '../utils/syncReporting';\nimport * as fs from 'fs';\n\nexport function registerStatusCommand(program: Command): void {\n program\n .command('status [org] [tenant]')\n .description(\n 'Show sync status between local and remote\\n\\nUsage: status <org> <tenant> OR status <tenant> (if org is known)',\n )\n .option(\n '--all',\n 'Show status for 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 '--shallow',\n 'Skip remote-content hashing (faster; trusts the last-sync baseline, will miss edits to existing remote files)',\n )\n // `--deep` was the opt-IN flag in 1.6.1 and earlier (default was\n // shallow). Deep is now the default, so the flag is a no-op \u2014 but\n // we still accept it so existing scripts that pass `--deep` keep\n // working. Same for push.\n .option('--deep', '(Deprecated; now the default) Hash remote content to detect remote-side edits')\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 { tenant, client } = await preflight(arg1, arg2);\n\n const filesDir = getTenantFilesDir(tenant);\n const localPathDisplay = displayLocalPath(filesDir);\n\n if (!fs.existsSync(filesDir)) {\n logger.warning(`Local folder not found: ${localPathDisplay}`);\n logger.dim('Run \"farseer pull <tenant>\" to download files from the instance.');\n return;\n }\n\n logger.info(`Comparing local (${localPathDisplay}) with remote (Files/)...`);\n console.log();\n\n const syncService = new SyncService(tenant, client);\n\n try {\n const includeExtensions = normalizeExtensions(options.includeExt);\n const includeFolders = options.includeFolder as string[];\n // Deep is the default. `--shallow` opts out and reuses the\n // last-pulled baseline as the \"current remote hash\", which\n // cannot detect content edits to existing remote files \u2014\n // surfaced via `status.deepCompare = false` for honest\n // reporting downstream.\n const deep = !options.shallow;\n const status = await syncService.getStatus({\n all: options.all,\n deep,\n includeExtensions: includeExtensions.length > 0 ? includeExtensions : undefined,\n includeFolders: includeFolders.length > 0 ? includeFolders : undefined,\n });\n\n // Fetch app status before the early-return gate; otherwise\n // pure app drift (args diverged on remote, no file changes)\n // reports as \"Everything in sync\".\n const appSyncService = new AppSyncService(tenant, client);\n const appStatus = await appSyncService.getStatus();\n const hasAppChanges =\n appStatus.newLocal.length > 0 || appStatus.newRemote.length > 0 || appStatus.modified.length > 0;\n\n const hasChanges =\n status.modifiedLocally.length > 0 ||\n status.modifiedRemotely.length > 0 ||\n status.addedLocally.length > 0 ||\n status.addedRemotely.length > 0 ||\n status.deletedLocally.length > 0 ||\n status.deletedRemotely.length > 0 ||\n status.conflicts.length > 0 ||\n hasAppChanges;\n\n if (!hasChanges) {\n // Surface the out-of-scope warning BEFORE the success\n // line so the \"within current scope\" qualifier reads\n // as a follow-up to the count the user just saw, not\n // a contradiction of a bare \"Everything is in sync!\".\n reportIgnoredLocal(status.ignoredLocal, status.ignoredLocalTotal);\n if (status.deepCompare) {\n if (status.ignoredLocalTotal > 0) {\n logger.success('Everything is in sync within current scope.');\n logger.dim(\n `(${status.ignoredLocalTotal} file(s) outside scope were not compared \u2014 see warning above for details.)`,\n );\n } else {\n logger.success('Everything is in sync!');\n }\n } else {\n // Fast mode reuses the last-pulled baseline for remote\n // hashes \u2014 it CANNOT detect content edits to existing\n // remote files. Be honest about what was checked.\n logger.info('Local matches the last-pull baseline.');\n logger.dim(\n 'Remote-side content edits not checked (--shallow). Drop the flag to verify against remote.',\n );\n }\n logger.dim(`${status.inSync.length} file(s) synchronized.`);\n if (appStatus.synced.length > 0) {\n logger.dim(`${appStatus.synced.length} app(s) synchronized.`);\n }\n return;\n }\n\n if (\n status.addedLocally.length > 0 ||\n status.modifiedLocally.length > 0 ||\n status.deletedLocally.length > 0\n ) {\n console.log(chalk.bold('Local changes:'));\n for (const file of status.addedLocally) console.log(chalk.green(` + ${file}`));\n for (const file of status.modifiedLocally) console.log(chalk.yellow(` M ${file}`));\n for (const file of status.deletedLocally) console.log(chalk.red(` - ${file}`));\n console.log();\n }\n\n const syncState = syncService.loadSyncState();\n if (\n status.addedRemotely.length > 0 ||\n status.modifiedRemotely.length > 0 ||\n status.deletedRemotely.length > 0\n ) {\n console.log(chalk.bold('Remote changes:'));\n for (const file of status.addedRemotely) console.log(chalk.cyan(` + ${file}`));\n for (const file of status.modifiedRemotely) {\n // Modified-on-remote rows pick up `(by <name>)` when\n // the recorded sync metadata knows who last uploaded\n // the file. Falls back to email when only that's set.\n const metadata = syncState.files[file]?.metadata;\n const uploaderInfo = metadata?.uploaderName\n ? ` (by ${metadata.uploaderName})`\n : metadata?.uploaderEmail\n ? ` (by ${metadata.uploaderEmail})`\n : '';\n console.log(chalk.cyan(` M ${file}`) + chalk.dim(uploaderInfo));\n }\n for (const file of status.deletedRemotely) console.log(chalk.red(` - ${file}`));\n console.log();\n }\n\n if (status.conflicts.length > 0) {\n console.log(chalk.red.bold('Conflicts:'));\n for (const conflict of status.conflicts) {\n console.log(chalk.red(` ! ${conflict.filePath}`));\n console.log(chalk.dim(` ${conflict.description}`));\n }\n console.log();\n logger.dim(`Resolve conflicts during pull: farseer pull ${tenant}`);\n console.log();\n }\n\n // App diff (already fetched above so the early-return path\n // can short-circuit correctly). Render only \u2014 no extra API call.\n if (hasAppChanges) {\n console.log(chalk.bold('Apps:'));\n console.log();\n\n if (appStatus.newLocal.length > 0) {\n console.log(chalk.green('New local apps (to be created on remote):'));\n for (const app of appStatus.newLocal) {\n console.log(chalk.green(` + ${app}`));\n }\n console.log();\n }\n\n if (appStatus.newRemote.length > 0) {\n console.log(chalk.cyan('New remote apps (to be downloaded):'));\n for (const app of appStatus.newRemote) {\n console.log(chalk.cyan(` + ${app}`));\n }\n console.log();\n }\n\n if (appStatus.modified.length > 0) {\n console.log(chalk.yellow('Modified apps:'));\n for (const app of appStatus.modified) {\n console.log(chalk.yellow(` ~ ${app}`));\n }\n console.log();\n }\n\n if (appStatus.synced.length > 0) {\n logger.dim(`${appStatus.synced.length} app(s) in sync.`);\n }\n } else if (appStatus.synced.length > 0) {\n logger.dim(`${appStatus.synced.length} app(s) in sync.`);\n }\n\n console.log();\n reportIgnoredLocal(status.ignoredLocal, status.ignoredLocalTotal);\n if (!status.deepCompare) {\n // Fast mode skipped the remote-content hash check, so the\n // listing above may be incomplete \u2014 content edits to\n // existing remote files won't appear. Tell the user.\n logger.dim('--shallow: remote-content edits to existing files were NOT checked.');\n }\n logger.dim('Use \"farseer push <tenant>\" to upload local changes.');\n logger.dim('Use \"farseer pull <tenant>\" to download remote changes.');\n } catch (error) {\n logger.error('Failed to check status.');\n if (error instanceof Error) {\n logger.dim(error.message);\n }\n process.exit(1);\n }\n });\n}\n"],
5
4
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAkB;AAClB,oBAAuB;AACvB,uBAA0B;AAC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