@agimon-ai/po-git 0.0.0-alpha.184 → 0.0.0-alpha.186

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.
@@ -2,7 +2,7 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
- const require_worktreeOperations = require("../worktreeOperations-0Jrjcbg7.cjs");
5
+ const require_worktreeOperations = require("../worktreeOperations-BEk4VEj3.cjs");
6
6
  let node_fs_promises = require("node:fs/promises");
7
7
  node_fs_promises = require_worktreeOperations.__toESM(node_fs_promises, 1);
8
8
  let node_path = require("node:path");
@@ -1103,8 +1103,8 @@ async function tighten(target, mode) {
1103
1103
  if (((await node_fs_promises.default.stat(target)).mode & LOOSE_BITS) !== 0) await node_fs_promises.default.chmod(target, mode);
1104
1104
  } catch {}
1105
1105
  }
1106
- function createGitAuthStore(homeDir = node_os.default.homedir()) {
1107
- const file = require_worktreeOperations.credentialsFile(homeDir);
1106
+ function createGitAuthStore(homeDir = node_os.default.homedir(), environment = {}) {
1107
+ const file = require_worktreeOperations.credentialsFile(homeDir, environment);
1108
1108
  const readFile = async () => {
1109
1109
  await tighten(file, OWNER_ONLY_FILE);
1110
1110
  const raw = await require_worktreeOperations.readJson(file);
@@ -1126,7 +1126,7 @@ function createGitAuthStore(homeDir = node_os.default.homedir()) {
1126
1126
  const key = await workspaceKey(workspaceRoot);
1127
1127
  const current = await readFile();
1128
1128
  const next = await parseGitAuthSave(request, current.workspaces[key] ?? { method: "none" }, homeDir);
1129
- const root = require_worktreeOperations.poGitRoot(homeDir);
1129
+ const root = require_worktreeOperations.poGitRoot(homeDir, environment);
1130
1130
  await node_fs_promises.default.mkdir(root, {
1131
1131
  recursive: true,
1132
1132
  mode: OWNER_ONLY_DIRECTORY
@@ -1326,7 +1326,8 @@ function createGitApi(openDirectory) {
1326
1326
  const operations = require_worktreeOperations.createWorktreeOperations({
1327
1327
  git,
1328
1328
  sessionService: context.sessionService,
1329
- ...context.homeDirectory === void 0 ? {} : { homeDir: context.homeDirectory }
1329
+ ...context.homeDirectory === void 0 ? {} : { homeDir: context.homeDirectory },
1330
+ ...context.environment === void 0 ? {} : { environment: context.environment }
1330
1331
  });
1331
1332
  /**
1332
1333
  * The new-session dialog's routes: the workspace's branches, and a top-level
@@ -1406,7 +1407,7 @@ function createGitApi(openDirectory) {
1406
1407
  return root;
1407
1408
  };
1408
1409
  const homeDir = context.homeDirectory ?? context.environment?.HOME;
1409
- const gitAuth = homeDir === void 0 ? void 0 : createGitAuthStore(homeDir);
1410
+ const gitAuth = homeDir === void 0 ? void 0 : createGitAuthStore(homeDir, context.environment);
1410
1411
  const branchDiff = createBranchDiff();
1411
1412
  const pendingReviews = /* @__PURE__ */ new Map();
1412
1413
  /**
@@ -1448,7 +1449,7 @@ function createGitApi(openDirectory) {
1448
1449
  if (homeDir === void 0) throw new Error("Git review requires the admitted host home directory.");
1449
1450
  let recordedBaseRef;
1450
1451
  try {
1451
- recordedBaseRef = (await require_worktreeOperations.createWorktreeRegistry(await require_worktreeOperations.registryFile(cwd, homeDir)).list()).find((record) => record.sessionId === context.sessionId)?.baseRef;
1452
+ recordedBaseRef = (await require_worktreeOperations.createWorktreeRegistry(await require_worktreeOperations.registryFile(cwd, homeDir, context.environment)).list()).find((record) => record.sessionId === context.sessionId)?.baseRef;
1452
1453
  } catch {
1453
1454
  recordedBaseRef = void 0;
1454
1455
  }
@@ -1905,7 +1906,7 @@ function createGitChangesChannel(options = {}) {
1905
1906
  const homeDir = options.homeDir ?? node_os.default.homedir();
1906
1907
  const diff = options.diff ?? createBranchDiff();
1907
1908
  const sync = options.sync ?? createGitSync({ homeDir });
1908
- const auth = options.auth ?? createGitAuthStore(homeDir);
1909
+ const auth = options.auth ?? createGitAuthStore(homeDir, options.environment);
1909
1910
  const latest = /* @__PURE__ */ new Map();
1910
1911
  const subscriptions = /* @__PURE__ */ new Map();
1911
1912
  const scopes = /* @__PURE__ */ new Map();
@@ -1917,7 +1918,7 @@ function createGitChangesChannel(options = {}) {
1917
1918
  /** The base the session's own worktree was created from, when it has one. */
1918
1919
  const recordedBaseRef = async (scope) => {
1919
1920
  try {
1920
- return (await require_worktreeOperations.createWorktreeRegistry(await require_worktreeOperations.registryFile(scope.cwd, homeDir)).list()).find((record) => record.sessionId === scope.sessionId)?.baseRef;
1921
+ return (await require_worktreeOperations.createWorktreeRegistry(await require_worktreeOperations.registryFile(scope.cwd, homeDir, options.environment)).list()).find((record) => record.sessionId === scope.sessionId)?.baseRef;
1921
1922
  } catch {
1922
1923
  return;
1923
1924
  }
@@ -2078,7 +2079,7 @@ function payloadOf(state) {
2078
2079
  /** Worktrees visible to this session, using the hub's live session table for ownership. */
2079
2080
  async function viewsFor(scope, deps) {
2080
2081
  try {
2081
- return (await require_worktreeOperations.createWorktreeRegistry(await require_worktreeOperations.registryFile(scope.cwd, deps.homeDir)).list()).flatMap((record) => {
2082
+ return (await require_worktreeOperations.createWorktreeRegistry(await require_worktreeOperations.registryFile(scope.cwd, deps.homeDir, deps.environment)).list()).flatMap((record) => {
2082
2083
  if (record.parentSessionId === void 0 && record.sessionId !== scope.sessionId) return [];
2083
2084
  const owned = record.parentSessionId === void 0 || record.parentSessionId === scope.sessionId;
2084
2085
  const unowned = !owned && !deps.sessionService.isLive(record.parentSessionId);
@@ -2159,7 +2160,9 @@ function createWorktreesChannel(options = {}) {
2159
2160
  if (sessionService === void 0) throw new require_worktreeOperations.HubUnavailableError("The cockpit session service is unavailable. Start the cockpit and try again.");
2160
2161
  const worktrees = options.operations ?? require_worktreeOperations.createWorktreeOperations({
2161
2162
  git: require_worktreeOperations.createWorktreeGit(),
2162
- sessionService
2163
+ sessionService,
2164
+ ...options.homeDir === void 0 ? {} : { homeDir: options.homeDir },
2165
+ ...options.environment === void 0 ? {} : { environment: options.environment }
2163
2166
  });
2164
2167
  /** Announces a successful mutation to this session's lifecycle subscribers. */
2165
2168
  const publishLifecycle = (scope, repositoryRoot) => {
@@ -2188,6 +2191,7 @@ function createWorktreesChannel(options = {}) {
2188
2191
  });
2189
2192
  const views = {
2190
2193
  homeDir: options.homeDir,
2194
+ environment: options.environment,
2191
2195
  sessionService
2192
2196
  };
2193
2197
  const latest = /* @__PURE__ */ new Map();
@@ -2262,7 +2266,7 @@ function createWorktreesChannel(options = {}) {
2262
2266
  if (!require_worktreeOperations.isWorktreeLifecycleEvent(payload)) return;
2263
2267
  let sameRepository = false;
2264
2268
  try {
2265
- sameRepository = await require_worktreeOperations.registryFile(scope.cwd, options.homeDir) === await require_worktreeOperations.registryFile(payload.repositoryRoot, options.homeDir);
2269
+ sameRepository = await require_worktreeOperations.registryFile(scope.cwd, options.homeDir, options.environment) === await require_worktreeOperations.registryFile(payload.repositoryRoot, options.homeDir, options.environment);
2266
2270
  } catch {
2267
2271
  sameRepository = false;
2268
2272
  }