sync-worktrees 3.5.0 → 3.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +29 -9
- package/dist/index.js.map +2 -2
- package/dist/mcp-server.js +29 -9
- package/dist/mcp-server.js.map +2 -2
- package/package.json +1 -1
package/dist/mcp-server.js
CHANGED
|
@@ -27,7 +27,8 @@ var GIT_CONSTANTS = {
|
|
|
27
27
|
REMOTES: "refs/remotes/origin",
|
|
28
28
|
REMOTES_ORIGIN: "refs/remotes/origin/*"
|
|
29
29
|
},
|
|
30
|
-
FETCH_CONFIG: "+refs/heads/*:refs/remotes/origin/*"
|
|
30
|
+
FETCH_CONFIG: "+refs/heads/*:refs/remotes/origin/*",
|
|
31
|
+
PROGRESS_BUCKET_PERCENT: 25
|
|
31
32
|
};
|
|
32
33
|
var GIT_OPERATIONS = {
|
|
33
34
|
MERGE_HEAD: "MERGE_HEAD",
|
|
@@ -1827,13 +1828,33 @@ var GitService = class {
|
|
|
1827
1828
|
const key = `${path6.resolve(dirPath)}::${useLfsSkip ? "1" : "0"}`;
|
|
1828
1829
|
let git = this.gitInstances.get(key);
|
|
1829
1830
|
if (!git) {
|
|
1830
|
-
const
|
|
1831
|
-
const base = block > 0 ? simpleGit4(dirPath, { timeout: { block } }) : simpleGit4(dirPath);
|
|
1831
|
+
const base = simpleGit4(dirPath, this.buildSimpleGitOptions(this.getFetchTimeoutMs()));
|
|
1832
1832
|
git = useLfsSkip ? base.env({ [ENV_CONSTANTS.GIT_LFS_SKIP_SMUDGE]: "1" }) : base;
|
|
1833
1833
|
this.gitInstances.set(key, git);
|
|
1834
1834
|
}
|
|
1835
1835
|
return git;
|
|
1836
1836
|
}
|
|
1837
|
+
buildSimpleGitOptions(blockMs) {
|
|
1838
|
+
const options = { progress: this.makeProgressHandler() };
|
|
1839
|
+
if (blockMs > 0) options.timeout = { block: blockMs };
|
|
1840
|
+
return options;
|
|
1841
|
+
}
|
|
1842
|
+
makeProgressHandler() {
|
|
1843
|
+
const lastBucket = /* @__PURE__ */ new Map();
|
|
1844
|
+
return (event) => {
|
|
1845
|
+
if (event.method !== "fetch" && event.method !== "clone" && event.method !== "pull") return;
|
|
1846
|
+
const key = `${event.method}:${event.stage}`;
|
|
1847
|
+
const bucket = Math.floor(event.progress / GIT_CONSTANTS.PROGRESS_BUCKET_PERCENT);
|
|
1848
|
+
let last = lastBucket.get(key) ?? -1;
|
|
1849
|
+
if (bucket < last) {
|
|
1850
|
+
last = -1;
|
|
1851
|
+
}
|
|
1852
|
+
if (bucket <= last && event.progress < 100) return;
|
|
1853
|
+
lastBucket.set(key, bucket);
|
|
1854
|
+
const total = event.total > 0 ? `${event.processed}/${event.total}` : `${event.processed}`;
|
|
1855
|
+
this.logger.info(` \u21B3 ${event.method} ${event.stage}: ${event.progress}% (${total})`);
|
|
1856
|
+
};
|
|
1857
|
+
}
|
|
1837
1858
|
updateLogger(logger) {
|
|
1838
1859
|
this.logger = logger;
|
|
1839
1860
|
this.sparseCheckoutService.updateLogger(logger);
|
|
@@ -1845,10 +1866,9 @@ var GitService = class {
|
|
|
1845
1866
|
} catch {
|
|
1846
1867
|
this.logger.info(`Cloning from "${repoUrl}" as bare repository into "${this.bareRepoPath}"...`);
|
|
1847
1868
|
await fs4.mkdir(path6.dirname(this.bareRepoPath), { recursive: true });
|
|
1848
|
-
const
|
|
1849
|
-
const cloneBase = cloneBlock > 0 ? simpleGit4({ timeout: { block: cloneBlock } }) : simpleGit4();
|
|
1869
|
+
const cloneBase = simpleGit4(this.buildSimpleGitOptions(this.getCloneTimeoutMs()));
|
|
1850
1870
|
const cloneGit = this.isLfsSkipEnabled() ? cloneBase.env({ [ENV_CONSTANTS.GIT_LFS_SKIP_SMUDGE]: "1" }) : cloneBase;
|
|
1851
|
-
await cloneGit.clone(repoUrl, this.bareRepoPath, ["--bare"]);
|
|
1871
|
+
await cloneGit.clone(repoUrl, this.bareRepoPath, ["--bare", "--progress"]);
|
|
1852
1872
|
this.logger.info("\u2705 Clone successful.");
|
|
1853
1873
|
}
|
|
1854
1874
|
const bareGit = this.getCachedGit(this.bareRepoPath);
|
|
@@ -1862,7 +1882,7 @@ var GitService = class {
|
|
|
1862
1882
|
await bareGit.addConfig("remote.origin.fetch", "+refs/heads/*:refs/remotes/origin/*");
|
|
1863
1883
|
}
|
|
1864
1884
|
this.logger.info("Fetching remote branches...");
|
|
1865
|
-
await bareGit.fetch(["--all"]);
|
|
1885
|
+
await bareGit.fetch(["--all", "--progress"]);
|
|
1866
1886
|
this.defaultBranch = await this.detectDefaultBranch(bareGit);
|
|
1867
1887
|
this.mainWorktreePath = path6.join(this.config.worktreeDir, this.defaultBranch);
|
|
1868
1888
|
let needsMainWorktree = true;
|
|
@@ -1940,12 +1960,12 @@ var GitService = class {
|
|
|
1940
1960
|
this.assertInitialized();
|
|
1941
1961
|
this.logger.info("Fetching latest data from remote...");
|
|
1942
1962
|
const git = this.getCachedGit(this.mainWorktreePath, this.isLfsSkipEnabled());
|
|
1943
|
-
await git.fetch(["--all", "--prune"]);
|
|
1963
|
+
await git.fetch(["--all", "--prune", "--progress"]);
|
|
1944
1964
|
}
|
|
1945
1965
|
async fetchBranch(branchName) {
|
|
1946
1966
|
this.assertInitialized();
|
|
1947
1967
|
const git = this.getCachedGit(this.mainWorktreePath, this.isLfsSkipEnabled());
|
|
1948
|
-
await git.fetch(["origin", branchName, "--prune"]);
|
|
1968
|
+
await git.fetch(["origin", branchName, "--prune", "--progress"]);
|
|
1949
1969
|
}
|
|
1950
1970
|
assertInitialized() {
|
|
1951
1971
|
if (!this.git) {
|