adhdev 0.9.61 → 0.9.63
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/cli/index.js +64 -5
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +62 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/vendor/mcp-server/index.js +584 -11
- package/vendor/mcp-server/index.js.map +1 -1
package/dist/index.js
CHANGED
|
@@ -968,7 +968,8 @@ function createDefaultGitCommandServices() {
|
|
|
968
968
|
stashPush: async ({ workspace, message, includeUntracked = false }) => gitStashPush(workspace, message, includeUntracked),
|
|
969
969
|
stashPop: async ({ workspace, stashRef }) => gitStashPop(workspace, stashRef),
|
|
970
970
|
checkoutFiles: async ({ workspace, paths }) => gitCheckoutFiles(workspace, paths),
|
|
971
|
-
getRemoteUrl: async ({ workspace, remote = "origin" }) => gitGetRemoteUrl(workspace, remote)
|
|
971
|
+
getRemoteUrl: async ({ workspace, remote = "origin" }) => gitGetRemoteUrl(workspace, remote),
|
|
972
|
+
push: async ({ workspace, remote = "origin", branch, setUpstream = false }) => gitPush(workspace, remote, branch, setUpstream)
|
|
972
973
|
};
|
|
973
974
|
}
|
|
974
975
|
function validateWorkspace2(args) {
|
|
@@ -1135,6 +1136,20 @@ async function handleGitCommand(command, args, services = defaultGitCommandServi
|
|
|
1135
1136
|
if ("success" in remoteResult) return remoteResult;
|
|
1136
1137
|
return { success: true, remoteUrl: remoteResult.remoteUrl, remote: remoteResult.remote };
|
|
1137
1138
|
}
|
|
1139
|
+
case "git_push": {
|
|
1140
|
+
if (!services.push) return serviceNotImplemented(command);
|
|
1141
|
+
const remote = typeof args?.remote === "string" && args.remote.trim() ? args.remote.trim() : "origin";
|
|
1142
|
+
const branch = typeof args?.branch === "string" && args.branch.trim() ? args.branch.trim() : void 0;
|
|
1143
|
+
const setUpstream = Boolean(args?.setUpstream);
|
|
1144
|
+
if (!/^[a-zA-Z0-9_.\-]+$/.test(remote)) {
|
|
1145
|
+
return failure("invalid_args", "remote must contain only alphanumeric characters, dots, hyphens, and underscores");
|
|
1146
|
+
}
|
|
1147
|
+
if (branch !== void 0 && !/^[a-zA-Z0-9/_.\-]+$/.test(branch)) {
|
|
1148
|
+
return failure("invalid_args", "branch must contain only alphanumeric characters, slashes, dots, hyphens, and underscores");
|
|
1149
|
+
}
|
|
1150
|
+
const pushResult = await runService(() => services.push({ workspace, remote, branch, setUpstream }));
|
|
1151
|
+
return "success" in pushResult ? pushResult : { success: true, push: pushResult };
|
|
1152
|
+
}
|
|
1138
1153
|
default:
|
|
1139
1154
|
return failure("invalid_args", `Unknown Git command: ${command}`);
|
|
1140
1155
|
}
|
|
@@ -1237,6 +1252,49 @@ async function gitGetRemoteUrl(workspace, remote) {
|
|
|
1237
1252
|
}
|
|
1238
1253
|
return { remoteUrl, remote };
|
|
1239
1254
|
}
|
|
1255
|
+
async function gitPush(workspace, remote, branch, setUpstream) {
|
|
1256
|
+
const lastCheckedAt = Date.now();
|
|
1257
|
+
const repo = await resolveGitRepository(workspace);
|
|
1258
|
+
const repoRoot = repo.repoRoot;
|
|
1259
|
+
let resolvedBranch = branch;
|
|
1260
|
+
if (!resolvedBranch) {
|
|
1261
|
+
const branchResult = await runGit(repo, ["symbolic-ref", "--short", "HEAD"], { cwd: repoRoot });
|
|
1262
|
+
resolvedBranch = branchResult.stdout.trim();
|
|
1263
|
+
if (!resolvedBranch) {
|
|
1264
|
+
throw new GitCommandError("git_command_failed", "Cannot push: not on a branch (detached HEAD)");
|
|
1265
|
+
}
|
|
1266
|
+
}
|
|
1267
|
+
const pushArgs = ["push"];
|
|
1268
|
+
if (setUpstream) pushArgs.push("--set-upstream");
|
|
1269
|
+
pushArgs.push(remote, resolvedBranch);
|
|
1270
|
+
let output = "";
|
|
1271
|
+
let newBranch = false;
|
|
1272
|
+
try {
|
|
1273
|
+
const result = await runGit(repo, pushArgs, { cwd: repoRoot });
|
|
1274
|
+
output = (result.stdout + result.stderr).trim();
|
|
1275
|
+
newBranch = /\[new branch\]/i.test(output);
|
|
1276
|
+
} catch (err) {
|
|
1277
|
+
const errOutput = (err?.stdout ?? "") + (err?.stderr ?? "");
|
|
1278
|
+
if (!setUpstream && /no upstream branch|set-upstream/i.test(errOutput)) {
|
|
1279
|
+
const retryArgs = ["push", "--set-upstream", remote, resolvedBranch];
|
|
1280
|
+
const retryResult = await runGit(repo, retryArgs, { cwd: repoRoot });
|
|
1281
|
+
output = (retryResult.stdout + retryResult.stderr).trim();
|
|
1282
|
+
newBranch = /\[new branch\]/i.test(output);
|
|
1283
|
+
} else {
|
|
1284
|
+
throw new GitCommandError("git_command_failed", errOutput || err?.message || "git push failed");
|
|
1285
|
+
}
|
|
1286
|
+
}
|
|
1287
|
+
return {
|
|
1288
|
+
workspace: repo.workspace,
|
|
1289
|
+
repoRoot,
|
|
1290
|
+
isGitRepo: true,
|
|
1291
|
+
remote,
|
|
1292
|
+
branch: resolvedBranch,
|
|
1293
|
+
output,
|
|
1294
|
+
newBranch,
|
|
1295
|
+
lastCheckedAt
|
|
1296
|
+
};
|
|
1297
|
+
}
|
|
1240
1298
|
function formatOptionalGitLogRangeArg(flag, value) {
|
|
1241
1299
|
return value ? [`${flag}=${value}`] : [];
|
|
1242
1300
|
}
|
|
@@ -1314,7 +1372,8 @@ var init_git_commands = __esm({
|
|
|
1314
1372
|
"git_stash_push",
|
|
1315
1373
|
"git_stash_pop",
|
|
1316
1374
|
"git_checkout_files",
|
|
1317
|
-
"git_remote_url"
|
|
1375
|
+
"git_remote_url",
|
|
1376
|
+
"git_push"
|
|
1318
1377
|
]);
|
|
1319
1378
|
SNAPSHOT_REASONS = /* @__PURE__ */ new Set([
|
|
1320
1379
|
"session_baseline",
|
|
@@ -59187,7 +59246,7 @@ var init_adhdev_daemon = __esm({
|
|
|
59187
59246
|
init_version();
|
|
59188
59247
|
init_src();
|
|
59189
59248
|
init_runtime_defaults();
|
|
59190
|
-
pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.
|
|
59249
|
+
pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.63" });
|
|
59191
59250
|
AdhdevDaemon = class _AdhdevDaemon {
|
|
59192
59251
|
localHttpServer = null;
|
|
59193
59252
|
localWss = null;
|