@bluestep-systems/b6p-core 0.8.1 → 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 (149) hide show
  1. package/README.md +310 -32
  2. package/dist/B6PCore.d.ts +7 -0
  3. package/dist/B6PCore.js +96 -1
  4. package/dist/B6PCore.js.map +1 -1
  5. package/dist/B6PUri.d.ts +6 -8
  6. package/dist/B6PUri.js +6 -8
  7. package/dist/B6PUri.js.map +1 -1
  8. package/dist/Err.d.ts +421 -0
  9. package/dist/Err.js +558 -0
  10. package/dist/Err.js.map +1 -1
  11. package/dist/auth/BearerAuthProvider.d.ts +32 -0
  12. package/dist/auth/BearerAuthProvider.js +49 -0
  13. package/dist/auth/BearerAuthProvider.js.map +1 -1
  14. package/dist/cache/OrgCache.js.map +1 -1
  15. package/dist/cache/ScriptMetaDataStore.js.map +1 -1
  16. package/dist/constants/ApiEndpoints.d.ts +1 -0
  17. package/dist/constants/ApiEndpoints.js +1 -0
  18. package/dist/constants/ApiEndpoints.js.map +1 -1
  19. package/dist/constants/AuthTypes.js.map +1 -1
  20. package/dist/constants/BlueHQ.js.map +1 -1
  21. package/dist/constants/CryptoAlgorithms.js.map +1 -1
  22. package/dist/constants/ExtensionConfig.js.map +1 -1
  23. package/dist/constants/FileExtensions.js.map +1 -1
  24. package/dist/constants/FolderNames.js.map +1 -1
  25. package/dist/constants/Gateway.d.ts +71 -0
  26. package/dist/constants/Gateway.js +79 -0
  27. package/dist/constants/Gateway.js.map +1 -0
  28. package/dist/constants/GitHubUrls.js.map +1 -1
  29. package/dist/constants/Http.js.map +1 -1
  30. package/dist/constants/MimeTypes.js.map +1 -1
  31. package/dist/constants/Numerical.js.map +1 -1
  32. package/dist/constants/OutputChannels.js.map +1 -1
  33. package/dist/constants/SettingsKeys.d.ts +5 -0
  34. package/dist/constants/SettingsKeys.js +5 -0
  35. package/dist/constants/SettingsKeys.js.map +1 -1
  36. package/dist/constants/SpecialFiles.js.map +1 -1
  37. package/dist/constants/WebDAVElements.js.map +1 -1
  38. package/dist/constants/index.d.ts +1 -0
  39. package/dist/constants/index.js +3 -1
  40. package/dist/constants/index.js.map +1 -1
  41. package/dist/data/DownstairsPathParser.js.map +1 -1
  42. package/dist/data/GlobMatcher.js.map +1 -1
  43. package/dist/data/IdUtility.js.map +1 -1
  44. package/dist/data/OrgWorker.js.map +1 -1
  45. package/dist/data/ScriptKey.d.ts +3 -27
  46. package/dist/data/ScriptKey.js +12 -24
  47. package/dist/data/ScriptKey.js.map +1 -1
  48. package/dist/data/ScriptUrlParser.js +3 -1
  49. package/dist/data/ScriptUrlParser.js.map +1 -1
  50. package/dist/data/ServerVersion.d.ts +76 -0
  51. package/dist/data/ServerVersion.js +111 -0
  52. package/dist/data/ServerVersion.js.map +1 -0
  53. package/dist/data/index.d.ts +2 -0
  54. package/dist/data/index.js +7 -1
  55. package/dist/data/index.js.map +1 -1
  56. package/dist/gateway/GatewayClient.d.ts +147 -0
  57. package/dist/gateway/GatewayClient.js +395 -0
  58. package/dist/gateway/GatewayClient.js.map +1 -0
  59. package/dist/gateway/GatewayContext.d.ts +43 -0
  60. package/dist/gateway/GatewayContext.js +3 -0
  61. package/dist/gateway/GatewayContext.js.map +1 -0
  62. package/dist/gateway/GatewayGit.d.ts +291 -0
  63. package/dist/gateway/GatewayGit.js +731 -0
  64. package/dist/gateway/GatewayGit.js.map +1 -0
  65. package/dist/gateway/GatewayKb.d.ts +173 -0
  66. package/dist/gateway/GatewayKb.js +354 -0
  67. package/dist/gateway/GatewayKb.js.map +1 -0
  68. package/dist/gateway/GatewayMarketplace.d.ts +116 -0
  69. package/dist/gateway/GatewayMarketplace.js +278 -0
  70. package/dist/gateway/GatewayMarketplace.js.map +1 -0
  71. package/dist/gateway/GatewayService.d.ts +47 -0
  72. package/dist/gateway/GatewayService.js +54 -0
  73. package/dist/gateway/GatewayService.js.map +1 -0
  74. package/dist/gateway/GatewayToken.d.ts +18 -0
  75. package/dist/gateway/GatewayToken.js +43 -0
  76. package/dist/gateway/GatewayToken.js.map +1 -0
  77. package/dist/gateway/GatewayTokenService.d.ts +101 -0
  78. package/dist/gateway/GatewayTokenService.js +465 -0
  79. package/dist/gateway/GatewayTokenService.js.map +1 -0
  80. package/dist/index.d.ts +29 -8
  81. package/dist/index.js +81 -9
  82. package/dist/index.js.map +1 -1
  83. package/dist/network/HttpClient.js.map +1 -1
  84. package/dist/network/HttpClientProvider.js.map +1 -1
  85. package/dist/network/StatusCodes.js.map +1 -1
  86. package/dist/persistence/PersistablePseudoMap.js.map +1 -1
  87. package/dist/persistence/PersistenceKeys.js.map +1 -1
  88. package/dist/persistence/PrivatePersistanceMap.js.map +1 -1
  89. package/dist/persistence/PseudoMap.js.map +1 -1
  90. package/dist/persistence/PublicPersistanceMap.js.map +1 -1
  91. package/dist/persistence/Serializable.js.map +1 -1
  92. package/dist/persistence/SharedFilePersistence.d.ts +22 -0
  93. package/dist/persistence/SharedFilePersistence.js +65 -14
  94. package/dist/persistence/SharedFilePersistence.js.map +1 -1
  95. package/dist/persistence/TypedMap.js.map +1 -1
  96. package/dist/persistence/TypedPersistable.js.map +1 -1
  97. package/dist/persistence/TypedPrivatePersistable.js.map +1 -1
  98. package/dist/persistence/dirLockdown.js.map +1 -1
  99. package/dist/providers.d.ts +46 -16
  100. package/dist/script/GitIdentity.d.ts +48 -0
  101. package/dist/script/GitIdentity.js +52 -0
  102. package/dist/script/GitIdentity.js.map +1 -0
  103. package/dist/script/GitSync.d.ts +388 -0
  104. package/dist/script/GitSync.js +1068 -0
  105. package/dist/script/GitSync.js.map +1 -0
  106. package/dist/script/ScriptContext.d.ts +20 -5
  107. package/dist/script/ScriptFactory.d.ts +1 -2
  108. package/dist/script/ScriptFactory.js +1 -2
  109. package/dist/script/ScriptFactory.js.map +1 -1
  110. package/dist/script/ScriptFile.d.ts +0 -94
  111. package/dist/script/ScriptFile.js +0 -245
  112. package/dist/script/ScriptFile.js.map +1 -1
  113. package/dist/script/ScriptFolder.d.ts +0 -9
  114. package/dist/script/ScriptFolder.js +4 -7
  115. package/dist/script/ScriptFolder.js.map +1 -1
  116. package/dist/script/ScriptNode.d.ts +0 -9
  117. package/dist/script/ScriptNode.js.map +1 -1
  118. package/dist/script/ScriptRoot.d.ts +0 -65
  119. package/dist/script/ScriptRoot.js +0 -199
  120. package/dist/script/ScriptRoot.js.map +1 -1
  121. package/dist/script/ScriptService.d.ts +113 -9
  122. package/dist/script/ScriptService.js +164 -52
  123. package/dist/script/ScriptService.js.map +1 -1
  124. package/dist/script/ServerCompile.d.ts +35 -0
  125. package/dist/script/ServerCompile.js +40 -0
  126. package/dist/script/ServerCompile.js.map +1 -0
  127. package/dist/script/TsConfig.d.ts +2 -2
  128. package/dist/script/TsConfig.js +3 -3
  129. package/dist/script/TsConfig.js.map +1 -1
  130. package/dist/script/push.d.ts +162 -188
  131. package/dist/script/push.js +216 -474
  132. package/dist/script/push.js.map +1 -1
  133. package/dist/session/SessionManager.js.map +1 -1
  134. package/dist/testing/FakeGateway.d.ts +280 -0
  135. package/dist/testing/FakeGateway.js +627 -0
  136. package/dist/testing/FakeGateway.js.map +1 -0
  137. package/dist/testing/MockFileSystem.js.map +1 -1
  138. package/dist/types.d.ts +332 -0
  139. package/dist/update/UpdateService.js.map +1 -1
  140. package/package.json +17 -12
  141. package/dist/script/ScriptTranspiler.d.ts +0 -121
  142. package/dist/script/ScriptTranspiler.js +0 -333
  143. package/dist/script/ScriptTranspiler.js.map +0 -1
  144. package/dist/script/SnapshotHistoryRecorder.d.ts +0 -47
  145. package/dist/script/SnapshotHistoryRecorder.js +0 -231
  146. package/dist/script/SnapshotHistoryRecorder.js.map +0 -1
  147. package/dist/script/TsLibResolver.d.ts +0 -60
  148. package/dist/script/TsLibResolver.js +0 -134
  149. package/dist/script/TsLibResolver.js.map +0 -1
