@bevel-software/platform-core-backend 0.29.0 → 0.30.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 (181) hide show
  1. package/dist/__tests__/test-repositories.d.ts +3 -0
  2. package/dist/__tests__/test-repositories.d.ts.map +1 -0
  3. package/dist/__tests__/test-repositories.js +18 -0
  4. package/dist/__tests__/test-repositories.js.map +1 -0
  5. package/dist/core/create-core-server.js +1 -1
  6. package/dist/core/create-core-server.js.map +1 -1
  7. package/dist/core/create-core-services.d.ts +3 -0
  8. package/dist/core/create-core-services.d.ts.map +1 -1
  9. package/dist/core/create-core-services.js +32 -4
  10. package/dist/core/create-core-services.js.map +1 -1
  11. package/dist/core/lifecycle.d.ts +8 -0
  12. package/dist/core/lifecycle.d.ts.map +1 -1
  13. package/dist/core/lifecycle.js +4 -0
  14. package/dist/core/lifecycle.js.map +1 -1
  15. package/dist/modules/access/access-control.interface.d.ts +20 -0
  16. package/dist/modules/access/access-control.interface.d.ts.map +1 -1
  17. package/dist/modules/access/access-control.service.d.ts +32 -1
  18. package/dist/modules/access/access-control.service.d.ts.map +1 -1
  19. package/dist/modules/access/access-control.service.js +138 -16
  20. package/dist/modules/access/access-control.service.js.map +1 -1
  21. package/dist/modules/access/access.routes.d.ts.map +1 -1
  22. package/dist/modules/access/access.routes.js +20 -6
  23. package/dist/modules/access/access.routes.js.map +1 -1
  24. package/dist/modules/agent-instructions/shared-file-rules.d.ts +1 -1
  25. package/dist/modules/agent-instructions/shared-file-rules.js +1 -1
  26. package/dist/modules/diff/diff.service.d.ts.map +1 -1
  27. package/dist/modules/diff/diff.service.js +7 -1
  28. package/dist/modules/diff/diff.service.js.map +1 -1
  29. package/dist/modules/kb-fs/git-dir.d.ts +21 -0
  30. package/dist/modules/kb-fs/git-dir.d.ts.map +1 -0
  31. package/dist/modules/kb-fs/git-dir.js +58 -0
  32. package/dist/modules/kb-fs/git-dir.js.map +1 -0
  33. package/dist/modules/kb-fs/index.d.ts +2 -0
  34. package/dist/modules/kb-fs/index.d.ts.map +1 -1
  35. package/dist/modules/kb-fs/index.js +2 -1
  36. package/dist/modules/kb-fs/index.js.map +1 -1
  37. package/dist/modules/kb-fs/ref-files.d.ts +63 -0
  38. package/dist/modules/kb-fs/ref-files.d.ts.map +1 -0
  39. package/dist/modules/kb-fs/ref-files.js +249 -0
  40. package/dist/modules/kb-fs/ref-files.js.map +1 -0
  41. package/dist/modules/plugins/teams.routes.d.ts +4 -0
  42. package/dist/modules/plugins/teams.routes.d.ts.map +1 -1
  43. package/dist/modules/plugins/teams.routes.js +9 -1
  44. package/dist/modules/plugins/teams.routes.js.map +1 -1
  45. package/dist/modules/tool-auth/internal-token.service.d.ts +1 -1
  46. package/dist/modules/tool-auth/tool-auth.middleware.d.ts +1 -2
  47. package/dist/modules/tool-auth/tool-auth.middleware.d.ts.map +1 -1
  48. package/dist/modules/tool-auth/tool-auth.middleware.js +1 -2
  49. package/dist/modules/tool-auth/tool-auth.middleware.js.map +1 -1
  50. package/dist/modules/tool-helpers/tool-handler.d.ts +2 -2
  51. package/dist/modules/tool-helpers/tool.contract.d.ts +2 -2
  52. package/dist/modules/workflow/git/git.service.d.ts +29 -0
  53. package/dist/modules/workflow/git/git.service.d.ts.map +1 -1
  54. package/dist/modules/workflow/git/git.service.js +177 -24
  55. package/dist/modules/workflow/git/git.service.js.map +1 -1
  56. package/dist/modules/workflow/workflow-hooks.d.ts +1 -1
  57. package/dist/modules/workspace/agent-access.gate.d.ts +2 -2
  58. package/dist/modules/workspace/agent-access.gate.js +2 -2
  59. package/dist/modules/workspace/bounded-matcher.d.ts +79 -0
  60. package/dist/modules/workspace/bounded-matcher.d.ts.map +1 -0
  61. package/dist/modules/workspace/bounded-matcher.js +261 -0
  62. package/dist/modules/workspace/bounded-matcher.js.map +1 -0
  63. package/dist/modules/workspace/fetch-instant.d.ts +9 -0
  64. package/dist/modules/workspace/fetch-instant.d.ts.map +1 -0
  65. package/dist/modules/workspace/fetch-instant.js +13 -0
  66. package/dist/modules/workspace/fetch-instant.js.map +1 -0
  67. package/dist/modules/workspace/index.d.ts +7 -0
  68. package/dist/modules/workspace/index.d.ts.map +1 -1
  69. package/dist/modules/workspace/index.js +6 -0
  70. package/dist/modules/workspace/index.js.map +1 -1
  71. package/dist/modules/workspace/kb-repository.contract.d.ts +124 -0
  72. package/dist/modules/workspace/kb-repository.contract.d.ts.map +1 -0
  73. package/dist/modules/workspace/kb-repository.contract.js +19 -0
  74. package/dist/modules/workspace/kb-repository.contract.js.map +1 -0
  75. package/dist/modules/workspace/kb-repository.d.ts +236 -0
  76. package/dist/modules/workspace/kb-repository.d.ts.map +1 -0
  77. package/dist/modules/workspace/kb-repository.js +811 -0
  78. package/dist/modules/workspace/kb-repository.js.map +1 -0
  79. package/dist/modules/workspace/pattern-matcher.contract.d.ts +50 -0
  80. package/dist/modules/workspace/pattern-matcher.contract.d.ts.map +1 -0
  81. package/dist/modules/workspace/pattern-matcher.contract.js +27 -0
  82. package/dist/modules/workspace/pattern-matcher.contract.js.map +1 -0
  83. package/dist/modules/workspace/routine-write-policy.d.ts +0 -7
  84. package/dist/modules/workspace/routine-write-policy.d.ts.map +1 -1
  85. package/dist/modules/workspace/routine-write-policy.js +0 -5
  86. package/dist/modules/workspace/routine-write-policy.js.map +1 -1
  87. package/dist/modules/workspace/set-aside-clone.d.ts +40 -0
  88. package/dist/modules/workspace/set-aside-clone.d.ts.map +1 -1
  89. package/dist/modules/workspace/set-aside-clone.js +139 -0
  90. package/dist/modules/workspace/set-aside-clone.js.map +1 -1
  91. package/dist/modules/workspace/startup/kb-startup-runner.d.ts +99 -0
  92. package/dist/modules/workspace/startup/kb-startup-runner.d.ts.map +1 -1
  93. package/dist/modules/workspace/startup/kb-startup-runner.js +407 -29
  94. package/dist/modules/workspace/startup/kb-startup-runner.js.map +1 -1
  95. package/dist/modules/workspace/workspace.service.d.ts +68 -32
  96. package/dist/modules/workspace/workspace.service.d.ts.map +1 -1
  97. package/dist/modules/workspace/workspace.service.js +240 -161
  98. package/dist/modules/workspace/workspace.service.js.map +1 -1
  99. package/dist/modules/workspace/workspace.tools.d.ts +13 -4
  100. package/dist/modules/workspace/workspace.tools.d.ts.map +1 -1
  101. package/dist/modules/workspace/workspace.tools.js +162 -336
  102. package/dist/modules/workspace/workspace.tools.js.map +1 -1
  103. package/dist/test-setup.js +4 -0
  104. package/dist/test-setup.js.map +1 -1
  105. package/package.json +3 -3
  106. package/src/__tests__/test-repositories.ts +22 -0
  107. package/src/__tests__/workspace-service.ts +69 -0
  108. package/src/core/__tests__/lifecycle.test.ts +16 -0
  109. package/src/core/create-core-server.ts +1 -1
  110. package/src/core/create-core-services.ts +36 -3
  111. package/src/core/lifecycle.ts +10 -0
  112. package/src/modules/access/__tests__/access-control.atref-cache.test.ts +144 -4
  113. package/src/modules/access/__tests__/access-control.group-read.test.ts +73 -0
  114. package/src/modules/access/__tests__/access.routes.group-grant.test.ts +66 -0
  115. package/src/modules/access/__tests__/access.routes.unknown-email.test.ts +2 -0
  116. package/src/modules/access/access-control.interface.ts +22 -0
  117. package/src/modules/access/access-control.service.ts +142 -14
  118. package/src/modules/access/access.routes.ts +22 -6
  119. package/src/modules/agent-instructions/shared-file-rules.ts +1 -1
  120. package/src/modules/diff/__tests__/diff.service.seed-atomicity.test.ts +2 -1
  121. package/src/modules/diff/__tests__/diff.service.test.ts +2 -1
  122. package/src/modules/diff/__tests__/diff.service.worktree.test.ts +76 -0
  123. package/src/modules/diff/diff.service.ts +6 -4
  124. package/src/modules/kb-fs/__tests__/git-dir.test.ts +77 -0
  125. package/src/modules/kb-fs/__tests__/ref-files.test.ts +338 -0
  126. package/src/modules/kb-fs/git-dir.ts +53 -0
  127. package/src/modules/kb-fs/index.ts +2 -0
  128. package/src/modules/kb-fs/ref-files.ts +279 -0
  129. package/src/modules/plugins/__tests__/teams.routes.test.ts +55 -0
  130. package/src/modules/plugins/teams.routes.ts +14 -1
  131. package/src/modules/settings/__tests__/setup.routes.layout-phase.test.ts +2 -2
  132. package/src/modules/settings/__tests__/setup.routes.managed-phase.test.ts +2 -2
  133. package/src/modules/tool-auth/internal-token.service.ts +1 -1
  134. package/src/modules/tool-auth/tool-auth.middleware.ts +1 -2
  135. package/src/modules/tool-helpers/__tests__/branch-declaration.test.ts +2 -2
  136. package/src/modules/tool-helpers/tool-handler.ts +2 -2
  137. package/src/modules/tool-helpers/tool.contract.ts +2 -2
  138. package/src/modules/tool-registry/__tests__/tool-description-length.test.ts +6 -1
  139. package/src/modules/workflow/git/__tests__/git.service.changedPathsMemo.test.ts +175 -0
  140. package/src/modules/workflow/git/__tests__/git.service.worktrees.test.ts +284 -0
  141. package/src/modules/workflow/git/git.service.ts +184 -22
  142. package/src/modules/workflow/workflow-hooks.ts +1 -1
  143. package/src/modules/workspace/__tests__/agent-downloads.test.ts +2 -2
  144. package/src/modules/workspace/__tests__/bounded-matcher.test.ts +213 -0
  145. package/src/modules/workspace/__tests__/git-internals.security.test.ts +22 -7
  146. package/src/modules/workspace/__tests__/kb-repository.test.ts +481 -0
  147. package/src/modules/workspace/__tests__/rest-tool-arguments.test.ts +14 -0
  148. package/src/modules/workspace/__tests__/routine-write-policy.test.ts +0 -11
  149. package/src/modules/workspace/__tests__/workspace-paths-inside-the-repo.test.ts +2 -2
  150. package/src/modules/workspace/__tests__/workspace.routes.folder-zip-access.test.ts +2 -2
  151. package/src/modules/workspace/__tests__/workspace.routes.folders.test.ts +4 -3
  152. package/src/modules/workspace/__tests__/workspace.service.any-workspace-credentials.test.ts +2 -2
  153. package/src/modules/workspace/__tests__/workspace.service.ensure-remotes-fetched.test.ts +2 -2
  154. package/src/modules/workspace/__tests__/workspace.service.forget-clone-races.test.ts +12 -5
  155. package/src/modules/workspace/__tests__/workspace.service.list-cloned.test.ts +6 -6
  156. package/src/modules/workspace/__tests__/workspace.service.move-never-overwrites.test.ts +2 -1
  157. package/src/modules/workspace/__tests__/workspace.service.read-filter.test.ts +2 -1
  158. package/src/modules/workspace/__tests__/workspace.service.replaced-repository.test.ts +2 -1
  159. package/src/modules/workspace/__tests__/workspace.service.test.ts +24 -23
  160. package/src/modules/workspace/__tests__/workspace.service.unknown-branch.test.ts +2 -1
  161. package/src/modules/workspace/__tests__/workspace.service.worktrees.test.ts +620 -0
  162. package/src/modules/workspace/__tests__/workspace.tools.agents-file.test.ts +15 -1
  163. package/src/modules/workspace/__tests__/workspace.tools.branch-errors.test.ts +71 -5
  164. package/src/modules/workspace/__tests__/workspace.tools.test.ts +153 -298
  165. package/src/modules/workspace/agent-access.gate.ts +2 -2
  166. package/src/modules/workspace/bounded-matcher.ts +328 -0
  167. package/src/modules/workspace/fetch-instant.ts +13 -0
  168. package/src/modules/workspace/index.ts +12 -0
  169. package/src/modules/workspace/kb-repository.contract.ts +124 -0
  170. package/src/modules/workspace/kb-repository.ts +844 -0
  171. package/src/modules/workspace/pattern-matcher.contract.ts +69 -0
  172. package/src/modules/workspace/routine-write-policy.ts +0 -15
  173. package/src/modules/workspace/set-aside-clone.ts +140 -0
  174. package/src/modules/workspace/startup/__tests__/kb-startup-runner.degraded.test.ts +3 -2
  175. package/src/modules/workspace/startup/__tests__/kb-startup-runner.test.ts +12 -10
  176. package/src/modules/workspace/startup/__tests__/kb-startup-runner.worktrees.test.ts +613 -0
  177. package/src/modules/workspace/startup/kb-startup-runner.ts +422 -29
  178. package/src/modules/workspace/startup/steps/__tests__/steps.test.ts +4 -3
  179. package/src/modules/workspace/workspace.service.ts +247 -169
  180. package/src/modules/workspace/workspace.tools.ts +179 -365
  181. package/src/test-setup.ts +5 -0
