claude-teammate 0.1.30 → 0.1.31
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/package.json +1 -1
- package/src/repo.js +30 -1
package/package.json
CHANGED
package/src/repo.js
CHANGED
|
@@ -55,7 +55,16 @@ export async function validateOrEnsureLocalRepo(repoUrl, reposDir, localPath = "
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
export async function ensureBranchFromMain(repoPath, branchName) {
|
|
58
|
-
|
|
58
|
+
try {
|
|
59
|
+
await execGit(repoPath, ["fetch", "origin", "main", "--prune"]);
|
|
60
|
+
} catch (error) {
|
|
61
|
+
if (!isMissingRemoteMainError(error)) {
|
|
62
|
+
throw error;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
await initializeRemoteMainBranch(repoPath);
|
|
66
|
+
}
|
|
67
|
+
|
|
59
68
|
await execGit(repoPath, ["checkout", "-B", branchName, "origin/main"]);
|
|
60
69
|
await execGit(repoPath, [
|
|
61
70
|
"-c",
|
|
@@ -202,6 +211,21 @@ async function branchHasChangesAgainstMain(repoPath) {
|
|
|
202
211
|
return Number.isFinite(count) && count > 0;
|
|
203
212
|
}
|
|
204
213
|
|
|
214
|
+
async function initializeRemoteMainBranch(repoPath) {
|
|
215
|
+
await execGit(repoPath, ["checkout", "--orphan", "main"]);
|
|
216
|
+
await execGit(repoPath, [
|
|
217
|
+
"-c",
|
|
218
|
+
"user.name=Claude Teammate",
|
|
219
|
+
"-c",
|
|
220
|
+
"user.email=claude-teammate@local",
|
|
221
|
+
"commit",
|
|
222
|
+
"--allow-empty",
|
|
223
|
+
"-m",
|
|
224
|
+
"Initialize main"
|
|
225
|
+
]);
|
|
226
|
+
await execGit(repoPath, ["push", "-u", "origin", "main"]);
|
|
227
|
+
}
|
|
228
|
+
|
|
205
229
|
function formatGitExecError(error) {
|
|
206
230
|
const message = error instanceof Error ? error.message : String(error);
|
|
207
231
|
const stderr =
|
|
@@ -217,6 +241,11 @@ function formatGitExecError(error) {
|
|
|
217
241
|
return new Error(`${message}\n${detail}`);
|
|
218
242
|
}
|
|
219
243
|
|
|
244
|
+
function isMissingRemoteMainError(error) {
|
|
245
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
246
|
+
return /couldn't find remote ref main/u.test(message);
|
|
247
|
+
}
|
|
248
|
+
|
|
220
249
|
function parseGitHubPath(rawPath) {
|
|
221
250
|
const cleanPath = rawPath.replace(/\.git$/u, "").replace(/\/+$/u, "");
|
|
222
251
|
const segments = cleanPath.split("/");
|