@@ -1,227 +1,215 @@
1
- import { GlobMatcher } from "../data/GlobMatcher";
1
+ import { type BuildFastForward, type DraftBuildRefusalReason, type DraftCompileOutcome, type DraftCompileStatus, type GitIdentity } from "@bluestep-systems/b6p-core-bsjs-git";
2
+ import { type PushRoute, type SnapshotRefusal } from "../data/ServerVersion";
2
3
  import type { ScriptContext } from "./ScriptContext";
3
- import type { FileSystem } from "../providers";
4
- import { ScriptFile } from "./ScriptFile";
4
+ import { type LastSyncedLookup, type PublishRefusal } from "./GitSync";
5
+ import type { ScriptRoot } from "./ScriptRoot";
6
+ import { type TypeCheckError } from "./ServerCompile";
7
+ /**
8
+ * The hashes a pre-git push or pull recorded for the files of a draft folder, as the lookup the git side uses to tell a
9
+ * local edit from a platform change in a folder that has no repository yet.
10
+ * @param scriptRoot The script whose metadata holds the records
11
+ * @param draftPath The draft folder the records' paths are under
12
+ * @lastreviewed null
13
+ */
14
+ export declare function legacySyncRecords(scriptRoot: ScriptRoot, draftPath: string): Promise<LastSyncedLookup>;
15
+ /**
16
+ * A platform build that ended in a status after which the draft does not publish: anything but `COMPILED`,
17
+ * `NOTHING_TO_COMPILE` and `SKIPPED_EXTERNALLY_BUILT` (for example `BUSY` or `INPUT_INCOMPLETE` once the retries ran
18
+ * out, `COMPILER_UNAVAILABLE`, `NOT_PERMITTED`, `WRITE_FAILED`, `OUTPUT_UPLOAD`, `SKIPPED_GIT_MANAGED`, `GATE_TRIPPED`,
19
+ * `EMIT_WITHHELD`, `UNKNOWN`).
20
+ * @lastreviewed null
21
+ */
22
+ export interface BuildIncomplete {
23
+ /** The status, `UNKNOWN` for one this version does not know. @lastreviewed null */
24
+ readonly status: DraftCompileStatus;
25
+ /** The status exactly as the platform sent it. @lastreviewed null */
26
+ readonly rawStatus: string;
27
+ /** What the status means, in words. @lastreviewed null */
28
+ readonly description: string;
29
+ }
30
+ /**
31
+ * What a build status that does not publish means, for {@link BuildIncomplete.description}.
32
+ * @lastreviewed null
33
+ */
34
+ export declare function describeBuildStatus(status: DraftCompileStatus, rawStatus: string): string;
5
35
  /**
6
36
  * Outcome of a push, for callers that need more signal than the human-facing
7
37
  * messages — e.g. a CLI that must exit non-zero or emit `--json` when nothing
8
- * was uploaded or a snapshot shipped without a history entry. Check `pushed`
9
- * before reading anything else: a push that aborted early uploaded nothing,
10
- * regardless of what the other fields say.
38
+ * was pushed or a snapshot did not publish. Check `pushed` before reading
39
+ * anything else: a push that aborted early pushed nothing, regardless of what
40
+ * the other fields say.
11
41
  * @lastreviewed null
12
42
  */
