canopycms 0.0.67 → 0.0.68-int.101

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 (281) hide show
  1. package/README.md +24 -17
  2. package/dist/ai/handler.js +8 -0
  3. package/dist/api/admin-branch-health.js +17 -20
  4. package/dist/api/admin.d.ts +30 -9
  5. package/dist/api/admin.js +32 -2
  6. package/dist/api/assets.js +84 -76
  7. package/dist/api/branch-create-window.d.ts +12 -0
  8. package/dist/api/branch-create-window.js +13 -0
  9. package/dist/api/branch-review.d.ts +3 -3
  10. package/dist/api/branch-review.js +14 -5
  11. package/dist/api/branch-status.d.ts +5 -5
  12. package/dist/api/branch-status.js +26 -6
  13. package/dist/api/branch-withdraw.d.ts +2 -2
  14. package/dist/api/branch-withdraw.js +7 -2
  15. package/dist/api/branch.d.ts +15 -2
  16. package/dist/api/branch.js +118 -92
  17. package/dist/api/client.d.ts +18 -6
  18. package/dist/api/client.js +79 -12
  19. package/dist/api/content.d.ts +6 -5
  20. package/dist/api/content.js +44 -41
  21. package/dist/api/entries.js +16 -15
  22. package/dist/api/github-sync.d.ts +19 -1
  23. package/dist/api/github-sync.js +57 -10
  24. package/dist/api/index.d.ts +1 -1
  25. package/dist/api/reference-options.js +1 -1
  26. package/dist/api/resolve-references.js +14 -40
  27. package/dist/api/settings-helpers.d.ts +1 -1
  28. package/dist/api/settings-helpers.js +1 -4
  29. package/dist/api/user.d.ts +3 -0
  30. package/dist/api/user.js +3 -0
  31. package/dist/assets/asset-url.d.ts +22 -16
  32. package/dist/assets/asset-url.js +42 -25
  33. package/dist/assets/factory.d.ts +5 -0
  34. package/dist/assets/factory.js +5 -0
  35. package/dist/assets/finalize.js +3 -0
  36. package/dist/assets/index.d.ts +1 -1
  37. package/dist/assets/materialize.d.ts +153 -0
  38. package/dist/assets/materialize.js +402 -0
  39. package/dist/assets/store-local.d.ts +19 -5
  40. package/dist/assets/store-local.js +69 -10
  41. package/dist/assets/store-s3.d.ts +38 -7
  42. package/dist/assets/store-s3.js +128 -22
  43. package/dist/assets/transform-directives.d.ts +52 -13
  44. package/dist/assets/transform-directives.js +87 -27
  45. package/dist/assets/transform.d.ts +3 -3
  46. package/dist/assets/transform.js +13 -8
  47. package/dist/assets/types.d.ts +31 -4
  48. package/dist/auth/file-based-auth-cache.js +7 -8
  49. package/dist/authorization/content.d.ts +5 -4
  50. package/dist/authorization/content.js +5 -5
  51. package/dist/authorization/path.d.ts +11 -6
  52. package/dist/authorization/path.js +11 -6
  53. package/dist/authorization/types.d.ts +2 -2
  54. package/dist/branch-health.d.ts +7 -1
  55. package/dist/branch-health.js +8 -3
  56. package/dist/branch-metadata.d.ts +5 -5
  57. package/dist/branch-metadata.js +44 -36
  58. package/dist/branch-provisioning.d.ts +167 -0
  59. package/dist/branch-provisioning.js +501 -0
  60. package/dist/branch-schema-cache.d.ts +5 -3
  61. package/dist/branch-schema-cache.js +29 -11
  62. package/dist/branch-sparse.d.ts +23 -0
  63. package/dist/branch-sparse.js +118 -0
  64. package/dist/branch-workspace.d.ts +42 -3
  65. package/dist/branch-workspace.js +240 -94
  66. package/dist/build/asset-refs.d.ts +93 -0
  67. package/dist/build/asset-refs.js +251 -0
  68. package/dist/build-identity.d.ts +3 -0
  69. package/dist/build-identity.js +13 -0
  70. package/dist/cli/asset-refs.d.ts +52 -0
  71. package/dist/cli/asset-refs.js +194 -0
  72. package/dist/cli/cli.d.ts +15 -1
  73. package/dist/cli/cli.js +5928 -2195
  74. package/dist/cli/configured-asset-store.d.ts +12 -0
  75. package/dist/cli/configured-asset-store.js +46 -0
  76. package/dist/cli/generate-ai-content.js +2185 -587
  77. package/dist/cli/github-app-manifest.d.ts +4 -3
  78. package/dist/cli/github-app-manifest.js +4 -3
  79. package/dist/cli/init.js +30 -27
  80. package/dist/cli/migrate.js +12 -8
  81. package/dist/cli/sync.js +83 -37
  82. package/dist/cli/template-files/Dockerfile.cms.template +8 -0
  83. package/dist/cli/template-files/cdk-app.ts.template +4 -0
  84. package/dist/cli/template-files/cms-stack.ts.template +23 -12
  85. package/dist/cli/template-files/deploy-cms.yml.template +2 -0
  86. package/dist/client.d.ts +1 -1
  87. package/dist/client.js +1 -1
  88. package/dist/config/helpers.js +1 -2
  89. package/dist/config/schemas/config.d.ts +19 -32
  90. package/dist/config/schemas/config.js +9 -11
  91. package/dist/config/schemas/field.js +1 -0
  92. package/dist/config/schemas/media.d.ts +4 -13
  93. package/dist/config/schemas/media.js +5 -8
  94. package/dist/config/schemas/url.d.ts +4 -20
  95. package/dist/config/schemas/url.js +6 -22
  96. package/dist/config/types.d.ts +30 -20
  97. package/dist/config/validation.d.ts +6 -0
  98. package/dist/config/validation.js +37 -0
  99. package/dist/content-listing.d.ts +12 -12
  100. package/dist/content-listing.js +10 -6
  101. package/dist/content-reader.d.ts +11 -2
  102. package/dist/content-reader.js +22 -14
  103. package/dist/content-store.d.ts +37 -9
  104. package/dist/content-store.js +70 -43
  105. package/dist/content-tree.d.ts +1 -1
  106. package/dist/content-tree.js +2 -2
  107. package/dist/context.d.ts +27 -9
  108. package/dist/context.js +154 -70
  109. package/dist/editor/BranchManager.d.ts +7 -1
  110. package/dist/editor/BranchManager.js +29 -14
  111. package/dist/editor/CanopyEditor.d.ts +1 -1
  112. package/dist/editor/CanopyEditor.js +2 -6
  113. package/dist/editor/Editor.d.ts +4 -3
  114. package/dist/editor/Editor.js +32 -22
  115. package/dist/editor/FormRenderer.js +34 -18
  116. package/dist/editor/PreviewFrame.d.ts +24 -0
  117. package/dist/editor/PreviewFrame.js +140 -0
  118. package/dist/editor/admin/SystemHealthPanel.js +47 -7
  119. package/dist/editor/components/BranchesDrawer.d.ts +9 -0
  120. package/dist/editor/components/BranchesDrawer.js +4 -0
  121. package/dist/editor/components/NoEditPermissionNotice.d.ts +10 -0
  122. package/dist/editor/components/NoEditPermissionNotice.js +17 -0
  123. package/dist/editor/context/AssetContext.d.ts +18 -35
  124. package/dist/editor/context/AssetContext.js +20 -29
  125. package/dist/editor/context/index.d.ts +1 -1
  126. package/dist/editor/context/index.js +1 -1
  127. package/dist/editor/editor-config.d.ts +1 -2
  128. package/dist/editor/editor-config.js +0 -23
  129. package/dist/editor/editor-utils.d.ts +24 -21
  130. package/dist/editor/editor-utils.js +75 -62
  131. package/dist/editor/fields/BlockField.d.ts +1 -0
  132. package/dist/editor/fields/BlockField.js +6 -4
  133. package/dist/editor/fields/CodeField.d.ts +1 -0
  134. package/dist/editor/fields/CodeField.js +2 -2
  135. package/dist/editor/fields/DateTimeField.d.ts +1 -0
  136. package/dist/editor/fields/DateTimeField.js +2 -2
  137. package/dist/editor/fields/FieldDescription.d.ts +16 -0
  138. package/dist/editor/fields/FieldDescription.js +11 -0
  139. package/dist/editor/fields/ImageField.d.ts +1 -0
  140. package/dist/editor/fields/ImageField.js +3 -2
  141. package/dist/editor/fields/InlineGroupField.js +4 -1
  142. package/dist/editor/fields/MarkdownField.d.ts +1 -0
  143. package/dist/editor/fields/MarkdownField.js +115 -20
  144. package/dist/editor/fields/NumberField.d.ts +1 -0
  145. package/dist/editor/fields/NumberField.js +2 -2
  146. package/dist/editor/fields/NumberListField.d.ts +1 -0
  147. package/dist/editor/fields/NumberListField.js +2 -2
  148. package/dist/editor/fields/ObjectField.d.ts +1 -0
  149. package/dist/editor/fields/ObjectField.js +5 -2
  150. package/dist/editor/fields/ReferenceField.d.ts +1 -0
  151. package/dist/editor/fields/ReferenceField.js +5 -4
  152. package/dist/editor/fields/SelectField.d.ts +1 -0
  153. package/dist/editor/fields/SelectField.js +2 -2
  154. package/dist/editor/fields/StringListField.d.ts +1 -0
  155. package/dist/editor/fields/StringListField.js +2 -2
  156. package/dist/editor/fields/TextField.d.ts +1 -0
  157. package/dist/editor/fields/TextField.js +2 -2
  158. package/dist/editor/fields/ToggleField.d.ts +1 -0
  159. package/dist/editor/fields/ToggleField.js +7 -4
  160. package/dist/editor/fields/entry-link/InsertEntryLink.d.ts +1 -1
  161. package/dist/editor/fields/entry-link/InsertEntryLink.js +3 -2
  162. package/dist/editor/fields/mdx-jsx-support.d.ts +1 -0
  163. package/dist/editor/fields/mdx-jsx-support.js +137 -0
  164. package/dist/editor/hooks/create-branch-request.d.ts +20 -0
  165. package/dist/editor/hooks/create-branch-request.js +52 -0
  166. package/dist/editor/hooks/useBranchActions.d.ts +13 -2
  167. package/dist/editor/hooks/useBranchActions.js +48 -17
  168. package/dist/editor/hooks/useBranchManager.d.ts +21 -0
  169. package/dist/editor/hooks/useBranchManager.js +204 -37
  170. package/dist/editor/hooks/useBranchesData.d.ts +6 -0
  171. package/dist/editor/hooks/useBranchesData.js +9 -3
  172. package/dist/editor/hooks/useCommentSystem.js +25 -6
  173. package/dist/editor/hooks/useDraftManager.d.ts +16 -1
  174. package/dist/editor/hooks/useDraftManager.js +193 -36
  175. package/dist/editor/hooks/useEntriesData.js +3 -3
  176. package/dist/editor/hooks/useEntryManager.d.ts +2 -1
  177. package/dist/editor/hooks/useEntryManager.js +34 -19
  178. package/dist/editor/media/AssetCard.d.ts +1 -1
  179. package/dist/editor/media/crop-math.d.ts +3 -4
  180. package/dist/editor/media/crop-math.js +11 -22
  181. package/dist/editor/media/editor-image-src.d.ts +7 -0
  182. package/dist/editor/media/editor-image-src.js +12 -0
  183. package/dist/editor/preview-asset-base.d.ts +8 -0
  184. package/dist/editor/preview-asset-base.js +13 -0
  185. package/dist/editor/preview-bridge.d.ts +9 -21
  186. package/dist/editor/preview-bridge.js +19 -139
  187. package/dist/editor/preview-path.d.ts +10 -0
  188. package/dist/editor/preview-path.js +20 -0
  189. package/dist/editor/theme.js +2 -2
  190. package/dist/entry-schema-registry.d.ts +4 -4
  191. package/dist/entry-schema-registry.js +10 -6
  192. package/dist/entry-schema.d.ts +27 -4
  193. package/dist/entry-schema.js +20 -3
  194. package/dist/git-manager.d.ts +173 -6
  195. package/dist/git-manager.js +594 -76
  196. package/dist/github-service.d.ts +15 -0
  197. package/dist/github-service.js +19 -1
  198. package/dist/http/handler.js +37 -13
  199. package/dist/http/index.d.ts +2 -0
  200. package/dist/http/index.js +2 -0
  201. package/dist/http/router.d.ts +2 -0
  202. package/dist/http/router.js +2 -1
  203. package/dist/http/types.d.ts +2 -0
  204. package/dist/http/worker-not-ready.d.ts +10 -0
  205. package/dist/http/worker-not-ready.js +24 -0
  206. package/dist/operating-mode/client-unsafe-strategy.js +0 -6
  207. package/dist/operating-mode/types.d.ts +1 -4
  208. package/dist/paths/branch-name.d.ts +5 -0
  209. package/dist/paths/branch-name.js +9 -0
  210. package/dist/paths/branch.d.ts +6 -2
  211. package/dist/paths/branch.js +16 -10
  212. package/dist/paths/index.d.ts +3 -3
  213. package/dist/paths/index.js +3 -3
  214. package/dist/paths/normalize.d.ts +7 -0
  215. package/dist/paths/normalize.js +9 -0
  216. package/dist/paths/validation.js +0 -2
  217. package/dist/preview.d.ts +8 -0
  218. package/dist/preview.js +7 -0
  219. package/dist/reference-resolver.d.ts +5 -21
  220. package/dist/reference-resolver.js +9 -44
  221. package/dist/resolve-canopy-user.js +2 -1
  222. package/dist/schema/schema-store.d.ts +54 -31
  223. package/dist/schema/schema-store.js +77 -31
  224. package/dist/server.d.ts +64 -9
  225. package/dist/server.js +48 -8
  226. package/dist/services.d.ts +18 -6
  227. package/dist/services.js +85 -70
  228. package/dist/settings-workspace.d.ts +23 -3
  229. package/dist/settings-workspace.js +197 -45
  230. package/dist/static/seo.d.ts +2 -14
  231. package/dist/static/seo.js +2 -25
  232. package/dist/submission-attribution.d.ts +73 -0
  233. package/dist/submission-attribution.js +221 -0
  234. package/dist/sync-core.d.ts +12 -1
  235. package/dist/sync-core.js +31 -13
  236. package/dist/task-queue/worker-status.d.ts +8 -0
  237. package/dist/task-queue/worker-status.js +17 -0
  238. package/dist/types.d.ts +31 -2
  239. package/dist/utils/content-serialize.d.ts +5 -2
  240. package/dist/utils/content-serialize.js +98 -24
  241. package/dist/utils/content-write-lock.d.ts +18 -7
  242. package/dist/utils/content-write-lock.js +18 -9
  243. package/dist/utils/debug.d.ts +8 -0
  244. package/dist/utils/debug.js +10 -2
  245. package/dist/utils/git.d.ts +32 -0
  246. package/dist/utils/git.js +42 -0
  247. package/dist/utils/occ-json-write.js +10 -2
  248. package/dist/utils/provision-log.d.ts +25 -0
  249. package/dist/utils/provision-log.js +49 -0
  250. package/dist/utils/provisioning-lock.d.ts +35 -5
  251. package/dist/utils/provisioning-lock.js +73 -12
  252. package/dist/utils/request-timing.d.ts +25 -0
  253. package/dist/utils/request-timing.js +101 -0
  254. package/dist/utils/sanitize-href.d.ts +8 -22
  255. package/dist/utils/sanitize-href.js +11 -28
  256. package/dist/utils/url-prefix.d.ts +30 -0
  257. package/dist/utils/url-prefix.js +61 -0
  258. package/dist/utils/yaml-source-splice.d.ts +58 -0
  259. package/dist/utils/yaml-source-splice.js +515 -0
  260. package/dist/validation/entry-validator.js +9 -3
  261. package/dist/version.d.ts +1 -0
  262. package/dist/version.js +3 -0
  263. package/dist/worker/canopy-state.d.ts +45 -0
  264. package/dist/worker/canopy-state.js +75 -0
  265. package/dist/worker/cms-worker.d.ts +8 -3
  266. package/dist/worker/cms-worker.js +38 -2
  267. package/dist/worker/git-sync.d.ts +30 -12
  268. package/dist/worker/git-sync.js +253 -58
  269. package/dist/worker/history-rewrite.d.ts +1 -1
  270. package/dist/worker/history-rewrite.js +1 -1
  271. package/dist/worker/provisioned-workspace.d.ts +35 -0
  272. package/dist/worker/provisioned-workspace.js +50 -0
  273. package/dist/worker/rebase.d.ts +1 -1
  274. package/dist/worker/rebase.js +95 -23
  275. package/dist/worker/remote-git-maintenance.d.ts +3 -0
  276. package/dist/worker/remote-git-maintenance.js +11 -0
  277. package/dist/worker/sparse-cone.d.ts +20 -0
  278. package/dist/worker/sparse-cone.js +132 -0
  279. package/dist/worker/task-runner.js +99 -14
  280. package/dist/worker/worker-context.d.ts +6 -1
  281. package/package.json +8 -2
