adhdev 0.9.62 → 0.9.64
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 +92 -8
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +90 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/vendor/mcp-server/index.js +454 -14
- package/vendor/mcp-server/index.js.map +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -1488,7 +1488,8 @@ function createDefaultGitCommandServices() {
|
|
|
1488
1488
|
stashPush: async ({ workspace, message, includeUntracked = false }) => gitStashPush(workspace, message, includeUntracked),
|
|
1489
1489
|
stashPop: async ({ workspace, stashRef }) => gitStashPop(workspace, stashRef),
|
|
1490
1490
|
checkoutFiles: async ({ workspace, paths }) => gitCheckoutFiles(workspace, paths),
|
|
1491
|
-
getRemoteUrl: async ({ workspace, remote = "origin" }) => gitGetRemoteUrl(workspace, remote)
|
|
1491
|
+
getRemoteUrl: async ({ workspace, remote = "origin" }) => gitGetRemoteUrl(workspace, remote),
|
|
1492
|
+
push: async ({ workspace, remote = "origin", branch, setUpstream = false }) => gitPush(workspace, remote, branch, setUpstream)
|
|
1492
1493
|
};
|
|
1493
1494
|
}
|
|
1494
1495
|
function validateWorkspace2(args) {
|
|
@@ -1655,6 +1656,20 @@ async function handleGitCommand(command, args, services = defaultGitCommandServi
|
|
|
1655
1656
|
if ("success" in remoteResult) return remoteResult;
|
|
1656
1657
|
return { success: true, remoteUrl: remoteResult.remoteUrl, remote: remoteResult.remote };
|
|
1657
1658
|
}
|
|
1659
|
+
case "git_push": {
|
|
1660
|
+
if (!services.push) return serviceNotImplemented(command);
|
|
1661
|
+
const remote = typeof args?.remote === "string" && args.remote.trim() ? args.remote.trim() : "origin";
|
|
1662
|
+
const branch = typeof args?.branch === "string" && args.branch.trim() ? args.branch.trim() : void 0;
|
|
1663
|
+
const setUpstream = Boolean(args?.setUpstream);
|
|
1664
|
+
if (!/^[a-zA-Z0-9_.\-]+$/.test(remote)) {
|
|
1665
|
+
return failure("invalid_args", "remote must contain only alphanumeric characters, dots, hyphens, and underscores");
|
|
1666
|
+
}
|
|
1667
|
+
if (branch !== void 0 && !/^[a-zA-Z0-9/_.\-]+$/.test(branch)) {
|
|
1668
|
+
return failure("invalid_args", "branch must contain only alphanumeric characters, slashes, dots, hyphens, and underscores");
|
|
1669
|
+
}
|
|
1670
|
+
const pushResult = await runService(() => services.push({ workspace, remote, branch, setUpstream }));
|
|
1671
|
+
return "success" in pushResult ? pushResult : { success: true, push: pushResult };
|
|
1672
|
+
}
|
|
1658
1673
|
default:
|
|
1659
1674
|
return failure("invalid_args", `Unknown Git command: ${command}`);
|
|
1660
1675
|
}
|
|
@@ -1757,6 +1772,49 @@ async function gitGetRemoteUrl(workspace, remote) {
|
|
|
1757
1772
|
}
|
|
1758
1773
|
return { remoteUrl, remote };
|
|
1759
1774
|
}
|
|
1775
|
+
async function gitPush(workspace, remote, branch, setUpstream) {
|
|
1776
|
+
const lastCheckedAt = Date.now();
|
|
1777
|
+
const repo = await resolveGitRepository(workspace);
|
|
1778
|
+
const repoRoot = repo.repoRoot;
|
|
1779
|
+
let resolvedBranch = branch;
|
|
1780
|
+
if (!resolvedBranch) {
|
|
1781
|
+
const branchResult = await runGit(repo, ["symbolic-ref", "--short", "HEAD"], { cwd: repoRoot });
|
|
1782
|
+
resolvedBranch = branchResult.stdout.trim();
|
|
1783
|
+
if (!resolvedBranch) {
|
|
1784
|
+
throw new GitCommandError("git_command_failed", "Cannot push: not on a branch (detached HEAD)");
|
|
1785
|
+
}
|
|
1786
|
+
}
|
|
1787
|
+
const pushArgs = ["push"];
|
|
1788
|
+
if (setUpstream) pushArgs.push("--set-upstream");
|
|
1789
|
+
pushArgs.push(remote, resolvedBranch);
|
|
1790
|
+
let output = "";
|
|
1791
|
+
let newBranch = false;
|
|
1792
|
+
try {
|
|
1793
|
+
const result = await runGit(repo, pushArgs, { cwd: repoRoot });
|
|
1794
|
+
output = (result.stdout + result.stderr).trim();
|
|
1795
|
+
newBranch = /\[new branch\]/i.test(output);
|
|
1796
|
+
} catch (err) {
|
|
1797
|
+
const errOutput = (err?.stdout ?? "") + (err?.stderr ?? "");
|
|
1798
|
+
if (!setUpstream && /no upstream branch|set-upstream/i.test(errOutput)) {
|
|
1799
|
+
const retryArgs = ["push", "--set-upstream", remote, resolvedBranch];
|
|
1800
|
+
const retryResult = await runGit(repo, retryArgs, { cwd: repoRoot });
|
|
1801
|
+
output = (retryResult.stdout + retryResult.stderr).trim();
|
|
1802
|
+
newBranch = /\[new branch\]/i.test(output);
|
|
1803
|
+
} else {
|
|
1804
|
+
throw new GitCommandError("git_command_failed", errOutput || err?.message || "git push failed");
|
|
1805
|
+
}
|
|
1806
|
+
}
|
|
1807
|
+
return {
|
|
1808
|
+
workspace: repo.workspace,
|
|
1809
|
+
repoRoot,
|
|
1810
|
+
isGitRepo: true,
|
|
1811
|
+
remote,
|
|
1812
|
+
branch: resolvedBranch,
|
|
1813
|
+
output,
|
|
1814
|
+
newBranch,
|
|
1815
|
+
lastCheckedAt
|
|
1816
|
+
};
|
|
1817
|
+
}
|
|
1760
1818
|
function formatOptionalGitLogRangeArg(flag, value) {
|
|
1761
1819
|
return value ? [`${flag}=${value}`] : [];
|
|
1762
1820
|
}
|
|
@@ -1834,7 +1892,8 @@ var init_git_commands = __esm({
|
|
|
1834
1892
|
"git_stash_push",
|
|
1835
1893
|
"git_stash_pop",
|
|
1836
1894
|
"git_checkout_files",
|
|
1837
|
-
"git_remote_url"
|
|
1895
|
+
"git_remote_url",
|
|
1896
|
+
"git_push"
|
|
1838
1897
|
]);
|
|
1839
1898
|
SNAPSHOT_REASONS = /* @__PURE__ */ new Set([
|
|
1840
1899
|
"session_baseline",
|
|
@@ -9350,9 +9409,34 @@ function findLastMessageIndexBySignature(messages, signature) {
|
|
|
9350
9409
|
}
|
|
9351
9410
|
return -1;
|
|
9352
9411
|
}
|
|
9412
|
+
function isReadChatConversationAnchorMessage(message) {
|
|
9413
|
+
if (!message) return false;
|
|
9414
|
+
const role = String(message.role || "").trim().toLowerCase();
|
|
9415
|
+
if (role !== "user" && role !== "assistant") return false;
|
|
9416
|
+
const kind = String(message.kind || "standard").trim().toLowerCase();
|
|
9417
|
+
return !kind || kind === "standard";
|
|
9418
|
+
}
|
|
9419
|
+
function buildVisibleReadChatTailMessages(messages, tailLimit) {
|
|
9420
|
+
const totalMessages = messages.length;
|
|
9421
|
+
if (tailLimit <= 0 || totalMessages <= tailLimit) return messages;
|
|
9422
|
+
const tailMessages = messages.slice(-tailLimit);
|
|
9423
|
+
if (tailMessages.some(isReadChatConversationAnchorMessage)) return tailMessages;
|
|
9424
|
+
const hiddenMessages = messages.slice(0, totalMessages - tailLimit);
|
|
9425
|
+
const anchors = [];
|
|
9426
|
+
const seenRoles = /* @__PURE__ */ new Set();
|
|
9427
|
+
for (let index = hiddenMessages.length - 1; index >= 0 && anchors.length < 2; index -= 1) {
|
|
9428
|
+
const message = hiddenMessages[index];
|
|
9429
|
+
if (!isReadChatConversationAnchorMessage(message)) continue;
|
|
9430
|
+
const role = String(message.role || "").trim().toLowerCase();
|
|
9431
|
+
if (seenRoles.has(role)) continue;
|
|
9432
|
+
seenRoles.add(role);
|
|
9433
|
+
anchors.unshift(message);
|
|
9434
|
+
}
|
|
9435
|
+
return anchors.length > 0 ? [...anchors, ...tailMessages] : tailMessages;
|
|
9436
|
+
}
|
|
9353
9437
|
function buildBoundedTailSync(messages, cursor) {
|
|
9354
9438
|
const totalMessages = messages.length;
|
|
9355
|
-
const tailMessages =
|
|
9439
|
+
const tailMessages = buildVisibleReadChatTailMessages(messages, cursor.tailLimit);
|
|
9356
9440
|
return {
|
|
9357
9441
|
syncMode: "full",
|
|
9358
9442
|
replaceFrom: 0,
|
|
@@ -9474,8 +9558,8 @@ function buildReadChatCommandResult(payload, args) {
|
|
|
9474
9558
|
const messages = collapseReplayDuplicatesFromReadChat(normalizeReadChatMessages(validatedPayload));
|
|
9475
9559
|
const cursor = normalizeReadChatCursor(args);
|
|
9476
9560
|
if (!cursor.knownMessageCount && !cursor.lastMessageSignature && cursor.tailLimit > 0 && messages.length > cursor.tailLimit) {
|
|
9477
|
-
const tailMessages = messages
|
|
9478
|
-
const lastMessageSignature = getChatMessageSignature(
|
|
9561
|
+
const tailMessages = buildVisibleReadChatTailMessages(messages, cursor.tailLimit);
|
|
9562
|
+
const lastMessageSignature = getChatMessageSignature(messages[messages.length - 1]);
|
|
9479
9563
|
return {
|
|
9480
9564
|
success: true,
|
|
9481
9565
|
...validatedPayload,
|
|
@@ -90329,7 +90413,7 @@ var init_adhdev_daemon = __esm({
|
|
|
90329
90413
|
init_version();
|
|
90330
90414
|
init_src();
|
|
90331
90415
|
init_runtime_defaults();
|
|
90332
|
-
pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.
|
|
90416
|
+
pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.64" });
|
|
90333
90417
|
AdhdevDaemon = class _AdhdevDaemon {
|
|
90334
90418
|
localHttpServer = null;
|
|
90335
90419
|
localWss = null;
|
|
@@ -96949,8 +97033,8 @@ Claude Desktop config (~/.claude_desktop_config.json):
|
|
|
96949
97033
|
}
|
|
96950
97034
|
}
|
|
96951
97035
|
|
|
96952
|
-
Tools available (local): list_daemons, list_sessions, launch_session, stop_session, check_pending, read_chat, send_chat, approve, git_status, screenshot
|
|
96953
|
-
Tools available (cloud): list_daemons, list_sessions, launch_session, stop_session, check_pending, read_chat, send_chat, approve, git_status
|
|
97036
|
+
Tools available (local): list_daemons, list_sessions, launch_session, stop_session, check_pending, read_chat, send_chat, approve, git_status, git_log, git_diff, git_checkpoint, git_push, screenshot
|
|
97037
|
+
Tools available (cloud): list_daemons, list_sessions, launch_session, stop_session, check_pending, read_chat, send_chat, approve, git_status, git_log, git_diff, git_checkpoint, git_push
|
|
96954
97038
|
`).action(async (opts) => {
|
|
96955
97039
|
const mcpBin = resolveMcpBin();
|
|
96956
97040
|
if (!mcpBin) {
|