13
43
  export interface PushResult {
14
44
  /**
15
- * True when the upload actually ran. False when the push aborted before
16
- * uploading anything (draft folder missing, or empty; or, on a snapshot push,
17
- * the compiled `scripts/app.js` missing or blank) — a state a machine
18
- * consumer must not read as success.
45
+ * True when the draft is on the platform: the draft branch was pushed, or already matched. False when the push
46
+ * aborted before that (draft folder missing, or empty) — a state a machine consumer must not read as success.
19
47
  * @lastreviewed null
20
48
  */
21
49
  pushed: boolean;
22
50
  /**
23
- * False for a snapshot push whose history entry could not be recorded (no
24
- * restore point exists), and for any push that did not run (`pushed: false`).
51
+ * The draft commit this push made, or the one already on the platform when nothing changed; the platform's build
52
+ * commit, when it makes one, follows it (`buildCommitSha`). `null` when `pushed` is false.
25
53
  * @lastreviewed null
26
54
  */
27
- historyRecorded: boolean;
55
+ commitSha: string | null;
28
56
  /**
29
- * Type-check outcome of the pre-publish transpile:
30
- * - `null` — no platform-code type-check ran. A plain (non-snapshot) push
31
- * does not compile; a push that aborted before compiling never got there;
32
- * and a snapshot whose TS all lives under nested client bundles (nothing
33
- * governed by the draft-root tsconfig) has no draft-root code to check.
34
- * - `0` — the draft-root code compiled with zero diagnostics: genuinely
35
- * type-checked.
36
- * - `> 0` — compiled, but N diagnostics were reported. The JavaScript was
37
- * emitted and published anyway (the platform runs the emitted JS on
38
- * GraalVM regardless of type errors, and local declarations may be
39
- * incomplete), so this is a loud warning, not a failure. A machine consumer
40
- * should treat `> 0` as "published without a passing type-check".
57
+ * The commit the platform published, on a snapshot push: the build commit, or the pushed commit when the build made
58
+ * none. `null` on a plain push, when the push aborted, when nothing was published (`snapshotRefused`, a build that
59
+ * failed or does not publish) and when the publish failed (`publishError` says why); a consumer asking for a
60
+ * snapshot must treat `null` as a failure.
41
61
  * @lastreviewed null
42
62
  */
43
- typeCheckDiagnostics: number | null;
63
+ publishedSha: string | null;
44
64
  /**
45
- * Whether the live (`snapshot/`) copy of every file this push wrote reads back identical to the
46
- * local bytes (compared by ETag, the platform's SHA-512 of the content):
47
- * - `null` — no read-back ran: a plain push, or a push that aborted before uploading.
48
- * Also `null` when no copy was wrong but at least one was served without a content hash
49
- * (ETag), so it could not be compared: those files are named in a warning, and cleanup and
50
- * history still run.
51
- * - `true` — every written file reads back identical. Files skipped as already in sync count as
52
- * verified, since the skip rule compared both copies.
53
- * - `false` — at least one file was still different, missing (`404`) or unreadable (another
54
- * non-2xx) after one re-upload; see `liveMismatches`. The push stopped there: no cleanup ran
55
- * and no history entry was recorded (`historyRecorded` is false), so a consumer that already
56
- * reads that field fails the run.
65
+ * Why the platform refused or failed the publish of a snapshot push, when it did; the draft was pushed regardless.
66
+ * `null` otherwise.
57
67
  * @lastreviewed null
58
68
  */
59
- liveVerified: boolean | null;
69
+ publishError: string | null;
60
70
  /**
61
- * Draft-relative paths (`/`-separated, e.g. `.build/scripts/app.js`) whose live copy failed the
62
- * read-back. Empty unless `liveVerified` is false.
71
+ * The platform's structured refusal of the publish: `reason` and `withheld` from the server's `PUBLISH_REFUSED`
72
+ * extensions (every reason, `DRAFT_MOVED` and `BUILD_*` included). `null` when the publish was not refused.
63
73
  * @lastreviewed null
64
74
  */
65
- liveMismatches: string[];
75
+ publishRefusal: PublishRefusal | null;
66
76
  /**
67
- * Draft-relative paths (`/`-separated) of files that exist only on the platform and were kept
68
- * because deleting them was not confirmed: declined, or answered with the safe default (an empty
69
- * answer, or the CLI's `--yes`). Empty when there were none, when they were deleted, or when
70
- * cleanup did not run.
77
+ * True when this push switched the script from WebDAV to git publishing. The switch is one-way: the script's draft
78
+ * and snapshot no longer accept WebDAV writes.
71
79
  * @lastreviewed null
72
80
  */
73
- keptPlatformOnly: string[];
74
- }
75
- /**
76
- * Outcome of {@link verifyLiveSnapshot}. Paths are draft-relative and `/`-separated.
77
- * @lastreviewed null
78
- */
79
- export interface LiveSnapshotCheck {
81
+ switchedToGit: boolean;
80
82
  /**
81
- * Files whose `snapshot/` copy still differs from local, is missing (`404`) or can't be read
82
- * (another non-2xx) after one re-upload.
83
+ * Which route the push took: `server-build` (the platform builds every push, and a snapshot publishes the build) or
84
+ * `push-only` (the server predates the git build: the draft was pushed and nothing else happened), with why and the
85
+ * versions compared. `null` when the push stopped before the server's version was asked.
83
86
  * @lastreviewed null
84
87
  */
85
- mismatches: string[];
88
+ route: PushRoute | null;
86
89
  /**
87
- * Files the platform served (2xx) without a SHA-512 ETag, so neither match nor mismatch can be
88
- * said.
90
+ * Set when a snapshot push was asked for but the server does not build git drafts: the draft was pushed, nothing was
91
+ * built or published. A result, not an error. `null` for a plain push and on the build route.
89
92
  * @lastreviewed null
90
93
  */
91
- indeterminate: string[];
92
- }
93
- /**
94
- * Outcome of {@link checkEmittedEntrypoint}.
95
- * @lastreviewed null
96
- */
97
- export interface EmittedEntrypointCheck {
94
+ snapshotRefused: SnapshotRefusal | null;
98
95
  /**
99
- * - `"no-source"` — the draft has no `scripts/app.ts` (a JS-only draft): nothing to check.
100
- * - `"ok"` — the compiled entrypoint exists and has content.
101
- * - `"missing"` — `scripts/app.ts` exists but the compile wrote no `scripts/app.js`.
102
- * - `"empty"` — the compiled entrypoint has no code: only comments (the inline source map
103
- * included) and the compiler's empty-module lines, e.g. from a blank `app.ts` or one holding
104
- * only types. The platform serves such a file as an empty `200`.
96
+ * What the platform's build of the pushed draft came to (`compileDraft`): status, counts, diagnostics and the save
97
+ * gate's findings. `null` when no build ran (push-only route, aborted push) or the build request failed
98
+ * (`buildError`).
105
99
  * @lastreviewed null
106
100
  */
107
- status: "no-source" | "ok" | "missing" | "empty";
101
+ build: DraftCompileOutcome | null;
108
102
  /**
109
- * Absolute path of the compiled entrypoint the check looked for.
103
+ * The build commit the platform made on the draft branch (the output, and the build manifest when it vouched for the
104
+ * build). The local draft folder was moved to it unless `buildFastForward` says otherwise. `null` when it made none: already built, nothing to build,
105
+ * no build ran, or the request failed.
110
106
  * @lastreviewed null
111
107
  */
112
- emittedPath: string;
113
- }
114
- /**
115
- * Pre-publish check for a snapshot push: after the compile, the entrypoint the platform runtime
116
- * loads must be there. The runtime resolves `scripts/app` to `<build folder>/scripts/app.js`; if
117
- * that file is missing or has no code, publishing it breaks the live version (a missing one fails
118
- * with `NoSuchFileException .../scripts/app`, one with no code answers an empty `200`), so the push
119
- * must stop before any upload (ClickUp 86bbqnrtp).
120
- *
121
- * Only the entrypoint is checked. A helper module may legitimately compile to almost nothing, so
122
- * checking every emitted file would stop good pushes. The transpiler sets `rootDir` to the
123
- * tsconfig's folder, which is why `scripts/app.ts` always maps to `<build folder>/scripts/app.js`.
124
- * @param opts.draftPath The draft folder
125
- * @param opts.buildFolderPath The draft-root tsconfig's build folder ({@link ScriptRoot.getDraftBuildFolder})
126
- * @param opts.fs The file system to read
127
- * @returns What was found, and the path it looked at
128
- * @lastreviewed null
129
- */
130
- export declare function checkEmittedEntrypoint(opts: {
131
- draftPath: string;
132
- buildFolderPath: string;
133
- fs: FileSystem;
134
- }): Promise<EmittedEntrypointCheck>;
135
- /**
136
- * Post-publish read-back for a snapshot push: `HEAD`s the `snapshot/` copy of each file the push
137
- * wrote and compares its ETag with the local SHA-512. The platform can accept a write (2xx) and
138
- * still serve different bytes, e.g. an empty or cut-off file, so a clean upload alone doesn't prove
139
- * the live version is right (ClickUp 86bbqnrtp).
140
- *
141
- * A copy that differs, is missing (`404`) or can't be read (another non-2xx) is re-sent once and
142
- * checked again; a re-send the platform refuses leaves it a mismatch. Only a 2xx without a content
143
- * hash is indeterminate. Files are checked one at a time, in the order given.
144
- * @param files The files this push wrote to `snapshot/`
145
- * @param ctx Where the retries are logged
146
- * @returns The files still mismatched, and the ones that could not be compared
147
- * @lastreviewed null
148
- */
149
- export declare function verifyLiveSnapshot(files: ScriptFile[], ctx: Pick<ScriptContext, "logger">): Promise<LiveSnapshotCheck>;
150
- /**
151
- * A file whose upload would overwrite a platform version nobody here has seen.
152
- * @lastreviewed null
153
- */
154
- export interface OverwriteCandidate {
108
+ buildCommitSha: string | null;
109
+ /**
110
+ * Whether the draft passes the platform's build check: the build is clean (every project's output written, no
111
+ * blocking error) and its manifest committed, or the draft needs none (externally built, nothing to build). `false`
112
+ * after an unclean build: the output is committed without a manifest
113
+ * and a publish is refused (`BUILD_STALE` or `BUILD_MANIFEST_MISSING`). `null` when no build ran.
114
+ * @lastreviewed null
115
+ */
116
+ buildVouched: boolean | null;
155
117
  /**
156
- * The file to upload.
118
+ * Why no build answer came after a successful push (the draft is pushed; nothing was published). `null` otherwise.
157
119
  * @lastreviewed null
158
120
  */
159
- file: ScriptFile;
121
+ buildError: string | null;
160
122
  /**
161
- * Draft-relative, `/`-separated path, e.g. `scripts/app.ts`.
123
+ * What `buildError` is: `not-requested` (no build was asked for: the platform's draft was no longer the pushed
124
+ * commit), `refused` (the platform refused the build, see `buildErrorReason`; nothing was built) or
125
+ * `request-failed` (any other failure; it may have run). `null` with no `buildError`.
162
126
  * @lastreviewed null
163
127
  */
164
- path: string;
128
+ buildErrorKind: "not-requested" | "refused" | "request-failed" | null;
165
129
  /**
166
- * Why it is at risk; see {@link ScriptFile.platformChangeAtRisk}.
130
+ * The platform's refusal reason when `buildErrorKind` is `refused`: `DRAFT_MOVED`, `DRAFT_TOO_LARGE` (the draft is
131
+ * over the build's size limit), `REPO_MISSING` or `DRAFT_BRANCH_MISSING`. `null` otherwise.
167
132
  * @lastreviewed null
168
133
  */
169
- risk: "changed" | "unsynced";
134
+ buildErrorReason: DraftBuildRefusalReason | null;
135
+ /**
136
+ * Set when the build answered with a status after which the draft does not publish (see {@link BuildIncomplete}):
137
+ * a snapshot push then publishes nothing, and neither push reports itself complete. `null` otherwise.
138
+ * @lastreviewed null
139
+ */
140
+ buildIncomplete: BuildIncomplete | null;
141
+ /**
142
+ * How the local draft folder was moved to `buildCommitSha`: `fast-forwarded`, `unchanged` (no build commit),
143
+ * `blocked` (local files the build changes are in the way, `blockedPaths`; the folder was left as it was, and a
144
+ * snapshot published nothing) or `failed` (`error`; the folder's draft branch did not move). `null` when no build
145
+ * answer came.
146
+ * @lastreviewed null
147
+ */
148
+ buildFastForward: BuildFastForward | null;
149
+ /**
150
+ * How many `ERROR` and `WARNING` diagnostics the platform's build reported in all (its `errors` + `warnings`):
151
+ * `null` when no build ran. {@link typeCheckErrors} lists fewer when the platform capped its list (at most 20) or
152
+ * some were outside the script's own sources. The platform builds and type-checks; a type-checker finding is a
153
+ * warning and does not stop the publish, so `> 0` is "built with findings", not a failure.
154
+ * @lastreviewed null
155
+ */
156
+ typeCheckDiagnostics: number | null;
157
+ /**
158
+ * The platform build's diagnostics in the script's own sources (never a `.d.ts`, never outside the tree), located:
159
+ * `{ file, line, column, code, message, severity }`, `file` relative to the draft folder. The platform lists at most
160
+ * 20 diagnostics (`build.diagnosticsOmitted` counts the rest). Empty when none, and when no build ran.
161
+ * @lastreviewed null
162
+ */
163
+ typeCheckErrors: TypeCheckError[];
164
+ /**
165
+ * Whether the platform's published branch reads back at the commit it reported publishing (`publishedSha`):
166
+ * - `null` — no read-back ran: a plain push, an aborted one, a failed publish, or the published branch could not be
167
+ * fetched to compare.
168
+ * - `true` — the published branch is at `publishedSha`.
169
+ * - `false` — it is at another commit; see `liveMismatches`.
170
+ * @lastreviewed null
171
+ */
172
+ liveVerified: boolean | null;
173
+ /**
174
+ * Draft-relative paths (`/`-separated) that differ between the commit the platform reported publishing and its
175
+ * published branch. Empty unless `liveVerified` is false (and then empty too when the difference can't be listed).
176
+ * @lastreviewed null
177
+ */
178
+ liveMismatches: string[];
179
+ /**
180
+ * Draft-relative paths (`/`-separated) of files that exist only on the platform and were kept
181
+ * because deleting them was not confirmed: declined, or answered with the safe default (an empty
182
+ * answer, or the CLI's `--yes`). They are part of the pushed commit. Empty when there were none or
183
+ * when they were deleted.
184
+ * @lastreviewed null
185
+ */
186
+ keptPlatformOnly: string[];
170
187
  }
