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.
- package/dist/commands/push.js +16 -3
- package/dist/commands/push.js.map +2 -2
- package/dist/commands/status.js +14 -3
- package/dist/commands/status.js.map +2 -2
- package/dist/mcp/tools/syncTools.js +74 -5
- package/dist/mcp/tools/syncTools.js.map +2 -2
- package/dist/services/syncService.js +91 -7
- package/dist/services/syncService.js.map +2 -2
- package/dist/utils/helpers.js +22 -1
- package/dist/utils/helpers.js.map +2 -2
- package/dist/utils/syncReporting.js +66 -0
- package/dist/utils/syncReporting.js.map +7 -0
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/mcp/tools/syncTools.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * File Synchronization Tools\n *\n * Tools for syncing files between local repository and Farseer instance.\n */\n\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { z } from 'zod';\nimport { createPatch } from 'diff';\nimport { SyncService } from '../../services/syncService';\nimport { AppSyncService } from '../../services/appSyncService';\nimport { getFarseerClientWithFallback } from '../../services/farseerFactory';\nimport {\n resolveOrgAndTenant,\n successResponse,\n errorResponse,\n authRequiredResponse,\n tenantRequiredResponse,\n} from '../utils/helpers';\nimport { formatClientError } from '../../utils/errorFormatter';\n\n// Define schemas outside of tool registration to avoid deep type instantiation\n//\n// `includeExtensions` and `includeFolders` mirror the CLI's `--include-ext` /\n// `--include-folder` flags. Without them on the MCP surface, an agent could\n// only choose between scripts-only and \"all\" \u2014 there was no way to scope a\n// pull/push/status to \"scripts plus this one folder\" the way a CLI user can.\nconst includeExtensionsSchema = z\n .array(z.string())\n .optional()\n .describe(\n 'Extra file extensions to include alongside the default .ts / .js scripts. ' +\n 'Supply with or without leading dot (\".csv\" or \"csv\"). Mirrors the CLI\\'s --include-ext flag.',\n );\nconst includeFoldersSchema = z\n .array(z.string())\n .optional()\n .describe(\n 'Extra folder paths whose files (any extension) are included alongside the default scripts. ' +\n 'Each path is interpreted relative to the tenant root, e.g. \"Data\" or \"Config/local\". ' +\n \"Mirrors the CLI's --include-folder flag.\",\n );\n\nconst pullSchema = {\n organisation: z\n .string()\n .optional()\n .describe(\n 'Farseer organisation (subdomain, e.g. \"salvus-2\"). If omitted, uses checked-out org or saved mapping.',\n ),\n tenant: z.string().optional().describe('Tenant ID (e.g. \"salvus-prodaja\"). Uses checked-out tenant if omitted.'),\n all: z.boolean().optional().describe('Download all files, not just scripts (.ts, .js)'),\n force: z\n .boolean()\n .optional()\n .describe(\n 'DESTRUCTIVE \u2014 overwrites EVERY locally-modified file with the remote version, including ' +\n \"local edits that have no remote conflict (e.g. a file you've been editing but the remote \" +\n 'is still on the baseline version). Use only when the user has explicitly asked to ' +\n 'discard local changes. Does NOT delete local-only files (that destructive wipe stays ' +\n 'on the CLI side behind the interactive confirm prompt).',\n ),\n includeExtensions: includeExtensionsSchema,\n includeFolders: includeFoldersSchema,\n};\n\nconst pushSchema = {\n organisation: z\n .string()\n .optional()\n .describe('Farseer organisation (subdomain). If omitted, uses checked-out org or saved mapping.'),\n tenant: z.string().optional().describe('Tenant ID. Uses checked-out tenant if omitted.'),\n force: z\n .boolean()\n .optional()\n .describe(\n 'Skip the drift check and overwrite remote even if it diverged from baseline. ' +\n 'Does NOT delete remote-only files; pass mirror=true for that.',\n ),\n mirror: z\n .boolean()\n .optional()\n .describe(\n 'Also delete remote files that have no local counterpart \u2014 destructive \"make remote = local\" semantics. ' +\n \"Implies the upload step still respects the user's local presence, so this only fires for files \" +\n 'genuinely missing locally. Combine with force=true if the drift check would otherwise refuse the push.',\n ),\n all: z\n .boolean()\n .optional()\n .describe(\n 'Push all files, not just scripts (.ts, .js). Excludes hidden files unless includeFolders names them.',\n ),\n includeExtensions: includeExtensionsSchema,\n includeFolders: includeFoldersSchema,\n};\n\nconst statusSchema = {\n organisation: z\n .string()\n .optional()\n .describe('Farseer organisation (subdomain). If omitted, uses checked-out org or saved mapping.'),\n tenant: z.string().optional().describe('Tenant ID. Uses checked-out tenant if omitted.'),\n all: z.boolean().optional().describe('Show all files, not just scripts'),\n // Deep is the default \u2014 matches the CLI's `farseer status` behaviour\n // (deep-by-default since 1.6.2). Agents should pass `shallow: true`\n // only when they have independent reason to trust the last-pull\n // baseline (e.g. checking immediately after a successful pull) and\n // want the faster path on a large tenant.\n shallow: z\n .boolean()\n .optional()\n .describe(\n 'Skip remote-content hashing. Faster on big tenants but cannot detect remote-side edits to existing ' +\n 'files made since the last pull. Default is deep \u2014 every remote file is hashed.',\n ),\n // Backwards-compat alias for callers written against the 1.6.1 MCP\n // schema, where deep=false was the fast-path opt-out. We map it to\n // shallow internally; if both are passed, shallow wins (explicit\n // opt-out beats the legacy positive). New callers should use shallow.\n deep: z\n .boolean()\n .optional()\n .describe(\n '(Deprecated) Backwards-compat alias for the pre-1.6.2 fast-path control. ' +\n 'Pass shallow=true instead. If both are supplied, shallow takes precedence.',\n ),\n includeExtensions: includeExtensionsSchema,\n includeFolders: includeFoldersSchema,\n};\n\nconst diffSchema = {\n organisation: z.string().optional().describe('Farseer organisation (subdomain).'),\n tenant: z.string().optional().describe('Tenant ID'),\n file: z.string().optional().describe('Specific file path to diff. If omitted, shows all differences.'),\n showRemote: z.boolean().optional().describe('Show only the remote content instead of diff'),\n};\n\nconst listFilesSchema = {\n organisation: z.string().optional().describe('Farseer organisation (subdomain).'),\n tenant: z.string().optional().describe('Tenant ID'),\n all: z.boolean().optional().describe('Show all files, not just scripts'),\n};\n\nexport function registerSyncTools(server: McpServer): void {\n // farseer_pull - Download files from remote\n server.tool(\n 'farseer_pull',\n `Pull (download) files and app configurations from a Farseer instance to the local repository.\n\nWhat gets pulled:\n- TypeScript/JavaScript scripts from Files/ folder (searched recursively)\n- App configurations (saved as JSON in apps/ folder)\n\nFiles are saved to: farseer-apps/<tenant>/files/\nApps are saved to: farseer-apps/<tenant>/apps/\n\nBy default only script files (.ts, .js) are pulled.\nUse all=true to pull all files including images, data files, etc.\nUse includeExtensions / includeFolders to broaden the scope without pulling everything\n(e.g. includeExtensions=[\"csv\"] adds CSV files; includeFolders=[\"Data\"] adds the Data\nfolder regardless of extension). These mirror the CLI's --include-ext / --include-folder\nflags and are additive on top of the default scripts.\n\nConflict handling:\n- Per-file conflict resolution (keep_local / keep_remote / keep_both / merge_markers)\n is CLI-only \u2014 it requires an interactive prompt and the MCP can't answer one.\n- The MCP path returns conflicts in response.conflicts[] so the agent can re-pull\n with force=true once the user has confirmed they want to discard their edits.\n- force=true is DESTRUCTIVE: it overwrites every locally-modified file with the\n remote version (even local edits that don't conflict with remote). It does NOT\n wipe local-only files (that destructive step lives behind the CLI's confirm prompt).\n Only pass force=true when the user has explicitly accepted losing local changes.\n\nSync includes (middle ground between scripts-only and all):\n- Users can configure extra extensions and folders via \"farseer config include\" CLI command\n- These are stored per-tenant in ~/.farseer/config.json under \"syncIncludes\"\n- When configured, pull/push/status automatically include those files alongside default scripts\n- Example: syncIncludes may add .json files or entire folders like \"Config\" or \"App Logs\"\n- The sync includes are respected automatically \u2014 no extra parameters needed here\n\nOrganisation and tenant:\n- Organisation = subdomain (e.g. \"salvus-2\" for salvus-2.farseer.io)\n- Tenant = workspace ID (e.g. \"salvus-prodaja\")\n- Often they are the same. Only specify organisation when it differs from tenant.\n- If checked out, both are resolved automatically.`,\n pullSchema,\n async (params: {\n organisation?: string;\n tenant?: string;\n all?: boolean;\n force?: boolean;\n includeExtensions?: string[];\n includeFolders?: string[];\n }) => {\n const resolved = resolveOrgAndTenant(params);\n if (!resolved) {\n return tenantRequiredResponse();\n }\n const { organisation, tenant } = resolved;\n\n const clientResult = await getFarseerClientWithFallback(organisation, tenant);\n if (!clientResult) {\n return authRequiredResponse(tenant);\n }\n\n try {\n // Pull files (use tenant for folder path)\n const syncService = new SyncService(tenant, clientResult.client);\n const fileResult = await syncService.pull({\n all: params.all,\n force: params.force,\n includeExtensions: params.includeExtensions,\n includeFolders: params.includeFolders,\n });\n\n // Pull apps (only with JWT auth)\n let appResult = null;\n if (clientResult.authType === 'jwt') {\n const appSyncService = new AppSyncService(tenant, clientResult.client);\n appResult = await appSyncService.pull();\n }\n\n const response: Record<string, any> = {\n tenant,\n organisation,\n files: {\n downloaded: fileResult.downloaded,\n deleted: fileResult.deleted,\n unchanged: fileResult.unchanged.length,\n },\n apps: appResult\n ? {\n created: appResult.created,\n updated: appResult.updated,\n deleted: appResult.deleted,\n unchanged: appResult.unchanged.length,\n }\n : { note: 'App sync requires browser login (JWT)' },\n message: `Pulled ${fileResult.downloaded.length} files${appResult ? ` and ${appResult.created.length + appResult.updated.length} apps` : ''}`,\n };\n\n if (fileResult.conflicts.length > 0) {\n response.conflicts = fileResult.conflicts.map((c) => ({\n file: c.filePath,\n type: c.type,\n description: c.description,\n }));\n response.message = `Pulled ${fileResult.downloaded.length} files but ${fileResult.conflicts.length} conflict(s) need resolution`;\n response.hint =\n 'Use force=true to overwrite local changes, or resolve conflicts via CLI: farseer pull <tenant>';\n }\n\n if (fileResult.conflictFilesWritten.length > 0) {\n response.conflictFilesWritten = fileResult.conflictFilesWritten;\n }\n\n return successResponse(response);\n } catch (error) {\n return errorResponse(`Pull failed: ${await formatClientError(error)}`, 'NETWORK_ERROR');\n }\n },\n );\n\n // farseer_push - Upload files to remote\n server.tool(\n 'farseer_push',\n `Push (upload) local file and app changes to a Farseer instance.\n\nWhat gets pushed:\n- New/modified scripts from farseer-apps/<tenant>/files/ (filtered by sync scope \u2014\n default is .ts/.js; broaden via includeExtensions / includeFolders / all on this\n tool, or via persistent sync includes set with the CLI's \"farseer config include\").\n- New/modified app configurations from farseer-apps/<tenant>/apps/.\n- Deleted files (when they were previously synced \u2014 preserves \"I rm'd this\" semantics).\n\nPre-flight (runs before any HTTP call):\n- Refuses files the backend would refuse anyway: extension not on whitelist,\n filename longer than 256 chars, empty body, unresolved git-style merge markers\n (<<<<<<< LOCAL / ======= / >>>>>>> REMOTE) left over from a merge_markers pull.\n- Returns rejected files in the response. If every candidate is rejected (and\n no deletes/updates either), the tool call returns VALIDATION_ERROR.\n\nDrift / mirror semantics:\n- force=true skips the drift check (push over remote-side adds/deletes).\n- mirror=true (separate param) also deletes remote files that have no local\n counterpart, within the current sync scope. Combine with force when both are\n needed.\n\nOut-of-scope files (e.g. a hidden .vscode/settings.json next to scripts) are\nINVISIBLE to push \u2014 never uploaded, never deleted. Hidden paths require explicit\nopt-in via --include-folder.\n\nSync includes: if user configured via \"farseer config include\", drift and scope\nchecks respect those settings automatically.\n\nIf no tenant is specified, uses the currently checked-out tenant.`,\n pushSchema,\n async (params: {\n organisation?: string;\n tenant?: string;\n force?: boolean;\n mirror?: boolean;\n all?: boolean;\n includeExtensions?: string[];\n includeFolders?: string[];\n }) => {\n const resolved = resolveOrgAndTenant(params);\n if (!resolved) {\n return tenantRequiredResponse();\n }\n const { organisation, tenant } = resolved;\n\n const clientResult = await getFarseerClientWithFallback(organisation, tenant);\n if (!clientResult) {\n return authRequiredResponse(tenant);\n }\n\n try {\n const syncService = new SyncService(tenant, clientResult.client);\n\n // Non-force push must not silently overwrite remote-side\n // drift. The previous `checkRemoteChanges` gate was a\n // list-only diff against the recorded baseline \u2014 it could\n // see remote-side adds/deletes but not content edits to\n // existing files. That's the same Matej-class blind spot\n // the CLI gate closed in 1.6.2: run a DEEP status so\n // remote content drift surfaces, then block if any\n // remote-side bucket has paths in scope.\n if (!params.force) {\n const status = await syncService.getStatus({\n deep: true,\n all: params.all,\n includeExtensions: params.includeExtensions,\n includeFolders: params.includeFolders,\n });\n const conflicting = [\n ...status.modifiedRemotely,\n ...status.addedRemotely,\n ...status.deletedRemotely,\n ];\n if (conflicting.length > 0) {\n // Mirror the CLI's behaviour at push.ts:211-216 \u2014\n // echo the active scope flags back into the\n // suggested pull command so a default-scope pull\n // doesn't run, report \"Already up to date\", and\n // leave the agent stuck in the same drift loop.\n const scopeFlags: string[] = [];\n if (params.all) scopeFlags.push('--all');\n for (const ext of params.includeExtensions ?? []) scopeFlags.push(`--include-ext ${ext}`);\n for (const folder of params.includeFolders ?? [])\n scopeFlags.push(`--include-folder \"${folder}\"`);\n const pullCmd = ['farseer pull', tenant, ...scopeFlags].join(' ');\n return errorResponse(\n `Remote has changes for ${conflicting.length} file(s) since last pull:\\n` +\n conflicting.map((p) => ` - ${p}`).join('\\n') +\n `\\n\\nRun \\`${pullCmd}\\` first, or use force=true to overwrite remote.`,\n 'VALIDATION_ERROR',\n );\n }\n }\n\n // Push files. Pass `mirror` separately from `force` so an\n // agent must opt in explicitly to remote-side deletes \u2014 the\n // CLI gates this behind a confirm prompt, the MCP can't, so\n // we make it a separate parameter the caller has to set.\n const fileResult = await syncService.push({\n force: params.force,\n mirror: params.mirror,\n all: params.all,\n includeExtensions: params.includeExtensions,\n includeFolders: params.includeFolders,\n });\n\n // Check for conflicts\n if (fileResult.conflicts.length > 0) {\n return errorResponse(\n `Push blocked by ${fileResult.conflicts.length} conflict(s):\\n${fileResult.conflicts.map((c) => ` - ${c.filePath}: ${c.description}`).join('\\n')}\\n\\nPull first or use force=true.`,\n 'VALIDATION_ERROR',\n );\n }\n\n // Pre-flight rejected files. A push that produced zero side\n // effects (no upload, no update, no delete) because every\n // candidate was rejected is a failure from the agent's\n // perspective \u2014 surface it as VALIDATION_ERROR so the tool\n // call doesn't quietly look like a success.\n //\n // Note `appliedAny` includes deletes: a mirror push that\n // removed remote-only files BUT had every upload candidate\n // rejected has still mutated remote state, so the response\n // must show the deletes (treated as a partial success), not\n // an error that hides them.\n if (fileResult.rejected && fileResult.rejected.length > 0) {\n const summary = fileResult.rejected.map((r) => ` - ${r.filePath}: ${r.detail}`).join('\\n');\n const appliedAny =\n fileResult.uploaded.length + fileResult.updated.length + fileResult.deleted.length > 0;\n if (!appliedAny) {\n return errorResponse(\n `Push rejected \u2014 backend would refuse every candidate file:\\n${summary}`,\n 'VALIDATION_ERROR',\n );\n }\n // Partial success: at least some side effects applied.\n // Fall through to successResponse below so the caller\n // sees the full files.{uploaded,updated,deleted,rejected}\n // breakdown and can decide how strict to be.\n }\n\n // Per-file mid-push failures (5xx, transient errors). These\n // reach the agent as a separate signal from `rejected`\n // (pre-flight). We always surface them \u2014 if the entire push\n // failed mid-flight with no side effects, return error so\n // the agent retries; otherwise let the partial success\n // through so the agent can see what stuck.\n if (fileResult.failed && fileResult.failed.length > 0) {\n const failureSummary = fileResult.failed\n .map((f) => ` - ${f.filePath} (${f.operation}): ${f.reason}`)\n .join('\\n');\n const appliedAny =\n fileResult.uploaded.length + fileResult.updated.length + fileResult.deleted.length > 0;\n if (!appliedAny) {\n return errorResponse(\n `Push failed mid-flight \u2014 every attempted file errored:\\n${failureSummary}`,\n 'NETWORK_ERROR',\n );\n }\n }\n\n // Push apps (only with JWT auth)\n let appResult = null;\n if (clientResult.authType === 'jwt') {\n const appSyncService = new AppSyncService(tenant, clientResult.client);\n appResult = await appSyncService.push();\n }\n\n return successResponse({\n tenant,\n organisation,\n files: {\n uploaded: fileResult.uploaded,\n updated: fileResult.updated,\n deleted: fileResult.deleted,\n unchanged: fileResult.unchanged.length,\n rejected: fileResult.rejected ?? [],\n failed: fileResult.failed ?? [],\n },\n apps: appResult\n ? {\n created: appResult.created,\n updated: appResult.updated,\n unchanged: appResult.unchanged.length,\n }\n : { note: 'App sync requires browser login (JWT)' },\n 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)` : ''}`,\n });\n } catch (error) {\n return errorResponse(`Push failed: ${await formatClientError(error)}`, 'NETWORK_ERROR');\n }\n },\n );\n\n // farseer_status - Check sync status\n server.tool(\n 'farseer_status',\n `Check the synchronization status between local files and the remote Farseer instance.\n\nShows which files are:\n- Modified locally (changed since last sync)\n- Modified remotely (changed on server since last sync)\n- Only local (new files not yet pushed)\n- Only remote (files not yet pulled)\n- In sync (no changes)\n\nAlso shows app sync status if using JWT authentication.\n\nSync includes: If the user has configured extra file types via \"farseer config include\"\n(e.g., .json extensions or specific folders like \"Config\"), those files are automatically\nincluded in the status check alongside default script files.\n\nDeep vs shallow: Default is deep \u2014 every remote file is hashed so the response surfaces\nremote-side content edits made since the last pull. Pass shallow=true to skip the hash\ncheck (faster on big tenants; trusts the recorded baseline, so it cannot detect content\nedits to existing remote files). Matches the CLI's --shallow flag.\n\nIf no tenant is specified, uses the currently checked-out tenant.`,\n statusSchema,\n async (params: {\n organisation?: string;\n tenant?: string;\n all?: boolean;\n shallow?: boolean;\n deep?: boolean;\n includeExtensions?: string[];\n includeFolders?: string[];\n }) => {\n const resolved = resolveOrgAndTenant(params);\n if (!resolved) {\n return tenantRequiredResponse();\n }\n const { organisation, tenant } = resolved;\n\n const clientResult = await getFarseerClientWithFallback(organisation, tenant);\n if (!clientResult) {\n return authRequiredResponse(tenant);\n }\n\n try {\n const syncService = new SyncService(tenant, clientResult.client);\n // Deep is the default; `shallow: true` opts into the faster\n // list-only path. Matches the CLI's --shallow flag.\n //\n // `deep` is a deprecated backwards-compat alias for callers\n // written against the 1.6.1 schema. Resolution order:\n // 1. shallow=true \u2192 deep: false (explicit opt-out wins)\n // 2. deep=false \u2192 deep: false (legacy fast-path)\n // 3. deep=true or unset \u2192 deep: true (the new default)\n // This keeps the schema-validated surface backwards-\n // compatible with existing MCP callers that haven't been\n // rewritten yet, without confusing combinations.\n const effectiveDeep = params.shallow === true ? false : params.deep !== false;\n const fileStatus = await syncService.getStatus({\n all: params.all,\n deep: effectiveDeep,\n includeExtensions: params.includeExtensions,\n includeFolders: params.includeFolders,\n });\n\n // Get app status (only with JWT auth)\n let appStatus = null;\n if (clientResult.authType === 'jwt') {\n const appSyncService = new AppSyncService(tenant, clientResult.client);\n appStatus = await appSyncService.getStatus();\n }\n\n const hasChanges =\n fileStatus.modifiedLocally.length > 0 ||\n fileStatus.modifiedRemotely.length > 0 ||\n fileStatus.addedLocally.length > 0 ||\n fileStatus.addedRemotely.length > 0 ||\n fileStatus.deletedLocally.length > 0 ||\n fileStatus.deletedRemotely.length > 0 ||\n fileStatus.conflicts.length > 0;\n\n return successResponse({\n tenant,\n organisation,\n files: {\n addedLocally: fileStatus.addedLocally,\n modifiedLocally: fileStatus.modifiedLocally,\n deletedLocally: fileStatus.deletedLocally,\n addedRemotely: fileStatus.addedRemotely,\n modifiedRemotely: fileStatus.modifiedRemotely,\n deletedRemotely: fileStatus.deletedRemotely,\n inSync: fileStatus.inSync.length,\n deepCompare: fileStatus.deepCompare,\n conflicts: fileStatus.conflicts.map((c) => ({\n file: c.filePath,\n type: c.type,\n description: c.description,\n })),\n },\n apps: appStatus\n ? {\n newLocal: appStatus.newLocal,\n newRemote: appStatus.newRemote,\n modified: appStatus.modified,\n synced: appStatus.synced.length,\n }\n : { note: 'App sync requires browser login (JWT)' },\n summary: fileStatus.conflicts?.length\n ? `${fileStatus.conflicts.length} conflict(s) detected`\n : hasChanges\n ? 'Changes detected'\n : 'Everything is in sync',\n });\n } catch (error) {\n return errorResponse(`Status check failed: ${await formatClientError(error)}`, 'NETWORK_ERROR');\n }\n },\n );\n\n // farseer_diff - Show file differences\n server.tool(\n 'farseer_diff',\n `Show the differences between local and remote versions of files.\n\nCan show:\n- Unified diff format (default)\n- Just the remote content (showRemote=true)\n\nUseful for reviewing changes before pull or push.\n\nIf no file is specified, shows diffs for all changed files.`,\n diffSchema,\n async (params: { organisation?: string; tenant?: string; file?: string; showRemote?: boolean }) => {\n const resolved = resolveOrgAndTenant(params);\n if (!resolved) {\n return tenantRequiredResponse();\n }\n const { organisation, tenant } = resolved;\n\n const clientResult = await getFarseerClientWithFallback(organisation, tenant);\n if (!clientResult) {\n return authRequiredResponse(tenant);\n }\n\n try {\n const syncService = new SyncService(tenant, clientResult.client);\n\n if (params.file) {\n // Single file diff\n const { localContent, remoteContent } = await syncService.getFileDiff(params.file);\n\n if (params.showRemote) {\n return successResponse({\n file: params.file,\n remoteContent: remoteContent || '(file does not exist on remote)',\n });\n }\n\n const diff = createPatch(params.file, remoteContent || '', localContent || '', 'remote', 'local');\n\n return successResponse({\n file: params.file,\n localExists: localContent !== null,\n remoteExists: remoteContent !== null,\n diff,\n });\n } else {\n // All changed files\n const status = await syncService.getStatus();\n const changedFiles = [\n ...status.addedLocally,\n ...status.modifiedLocally,\n ...status.deletedLocally,\n ...status.addedRemotely,\n ...status.modifiedRemotely,\n ...status.deletedRemotely,\n ];\n\n const diffs: Array<{\n file: string;\n localExists: boolean;\n remoteExists: boolean;\n diff: string;\n }> = [];\n\n for (const f of changedFiles.slice(0, 10)) {\n // Limit to 10 files\n const { localContent, remoteContent } = await syncService.getFileDiff(f);\n const diff = createPatch(f, remoteContent || '', localContent || '', 'remote', 'local');\n diffs.push({\n file: f,\n localExists: localContent !== null,\n remoteExists: remoteContent !== null,\n diff,\n });\n }\n\n return successResponse({\n totalChangedFiles: changedFiles.length,\n diffs,\n note:\n changedFiles.length > 10\n ? `Showing first 10 of ${changedFiles.length} changed files`\n : undefined,\n });\n }\n } catch (error) {\n return errorResponse(`Diff failed: ${await formatClientError(error)}`, 'NETWORK_ERROR');\n }\n },\n );\n\n // farseer_list_files - List remote files\n server.tool(\n 'farseer_list_files',\n `List all files stored on the remote Farseer instance in the Files/ folder.\n\nBy default shows only script files (.ts, .js, .mjs, .cjs).\nUse all=true to show all files including images, data files, etc.\n\nReturns file paths relative to the Files/ folder.`,\n listFilesSchema,\n async (params: { organisation?: string; tenant?: string; all?: boolean }) => {\n const resolved = resolveOrgAndTenant(params);\n if (!resolved) {\n return tenantRequiredResponse();\n }\n const { organisation, tenant } = resolved;\n\n const clientResult = await getFarseerClientWithFallback(organisation, tenant);\n if (!clientResult) {\n return authRequiredResponse(tenant);\n }\n\n try {\n let files = await clientResult.client.listFiles();\n\n // Filter to scripts unless --all\n if (!params.all) {\n const scriptExtensions = ['.ts', '.js', '.mjs', '.cjs'];\n files = files.filter((f) => scriptExtensions.some((ext) => f.name.toLowerCase().endsWith(ext)));\n }\n\n // Group by directory\n const byDirectory: Record<string, string[]> = {};\n for (const file of files) {\n const dir = file.path.includes('/') ? file.path.split('/').slice(0, -1).join('/') : '.';\n if (!byDirectory[dir]) {\n byDirectory[dir] = [];\n }\n byDirectory[dir].push(file.name);\n }\n\n return successResponse({\n tenant,\n organisation,\n totalFiles: files.length,\n files: files.map((f) => ({\n name: f.name,\n path: f.path,\n reference: f.reference,\n })),\n byDirectory,\n });\n } catch (error) {\n return errorResponse(`List files failed: ${await formatClientError(error)}`, 'NETWORK_ERROR');\n }\n },\n );\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,iBAAkB;AAClB,kBAA4B;AAC5B,yBAA4B;AAC5B,4BAA+B;AAC/B,4BAA6C;AAC7C,qBAMO;AACP,4BAAkC;AAQlC,MAAM,0BAA0B,aAC3B,MAAM,aAAE,OAAO,CAAC,EAChB,SAAS,EACT;AAAA,EACG;AAEJ;AACJ,MAAM,uBAAuB,aACxB,MAAM,aAAE,OAAO,CAAC,EAChB,SAAS,EACT;AAAA,EACG;AAGJ;AAEJ,MAAM,aAAa;AAAA,EACf,cAAc,aACT,OAAO,EACP,SAAS,EACT;AAAA,IACG;AAAA,EACJ;AAAA,EACJ,QAAQ,aAAE,OAAO,EAAE,SAAS,EAAE,SAAS,wEAAwE;AAAA,EAC/G,KAAK,aAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,iDAAiD;AAAA,EACtF,OAAO,aACF,QAAQ,EACR,SAAS,EACT;AAAA,IACG;AAAA,EAKJ;AAAA,EACJ,mBAAmB;AAAA,EACnB,gBAAgB;AACpB;AAEA,MAAM,aAAa;AAAA,EACf,cAAc,aACT,OAAO,EACP,SAAS,EACT,SAAS,sFAAsF;AAAA,EACpG,Q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AAI,CAAC,OAAO;AAAA,YACrB,MAAM,EAAE;AAAA,YACR,MAAM,EAAE;AAAA,YACR,WAAW,EAAE;AAAA,UACjB,EAAE;AAAA,UACF;AAAA,QACJ,CAAC;AAAA,MACL,SAAS,OAAO;AACZ,mBAAO,8BAAc,sBAAsB,UAAM,yCAAkB,KAAK,CAAC,IAAI,eAAe;AAAA,MAChG;AAAA,IACJ;AAAA,EACJ;AACJ;",
|
|
4
|
+
"sourcesContent": ["/**\n * File Synchronization Tools\n *\n * Tools for syncing files between local repository and Farseer instance.\n */\n\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { z } from 'zod';\nimport { createPatch } from 'diff';\nimport { SyncService } from '../../services/syncService';\nimport { AppSyncService } from '../../services/appSyncService';\nimport { getFarseerClientWithFallback } from '../../services/farseerFactory';\nimport {\n resolveOrgAndTenant,\n successResponse,\n errorResponse,\n authRequiredResponse,\n tenantRequiredResponse,\n} from '../utils/helpers';\nimport { formatClientError } from '../../utils/errorFormatter';\n\n/**\n * Format a category breakdown for the MCP summary string when\n * `ignoredLocal` is non-empty. Agents quote the summary verbatim back\n * to users, so the breakdown has to fit on one line and stay readable\n * without the structured array.\n *\n * Examples:\n * - \"5 with unsupported extension\"\n * - \"3 in blocklisted folders\"\n * - \"5 with unsupported extension, 3 in blocklisted folders\"\n *\n * Takes the UNCAPPED per-reason totals tracked during the walk, not\n * counts from the stored slice. The slice is capped at\n * `IGNORED_LOCAL_CAP` to bound memory, so counting it would give the\n * user a number that disagrees with the headline \u2014 e.g. headline\n * \"250 outside scope\" with breakdown \"100 with unsupported extension\"\n * when all 250 are unsupported-extension files.\n *\n * Returns an empty string when both totals are zero; the caller still\n * gates on `total > 0` and falls back to a plain pointer when this\n * comes back empty.\n */\nfunction summariseIgnoredReasons(totals: { unsupportedExtension: number; blocklistedFolder: number }): string {\n const parts: string[] = [];\n if (totals.unsupportedExtension > 0) parts.push(`${totals.unsupportedExtension} with unsupported extension`);\n if (totals.blocklistedFolder > 0) parts.push(`${totals.blocklistedFolder} in blocklisted folders`);\n return parts.join(', ');\n}\n\n// Define schemas outside of tool registration to avoid deep type instantiation\n//\n// `includeExtensions` and `includeFolders` mirror the CLI's `--include-ext` /\n// `--include-folder` flags. Without them on the MCP surface, an agent could\n// only choose between scripts-only and \"all\" \u2014 there was no way to scope a\n// pull/push/status to \"scripts plus this one folder\" the way a CLI user can.\nconst includeExtensionsSchema = z\n .array(z.string())\n .optional()\n .describe(\n 'Extra file extensions to include alongside the default .ts / .js scripts. ' +\n 'Supply with or without leading dot (\".csv\" or \"csv\"). Mirrors the CLI\\'s --include-ext flag.',\n );\nconst includeFoldersSchema = z\n .array(z.string())\n .optional()\n .describe(\n 'Extra folder paths whose files (any extension) are included alongside the default scripts. ' +\n 'Each path is interpreted relative to the tenant root, e.g. \"Data\" or \"Config/local\". ' +\n \"Mirrors the CLI's --include-folder flag.\",\n );\n\nconst pullSchema = {\n organisation: z\n .string()\n .optional()\n .describe(\n 'Farseer organisation (subdomain, e.g. \"salvus-2\"). If omitted, uses checked-out org or saved mapping.',\n ),\n tenant: z.string().optional().describe('Tenant ID (e.g. \"salvus-prodaja\"). Uses checked-out tenant if omitted.'),\n all: z.boolean().optional().describe('Download all files, not just scripts (.ts, .js)'),\n force: z\n .boolean()\n .optional()\n .describe(\n 'DESTRUCTIVE \u2014 overwrites EVERY locally-modified file with the remote version, including ' +\n \"local edits that have no remote conflict (e.g. a file you've been editing but the remote \" +\n 'is still on the baseline version). Use only when the user has explicitly asked to ' +\n 'discard local changes. Does NOT delete local-only files (that destructive wipe stays ' +\n 'on the CLI side behind the interactive confirm prompt).',\n ),\n includeExtensions: includeExtensionsSchema,\n includeFolders: includeFoldersSchema,\n};\n\nconst pushSchema = {\n organisation: z\n .string()\n .optional()\n .describe('Farseer organisation (subdomain). If omitted, uses checked-out org or saved mapping.'),\n tenant: z.string().optional().describe('Tenant ID. Uses checked-out tenant if omitted.'),\n force: z\n .boolean()\n .optional()\n .describe(\n 'Skip the drift check and overwrite remote even if it diverged from baseline. ' +\n 'Does NOT delete remote-only files; pass mirror=true for that.',\n ),\n mirror: z\n .boolean()\n .optional()\n .describe(\n 'Also delete remote files that have no local counterpart \u2014 destructive \"make remote = local\" semantics. ' +\n \"Implies the upload step still respects the user's local presence, so this only fires for files \" +\n 'genuinely missing locally. Combine with force=true if the drift check would otherwise refuse the push.',\n ),\n all: z\n .boolean()\n .optional()\n .describe(\n 'Push all files, not just scripts (.ts, .js). Excludes hidden files unless includeFolders names them.',\n ),\n includeExtensions: includeExtensionsSchema,\n includeFolders: includeFoldersSchema,\n};\n\nconst statusSchema = {\n organisation: z\n .string()\n .optional()\n .describe('Farseer organisation (subdomain). If omitted, uses checked-out org or saved mapping.'),\n tenant: z.string().optional().describe('Tenant ID. Uses checked-out tenant if omitted.'),\n all: z.boolean().optional().describe('Show all files, not just scripts'),\n // Deep is the default \u2014 matches the CLI's `farseer status` behaviour\n // (deep-by-default since 1.6.2). Agents should pass `shallow: true`\n // only when they have independent reason to trust the last-pull\n // baseline (e.g. checking immediately after a successful pull) and\n // want the faster path on a large tenant.\n shallow: z\n .boolean()\n .optional()\n .describe(\n 'Skip remote-content hashing. Faster on big tenants but cannot detect remote-side edits to existing ' +\n 'files made since the last pull. Default is deep \u2014 every remote file is hashed.',\n ),\n // Backwards-compat alias for callers written against the 1.6.1 MCP\n // schema, where deep=false was the fast-path opt-out. We map it to\n // shallow internally; if both are passed, shallow wins (explicit\n // opt-out beats the legacy positive). New callers should use shallow.\n deep: z\n .boolean()\n .optional()\n .describe(\n '(Deprecated) Backwards-compat alias for the pre-1.6.2 fast-path control. ' +\n 'Pass shallow=true instead. If both are supplied, shallow takes precedence.',\n ),\n includeExtensions: includeExtensionsSchema,\n includeFolders: includeFoldersSchema,\n};\n\nconst diffSchema = {\n organisation: z.string().optional().describe('Farseer organisation (subdomain).'),\n tenant: z.string().optional().describe('Tenant ID'),\n file: z.string().optional().describe('Specific file path to diff. If omitted, shows all differences.'),\n showRemote: z.boolean().optional().describe('Show only the remote content instead of diff'),\n};\n\nconst listFilesSchema = {\n organisation: z.string().optional().describe('Farseer organisation (subdomain).'),\n tenant: z.string().optional().describe('Tenant ID'),\n all: z.boolean().optional().describe('Show all files, not just scripts'),\n};\n\nexport function registerSyncTools(server: McpServer): void {\n // farseer_pull - Download files from remote\n server.tool(\n 'farseer_pull',\n `Pull (download) files and app configurations from a Farseer instance to the local repository.\n\nWhat gets pulled:\n- TypeScript/JavaScript scripts from Files/ folder (searched recursively)\n- App configurations (saved as JSON in apps/ folder)\n\nFiles are saved to: farseer-apps/<tenant>/files/\nApps are saved to: farseer-apps/<tenant>/apps/\n\nBy default only script files (.ts, .js) are pulled.\nUse all=true to pull all files including images, data files, etc.\nUse includeExtensions / includeFolders to broaden the scope without pulling everything\n(e.g. includeExtensions=[\"csv\"] adds CSV files; includeFolders=[\"Data\"] adds the Data\nfolder regardless of extension). These mirror the CLI's --include-ext / --include-folder\nflags and are additive on top of the default scripts.\n\nConflict handling:\n- Per-file conflict resolution (keep_local / keep_remote / keep_both / merge_markers)\n is CLI-only \u2014 it requires an interactive prompt and the MCP can't answer one.\n- The MCP path returns conflicts in response.conflicts[] so the agent can re-pull\n with force=true once the user has confirmed they want to discard their edits.\n- force=true is DESTRUCTIVE: it overwrites every locally-modified file with the\n remote version (even local edits that don't conflict with remote). It does NOT\n wipe local-only files (that destructive step lives behind the CLI's confirm prompt).\n Only pass force=true when the user has explicitly accepted losing local changes.\n\nSync includes (middle ground between scripts-only and all):\n- Users can configure extra extensions and folders via \"farseer config include\" CLI command\n- These are stored per-tenant in ~/.farseer/config.json under \"syncIncludes\"\n- When configured, pull/push/status automatically include those files alongside default scripts\n- Example: syncIncludes may add .json files or entire folders like \"Config\" or \"App Logs\"\n- The sync includes are respected automatically \u2014 no extra parameters needed here\n\nOrganisation and tenant:\n- Organisation = subdomain (e.g. \"salvus-2\" for salvus-2.farseer.io)\n- Tenant = workspace ID (e.g. \"salvus-prodaja\")\n- Often they are the same. Only specify organisation when it differs from tenant.\n- If checked out, both are resolved automatically.`,\n pullSchema,\n async (params: {\n organisation?: string;\n tenant?: string;\n all?: boolean;\n force?: boolean;\n includeExtensions?: string[];\n includeFolders?: string[];\n }) => {\n const resolved = resolveOrgAndTenant(params);\n if (!resolved) {\n return tenantRequiredResponse();\n }\n const { organisation, tenant } = resolved;\n\n const clientResult = await getFarseerClientWithFallback(organisation, tenant);\n if (!clientResult) {\n return authRequiredResponse(tenant);\n }\n\n try {\n // Pull files (use tenant for folder path)\n const syncService = new SyncService(tenant, clientResult.client);\n const fileResult = await syncService.pull({\n all: params.all,\n force: params.force,\n includeExtensions: params.includeExtensions,\n includeFolders: params.includeFolders,\n });\n\n // Pull apps (only with JWT auth)\n let appResult = null;\n if (clientResult.authType === 'jwt') {\n const appSyncService = new AppSyncService(tenant, clientResult.client);\n appResult = await appSyncService.pull();\n }\n\n const response: Record<string, any> = {\n tenant,\n organisation,\n files: {\n downloaded: fileResult.downloaded,\n deleted: fileResult.deleted,\n unchanged: fileResult.unchanged.length,\n },\n apps: appResult\n ? {\n created: appResult.created,\n updated: appResult.updated,\n deleted: appResult.deleted,\n unchanged: appResult.unchanged.length,\n }\n : { note: 'App sync requires browser login (JWT)' },\n message: `Pulled ${fileResult.downloaded.length} files${appResult ? ` and ${appResult.created.length + appResult.updated.length} apps` : ''}`,\n };\n\n if (fileResult.conflicts.length > 0) {\n response.conflicts = fileResult.conflicts.map((c) => ({\n file: c.filePath,\n type: c.type,\n description: c.description,\n }));\n response.message = `Pulled ${fileResult.downloaded.length} files but ${fileResult.conflicts.length} conflict(s) need resolution`;\n response.hint =\n 'Use force=true to overwrite local changes, or resolve conflicts via CLI: farseer pull <tenant>';\n }\n\n if (fileResult.conflictFilesWritten.length > 0) {\n response.conflictFilesWritten = fileResult.conflictFilesWritten;\n }\n\n return successResponse(response);\n } catch (error) {\n return errorResponse(`Pull failed: ${await formatClientError(error)}`, 'NETWORK_ERROR');\n }\n },\n );\n\n // farseer_push - Upload files to remote\n server.tool(\n 'farseer_push',\n `Push (upload) local file and app changes to a Farseer instance.\n\nWhat gets pushed:\n- New/modified scripts from farseer-apps/<tenant>/files/ (filtered by sync scope \u2014\n default is .ts/.js; broaden via includeExtensions / includeFolders / all on this\n tool, or via persistent sync includes set with the CLI's \"farseer config include\").\n- New/modified app configurations from farseer-apps/<tenant>/apps/.\n- Deleted files (when they were previously synced \u2014 preserves \"I rm'd this\" semantics).\n\nPre-flight (runs before any HTTP call):\n- Refuses files the backend would refuse anyway: extension not on whitelist,\n filename longer than 256 chars, empty body, unresolved git-style merge markers\n (<<<<<<< LOCAL / ======= / >>>>>>> REMOTE) left over from a merge_markers pull.\n- Returns rejected files in the response. If every candidate is rejected (and\n no deletes/updates either), the tool call returns VALIDATION_ERROR.\n\nDrift / mirror semantics:\n- force=true skips the drift check (push over remote-side adds/deletes).\n- mirror=true (separate param) also deletes remote files that have no local\n counterpart, within the current sync scope. Combine with force when both are\n needed.\n\nOut-of-scope files (e.g. a hidden .vscode/settings.json next to scripts) are\nINVISIBLE to push \u2014 never uploaded, never deleted. Hidden paths require explicit\nopt-in via --include-folder (extension includes never widen scope to hidden\nfiles \u2014 that would let a generic .json broadening leak credentials).\n\nSilent-skip signal: \\`files.ignoredLocal\\` is an array of\n\\`{ path, reason }\\` entries listing non-hidden user files that exist on\ndisk but were outside the active sync scope and therefore NOT pushed.\n\\`reason\\` is one of:\n - \\`unsupportedExtension\\`: file extension isn't in default scope (e.g.\n .csv, .md). Tell the user to broaden with \\`--include-ext <ext>\\`.\n - \\`blocklistedFolder\\`: file is in a tooling-output folder (node_modules/,\n dist/, build/). These are almost never user content \u2014 warn the user\n that opting in is unusual instead of suggesting the flag outright.\n\\`files.ignoredLocalTotal\\` carries the uncapped count when the list was\ntruncated. Hidden files (.env, .git/, .vscode/) never appear here \u2014 the\nresponse does not advertise widening scope to include them. Use this list to\ndetect \"push succeeded but my local .csv / .md / .py files weren't sent\"\nbefore reporting success to the user.\n\nSync includes: if user configured via \"farseer config include\", drift and scope\nchecks respect those settings automatically.\n\nIf no tenant is specified, uses the currently checked-out tenant.`,\n pushSchema,\n async (params: {\n organisation?: string;\n tenant?: string;\n force?: boolean;\n mirror?: boolean;\n all?: boolean;\n includeExtensions?: string[];\n includeFolders?: string[];\n }) => {\n const resolved = resolveOrgAndTenant(params);\n if (!resolved) {\n return tenantRequiredResponse();\n }\n const { organisation, tenant } = resolved;\n\n const clientResult = await getFarseerClientWithFallback(organisation, tenant);\n if (!clientResult) {\n return authRequiredResponse(tenant);\n }\n\n try {\n const syncService = new SyncService(tenant, clientResult.client);\n\n // Non-force push must not silently overwrite remote-side\n // drift. The previous `checkRemoteChanges` gate was a\n // list-only diff against the recorded baseline \u2014 it could\n // see remote-side adds/deletes but not content edits to\n // existing files. That's the same Matej-class blind spot\n // the CLI gate closed in 1.6.2: run a DEEP status so\n // remote content drift surfaces, then block if any\n // remote-side bucket has paths in scope.\n if (!params.force) {\n const status = await syncService.getStatus({\n deep: true,\n all: params.all,\n includeExtensions: params.includeExtensions,\n includeFolders: params.includeFolders,\n });\n const conflicting = [\n ...status.modifiedRemotely,\n ...status.addedRemotely,\n ...status.deletedRemotely,\n ];\n if (conflicting.length > 0) {\n // Mirror the CLI's behaviour at push.ts:211-216 \u2014\n // echo the active scope flags back into the\n // suggested pull command so a default-scope pull\n // doesn't run, report \"Already up to date\", and\n // leave the agent stuck in the same drift loop.\n const scopeFlags: string[] = [];\n if (params.all) scopeFlags.push('--all');\n for (const ext of params.includeExtensions ?? []) scopeFlags.push(`--include-ext ${ext}`);\n for (const folder of params.includeFolders ?? [])\n scopeFlags.push(`--include-folder \"${folder}\"`);\n const pullCmd = ['farseer pull', tenant, ...scopeFlags].join(' ');\n return errorResponse(\n `Remote has changes for ${conflicting.length} file(s) since last pull:\\n` +\n conflicting.map((p) => ` - ${p}`).join('\\n') +\n `\\n\\nRun \\`${pullCmd}\\` first, or use force=true to overwrite remote.`,\n 'VALIDATION_ERROR',\n );\n }\n }\n\n // Push files. Pass `mirror` separately from `force` so an\n // agent must opt in explicitly to remote-side deletes \u2014 the\n // CLI gates this behind a confirm prompt, the MCP can't, so\n // we make it a separate parameter the caller has to set.\n const fileResult = await syncService.push({\n force: params.force,\n mirror: params.mirror,\n all: params.all,\n includeExtensions: params.includeExtensions,\n includeFolders: params.includeFolders,\n });\n\n // Check for conflicts\n if (fileResult.conflicts.length > 0) {\n return errorResponse(\n `Push blocked by ${fileResult.conflicts.length} conflict(s):\\n${fileResult.conflicts.map((c) => ` - ${c.filePath}: ${c.description}`).join('\\n')}\\n\\nPull first or use force=true.`,\n 'VALIDATION_ERROR',\n );\n }\n\n // Pre-flight rejected files. A push that produced zero side\n // effects (no upload, no update, no delete) because every\n // candidate was rejected is a failure from the agent's\n // perspective \u2014 surface it as VALIDATION_ERROR so the tool\n // call doesn't quietly look like a success.\n //\n // Note `appliedAny` includes deletes: a mirror push that\n // removed remote-only files BUT had every upload candidate\n // rejected has still mutated remote state, so the response\n // must show the deletes (treated as a partial success), not\n // an error that hides them.\n if (fileResult.rejected && fileResult.rejected.length > 0) {\n const summary = fileResult.rejected.map((r) => ` - ${r.filePath}: ${r.detail}`).join('\\n');\n const appliedAny =\n fileResult.uploaded.length + fileResult.updated.length + fileResult.deleted.length > 0;\n if (!appliedAny) {\n return errorResponse(\n `Push rejected \u2014 backend would refuse every candidate file:\\n${summary}`,\n 'VALIDATION_ERROR',\n );\n }\n // Partial success: at least some side effects applied.\n // Fall through to successResponse below so the caller\n // sees the full files.{uploaded,updated,deleted,rejected}\n // breakdown and can decide how strict to be.\n }\n\n // Per-file mid-push failures (5xx, transient errors). These\n // reach the agent as a separate signal from `rejected`\n // (pre-flight). We always surface them \u2014 if the entire push\n // failed mid-flight with no side effects, return error so\n // the agent retries; otherwise let the partial success\n // through so the agent can see what stuck.\n if (fileResult.failed && fileResult.failed.length > 0) {\n const failureSummary = fileResult.failed\n .map((f) => ` - ${f.filePath} (${f.operation}): ${f.reason}`)\n .join('\\n');\n const appliedAny =\n fileResult.uploaded.length + fileResult.updated.length + fileResult.deleted.length > 0;\n if (!appliedAny) {\n return errorResponse(\n `Push failed mid-flight \u2014 every attempted file errored:\\n${failureSummary}`,\n 'NETWORK_ERROR',\n );\n }\n }\n\n // Push apps (only with JWT auth)\n let appResult = null;\n if (clientResult.authType === 'jwt') {\n const appSyncService = new AppSyncService(tenant, clientResult.client);\n appResult = await appSyncService.push();\n }\n\n const ignoredLocalEntries = fileResult.ignoredLocal ?? [];\n const ignoredLocalCount = fileResult.ignoredLocalTotal ?? 0;\n const ignoredLocalTotalByReason = fileResult.ignoredLocalTotalByReason ?? {\n unsupportedExtension: 0,\n blocklistedFolder: 0,\n };\n // Drive the breakdown from the UNCAPPED per-reason totals so\n // the numbers in the suffix agree with the headline even\n // when the path slice was truncated.\n const ignoredBreakdown = summariseIgnoredReasons(ignoredLocalTotalByReason);\n const ignoredSuffix =\n ignoredLocalCount > 0\n ? ignoredBreakdown\n ? ` (${ignoredLocalCount} local file(s) outside scope: ${ignoredBreakdown} \u2014 see files.ignoredLocal)`\n : ` (${ignoredLocalCount} local file(s) outside scope \u2014 see files.ignoredLocal)`\n : '';\n return successResponse({\n tenant,\n organisation,\n files: {\n uploaded: fileResult.uploaded,\n updated: fileResult.updated,\n deleted: fileResult.deleted,\n unchanged: fileResult.unchanged.length,\n rejected: fileResult.rejected ?? [],\n failed: fileResult.failed ?? [],\n // Surface scope-skipped files so an agent calling\n // push gets the same silent-skip signal CLI users\n // see in the warning line. Without this, agents\n // reported \"push complete\" while local .csv / .md /\n // .py work-in-progress sat unsent on disk.\n // Entries are { path, reason } so the agent can\n // present category-specific advice \u2014 extension\n // broadening vs blocklisted-folder warning.\n ignoredLocal: ignoredLocalEntries,\n ignoredLocalTotal: ignoredLocalCount,\n ignoredLocalTotalByReason,\n },\n apps: appResult\n ? {\n created: appResult.created,\n updated: appResult.updated,\n unchanged: appResult.unchanged.length,\n }\n : { note: 'App sync requires browser login (JWT)' },\n 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}`,\n });\n } catch (error) {\n return errorResponse(`Push failed: ${await formatClientError(error)}`, 'NETWORK_ERROR');\n }\n },\n );\n\n // farseer_status - Check sync status\n server.tool(\n 'farseer_status',\n `Check the synchronization status between local files and the remote Farseer instance.\n\nShows which files are:\n- Modified locally (changed since last sync)\n- Modified remotely (changed on server since last sync)\n- Only local (new files not yet pushed)\n- Only remote (files not yet pulled)\n- In sync (no changes)\n\nAlso shows app sync status if using JWT authentication.\n\nOut-of-scope local files: \\`files.ignoredLocal\\` is an array of\n\\`{ path, reason }\\` entries listing user-authored files that exist on disk\nbut were silently skipped because they don't match the current sync scope\n(default scope is .ts / .js). \\`reason\\` is one of \\`unsupportedExtension\\`\n(extension not in default scope \u2014 broaden via \\`--include-ext\\`) or\n\\`blocklistedFolder\\` (file lives under a tooling-output folder like\nnode_modules/ or dist/ \u2014 opting in is unusual). Use this to detect the\n\"local edits exist but status reports clean\" failure mode before reporting\n\"everything is in sync\" to the user. Hidden files (.env, .git/, .vscode/)\nare NEVER listed there \u2014 those require explicit opt-in via the CLI's\n\\`farseer config include\\` and the response does not advertise widening\nscope to include them. \\`ignoredLocalTotal\\` carries the uncapped count\nwhen the slice was truncated.\n\nSync includes: If the user has configured extra file types via \"farseer config include\"\n(e.g., .json extensions or specific folders like \"Config\"), those files are automatically\nincluded in the status check alongside default script files.\n\nDeep vs shallow: Default is deep \u2014 every remote file is hashed so the response surfaces\nremote-side content edits made since the last pull. Pass shallow=true to skip the hash\ncheck (faster on big tenants; trusts the recorded baseline, so it cannot detect content\nedits to existing remote files). Matches the CLI's --shallow flag.\n\nIf no tenant is specified, uses the currently checked-out tenant.`,\n statusSchema,\n async (params: {\n organisation?: string;\n tenant?: string;\n all?: boolean;\n shallow?: boolean;\n deep?: boolean;\n includeExtensions?: string[];\n includeFolders?: string[];\n }) => {\n const resolved = resolveOrgAndTenant(params);\n if (!resolved) {\n return tenantRequiredResponse();\n }\n const { organisation, tenant } = resolved;\n\n const clientResult = await getFarseerClientWithFallback(organisation, tenant);\n if (!clientResult) {\n return authRequiredResponse(tenant);\n }\n\n try {\n const syncService = new SyncService(tenant, clientResult.client);\n // Deep is the default; `shallow: true` opts into the faster\n // list-only path. Matches the CLI's --shallow flag.\n //\n // `deep` is a deprecated backwards-compat alias for callers\n // written against the 1.6.1 schema. Resolution order:\n // 1. shallow=true \u2192 deep: false (explicit opt-out wins)\n // 2. deep=false \u2192 deep: false (legacy fast-path)\n // 3. deep=true or unset \u2192 deep: true (the new default)\n // This keeps the schema-validated surface backwards-\n // compatible with existing MCP callers that haven't been\n // rewritten yet, without confusing combinations.\n const effectiveDeep = params.shallow === true ? false : params.deep !== false;\n const fileStatus = await syncService.getStatus({\n all: params.all,\n deep: effectiveDeep,\n includeExtensions: params.includeExtensions,\n includeFolders: params.includeFolders,\n });\n\n // Get app status (only with JWT auth)\n let appStatus = null;\n if (clientResult.authType === 'jwt') {\n const appSyncService = new AppSyncService(tenant, clientResult.client);\n appStatus = await appSyncService.getStatus();\n }\n\n const hasChanges =\n fileStatus.modifiedLocally.length > 0 ||\n fileStatus.modifiedRemotely.length > 0 ||\n fileStatus.addedLocally.length > 0 ||\n fileStatus.addedRemotely.length > 0 ||\n fileStatus.deletedLocally.length > 0 ||\n fileStatus.deletedRemotely.length > 0 ||\n fileStatus.conflicts.length > 0;\n\n // Surface scope-skipped files so agents calling MCP see\n // the same silent-skip signal CLI users get. Without this\n // an agent that ran status on a tenant where the user has\n // unsaved .csv / .md / .py edits gets a clean \"Everything\n // is in sync\" \u2014 exactly the failure the CLI fix addressed.\n // Hidden files (.env, .git/) are upstream-excluded so the\n // response can't tell the agent to widen scope to include\n // a credential file.\n return successResponse({\n tenant,\n organisation,\n files: {\n addedLocally: fileStatus.addedLocally,\n modifiedLocally: fileStatus.modifiedLocally,\n deletedLocally: fileStatus.deletedLocally,\n addedRemotely: fileStatus.addedRemotely,\n modifiedRemotely: fileStatus.modifiedRemotely,\n deletedRemotely: fileStatus.deletedRemotely,\n inSync: fileStatus.inSync.length,\n deepCompare: fileStatus.deepCompare,\n conflicts: fileStatus.conflicts.map((c) => ({\n file: c.filePath,\n type: c.type,\n description: c.description,\n })),\n ignoredLocal: fileStatus.ignoredLocal,\n ignoredLocalTotal: fileStatus.ignoredLocalTotal,\n ignoredLocalTotalByReason: fileStatus.ignoredLocalTotalByReason,\n },\n apps: appStatus\n ? {\n newLocal: appStatus.newLocal,\n newRemote: appStatus.newRemote,\n modified: appStatus.modified,\n synced: appStatus.synced.length,\n }\n : { note: 'App sync requires browser login (JWT)' },\n summary: (() => {\n if (fileStatus.conflicts?.length) {\n return `${fileStatus.conflicts.length} conflict(s) detected`;\n }\n if (hasChanges) return 'Changes detected';\n if (fileStatus.ignoredLocalTotal > 0) {\n // No drift within scope \u2014 but local files\n // outside scope exist. Agents quote this\n // summary back to users; a flat \"Everything is\n // in sync\" would hide that .md / .csv / .py\n // work was never compared. Include the reason\n // breakdown so the user sees whether they need\n // to broaden by extension or are looking at\n // ignored tooling output.\n //\n // Drive the breakdown from the UNCAPPED per-\n // reason totals so e.g. \"250 outside scope\"\n // doesn't pair with \"100 with unsupported\n // extension\" when all 250 are that reason.\n const breakdown = summariseIgnoredReasons(fileStatus.ignoredLocalTotalByReason);\n const suffix = breakdown\n ? `${fileStatus.ignoredLocalTotal} local file(s) outside scope: ${breakdown}`\n : `${fileStatus.ignoredLocalTotal} local file(s) outside scope`;\n return `Everything in sync within current scope (${suffix} \u2014 see files.ignoredLocal)`;\n }\n return 'Everything is in sync';\n })(),\n });\n } catch (error) {\n return errorResponse(`Status check failed: ${await formatClientError(error)}`, 'NETWORK_ERROR');\n }\n },\n );\n\n // farseer_diff - Show file differences\n server.tool(\n 'farseer_diff',\n `Show the differences between local and remote versions of files.\n\nCan show:\n- Unified diff format (default)\n- Just the remote content (showRemote=true)\n\nUseful for reviewing changes before pull or push.\n\nIf no file is specified, shows diffs for all changed files.`,\n diffSchema,\n async (params: { organisation?: string; tenant?: string; file?: string; showRemote?: boolean }) => {\n const resolved = resolveOrgAndTenant(params);\n if (!resolved) {\n return tenantRequiredResponse();\n }\n const { organisation, tenant } = resolved;\n\n const clientResult = await getFarseerClientWithFallback(organisation, tenant);\n if (!clientResult) {\n return authRequiredResponse(tenant);\n }\n\n try {\n const syncService = new SyncService(tenant, clientResult.client);\n\n if (params.file) {\n // Single file diff\n const { localContent, remoteContent } = await syncService.getFileDiff(params.file);\n\n if (params.showRemote) {\n return successResponse({\n file: params.file,\n remoteContent: remoteContent || '(file does not exist on remote)',\n });\n }\n\n const diff = createPatch(params.file, remoteContent || '', localContent || '', 'remote', 'local');\n\n return successResponse({\n file: params.file,\n localExists: localContent !== null,\n remoteExists: remoteContent !== null,\n diff,\n });\n } else {\n // All changed files\n const status = await syncService.getStatus();\n const changedFiles = [\n ...status.addedLocally,\n ...status.modifiedLocally,\n ...status.deletedLocally,\n ...status.addedRemotely,\n ...status.modifiedRemotely,\n ...status.deletedRemotely,\n ];\n\n const diffs: Array<{\n file: string;\n localExists: boolean;\n remoteExists: boolean;\n diff: string;\n }> = [];\n\n for (const f of changedFiles.slice(0, 10)) {\n // Limit to 10 files\n const { localContent, remoteContent } = await syncService.getFileDiff(f);\n const diff = createPatch(f, remoteContent || '', localContent || '', 'remote', 'local');\n diffs.push({\n file: f,\n localExists: localContent !== null,\n remoteExists: remoteContent !== null,\n diff,\n });\n }\n\n return successResponse({\n totalChangedFiles: changedFiles.length,\n diffs,\n note:\n changedFiles.length > 10\n ? `Showing first 10 of ${changedFiles.length} changed files`\n : undefined,\n });\n }\n } catch (error) {\n return errorResponse(`Diff failed: ${await formatClientError(error)}`, 'NETWORK_ERROR');\n }\n },\n );\n\n // farseer_list_files - List remote files\n server.tool(\n 'farseer_list_files',\n `List all files stored on the remote Farseer instance in the Files/ folder.\n\nBy default shows only script files (.ts, .js, .mjs, .cjs).\nUse all=true to show all files including images, data files, etc.\n\nReturns file paths relative to the Files/ folder.`,\n listFilesSchema,\n async (params: { organisation?: string; tenant?: string; all?: boolean }) => {\n const resolved = resolveOrgAndTenant(params);\n if (!resolved) {\n return tenantRequiredResponse();\n }\n const { organisation, tenant } = resolved;\n\n const clientResult = await getFarseerClientWithFallback(organisation, tenant);\n if (!clientResult) {\n return authRequiredResponse(tenant);\n }\n\n try {\n let files = await clientResult.client.listFiles();\n\n // Filter to scripts unless --all\n if (!params.all) {\n const scriptExtensions = ['.ts', '.js', '.mjs', '.cjs'];\n files = files.filter((f) => scriptExtensions.some((ext) => f.name.toLowerCase().endsWith(ext)));\n }\n\n // Group by directory\n const byDirectory: Record<string, string[]> = {};\n for (const file of files) {\n const dir = file.path.includes('/') ? file.path.split('/').slice(0, -1).join('/') : '.';\n if (!byDirectory[dir]) {\n byDirectory[dir] = [];\n }\n byDirectory[dir].push(file.name);\n }\n\n return successResponse({\n tenant,\n organisation,\n totalFiles: files.length,\n files: files.map((f) => ({\n name: f.name,\n path: f.path,\n reference: f.reference,\n })),\n byDirectory,\n });\n } catch (error) {\n return errorResponse(`List files failed: ${await formatClientError(error)}`, 'NETWORK_ERROR');\n }\n },\n );\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,iBAAkB;AAClB,kBAA4B;AAC5B,yBAA4B;AAC5B,4BAA+B;AAC/B,4BAA6C;AAC7C,qBAMO;AACP,4BAAkC;AAwBlC,SAAS,wBAAwB,QAA6E;AAC1G,QAAM,QAAkB,CAAC;AACzB,MAAI,OAAO,uBAAuB,EAAG,OAAM,KAAK,GAAG,OAAO,oBAAoB,6BAA6B;AAC3G,MAAI,OAAO,oBA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AClG;AAGA,cAAM,cAAwC,CAAC;AAC/C,mBAAW,QAAQ,OAAO;AACtB,gBAAM,MAAM,KAAK,KAAK,SAAS,GAAG,IAAI,KAAK,KAAK,MAAM,GAAG,EAAE,MAAM,GAAG,EAAE,EAAE,KAAK,GAAG,IAAI;AACpF,cAAI,CAAC,YAAY,GAAG,GAAG;AACnB,wBAAY,GAAG,IAAI,CAAC;AAAA,UACxB;AACA,sBAAY,GAAG,EAAE,KAAK,KAAK,IAAI;AAAA,QACnC;AAEA,mBAAO,gCAAgB;AAAA,UACnB;AAAA,UACA;AAAA,UACA,YAAY,MAAM;AAAA,UAClB,OAAO,MAAM,IAAI,CAAC,OAAO;AAAA,YACrB,MAAM,EAAE;AAAA,YACR,MAAM,EAAE;AAAA,YACR,WAAW,EAAE;AAAA,UACjB,EAAE;AAAA,UACF;AAAA,QACJ,CAAC;AAAA,MACL,SAAS,OAAO;AACZ,mBAAO,8BAAc,sBAAsB,UAAM,yCAAkB,KAAK,CAAC,IAAI,eAAe;AAAA,MAChG;AAAA,IACJ;AAAA,EACJ;AACJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -32,6 +32,8 @@ __export(syncService_exports, {
|
|
|
32
32
|
MERGE_MARKER_REMOTE_END: () => MERGE_MARKER_REMOTE_END,
|
|
33
33
|
MERGE_MARKER_SEPARATOR: () => MERGE_MARKER_SEPARATOR,
|
|
34
34
|
SyncService: () => SyncService,
|
|
35
|
+
buildHiddenDirSkipper: () => buildHiddenDirSkipper,
|
|
36
|
+
classifyIgnoredFile: () => classifyIgnoredFile,
|
|
35
37
|
isHiddenFile: () => import_helpers2.isHiddenFile,
|
|
36
38
|
isOsMetadataFile: () => import_helpers2.isOsMetadataFile,
|
|
37
39
|
shouldIncludeFile: () => shouldIncludeFile
|
|
@@ -45,7 +47,38 @@ var import_helpers = require("../utils/helpers");
|
|
|
45
47
|
var import_logger = require("../utils/logger");
|
|
46
48
|
var import_fileValidation = require("../utils/fileValidation");
|
|
47
49
|
var import_errorFormatter = require("../utils/errorFormatter");
|
|
50
|
+
var import_syncReporting = require("../utils/syncReporting");
|
|
48
51
|
var import_helpers2 = require("../utils/helpers");
|
|
52
|
+
const IGNORED_FOLDER_BLOCKLIST = ["node_modules", "dist", "build", "bower_components", "coverage", "__pycache__"];
|
|
53
|
+
function classifyIgnoredFile(filePath) {
|
|
54
|
+
const segments = filePath.split("/");
|
|
55
|
+
for (const seg of segments) {
|
|
56
|
+
if (IGNORED_FOLDER_BLOCKLIST.includes(seg)) return "blocklistedFolder";
|
|
57
|
+
}
|
|
58
|
+
return "unsupportedExtension";
|
|
59
|
+
}
|
|
60
|
+
function buildHiddenDirSkipper(options, configFolders) {
|
|
61
|
+
const normalize = (f) => f.split(path.sep).join("/").replace(/^\/+|\/+$/g, "");
|
|
62
|
+
const includeFolders = [...options?.includeFolders ?? [], ...configFolders].map(
|
|
63
|
+
(f) => f.split(path.sep).join("/").replace(/\/+$/, "")
|
|
64
|
+
);
|
|
65
|
+
const onlyFilesPosix = (options?.onlyFiles ?? []).map(normalize);
|
|
66
|
+
return (relPath) => {
|
|
67
|
+
const posix = relPath.split(path.sep).join("/");
|
|
68
|
+
if (!(0, import_helpers.isHiddenFile)(posix)) return false;
|
|
69
|
+
for (const include of includeFolders) {
|
|
70
|
+
if (posix === include) return false;
|
|
71
|
+
if (posix.startsWith(include + "/")) return false;
|
|
72
|
+
if (include.startsWith(posix + "/")) return false;
|
|
73
|
+
}
|
|
74
|
+
for (const only of onlyFilesPosix) {
|
|
75
|
+
if (only === posix) return false;
|
|
76
|
+
if (only.startsWith(posix + "/")) return false;
|
|
77
|
+
if (posix.startsWith(only + "/")) return false;
|
|
78
|
+
}
|
|
79
|
+
return true;
|
|
80
|
+
};
|
|
81
|
+
}
|
|
49
82
|
function shouldIncludeFile(filePath, tenant, options) {
|
|
50
83
|
if ((0, import_helpers.isOsMetadataFile)(filePath)) return false;
|
|
51
84
|
if (options?.onlyFiles && options.onlyFiles.length > 0) {
|
|
@@ -53,8 +86,10 @@ function shouldIncludeFile(filePath, tenant, options) {
|
|
|
53
86
|
}
|
|
54
87
|
const ext = path.extname(filePath).toLowerCase();
|
|
55
88
|
const persistent = (0, import_configService.getSyncIncludes)(tenant);
|
|
56
|
-
const
|
|
57
|
-
if ((0, import_helpers.isHiddenFile)(filePath)) return
|
|
89
|
+
const folderMatches = (options?.includeFolders?.some((f) => filePath.startsWith(f + "/") || filePath === f) ?? false) || (persistent?.folders?.some((f) => filePath.startsWith(f + "/") || filePath === f) ?? false);
|
|
90
|
+
if ((0, import_helpers.isHiddenFile)(filePath)) return folderMatches;
|
|
91
|
+
const extensionMatches = (options?.includeExtensions?.includes(ext) ?? false) || (persistent?.extensions?.includes(ext) ?? false);
|
|
92
|
+
const matchesIncludes = folderMatches || extensionMatches;
|
|
58
93
|
if (options?.all) return true;
|
|
59
94
|
if (import_farseerFactory.DEFAULT_SCRIPT_EXTENSIONS.includes(ext)) return true;
|
|
60
95
|
return matchesIncludes;
|
|
@@ -69,7 +104,10 @@ function emptyStatus(deepCompare) {
|
|
|
69
104
|
deletedRemotely: [],
|
|
70
105
|
inSync: [],
|
|
71
106
|
conflicts: [],
|
|
72
|
-
deepCompare
|
|
107
|
+
deepCompare,
|
|
108
|
+
ignoredLocal: [],
|
|
109
|
+
ignoredLocalTotal: 0,
|
|
110
|
+
ignoredLocalTotalByReason: { unsupportedExtension: 0, blocklistedFolder: 0 }
|
|
73
111
|
};
|
|
74
112
|
}
|
|
75
113
|
const MERGE_MARKER_LOCAL_START = "<<<<<<< LOCAL (your version)";
|
|
@@ -119,7 +157,28 @@ class SyncService {
|
|
|
119
157
|
const deep = options?.deep === true;
|
|
120
158
|
const syncState = this.loadSyncState();
|
|
121
159
|
const filesDir = (0, import_helpers.getTenantFilesDir)(this.tenant);
|
|
122
|
-
const
|
|
160
|
+
const includeFoldersFromConfig = (0, import_configService.getSyncIncludes)(this.tenant)?.folders ?? [];
|
|
161
|
+
const skipHiddenDir = buildHiddenDirSkipper(options, includeFoldersFromConfig);
|
|
162
|
+
const allLocalFiles = (0, import_helpers.getAllFilesInDir)(filesDir, { shouldSkipDir: skipHiddenDir });
|
|
163
|
+
const localFiles = [];
|
|
164
|
+
const ignoredLocal = [];
|
|
165
|
+
let ignoredLocalTotal = 0;
|
|
166
|
+
const ignoredLocalTotalByReason = { unsupportedExtension: 0, blocklistedFolder: 0 };
|
|
167
|
+
const suppressIgnoredLocal = (options?.onlyFiles?.length ?? 0) > 0;
|
|
168
|
+
for (const f of allLocalFiles) {
|
|
169
|
+
if (shouldIncludeFile(f, this.tenant, options)) {
|
|
170
|
+
localFiles.push(f);
|
|
171
|
+
continue;
|
|
172
|
+
}
|
|
173
|
+
if ((0, import_helpers.isOsMetadataFile)(f) || (0, import_helpers.isHiddenFile)(f)) continue;
|
|
174
|
+
if (suppressIgnoredLocal) continue;
|
|
175
|
+
ignoredLocalTotal++;
|
|
176
|
+
const reason = classifyIgnoredFile(f);
|
|
177
|
+
ignoredLocalTotalByReason[reason]++;
|
|
178
|
+
if (ignoredLocal.length < import_syncReporting.IGNORED_LOCAL_CAP) {
|
|
179
|
+
ignoredLocal.push({ path: f, reason });
|
|
180
|
+
}
|
|
181
|
+
}
|
|
123
182
|
const localHashes = /* @__PURE__ */ new Map();
|
|
124
183
|
for (const file of localFiles) {
|
|
125
184
|
const fullPath = (0, import_helpers.safeResolveWithinBase)(filesDir, file);
|
|
@@ -165,6 +224,9 @@ class SyncService {
|
|
|
165
224
|
onlyFiles: options?.onlyFiles
|
|
166
225
|
});
|
|
167
226
|
const status = emptyStatus(deep);
|
|
227
|
+
status.ignoredLocal = ignoredLocal;
|
|
228
|
+
status.ignoredLocalTotal = ignoredLocalTotal;
|
|
229
|
+
status.ignoredLocalTotalByReason = ignoredLocalTotalByReason;
|
|
168
230
|
if (deep) {
|
|
169
231
|
status.remoteHashes = remoteHashes;
|
|
170
232
|
}
|
|
@@ -483,16 +545,36 @@ ${remoteContent}${remoteContent.endsWith("\n") ? "" : "\n"}${MERGE_MARKER_REMOTE
|
|
|
483
545
|
// own atomic operation, and `syncState` is saved in `finally` so
|
|
484
546
|
// already-successful items aren't re-uploaded next run. The
|
|
485
547
|
// caller surfaces this list and exits non-zero on non-empty.
|
|
486
|
-
failed: []
|
|
548
|
+
failed: [],
|
|
549
|
+
ignoredLocal: [],
|
|
550
|
+
ignoredLocalTotal: 0,
|
|
551
|
+
ignoredLocalTotalByReason: { unsupportedExtension: 0, blocklistedFolder: 0 }
|
|
487
552
|
};
|
|
488
553
|
const remoteFiles = (await this.farseerClient.listFiles()).filter((f) => !(0, import_helpers.isOsMetadataFile)(f.path));
|
|
489
554
|
const remoteFileMap = /* @__PURE__ */ new Map();
|
|
490
555
|
for (const file of remoteFiles) {
|
|
491
556
|
remoteFileMap.set(file.path, file);
|
|
492
557
|
}
|
|
493
|
-
const
|
|
558
|
+
const includeFoldersFromConfig = (0, import_configService.getSyncIncludes)(this.tenant)?.folders ?? [];
|
|
559
|
+
const skipHiddenDir = buildHiddenDirSkipper(options, includeFoldersFromConfig);
|
|
560
|
+
const allLocalFiles = (0, import_helpers.getAllFilesInDir)(filesDir, { shouldSkipDir: skipHiddenDir });
|
|
494
561
|
const localPresenceSet = new Set(allLocalFiles);
|
|
495
|
-
const inScopeFiles =
|
|
562
|
+
const inScopeFiles = [];
|
|
563
|
+
const suppressIgnoredLocal = (options?.onlyFiles?.length ?? 0) > 0;
|
|
564
|
+
for (const f of allLocalFiles) {
|
|
565
|
+
if (shouldIncludeFile(f, this.tenant, options)) {
|
|
566
|
+
inScopeFiles.push(f);
|
|
567
|
+
continue;
|
|
568
|
+
}
|
|
569
|
+
if (suppressIgnoredLocal) continue;
|
|
570
|
+
if ((0, import_helpers.isOsMetadataFile)(f) || (0, import_helpers.isHiddenFile)(f)) continue;
|
|
571
|
+
result.ignoredLocalTotal++;
|
|
572
|
+
const reason = classifyIgnoredFile(f);
|
|
573
|
+
result.ignoredLocalTotalByReason[reason]++;
|
|
574
|
+
if (result.ignoredLocal.length < import_syncReporting.IGNORED_LOCAL_CAP) {
|
|
575
|
+
result.ignoredLocal.push({ path: f, reason });
|
|
576
|
+
}
|
|
577
|
+
}
|
|
496
578
|
const localContents = /* @__PURE__ */ new Map();
|
|
497
579
|
for (const file of inScopeFiles) {
|
|
498
580
|
const fullPath = (0, import_helpers.safeResolveWithinBase)(filesDir, file);
|
|
@@ -851,6 +933,8 @@ ${remoteContent}${remoteContent.endsWith("\n") ? "" : "\n"}${MERGE_MARKER_REMOTE
|
|
|
851
933
|
MERGE_MARKER_REMOTE_END,
|
|
852
934
|
MERGE_MARKER_SEPARATOR,
|
|
853
935
|
SyncService,
|
|
936
|
+
buildHiddenDirSkipper,
|
|
937
|
+
classifyIgnoredFile,
|
|
854
938
|
isHiddenFile,
|
|
855
939
|
isOsMetadataFile,
|
|
856
940
|
shouldIncludeFile
|