@zgeoff/atc 2.12.0 → 2.13.0

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.
Files changed (71) hide show
  1. package/README.md +10 -10
  2. package/package.json +2 -1
  3. package/src/agents/agent-adapter.ts +48 -11
  4. package/src/agents/build-atc-bridge-files.ts +13 -0
  5. package/src/agents/build-claude-query-options.ts +72 -0
  6. package/src/agents/build-cli-command.ts +7 -5
  7. package/src/{daemon → agents}/build-headless-env.ts +12 -6
  8. package/src/agents/build-hook-settings.ts +8 -2
  9. package/src/agents/build-restore-mode-args.ts +23 -0
  10. package/src/agents/claude-adapter.ts +64 -17
  11. package/src/agents/codex-adapter.ts +5 -0
  12. package/src/agents/find-claude-permission-mode.ts +24 -0
  13. package/src/agents/gateway-adapter.ts +38 -11
  14. package/src/agents/grok-adapter.ts +5 -0
  15. package/src/agents/make-claude-headless-runner.ts +46 -0
  16. package/src/agents/plan-pasted-line-input.ts +22 -0
  17. package/src/agents/plan-typed-line-input.ts +8 -0
  18. package/src/agents/resolve-claude-permission-mode.ts +13 -0
  19. package/src/{daemon/start-headless-run.ts → agents/start-claude-headless-run.ts} +6 -53
  20. package/src/agents/write-atc-bridge.ts +2 -6
  21. package/src/cli.ts +8 -12
  22. package/src/client/index.ts +50 -1
  23. package/src/client/ui.ts +8 -0
  24. package/src/daemon/build-execution-targets.ts +49 -10
  25. package/src/daemon/build-imp-provider.ts +68 -0
  26. package/src/daemon/build-report-trail-entry.ts +4 -2
  27. package/src/daemon/build-scoped-context.ts +4 -1
  28. package/src/daemon/build-session-lifecycle.ts +52 -0
  29. package/src/daemon/build-tar-archive.ts +85 -0
  30. package/src/daemon/daemon-connection.ts +97 -4
  31. package/src/daemon/daemon.ts +298 -41
  32. package/src/daemon/execution-provider.ts +109 -4
  33. package/src/daemon/hooks.ts +5 -17
  34. package/src/daemon/imp-client-port.ts +343 -0
  35. package/src/daemon/imp-harness.ts +618 -0
  36. package/src/daemon/imp-port-error.ts +18 -0
  37. package/src/daemon/imp-port.ts +246 -0
  38. package/src/daemon/imp-provider.ts +601 -0
  39. package/src/daemon/is-binding-current.ts +43 -0
  40. package/src/daemon/local-pty-provider.ts +62 -3
  41. package/src/daemon/materialize-workspace.ts +571 -0
  42. package/src/daemon/parse-hook-line.ts +31 -0
  43. package/src/daemon/pick-session-state.ts +15 -0
  44. package/src/daemon/restore-fleet.ts +41 -23
  45. package/src/daemon/screen-model.ts +7 -0
  46. package/src/daemon/sessions.ts +574 -61
  47. package/src/daemon/start-headless-turn.ts +1 -1
  48. package/src/daemon/start-session-bridge.ts +294 -0
  49. package/src/mcp/mcp-tools.ts +9 -2
  50. package/src/mcp/require-daemon-features.ts +3 -0
  51. package/src/mcp/run-tool.ts +27 -8
  52. package/src/protocol/daemon-features.ts +11 -0
  53. package/src/protocol/protocol.ts +23 -0
  54. package/src/protocol/request-param-schemas.ts +66 -0
  55. package/src/report.ts +37 -2
  56. package/src/run-bridge-tap.ts +241 -0
  57. package/src/shared/collect-clean-env.ts +9 -1
  58. package/src/shared/open-bridge-socket.ts +86 -0
  59. package/src/shared/send-bridge-request.ts +47 -0
  60. package/src/statusline.ts +34 -3
  61. package/src/store/fleet-entry.ts +19 -0
  62. package/src/store/run-migrations.ts +76 -0
  63. package/src/store/state-store.ts +182 -21
  64. package/src/store/trail-entry.ts +4 -0
  65. package/src/store/workspace-materialization.ts +70 -0
  66. package/src/tap.ts +11 -0
  67. package/src/workspace/check-url-credentials.ts +59 -0
  68. package/src/workspace/create-workspace-clone.ts +13 -1
  69. package/src/workspace/repository-env-vars.ts +22 -0
  70. package/src/workspace/run-git.ts +2 -18
  71. /package/src/{daemon → agents}/resolve-headless-executable.ts +0 -0
