sync-worktrees 3.0.1 → 3.1.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 +43 -12
- package/dist/index.js.map +2 -2
- package/dist/mcp-server.js +235 -93
- package/dist/mcp-server.js.map +4 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -83,6 +83,11 @@ var PATH_CONSTANTS = {
|
|
|
83
83
|
GIT_DIR: ".git",
|
|
84
84
|
README: "README"
|
|
85
85
|
};
|
|
86
|
+
var CONFIG_FILE_NAMES = [
|
|
87
|
+
"sync-worktrees.config.js",
|
|
88
|
+
"sync-worktrees.config.mjs",
|
|
89
|
+
"sync-worktrees.config.cjs"
|
|
90
|
+
];
|
|
86
91
|
var METADATA_CONSTANTS = {
|
|
87
92
|
MAX_HISTORY_ENTRIES: 10,
|
|
88
93
|
METADATA_FILENAME: "sync-metadata.json",
|
|
@@ -144,6 +149,24 @@ function filterBranchesByName(branches, include, exclude) {
|
|
|
144
149
|
|
|
145
150
|
// src/services/config-loader.service.ts
|
|
146
151
|
var ConfigLoaderService = class {
|
|
152
|
+
async findConfigUpward(startDir) {
|
|
153
|
+
let current = path.resolve(startDir);
|
|
154
|
+
const root = path.parse(current).root;
|
|
155
|
+
while (true) {
|
|
156
|
+
for (const name of CONFIG_FILE_NAMES) {
|
|
157
|
+
const candidate = path.join(current, name);
|
|
158
|
+
try {
|
|
159
|
+
await fs.access(candidate);
|
|
160
|
+
return candidate;
|
|
161
|
+
} catch {
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
if (current === root) return null;
|
|
165
|
+
const parent = path.dirname(current);
|
|
166
|
+
if (parent === current) return null;
|
|
167
|
+
current = parent;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
147
170
|
async loadConfigFile(configPath) {
|
|
148
171
|
const absolutePath = path.resolve(configPath);
|
|
149
172
|
try {
|
|
@@ -2447,6 +2470,7 @@ var WorktreeStatusService = class {
|
|
|
2447
2470
|
if (hasUnpushedCommits) reasons.push("unpushed commits");
|
|
2448
2471
|
if (hasOperationInProgress) reasons.push("operation in progress");
|
|
2449
2472
|
if (hasModifiedSubmodules) reasons.push("modified submodules");
|
|
2473
|
+
if (upstreamGone) reasons.push("upstream gone");
|
|
2450
2474
|
const canRemove = isClean && !hasUnpushedCommits && !hasOperationInProgress && !hasModifiedSubmodules;
|
|
2451
2475
|
const details = includeDetails ? this.buildStatusDetails(snap) : void 0;
|
|
2452
2476
|
return {
|
|
@@ -4274,13 +4298,17 @@ var HookExecutionService = class {
|
|
|
4274
4298
|
// src/utils/disk-space.ts
|
|
4275
4299
|
import fastFolderSize from "fast-folder-size";
|
|
4276
4300
|
async function calculateDirectorySize(dirPath) {
|
|
4277
|
-
return new Promise((resolve8) => {
|
|
4301
|
+
return new Promise((resolve8, reject) => {
|
|
4278
4302
|
fastFolderSize(dirPath, (err, bytes) => {
|
|
4279
|
-
if (err
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
|
|
4303
|
+
if (err) {
|
|
4304
|
+
reject(err);
|
|
4305
|
+
return;
|
|
4306
|
+
}
|
|
4307
|
+
if (bytes === void 0) {
|
|
4308
|
+
reject(new Error(`fast-folder-size returned no bytes for ${dirPath}`));
|
|
4309
|
+
return;
|
|
4283
4310
|
}
|
|
4311
|
+
resolve8(bytes);
|
|
4284
4312
|
});
|
|
4285
4313
|
});
|
|
4286
4314
|
}
|
|
@@ -4297,12 +4325,16 @@ async function calculateSyncDiskSpace(repoPaths, worktreeDirs) {
|
|
|
4297
4325
|
try {
|
|
4298
4326
|
let totalBytes = 0;
|
|
4299
4327
|
for (const repoPath of repoPaths) {
|
|
4300
|
-
|
|
4301
|
-
|
|
4328
|
+
try {
|
|
4329
|
+
totalBytes += await calculateDirectorySize(repoPath);
|
|
4330
|
+
} catch {
|
|
4331
|
+
}
|
|
4302
4332
|
}
|
|
4303
4333
|
for (const worktreeDir of worktreeDirs) {
|
|
4304
|
-
|
|
4305
|
-
|
|
4334
|
+
try {
|
|
4335
|
+
totalBytes += await calculateDirectorySize(worktreeDir);
|
|
4336
|
+
} catch {
|
|
4337
|
+
}
|
|
4306
4338
|
}
|
|
4307
4339
|
return formatBytes(totalBytes);
|
|
4308
4340
|
} catch (error) {
|
|
@@ -4742,7 +4774,7 @@ var InteractiveUIService = class {
|
|
|
4742
4774
|
originalBranch = match[2];
|
|
4743
4775
|
}
|
|
4744
4776
|
}
|
|
4745
|
-
const sizeBytes = await calculateDirectorySize(fullPath);
|
|
4777
|
+
const sizeBytes = await calculateDirectorySize(fullPath).catch(() => 0);
|
|
4746
4778
|
const sizeFormatted = formatBytes(sizeBytes);
|
|
4747
4779
|
return {
|
|
4748
4780
|
name: entry.name,
|
|
@@ -5219,9 +5251,8 @@ export default ${serializeToESM(configObject)};
|
|
|
5219
5251
|
function getDefaultConfigPath() {
|
|
5220
5252
|
return path9.join(process.cwd(), "sync-worktrees.config.js");
|
|
5221
5253
|
}
|
|
5222
|
-
var CONFIG_CANDIDATES = ["sync-worktrees.config.js", "sync-worktrees.config.mjs", "sync-worktrees.config.cjs"];
|
|
5223
5254
|
async function findConfigInCwd(cwd = process.cwd()) {
|
|
5224
|
-
for (const name of
|
|
5255
|
+
for (const name of CONFIG_FILE_NAMES) {
|
|
5225
5256
|
const full = path9.join(cwd, name);
|
|
5226
5257
|
try {
|
|
5227
5258
|
await fs9.access(full);
|