{"id":28828999,"url":"https://github.com/forcedotcom/source-tracking","last_synced_at":"2026-04-11T21:24:35.855Z","repository":{"id":37551987,"uuid":"392055921","full_name":"forcedotcom/source-tracking","owner":"forcedotcom","description":"JavaScript library for tracking local and remote Salesforce metadata changes.","archived":false,"fork":false,"pushed_at":"2026-01-12T23:52:58.000Z","size":9395,"stargazers_count":28,"open_issues_count":8,"forks_count":17,"subscribers_count":10,"default_branch":"main","last_synced_at":"2026-01-13T03:18:27.835Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/forcedotcom.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-08-02T18:34:32.000Z","updated_at":"2026-01-12T23:53:02.000Z","dependencies_parsed_at":"2023-10-14T23:17:05.233Z","dependency_job_id":"99a49dce-7a52-4228-9e45-b67503e5bfc1","html_url":"https://github.com/forcedotcom/source-tracking","commit_stats":{"total_commits":1154,"total_committers":29,"mean_commits":"39.793103448275865","dds":0.6022530329289428,"last_synced_commit":"e4d571c0daba2aa62246a32fd9cf31de32ddc05c"},"previous_names":[],"tags_count":244,"template":false,"template_full_name":null,"purl":"pkg:github/forcedotcom/source-tracking","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/forcedotcom%2Fsource-tracking","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/forcedotcom%2Fsource-tracking/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/forcedotcom%2Fsource-tracking/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/forcedotcom%2Fsource-tracking/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/forcedotcom","download_url":"https://codeload.github.com/forcedotcom/source-tracking/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/forcedotcom%2Fsource-tracking/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28477210,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T03:13:13.607Z","status":"ssl_error","status_checked_at":"2026-01-16T03:11:47.863Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-19T05:11:18.269Z","updated_at":"2026-01-16T04:50:10.730Z","avatar_url":"https://github.com/forcedotcom.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# source-tracking\n\nJavaScript library for tracking local and remote Salesforce metadata changes.\n\n## Issues\n\nPlease report all issues to [issues only repository](https://github.com/forcedotcom/cli/issues).\n\n## Usage\n\nYou should use the class named SourceTracking.\n\nStart like this:\n\n```ts\nimport { SourceTracking } from '@salesforce/source-tracking';\n\nconst tracking = await SourceTracking.create({\n  org: this.org, // Org from sfdx-core\n  project: this.project, // Project from sfdx-core\n});\n```\n\nAny calls to methods on your instance of `tracking` will check to make sure that the appropriate remote/local files are up to date and loaded.\n\nIf you know you need to access remote or local, you can `ensure` them so that the FS and API operations don't happen multiple time (useful before calling operations that run in parallel)\n\n```ts\nawait tracking.ensureRemoteTracking(); // pass `true` if you know you need to force a re-query.\n// Example: the library got Remote Changes from the server, but you just did a deploy and know you need to get the updated SourceMembers.\n\nawait tracking.ensureLocalTracking();\n```\n\n## Use cases\n\n1. push,pull,status: `getConflicts()`, `getChanges()`\n1. deploy/retrieve: `updateLocalTracking()`,`updateRemoteTracking`\n\n### Deploy\n\n1. Once your SDR-based deploy finishes, you need to update the client's tracking files for both local (because local files went to the server) AND remote (because your deployment will result in new SourceMembers that need to be synced to the client).\n\n```ts\n// send in two arrays of Files (nonDeletes and Deletes)\nawait tracking.updateLocalTracking({\n  deployedFiles: ['force-app/main/default/classes/MyClass.cls', 'force-app/main/default/classes/MyClass.cls-meta.xml'],\n  deletedFiles: [],\n});\n\n// Pass an array of objects.  The type comes from SDR's FileResponse type, Success variant\n// By default, it'll poll the server to get your SourceMembers before committing all the changes to the tracking files\nawait tracking.updateRemoteTracking([\n  {\n    fullName: 'MyClass',\n    type: 'ApexClass',\n    state: 'Changed',\n    filePath: 'force-app/main/default/classes/MyClass.cls',\n  },\n  {\n    fullName: 'MyClass',\n    type: 'ApexClass',\n    state: 'Changed',\n    filePath: 'force-app/main/default/classes/MyClass.cls-meta.xml',\n  },\n]);\n```\n\n### Retrieve\n\nOnce your retrieve finishes, use the same updateLocalTracking as you did for deploy to commit the file changes to local and remote changes.\n\n```ts\n// By default, it'll poll the server to get your SourceMembers before committing all the changes to the tracking files.  If you already queried sourceMembers as part of conflict check, etc you can pass `false` to prevent polling the server again for SourceMembers\nawait tracking.updateRemoteTracking(\n  [\n    {\n      fullName: 'MyClass',\n      type: 'ApexClass',\n      state: 'Changed',\n      filePath: 'force-app/main/default/classes/MyClass.cls',\n    },\n    {\n      fullName: 'MyClass',\n      type: 'ApexClass',\n      state: 'Changed',\n      filePath: 'force-app/main/default/classes/MyClass.cls-meta.xml',\n    },\n  ],\n  false\n);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fforcedotcom%2Fsource-tracking","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fforcedotcom%2Fsource-tracking","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fforcedotcom%2Fsource-tracking/lists"}