farseer-cli 1.7.2 → 1.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -43,6 +43,7 @@ var import_helpers = require("../utils/helpers");
43
43
  var import_errorFormatter = require("../utils/errorFormatter");
44
44
  var import_fileValidation = require("../utils/fileValidation");
45
45
  var import_cliOptions = require("../utils/cliOptions");
46
+ var import_syncReporting = require("../utils/syncReporting");
46
47
  var fs = __toESM(require("fs"));
47
48
  function registerPushCommand(program) {
48
49
  program.command("push [org] [tenant]").description(
@@ -67,7 +68,7 @@ function registerPushCommand(program) {
67
68
  }
68
69
  const filesDir = (0, import_helpers.getTenantFilesDir)(tenant);
69
70
  if (!fs.existsSync(filesDir)) {
70
- import_logger.logger.error(`Local folder not found: farseer-apps/${tenant}/files/`);
71
+ import_logger.logger.error(`Local folder not found: ${(0, import_helpers.displayLocalPath)(filesDir)}`);
71
72
  import_logger.logger.dim('Run "farseer pull <tenant>" first to initialize the folder.');
72
73
  process.exit(1);
73
74
  }
@@ -132,7 +133,15 @@ function registerPushCommand(program) {
132
133
  const hasFileChanges = filesToUpload.length > 0 || filesToDelete.length > 0 || remoteOnlyFiles.length > 0 || hasConflicts;
133
134
  const hasAppChanges = appStatus.newLocal.length > 0 || appStatus.modified.length > 0;
134
135
  if (!hasFileChanges && !hasAppChanges) {
135
- import_logger.logger.success("Nothing to push. Everything is in sync.");
136
+ (0, import_syncReporting.reportIgnoredLocal)(status.ignoredLocal, status.ignoredLocalTotal);
137
+ if (status.ignoredLocalTotal > 0) {
138
+ import_logger.logger.success("Everything is in sync within current scope.");
139
+ import_logger.logger.dim(
140
+ `(${status.ignoredLocalTotal} file(s) outside scope were not compared \u2014 see warning above for details.)`
141
+ );
142
+ } else {
143
+ import_logger.logger.success("Nothing to push. Everything is in sync.");
144
+ }
136
145
  return;
137
146
  }
138
147
  console.log();
@@ -159,6 +168,7 @@ function registerPushCommand(program) {
159
168
  for (const file of filesToOverwrite)
160
169
  console.log(import_chalk.default.yellow(` M ${file} (remote content drift; local wins)`));
161
170
  }
171
+ (0, import_syncReporting.reportIgnoredLocal)(status.ignoredLocal, status.ignoredLocalTotal);
162
172
  if (hasConflicts) {
163
173
  const headerText = options.force ? "Conflicts (will be force-overwritten on remote):" : "Conflicts (will be SKIPPED \u2014 pull first to resolve):";
164
174
  console.log(import_chalk.default.red.bold(headerText));
@@ -212,7 +222,10 @@ function registerPushCommand(program) {
212
222
  unchanged: [],
213
223
  conflicts: [],
214
224
  rejected: [],
215
- failed: []
225
+ failed: [],
226
+ ignoredLocal: [],
227
+ ignoredLocalTotal: 0,
228
+ ignoredLocalTotalByReason: { unsupportedExtension: 0, blocklistedFolder: 0 }
216
229
  };
217
230
  if (hasFileChanges) {
218
231
  import_logger.logger.info(`Pushing files to ${tenant}...`);
@@ -1,7 +1,7 @@
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 { getFarseerClientWithFallback, showLoginPrompt, ensureFreshToken } from '../services/farseerFactory';\nimport { SyncService } from '../services/syncService';\nimport { AppSyncService } from '../services/appSyncService';\nimport {\n getTenantFilesDir,\n resolveTenantWithOrgMapping,\n safeResolveWithinBase,\n validateOnlyFilePaths,\n} from '../utils/helpers';\nimport { formatClientError } from '../utils/errorFormatter';\nimport { ValidationFailure, partitionForUpload } from '../utils/fileValidation';\nimport { collectValues, normalizeExtensions } from '../utils/cliOptions';\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 } = resolveTenantWithOrgMapping(arg1, arg2);\n const clientResult = await getFarseerClientWithFallback(organisation, tenant);\n\n if (!clientResult) {\n showLoginPrompt(tenant);\n process.exit(1);\n }\n\n const filesDir = getTenantFilesDir(tenant);\n\n if (!fs.existsSync(filesDir)) {\n logger.error(`Local folder not found: farseer-apps/${tenant}/files/`);\n logger.dim('Run \"farseer pull <tenant>\" first to initialize the folder.');\n process.exit(1);\n }\n\n const syncService = new SyncService(tenant, clientResult.client);\n const includeExtensions = normalizeExtensions(options.includeExt);\n const includeFolders = options.includeFolder as string[];\n const onlyFiles = (options.only as string[]).map((p) => p.replace(/^\\/+/, ''));\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 const status = await syncService.getStatus({\n ...syncFilterOptions,\n deep,\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, clientResult.client);\n const appStatus = onlyMode\n ? { newLocal: [], newRemote: [], modified: [], synced: [] }\n : await appSyncService.getStatus();\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 logger.success('Nothing to push. Everything is in sync.');\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 // 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 // Ensure token is fresh before push operations (may have expired during user input)\n await ensureFreshToken(clientResult.client);\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 };\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,4BAAgF;AAChF,yBAA4B;AAC5B,4BAA+B;AAC/B,qBAKO;AACP,4BAAkC;AAClC,4BAAsD;AACtD,wBAAmD;AAEnD,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;AAA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,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;",
4
+ "sourcesContent": ["import { Command } from 'commander';\nimport chalk from 'chalk';\nimport inquirer from 'inquirer';\nimport { logger } from '../utils/logger';\nimport { fileLogger } from '../utils/fileLogger';\nimport { getFarseerClientWithFallback, showLoginPrompt, ensureFreshToken } from '../services/farseerFactory';\nimport { SyncService } from '../services/syncService';\nimport { AppSyncService } from '../services/appSyncService';\nimport {\n getTenantFilesDir,\n resolveTenantWithOrgMapping,\n safeResolveWithinBase,\n validateOnlyFilePaths,\n displayLocalPath,\n} from '../utils/helpers';\nimport { formatClientError } from '../utils/errorFormatter';\nimport { ValidationFailure, partitionForUpload } from '../utils/fileValidation';\nimport { collectValues, normalizeExtensions } 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 } = resolveTenantWithOrgMapping(arg1, arg2);\n const clientResult = await getFarseerClientWithFallback(organisation, tenant);\n\n if (!clientResult) {\n showLoginPrompt(tenant);\n process.exit(1);\n }\n\n const 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, clientResult.client);\n const includeExtensions = normalizeExtensions(options.includeExt);\n const includeFolders = options.includeFolder as string[];\n const onlyFiles = (options.only as string[]).map((p) => p.replace(/^\\/+/, ''));\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 const status = await syncService.getStatus({\n ...syncFilterOptions,\n deep,\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, clientResult.client);\n const appStatus = onlyMode\n ? { newLocal: [], newRemote: [], modified: [], synced: [] }\n : await appSyncService.getStatus();\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 // Ensure token is fresh before push operations (may have expired during user input)\n await ensureFreshToken(clientResult.client);\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": ";;;;;;;;;;;;;;;;;;;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;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
6
  "names": ["chalk", "inquirer"]
7
7
  }
@@ -38,6 +38,7 @@ var import_syncService = require("../services/syncService");
38
38
  var import_appSyncService = require("../services/appSyncService");
39
39
  var import_helpers = require("../utils/helpers");
40
40
  var import_cliOptions = require("../utils/cliOptions");
41
+ var import_syncReporting = require("../utils/syncReporting");
41
42
  var fs = __toESM(require("fs"));
42
43
  function registerStatusCommand(program) {
43
44
  program.command("status [org] [tenant]").description(
@@ -53,12 +54,13 @@ function registerStatusCommand(program) {
53
54
  process.exit(1);
54
55
  }
55
56
  const filesDir = (0, import_helpers.getTenantFilesDir)(tenant);
57
+ const localPathDisplay = (0, import_helpers.displayLocalPath)(filesDir);
56
58
  if (!fs.existsSync(filesDir)) {
57
- import_logger.logger.warning(`Local folder not found: apps/${tenant}/files/`);
59
+ import_logger.logger.warning(`Local folder not found: ${localPathDisplay}`);
58
60
  import_logger.logger.dim('Run "farseer pull <tenant>" to download files from the instance.');
59
61
  return;
60
62
  }
61
- import_logger.logger.info(`Comparing local (apps/${tenant}/files/) with remote (Files/)...`);
63
+ import_logger.logger.info(`Comparing local (${localPathDisplay}) with remote (Files/)...`);
62
64
  console.log();
63
65
  const syncService = new import_syncService.SyncService(tenant, clientResult.client);
64
66
  try {
@@ -76,8 +78,16 @@ function registerStatusCommand(program) {
76
78
  const hasAppChanges = appStatus.newLocal.length > 0 || appStatus.newRemote.length > 0 || appStatus.modified.length > 0;
77
79
  const hasChanges = status.modifiedLocally.length > 0 || status.modifiedRemotely.length > 0 || status.addedLocally.length > 0 || status.addedRemotely.length > 0 || status.deletedLocally.length > 0 || status.deletedRemotely.length > 0 || status.conflicts.length > 0 || hasAppChanges;
78
80
  if (!hasChanges) {
81
+ (0, import_syncReporting.reportIgnoredLocal)(status.ignoredLocal, status.ignoredLocalTotal);
79
82
  if (status.deepCompare) {
80
- import_logger.logger.success("Everything is in sync!");
83
+ if (status.ignoredLocalTotal > 0) {
84
+ import_logger.logger.success("Everything is in sync within current scope.");
85
+ import_logger.logger.dim(
86
+ `(${status.ignoredLocalTotal} file(s) outside scope were not compared \u2014 see warning above for details.)`
87
+ );
88
+ } else {
89
+ import_logger.logger.success("Everything is in sync!");
90
+ }
81
91
  } else {
82
92
  import_logger.logger.info("Local matches the last-pull baseline.");
83
93
  import_logger.logger.dim(
@@ -150,6 +160,7 @@ function registerStatusCommand(program) {
150
160
  import_logger.logger.dim(`${appStatus.synced.length} app(s) in sync.`);
151
161
  }
152
162
  console.log();
163
+ (0, import_syncReporting.reportIgnoredLocal)(status.ignoredLocal, status.ignoredLocalTotal);
153
164
  if (!status.deepCompare) {
154
165
  import_logger.logger.dim("--shallow: remote-content edits to existing files were NOT checked.");
155
166
  }
@@ -1,7 +1,7 @@
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 { getFarseerClientWithFallback, showLoginPrompt } from '../services/farseerFactory';\nimport { SyncService } from '../services/syncService';\nimport { AppSyncService } from '../services/appSyncService';\nimport { getTenantFilesDir, resolveTenantWithOrgMapping } from '../utils/helpers';\nimport { collectValues, normalizeExtensions } from '../utils/cliOptions';\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('--all', 'Show status for all files (default: only scripts .ts, .js)')\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 { organisation, tenant } = resolveTenantWithOrgMapping(arg1, arg2);\n const clientResult = await getFarseerClientWithFallback(organisation, tenant);\n\n if (!clientResult) {\n showLoginPrompt(tenant);\n process.exit(1);\n }\n\n const filesDir = getTenantFilesDir(tenant);\n\n if (!fs.existsSync(filesDir)) {\n logger.warning(`Local folder not found: apps/${tenant}/files/`);\n logger.dim('Run \"farseer pull <tenant>\" to download files from the instance.');\n return;\n }\n\n logger.info(`Comparing local (apps/${tenant}/files/) with remote (Files/)...`);\n console.log();\n\n const syncService = new SyncService(tenant, clientResult.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, clientResult.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 if (status.deepCompare) {\n logger.success('Everything is in sync!');\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 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
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAkB;AAClB,oBAAuB;AACvB,4BAA8D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SAAS,GAAG;AAChC,kBAAQ,IAAI,aAAAA,QAAM,KAAK,qCAAqC,CAAC;AAC7D,qBAAW,OAAO,UAAU,WAAW;AACnC,oBAAQ,IAAI,aAAAA,QAAM,KAAK,OAAO,GAAG,EAAE,CAAC;AAAA,UACxC;AACA,kBAAQ,IAAI;AAAA,QAChB;AAEA,YAAI,UAAU,SAAS,SAAS,GAAG;AAC/B,kBAAQ,IAAI,aAAAA,QAAM,OAAO,gBAAgB,CAAC;AAC1C,qBAAW,OAAO,UAAU,UAAU;AAClC,oBAAQ,IAAI,aAAAA,QAAM,OAAO,OAAO,GAAG,EAAE,CAAC;AAAA,UAC1C;AACA,kBAAQ,IAAI;AAAA,QAChB;AAEA,YAAI,UAAU,OAAO,SAAS,GAAG;AAC7B,+BAAO,IAAI,GAAG,UAAU,OAAO,MAAM,kBAAkB;AAAA,QAC3D;AAAA,MACJ,WAAW,UAAU,OAAO,SAAS,GAAG;AACpC,6BAAO,IAAI,GAAG,UAAU,OAAO,MAAM,kBAAkB;AAAA,MAC3D;AAEA,cAAQ,IAAI;AACZ,UAAI,CAAC,OAAO,aAAa;AAIrB,6BAAO,IAAI,qEAAqE;AAAA,MACpF;AACA,2BAAO,IAAI,sDAAsD;AACjE,2BAAO,IAAI,yDAAyD;AAAA,IACxE,SAAS,OAAO;AACZ,2BAAO,MAAM,yBAAyB;AACtC,UAAI,iBAAiB,OAAO;AACxB,6BAAO,IAAI,MAAM,OAAO;AAAA,MAC5B;AACA,cAAQ,KAAK,CAAC;AAAA,IAClB;AAAA,EACJ,CAAC;AACT;",
4
+ "sourcesContent": ["import { Command } from 'commander';\nimport chalk from 'chalk';\nimport { logger } from '../utils/logger';\nimport { getFarseerClientWithFallback, showLoginPrompt } from '../services/farseerFactory';\nimport { SyncService } from '../services/syncService';\nimport { AppSyncService } from '../services/appSyncService';\nimport { getTenantFilesDir, resolveTenantWithOrgMapping, 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('--all', 'Show status for all files (default: only scripts .ts, .js)')\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 { organisation, tenant } = resolveTenantWithOrgMapping(arg1, arg2);\n const clientResult = await getFarseerClientWithFallback(organisation, tenant);\n\n if (!clientResult) {\n showLoginPrompt(tenant);\n process.exit(1);\n }\n\n const 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, clientResult.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, clientResult.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
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAkB;AAClB,oBAAuB;AACvB,4BAA8D;AAC9D,yBAA4B;AAC5B,4BAA+B;AAC/B,qBAAiF;AACjF,wBAAmD;AACnD,2BAAmC;AACnC,SAAoB;AAEb,SAAS,sBAAsB,SAAwB;AAC1D,UACK,QAAQ,uBAAuB,EAC/B;AAAA,IACG;AAAA,EACJ,EACC,OAAO,SAAS,4DAA4D,EAC5E;AAAA,IACG;AAAA,IACA;AAAA,EACJ,EAKC,OAAO,UAAU,+EAA+E,EAChG,OAAO,uBAAuB,6CAA6C,iCAAe,CAAC,CAAC,EAC5F,OAAO,6BAA6B,4CAA4C,iCAAe,CAAC,CAAC,EACjG,OAAO,OAAO,MAAM,MAAM,YAAY;AACnC,UAAM,EAAE,cAAc,OAAO,QAAI,4CAA4B,MAAM,IAAI;AACvE,UAAM,eAAe,UAAM,oDAA6B,cAAc,MAAM;AAE5E,QAAI,CAAC,cAAc;AACf,iDAAgB,MAAM;AACtB,cAAQ,KAAK,CAAC;AAAA,IAClB;AAEA,UAAM,eAAW,kCAAkB,MAAM;AACzC,UAAM,uBAAmB,iCAAiB,QAAQ;AAElD,QAAI,CAAC,GAAG,WAAW,QAAQ,GAAG;AAC1B,2BAAO,QAAQ,2BAA2B,g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AAO,IAAI,GAAG,UAAU,OAAO,MAAM,kBAAkB;AAAA,QAC3D;AAAA,MACJ,WAAW,UAAU,OAAO,SAAS,GAAG;AACpC,6BAAO,IAAI,GAAG,UAAU,OAAO,MAAM,kBAAkB;AAAA,MAC3D;AAEA,cAAQ,IAAI;AACZ,mDAAmB,OAAO,cAAc,OAAO,iBAAiB;AAChE,UAAI,CAAC,OAAO,aAAa;AAIrB,6BAAO,IAAI,qEAAqE;AAAA,MACpF;AACA,2BAAO,IAAI,sDAAsD;AACjE,2BAAO,IAAI,yDAAyD;AAAA,IACxE,SAAS,OAAO;AACZ,2BAAO,MAAM,yBAAyB;AACtC,UAAI,iBAAiB,OAAO;AACxB,6BAAO,IAAI,MAAM,OAAO;AAAA,MAC5B;AACA,cAAQ,KAAK,CAAC;AAAA,IAClB;AAAA,EACJ,CAAC;AACT;",
6
6
  "names": ["chalk"]
7
7
  }
@@ -28,6 +28,12 @@ var import_appSyncService = require("../../services/appSyncService");
28
28
  var import_farseerFactory = require("../../services/farseerFactory");
29
29
  var import_helpers = require("../utils/helpers");
30
30
  var import_errorFormatter = require("../../utils/errorFormatter");
31
+ function summariseIgnoredReasons(totals) {
32
+ const parts = [];
33
+ if (totals.unsupportedExtension > 0) parts.push(`${totals.unsupportedExtension} with unsupported extension`);
34
+ if (totals.blocklistedFolder > 0) parts.push(`${totals.blocklistedFolder} in blocklisted folders`);
35
+ return parts.join(", ");
36
+ }
31
37
  const includeExtensionsSchema = import_zod.z.array(import_zod.z.string()).optional().describe(
32
38
  `Extra file extensions to include alongside the default .ts / .js scripts. Supply with or without leading dot (".csv" or "csv"). Mirrors the CLI's --include-ext flag.`
33
39
  );
@@ -219,7 +225,23 @@ Drift / mirror semantics:
219
225
 
220
226
  Out-of-scope files (e.g. a hidden .vscode/settings.json next to scripts) are
221
227
  INVISIBLE to push \u2014 never uploaded, never deleted. Hidden paths require explicit
222
- opt-in via --include-folder.
228
+ opt-in via --include-folder (extension includes never widen scope to hidden
229
+ files \u2014 that would let a generic .json broadening leak credentials).
230
+
231
+ Silent-skip signal: \`files.ignoredLocal\` is an array of
232
+ \`{ path, reason }\` entries listing non-hidden user files that exist on
233
+ disk but were outside the active sync scope and therefore NOT pushed.
234
+ \`reason\` is one of:
235
+ - \`unsupportedExtension\`: file extension isn't in default scope (e.g.
236
+ .csv, .md). Tell the user to broaden with \`--include-ext <ext>\`.
237
+ - \`blocklistedFolder\`: file is in a tooling-output folder (node_modules/,
238
+ dist/, build/). These are almost never user content \u2014 warn the user
239
+ that opting in is unusual instead of suggesting the flag outright.
240
+ \`files.ignoredLocalTotal\` carries the uncapped count when the list was
241
+ truncated. Hidden files (.env, .git/, .vscode/) never appear here \u2014 the
242
+ response does not advertise widening scope to include them. Use this list to
243
+ detect "push succeeded but my local .csv / .md / .py files weren't sent"
244
+ before reporting success to the user.
223
245
 
224
246
  Sync includes: if user configured via "farseer config include", drift and scope
225
247
  checks respect those settings automatically.
@@ -309,6 +331,14 @@ ${failureSummary}`,
309
331
  const appSyncService = new import_appSyncService.AppSyncService(tenant, clientResult.client);
310
332
  appResult = await appSyncService.push();
311
333
  }
334
+ const ignoredLocalEntries = fileResult.ignoredLocal ?? [];
335
+ const ignoredLocalCount = fileResult.ignoredLocalTotal ?? 0;
336
+ const ignoredLocalTotalByReason = fileResult.ignoredLocalTotalByReason ?? {
337
+ unsupportedExtension: 0,
338
+ blocklistedFolder: 0
339
+ };
340
+ const ignoredBreakdown = summariseIgnoredReasons(ignoredLocalTotalByReason);
341
+ const ignoredSuffix = ignoredLocalCount > 0 ? ignoredBreakdown ? ` (${ignoredLocalCount} local file(s) outside scope: ${ignoredBreakdown} \u2014 see files.ignoredLocal)` : ` (${ignoredLocalCount} local file(s) outside scope \u2014 see files.ignoredLocal)` : "";
312
342
  return (0, import_helpers.successResponse)({
313
343
  tenant,
314
344
  organisation,
@@ -318,14 +348,25 @@ ${failureSummary}`,
318
348
  deleted: fileResult.deleted,
319
349
  unchanged: fileResult.unchanged.length,
320
350
  rejected: fileResult.rejected ?? [],
321
- failed: fileResult.failed ?? []
351
+ failed: fileResult.failed ?? [],
352
+ // Surface scope-skipped files so an agent calling
353
+ // push gets the same silent-skip signal CLI users
354
+ // see in the warning line. Without this, agents
355
+ // reported "push complete" while local .csv / .md /
356
+ // .py work-in-progress sat unsent on disk.
357
+ // Entries are { path, reason } so the agent can
358
+ // present category-specific advice — extension
359
+ // broadening vs blocklisted-folder warning.
360
+ ignoredLocal: ignoredLocalEntries,
361
+ ignoredLocalTotal: ignoredLocalCount,
362
+ ignoredLocalTotalByReason
322
363
  },
323
364
  apps: appResult ? {
324
365
  created: appResult.created,
325
366
  updated: appResult.updated,
326
367
  unchanged: appResult.unchanged.length
327
368
  } : { note: "App sync requires browser login (JWT)" },
328
- summary: `Pushed ${fileResult.uploaded.length + fileResult.updated.length} files${appResult ? ` and ${appResult.created.length + appResult.updated.length} apps` : ""}${fileResult.rejected && fileResult.rejected.length > 0 ? ` (${fileResult.rejected.length} skipped \u2014 see files.rejected)` : ""}${fileResult.failed && fileResult.failed.length > 0 ? ` (${fileResult.failed.length} failed mid-push \u2014 see files.failed)` : ""}`
369
+ summary: `Pushed ${fileResult.uploaded.length + fileResult.updated.length} files${appResult ? ` and ${appResult.created.length + appResult.updated.length} apps` : ""}${fileResult.rejected && fileResult.rejected.length > 0 ? ` (${fileResult.rejected.length} skipped \u2014 see files.rejected)` : ""}${fileResult.failed && fileResult.failed.length > 0 ? ` (${fileResult.failed.length} failed mid-push \u2014 see files.failed)` : ""}${ignoredSuffix}`
329
370
  });
330
371
  } catch (error) {
331
372
  return (0, import_helpers.errorResponse)(`Push failed: ${await (0, import_errorFormatter.formatClientError)(error)}`, "NETWORK_ERROR");
@@ -345,6 +386,20 @@ Shows which files are:
345
386
 
346
387
  Also shows app sync status if using JWT authentication.
347
388
 
389
+ Out-of-scope local files: \`files.ignoredLocal\` is an array of
390
+ \`{ path, reason }\` entries listing user-authored files that exist on disk
391
+ but were silently skipped because they don't match the current sync scope
392
+ (default scope is .ts / .js). \`reason\` is one of \`unsupportedExtension\`
393
+ (extension not in default scope \u2014 broaden via \`--include-ext\`) or
394
+ \`blocklistedFolder\` (file lives under a tooling-output folder like
395
+ node_modules/ or dist/ \u2014 opting in is unusual). Use this to detect the
396
+ "local edits exist but status reports clean" failure mode before reporting
397
+ "everything is in sync" to the user. Hidden files (.env, .git/, .vscode/)
398
+ are NEVER listed there \u2014 those require explicit opt-in via the CLI's
399
+ \`farseer config include\` and the response does not advertise widening
400
+ scope to include them. \`ignoredLocalTotal\` carries the uncapped count
401
+ when the slice was truncated.
402
+
348
403
  Sync includes: If the user has configured extra file types via "farseer config include"
349
404
  (e.g., .json extensions or specific folders like "Config"), those files are automatically
350
405
  included in the status check alongside default script files.
@@ -397,7 +452,10 @@ If no tenant is specified, uses the currently checked-out tenant.`,
397
452
  file: c.filePath,
398
453
  type: c.type,
399
454
  description: c.description
400
- }))
455
+ })),
456
+ ignoredLocal: fileStatus.ignoredLocal,
457
+ ignoredLocalTotal: fileStatus.ignoredLocalTotal,
458
+ ignoredLocalTotalByReason: fileStatus.ignoredLocalTotalByReason
401
459
  },
402
460
  apps: appStatus ? {
403
461
  newLocal: appStatus.newLocal,
@@ -405,7 +463,18 @@ If no tenant is specified, uses the currently checked-out tenant.`,
405
463
  modified: appStatus.modified,
406
464
  synced: appStatus.synced.length
407
465
  } : { note: "App sync requires browser login (JWT)" },
408
- summary: fileStatus.conflicts?.length ? `${fileStatus.conflicts.length} conflict(s) detected` : hasChanges ? "Changes detected" : "Everything is in sync"
466
+ summary: (() => {
467
+ if (fileStatus.conflicts?.length) {
468
+ return `${fileStatus.conflicts.length} conflict(s) detected`;
469
+ }
470
+ if (hasChanges) return "Changes detected";
471
+ if (fileStatus.ignoredLocalTotal > 0) {
472
+ const breakdown = summariseIgnoredReasons(fileStatus.ignoredLocalTotalByReason);
473
+ const suffix = breakdown ? `${fileStatus.ignoredLocalTotal} local file(s) outside scope: ${breakdown}` : `${fileStatus.ignoredLocalTotal} local file(s) outside scope`;
474
+ return `Everything in sync within current scope (${suffix} \u2014 see files.ignoredLocal)`;
475
+ }
476
+ return "Everything is in sync";
477
+ })()
409
478
  });
410
479
  } catch (error) {
411
480
  return (0, import_helpers.errorResponse)(`Status check failed: ${await (0, import_errorFormatter.formatClientError)(error)}`, "NETWORK_ERROR");