@@ -24,6 +24,11 @@ import type { MessageRecord } from './message-record';
24
24
  import { runMigrations } from './run-migrations';
25
25
  import type { StateStoreSchema } from './run-migrations';
26
26
  import type { TrailEntry } from './trail-entry';
27
+ import type {
28
+ MaterializationUpdate,
29
+ SessionWorkspace,
30
+ WorkspaceMaterialization,
31
+ } from './workspace-materialization';
27
32
 
28
33
  // Spelled as the partial index's predicate so SQLite can match them.
29
34
  const TRAIL_FILTER = sql<boolean>`kind IS NOT NULL AND kind != 'heartbeat'`;
@@ -124,29 +129,43 @@ export class StateStore {
124
129
  async loadFleet(): Promise<FleetEntry[]> {
125
130
  const rows = await this.db
126
131
  .selectFrom('fleet')
127
- .where('session_id', 'in', (eb) =>
132
+
133
+ // A session's ready workspace comes back with its row.
134
+ .leftJoin('workspace_materialization as workspace', (join) =>
135
+ join
136
+ .onRef('workspace.session_id', '=', 'fleet.session_id')
137
+ .on('workspace.phase', '=', 'ready'),
138
+ )
139
+ .where('fleet.session_id', 'in', (eb) =>
128
140
  eb.selectFrom('session_owner').select('session_id').where('daemon_id', '=', this.daemonID),
129
141
  )
130
142
 
131
143
  // Stored order, which a restore keeps for sessions with no recency.
132
- .orderBy(sql`rowid`)
144
+ .orderBy(sql`fleet.rowid`)
133
145
  .select([
134
- 'session_id',
135
- 'agent_session_id',
136
- 'name',
137
- 'cwd',
138
- 'pinned',
139
- 'last_attached',
140
- 'agent',
141
- 'exited',
142
- 'parent_session_id',
143
- 'prompt',
144
- 'result',
145
- 'transcript_path',
146
- 'model',
147
- 'effort',
148
- 'target',
149
- 'target_identity',
146
+ 'fleet.session_id',
147
+ 'fleet.agent_session_id',
148
+ 'fleet.name',
149
+ 'fleet.cwd',
150
+ 'fleet.pinned',
151
+ 'fleet.last_attached',
152
+ 'fleet.agent',
153
+ 'fleet.exited',
154
+ 'fleet.parent_session_id',
155
+ 'fleet.prompt',
156
+ 'fleet.result',
157
+ 'fleet.transcript_path',
158
+ 'fleet.model',
159
+ 'fleet.effort',
160
+ 'fleet.target',
161
+ 'fleet.target_identity',
162
+ 'workspace.repo_url',
163
+ 'workspace.sha',
164
+ 'workspace.ref',
165
+ 'workspace.materialized_at',
166
+ 'workspace.withheld_env',
167
+ 'fleet.desired',
168
+ 'fleet.host_key',
150
169
  ])
151
170
  .execute();
152
171
 
@@ -172,6 +191,10 @@ export class StateStore {
172
191
  ...(row.effort === null ? {} : { effort: row.effort }),
173
192
  ...(row.target === null ? {} : { target: row.target }),
174
193
  ...(row.target_identity === null ? {} : { targetIdentity: row.target_identity }),
194
+ ...buildWorkspaceField(row),
195
+ ...buildWithheldEnvField(row.withheld_env),
196
+ ...(row.desired === 'sleep' || row.desired === 'stop' ? { desired: row.desired } : {}),
197
+ ...(row.host_key === null ? {} : { hostKey: toSessionID(row.host_key) }),
175
198
  });
176
199
  }
177
200
 
@@ -249,6 +272,8 @@ export class StateStore {
249
272
  effort: entry.effort ?? null,
250
273
  target: entry.target ?? null,
251
274
  target_identity: entry.targetIdentity ?? null,
275
+ desired: entry.desired ?? null,
276
+ host_key: entry.hostKey ?? null,
252
277
  })
