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 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",
@@ -90329,7 +90388,7 @@ var init_adhdev_daemon = __esm({
90329
90388
  init_version();
90330
90389
  init_src();
90331
90390
  init_runtime_defaults();
90332
- pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.61" });
90391
+ pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.63" });
90333
90392
  AdhdevDaemon = class _AdhdevDaemon {
90334
90393
  localHttpServer = null;
90335
90394
  localWss = null;
@@ -96949,8 +97008,8 @@ Claude Desktop config (~/.claude_desktop_config.json):
96949
97008
  }
96950
97009
  }
96951
97010
 
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
97011
+ 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
97012
+ 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
97013
  `).action(async (opts) => {
96955
97014
  const mcpBin = resolveMcpBin();
96956
97015
  if (!mcpBin) {