@paysdoc/devplatform 1.0.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 (243) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +122 -0
  3. package/dist/git/bootstrapIdentity.d.ts +50 -0
  4. package/dist/git/bootstrapIdentity.d.ts.map +1 -0
  5. package/dist/git/bootstrapIdentity.js +72 -0
  6. package/dist/git/bootstrapIdentity.js.map +1 -0
  7. package/dist/git/branchOps.d.ts +27 -0
  8. package/dist/git/branchOps.d.ts.map +1 -0
  9. package/dist/git/branchOps.js +91 -0
  10. package/dist/git/branchOps.js.map +1 -0
  11. package/dist/git/claimOps.d.ts +40 -0
  12. package/dist/git/claimOps.d.ts.map +1 -0
  13. package/dist/git/claimOps.js +44 -0
  14. package/dist/git/claimOps.js.map +1 -0
  15. package/dist/git/commitOps.d.ts +35 -0
  16. package/dist/git/commitOps.d.ts.map +1 -0
  17. package/dist/git/commitOps.js +131 -0
  18. package/dist/git/commitOps.js.map +1 -0
  19. package/dist/git/consoleLogger.d.ts +8 -0
  20. package/dist/git/consoleLogger.d.ts.map +1 -0
  21. package/dist/git/consoleLogger.js +9 -0
  22. package/dist/git/consoleLogger.js.map +1 -0
  23. package/dist/git/gitContext.d.ts +150 -0
  24. package/dist/git/gitContext.d.ts.map +1 -0
  25. package/dist/git/gitContext.js +405 -0
  26. package/dist/git/gitContext.js.map +1 -0
  27. package/dist/git/gitReadOps.d.ts +33 -0
  28. package/dist/git/gitReadOps.d.ts.map +1 -0
  29. package/dist/git/gitReadOps.js +38 -0
  30. package/dist/git/gitReadOps.js.map +1 -0
  31. package/dist/git/index.d.ts +49 -0
  32. package/dist/git/index.d.ts.map +1 -0
  33. package/dist/git/index.js +44 -0
  34. package/dist/git/index.js.map +1 -0
  35. package/dist/git/processCleanup.d.ts +7 -0
  36. package/dist/git/processCleanup.d.ts.map +1 -0
  37. package/dist/git/processCleanup.js +45 -0
  38. package/dist/git/processCleanup.js.map +1 -0
  39. package/dist/git/remoteOps.d.ts +25 -0
  40. package/dist/git/remoteOps.d.ts.map +1 -0
  41. package/dist/git/remoteOps.js +30 -0
  42. package/dist/git/remoteOps.js.map +1 -0
  43. package/dist/git/repoWorkspace.d.ts +72 -0
  44. package/dist/git/repoWorkspace.d.ts.map +1 -0
  45. package/dist/git/repoWorkspace.js +85 -0
  46. package/dist/git/repoWorkspace.js.map +1 -0
  47. package/dist/git/types.d.ts +182 -0
  48. package/dist/git/types.d.ts.map +1 -0
  49. package/dist/git/types.js +10 -0
  50. package/dist/git/types.js.map +1 -0
  51. package/dist/git/workingDirectoryGuard.d.ts +39 -0
  52. package/dist/git/workingDirectoryGuard.d.ts.map +1 -0
  53. package/dist/git/workingDirectoryGuard.js +53 -0
  54. package/dist/git/workingDirectoryGuard.js.map +1 -0
  55. package/dist/git/worktreeCreateOps.d.ts +45 -0
  56. package/dist/git/worktreeCreateOps.d.ts.map +1 -0
  57. package/dist/git/worktreeCreateOps.js +208 -0
  58. package/dist/git/worktreeCreateOps.js.map +1 -0
  59. package/dist/git/worktreeProbeOps.d.ts +17 -0
  60. package/dist/git/worktreeProbeOps.d.ts.map +1 -0
  61. package/dist/git/worktreeProbeOps.js +66 -0
  62. package/dist/git/worktreeProbeOps.js.map +1 -0
  63. package/dist/git/worktreeQueryOps.d.ts +45 -0
  64. package/dist/git/worktreeQueryOps.d.ts.map +1 -0
  65. package/dist/git/worktreeQueryOps.js +129 -0
  66. package/dist/git/worktreeQueryOps.js.map +1 -0
  67. package/dist/git/worktreeRemoveOps.d.ts +27 -0
  68. package/dist/git/worktreeRemoveOps.d.ts.map +1 -0
  69. package/dist/git/worktreeRemoveOps.js +132 -0
  70. package/dist/git/worktreeRemoveOps.js.map +1 -0
  71. package/dist/git/worktreeResetOps.d.ts +18 -0
  72. package/dist/git/worktreeResetOps.d.ts.map +1 -0
  73. package/dist/git/worktreeResetOps.js +68 -0
  74. package/dist/git/worktreeResetOps.js.map +1 -0
  75. package/dist/index.d.ts +13 -0
  76. package/dist/index.d.ts.map +1 -0
  77. package/dist/index.js +13 -0
  78. package/dist/index.js.map +1 -0
  79. package/dist/providers/forgeProviders.d.ts +72 -0
  80. package/dist/providers/forgeProviders.d.ts.map +1 -0
  81. package/dist/providers/forgeProviders.js +112 -0
  82. package/dist/providers/forgeProviders.js.map +1 -0
  83. package/dist/providers/github/appAuth.d.ts +70 -0
  84. package/dist/providers/github/appAuth.d.ts.map +1 -0
  85. package/dist/providers/github/appAuth.js +243 -0
  86. package/dist/providers/github/appAuth.js.map +1 -0
  87. package/dist/providers/github/cloneUrl.d.ts +12 -0
  88. package/dist/providers/github/cloneUrl.d.ts.map +1 -0
  89. package/dist/providers/github/cloneUrl.js +20 -0
  90. package/dist/providers/github/cloneUrl.js.map +1 -0
  91. package/dist/providers/github/commands/boardCommands.d.ts +22 -0
  92. package/dist/providers/github/commands/boardCommands.d.ts.map +1 -0
  93. package/dist/providers/github/commands/boardCommands.js +66 -0
  94. package/dist/providers/github/commands/boardCommands.js.map +1 -0
  95. package/dist/providers/github/commands/issueCommands.d.ts +21 -0
  96. package/dist/providers/github/commands/issueCommands.d.ts.map +1 -0
  97. package/dist/providers/github/commands/issueCommands.js +50 -0
  98. package/dist/providers/github/commands/issueCommands.js.map +1 -0
  99. package/dist/providers/github/commands/labelCommands.d.ts +3 -0
  100. package/dist/providers/github/commands/labelCommands.d.ts.map +1 -0
  101. package/dist/providers/github/commands/labelCommands.js +8 -0
  102. package/dist/providers/github/commands/labelCommands.js.map +1 -0
  103. package/dist/providers/github/commands/prCommands.d.ts +14 -0
  104. package/dist/providers/github/commands/prCommands.d.ts.map +1 -0
  105. package/dist/providers/github/commands/prCommands.js +46 -0
  106. package/dist/providers/github/commands/prCommands.js.map +1 -0
  107. package/dist/providers/github/commands/secretCommands.d.ts +2 -0
  108. package/dist/providers/github/commands/secretCommands.d.ts.map +1 -0
  109. package/dist/providers/github/commands/secretCommands.js +5 -0
  110. package/dist/providers/github/commands/secretCommands.js.map +1 -0
  111. package/dist/providers/github/contextBinding.d.ts +11 -0
  112. package/dist/providers/github/contextBinding.d.ts.map +1 -0
  113. package/dist/providers/github/contextBinding.js +15 -0
  114. package/dist/providers/github/contextBinding.js.map +1 -0
  115. package/dist/providers/github/domain/issue.d.ts +94 -0
  116. package/dist/providers/github/domain/issue.d.ts.map +1 -0
  117. package/dist/providers/github/domain/issue.js +7 -0
  118. package/dist/providers/github/domain/issue.js.map +1 -0
  119. package/dist/providers/github/domain/pullRequest.d.ts +55 -0
  120. package/dist/providers/github/domain/pullRequest.d.ts.map +1 -0
  121. package/dist/providers/github/domain/pullRequest.js +9 -0
  122. package/dist/providers/github/domain/pullRequest.js.map +1 -0
  123. package/dist/providers/github/ghAuthToken.d.ts +28 -0
  124. package/dist/providers/github/ghAuthToken.d.ts.map +1 -0
  125. package/dist/providers/github/ghAuthToken.js +39 -0
  126. package/dist/providers/github/ghAuthToken.js.map +1 -0
  127. package/dist/providers/github/ghCommandRunner.d.ts +20 -0
  128. package/dist/providers/github/ghCommandRunner.d.ts.map +1 -0
  129. package/dist/providers/github/ghCommandRunner.js +21 -0
  130. package/dist/providers/github/ghCommandRunner.js.map +1 -0
  131. package/dist/providers/github/ghIssueApi.d.ts +29 -0
  132. package/dist/providers/github/ghIssueApi.d.ts.map +1 -0
  133. package/dist/providers/github/ghIssueApi.js +37 -0
  134. package/dist/providers/github/ghIssueApi.js.map +1 -0
  135. package/dist/providers/github/ghIssueParsers.d.ts +28 -0
  136. package/dist/providers/github/ghIssueParsers.d.ts.map +1 -0
  137. package/dist/providers/github/ghIssueParsers.js +105 -0
  138. package/dist/providers/github/ghIssueParsers.js.map +1 -0
  139. package/dist/providers/github/ghPrApi.d.ts +27 -0
  140. package/dist/providers/github/ghPrApi.d.ts.map +1 -0
  141. package/dist/providers/github/ghPrApi.js +32 -0
  142. package/dist/providers/github/ghPrApi.js.map +1 -0
  143. package/dist/providers/github/ghPrParsers.d.ts +57 -0
  144. package/dist/providers/github/ghPrParsers.d.ts.map +1 -0
  145. package/dist/providers/github/ghPrParsers.js +135 -0
  146. package/dist/providers/github/ghPrParsers.js.map +1 -0
  147. package/dist/providers/github/ghRepoApi.d.ts +33 -0
  148. package/dist/providers/github/ghRepoApi.d.ts.map +1 -0
  149. package/dist/providers/github/ghRepoApi.js +89 -0
  150. package/dist/providers/github/ghRepoApi.js.map +1 -0
  151. package/dist/providers/github/githubBoardManager.d.ts +39 -0
  152. package/dist/providers/github/githubBoardManager.d.ts.map +1 -0
  153. package/dist/providers/github/githubBoardManager.js +166 -0
  154. package/dist/providers/github/githubBoardManager.js.map +1 -0
  155. package/dist/providers/github/githubCodeHost.d.ts +73 -0
  156. package/dist/providers/github/githubCodeHost.d.ts.map +1 -0
  157. package/dist/providers/github/githubCodeHost.js +217 -0
  158. package/dist/providers/github/githubCodeHost.js.map +1 -0
  159. package/dist/providers/github/githubIdentity.d.ts +51 -0
  160. package/dist/providers/github/githubIdentity.d.ts.map +1 -0
  161. package/dist/providers/github/githubIdentity.js +110 -0
  162. package/dist/providers/github/githubIdentity.js.map +1 -0
  163. package/dist/providers/github/githubIssueTracker.d.ts +69 -0
  164. package/dist/providers/github/githubIssueTracker.d.ts.map +1 -0
  165. package/dist/providers/github/githubIssueTracker.js +209 -0
  166. package/dist/providers/github/githubIssueTracker.js.map +1 -0
  167. package/dist/providers/github/githubTokenProvider.d.ts +41 -0
  168. package/dist/providers/github/githubTokenProvider.d.ts.map +1 -0
  169. package/dist/providers/github/githubTokenProvider.js +51 -0
  170. package/dist/providers/github/githubTokenProvider.js.map +1 -0
  171. package/dist/providers/github/index.d.ts +10 -0
  172. package/dist/providers/github/index.d.ts.map +1 -0
  173. package/dist/providers/github/index.js +5 -0
  174. package/dist/providers/github/index.js.map +1 -0
  175. package/dist/providers/github/mappers.d.ts +40 -0
  176. package/dist/providers/github/mappers.d.ts.map +1 -0
  177. package/dist/providers/github/mappers.js +103 -0
  178. package/dist/providers/github/mappers.js.map +1 -0
  179. package/dist/providers/github/tokenResolver.d.ts +37 -0
  180. package/dist/providers/github/tokenResolver.d.ts.map +1 -0
  181. package/dist/providers/github/tokenResolver.js +43 -0
  182. package/dist/providers/github/tokenResolver.js.map +1 -0
  183. package/dist/providers/gitlab/gitlabApiClient.d.ts +45 -0
  184. package/dist/providers/gitlab/gitlabApiClient.d.ts.map +1 -0
  185. package/dist/providers/gitlab/gitlabApiClient.js +95 -0
  186. package/dist/providers/gitlab/gitlabApiClient.js.map +1 -0
  187. package/dist/providers/gitlab/gitlabBoardManager.d.ts +11 -0
  188. package/dist/providers/gitlab/gitlabBoardManager.d.ts.map +1 -0
  189. package/dist/providers/gitlab/gitlabBoardManager.js +27 -0
  190. package/dist/providers/gitlab/gitlabBoardManager.js.map +1 -0
  191. package/dist/providers/gitlab/gitlabCodeHost.d.ts +49 -0
  192. package/dist/providers/gitlab/gitlabCodeHost.d.ts.map +1 -0
  193. package/dist/providers/gitlab/gitlabCodeHost.js +109 -0
  194. package/dist/providers/gitlab/gitlabCodeHost.js.map +1 -0
  195. package/dist/providers/gitlab/gitlabTypes.d.ts +46 -0
  196. package/dist/providers/gitlab/gitlabTypes.d.ts.map +1 -0
  197. package/dist/providers/gitlab/gitlabTypes.js +6 -0
  198. package/dist/providers/gitlab/gitlabTypes.js.map +1 -0
  199. package/dist/providers/gitlab/index.d.ts +5 -0
  200. package/dist/providers/gitlab/index.d.ts.map +1 -0
  201. package/dist/providers/gitlab/index.js +4 -0
  202. package/dist/providers/gitlab/index.js.map +1 -0
  203. package/dist/providers/gitlab/mappers.d.ts +26 -0
  204. package/dist/providers/gitlab/mappers.d.ts.map +1 -0
  205. package/dist/providers/gitlab/mappers.js +63 -0
  206. package/dist/providers/gitlab/mappers.js.map +1 -0
  207. package/dist/providers/index.d.ts +7 -0
  208. package/dist/providers/index.d.ts.map +1 -0
  209. package/dist/providers/index.js +7 -0
  210. package/dist/providers/index.js.map +1 -0
  211. package/dist/providers/jira/adfConverter.d.ts +32 -0
  212. package/dist/providers/jira/adfConverter.d.ts.map +1 -0
  213. package/dist/providers/jira/adfConverter.js +144 -0
  214. package/dist/providers/jira/adfConverter.js.map +1 -0
  215. package/dist/providers/jira/index.d.ts +8 -0
  216. package/dist/providers/jira/index.d.ts.map +1 -0
  217. package/dist/providers/jira/index.js +5 -0
  218. package/dist/providers/jira/index.js.map +1 -0
  219. package/dist/providers/jira/jiraApiClient.d.ts +42 -0
  220. package/dist/providers/jira/jiraApiClient.d.ts.map +1 -0
  221. package/dist/providers/jira/jiraApiClient.js +84 -0
  222. package/dist/providers/jira/jiraApiClient.js.map +1 -0
  223. package/dist/providers/jira/jiraBoardManager.d.ts +11 -0
  224. package/dist/providers/jira/jiraBoardManager.d.ts.map +1 -0
  225. package/dist/providers/jira/jiraBoardManager.js +27 -0
  226. package/dist/providers/jira/jiraBoardManager.js.map +1 -0
  227. package/dist/providers/jira/jiraIssueTracker.d.ts +53 -0
  228. package/dist/providers/jira/jiraIssueTracker.d.ts.map +1 -0
  229. package/dist/providers/jira/jiraIssueTracker.js +231 -0
  230. package/dist/providers/jira/jiraIssueTracker.js.map +1 -0
  231. package/dist/providers/jira/jiraTypes.d.ts +61 -0
  232. package/dist/providers/jira/jiraTypes.d.ts.map +1 -0
  233. package/dist/providers/jira/jiraTypes.js +6 -0
  234. package/dist/providers/jira/jiraTypes.js.map +1 -0
  235. package/dist/providers/types.d.ts +271 -0
  236. package/dist/providers/types.d.ts.map +1 -0
  237. package/dist/providers/types.js +52 -0
  238. package/dist/providers/types.js.map +1 -0
  239. package/dist/providers/workspaceValidation.d.ts +18 -0
  240. package/dist/providers/workspaceValidation.d.ts.map +1 -0
  241. package/dist/providers/workspaceValidation.js +37 -0
  242. package/dist/providers/workspaceValidation.js.map +1 -0
  243. package/package.json +66 -0