@@ -0,0 +1,236 @@
1
+ import { type IGitRunner } from '../../shared/git.contract.js';
2
+ import type { AddWorktreeOptions, FetchOptions, IKbRepository } from './kb-repository.contract.js';
3
+ /** Where a converted clone's stash and other local refs are kept, per workspace (see `importLocalRefs`). */
4
+ export declare const CONVERTED_REFS = "refs/kb-converted";
5
+ /**
6
+ * Where the repository is: `<root>/<kb folder>.git`, under `override` when the
7
+ * composition root names one (a folder on a persistent volume beside the
8
+ * workspaces root), else a folder next to the workspaces root named after it.
9
+ *
10
+ * The fallback is derived from the root's own name, so two workspaces roots
11
+ * that share a parent (every suite's temporary roots) never share a repository.
12
+ */
13
+ export declare function repositoryDirFor(workspacesRoot: string, kbDirName: string, override?: string): string;
14
+ /**
15
+ * What a branch workspace's checkout folder is:
16
+ * - `worktree` — its `.git` is a file naming a folder that exists;
17
+ * - `clone` — its `.git` is a folder: a full clone, from a release before
18
+ * worktrees (converted at boot, and served as it is until it is);
19
+ * - `broken` — its `.git` is a file naming a folder that does not exist (the
20
+ * repository was lost, or the worktree was pruned from under it): an
21
+ * unfinished checkout, recreated as an unfinished clone is;
22
+ * - `none` — no `.git` at all.
23
+ *
24
+ * Errors other than absence propagate: a `.git` that could not be read has
25
+ * not been shown to be anything.
26
+ */
27
+ export type WorkingCopyShape = 'worktree' | 'clone' | 'broken' | 'none';
28
+ export declare function workingCopyShape(checkoutDir: string): Promise<WorkingCopyShape>;
29
+ export interface KbRepositoryOptions {
30
+ /** The bare repository's folder — see {@link repositoryDirFor}. */
31
+ dir: string;
32
+ /** The configured remote, read at every use (the setup screen can change it). */
33
+ kbRepoUrl: () => string;
34
+ /** Injected by the composition root, as every other git caller's is. */
35
+ gitRunner: IGitRunner;
36
+ }
37
+ export type { AddWorktreeOptions, FetchOptions, IKbRepository } from './kb-repository.contract.js';
38
+ export declare class KbRepository implements IKbRepository {
39
+ readonly dir: string;
40
+ private readonly kbRepoUrl;
41
+ private readonly gitRunner;
42
+ /** The administrator's queue: `exclusive` sections run one after another, in call order. */
43
+ private admin;
44
+ /** See the contract: the repository's one administrator for `fn`'s duration. Never nested. */
45
+ exclusive<T>(fn: () => Promise<T>): Promise<T>;
46
+ /** When the last fetch succeeded, and when the last attempt failed. */
47
+ private lastSuccessAt;
48
+ private lastFailureAt;
49
+ private lastOk;
50
+ private inFlightFetch;
51
+ /** When the fetch in flight started: a caller that needs one from `fetchedSince` on joins only a later one. */
52
+ private inFlightStartedAt;
53
+ /**
54
+ * Bumped whenever the repository is taken away (set aside): a fetch that was
55
+ * in flight for the one that went must not stamp its result on the new one.
56
+ */
57
+ private generation;
58
+ /** The credential fingerprint last stamped into the repository's config, this process. */
59
+ private stampedCredentials;
60
+ /** Whether this process has stamped the repository's own configuration yet. */
61
+ private configStamped;
62
+ constructor(opts: KbRepositoryOptions);
63
+ private redact;
64
+ private git;
65
+ /**
66
+ * Whether the repository is on disk and FINISHED: a bare repository whose
67
+ * first fetch landed. The marker is written last, so a repository whose
68
+ * making was cut short (a crash, a full disk) is not taken for one.
69
+ */
70
+ exists(): Promise<boolean>;
71
+ /**
72
+ * Make sure the repository exists and has been fetched at least once; create
73
+ * it when it does not. As the administrator. Throws when it cannot be
74
+ * created or its first fetch fails — with git's words, redacted.
75
+ */
76
+ ensure(): Promise<void>;
77
+ private ensureHeld;
78
+ /** The repository's own configuration — what every worktree of it reads. */
79
+ private configArgs;
80
+ private credentialFingerprint;
81
+ /**
82
+ * Stamp the repository's configuration once per process, and its credential
83
+ * helper again whenever the deployment's credential changed — once for every
84
+ * worktree, since they all read this one config. Never throws: a stamp that
85
+ * failed leaves the repository as usable as it was, and is tried again next
86
+ * time.
87
+ */
88
+ private stampConfigIfNeeded;
89
+ /**
90
+ * Bring the credential helper into line with the deployment's credential when
91
+ * it changed since it was last stamped. As the administrator, as every write
92
+ * to the shared config is. A no-op for a repository not yet made.
93
+ */
94
+ refreshCredentials(): Promise<void>;
95
+ /**
96
+ * Run `git config` arguments against the repository's shared configuration
97
+ * (from a worktree or the repository, it is one file), one writer at a time:
98
+ * git refuses a second writer while `config.lock` is held rather than
99
+ * waiting for it.
100
+ */
101
+ writeConfig(cwd: string, argLists: readonly string[][]): Promise<void>;
102
+ /** See the contract. `gc --auto` decides for itself whether there is enough loose to pack. */
103
+ maintain(): Promise<void>;
104
+ /**
105
+ * `at` for a success is when its fetch STARTED: the refs it wrote are at
106
+ * least that fresh, and no fresher — a deletion on the remote while it ran
107
+ * may be missing from them.
108
+ */
109
+ private noteFetched;
110
+ /** The last time the repository reached the remote and whether it worked; null before any attempt. */
111
+ lastContact(): {
112
+ at: number;
113
+ ok: boolean;
114
+ } | null;
115
+ /** Why the last fetch failed, redacted; null when it did not. For a fail-closed caller's message. */
116
+ lastFetchFailure(): string | null;
117
+ private lastFailure;
118
+ /**
119
+ * `git fetch --prune origin` in the repository — ONCE for every workspace.
120
+ * Throttled by `maxAgeMs` and joined while in flight (ten callers in one
121
+ * tick share one fetch). Not serialized against the worktrees' own git:
122
+ * a fetch writes remote-tracking refs and packs, which git locks itself.
123
+ * Answers whether the remote-tracking refs are provably fresh: this call's
124
+ * fetch (or the one it joined) succeeded, or one succeeded within the
125
+ * window. Never throws; a caller that must not act on stale refs reads the
126
+ * answer.
127
+ */
128
+ fetch(opts: FetchOptions): Promise<boolean>;
129
+ /**
130
+ * Forget what this process knows about the repository — it was set aside,
131
+ * and the next use makes a fresh one.
132
+ */
133
+ forget(): void;
134
+ private revParse;
135
+ private isAncestor;
136
+ /**
137
+ * Add the worktree of `branch` at `checkoutDir`. Copies no history: the
138
+ * repository already has it, and is fetched first when the remote's branch
139
+ * is not known to it yet.
140
+ *
141
+ * The branch's local ref is created from `origin/<branch>`, tracking it. A
142
+ * local ref already there (a converted clone's tip, a worktree that was lost
143
+ * with commits the remote lacks) is KEPT when it holds commits the remote
144
+ * does not have, and fast-forwarded to the remote when it is behind.
145
+ *
146
+ * A branch the remote does not have fails with git's own words for a clone
147
+ * of it ("Remote branch … not found in upstream origin"), so the callers
148
+ * that tell a deleted branch from one that never existed read it as they
149
+ * read a clone's failure — unless `allowLocalOnly` (a converted clone whose
150
+ * branch was never pushed) and the local ref exists.
151
+ *
152
+ * `keepLocalTip` (a conversion) leaves a local ref that is behind the
153
+ * remote where it is: the worktree comes up at the clone's own tip, and the
154
+ * phase's own update moves it on, as it moved the clone.
155
+ *
156
+ * `fetchedSince` (the startup phase, opening every branch) skips asking
157
+ * the remote when the repository's own fetch succeeded, starting after it,
158
+ * and already has `origin/<branch>`: that fetch brought every branch, so
159
+ * opening a hundred branches costs one fetch, not a hundred. A branch it
160
+ * does not know yet is asked for as usual.
161
+ */
162
+ addWorktree(branch: string, checkoutDir: string, opts?: AddWorktreeOptions): Promise<void>;
163
+ /**
164
+ * Remove the worktree at `checkoutDir` and prune it from the repository,
165
+ * with its branch's local ref: deleting a workspace takes what a deleted
166
+ * clone took. The repository's objects and every other worktree are left
167
+ * exactly as they were. A folder git will not remove (it is not a worktree
168
+ * any more, or is locked) is deleted by hand, then pruned.
169
+ */
170
+ removeWorktree(checkoutDir: string, branch: string): Promise<void>;
171
+ /**
172
+ * After worktree folders were deleted by hand (the orphan sweep): prune them
173
+ * from the repository and drop their branches' local refs. A branch still
174
+ * checked out in a worktree that exists is refused by git and kept.
175
+ */
176
+ forgetWorktrees(branches: readonly string[]): Promise<void>;
177
+ /**
178
+ * `git worktree prune`: forget worktrees whose folders are gone. As the
179
+ * administrator: a prune beside a `worktree add` can take the entry being
180
+ * made, before git has marked it as in the making.
181
+ */
182
+ prune(): Promise<void>;
183
+ /** The folders of the repository's worktrees, as git lists them. */
184
+ listWorktrees(): Promise<string[]>;
185
+ /**
186
+ * Bring the tip of `branch` from the full clone at `cloneDir` into the
187
+ * repository as `refs/heads/<branch>` — its commits the remote lacks
188
+ * included — without touching the remote. Answers the tip, after checking
189
+ * the repository now has it.
190
+ */
191
+ importBranch(cloneDir: string, branch: string): Promise<string>;
192
+ /**
193
+ * Bring what else the full clone at `cloneDir` holds of its own into the
194
+ * repository, under `refs/kb-converted/<workspaceId>/`, before the clone
195
+ * goes: every entry of its stash (`stash/0` the latest), and every local
196
+ * ref but its own branch's and the remote-tracking ones — other local
197
+ * branches, tags — that the repository does not already hold with the same
198
+ * value. Nothing in the clone changes: each object is pushed by its id.
199
+ * Answers the refs written, after checking the repository holds each at the
200
+ * clone's value; throws, the clone untouched, when one cannot be written.
201
+ *
202
+ * The refs are no workspace's: deleting the branch's workspace leaves them,
203
+ * and the repository's collection keeps what they reach.
204
+ */
205
+ importLocalRefs(cloneDir: string, branch: string, workspaceId: string): Promise<string[]>;
206
+ /** The object a ref names, as it is (a tag is not peeled), or null. */
207
+ private refValue;
208
+ /**
209
+ * The address the repository fetches from, or null when it cannot be read
210
+ * (no repository, no `origin`).
211
+ */
212
+ originUrl(): Promise<string | null>;
213
+ /**
214
+ * Re-link a repository and its worktrees that were moved together (set
215
+ * aside), so `git log` in a moved worktree reads the moved repository.
216
+ *
217
+ * Both links are written here rather than left to `git worktree repair`,
218
+ * which cannot follow a link whose two ends BOTH moved: the worktree's
219
+ * `.git` file names `<repository>/worktrees/<name>`, and that folder's
220
+ * `gitdir` names the worktree's `.git`. The name is the last part of the
221
+ * path the worktree's `.git` file still holds. Answers the moved worktrees
222
+ * that could not be re-linked (git had already lost track of them, or a
223
+ * write failed) — their files are all there, only `git` in them is not.
224
+ * A worktree whose second link cannot be written gets its first one back,
225
+ * so neither link names a place the other does not.
226
+ */
227
+ relinkMovedCopy(movedRepository: string, movedWorktrees: readonly string[]): Promise<string[]>;
228
+ /**
229
+ * Point the repository at `url` — the same repository at a new address.
230
+ * What this process knew of the old address's fetches is forgotten with it,
231
+ * so the next fetch reaches the new one rather than reading a success from
232
+ * the old one as fresh.
233
+ */
234
+ setOriginUrl(url: string): Promise<void>;
235
+ }
236
+ //# sourceMappingURL=kb-repository.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kb-repository.d.ts","sourceRoot":"","sources":["../../../src/modules/workspace/kb-repository.ts"],"names":[],"mappings":"AAGA,OAAO,EAAe,KAAK,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAG5E,OAAO,KAAK,EAAE,kBAAkB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAoEnG,4GAA4G;AAC5G,eAAO,MAAM,cAAc,sBAAsB,CAAC;AAMlD;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,cAAc,EAAE,MAAM,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