sync-worktrees 1.8.0 ā 2.0.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/README.md +4 -4
- package/dist/index.js +2862 -203
- package/dist/index.js.map +7 -1
- package/package.json +19 -11
- package/dist/constants.d.ts +0 -54
- package/dist/constants.d.ts.map +0 -1
- package/dist/constants.js +0 -66
- package/dist/constants.js.map +0 -1
- package/dist/errors/index.d.ts +0 -51
- package/dist/errors/index.d.ts.map +0 -1
- package/dist/errors/index.js +0 -119
- package/dist/errors/index.js.map +0 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.d.ts.map +0 -1
- package/dist/services/config-loader.service.d.ts +0 -9
- package/dist/services/config-loader.service.d.ts.map +0 -1
- package/dist/services/config-loader.service.js +0 -193
- package/dist/services/config-loader.service.js.map +0 -1
- package/dist/services/git.service.d.ts +0 -51
- package/dist/services/git.service.d.ts.map +0 -1
- package/dist/services/git.service.js +0 -749
- package/dist/services/git.service.js.map +0 -1
- package/dist/services/path-resolution.service.d.ts +0 -7
- package/dist/services/path-resolution.service.d.ts.map +0 -1
- package/dist/services/path-resolution.service.js +0 -58
- package/dist/services/path-resolution.service.js.map +0 -1
- package/dist/services/worktree-metadata.service.d.ts +0 -22
- package/dist/services/worktree-metadata.service.d.ts.map +0 -1
- package/dist/services/worktree-metadata.service.js +0 -276
- package/dist/services/worktree-metadata.service.js.map +0 -1
- package/dist/services/worktree-status.service.d.ts +0 -28
- package/dist/services/worktree-status.service.d.ts.map +0 -1
- package/dist/services/worktree-status.service.js +0 -229
- package/dist/services/worktree-status.service.js.map +0 -1
- package/dist/services/worktree-sync.service.d.ts +0 -17
- package/dist/services/worktree-sync.service.d.ts.map +0 -1
- package/dist/services/worktree-sync.service.js +0 -454
- package/dist/services/worktree-sync.service.js.map +0 -1
- package/dist/types/index.d.ts +0 -32
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -3
- package/dist/types/index.js.map +0 -1
- package/dist/types/sync-metadata.d.ts +0 -16
- package/dist/types/sync-metadata.d.ts.map +0 -1
- package/dist/types/sync-metadata.js +0 -3
- package/dist/types/sync-metadata.js.map +0 -1
- package/dist/utils/cli.d.ts +0 -14
- package/dist/utils/cli.d.ts.map +0 -1
- package/dist/utils/cli.js +0 -117
- package/dist/utils/cli.js.map +0 -1
- package/dist/utils/config-generator.d.ts +0 -4
- package/dist/utils/config-generator.d.ts.map +0 -1
- package/dist/utils/config-generator.js +0 -112
- package/dist/utils/config-generator.js.map +0 -1
- package/dist/utils/date-filter.d.ts +0 -10
- package/dist/utils/date-filter.d.ts.map +0 -1
- package/dist/utils/date-filter.js +0 -47
- package/dist/utils/date-filter.js.map +0 -1
- package/dist/utils/git-url.d.ts +0 -15
- package/dist/utils/git-url.d.ts.map +0 -1
- package/dist/utils/git-url.js +0 -46
- package/dist/utils/git-url.js.map +0 -1
- package/dist/utils/interactive.d.ts +0 -3
- package/dist/utils/interactive.d.ts.map +0 -1
- package/dist/utils/interactive.js +0 -195
- package/dist/utils/interactive.js.map +0 -1
- package/dist/utils/lfs-error.d.ts +0 -23
- package/dist/utils/lfs-error.d.ts.map +0 -1
- package/dist/utils/lfs-error.js +0 -45
- package/dist/utils/lfs-error.js.map +0 -1
- package/dist/utils/retry.d.ts +0 -15
- package/dist/utils/retry.d.ts.map +0 -1
- package/dist/utils/retry.js +0 -78
- package/dist/utils/retry.js.map +0 -1
package/dist/utils/cli.js
DELETED
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.parseArguments = parseArguments;
|
|
7
|
-
exports.isInteractiveMode = isInteractiveMode;
|
|
8
|
-
exports.reconstructCliCommand = reconstructCliCommand;
|
|
9
|
-
const yargs_1 = __importDefault(require("yargs"));
|
|
10
|
-
const helpers_1 = require("yargs/helpers");
|
|
11
|
-
function parseArguments() {
|
|
12
|
-
const argv = (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv))
|
|
13
|
-
.option("config", {
|
|
14
|
-
alias: "c",
|
|
15
|
-
type: "string",
|
|
16
|
-
description: "Path to JavaScript config file",
|
|
17
|
-
})
|
|
18
|
-
.option("filter", {
|
|
19
|
-
alias: "f",
|
|
20
|
-
type: "string",
|
|
21
|
-
description: "Filter repositories by name (supports wildcards and comma-separated values)",
|
|
22
|
-
})
|
|
23
|
-
.option("list", {
|
|
24
|
-
alias: "l",
|
|
25
|
-
type: "boolean",
|
|
26
|
-
description: "List configured repositories and exit",
|
|
27
|
-
default: false,
|
|
28
|
-
})
|
|
29
|
-
.option("bareRepoDir", {
|
|
30
|
-
alias: "b",
|
|
31
|
-
type: "string",
|
|
32
|
-
description: "Directory for storing bare repositories (default: .bare/<repo-name>).",
|
|
33
|
-
})
|
|
34
|
-
.option("repoUrl", {
|
|
35
|
-
alias: "u",
|
|
36
|
-
type: "string",
|
|
37
|
-
description: "Git repository URL (e.g., SSH or HTTPS).",
|
|
38
|
-
})
|
|
39
|
-
.option("worktreeDir", {
|
|
40
|
-
alias: "w",
|
|
41
|
-
type: "string",
|
|
42
|
-
description: "Absolute path to the directory for storing worktrees.",
|
|
43
|
-
})
|
|
44
|
-
.option("cronSchedule", {
|
|
45
|
-
alias: "s",
|
|
46
|
-
type: "string",
|
|
47
|
-
description: "Cron schedule for how often to run the sync.",
|
|
48
|
-
default: "0 * * * *",
|
|
49
|
-
})
|
|
50
|
-
.option("runOnce", {
|
|
51
|
-
type: "boolean",
|
|
52
|
-
description: "Run the sync process once and then exit, without scheduling.",
|
|
53
|
-
default: false,
|
|
54
|
-
})
|
|
55
|
-
.option("branchMaxAge", {
|
|
56
|
-
alias: "a",
|
|
57
|
-
type: "string",
|
|
58
|
-
description: "Maximum age of branches to sync (e.g., '30d', '6m', '1y').",
|
|
59
|
-
})
|
|
60
|
-
.option("skipLfs", {
|
|
61
|
-
type: "boolean",
|
|
62
|
-
description: "Skip Git LFS downloads when fetching and creating worktrees.",
|
|
63
|
-
default: false,
|
|
64
|
-
})
|
|
65
|
-
.option("no-update-existing", {
|
|
66
|
-
type: "boolean",
|
|
67
|
-
description: "Disable automatic updates of existing worktrees.",
|
|
68
|
-
default: false,
|
|
69
|
-
})
|
|
70
|
-
.help()
|
|
71
|
-
.alias("help", "h")
|
|
72
|
-
.parseSync();
|
|
73
|
-
return {
|
|
74
|
-
config: argv.config,
|
|
75
|
-
filter: argv.filter,
|
|
76
|
-
list: argv.list,
|
|
77
|
-
repoUrl: argv.repoUrl,
|
|
78
|
-
worktreeDir: argv.worktreeDir,
|
|
79
|
-
cronSchedule: argv.cronSchedule,
|
|
80
|
-
runOnce: argv.runOnce,
|
|
81
|
-
bareRepoDir: argv.bareRepoDir,
|
|
82
|
-
branchMaxAge: argv.branchMaxAge,
|
|
83
|
-
skipLfs: argv.skipLfs,
|
|
84
|
-
noUpdateExisting: argv["no-update-existing"],
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
function isInteractiveMode(config) {
|
|
88
|
-
return !config.repoUrl || !config.worktreeDir;
|
|
89
|
-
}
|
|
90
|
-
function reconstructCliCommand(config) {
|
|
91
|
-
const executable = process.argv[1].includes("ts-node") ? "ts-node src/index.ts" : "sync-worktrees";
|
|
92
|
-
const args = [];
|
|
93
|
-
args.push(`--repoUrl "${config.repoUrl}"`);
|
|
94
|
-
if (config.worktreeDir) {
|
|
95
|
-
args.push(`--worktreeDir "${config.worktreeDir}"`);
|
|
96
|
-
}
|
|
97
|
-
if (config.bareRepoDir) {
|
|
98
|
-
args.push(`--bareRepoDir "${config.bareRepoDir}"`);
|
|
99
|
-
}
|
|
100
|
-
if (config.cronSchedule && config.cronSchedule !== "0 * * * *") {
|
|
101
|
-
args.push(`--cronSchedule "${config.cronSchedule}"`);
|
|
102
|
-
}
|
|
103
|
-
if (config.runOnce) {
|
|
104
|
-
args.push("--runOnce");
|
|
105
|
-
}
|
|
106
|
-
if (config.branchMaxAge) {
|
|
107
|
-
args.push(`--branchMaxAge "${config.branchMaxAge}"`);
|
|
108
|
-
}
|
|
109
|
-
if (config.skipLfs) {
|
|
110
|
-
args.push("--skip-lfs");
|
|
111
|
-
}
|
|
112
|
-
if (config.updateExistingWorktrees === false) {
|
|
113
|
-
args.push("--no-update-existing");
|
|
114
|
-
}
|
|
115
|
-
return `${executable} ${args.join(" ")}`;
|
|
116
|
-
}
|
|
117
|
-
//# sourceMappingURL=cli.js.map
|
package/dist/utils/cli.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/utils/cli.ts"],"names":[],"mappings":";;;;;AAeA,wCA4EC;AAED,8CAEC;AAED,sDAoCC;AArID,kDAA0B;AAC1B,2CAAwC;AAcxC,SAAgB,cAAc;IAC5B,MAAM,IAAI,GAAG,IAAA,eAAK,EAAC,IAAA,iBAAO,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC;SACtC,MAAM,CAAC,QAAQ,EAAE;QAChB,KAAK,EAAE,GAAG;QACV,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,gCAAgC;KAC9C,CAAC;SACD,MAAM,CAAC,QAAQ,EAAE;QAChB,KAAK,EAAE,GAAG;QACV,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,6EAA6E;KAC3F,CAAC;SACD,MAAM,CAAC,MAAM,EAAE;QACd,KAAK,EAAE,GAAG;QACV,IAAI,EAAE,SAAS;QACf,WAAW,EAAE,uCAAuC;QACpD,OAAO,EAAE,KAAK;KACf,CAAC;SACD,MAAM,CAAC,aAAa,EAAE;QACrB,KAAK,EAAE,GAAG;QACV,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,uEAAuE;KACrF,CAAC;SACD,MAAM,CAAC,SAAS,EAAE;QACjB,KAAK,EAAE,GAAG;QACV,IAAI,EAAE,QA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AM,CAAC,uBAAuB,KAAK,KAAK,EAAE,CAAC;QAC7C,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;IACpC,CAAC;IAED,OAAO,GAAG,UAAU,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;AAC3C,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config-generator.d.ts","sourceRoot":"","sources":["../../src/utils/config-generator.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AA2CvC,wBAAsB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA2C1F;AAED,wBAAgB,oBAAoB,IAAI,MAAM,CAE7C"}
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.generateConfigFile = generateConfigFile;
|
|
37
|
-
exports.getDefaultConfigPath = getDefaultConfigPath;
|
|
38
|
-
const fs = __importStar(require("fs/promises"));
|
|
39
|
-
const path = __importStar(require("path"));
|
|
40
|
-
const git_url_1 = require("./git-url");
|
|
41
|
-
/**
|
|
42
|
-
* Serializes a JavaScript object to a clean module.exports format
|
|
43
|
-
*/
|
|
44
|
-
function serializeToModuleExports(obj, indent = 0) {
|
|
45
|
-
const spaces = " ".repeat(indent);
|
|
46
|
-
const innerSpaces = " ".repeat(indent + 2);
|
|
47
|
-
if (typeof obj === "string") {
|
|
48
|
-
return `"${obj}"`;
|
|
49
|
-
}
|
|
50
|
-
if (typeof obj === "number" || typeof obj === "boolean") {
|
|
51
|
-
return String(obj);
|
|
52
|
-
}
|
|
53
|
-
if (Array.isArray(obj)) {
|
|
54
|
-
if (obj.length === 0)
|
|
55
|
-
return "[]";
|
|
56
|
-
const items = obj.map((item) => `${innerSpaces}${serializeToModuleExports(item, indent + 2)}`).join(",\n");
|
|
57
|
-
return `[\n${items}\n${spaces}]`;
|
|
58
|
-
}
|
|
59
|
-
if (obj && typeof obj === "object") {
|
|
60
|
-
const entries = Object.entries(obj)
|
|
61
|
-
.filter(([_, value]) => value !== undefined)
|
|
62
|
-
.map(([key, value]) => {
|
|
63
|
-
const serializedValue = serializeToModuleExports(value, indent + 2);
|
|
64
|
-
return `${innerSpaces}${key}: ${serializedValue}`;
|
|
65
|
-
});
|
|
66
|
-
if (entries.length === 0)
|
|
67
|
-
return "{}";
|
|
68
|
-
return `{\n${entries.join(",\n")}\n${spaces}}`;
|
|
69
|
-
}
|
|
70
|
-
return String(obj);
|
|
71
|
-
}
|
|
72
|
-
async function generateConfigFile(config, configPath) {
|
|
73
|
-
const configDir = path.dirname(configPath);
|
|
74
|
-
await fs.mkdir(configDir, { recursive: true });
|
|
75
|
-
// Calculate relative paths from config file location
|
|
76
|
-
const worktreeDirRelative = path.relative(configDir, config.worktreeDir);
|
|
77
|
-
const useRelativeWorktree = !worktreeDirRelative.startsWith("../../../");
|
|
78
|
-
const repoName = (0, git_url_1.extractRepoNameFromUrl)(config.repoUrl);
|
|
79
|
-
// Build the repository object
|
|
80
|
-
const repository = {
|
|
81
|
-
name: repoName,
|
|
82
|
-
repoUrl: config.repoUrl,
|
|
83
|
-
worktreeDir: useRelativeWorktree ? `./${worktreeDirRelative}` : config.worktreeDir,
|
|
84
|
-
};
|
|
85
|
-
// Add bareRepoDir if provided
|
|
86
|
-
if (config.bareRepoDir) {
|
|
87
|
-
const bareRepoDirRelative = path.relative(configDir, config.bareRepoDir);
|
|
88
|
-
const useRelativeBare = !bareRepoDirRelative.startsWith("../../../");
|
|
89
|
-
repository.bareRepoDir = useRelativeBare ? `./${bareRepoDirRelative}` : config.bareRepoDir;
|
|
90
|
-
}
|
|
91
|
-
// Build the complete config object
|
|
92
|
-
const configObject = {
|
|
93
|
-
defaults: {
|
|
94
|
-
cronSchedule: config.cronSchedule,
|
|
95
|
-
runOnce: config.runOnce,
|
|
96
|
-
},
|
|
97
|
-
repositories: [repository],
|
|
98
|
-
};
|
|
99
|
-
// Generate the config file content
|
|
100
|
-
const configContent = `/**
|
|
101
|
-
* Sync-worktrees configuration file
|
|
102
|
-
* Generated on ${new Date().toISOString()}
|
|
103
|
-
*/
|
|
104
|
-
|
|
105
|
-
module.exports = ${serializeToModuleExports(configObject)};
|
|
106
|
-
`;
|
|
107
|
-
await fs.writeFile(configPath, configContent, "utf-8");
|
|
108
|
-
}
|
|
109
|
-
function getDefaultConfigPath() {
|
|
110
|
-
return path.join(process.cwd(), "sync-worktrees.config.js");
|
|
111
|
-
}
|
|
112
|
-
//# sourceMappingURL=config-generator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config-generator.js","sourceRoot":"","sources":["../../src/utils/config-generator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDA,gDA2CC;AAED,oDAEC;AA/FD,gDAAkC;AAClC,2CAA6B;AAE7B,uCAAmD;AASnD;;GAEG;AACH,SAAS,wBAAwB,CAAC,GAAsB,EAAE,SAAiB,CAAC;IAC1E,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAClC,MAAM,WAAW,GAAG,GAAG,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAE3C,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QAC5B,OAAO,IAAI,GAAG,GAAG,CAAC;IACpB,CAAC;IAED,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,OAAO,GAAG,KAAK,SAAS,EAAE,CAAC;QACxD,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;IACrB,CAAC;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QACvB,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC;QAClC,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,WAAW,GAAG,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK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,UAAU,GAAuB;QACrC,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,WAAW,EAAE,mBAAmB,CAAC,CAAC,CAAC,KAAK,mBAAmB,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW;KACnF,CAAC;IAEF,8BAA8B;IAC9B,IAAI,MAAM,CAAC,WAAW,EAAE,CAAC;QACvB,MAAM,mBAAmB,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;QACzE,MAAM,eAAe,GAAG,CAAC,mBAAmB,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;QACrE,UAAU,CAAC,WAAW,GAAG,eAAe,CAAC,CAAC,CAAC,KAAK,mBAAmB,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC;IAC7F,CAAC;IAED,mCAAmC;IACnC,MAAM,YAAY,GAAG;QACnB,QAAQ,EAAE;YACR,YAAY,EAAE,MAAM,CAAC,YAAY;YACjC,OAAO,EAAE,MAAM,CAAC,OAAO;SACxB;QACD,YAAY,EAAE,CAAC,UAAU,CAAC;KAC3B,CAAC;IAEF,mCAAmC;IACnC,MAAM,aAAa,GAAG;;kBAEN,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;;;mBAGvB,wBAAwB,CAAC,YAAY,CAAC;CACxD,CAAC;IAEA,MAAM,EAAE,CAAC,SAAS,CAAC,UAAU,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC;AACzD,CAAC;AAED,SAAgB,oBAAoB;IAClC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,0BAA0B,CAAC,CAAC;AAC9D,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare function parseDuration(durationStr: string): number | null;
|
|
2
|
-
export declare function filterBranchesByAge(branches: {
|
|
3
|
-
branch: string;
|
|
4
|
-
lastActivity: Date;
|
|
5
|
-
}[], maxAge: string): {
|
|
6
|
-
branch: string;
|
|
7
|
-
lastActivity: Date;
|
|
8
|
-
}[];
|
|
9
|
-
export declare function formatDuration(durationStr: string): string;
|
|
10
|
-
//# sourceMappingURL=date-filter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"date-filter.d.ts","sourceRoot":"","sources":["../../src/utils/date-filter.ts"],"names":[],"mappings":"AAAA,wBAAgB,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAkBhE;AAED,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,IAAI,CAAA;CAAE,EAAE,EAClD,MAAM,EAAE,MAAM,GACb;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,IAAI,CAAA;CAAE,EAAE,CAU1C;AAED,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAkB1D"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseDuration = parseDuration;
|
|
4
|
-
exports.filterBranchesByAge = filterBranchesByAge;
|
|
5
|
-
exports.formatDuration = formatDuration;
|
|
6
|
-
function parseDuration(durationStr) {
|
|
7
|
-
const match = durationStr.match(/^(\d+)([hdwmy])$/);
|
|
8
|
-
if (!match) {
|
|
9
|
-
return null;
|
|
10
|
-
}
|
|
11
|
-
const value = parseInt(match[1], 10);
|
|
12
|
-
const unit = match[2];
|
|
13
|
-
const multipliers = {
|
|
14
|
-
h: 60 * 60 * 1000, // hours
|
|
15
|
-
d: 24 * 60 * 60 * 1000, // days
|
|
16
|
-
w: 7 * 24 * 60 * 60 * 1000, // weeks
|
|
17
|
-
m: 30 * 24 * 60 * 60 * 1000, // months (approximate)
|
|
18
|
-
y: 365 * 24 * 60 * 60 * 1000, // years (approximate)
|
|
19
|
-
};
|
|
20
|
-
return value * multipliers[unit];
|
|
21
|
-
}
|
|
22
|
-
function filterBranchesByAge(branches, maxAge) {
|
|
23
|
-
const maxAgeMs = parseDuration(maxAge);
|
|
24
|
-
if (maxAgeMs === null) {
|
|
25
|
-
console.warn(`Invalid duration format: ${maxAge}. Using all branches.`);
|
|
26
|
-
return branches;
|
|
27
|
-
}
|
|
28
|
-
const cutoffDate = new Date(Date.now() - maxAgeMs);
|
|
29
|
-
return branches.filter(({ lastActivity }) => lastActivity >= cutoffDate);
|
|
30
|
-
}
|
|
31
|
-
function formatDuration(durationStr) {
|
|
32
|
-
const match = durationStr.match(/^(\d+)([hdwmy])$/);
|
|
33
|
-
if (!match) {
|
|
34
|
-
return durationStr;
|
|
35
|
-
}
|
|
36
|
-
const value = parseInt(match[1], 10);
|
|
37
|
-
const unit = match[2];
|
|
38
|
-
const unitNames = {
|
|
39
|
-
h: value === 1 ? "hour" : "hours",
|
|
40
|
-
d: value === 1 ? "day" : "days",
|
|
41
|
-
w: value === 1 ? "week" : "weeks",
|
|
42
|
-
m: value === 1 ? "month" : "months",
|
|
43
|
-
y: value === 1 ? "year" : "years",
|
|
44
|
-
};
|
|
45
|
-
return `${value} ${unitNames[unit]}`;
|
|
46
|
-
}
|
|
47
|
-
//# sourceMappingURL=date-filter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"date-filter.js","sourceRoot":"","sources":["../../src/utils/date-filter.ts"],"names":[],"mappings":";;AAAA,sCAkBC;AAED,kDAaC;AAED,wCAkBC;AArDD,SAAgB,aAAa,CAAC,WAAmB;IAC/C,MAAM,KAAK,GAAG,WAAW,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;IACpD,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACrC,MAAM,IAAI,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E,EAAE,CAAC,CAAC;IACrC,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IAEtB,MAAM,SAAS,GAA2B;QACxC,CAAC,EAAE,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO;QACjC,CAAC,EAAE,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM;QAC/B,CAAC,EAAE,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO;QACjC,CAAC,EAAE,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ;QACnC,CAAC,EAAE,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO;KAClC,CAAC;IAEF,OAAO,GAAG,KAAK,IAAI,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;AACvC,CAAC"}
|
package/dist/utils/git-url.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Extracts the repository name from a Git URL
|
|
3
|
-
* @param gitUrl - The Git URL (HTTPS or SSH format)
|
|
4
|
-
* @returns The repository name without .git extension
|
|
5
|
-
* @throws Error if the URL format is invalid
|
|
6
|
-
*/
|
|
7
|
-
export declare function extractRepoNameFromUrl(gitUrl: string): string;
|
|
8
|
-
/**
|
|
9
|
-
* Generates the default bare repository directory path
|
|
10
|
-
* @param repoUrl - The Git repository URL
|
|
11
|
-
* @param baseDir - The base directory for bare repos (default: .bare)
|
|
12
|
-
* @returns The path to the bare repository
|
|
13
|
-
*/
|
|
14
|
-
export declare function getDefaultBareRepoDir(repoUrl: string, baseDir?: string): string;
|
|
15
|
-
//# sourceMappingURL=git-url.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"git-url.d.ts","sourceRoot":"","sources":["../../src/utils/git-url.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CA6B7D;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,MAAgB,GAAG,MAAM,CAGxF"}
|
package/dist/utils/git-url.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.extractRepoNameFromUrl = extractRepoNameFromUrl;
|
|
4
|
-
exports.getDefaultBareRepoDir = getDefaultBareRepoDir;
|
|
5
|
-
/**
|
|
6
|
-
* Extracts the repository name from a Git URL
|
|
7
|
-
* @param gitUrl - The Git URL (HTTPS or SSH format)
|
|
8
|
-
* @returns The repository name without .git extension
|
|
9
|
-
* @throws Error if the URL format is invalid
|
|
10
|
-
*/
|
|
11
|
-
function extractRepoNameFromUrl(gitUrl) {
|
|
12
|
-
// Remove trailing spaces
|
|
13
|
-
const url = gitUrl.trim();
|
|
14
|
-
// Handle SSH format: git@github.com:user/repo.git or ssh://git@domain/path/repo.git
|
|
15
|
-
const sshMatch = url.match(/^git@[^:]+:(?:.+\/)?([^/]+?)(?:\.git)?$/);
|
|
16
|
-
if (sshMatch) {
|
|
17
|
-
return sshMatch[1];
|
|
18
|
-
}
|
|
19
|
-
// Handle SSH URL format: ssh://git@domain.com/path/repo.git
|
|
20
|
-
const sshUrlMatch = url.match(/^ssh:\/\/[^/]+\/(?:.+\/)?([^/]+?)(?:\.git)?$/);
|
|
21
|
-
if (sshUrlMatch) {
|
|
22
|
-
return sshUrlMatch[1];
|
|
23
|
-
}
|
|
24
|
-
// Handle HTTPS format: https://github.com/user/repo.git
|
|
25
|
-
const httpsMatch = url.match(/^https?:\/\/[^/]+\/(?:.+\/)?([^/]+?)(?:\.git)?$/);
|
|
26
|
-
if (httpsMatch) {
|
|
27
|
-
return httpsMatch[1];
|
|
28
|
-
}
|
|
29
|
-
// Handle file:// URLs for local repositories
|
|
30
|
-
const fileMatch = url.match(/^file:\/\/(?:.+\/)?([^/]+?)(?:\.git)?$/);
|
|
31
|
-
if (fileMatch) {
|
|
32
|
-
return fileMatch[1];
|
|
33
|
-
}
|
|
34
|
-
throw new Error(`Invalid Git URL format: ${gitUrl}`);
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Generates the default bare repository directory path
|
|
38
|
-
* @param repoUrl - The Git repository URL
|
|
39
|
-
* @param baseDir - The base directory for bare repos (default: .bare)
|
|
40
|
-
* @returns The path to the bare repository
|
|
41
|
-
*/
|
|
42
|
-
function getDefaultBareRepoDir(repoUrl, baseDir = ".bare") {
|
|
43
|
-
const repoName = extractRepoNameFromUrl(repoUrl);
|
|
44
|
-
return `${baseDir}/${repoName}`;
|
|
45
|
-
}
|
|
46
|
-
//# sourceMappingURL=git-url.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"git-url.js","sourceRoot":"","sources":["../../src/utils/git-url.ts"],"names":[],"mappings":";;AAMA,wDA6BC;AAQD,sDAGC;AA9CD;;;;;GAKG;AACH,SAAgB,sBAAsB,CAAC,MAAc;IACnD,yBAAyB;IACzB,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;IAE1B,oFAAoF;IACpF,MAAM,QAAQ,GAAG,GAAG,CAAC,KAAK,CAAC,yCAAyC,CAAC,CAAC;IACtE,IAAI,QAAQ,EAAE,CAAC;QACb,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC;IACrB,CAAC;IAED,4DAA4D;IAC5D,MAAM,WAAW,GAAG,GAAG,CAAC,KAAK,CAAC,8CAA8C,CAAC,CAAC;IAC9E,IAAI,WAAW,EAAE,CAAC;QAChB,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC;IACxB,CAAC;IAED,wDAAwD;IACxD,MAAM,UAAU,GAAG,GAAG,CAAC,KAAK,CAAC,iDAAiD,CAAC,CAAC;IAChF,IAAI,UAAU,EAAE,CAAC;QACf,OAAO,UAAU,CAAC,CAAC,CAAC,CAAC;IACvB,CAAC;IAED,6CAA6C;IAC7C,MAAM,SAAS,GAAG,GAAG,CAAC,KAAK,CAAC,wCAAwC,CAAC,CAAC;IACtE,IAAI,SAAS,EAAE,CAAC;QACd,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC;IACtB,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,2BAA2B,MAAM,EAAE,CAAC,CAAC;AACvD,CAAC;AAED;;;;;GAKG;AACH,SAAgB,qBAAqB,CAAC,OAAe,EAAE,UAAkB,OAAO;IAC9E,MAAM,QAAQ,GAAG,sBAAsB,CAAC,OAAO,CAAC,CAAC;IACjD,OAAO,GAAG,OAAO,IAAI,QAAQ,EAAE,CAAC;AAClC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"interactive.d.ts","sourceRoot":"","sources":["../../src/utils/interactive.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC,wBAAsB,eAAe,CAAC,aAAa,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAsKrF"}
|
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.promptForConfig = promptForConfig;
|
|
37
|
-
const path = __importStar(require("path"));
|
|
38
|
-
const prompts_1 = require("@inquirer/prompts");
|
|
39
|
-
const config_generator_1 = require("./config-generator");
|
|
40
|
-
const git_url_1 = require("./git-url");
|
|
41
|
-
async function promptForConfig(partialConfig) {
|
|
42
|
-
console.log("š§ Welcome to sync-worktrees interactive setup!\n");
|
|
43
|
-
let repoUrl = partialConfig.repoUrl;
|
|
44
|
-
if (!repoUrl) {
|
|
45
|
-
repoUrl = await (0, prompts_1.input)({
|
|
46
|
-
message: "Enter the Git repository URL (e.g., https://github.com/user/repo.git):",
|
|
47
|
-
validate: (value) => {
|
|
48
|
-
if (!value.trim()) {
|
|
49
|
-
return "Repository URL is required";
|
|
50
|
-
}
|
|
51
|
-
try {
|
|
52
|
-
// Basic URL validation
|
|
53
|
-
if (!value.match(/^(https?:\/\/|ssh:\/\/|git@|file:\/\/).*$/)) {
|
|
54
|
-
return "Please enter a valid Git URL (https://, ssh://, git@, or file://)";
|
|
55
|
-
}
|
|
56
|
-
return true;
|
|
57
|
-
}
|
|
58
|
-
catch {
|
|
59
|
-
return "Please enter a valid URL";
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
let worktreeDir = partialConfig.worktreeDir;
|
|
65
|
-
if (!worktreeDir) {
|
|
66
|
-
// Extract repository name from URL to suggest as default
|
|
67
|
-
const repoName = repoUrl ? (0, git_url_1.extractRepoNameFromUrl)(repoUrl) : "";
|
|
68
|
-
const defaultWorktreeDir = repoName ? `./${repoName}` : "";
|
|
69
|
-
worktreeDir = await (0, prompts_1.input)({
|
|
70
|
-
message: "Enter the directory for storing worktrees:",
|
|
71
|
-
default: defaultWorktreeDir,
|
|
72
|
-
validate: (value) => {
|
|
73
|
-
// Allow empty input to use default value
|
|
74
|
-
if (!value.trim() && !defaultWorktreeDir) {
|
|
75
|
-
return "Worktree directory is required";
|
|
76
|
-
}
|
|
77
|
-
return true;
|
|
78
|
-
},
|
|
79
|
-
});
|
|
80
|
-
// Use default if empty input
|
|
81
|
-
if (!worktreeDir.trim() && defaultWorktreeDir) {
|
|
82
|
-
worktreeDir = defaultWorktreeDir;
|
|
83
|
-
}
|
|
84
|
-
if (!path.isAbsolute(worktreeDir)) {
|
|
85
|
-
worktreeDir = path.resolve(worktreeDir);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
let bareRepoDir = partialConfig.bareRepoDir;
|
|
89
|
-
const askForBareDir = await (0, prompts_1.confirm)({
|
|
90
|
-
message: "Would you like to specify a custom location for the bare repository?",
|
|
91
|
-
default: false,
|
|
92
|
-
});
|
|
93
|
-
if (askForBareDir) {
|
|
94
|
-
bareRepoDir = await (0, prompts_1.input)({
|
|
95
|
-
message: "Enter the directory for the bare repository:",
|
|
96
|
-
default: "",
|
|
97
|
-
validate: (value) => {
|
|
98
|
-
if (!value.trim()) {
|
|
99
|
-
return "Bare repository directory is required";
|
|
100
|
-
}
|
|
101
|
-
return true;
|
|
102
|
-
},
|
|
103
|
-
});
|
|
104
|
-
if (!path.isAbsolute(bareRepoDir)) {
|
|
105
|
-
bareRepoDir = path.resolve(bareRepoDir);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
let runOnce = partialConfig.runOnce;
|
|
109
|
-
let cronSchedule = partialConfig.cronSchedule || "0 * * * *";
|
|
110
|
-
if (runOnce === undefined) {
|
|
111
|
-
const runMode = await (0, prompts_1.select)({
|
|
112
|
-
message: "How would you like to run the sync?",
|
|
113
|
-
choices: [
|
|
114
|
-
{ name: "Run once", value: "once" },
|
|
115
|
-
{ name: "Schedule with cron", value: "scheduled" },
|
|
116
|
-
],
|
|
117
|
-
});
|
|
118
|
-
runOnce = runMode === "once";
|
|
119
|
-
if (!runOnce && !partialConfig.cronSchedule) {
|
|
120
|
-
cronSchedule = await (0, prompts_1.input)({
|
|
121
|
-
message: "Enter the cron schedule (or press enter for default):",
|
|
122
|
-
default: "0 * * * *",
|
|
123
|
-
validate: (value) => {
|
|
124
|
-
if (!value.trim()) {
|
|
125
|
-
return "Cron schedule is required";
|
|
126
|
-
}
|
|
127
|
-
const parts = value.trim().split(" ");
|
|
128
|
-
if (parts.length < 5) {
|
|
129
|
-
return "Invalid cron pattern. Expected format: '* * * * *'";
|
|
130
|
-
}
|
|
131
|
-
return true;
|
|
132
|
-
},
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
const finalConfig = {
|
|
137
|
-
repoUrl,
|
|
138
|
-
worktreeDir,
|
|
139
|
-
cronSchedule,
|
|
140
|
-
runOnce: runOnce || false,
|
|
141
|
-
bareRepoDir,
|
|
142
|
-
};
|
|
143
|
-
console.log("\nš Configuration summary:");
|
|
144
|
-
console.log(` Repository URL: ${finalConfig.repoUrl}`);
|
|
145
|
-
console.log(` Worktrees: ${finalConfig.worktreeDir}`);
|
|
146
|
-
if (finalConfig.bareRepoDir) {
|
|
147
|
-
console.log(` Bare repo: ${finalConfig.bareRepoDir}`);
|
|
148
|
-
}
|
|
149
|
-
else {
|
|
150
|
-
console.log(` Bare repo: .bare/<repo-name> (default)`);
|
|
151
|
-
}
|
|
152
|
-
if (finalConfig.runOnce) {
|
|
153
|
-
console.log(` Mode: Run once`);
|
|
154
|
-
}
|
|
155
|
-
else {
|
|
156
|
-
console.log(` Mode: Scheduled (${finalConfig.cronSchedule})`);
|
|
157
|
-
}
|
|
158
|
-
console.log("");
|
|
159
|
-
// Ask if user wants to save configuration to a file
|
|
160
|
-
const saveConfig = await (0, prompts_1.confirm)({
|
|
161
|
-
message: "Would you like to save this configuration to a file for future use?",
|
|
162
|
-
default: true,
|
|
163
|
-
});
|
|
164
|
-
if (saveConfig) {
|
|
165
|
-
const defaultConfigPath = (0, config_generator_1.getDefaultConfigPath)();
|
|
166
|
-
let configPath = await (0, prompts_1.input)({
|
|
167
|
-
message: "Enter the path for the config file:",
|
|
168
|
-
default: defaultConfigPath,
|
|
169
|
-
validate: (value) => {
|
|
170
|
-
if (!value.trim()) {
|
|
171
|
-
return "Config file path is required";
|
|
172
|
-
}
|
|
173
|
-
if (!value.endsWith(".js")) {
|
|
174
|
-
return "Config file must have a .js extension";
|
|
175
|
-
}
|
|
176
|
-
return true;
|
|
177
|
-
},
|
|
178
|
-
});
|
|
179
|
-
if (!path.isAbsolute(configPath)) {
|
|
180
|
-
configPath = path.resolve(configPath);
|
|
181
|
-
}
|
|
182
|
-
try {
|
|
183
|
-
await (0, config_generator_1.generateConfigFile)(finalConfig, configPath);
|
|
184
|
-
console.log(`\nā
Configuration saved to: ${configPath}`);
|
|
185
|
-
console.log(`\nš” You can now use this config file with:`);
|
|
186
|
-
console.log(` sync-worktrees --config ${path.relative(process.cwd(), configPath)}`);
|
|
187
|
-
console.log("");
|
|
188
|
-
}
|
|
189
|
-
catch (error) {
|
|
190
|
-
console.error(`\nā Failed to save config file: ${error.message}`);
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
return finalConfig;
|
|
194
|
-
}
|
|
195
|
-
//# sourceMappingURL=interactive.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"interactive.js","sourceRoot":"","sources":["../../src/utils/interactive.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,0CAsKC;AA/KD,2CAA6B;AAE7B,+CAA2D;AAE3D,yDAA8E;AAC9E,uCAAmD;AAI5C,KAAK,UAAU,eAAe,CAAC,aAA8B;IAClE,OAAO,CAAC,GAAG,CAAC,mDAAmD,CAAC,CAAC;IAEjE,IAAI,OAAO,GAAG,aAAa,CAAC,OAAO,CAAC;IACpC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,GAAG,MAAM,IAAA,eAAK,EAAC;YACpB,OAAO,EAAE,wEAAwE;YACjF,QAAQ,EAAE,CAAC,KAAa,EAAE,EAAE;gBAC1B,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,CAAC;oBAClB,OAAO,4BAA4B,CAAC;gBACtC,CAAC;gBACD,IAAI,CAAC;oBACH,uBAAuB;oBACvB,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,2CAA2C,CAAC,EAAE,CAAC;wBAC9D,OAAO,mEAAmE,CAAC;oBAC7E,CAAC;oBACD,OAAO,IAAI,CAAC;gBACd,CAAC;gBAAC,MAAM,CAAC;oBACP,OAAO,0BAA0B,CAAC;gBACpC,CAAC;YACH,CAAC;SACF,CAAC,CAAC;IACL,CAAC;IAED,IAAI,WAAW,GAAG,aAAa,CAAC,WAAW,CAAC;IAC5C,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,yDAAyD;QACzD,MAAM,QAAQ,GAAG,OAAO,CAAC,CAAC,CAAC,IAAA,gCAAsB,EAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;Q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,CAAC;YACd,CAAC;SACF,CAAC,CAAC;QAEH,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;YACjC,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QACxC,CAAC;QAED,IAAI,CAAC;YACH,MAAM,IAAA,qCAAkB,EAAC,WAAW,EAAE,UAAU,CAAC,CAAC;YAClD,OAAO,CAAC,GAAG,CAAC,+BAA+B,UAAU,EAAE,CAAC,CAAC;YACzD,OAAO,CAAC,GAAG,CAAC,6CAA6C,CAAC,CAAC;YAC3D,OAAO,CAAC,GAAG,CAAC,8BAA8B,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,UAAU,CAAC,EAAE,CAAC,CAAC;YACtF,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAClB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,mCAAoC,KAAe,CAAC,OAAO,EAAE,CAAC,CAAC;QAC/E,CAAC;IACH,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Extracts error message from unknown error type
|
|
3
|
-
* @param error The error to extract message from
|
|
4
|
-
* @returns The error message string
|
|
5
|
-
*/
|
|
6
|
-
export declare function getErrorMessage(error: unknown): string;
|
|
7
|
-
/**
|
|
8
|
-
* Common LFS error patterns that indicate Git LFS-related failures
|
|
9
|
-
*/
|
|
10
|
-
export declare const LFS_ERROR_PATTERNS: readonly ["smudge filter lfs failed", "Object does not exist on the server", "external filter 'git-lfs filter-process' failed"];
|
|
11
|
-
/**
|
|
12
|
-
* Checks if an error message contains any known LFS error patterns
|
|
13
|
-
* @param errorMessage The error message to check
|
|
14
|
-
* @returns true if the error is related to Git LFS
|
|
15
|
-
*/
|
|
16
|
-
export declare function isLfsError(errorMessage: string): boolean;
|
|
17
|
-
/**
|
|
18
|
-
* Checks if an error object contains any known LFS error patterns
|
|
19
|
-
* @param error The error object to check
|
|
20
|
-
* @returns true if the error is related to Git LFS
|
|
21
|
-
*/
|
|
22
|
-
export declare function isLfsErrorFromError(error: unknown): boolean;
|
|
23
|
-
//# sourceMappingURL=lfs-error.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lfs-error.d.ts","sourceRoot":"","sources":["../../src/utils/lfs-error.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAQtD;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,iIAIpB,CAAC;AAEZ;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAExD;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAE3D"}
|