@@ -1,7 +1,64 @@
1
1
  import { type SimpleGitOptions, type StatusResult } from 'simple-git';
2
2
  import type { OperatingMode } from './operating-mode/index.js';
3
+ import type { ProvisionLog } from './utils/provision-log.js';
3
4
  export declare function gitChildEnv(overrides: Record<string, string>): Record<string, string>;
4
5
  export declare function gitNetworkChildEnv(): Record<string, string>;
6
+ /**
7
+ * Settings written into every bare `remote.git` CanopyCMS creates: the worker's (prod) and the
8
+ * simulated remote (dev). A push runs `receive-pack` with remote.git's own config and none of the
9
+ * pusher's: git unsets `GIT_CONFIG_PARAMETERS` before spawning it for a local-path push. Unset, a
10
+ * push starts auto-housekeeping there (detached, or inside a Lambda that is frozen mid-run) that
11
+ * repacks while another process clones, and pushes under the default `unpackLimit` (100) leave
12
+ * loose objects that every local clone copies one NFS round trip at a time.
13
+ *
14
+ * Never an `extensions.*` key: once a repo is at `repositoryformatversion` 1, a git that does not
15
+ * know the key refuses it, and Lambda runs git 2.39.
16
+ * @internal Exported for tests.
17
+ */
18
+ export declare const REMOTE_GIT_CONFIG: ReadonlyArray<readonly [key: string, value: string]>;
19
+ /** Write each of {@link REMOTE_GIT_CONFIG} into the bare repo `gitDir` only where it differs. */
20
+ export declare function ensureRemoteGitConfig(gitDir: string): Promise<void>;
21
+ interface BareRemoteObjectCounts {
22
+ loose: number;
23
+ packs: number;
24
+ }
25
+ export type BareRemoteRepackResult = {
26
+ repacked: false;
27
+ before: BareRemoteObjectCounts;
28
+ } | {
29
+ repacked: true;
30
+ before: BareRemoteObjectCounts;
31
+ after: BareRemoteObjectCounts;
32
+ ms: number;
33
+ };
34
+ /**
35
+ * Repack the bare repo `gitDir` once it holds more than {@link REMOTE_GIT_MAX_LOOSE_OBJECTS}
36
+ * loose objects or {@link REMOTE_GIT_MAX_PACKS} packs, then pack its refs. Under
37
+ * {@link REMOTE_GIT_CONFIG} every push adds a pack, and nothing else ever compacts them.
38
+ *
39
+ * Safe beside concurrent pushes and clones, which is why it is `--cruft` with no expiry:
40
+ * unreachable objects move into a cruft pack rather than being dropped, so a push that read an
41
+ * old object before the repack still finds it, and a repack only deletes packs it listed when it
42
+ * began. A clone that hardlinked a pack keeps that inode when the repack unlinks the remote's
43
+ * name for it, and packs are never modified in place. `repack -d` also removes the loose objects
44
+ * it packed and their emptied fan-out directories.
45
+ */
46
+ export declare function repackBareRemoteIfNeeded(gitDir: string): Promise<BareRemoteRepackResult>;
47
+ /**
48
+ * Config every workspace clone writes into its own `.git/config`: the managed
49
+ * marker that ensureRemote's guard checks, and a fallback author for internal
50
+ * commits such as the orphan settings init (ensureAuthor() sets the real one
51
+ * before user-facing commits).
52
+ */
53
+ export declare function managedWorkspaceConfig(gitBotAuthorName: string, gitBotAuthorEmail: string): Record<string, string>;
54
+ export interface CloneRepoOptions {
55
+ /** The clone's remote name; git's default is `origin`. */
56
+ remoteName?: string;
57
+ /** Leave the working tree unpopulated for the caller to check out. */
58
+ noCheckout?: boolean;
59
+ /** Written into the new repo's own config by the clone (`git clone -c`). */
60
+ config?: Record<string, string>;
61
+ }
5
62
  /**
6
63
  * Remote-tracking namespace that `syncGit()`'s GitHub fetch lands refs in
7
64
  * (`+refs/heads/*:${GITHUB_TRACKING_REF_PREFIX}*`), instead of writing
@@ -69,6 +126,17 @@ export declare class GitRemoteRefMissingError extends Error {
69
126
  */