171
188
  /**
172
- * Finds the files of a push whose upload would overwrite a platform version nobody here has seen,
173
- * by the rule in {@link ScriptFile.platformChangeAtRisk}. Files the push won't upload anyway
174
- * (ignored, declarations, already in sync) are left out, so they are never asked about.
189
+ * Core push implementation, on git: the draft folder is the script's git working tree, a push commits it and pushes the
190
+ * draft branch (see {@link pushDraft}), the platform then builds the pushed commit, and a snapshot publishes the build.
175
191
  *
176
- * Reads the platform one file at a time. The skip check it runs is cached on each file, so the
177
- * upload that follows doesn't repeat it.
178
- * @param files The push's files, the same instances the upload will use
179
- * @param opts.isSnapshot Whether the push also publishes to `snapshot/`
180
- * @returns The files at risk, in the order given
181
- * @lastreviewed null
182
- */
183
- export declare function collectOverwriteCandidates(files: ScriptFile[], opts: {
184
- isSnapshot: boolean;
185
- }): Promise<OverwriteCandidate[]>;
186
- /**
187
- * The push's one overwrite confirmation (ClickUp 86bbjennm). Before anything is uploaded, it finds
188
- * every file at risk ({@link collectOverwriteCandidates}) and asks once for all of them, so an
189
- * answer, or the lack of one, can no longer leave a push half done. Files the caller already
190
- * confirmed in `preConfirmed` are not asked about: that is how a consumer confirms without a
191
- * prompt, e.g. from a flag.
192
- * @param opts.files The push's files, the same instances the upload will use
193
- * @param opts.ctx Where the prompt goes
194
- * @param opts.isSnapshot Whether the push also publishes to `snapshot/`
195
- * @param opts.preConfirmed Draft-relative paths (`/`- or `\`-separated) the caller confirms up front
196
- * @returns The files whose overwrite is confirmed; `upload()` skips its own prompt for them
197
- * @throws an {@link Err.OverwriteDeclinedError} listing the files, when the answer is anything but
198
- * "Overwrite all". Nothing has been uploaded at that point.
199
- * @lastreviewed null
200
- */
201
- export declare function confirmOverwrites(opts: {
202
- files: ScriptFile[];
203
- ctx: Pick<ScriptContext, "prompt">;
204
- isSnapshot: boolean;
205
- preConfirmed?: string[];
206
- }): Promise<Set<ScriptFile>>;
207
- /**
208
- * Core push implementation.
192
+ * Nothing compiles here. The server's version picks the route once per push ({@link resolvePushRoute}): a `dev` server
193
+ * or one at or above `MIN_SERVER_VERSION` builds every push (GraphQL `compileDraft` pinned to the pushed commit), which
194
+ * commits the output, and the build manifest when it vouches for the build, as one build commit; the draft folder is
195
+ * fast-forwarded to it. A snapshot push then publishes that commit, unless the build failed or ended in a status that
196
+ * does not publish (a tripped gate, a withheld emit). An unclean build is published-or-refused by the platform's
197
+ * manifest check, never by core. On any other server the push is a git push alone, and a snapshot push takes no
198
+ * snapshot (`snapshotRefused`). If the platform refuses the publish the draft stays pushed and the result carries
199
+ * `publishError`.
209
200
  *
210
- * Delegates the per-file work to {@link ScriptFile.upload}, which handles:
211
- * - exclusion logic (declarations / .git / .gitignore / integrity match)
212
- * - collision detection against last-verified hash with user prompt
213
- * - snapshot dual-write (draft + snapshot)
214
- * - metadata `lastVerifiedHash` updates via touch()
215
- * - rich error wrapping
216
- *
217
- * Before any upload, one confirmation covers every file that would overwrite a platform version
218
- * nobody here has seen ({@link confirmOverwrites}); declining stops the push with nothing written.
219
- * A snapshot push then reads the live copies back ({@link verifyLiveSnapshot}). If any is still
220
- * wrong, the push stops before cleanup and history and returns `liveVerified: false`.
201
+ * Before anything is pushed, one confirmation covers every platform file the push would overwrite; declining stops the
202
+ * push with nothing sent.
221
203
  * @param opts.overwrite Draft-relative paths whose overwrite the caller confirms up front, so the
222
204
  * push doesn't ask about them (e.g. a consumer's flag, after the user approved the files a
223
205
  * declined push listed). Other at-risk files still ask.
206
+ * @param opts.author Who the commit is by. When absent: the folder's `git config`, then the environment.
207
+ * @param opts.adoptUnbound `false` for a deploy to a script the folder isn't the working copy of: the folder is then
208
+ * never bound to the target's repo. Default `true`.
209
+ * @param opts.floor Overrides `MIN_SERVER_VERSION` (`null` means unset); for tests
210
+ * @param opts.sleep Waits between the build's retries; for tests
224
211
  * @throws an {@link Err.OverwriteDeclinedError} when an overwrite is not confirmed
212
+ * @throws {GitIdentityError} when no commit author can be found
225
213
  * @lastreviewed null
226
214
  */