@@ -0,0 +1,405 @@
1
+ /**
2
+ * GitContext deep module — the single authority for "which repo's filesystem."
3
+ *
4
+ * A GitContext is constructed from a mandatory identity (owner, repo, selfHost,
5
+ * tokenProvider, gitIdentity) plus injected config (frameworkRepoRoot, targetReposDir).
6
+ * Base-path resolution lives only in the constructor — no optional base path,
7
+ * no cwd fallback. Incomplete identity is a hard construction error.
8
+ *
9
+ * Every git operation — and every forge adapter built on this package — is
10
+ * routed through `exec()`, the package's public, forge-neutral executor — the
11
+ * single spawn site, single env merge, single cwd resolution and single
12
+ * ENOENT-rewrap `catch` in the package. `exec()` knows nothing about what a
13
+ * command means: no forge semantics, no token selection, no `--repo`
14
+ * awareness.
15
+ *
16
+ * A private classifier chooses the working-directory CLASS and assembles the
17
+ * credential env, then delegates to `exec()`:
18
+ * - #run() — git commands and workspace-scoped operations. Resolves to the
19
+ * context base path (or an explicit worktree path when
20
+ * supplied).
21
+ * Forge adapters build their own classifier on top of the same primitives —
22
+ * one resolves to the injected framework repo root (`ExecWorkingDirectory`'s
23
+ * `frameworkRoot` class) for commands whose repository identity travels in
24
+ * the command string, so a repo-independent command can run without the
25
+ * target workspace ever having been cloned.
26
+ *
27
+ * `#run` assembles its credential environment through the **TokenProvider
28
+ * port** (`#credentials`, see `types.ts`), asked once per command and never
29
+ * cached by the core, plus git identity — merged into the child environment
30
+ * without ever mutating process.env. It declares only a forge-neutral
31
+ * `CredentialPurpose`; the provider decides which credential answers it.
32
+ * Identity validation probes the provider once at construction and discards
33
+ * the result — see `assertCompleteIdentity`.
34
+ *
35
+ * A spawn failure caused by a missing working directory (basePath or an
36
+ * explicit worktree path that has never been cloned/created on this host)
37
+ * is rewrapped inside `exec()` into an error naming the path and repository
38
+ * identity, preserving `code: 'ENOENT'`; every other failure propagates
39
+ * verbatim.
40
+ *
41
+ * Worktree-operation logging arrives through an injected `Logger` port
42
+ * (`deps.logger`), defaulting to `consoleLogger` — so the package carries no
43
+ * dependency on the host application's logger (PRD story 17).
44
+ */
45
+ import * as path from 'path';
46
+ import { execSync } from 'child_process';
47
+ import { existsSync, mkdirSync, copyFileSync, rmSync } from 'fs';
48
+ import { consoleLogger } from './consoleLogger.js';
49
+ import { branchOps } from './branchOps.js';
50
+ import { commitOps } from './commitOps.js';
51
+ import { worktreeResetOps } from './worktreeResetOps.js';
52
+ import { worktreeQueryOps } from './worktreeQueryOps.js';
53
+ import { worktreeCreateOps } from './worktreeCreateOps.js';
54
+ import { worktreeRemoveOps } from './worktreeRemoveOps.js';
55
+ import { worktreeProbeOps } from './worktreeProbeOps.js';
56
+ import { gitReadOps } from './gitReadOps.js';
57
+ import { remoteOps } from './remoteOps.js';
58
+ import { claimOps } from './claimOps.js';
59
+ import { rewrapMissingWorkingDirectory } from './workingDirectoryGuard.js';
60
+ /** Single real spawn site for the package — a thin execSync wrapper. */
61
+ const defaultExec = (command, options) => {
62
+ if (options.input !== undefined) {
63
+ return execSync(command, {
64
+ ...options,
65
+ encoding: 'utf-8',
66
+ input: options.input,
67
+ stdio: ['pipe', 'pipe', 'pipe'],
68
+ maxBuffer: 10 * 1024 * 1024,
69
+ });
70
+ }
71
+ return execSync(command, { ...options, encoding: 'utf-8', maxBuffer: 10 * 1024 * 1024 });
72
+ };
73
+ function assertCompleteIdentity(options) {
74
+ const required = [
75
+ ['owner', options.owner],
76
+ ['repo', options.repo],
77
+ ['frameworkRepoRoot', options.frameworkRepoRoot],
78
+ ['targetReposDir', options.targetReposDir],
79
+ ];
80
+ for (const [field, value] of required) {
81
+ if (!value?.trim())
82
+ throw new Error(`GitContext: ${field} must not be empty`);
83
+ }
84
+ if (typeof options.selfHost !== 'boolean') {
85
+ throw new Error('GitContext: selfHost discriminator must be a boolean (true = self-host, false = target)');
86
+ }
87
+ if (!options.gitIdentity)
88
+ throw new Error('GitContext: gitIdentity must be provided');
89
+ const id = options.gitIdentity;
90
+ const idFields = [
91
+ ['authorName', id.authorName],
92
+ ['authorEmail', id.authorEmail],
93
+ ['committerName', id.committerName],
94
+ ['committerEmail', id.committerEmail],
95
+ ];
96
+ for (const [field, value] of idFields) {
97
+ if (!value?.trim())
98
+ throw new Error(`GitContext: gitIdentity.${field} must not be empty`);
99
+ }
100
+ if (!options.tokenProvider) {
101
+ throw new Error('GitContext: tokenProvider must be provided');
102
+ }
103
+ // Validate-and-discard probe: construction performs exactly ONE
104
+ // resolution to fail loudly when the provider can produce no credential —
105
+ // preserving the loud launch-time failure that launchGitContext and
106
+ // gitContextFactory callers depend on — but the answer is thrown away
107
+ // immediately. The first real command still resolves the provider's
108
+ // SECOND answer, never this one. This is what keeps "never cached at
109
+ // construction" literally true while still validating eagerly.
110
+ const probe = options.tokenProvider.credentialEnv({ owner: options.owner, repo: options.repo, purpose: 'default' });
111
+ const values = Object.values(probe);
112
+ const isComplete = values.length > 0 && values.every((v) => !!v?.trim());
113
+ if (!isComplete) {
114
+ throw new Error(`GitContext: tokenProvider returned no credential for ${options.owner}/${options.repo}`);
115
+ }
116
+ }
117
+ function resolveBasePath(options) {
118
+ return options.selfHost
119
+ ? options.frameworkRepoRoot
120
+ : path.join(options.targetReposDir, options.owner, options.repo);
121
+ }
122
+ function sanitizeBranchName(branch) {
123
+ return branch.replace(/[/\\:*?"<>|`]/g, '-');
124
+ }
125
+ export class GitContext {
126
+ #basePath;
127
+ #repoApiCwd;
128
+ #owner;
129
+ #repo;
130
+ #selfHost;
131
+ #credentials;
132
+ #gitIdentity;
133
+ #execFn;
134
+ #fsDeps;
135
+ #log;
136
+ constructor(options, deps = {}) {
137
+ assertCompleteIdentity(options);
138
+ this.#owner = options.owner;
139
+ this.#repo = options.repo;
140
+ this.#selfHost = options.selfHost;
141
+ this.#credentials = options.tokenProvider;
142
+ this.#gitIdentity = options.gitIdentity;
143
+ this.#basePath = resolveBasePath(options);
144
+ this.#repoApiCwd = options.frameworkRepoRoot;
145
+ this.#execFn = deps.exec ?? defaultExec;
146
+ this.#fsDeps = deps.fsDeps ?? { existsSync, mkdirSync, copyFileSync, rmSync };
147
+ this.#log = deps.logger ?? consoleLogger;
148
+ }
149
+ get basePath() { return this.#basePath; }
150
+ get owner() { return this.#owner; }
151
+ get repo() { return this.#repo; }
152
+ get selfHost() { return this.#selfHost; }
153
+ worktreePathFor(branch) {
154
+ if (!branch || !branch.trim())
155
+ throw new Error('GitContext: branch must not be empty');
156
+ return path.join(this.#basePath, '.worktrees', sanitizeBranchName(branch));
157
+ }
158
+ /**
159
+ * Assembles a command's environment overlay. The credential is resolved
160
+ * through the TokenProvider port on **every call** — never captured at
161
+ * construction — so a long-running orchestrator's agent-subprocess call
162
+ * sites (buildPhase.ts, documentPhase.ts, reviewPhase.ts, prPhase.ts,
163
+ * prReviewPhase.ts, scenarioFixPhase.ts, promotionRotAdvisory.ts) each get a
164
+ * freshly-resolved credential per invocation. The credential is spread
165
+ * before the GIT_* identity assignments so a hostile or misbehaving
166
+ * provider can never displace the context's git identity; both are spread
167
+ * after `base`, preserving existing precedence for call sites that pass an
168
+ * overlay base.
169
+ */
170
+ commandEnv(base = {}, purpose = 'default') {
171
+ return {
172
+ ...base,
173
+ ...this.#credentials.credentialEnv({ owner: this.#owner, repo: this.#repo, purpose }),
174
+ GIT_AUTHOR_NAME: this.#gitIdentity.authorName,
175
+ GIT_AUTHOR_EMAIL: this.#gitIdentity.authorEmail,
176
+ GIT_COMMITTER_NAME: this.#gitIdentity.committerName,
177
+ GIT_COMMITTER_EMAIL: this.#gitIdentity.committerEmail,
178
+ };
179
+ }
180
+ /** Resolves a working-directory CLASS to the concrete path `exec()` spawns in. */
181
+ #resolveWorkingDirectory(spec) {
182
+ if (spec.kind === 'frameworkRoot')
183
+ return this.#repoApiCwd;
184
+ if (spec.path === undefined)
185
+ return this.#basePath;
186
+ if (!spec.path.trim())
187
+ throw new Error('GitContext: exec working directory path must not be empty');
188
+ return spec.path;
189
+ }
190
+ /**
191
+ * The package's public, forge-neutral executor — the single spawn site.
192
+ * Every git/gh operation in this class, and every future forge adapter
193
+ * built on this package, reaches a child process through here.
194
+ *
195
+ * `command` is the FIRST POSITIONAL parameter by contract, not a field on
196
+ * `options`: `adws/checkGitGhGuard.ts`'s `git-gh-shellout` rule only
197
+ * inspects a call's first argument, so an options-object form would
198
+ * silently disable that guard for every consumer of this method.
199
+ *
200
+ * `options.cwd` is a working-directory CLASS, never a bare path, and there
201
+ * is no `process.cwd()` fallback — see `ExecWorkingDirectory`.
202
+ * `options.env` is a per-command credential/identity overlay merged over
203
+ * the inherited process environment; `process.env` itself is never
204
+ * mutated. `options.input`, when supplied, is piped to the child's stdin.
205
+ *
206
+ * Returns stdout, trimmed — every existing call site depends on this.
207
+ * A spawn failure caused by a missing working directory is rewrapped into
208
+ * an actionable error naming the path and repository identity, preserving
209
+ * `code: 'ENOENT'`; every other failure (including an ENOENT whose cwd
210
+ * genuinely exists) propagates verbatim.
211
+ *
212
+ * Deliberately forge-neutral: no credential-purpose parameter, no token
213
+ * selection, no forge vocabulary anywhere in this signature.
214
+ */
215
+ exec(command, options) {
216
+ if (!command.trim())
217
+ throw new Error('GitContext: exec command must not be empty');
218
+ const cwd = this.#resolveWorkingDirectory(options.cwd);
219
+ const env = { ...process.env, ...options.env };
220
+ try {
221
+ return this.#execFn(command, { cwd, env, input: options.input }).trim();
222
+ }
223
+ catch (error) {
224
+ throw rewrapMissingWorkingDirectory(error, { cwd, command, owner: this.#owner, repo: this.#repo, selfHost: this.#selfHost }, this.#fsDeps.existsSync);
225
+ }
226
+ }
227
+ /**
228
+ * Workspace-scoped classifier over `exec()` — git commands and
229
+ * workspace-scoped operations. Resolves to the context base path, or to an
230
+ * explicit worktree path when supplied.
231
+ *
232
+ * opts.cwd — when provided, narrows the workspace class to this worktree path
233
+ * opts.input — when provided, passes the string to the child's stdin
234
+ */
235
+ #run(command, opts = {}) {
236
+ return this.exec(command, {
237
+ cwd: { kind: 'workspace', path: opts.cwd },
238
+ env: this.commandEnv({}),
239
+ input: opts.input,
240
+ });
241
+ }
242
+ // ── Branch ops ───────────────────────────────────────────────────────────────
243
+ getCurrentBranch(worktreePath) {
244
+ return branchOps.getCurrentBranch((cmd, cwd) => this.#run(cmd, { cwd }), worktreePath ?? this.#basePath);
245
+ }
246
+ mergeLatestFromDefaultBranch(defaultBranch, worktreePath) {
247
+ branchOps.mergeLatestFromDefaultBranch((cmd, cwd) => this.#run(cmd, { cwd }), defaultBranch, worktreePath);
248
+ }
249
+ fetchAndResetToRemote(defaultBranch, worktreePath) {
250
+ branchOps.fetchAndResetToRemote((cmd, cwd) => this.#run(cmd, { cwd }), defaultBranch, worktreePath);
251
+ }
252
+ deleteLocalBranch(branch, worktreePath) {
253
+ return branchOps.deleteLocalBranch((cmd, cwd) => this.#run(cmd, { cwd }), branch, worktreePath ?? this.#basePath);
254
+ }
255
+ deleteRemoteBranch(branch, worktreePath) {
256
+ return branchOps.deleteRemoteBranch((cmd, cwd) => this.#run(cmd, { cwd }), branch, worktreePath ?? this.#basePath);
257
+ }
258
+ // ── Commit/push ops ──────────────────────────────────────────────────────────
259
+ commitChanges(message, worktreePath, opts) {
260
+ return commitOps.commitChanges((cmd, cwd) => this.#run(cmd, { cwd }), message, worktreePath, opts);
261
+ }
262
+ removeAndCommitPaths(paths, message, worktreePath) {
263
+ return commitOps.removeAndCommitPaths((cmd, cwd) => this.#run(cmd, { cwd }), paths, message, worktreePath);
264
+ }
265
+ addAndCommitPaths(paths, message, worktreePath) {
266
+ return commitOps.addAndCommitPaths((cmd, cwd) => this.#run(cmd, { cwd }), paths, message, worktreePath);
267
+ }
268
+ pushBranch(branch, worktreePath) {
269
+ commitOps.pushBranch((cmd, cwd) => this.#run(cmd, { cwd }), branch, worktreePath);
270
+ }
271
+ getHeadTreeHash(worktreePath) {
272
+ return commitOps.getHeadTreeHash((cmd, cwd) => this.#run(cmd, { cwd }), worktreePath);
273
+ }
274
+ hasUncommittedChanges(worktreePath) {
275
+ return commitOps.hasUncommittedChanges((cmd, cwd) => this.#run(cmd, { cwd }), worktreePath);
276
+ }
277
+ // ── Worktree reset op ────────────────────────────────────────────────────────
278
+ resetWorktree(worktreePath, branch) {
279
+ worktreeResetOps.resetWorktree((cmd, cwd) => this.#run(cmd, { cwd }), this.#fsDeps, worktreePath, branch);
280
+ }
281
+ // ── Worktree management ops ──────────────────────────────────────────────────
282
+ #worktreesDir() {
283
+ return path.join(this.#basePath, '.worktrees');
284
+ }
285
+ #worktreePaths(branchName) {
286
+ return {
287
+ worktreesDir: this.#worktreesDir(),
288
+ worktreePath: this.worktreePathFor(branchName),
289
+ baseCwd: this.#basePath,
290
+ };
291
+ }
292
+ createWorktree(branchName, baseBranch) {
293
+ return worktreeCreateOps.createWorktree((cmd, cwd) => this.#run(cmd, { cwd }), this.#fsDeps, this.#log, this.#worktreePaths(branchName), branchName, baseBranch);
294
+ }
295
+ createWorktreeForNewBranch(branchName, baseBranch) {
296
+ return worktreeCreateOps.createWorktreeForNewBranch((cmd, cwd) => this.#run(cmd, { cwd }), this.#fsDeps, this.#log, this.#worktreePaths(branchName), branchName, baseBranch);
297
+ }
298
+ ensureWorktree(branchName, baseBranch) {
299
+ return worktreeCreateOps.ensureWorktree((cmd, cwd) => this.#run(cmd, { cwd }), this.#fsDeps, this.#log, this.#worktreePaths(branchName), branchName, baseBranch);
300
+ }
301
+ getWorktreeForBranch(branchName) {
302
+ return worktreeQueryOps.getWorktreeForBranch((cmd, cwd) => this.#run(cmd, { cwd }), this.#fsDeps, this.#basePath, this.worktreePathFor(branchName), branchName);
303
+ }
304
+ listWorktrees() {
305
+ return worktreeQueryOps.listWorktrees((cmd, cwd) => this.#run(cmd, { cwd }), this.#basePath);
306
+ }
307
+ findWorktreeForIssue(prefixes, issueNumber) {
308
+ return worktreeQueryOps.findWorktreeForIssue((cmd, cwd) => this.#run(cmd, { cwd }), this.#basePath, prefixes, issueNumber);
309
+ }
310
+ removeWorktree(branchName) {
311
+ return worktreeRemoveOps.removeWorktree((cmd, cwd) => this.#run(cmd, { cwd }), this.#fsDeps, this.#log, this.worktreePathFor(branchName), branchName, (branch) => this.deleteLocalBranch(branch), this.#basePath);
312
+ }
313
+ removeWorktreesForIssue(issueNumber) {
314
+ return worktreeRemoveOps.removeWorktreesForIssue((cmd, cwd) => this.#run(cmd, { cwd }), this.#fsDeps, this.#log, this.#basePath, issueNumber, (branch) => this.deleteLocalBranch(branch));
315
+ }
316
+ copyEnvToWorktree(worktreePath) {
317
+ worktreeCreateOps.copyEnvToWorktree(this.#fsDeps, this.#log, this.#basePath, worktreePath);
318
+ }
319
+ remoteUrl(cwd) {
320
+ return this.#run('git remote get-url origin', { cwd });
321
+ }
322
+ remotes(cwd) {
323
+ return this.#run('git remote', { cwd }).split('\n').map(s => s.trim()).filter(Boolean);
324
+ }
325
+ gitConfigUser(cwd) {
326
+ let name = null;
327
+ let email = null;
328
+ try {
329
+ const n = this.#run('git config user.name', { cwd });
330
+ name = n || null;
331
+ }
332
+ catch { /* unset key — expected non-error state */ }
333
+ try {
334
+ const e = this.#run('git config user.email', { cwd });
335
+ email = e || null;
336
+ }
337
+ catch { /* unset key — expected non-error state */ }
338
+ return { name, email };
339
+ }
340
+ // ── Worktree / branch probe reads ────────────────────────────────────────────
341
+ resolveGitDir(worktreePath) {
342
+ return worktreeProbeOps.resolveGitDir((cmd, cwd) => this.#run(cmd, { cwd }), worktreePath);
343
+ }
344
+ currentBranchSymbolic(worktreePath) {
345
+ return worktreeProbeOps.currentBranchSymbolic((cmd, cwd) => this.#run(cmd, { cwd }), worktreePath);
346
+ }
347
+ worktreeRegistration(worktreePath) {
348
+ return worktreeProbeOps.worktreeRegistration((cmd, cwd) => this.#run(cmd, { cwd }), worktreePath);
349
+ }
350
+ worktreeBranches(cwd) {
351
+ return worktreeQueryOps.worktreeBranches((cmd, c) => this.#run(cmd, { cwd: c }), cwd ?? this.#basePath);
352
+ }
353
+ localBranches(cwd) {
354
+ return branchOps.localBranches((cmd, c) => this.#run(cmd, { cwd: c }), cwd ?? this.#basePath);
355
+ }
356
+ mainRepoPath(cwd) {
357
+ return worktreeQueryOps.mainRepoPath((cmd, c) => this.#run(cmd, { cwd: c }), cwd ?? this.#basePath);
358
+ }
359
+ // ── Remote fetch / merge / ls-remote ops ────────────────────────────────────
360
+ fetchRemote(branch, cwd) {
361
+ remoteOps.fetchRemote((cmd, c) => this.#run(cmd, { cwd: c }), branch, cwd);
362
+ }
363
+ mergeBranch(ref, cwd, opts) {
364
+ remoteOps.mergeBranch((cmd, c) => this.#run(cmd, { cwd: c }), ref, cwd, opts);
365
+ }
366
+ abortMerge(cwd) {
367
+ remoteOps.abortMerge((cmd, c) => this.#run(cmd, { cwd: c }), cwd);
368
+ }
369
+ lsRemote(branch, cwd) {
370
+ return remoteOps.lsRemote((cmd, c) => this.#run(cmd, { cwd: c }), branch, cwd ?? this.#basePath);
371
+ }
372
+ // ── Upgrade-claim distributed-lock ops ──────────────────────────────────────
373
+ addDetachedWorktree(worktreePath, ref, cwd) {
374
+ claimOps.addDetachedWorktree((cmd, c) => this.#run(cmd, { cwd: c }), worktreePath, ref, cwd);
375
+ }
376
+ commitAllowEmpty(message, cwd) {
377
+ claimOps.commitAllowEmpty((cmd, c) => this.#run(cmd, { cwd: c }), message, cwd);
378
+ }
379
+ pushHeadToBranch(branch, cwd) {
380
+ claimOps.pushHeadToBranch((cmd, c) => this.#run(cmd, { cwd: c }), branch, cwd);
381
+ }
382
+ removeDetachedWorktree(worktreePath, cwd) {
383
+ claimOps.removeDetachedWorktree((cmd, c) => this.#run(cmd, { cwd: c }), worktreePath, cwd);
384
+ }
385
+ // ── Git read ops ──────────────────────────────────────────────────────────────
386
+ lsFiles(cwd, prefix) {
387
+ return gitReadOps.lsFiles((cmd, c) => this.#run(cmd, { cwd: c }), cwd, prefix);
388
+ }
389
+ headShort(cwd) {
390
+ return gitReadOps.headShort((cmd, c) => this.#run(cmd, { cwd: c }), cwd ?? this.#basePath);
391
+ }
392
+ diff(range, cwd) {
393
+ return gitReadOps.diff((cmd, c) => this.#run(cmd, { cwd: c }), range, cwd);
394
+ }
395
+ log(branchName, cwd) {
396
+ return gitReadOps.log((cmd, c) => this.#run(cmd, { cwd: c }), branchName, cwd ?? this.#basePath);
397
+ }
398
+ show(ref, filePath, cwd) {
399
+ return gitReadOps.show((cmd, c) => this.#run(cmd, { cwd: c }), ref, filePath, cwd ?? this.#basePath);
400
+ }
401
+ logSince(opts, cwd) {
402
+ return gitReadOps.logSince((cmd, c) => this.#run(cmd, { cwd: c }), opts, cwd ?? this.#basePath);
403
+ }
404
+ }
405
+ //# sourceMappingURL=gitContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gitContext.js","sourceRoot":"","sources":["../../src/git/gitContext.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAEH,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AAKjE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAA+B,MAAM,uBAAuB,CAAC;AACtF,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAA6B,MAAM,uBAAuB,CAAC;AACpF,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,6BAA6B,EAAE,MAAM,4BAA4B,CAAC;AAE3E,wEAAwE;AACxE,MAAM,WAAW,GAAW,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE;IAC/C,IAAI,OAAO,CAAC,KAAK,K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,EAAE,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC;IACvG,CAAC;IAED,QAAQ,CAAC,IAAqB,EAAE,GAAY;QAC1C,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC;IAClG,CAAC;CAEF"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Package-private git-read op module for GitContext.
3
+ * Handles phase-level read commands: tracked-file listing, short HEAD hash,
4
+ * branch diff, and commit-history log.
5
+ *
6
+ * All functions propagate errors — each call site handles its own try/catch.
7
+ */
8
+ type Runner = (command: string, cwd: string) => string;
9
+ declare function lsFiles(run: Runner, cwd: string, prefix?: string): string[];
10
+ declare function headShort(run: Runner, cwd: string): string;
11
+ declare function diff(run: Runner, range: string, cwd: string): string;
12
+ declare function log(run: Runner, branchName: string, cwd: string): string;
13
+ declare function show(run: Runner, ref: string, filePath: string, cwd: string): string;
14
+ /** Bounded flag vocabulary for git log --since reads; only assembles a log command. */
15
+ export interface LogSinceOptions {
16
+ since: string;
17
+ grep?: string;
18
+ oneline?: boolean;
19
+ patch?: boolean;
20
+ pathspec?: string;
21
+ }
22
+ /** Bounded git log --since read; only assembles a log command. */
23
+ declare function logSince(run: Runner, opts: LogSinceOptions, cwd: string): string;
24
+ export declare const gitReadOps: {
25
+ lsFiles: typeof lsFiles;
26
+ headShort: typeof headShort;
27
+ diff: typeof diff;
28
+ log: typeof log;
29
+ show: typeof show;
30
+ logSince: typeof logSince;
31
+ };
32
+ export {};
33
+ //# sourceMappingURL=gitReadOps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gitReadOps.d.ts","sourceRoot":"","sources":["../../src/git/gitReadOps.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,KAAK,MAAM,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC;AAEvD,iBAAS,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAGpE;AAED,iBAAS,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED,iBAAS,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAE7D;AAED,iBAAS,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAEjE;AAED,iBAAS,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAE7E;AAED,uFAAuF;AACvF,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,kEAAkE;AAClE,iBAAS,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAQzE;AAED,eAAO,MAAM,UAAU;;;;;;;CAAoD,CAAC"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Package-private git-read op module for GitContext.
3
+ * Handles phase-level read commands: tracked-file listing, short HEAD hash,
4
+ * branch diff, and commit-history log.
5
+ *
6
+ * All functions propagate errors — each call site handles its own try/catch.
7
+ */
8
+ function lsFiles(run, cwd, prefix) {
9
+ const cmd = prefix ? `git ls-files "${prefix}"` : 'git ls-files';
10
+ return run(cmd, cwd).split('\n').filter(Boolean);
11
+ }
12
+ function headShort(run, cwd) {
13
+ return run('git rev-parse --short HEAD', cwd);
14
+ }
15
+ function diff(run, range, cwd) {
16
+ return run(`git diff ${range}`, cwd);
17
+ }
18
+ function log(run, branchName, cwd) {
19
+ return run(`git log "${branchName}" --format="%aI %s" --no-merges`, cwd);
20
+ }
21
+ function show(run, ref, filePath, cwd) {
22
+ return run(`git show "${ref}:${filePath}"`, cwd);
23
+ }
24
+ /** Bounded git log --since read; only assembles a log command. */
25
+ function logSince(run, opts, cwd) {
26
+ const parts = ['git log', `--since="${opts.since}"`];
27
+ if (opts.grep)
28
+ parts.push(`--grep="${opts.grep}"`);
29
+ parts.push('--no-merges');
30
+ if (opts.oneline)
31
+ parts.push('--oneline');
32
+ if (opts.patch)
33
+ parts.push('-p');
34
+ const cmd = opts.pathspec ? `${parts.join(' ')} -- ${opts.pathspec}` : parts.join(' ');
35
+ return run(cmd, cwd);
36
+ }
37
+ export const gitReadOps = { lsFiles, headShort, diff, log, show, logSince };
38
+ //# sourceMappingURL=gitReadOps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gitReadOps.js","sourceRoot":"","sources":["../../src/git/gitReadOps.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,SAAS,OAAO,CAAC,GAAW,EAAE,GAAW,EAAE,MAAe;IACxD,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,iBAAiB,MAAM,GAAG,CAAC,CAAC,CAAC,cAAc,CAAC;IACjE,OAAO,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AACnD,CAAC;AAED,SAAS,SAAS,CAAC,GAAW,EAAE,GAAW;IACzC,OAAO,GAAG,CAAC,4BAA4B,EAAE,GAAG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AS,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * GitContext package — standalone, importable public surface.
3
+ *
4
+ * Primary export: GitContext class and its public types. The public surface
5
+ * includes the forge-neutral executor primitive (`GitContext.exec` plus the
6
+ * `ExecWorkingDirectory`/`ExecOptions` types), the TokenProvider port
7
+ * types (`TokenProvider`/`CredentialRequest`/`CredentialPurpose`) — the seam
8
+ * a forge adapter built on this package implements instead of the core
9
+ * holding a credential — and the `Logger` port (`Logger`/`LogLevel`,
10
+ * defaulting to `consoleLogger`), so the package carries no dependency on
11
+ * the host application's logger. The GitHub implementation of the
12
+ * TokenProvider port (`createGitHubTokenProvider`), the gh command-string
13
+ * builders, GitHub App authentication, token resolution, GitHub remote-URL
14
+ * parsing, bot-identity derivation, clone-URL construction and
15
+ * `gh auth token` all live in the GitHub forge adapter
16
+ * (`adws/providers/github/`, #792/#793), not here.
17
+ *
18
+ * Also exports the worktree lifecycle op namespaces (create/remove/query/
19
+ * probe/reset) and the distributed-lock `claimOps`, alongside the
20
+ * `repoWorkspace` workspace ops — the full forge-neutral git/worktree
21
+ * surface this package ships (issue #1). None of it imports from
22
+ * `src/providers/`; that boundary is enforced by a committed import-graph
23
+ * test.
24
+ *
25
+ * Bootstrap exceptions (issue #700, narrowed by #793): the functions below
26
+ * are the ONLY legitimate pre-context git reads in the codebase — generic
27
+ * git reads only, no forge vocabulary. They live inside this structurally-
28
+ * exempt package (guard skips adws/gitContext/ by directory) rather than on
29
+ * the ALLOWLIST. The GitHub forge adapter composes them rather than
30
+ * shelling out itself.
31
+ */
32
+ export { GitContext } from './gitContext.js';
33
+ export type { GitIdentity, GitContextOptions, ExecFn, GitContextDeps, FsDeps, ExecWorkingDirectory, ExecOptions, TokenProvider, CredentialPurpose, CredentialRequest, Logger, LogLevel, } from './types.js';
34
+ export { consoleLogger } from './consoleLogger.js';
35
+ export { killProcessesInDirectory } from './processCleanup.js';
36
+ export { claimOps } from './claimOps.js';
37
+ export { worktreeCreateOps } from './worktreeCreateOps.js';
38
+ export { worktreeRemoveOps } from './worktreeRemoveOps.js';
39
+ export { worktreeQueryOps } from './worktreeQueryOps.js';
40
+ export { worktreeProbeOps } from './worktreeProbeOps.js';
41
+ export { worktreeResetOps } from './worktreeResetOps.js';
42
+ export type { WorktreeForIssueResult } from './worktreeQueryOps.js';
43
+ export type { WorktreeRegistration } from './worktreeProbeOps.js';
44
+ export type { LogSinceOptions } from './gitReadOps.js';
45
+ export { readOriginRemoteUrl, readCurrentBranch, readEnvGitIdentity, readGitConfigIdentity } from './bootstrapIdentity.js';
46
+ export type { GitConfigIdentityDeps } from './bootstrapIdentity.js';
47
+ export { getTargetRepoWorkspacePath, isRepoCloned, cloneRepo, ensureRepoWorkspace, } from './repoWorkspace.js';
48
+ export type { EnsureRepoWorkspaceDeps } from './repoWorkspace.js';
49
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/git/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,YAAY,EACV,WAAW,EAAE,iBAAiB,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,oBAAoB,EAAE,WAAW,EACjG,aAAa,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,EAAE,QAAQ,GACtE,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,YAAY,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AACpE,YAAY,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAClE,YAAY,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAGvD,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC3H,YAAY,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,EACL,0BAA0B,EAC1B,YAAY,EACZ,SAAS,EACT,mBAAmB,GACpB,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * GitContext package — standalone, importable public surface.
3
+ *
4
+ * Primary export: GitContext class and its public types. The public surface
5
+ * includes the forge-neutral executor primitive (`GitContext.exec` plus the
6
+ * `ExecWorkingDirectory`/`ExecOptions` types), the TokenProvider port
7
+ * types (`TokenProvider`/`CredentialRequest`/`CredentialPurpose`) — the seam
8
+ * a forge adapter built on this package implements instead of the core
9
+ * holding a credential — and the `Logger` port (`Logger`/`LogLevel`,
10
+ * defaulting to `consoleLogger`), so the package carries no dependency on
11
+ * the host application's logger. The GitHub implementation of the
12
+ * TokenProvider port (`createGitHubTokenProvider`), the gh command-string
13
+ * builders, GitHub App authentication, token resolution, GitHub remote-URL
14
+ * parsing, bot-identity derivation, clone-URL construction and
15
+ * `gh auth token` all live in the GitHub forge adapter
16
+ * (`adws/providers/github/`, #792/#793), not here.
17
+ *
18
+ * Also exports the worktree lifecycle op namespaces (create/remove/query/
19
+ * probe/reset) and the distributed-lock `claimOps`, alongside the
20
+ * `repoWorkspace` workspace ops — the full forge-neutral git/worktree
21
+ * surface this package ships (issue #1). None of it imports from
22
+ * `src/providers/`; that boundary is enforced by a committed import-graph
23
+ * test.
24
+ *
25
+ * Bootstrap exceptions (issue #700, narrowed by #793): the functions below
26
+ * are the ONLY legitimate pre-context git reads in the codebase — generic
27
+ * git reads only, no forge vocabulary. They live inside this structurally-
28
+ * exempt package (guard skips adws/gitContext/ by directory) rather than on
29
+ * the ALLOWLIST. The GitHub forge adapter composes them rather than
30
+ * shelling out itself.
31
+ */
32
+ export { GitContext } from './gitContext.js';
33
+ export { consoleLogger } from './consoleLogger.js';
34
+ export { killProcessesInDirectory } from './processCleanup.js';
35
+ export { claimOps } from './claimOps.js';
36
+ export { worktreeCreateOps } from './worktreeCreateOps.js';
37
+ export { worktreeRemoveOps } from './worktreeRemoveOps.js';
38
+ export { worktreeQueryOps } from './worktreeQueryOps.js';
39
+ export { worktreeProbeOps } from './worktreeProbeOps.js';
40
+ export { worktreeResetOps } from './worktreeResetOps.js';
41
+ // Bootstrap — absorbed pre-context primitives (issue #700), generic git reads only (#793)
42
+ export { readOriginRemoteUrl, readCurrentBranch, readEnvGitIdentity, readGitConfigIdentity } from './bootstrapIdentity.js';
43
+ export { getTargetRepoWorkspacePath, isRepoCloned, cloneRepo, ensureRepoWorkspace, } from './repoWorkspace.js';
44
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/git/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAK7C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAKzD,0FAA0F;AAC1F,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAE3H,OAAO,EACL,0BAA0B,EAC1B,YAAY,EACZ,SAAS,EACT,mBAAmB,GACpB,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Process cleanup utility for the GitContext package.
3
+ * Kills processes that have open files in a given directory.
4
+ * Self-contained — no git/gh, no ADW core imports.
5
+ */
6
+ export declare function killProcessesInDirectory(directoryPath: string): void;
7
+ //# sourceMappingURL=processCleanup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"processCleanup.d.ts","sourceRoot":"","sources":["../../src/git/processCleanup.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,wBAAgB,wBAAwB,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CA4BpE"}