253
278
  .execute();
254
279
 
@@ -306,8 +331,10 @@ export class StateStore {
306
331
  .execute();
307
332
  }
308
333
 
309
- async recordTrailEntry(entry: TrailEntry): Promise<void> {
310
- await this.db
334
+ // Returns whether the entry was written: a report whose id the trail
335
+ // already holds is left out.
336
+ async recordTrailEntry(entry: TrailEntry): Promise<boolean> {
337
+ const result = await this.db
311
338
  .insertInto('events')
312
339
  .values({
313
340
  ts: new Date(entry.at).toISOString(),
@@ -319,8 +346,12 @@ export class StateStore {
319
346
  session_id: entry.agentSessionID,
320
347
  kind: entry.kind,
321
348
  detail: entry.detail,
349
+ report_id: entry.kind === 'report' ? (entry.reportID ?? null) : null,
322
350
  })
323
- .execute();
351
+ .onConflict((oc) => oc.column('report_id').doNothing())
352
+ .executeTakeFirst();
353
+
354
+ return result.numInsertedOrUpdatedRows !== 0n;
324
355
  }
325
356
 
326
357
  async collectEventsAfter(
@@ -710,6 +741,76 @@ export class StateStore {
710
741
  .execute();
711
742
  }
712
743
 
744
+ // Records a materialization as it starts, in the resolving phase.
745
+ async createMaterialization(
746
+ row: Pick<
747
+ WorkspaceMaterialization,
748
+ 'sessionID' | 'target' | 'dir' | 'sourceKind' | 'withheldEnv'
749
+ >,
750
+ at: number,
751
+ ): Promise<void> {
752
+ await this.db
753
+ .insertInto('workspace_materialization')
754
+ .values({
755
+ session_id: row.sessionID,
756
+ target: row.target,
757
+ dir: row.dir,
758
+ source_kind: row.sourceKind,
759
+ phase: 'resolving',
760
+ repo_url: null,
761
+ sha: null,
762
+ ref: null,
763
+ error_code: null,
764
+ started_at: at,
765
+ updated_at: at,
766
+ materialized_at: null,
767
+ withheld_env: JSON.stringify(row.withheldEnv),
768
+ })
769
+ .execute();
770
+ }
771
+
772
+ async updateMaterialization(
773
+ sessionID: SessionID,
774
+ fields: MaterializationUpdate,
775
+ at: number,
776
+ ): Promise<void> {
777
+ await this.db
778
+ .updateTable('workspace_materialization')
779
+ .set({
780
+ phase: fields.phase,
781
+ ...(fields.repoURL === undefined ? {} : { repo_url: fields.repoURL }),
782
+ ...(fields.sha === undefined ? {} : { sha: fields.sha }),
783
+ ...(fields.ref === undefined ? {} : { ref: fields.ref }),
784
+ ...(fields.errorCode === undefined ? {} : { error_code: fields.errorCode }),
785
+ ...(fields.materializedAt === undefined ? {} : { materialized_at: fields.materializedAt }),
786
+ updated_at: at,
787
+ })
788
+ .where('session_id', '=', sessionID)
789
+ .execute();
790
+ }
791
+
792
+ async findMaterialization(sessionID: SessionID): Promise<WorkspaceMaterialization | null> {
793
+ const row = await this.db
794
+ .selectFrom('workspace_materialization')
795
+ .selectAll()
796
+ .where('session_id', '=', sessionID)
797
+ .executeTakeFirst();
798
+
799
+ return row === undefined ? null : toWorkspaceMaterialization(row);
800
+ }
801
+
802
+ // Runs once as a daemon starts, before it serves a request: a
803
+ // materialization still short of ready or failed belonged to a daemon that
804
+ // stopped partway through it, and its workspace was never verified, so it
805
+ // fails as interrupted.
806
+ async reconcileMaterializations(at: number): Promise<void> {
807
+ await this.db
808
+ .updateTable('workspace_materialization')
809
+ .set({ phase: 'failed', error_code: 'workspace_interrupted', updated_at: at })
810
+ .where('phase', 'not in', ['ready', 'failed'])
811
+ .execute();
812
+ }
813
+
713
814
  async stop(): Promise<void> {
714
815
  await this.db.destroy();
715
816
 
@@ -748,6 +849,30 @@ export class StateStore {
748
849
  }
749
850
  }
750
851
 
852
+ // A fleet row's ready workspace as its entry field, or nothing for a row
853
+ // that ran without one.
854
+ function buildWorkspaceField(
855
+ row: Readonly<{
856
+ repo_url: string | null;
857
+ sha: string | null;
858
+ ref: string | null;
859
+ materialized_at: number | null;
860
+ }>,
861
+ ): { readonly workspace?: SessionWorkspace } {
862
+ if (row.repo_url === null || row.sha === null || row.materialized_at === null) {
863
+ return {};
864
+ }
865
+
866
+ return {
867
+ workspace: {
868
+ repoURL: row.repo_url,
869
+ sha: row.sha,
870
+ ...(row.ref === null ? {} : { ref: row.ref }),
871
+ materializedAt: row.materialized_at,
872
+ },
873
+ };
874
+ }
875
+
751
876
  // Two sessions share an agent session id when one resumes the other's agent
752
877
  // session. The fleet keeps one row per agent session id, the entry written
753
878
  // last, and relinks the survivors as a one-level hierarchy of rows it holds:
@@ -761,6 +886,22 @@ export class StateStore {
761
886
  // row above it.
762
887
  //
763
888
  // Every walk takes at most one step per entry, so it ends on any input.
889
+ // A ready workspace's withheld variable names as their entry field, or
890
+ // nothing for a row that withholds none.
891
+ function buildWithheldEnvField(stored: string | null): { readonly withheldEnv?: string[] } {
892
+ const names = parseWithheldEnv(stored);
893
+
894
+ return names.length === 0 ? {} : { withheldEnv: names };
895
+ }
896
+
897
+ function parseWithheldEnv(stored: string | null): string[] {
898
+ const parsed: unknown = stored === null ? [] : JSON.parse(stored);
899
+
900
+ return Array.isArray(parsed)
901
+ ? parsed.filter((name): name is string => typeof name === 'string')
902
+ : [];
903
+ }
904
+
764
905
  function buildFleetWithoutReplacedRows(entries: readonly FleetEntry[]): FleetEntry[] {
765
906
  const survivors = new Map<AgentSessionID, SessionID>();
766
907
 
@@ -1033,3 +1174,23 @@ function toMessageRecord(row: Readonly<StateStoreSchema['messages']>): MessageRe
1033
1174
  ...(row.turn_id === null ? {} : { turn: row.turn_id }),
1034
1175
  };
1035
1176
  }
1177
+
1178
+ function toWorkspaceMaterialization(
1179
+ row: Readonly<StateStoreSchema['workspace_materialization']>,
1180
+ ): WorkspaceMaterialization {
1181
+ return {
1182
+ sessionID: toSessionID(row.session_id),
1183
+ target: row.target,
1184
+ dir: row.dir,
1185
+ sourceKind: row.source_kind,
1186
+ phase: row.phase,
1187
+ repoURL: row.repo_url,
1188
+ sha: row.sha,
1189
+ ref: row.ref,
1190
+ errorCode: row.error_code,
1191
+ startedAt: row.started_at,
1192
+ updatedAt: row.updated_at,
1193
+ materializedAt: row.materialized_at,
1194
+ withheldEnv: parseWithheldEnv(row.withheld_env),
1195
+ };
1196
+ }
@@ -18,6 +18,10 @@ interface MessageTrailEntry extends TrailEntryBase {
18
18
  interface ReportTrailEntry extends TrailEntryBase {
19
19
  readonly kind: 'report';
20
20
  readonly label: string;
21
+
22
+ // The id a remote session's reporter gave the report, so a resent
23
+ // report is stored once; absent for a report that carries none.
24
+ readonly reportID?: string;
21
25
  }
22
26
 
23
27
  /**
@@ -0,0 +1,70 @@
1
+ import type { SessionID } from '../shared/session-id';
2
+
3
+ /**
4
+ * Where a spawn's workspace stands on its way to the execution target:
5
+ * resolving the source to a commit, cloning it on the daemon's host,
6
+ * transferring the archive to the target, and verifying the target's
7
+ * checkout, then `ready` or `failed`. A row a stopped daemon left in any
8
+ * other phase is reconciled to `failed` before the next daemon serves a
9
+ * request, so no workspace ever counts as ready without its verification.
10
+ */
11
+ export type MaterializationPhase =
12
+ | 'resolving'
13
+ | 'cloning'
14
+ | 'transferring'
15
+ | 'verifying'
16
+ | 'ready'
17
+ | 'failed';
18
+
19
+ /**
20
+ * One spawn's workspace materialization, keyed by the session it is for.
21
+ * The repository URL is the token-free form, and the row never holds a
22
+ * credential or the reference to one.
23
+ */
24
+ export interface WorkspaceMaterialization {
25
+ readonly sessionID: SessionID;
26
+ readonly target: string;
27
+
28
+ // The directory on the target the workspace is materialized into.
29
+ readonly dir: string;
30
+ readonly sourceKind: 'path' | 'git';
31
+ readonly phase: MaterializationPhase;
32
+ readonly repoURL: string | null;
33
+ readonly sha: string | null;
34
+
35
+ // The branch or tag the commit was resolved from; null for a pinned
36
+ // commit or a detached checkout.
37
+ readonly ref: string | null;
38
+
39
+ // The refusal that failed the materialization; null unless failed.
40
+ readonly errorCode: string | null;
41
+ readonly startedAt: number;
42
+ readonly updatedAt: number;
43
+ readonly materializedAt: number | null;
44
+
45
+ // The environment variable names every harness the session starts goes
46
+ // without: the workspace credential's variable and the askpass context.
47
+ readonly withheldEnv: readonly string[];
48
+ }
49
+
50
+ // The fields a materialization rewrites as it moves through its phases.
51
+ export interface MaterializationUpdate {
52
+ readonly phase: MaterializationPhase;
53
+ readonly repoURL?: string;
54
+ readonly sha?: string;
55
+ readonly ref?: string | null;
56
+ readonly errorCode?: string;
57
+ readonly materializedAt?: number;
58
+ }
59
+
60
+ /**
61
+ * What a session's ready workspace was built from: the token-free
62
+ * repository URL, the commit checked out, the branch or tag it came from,
63
+ * and when it became ready.
64
+ */
65
+ export interface SessionWorkspace {
66
+ readonly repoURL: string;
67
+ readonly sha: string;
68
+ readonly ref?: string;
69
+ readonly materializedAt: number;
70
+ }
package/src/tap.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  import { DaemonClient } from './client/daemon-client';
3
3
  import { DaemonError } from './protocol/daemon-error';
4
+ import { runBridgeTap } from './run-bridge-tap';
4
5
  import { daemonSocketPath } from './shared/config';
5
6
  import { getBuild } from './shared/get-build';
6
7
 
@@ -28,6 +29,16 @@ interface InboxMessage {
28
29
  * another tap replaced it or the session was removed.
29
30
  */
30
31
  export async function runTap(session: string): Promise<void> {
32
+ const bridge = process.env['ATC_SOCKET'];
33
+
34
+ // Inside a remote host the daemon's own socket is out of reach, and the
35
+ // session bridge serves the tap instead.
36
+ if (process.env['ATC_BRIDGE'] === '1' && bridge !== undefined && bridge !== '') {
37
+ await runBridgeTap(bridge, process.env['ATC_OUTBOX'] ?? '');
38
+
39
+ return;
40
+ }
41
+
31
42
  let client: DaemonClient;
32
43
 
33
44
  try {
@@ -0,0 +1,59 @@
1
+ import { runGit } from './run-git';
2
+
3
+ type URLCredentialFinding =
4
+ | { readonly ok: true }
5
+ | { readonly ok: false; readonly code: 'credential_in_url'; readonly message: string };
6
+
7
+ /**
8
+ * Checks that a repository URL reaches git without a credential in it, so
9
+ * a token can never surface in git's own messages or in the clone. The URL
10
+ * itself must carry none, and no `url.<base>.insteadOf` rewrite in the git
11
+ * config read from `cwd` may expand it into one that does. git expands the
12
+ * URL without touching the network. An http(s) URL carries a credential in
13
+ * its userinfo, query, or fragment; any other scheme URL only in a
14
+ * password, since its user is a login name such as `git`.
15
+ */
16
+ export async function checkURLCredentials(url: string, cwd: string): Promise<URLCredentialFinding> {
17
+ // git prints the URL as it would fetch it, with every rewrite applied.
18
+ const expanded = await runGit(['ls-remote', '--get-url', url], { cwd });
19
+
20
+ const fetched = expanded.exitCode === 0 ? expanded.stdout.trim() : url;
21
+
22
+ if (!hasURLCredential(fetched)) {
23
+ return { ok: true };
24
+ }
25
+
26
+ return {
27
+ ok: false,
28
+ code: 'credential_in_url',
29
+ message: hasURLCredential(url)
30
+ ? 'the repository URL carries a credential; pass it as a credentialRef instead'
31
+ : 'a url.<base>.insteadOf rewrite in the host git config puts a credential into the repository URL; remove the rewrite or pass the credential as a credentialRef',
32
+ };
33
+ }
34
+
35
+ const SCHEME_PATTERN = /^[a-z][a-z\d+.-]*:\/\//iu;
36
+
37
+ const HTTP_PROTOCOLS: ReadonlySet<string> = new Set(['http:', 'https:']);
38
+
39
+ function hasURLCredential(url: string): boolean {
40
+ if (!SCHEME_PATTERN.test(url)) {
41
+ return false;
42
+ }
43
+
44
+ let parsed: URL;
45
+
46
+ try {
47
+ parsed = new URL(url);
48
+ } catch {
49
+ return false;
50
+ }
51
+
52
+ if (HTTP_PROTOCOLS.has(parsed.protocol)) {
53
+ return (
54
+ parsed.username !== '' || parsed.password !== '' || parsed.search !== '' || parsed.hash !== ''
55
+ );
56
+ }
57
+
58
+ return parsed.password !== '';
59
+ }
@@ -40,6 +40,9 @@ type IncompleteCheckout = Exclude<
40
40
  * objects rather than hard-linking them, takes no hook templates, and runs no
41
41
  * hooks on checkout.
42
42
  *
43
+ * A ref, or a full commit id, that the upstream does not have is refused as
44
+ * `ref_not_found`, and the directory is removed.
45
+ *
43
46
  * The checked-out commit must be the whole workspace: one that uses
44
47
  * submodules or tracks paths through Git LFS is refused and the directory is
45
48
  * removed. The clone fetches without checking out, and the checkout then
@@ -163,9 +166,18 @@ async function createCloneAtRef(
163
166
  );
164
167
 
165
168
  if (checkout.exitCode !== 0) {
169
+ // A pinned commit that no upstream ref reaches never arrives in the
170
+ // clone, so its checkout fails on a commit the upstream does not have.
171
+ const present = await runGit(['cat-file', '-e', `${target.sha}^{commit}`], {
172
+ cwd: request.dir,
173
+ isolated: true,
174
+ });
175
+
166
176
  await rm(request.dir, { recursive: true, force: true });
167
177
 
168
- return { ok: false, code: 'clone_failed', message: checkout.stderr.trim() };
178
+ return target.branch === null && present.exitCode !== 0
179
+ ? { ok: false, code: 'ref_not_found', message: `origin has no commit ${target.sha}` }
180
+ : { ok: false, code: 'clone_failed', message: checkout.stderr.trim() };
169
181
  }
170
182
 
171
183
  const complete = await checkWorkspaceCompleteness(request.dir, target.sha);
@@ -0,0 +1,22 @@
1
+ /**
2
+ * The variables that pin git to a repository other than the one in its
3
+ * working directory, such as the `GIT_DIR` a git hook exports. A command
4
+ * that must act on its own directory runs without every one of them.
5
+ */
6
+ export const REPOSITORY_ENV_VARS: ReadonlySet<string> = new Set([
7
+ 'GIT_ALTERNATE_OBJECT_DIRECTORIES',
8
+ 'GIT_COMMON_DIR',
9
+ 'GIT_CONFIG',
10
+ 'GIT_CONFIG_COUNT',
11
+ 'GIT_CONFIG_PARAMETERS',
12
+ 'GIT_DIR',
13
+ 'GIT_GRAFT_FILE',
14
+ 'GIT_IMPLICIT_WORK_TREE',
15
+ 'GIT_INDEX_FILE',
16
+ 'GIT_NO_REPLACE_OBJECTS',
17
+ 'GIT_OBJECT_DIRECTORY',
18
+ 'GIT_PREFIX',
19
+ 'GIT_REPLACE_REF_BASE',
20
+ 'GIT_SHALLOW_FILE',
21
+ 'GIT_WORK_TREE',
22
+ ]);
@@ -1,3 +1,5 @@
1
+ import { REPOSITORY_ENV_VARS } from './repository-env-vars';
2
+
1
3
  interface GitRunOptions {
2
4
  readonly cwd?: string;
3
5
  readonly env?: Readonly<Record<string, string>>;
@@ -73,24 +75,6 @@ export async function runGit(
73
75
  return { exitCode, stdout, stderr };
74
76
  }
75
77
 
76
- const REPOSITORY_ENV_VARS: ReadonlySet<string> = new Set([
77
- 'GIT_ALTERNATE_OBJECT_DIRECTORIES',
78
- 'GIT_COMMON_DIR',
79
- 'GIT_CONFIG',
80
- 'GIT_CONFIG_COUNT',
81
- 'GIT_CONFIG_PARAMETERS',
82
- 'GIT_DIR',
83
- 'GIT_GRAFT_FILE',
84
- 'GIT_IMPLICIT_WORK_TREE',
85
- 'GIT_INDEX_FILE',
86
- 'GIT_NO_REPLACE_OBJECTS',
87
- 'GIT_OBJECT_DIRECTORY',
88
- 'GIT_PREFIX',
89
- 'GIT_REPLACE_REF_BASE',
90
- 'GIT_SHALLOW_FILE',
91
- 'GIT_WORK_TREE',
92
- ]);
93
-
94
78
  function collectHostEnv(): Record<string, string | undefined> {
95
79
  return Object.fromEntries(
96
80
  Object.entries(process.env).filter(