227
215
  export declare function executePush(opts: {
@@ -231,23 +219,9 @@ export declare function executePush(opts: {
231
219
  snapshot: boolean;
232
220
  message?: string;
233
221
  overwrite?: string[];
222
+ author?: GitIdentity;
223
+ adoptUnbound?: boolean;
224
+ enableGit?: boolean;
225
+ floor?: string | null;
226
+ sleep?: (ms: number) => Promise<void>;
234
227
  }): Promise<PushResult>;
235
- /**
236
- * Delete remote files that no longer have a local counterpart, after one confirmation listing
237
- * them. Anything but an explicit "Yes" keeps them all, including a prompt that throws because it
238
- * got no answer. Files matched by `.gitignore` are never deleted. Failures are logged, never
239
- * thrown: a push that uploaded fine is not failed by cleanup.
240
- * @param opts.ctx Where requests, prompts and logs go
241
- * @param opts.targetUrl The script's WebDAV base URL, listed with `PROPFIND`
242
- * @param opts.draftPath The local draft folder to compare against
243
- * @param opts.gitignoreMatcher The script's `.gitignore` patterns
244
- * @returns Draft-relative paths of the platform-only files it kept because deleting them was not
245
- * confirmed; empty when there were none, when they were deleted, or when cleanup failed
246
- * @lastreviewed null
247
- */
248
- export declare function cleanupUnusedUpstairsPaths(opts: {
249
- ctx: ScriptContext;
250
- targetUrl: string;
251
- draftPath: string;
252
- gitignoreMatcher: GlobMatcher;
253
- }): Promise<string[]>;