70
127
  gitError?: unknown | undefined);
71
128
  }
129
+ /**
130
+ * No git remote is configured and the one the strategy auto-detects does not
131
+ * exist yet: in prod, the EC2 worker creates `{workspaceRoot}/remote.git` on
132
+ * its first boot, so until then every request that needs a workspace fails
133
+ * here. Usually transient, unlike a missing remote in a mode with nothing to wait for.
134
+ * The HTTP layer maps it to a 503 (`http/worker-not-ready.ts`).
135
+ */
136
+ export declare class RemoteNotReadyError extends Error {
137
+ readonly expectedRemotePath: string;
138
+ constructor(expectedRemotePath: string);
139
+ }
72
140
  export interface ResolveRemoteUrlOptions {
73
141
  mode: OperatingMode;
74
142
  remoteUrl?: string;
@@ -108,6 +176,8 @@ export interface InitializeWorkspaceOptions {
108
176
  * only; settings workspaces commit by explicit path and don't need it.
109
177
  */
110
178
  gitExcludePattern?: string;
179
+ /** Times each provisioning step; no step lines are printed without one. */
180
+ provisionLog?: ProvisionLog;
111
181
  }
112
182
  export declare class GitManager {
113
183
  private readonly git;
@@ -116,7 +186,13 @@ export declare class GitManager {
116
186
  private readonly remote;
117
187
  private readonly skipIndexMarker;
118
188
  constructor(options: GitManagerOptions, gitOptions?: Partial<SimpleGitOptions>);
119
- static cloneRepo(remoteUrl: string, targetPath: string, baseBranch?: string): Promise<void>;
189
+ /**
190
+ * Single-branch clone of `baseBranch`, retried once: a clone can lose a race
191
+ * with the worker's repack of `remote.git` deleting a pack it had just
192
+ * listed. Before the retry it clears only what it created itself, so a
193
+ * target that held files beforehand is never touched.
194
+ */
195
+ static cloneRepo(remoteUrl: string, targetPath: string, baseBranch?: string, options?: CloneRepoOptions): Promise<void>;
120
196
  /**
121
197
  * Initializes a local bare git repository to simulate a remote for dev mode,
122
198
  * seeded with the current state of baseBranch. Idempotent: an existing remote
@@ -173,7 +249,7 @@ export declare class GitManager {
173
249
  * deleteBranchHandler: a head left in `remote.git` forever makes the
174
250
  * create -> publish -> squash-merge -> delete -> reuse-the-name cycle reject
175
251
  * the reused branch's first publish non-fast-forward against the stale head
176
- * (`GitManager.push()` pushes `branch:branch`, and a squash-merged old tip is
252
+ * (`GitManager.push()` pushes the branch to the same name, and a squash-merged old tip is
177
253
  * not an ancestor of the new branch), and a retried submit then skips the
178
254
  * local push on a clean tree and enqueues the worker push of the STALE head,
179
255
  * resurrecting the deleted branch's content on GitHub as an apparent success.
@@ -223,6 +299,8 @@ export declare class GitManager {
223
299
  * @param source - Where `url` came from, for the thrown error message only.
224
300
  */
225
301
  private static assertRemoteUrlAllowedInMode;
302
+ /** The not-ready error for a mode whose remote is auto-detected, or `undefined` for other modes. */
303
+ private static remoteNotReadyError;
226
304
  /**
227
305
  * Resolves the remote URL for git operations following the priority:
228
306
  * 1. Explicit remoteUrl parameter
@@ -239,6 +317,17 @@ export declare class GitManager {
239
317
  * @returns Remote URL or undefined if no remote is needed
240
318
  */
241
319
  static resolveRemoteUrl(options: ResolveRemoteUrlOptions): Promise<string | undefined>;
320
+ /**
321
+ * {@link resolveRemoteUrl} for a workspace about to be cloned, which needs a
322
+ * remote: none resolving is the worker-not-ready error in a mode whose
323
+ * remote the worker creates, and a configuration error otherwise.
324
+ */
325
+ static resolveCloneRemoteUrl(options: ResolveRemoteUrlOptions): Promise<string>;
326
+ /**
327
+ * {@link cloneRepo} for a workspace, failing with one message that names the
328
+ * workspace, the remote and the base branch, which git's own error mixes.
329
+ */
330
+ static cloneWorkspace(remoteUrl: string, workspacePath: string, baseBranch: string, options: CloneRepoOptions): Promise<void>;
242
331
  /**
243
332
  * Check whether a git repository is already initialized at `workspacePath`.
244
333
  *
@@ -275,6 +364,14 @@ export declare class GitManager {
275
364
  */
276
365
  private invalidateContentIndexes;
277
366
  checkoutBranch(branch: string): Promise<void>;
367
+ /**
368
+ * The one checkout of a `--no-checkout` clone, which has the base branch
369
+ * and its remote-tracking ref and nothing else, so neither the branch
370
+ * listing nor the fetch that {@link checkoutBranch} starts with is needed.
371
+ * The missing index makes git populate the whole tree, even for the base
372
+ * branch HEAD already names.
373
+ */
374
+ checkoutFreshClone(branch: string): Promise<void>;
278
375
  private checkoutBranchInner;
279
376
  pullBase(): Promise<void>;
280
377
  private pullBaseInner;
@@ -282,9 +379,22 @@ export declare class GitManager {
282
379
  private pullCurrentBranchInner;
283
380
  rebaseOntoBase(): Promise<void>;
284
381
  private rebaseOntoBaseInner;
382
+ /** `--sparse` stages a named path outside a sparse clone's cone (branch-sparse.ts). */
285
383
  add(files: string | string[]): Promise<void>;
384
+ /**
385
+ * Restrict the working tree to `dirs` in cone mode, which always keeps the root-level files.
386
+ * Runs before a `--no-checkout` clone's one checkout, which invalidates the content caches.
387
+ */
388
+ setSparseCone(dirs: readonly string[]): Promise<void>;
389
+ /** Stage every working-tree change except canopycms's own state. See {@link stageAllExceptCanopyState}. */
390
+ addAllExceptCanopyState(): Promise<void>;
286
391
  commit(message: string): Promise<void>;
287
392
  push(branch?: string): Promise<void>;
393
+ /**
394
+ * The checked-out branch's plain name. `rev-parse --abbrev-ref HEAD` prints
395
+ * `heads/<name>` when a same-named tag exists, which is not a branch name.
396
+ */
397
+ private currentBranchName;
288
398
  /**
289
399
  * Whether the local branch has commits the remote mirror doesn't -- i.e.
290
400
  * whether push() would move the remote ref forward.
@@ -303,10 +413,19 @@ export declare class GitManager {
303
413
  * ("couldn't find remote ref"); that counts as "ahead", not an error.
304
414
  */
305
415
  hasUnpushedCommits(branch?: string): Promise<boolean>;
416
+ /**
417
+ * Repo-relative paths that differ between HEAD and its merge base with the
418
+ * base branch: everything the branch changes, across all of its commits.
419
+ * Diffs against the just-fetched base tip pinned to a SHA — the pullBaseInner
420
+ * constraint.
421
+ */
422
+ listChangedPathsSinceBase(): Promise<string[]>;
306
423
  ensureAuthor(author: {
307
424
  name: string;
308
425
  email: string;
309
426
  }): Promise<void>;
427
+ /** Writes each key into this repo's own config only where it differs. */
428
+ ensureLocalConfig(values: Record<string, string>): Promise<void>;
310
429
  ensureRemote(remoteUrl: string): Promise<void>;
311
430
  hasUncommittedChanges(): Promise<boolean>;
312
431
  getUncommittedFiles(): Promise<string[]>;
@@ -317,11 +436,59 @@ export declare class GitManager {
317
436
  */
318
437
  ensureGitExclude(pattern: string): Promise<void>;
319
438
  /**
320
- * Create an orphan branch (no shared history) for settings, so
321
- * deployment-specific settings never pollute content history. It holds only
322
- * settings files committed by explicit path (permissions.json, groups.json at
323
- * the workspace root).
439
+ * Put the workspace on the settings branch: an orphan (no shared history),
440
+ * so deployment-specific settings never pollute content history. It holds
441
+ * only settings files committed by explicit path (permissions.json,
442
+ * groups.json at the workspace root).
443
+ *
444
+ * The remote is the settings branch's durable copy, and the workspace clone
445
+ * is `--single-branch` at the base branch, so the remote is asked first:
446
+ * - no local branch: check out the remote's, or create an empty orphan only
447
+ * when the remote has none. An unreadable remote throws
448
+ * {@link SettingsRemoteUnreadableError} rather than guess "none".
449
+ * - local branch present: a history unrelated to the remote's is repaired
450
+ * onto the remote's when the local branch is still its empty initial
451
+ * commit with a clean working tree, and otherwise throws
452
+ * {@link SettingsBranchDivergedError}; local commits are never discarded.
453
+ * An unreadable remote throws only for that empty branch, since one that
454
+ * holds settings can serve them and the next save surfaces the remote error.
455
+ * Either way a remote branch holding content is never adopted:
456
+ * {@link SettingsBranchHasContentHistoryError}.
324
457
  */
325
458
  createOrphanSettingsBranch(branchName: string, initialFiles: Record<string, string>): Promise<void>;
326
459
  private createOrphanSettingsBranchInner;
460
+ /**
461
+ * Compares the checked-out local settings branch with the remote's tip.
462
+ * Related histories are left for the next settings pull to reconcile; only
463
+ * an unrelated one is acted on here.
464
+ */
465
+ private reconcileLocalSettingsBranch;
466
+ /**
467
+ * The remote's tip for `branch`, or `undefined` when the remote has no such
468
+ * branch. A remote that cannot be read throws: `ls-remote` exits 0 with no
469
+ * output only for a reachable remote without the ref.
470
+ */
471
+ private remoteBranchTip;
472
+ /**
473
+ * Fetch `branch` from the remote and return the fetched commit, pinned as
474
+ * pullBaseInner explains. The full ref: a bare name resolves to a
475
+ * same-named tag first.
476
+ */
477
+ private fetchBranchTip;
478
+ /**
479
+ * Refuse to adopt a remote settings branch that holds content: its tip has a file other than
480
+ * the settings files, or its roots include the base branch's (a settings branch is an orphan).
481
+ * Neither alone suffices: a base can have a root of its own, and a content tree can be pruned.
482
+ * The base comes from the remote when the clone lacks it (it was cloned at an earlier base).
483
+ */
484
+ private assertNotContentHistory;
485
+ private baseBranchRev;
486
+ private rootCommits;
487
+ /**
488
+ * Whether `branch` is a single parentless commit with an empty tree, as
489
+ * orphan creation leaves it. Full refs throughout: a bare name resolves to a
490
+ * same-named tag first, and clones fetch tags.
491
+ */
492
+ private isEmptyInitialBranch;
327
493
  }
494
+ export {};