create-ailk 0.35.1 → 0.37.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.
- package/README.md +1 -1
- package/component-catalog.json +51 -1
- package/component-catalog.md +8 -5
- package/dist/lib/env-catalog.js +8 -0
- package/dist/surfaces.js +66 -22
- package/dist/topology.d.ts +4 -4
- package/dist/topology.js +104 -60
- package/dist/update.d.ts +19 -1
- package/dist/update.js +293 -35
- package/package.json +3 -3
- package/templates/.env.example +38 -0
- package/templates/apps/api/.env.example +45 -0
- package/templates/apps/api/CLAUDE.md +12 -4
- package/templates/apps/api/src/lib/__mocks__/prisma.ts +7 -0
- package/templates/apps/mcp/CLAUDE.md +4 -2
- package/templates/apps/web/.env.example +16 -0
- package/templates/apps/web/CLAUDE.md +73 -5
- package/templates/apps/web/app/[locale]/(auth)/__tests__/password-reset.test.tsx +2 -0
- package/templates/apps/web/app/[locale]/(auth)/reset-password/__tests__/return.test.tsx +179 -0
- package/templates/apps/web/app/[locale]/(auth)/reset-password/page.tsx +22 -2
- package/templates/apps/web/app/[locale]/(auth)/reset-password/reset-password-card.tsx +9 -2
- package/templates/apps/web/app/[locale]/(auth)/sign-in/__tests__/page.test.tsx +52 -1
- package/templates/apps/web/app/[locale]/(auth)/sign-in/__tests__/remembered-method.test.ts +43 -0
- package/templates/apps/web/app/[locale]/(auth)/sign-in/__tests__/sign-in-card.test.tsx +108 -1
- package/templates/apps/web/app/[locale]/(auth)/sign-in/page.tsx +36 -3
- package/templates/apps/web/app/[locale]/(auth)/sign-in/remembered-method.ts +37 -0
- package/templates/apps/web/app/[locale]/(auth)/sign-in/sign-in-card.tsx +90 -33
- package/templates/apps/web/app/[locale]/(auth)/sign-in/sign-in-text.ts +9 -4
- package/templates/apps/web/app/[locale]/(authed)/__tests__/gate.test.tsx +79 -348
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/billing.test.tsx +241 -66
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/general.test.tsx +242 -28
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/hub-mode.test.tsx +377 -151
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/item.test.tsx +26 -1
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/layout-sign-out.test.tsx +10 -5
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/layout.test.tsx +17 -6
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/new-menu.test.tsx +51 -12
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/new-popups.test.tsx +17 -2
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/notifications.test.tsx +153 -2
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/page.test.tsx +206 -23
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/popups.test.tsx +150 -188
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/privacy.test.tsx +235 -177
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/rich-translator.ts +63 -0
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/security.test.tsx +0 -3
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/thread.test.tsx +340 -0
- package/templates/apps/web/app/[locale]/(authed)/account/account-data.ts +7 -5
- package/templates/apps/web/app/[locale]/(authed)/account/account-frame.tsx +20 -4
- package/templates/apps/web/app/[locale]/(authed)/account/actions.ts +8 -4
- package/templates/apps/web/app/[locale]/(authed)/account/appointments/[slug]/page.tsx +161 -0
- package/templates/apps/web/app/[locale]/(authed)/account/appointments/__tests__/page.test.tsx +426 -0
- package/templates/apps/web/app/[locale]/(authed)/account/appointments/appointments-data.ts +76 -0
- package/templates/apps/web/app/[locale]/(authed)/account/appointments/page.tsx +139 -0
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/page.tsx +92 -24
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/versions/[version]/file/route.ts +32 -1
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/file-route.test.ts +76 -3
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/page.test.tsx +290 -41
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/artifact-data.ts +109 -11
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/page.tsx +43 -44
- package/templates/apps/web/app/[locale]/(authed)/account/billing/__tests__/offerings.test.ts +99 -0
- package/templates/apps/web/app/[locale]/(authed)/account/billing/offerings.ts +123 -0
- package/templates/apps/web/app/[locale]/(authed)/account/billing/page.tsx +323 -73
- package/templates/apps/web/app/[locale]/(authed)/account/billing-source.ts +199 -43
- package/templates/apps/web/app/[locale]/(authed)/account/components/request-quote.tsx +52 -7
- package/templates/apps/web/app/[locale]/(authed)/account/connect/__tests__/page.test.tsx +8 -1
- package/templates/apps/web/app/[locale]/(authed)/account/connect/page.tsx +7 -3
- package/templates/apps/web/app/[locale]/(authed)/account/general/__tests__/phone-verification.test.tsx +215 -0
- package/templates/apps/web/app/[locale]/(authed)/account/general/__tests__/seam-imports.test.ts +65 -0
- package/templates/apps/web/app/[locale]/(authed)/account/general/account-name.ts +36 -0
- package/templates/apps/web/app/[locale]/(authed)/account/general/contact-actions.ts +70 -2
- package/templates/apps/web/app/[locale]/(authed)/account/general/contact-details.tsx +42 -0
- package/templates/apps/web/app/[locale]/(authed)/account/general/page.tsx +97 -53
- package/templates/apps/web/app/[locale]/(authed)/account/general/phone-actions.ts +122 -0
- package/templates/apps/web/app/[locale]/(authed)/account/general/phone-verification.tsx +215 -0
- package/templates/apps/web/app/[locale]/(authed)/account/general/photo-actions.ts +73 -0
- package/templates/apps/web/app/[locale]/(authed)/account/general/profile-form.tsx +12 -9
- package/templates/apps/web/app/[locale]/(authed)/account/general/profile-source.ts +18 -4
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/[kind]/[id]/page.tsx +20 -2
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/member-thread-composer.tsx +43 -0
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/page.tsx +125 -0
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/thread-data.ts +88 -0
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/thread-write.ts +31 -0
- package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/__tests__/invitation-id.test.ts +35 -0
- package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/__tests__/page.test.tsx +266 -0
- package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/actions.ts +116 -0
- package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/invitation-id.ts +12 -0
- package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/page.tsx +154 -0
- package/templates/apps/web/app/[locale]/(authed)/account/layout.tsx +9 -6
- package/templates/apps/web/app/[locale]/(authed)/account/new-menu.tsx +33 -8
- package/templates/apps/web/app/[locale]/(authed)/account/new-popups.tsx +31 -52
- package/templates/apps/web/app/[locale]/(authed)/account/notifications/page.tsx +44 -4
- package/templates/apps/web/app/[locale]/(authed)/account/page.tsx +69 -49
- package/templates/apps/web/app/[locale]/(authed)/account/privacy/__tests__/export-route.test.ts +173 -0
- package/templates/apps/web/app/[locale]/(authed)/account/privacy/actions.ts +42 -4
- package/templates/apps/web/app/[locale]/(authed)/account/privacy/export/route.ts +102 -0
- package/templates/apps/web/app/[locale]/(authed)/account/privacy/page.tsx +147 -137
- package/templates/apps/web/app/[locale]/(authed)/account/security/__tests__/hub-variant.test.tsx +258 -0
- package/templates/apps/web/app/[locale]/(authed)/account/security/page.tsx +21 -22
- package/templates/apps/web/app/[locale]/(authed)/account/security/security-panel.tsx +34 -6
- package/templates/apps/web/app/[locale]/(authed)/account/security/security-source.ts +37 -7
- package/templates/apps/web/app/[locale]/(authed)/account/settings/page.tsx +0 -2
- package/templates/apps/web/app/[locale]/(authed)/account/settings-frame.tsx +8 -5
- package/templates/apps/web/app/[locale]/(authed)/layout.tsx +15 -13
- package/templates/apps/web/app/[locale]/(authed)/signed-out-gate.generated.tsx +20 -52
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/ResultsClient.tsx +3 -2
- package/templates/apps/web/app/[locale]/layout.tsx +24 -75
- package/templates/apps/web/app/[locale]/purchase/__tests__/success.test.tsx +50 -0
- package/templates/apps/web/app/[locale]/purchase/success/page.tsx +48 -7
- package/templates/apps/web/app/api/auth/hub/__tests__/entry-routes.test.ts +749 -0
- package/templates/apps/web/app/api/auth/hub/authorize/__tests__/route.test.ts +166 -7
- package/templates/apps/web/app/api/auth/hub/authorize/route.ts +96 -30
- package/templates/apps/web/app/api/auth/hub/continuation.ts +51 -2
- package/templates/apps/web/app/api/auth/hub/email/route.ts +111 -0
- package/templates/apps/web/app/api/auth/hub/entry-shared.ts +163 -0
- package/templates/apps/web/app/api/auth/hub/password/__tests__/return.test.ts +86 -0
- package/templates/apps/web/app/api/auth/hub/password/__tests__/route.test.ts +368 -0
- package/templates/apps/web/app/api/auth/hub/password/return.ts +86 -0
- package/templates/apps/web/app/api/auth/hub/password/route.ts +171 -0
- package/templates/apps/web/app/api/auth/hub/purchase/route.ts +230 -0
- package/templates/apps/web/app/api/auth/hub/purchase-link/route.ts +174 -0
- package/templates/apps/web/app/api/auth/hub/sign-up/route.ts +60 -0
- package/templates/apps/web/app/api/auth/hub/sign-up-evidence.ts +97 -0
- package/templates/apps/web/app/api/hub-session/__tests__/routes.test.ts +738 -7
- package/templates/apps/web/app/api/hub-session/callback/route.ts +13 -47
- package/templates/apps/web/app/api/hub-session/email/route.ts +125 -0
- package/templates/apps/web/app/api/hub-session/one-tap/nonce/route.ts +49 -0
- package/templates/apps/web/app/api/hub-session/one-tap/route.ts +106 -0
- package/templates/apps/web/app/api/hub-session/open/route.ts +111 -0
- package/templates/apps/web/app/api/hub-session/password/return/route.ts +69 -0
- package/templates/apps/web/app/api/hub-session/password/route.ts +106 -0
- package/templates/apps/web/app/api/hub-session/sign-in/route.ts +23 -40
- package/templates/apps/web/app/api/hub-session/sign-out/route.ts +1 -10
- package/templates/apps/web/auth.ts +133 -6
- package/templates/apps/web/components/sign-out-trigger.tsx +1 -1
- package/templates/apps/web/lib/__tests__/account-config.test.ts +129 -1
- package/templates/apps/web/lib/__tests__/auth-email.test.ts +141 -0
- package/templates/apps/web/lib/__tests__/auth-phone.test.ts +445 -0
- package/templates/apps/web/lib/__tests__/auth-sms.test.ts +140 -0
- package/templates/apps/web/lib/__tests__/fixtures/tsconfig.flow.json +18 -0
- package/templates/apps/web/lib/__tests__/offerings-pricing.test.ts +33 -0
- package/templates/apps/web/lib/__tests__/site-header.test.ts +13 -0
- package/templates/apps/web/lib/__tests__/telemetry-scrub.test.ts +19 -1
- package/templates/apps/web/lib/account-config.ts +132 -8
- package/templates/apps/web/lib/auth-email.ts +62 -6
- package/templates/apps/web/lib/auth-env.ts +13 -0
- package/templates/apps/web/lib/auth-routes.ts +11 -6
- package/templates/apps/web/lib/auth-sms.ts +180 -0
- package/templates/apps/web/lib/hub-session/__tests__/hub-session.test.ts +28 -0
- package/templates/apps/web/lib/hub-session/__tests__/spoke-sign-in.test.tsx +332 -0
- package/templates/apps/web/lib/hub-session/config.ts +7 -1
- package/templates/apps/web/lib/hub-session/entry.ts +238 -0
- package/templates/apps/web/lib/hub-session/index.ts +1 -4
- package/templates/apps/web/lib/hub-session/one-tap.tsx +148 -0
- package/templates/apps/web/lib/hub-session/session.ts +120 -2
- package/templates/apps/web/lib/hub-session/spoke-sign-in.tsx +277 -0
- package/templates/apps/web/lib/offerings-pricing.ts +4 -1
- package/templates/apps/web/lib/site-header.ts +14 -1
- package/templates/apps/web/lib/telemetry-scrub.ts +11 -0
- package/templates/apps/web/lib/topology.generated.ts +39 -0
- package/templates/apps/web/messages/en.json +264 -96
- package/templates/apps/web/middleware.ts +34 -2
- package/templates/apps/web/security-headers.config.ts +21 -0
- package/versions.json +48 -48
- package/templates/apps/web/app/[locale]/(authed)/account/components/schedule-service.tsx +0 -276
- package/templates/apps/web/app/[locale]/(authed)/account/components/send-message.tsx +0 -128
- package/templates/apps/web/app/[locale]/(authed)/account/settings/__tests__/theme-modes.test.ts +0 -42
- package/templates/apps/web/app/[locale]/(authed)/account/settings/theme-modes.ts +0 -40
- package/templates/apps/web/app/[locale]/(authed)/sign-in-gate.tsx +0 -162
- package/templates/apps/web/components/signed-in-nav.tsx +0 -79
- package/templates/apps/web/lib/hub-session/__tests__/sign-in-gate.test.tsx +0 -180
- package/templates/apps/web/lib/hub-session/sign-in-gate.tsx +0 -162
package/dist/update.js
CHANGED
|
@@ -40,6 +40,18 @@
|
|
|
40
40
|
* mdx-body page is escaped as `\{`, kept only when the site's own MDX parser
|
|
41
41
|
* reads the page clean (#10773, `mdx-braces.ts`).
|
|
42
42
|
*
|
|
43
|
+
* The hold-back is one file's, never its import cluster's (#11147). A
|
|
44
|
+
* recorded file whose bytes are ANY published template version's copy in
|
|
45
|
+
* the record's range is a stale copy, not a site edit: it moves, and the
|
|
46
|
+
* report names the version. A file left alone does not hold back an
|
|
47
|
+
* importer whose own bytes are the record's — the importer moves, unless it
|
|
48
|
+
* names an export the held copy lacks — and the report lists the held file
|
|
49
|
+
* with the import edge that depends on it. A removal a still-present file
|
|
50
|
+
* imports is held with that file, so the tree stays type-checkable. A site
|
|
51
|
+
* edit that touches only comment lines is reported as `comment-only edit`,
|
|
52
|
+
* takes the template's copy on a conflict, and never counts as a site edit
|
|
53
|
+
* for the cascade.
|
|
54
|
+
*
|
|
43
55
|
* Pure module: no `import.meta.url` — the CLI supplies `templatesDir`, the
|
|
44
56
|
* `adopt.ts` / `add-route.ts` split.
|
|
45
57
|
*/
|
|
@@ -54,7 +66,8 @@ import { buildScaffoldMarkers, isExcluded, isTextFile, renderTemplateFile, templ
|
|
|
54
66
|
import { deriveArchitecture } from "./derive-architecture.js";
|
|
55
67
|
import { EnvContractError, planEnvRows, readEnvContract, readManifestTopology, } from "./lib/declared-env.js";
|
|
56
68
|
import { ENV_CATALOG } from "./lib/env-catalog.js";
|
|
57
|
-
import {
|
|
69
|
+
import { assertContentLengthWithinLimit, assertHttpsRegistryUrl, fetchTimeoutSignal, } from "./lib/fetch-guard.js";
|
|
70
|
+
import { DEFAULT_AILK_NPM_REGISTRY_URL, fetchTemplateSnapshot } from "./lib/fetch-template-snapshot.js";
|
|
58
71
|
import { exportsName, listFilesUnder, namedImportsOf } from "./lib/import-graph.js";
|
|
59
72
|
import { mergeThreeWay } from "./lib/merge-three-way.js";
|
|
60
73
|
import { publicTreeRemoved } from "./lib/site-modules.js";
|
|
@@ -81,6 +94,8 @@ function markersForVersion(projectName, version) {
|
|
|
81
94
|
return { ...buildScaffoldMarkers(projectName), CREATE_AILK_VERSION: version };
|
|
82
95
|
}
|
|
83
96
|
const VERSION_TUPLE = /^(\d+)\.(\d+)\.(\d+)/;
|
|
97
|
+
/** A published release — never a pre-release tag, which `versionOlder` would sort beside its release. */
|
|
98
|
+
const RELEASE_VERSION = /^\d+\.\d+\.\d+$/;
|
|
84
99
|
/** `true` iff semver `a` is strictly older than semver `b` (major, minor, patch, numerically). */
|
|
85
100
|
function versionOlder(a, b) {
|
|
86
101
|
const ma = VERSION_TUPLE.exec(a);
|
|
@@ -163,6 +178,92 @@ function backfillProjectName(targetDir) {
|
|
|
163
178
|
}
|
|
164
179
|
return targetDir.split(sep).filter(Boolean).pop() ?? targetDir;
|
|
165
180
|
}
|
|
181
|
+
/** The `patternVersion` of `.ailk-site-manifest.json`, or `undefined` when there is none to read. */
|
|
182
|
+
function readPatternVersion(targetDir) {
|
|
183
|
+
const manifestPath = join(targetDir, SITE_ROSTER_PATH);
|
|
184
|
+
if (!existsSync(manifestPath))
|
|
185
|
+
return undefined;
|
|
186
|
+
try {
|
|
187
|
+
const doc = JSON.parse(readFileSync(manifestPath, "utf8"));
|
|
188
|
+
const value = doc["patternVersion"];
|
|
189
|
+
return typeof value === "string" && value.length > 0 ? value : undefined;
|
|
190
|
+
}
|
|
191
|
+
catch {
|
|
192
|
+
return undefined;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
/** A source module: the files whose comment lines `summarizeEdit` can tell from code. */
|
|
196
|
+
const SOURCE_FILE = /\.[cm]?[jt]sx?$/;
|
|
197
|
+
/**
|
|
198
|
+
* `lines` with every blank line and every whole-line comment — a `//` line,
|
|
199
|
+
* or the lines of a `/* … *\/` block that opens at a line's start — left
|
|
200
|
+
* out, each remaining line trimmed. A comment that follows code on its line
|
|
201
|
+
* stays with the line: only whole lines are comment lines (#11147).
|
|
202
|
+
*/
|
|
203
|
+
function codeLines(lines) {
|
|
204
|
+
const out = [];
|
|
205
|
+
let inBlock = false;
|
|
206
|
+
for (const raw of lines) {
|
|
207
|
+
const line = raw.trim();
|
|
208
|
+
if (inBlock) {
|
|
209
|
+
const end = line.indexOf("*/");
|
|
210
|
+
if (end === -1)
|
|
211
|
+
continue;
|
|
212
|
+
inBlock = false;
|
|
213
|
+
const rest = line.slice(end + 2).trim();
|
|
214
|
+
if (rest.length > 0)
|
|
215
|
+
out.push(rest);
|
|
216
|
+
continue;
|
|
217
|
+
}
|
|
218
|
+
if (line.length === 0 || line.startsWith("//"))
|
|
219
|
+
continue;
|
|
220
|
+
if (line.startsWith("/*")) {
|
|
221
|
+
const end = line.indexOf("*/", 2);
|
|
222
|
+
if (end === -1) {
|
|
223
|
+
inBlock = true;
|
|
224
|
+
continue;
|
|
225
|
+
}
|
|
226
|
+
const rest = line.slice(end + 2).trim();
|
|
227
|
+
if (rest.length > 0)
|
|
228
|
+
out.push(rest);
|
|
229
|
+
continue;
|
|
230
|
+
}
|
|
231
|
+
out.push(line);
|
|
232
|
+
}
|
|
233
|
+
return out;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* The site's edit of `path` against the record's copy (#11147): the one
|
|
237
|
+
* changed region's size and first line (`+2 −1 at line 12`), and whether
|
|
238
|
+
* the edit is comment lines only — a source file whose code lines are the
|
|
239
|
+
* same on both sides. A region that opens inside a template literal (an odd
|
|
240
|
+
* number of backticks before it) is never comment-only: its `//` lines are
|
|
241
|
+
* text, not comments.
|
|
242
|
+
*/
|
|
243
|
+
function summarizeEdit(path, base, ours) {
|
|
244
|
+
const a = base.split("\n");
|
|
245
|
+
const b = ours.split("\n");
|
|
246
|
+
let prefix = 0;
|
|
247
|
+
while (prefix < a.length && prefix < b.length && a[prefix] === b[prefix])
|
|
248
|
+
prefix++;
|
|
249
|
+
let suffix = 0;
|
|
250
|
+
while (suffix < a.length - prefix &&
|
|
251
|
+
suffix < b.length - prefix &&
|
|
252
|
+
a[a.length - 1 - suffix] === b[b.length - 1 - suffix]) {
|
|
253
|
+
suffix++;
|
|
254
|
+
}
|
|
255
|
+
const removed = a.length - prefix - suffix;
|
|
256
|
+
const added = b.length - prefix - suffix;
|
|
257
|
+
const summary = `+${added} −${removed} at line ${prefix + 1}`;
|
|
258
|
+
const inTemplateLiteral = a.slice(0, prefix).join("\n").split("`").length % 2 === 0;
|
|
259
|
+
const codeA = codeLines(a);
|
|
260
|
+
const codeB = codeLines(b);
|
|
261
|
+
const commentOnly = SOURCE_FILE.test(path) &&
|
|
262
|
+
!inTemplateLiteral &&
|
|
263
|
+
codeA.length === codeB.length &&
|
|
264
|
+
codeA.every((line, i) => line === codeB[i]);
|
|
265
|
+
return { commentOnly, summary };
|
|
266
|
+
}
|
|
166
267
|
/** The highest directory or file missing on disk on `destRel`'s chain below `apps/<app>/` (D4 rule iii). */
|
|
167
268
|
function highestMissingAncestor(destRel, targetDir) {
|
|
168
269
|
const segments = destRel.split("/");
|
|
@@ -219,10 +320,10 @@ function relativeImportCandidates(fromPath, specifier) {
|
|
|
219
320
|
function isLocal(fromPath, specifier) {
|
|
220
321
|
return specifier.startsWith(".") || (specifier.startsWith("@/") && fromPath.startsWith(WEB_ROOT));
|
|
221
322
|
}
|
|
222
|
-
/** The local module specifiers `text` names. */
|
|
323
|
+
/** The local module specifiers `text` names — in its code lines, never a `jest.mock(…)` a comment cites (#11147). */
|
|
223
324
|
function localSpecifiers(fromPath, text) {
|
|
224
325
|
const out = new Set();
|
|
225
|
-
for (const match of text.matchAll(IMPORT_SPECIFIER)) {
|
|
326
|
+
for (const match of codeLines(text.split("\n")).join("\n").matchAll(IMPORT_SPECIFIER)) {
|
|
226
327
|
const specifier = match[1] ?? match[2] ?? match[3];
|
|
227
328
|
if (specifier !== undefined && isLocal(fromPath, specifier))
|
|
228
329
|
out.add(specifier);
|
|
@@ -868,6 +969,7 @@ export async function updateSite(opts) {
|
|
|
868
969
|
const version = opts.version;
|
|
869
970
|
// ── Load the record, or determine the backfill (D8) ──────────────────
|
|
870
971
|
const recordPath = join(targetDir, TEMPLATE_RECORD_PATH);
|
|
972
|
+
const patternVersion = readPatternVersion(targetDir);
|
|
871
973
|
let record;
|
|
872
974
|
let backfillPatternVersion;
|
|
873
975
|
// #10173 — a row at a path a later create-ailk no longer records (a
|
|
@@ -884,19 +986,7 @@ export async function updateSite(opts) {
|
|
|
884
986
|
}
|
|
885
987
|
}
|
|
886
988
|
else {
|
|
887
|
-
|
|
888
|
-
let patternVersion;
|
|
889
|
-
if (existsSync(manifestPath)) {
|
|
890
|
-
try {
|
|
891
|
-
const doc = JSON.parse(readFileSync(manifestPath, "utf8"));
|
|
892
|
-
const value = doc["patternVersion"];
|
|
893
|
-
if (typeof value === "string" && value.length > 0)
|
|
894
|
-
patternVersion = value;
|
|
895
|
-
}
|
|
896
|
-
catch {
|
|
897
|
-
// an unreadable manifest is the same refusal as a missing one, below.
|
|
898
|
-
}
|
|
899
|
-
}
|
|
989
|
+
// An unreadable manifest is the same refusal as a missing one.
|
|
900
990
|
if (patternVersion === undefined) {
|
|
901
991
|
throw new UpdateRefusedError(`no ${TEMPLATE_RECORD_PATH} and no "patternVersion" in ${SITE_ROSTER_PATH} to rebuild it from; run \`create-ailk adopt\` first`);
|
|
902
992
|
}
|
|
@@ -1014,6 +1104,56 @@ export async function updateSite(opts) {
|
|
|
1014
1104
|
versionCache.set(v, result);
|
|
1015
1105
|
return result;
|
|
1016
1106
|
}
|
|
1107
|
+
// ── The versions a stale copy could be (#11147) ───────────────────────
|
|
1108
|
+
// Every published version from the record's oldest (its rows' versions,
|
|
1109
|
+
// and the manifest's `patternVersion`) up to, not including, the running
|
|
1110
|
+
// one, newest first — read once from the registry's version list, which
|
|
1111
|
+
// the stub `fetchImpl` of a test may not serve. When it cannot be read,
|
|
1112
|
+
// the record's own versions are the list; never a refusal of the run.
|
|
1113
|
+
let versionsInRange;
|
|
1114
|
+
async function listVersionsInRange() {
|
|
1115
|
+
const known = new Set([...recordedVersions, ...(patternVersion !== undefined ? [patternVersion] : [])]);
|
|
1116
|
+
const floor = [...known].reduce((oldest, v) => (versionOlder(v, oldest) ? v : oldest), version);
|
|
1117
|
+
if (!versionOlder(floor, version))
|
|
1118
|
+
return []; // nothing recorded is older: no range, no request
|
|
1119
|
+
try {
|
|
1120
|
+
const registryUrl = opts.registryUrl ?? process.env["AILK_NPM_REGISTRY_URL"] ?? DEFAULT_AILK_NPM_REGISTRY_URL;
|
|
1121
|
+
assertHttpsRegistryUrl(registryUrl, Error);
|
|
1122
|
+
const response = await (opts.fetchImpl ?? fetch)(`${registryUrl.replace(/\/+$/, "")}/create-ailk`, {
|
|
1123
|
+
method: "GET",
|
|
1124
|
+
headers: { Accept: "application/vnd.npm.install-v1+json" },
|
|
1125
|
+
redirect: "error",
|
|
1126
|
+
signal: fetchTimeoutSignal(),
|
|
1127
|
+
});
|
|
1128
|
+
if (response.ok) {
|
|
1129
|
+
assertContentLengthWithinLimit(response, Error);
|
|
1130
|
+
const versions = (await response.json()).versions;
|
|
1131
|
+
if (isPlainObject(versions)) {
|
|
1132
|
+
for (const v of Object.keys(versions))
|
|
1133
|
+
if (RELEASE_VERSION.test(v))
|
|
1134
|
+
known.add(v);
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1138
|
+
catch {
|
|
1139
|
+
// The record's own versions are the list.
|
|
1140
|
+
}
|
|
1141
|
+
return [...known]
|
|
1142
|
+
.filter((v) => !versionOlder(v, floor) && versionOlder(v, version))
|
|
1143
|
+
.sort((a, b) => (versionOlder(a, b) ? 1 : versionOlder(b, a) ? -1 : 0));
|
|
1144
|
+
}
|
|
1145
|
+
/** The version in range whose rendered copy of `path` hashes to `diskHash`, newest first, or `undefined`. */
|
|
1146
|
+
async function staleCopyOf(path, diskHash) {
|
|
1147
|
+
for (const v of await (versionsInRange ??= listVersionsInRange())) {
|
|
1148
|
+
const snapshot = await loadVersionMap(v);
|
|
1149
|
+
if ("error" in snapshot)
|
|
1150
|
+
continue;
|
|
1151
|
+
const bytes = snapshot.get(path);
|
|
1152
|
+
if (bytes !== undefined && sha256Hex(bytes) === diskHash)
|
|
1153
|
+
return v;
|
|
1154
|
+
}
|
|
1155
|
+
return undefined;
|
|
1156
|
+
}
|
|
1017
1157
|
// ── The backfill: fetch the old base and build the synthetic record ──
|
|
1018
1158
|
// Every in-scope snapshot path gets a row at the snapshot's hash, present
|
|
1019
1159
|
// on disk or not (#9527): an absent one then reads as "deleted locally"
|
|
@@ -1080,6 +1220,11 @@ export async function updateSite(opts) {
|
|
|
1080
1220
|
...(apiMove?.review ?? []),
|
|
1081
1221
|
];
|
|
1082
1222
|
const skipped = [];
|
|
1223
|
+
// #11147 — the edited rows sorted: a stale copy of another version, a
|
|
1224
|
+
// comment-only edit, or a site edit with its hunk summary (the cascade's).
|
|
1225
|
+
const staleCopies = [];
|
|
1226
|
+
const commentOnlyEdits = [];
|
|
1227
|
+
const siteEdits = new Map();
|
|
1083
1228
|
const nextFiles = { ...record.files };
|
|
1084
1229
|
const writes = [];
|
|
1085
1230
|
const deletes = [];
|
|
@@ -1131,8 +1276,13 @@ export async function updateSite(opts) {
|
|
|
1131
1276
|
if (newBytes === undefined) {
|
|
1132
1277
|
// #9654 — the bytes are a pre-#9460 template copy, just not the one
|
|
1133
1278
|
// the row names: not an edit, so it is retired as an untouched copy
|
|
1134
|
-
// is, on the move's run or any later one.
|
|
1135
|
-
|
|
1279
|
+
// is, on the move's run or any later one. #11147 — so is a copy of
|
|
1280
|
+
// any other published version in the record's range.
|
|
1281
|
+
const priorMcpCopy = path.startsWith(`${MCP_SRC}/`) && PRIOR_MCP_TEMPLATE_HASHES.has(diskHash);
|
|
1282
|
+
const stale = priorMcpCopy ? undefined : await staleCopyOf(path, diskHash);
|
|
1283
|
+
if (priorMcpCopy || stale !== undefined) {
|
|
1284
|
+
if (stale !== undefined)
|
|
1285
|
+
staleCopies.push({ path, version: stale });
|
|
1136
1286
|
deletes.push(path);
|
|
1137
1287
|
delete nextFiles[path];
|
|
1138
1288
|
removed.push(path);
|
|
@@ -1149,6 +1299,16 @@ export async function updateSite(opts) {
|
|
|
1149
1299
|
current.push(path);
|
|
1150
1300
|
continue;
|
|
1151
1301
|
}
|
|
1302
|
+
// #11147 — another published version's copy is a stale copy, not an
|
|
1303
|
+
// edit: overwritten as an untouched file is, named with its version.
|
|
1304
|
+
const stale = await staleCopyOf(path, diskHash);
|
|
1305
|
+
if (stale !== undefined) {
|
|
1306
|
+
staleCopies.push({ path, version: stale });
|
|
1307
|
+
writes.push({ path, bytes: Buffer.from(newBytes) });
|
|
1308
|
+
nextFiles[path] = { sha256: newHash, version };
|
|
1309
|
+
updated.push(path);
|
|
1310
|
+
continue;
|
|
1311
|
+
}
|
|
1152
1312
|
// Template changed, and the edit does not already match it: three-way merge.
|
|
1153
1313
|
const base = await loadVersionMap(rec.version);
|
|
1154
1314
|
if ("error" in base) {
|
|
@@ -1177,9 +1337,18 @@ export async function updateSite(opts) {
|
|
|
1177
1337
|
review.push({ path, reason: "edited here; binary files are not merged" });
|
|
1178
1338
|
continue;
|
|
1179
1339
|
}
|
|
1340
|
+
const oursText = diskBytes.toString("utf8");
|
|
1341
|
+
const baseText = Buffer.from(baseBytes).toString("utf8");
|
|
1342
|
+
// #11147 — the edit, for the report and the cascade: a comment-only one
|
|
1343
|
+
// is never a site edit.
|
|
1344
|
+
const edit = summarizeEdit(path, baseText, oursText);
|
|
1345
|
+
if (edit.commentOnly)
|
|
1346
|
+
commentOnlyEdits.push(path);
|
|
1347
|
+
else
|
|
1348
|
+
siteEdits.set(path, edit.summary);
|
|
1180
1349
|
const mergeResult = mergeThreeWay({
|
|
1181
|
-
ours:
|
|
1182
|
-
base:
|
|
1350
|
+
ours: oursText,
|
|
1351
|
+
base: baseText,
|
|
1183
1352
|
theirs: Buffer.from(newBytes).toString("utf8"),
|
|
1184
1353
|
oursLabel: "yours",
|
|
1185
1354
|
baseLabel: `template ${rec.version}`,
|
|
@@ -1216,6 +1385,13 @@ export async function updateSite(opts) {
|
|
|
1216
1385
|
merged.push(path);
|
|
1217
1386
|
}
|
|
1218
1387
|
}
|
|
1388
|
+
else if (mergeResult.status === "conflict" && edit.commentOnly) {
|
|
1389
|
+
// #11147 — the site touched only comment lines, on the lines the
|
|
1390
|
+
// template changed: the template's copy lands, reported as such.
|
|
1391
|
+
writes.push({ path, bytes: Buffer.from(newBytes) });
|
|
1392
|
+
nextFiles[path] = { sha256: newHash, version };
|
|
1393
|
+
updated.push(path);
|
|
1394
|
+
}
|
|
1219
1395
|
else if (mergeResult.status === "conflict") {
|
|
1220
1396
|
review.push({
|
|
1221
1397
|
path,
|
|
@@ -1304,6 +1480,11 @@ export async function updateSite(opts) {
|
|
|
1304
1480
|
const deleting = new Set([...deletes, ...(mcpMove?.deletes ?? []), ...(apiMove?.deletes ?? [])]);
|
|
1305
1481
|
const adding = new Set(added);
|
|
1306
1482
|
const heldBackByFile = new Map();
|
|
1483
|
+
// #11147 — per held file, the importers that moved anyway: a file whose
|
|
1484
|
+
// own bytes were the record's follows no held import, unless it names an
|
|
1485
|
+
// export the held copy lacks (below). Only a test, or a file the site
|
|
1486
|
+
// itself edited, is held with what it imports.
|
|
1487
|
+
const heldImportsByFile = new Map();
|
|
1307
1488
|
const heldPaths = new Set();
|
|
1308
1489
|
const moving = [...new Set([...updated, ...merged, ...added, ...removed, ...current])].sort();
|
|
1309
1490
|
const isFileCache = new Map();
|
|
@@ -1359,7 +1540,6 @@ export async function updateSite(opts) {
|
|
|
1359
1540
|
}
|
|
1360
1541
|
sourcesOf.set(path, { all, written });
|
|
1361
1542
|
}
|
|
1362
|
-
const SOURCE_FILE = /\.[cm]?[jt]sx?$/;
|
|
1363
1543
|
const hold = (path, file, missing) => {
|
|
1364
1544
|
const entry = heldBackByFile.get(file) ?? { tests: [], importers: [], missing };
|
|
1365
1545
|
const list = TEST_FILE.test(path) ? entry.tests : entry.importers;
|
|
@@ -1381,6 +1561,19 @@ export async function updateSite(opts) {
|
|
|
1381
1561
|
}
|
|
1382
1562
|
return textCache.get(path);
|
|
1383
1563
|
};
|
|
1564
|
+
const candidatesCache = new Map();
|
|
1565
|
+
/** Every path the local specifiers of `path`'s copy on disk can resolve to. */
|
|
1566
|
+
const importCandidatesOf = (path) => {
|
|
1567
|
+
let hit = candidatesCache.get(path);
|
|
1568
|
+
if (hit === undefined) {
|
|
1569
|
+
const text = diskText(path);
|
|
1570
|
+
hit = new Set(text === undefined
|
|
1571
|
+
? []
|
|
1572
|
+
: localSpecifiers(path, text).flatMap((specifier) => relativeImportCandidates(path, specifier)));
|
|
1573
|
+
candidatesCache.set(path, hit);
|
|
1574
|
+
}
|
|
1575
|
+
return hit;
|
|
1576
|
+
};
|
|
1384
1577
|
// Every app source file this run does not write: the code that keeps the
|
|
1385
1578
|
// site's version and must still find what it imports.
|
|
1386
1579
|
const stayingFiles = [...listFilesUnder(targetDir, ["apps/web", "apps/api", "apps/mcp"])]
|
|
@@ -1394,16 +1587,41 @@ export async function updateSite(opts) {
|
|
|
1394
1587
|
};
|
|
1395
1588
|
while (grew) {
|
|
1396
1589
|
grew = false;
|
|
1590
|
+
// #11147 — a removal a still-present file imports — the site's own
|
|
1591
|
+
// code, a file left alone, or a file held with one — is held with that
|
|
1592
|
+
// importer, so the run never removes what the tree still imports. The
|
|
1593
|
+
// moves' removals (#9567, #9566) retire server copies and are not read.
|
|
1594
|
+
// A written importer held as `missing` on one pass can be what holds the
|
|
1595
|
+
// removal on the next; it then stays held — conservative, never wrong.
|
|
1596
|
+
for (const path of deletes) {
|
|
1597
|
+
if (heldPaths.has(path))
|
|
1598
|
+
continue;
|
|
1599
|
+
const importer = [...stayingFiles, ...heldPaths].find((file) => !rewrittenLater.has(file) && importCandidatesOf(file).has(path));
|
|
1600
|
+
if (importer === undefined)
|
|
1601
|
+
continue;
|
|
1602
|
+
holdPath(path);
|
|
1603
|
+
hold(path, importer, false);
|
|
1604
|
+
}
|
|
1397
1605
|
for (const path of moving) {
|
|
1398
1606
|
if (heldPaths.has(path))
|
|
1399
1607
|
continue;
|
|
1400
1608
|
const { all, written } = sourcesOf.get(path);
|
|
1401
|
-
const
|
|
1609
|
+
const cascades = TEST_FILE.test(path) || siteEdits.has(path);
|
|
1610
|
+
const importedHeld = new Set(all.flatMap((text) => importedHeldFiles(path, text, heldFiles)));
|
|
1611
|
+
if (!cascades) {
|
|
1612
|
+
for (const file of importedHeld) {
|
|
1613
|
+
const importers = heldImportsByFile.get(file) ?? [];
|
|
1614
|
+
if (!importers.includes(path))
|
|
1615
|
+
importers.push(path);
|
|
1616
|
+
heldImportsByFile.set(file, importers);
|
|
1617
|
+
}
|
|
1618
|
+
}
|
|
1619
|
+
const imported = cascades ? importedHeld : new Set();
|
|
1402
1620
|
const missing = new Set();
|
|
1403
1621
|
if (written !== undefined && !TEST_FILE.test(path)) {
|
|
1404
1622
|
for (const specifier of localSpecifiers(path, written)) {
|
|
1405
1623
|
const candidates = relativeImportCandidates(path, specifier);
|
|
1406
|
-
if (candidates.some((c) => heldFiles.has(c)
|
|
1624
|
+
if (candidates.some((c) => (heldFiles.has(c) ? isFileOnDisk(c) : presentAfter(c))))
|
|
1407
1625
|
continue;
|
|
1408
1626
|
// A dot-directory (`.source/`, `.next/`) is build output the site
|
|
1409
1627
|
// generates, never a file update could have carried.
|
|
@@ -1413,15 +1631,18 @@ export async function updateSite(opts) {
|
|
|
1413
1631
|
}
|
|
1414
1632
|
}
|
|
1415
1633
|
// A named import the file it resolves to — staying at the site's
|
|
1416
|
-
// version — does not export (a regenerated
|
|
1634
|
+
// version, or held back (#11147) — does not export (a regenerated
|
|
1635
|
+
// nav-config, say).
|
|
1417
1636
|
const lacking = new Set();
|
|
1418
1637
|
if (written !== undefined) {
|
|
1419
1638
|
for (const { specifier, names } of namedImportsOf(written)) {
|
|
1420
1639
|
if (!isLocal(path, specifier))
|
|
1421
1640
|
continue;
|
|
1422
1641
|
const target = relativeImportCandidates(path, specifier).find(isFileOnDisk);
|
|
1423
|
-
if (target === undefined ||
|
|
1642
|
+
if (target === undefined || rewrittenLater.has(target))
|
|
1424
1643
|
continue;
|
|
1644
|
+
if (heldFiles.has(target) && cascades)
|
|
1645
|
+
continue; // held with it above
|
|
1425
1646
|
if (writtenBytes.has(target) && !heldPaths.has(target))
|
|
1426
1647
|
continue;
|
|
1427
1648
|
if (deleting.has(target))
|
|
@@ -1489,8 +1710,20 @@ export async function updateSite(opts) {
|
|
|
1489
1710
|
file,
|
|
1490
1711
|
tests: tests.sort(),
|
|
1491
1712
|
...(importers.length > 0 ? { importers: importers.sort() } : {}),
|
|
1492
|
-
|
|
1713
|
+
// A removal held back (#11147) is in this site after all.
|
|
1714
|
+
...(missing && !heldPaths.has(file) ? { missing: true } : {}),
|
|
1493
1715
|
}));
|
|
1716
|
+
const leftAloneReason = new Map([...review, ...skipped].map((row) => [row.path, row.reason]));
|
|
1717
|
+
const heldImports = [...heldImportsByFile.entries()]
|
|
1718
|
+
.sort(([a], [b]) => a.localeCompare(b))
|
|
1719
|
+
.map(([file, importers]) => ({
|
|
1720
|
+
file,
|
|
1721
|
+
importers: importers.filter(notHeld).sort(),
|
|
1722
|
+
edit: siteEdits.has(file)
|
|
1723
|
+
? `the site edit is ${siteEdits.get(file)}`
|
|
1724
|
+
: (leftAloneReason.get(file) ?? "held back with another file"),
|
|
1725
|
+
}))
|
|
1726
|
+
.filter((entry) => entry.importers.length > 0);
|
|
1494
1727
|
// ── Apply: writes and removals, then the record (D4 Order) ───────────
|
|
1495
1728
|
// #9566 — the API move's removals first: a retired file at a boot-set
|
|
1496
1729
|
// path is overwritten by the write that follows, never deleted after it.
|
|
@@ -1662,6 +1895,11 @@ export async function updateSite(opts) {
|
|
|
1662
1895
|
review,
|
|
1663
1896
|
skipped,
|
|
1664
1897
|
heldBack,
|
|
1898
|
+
...(heldImports.length > 0 ? { heldImports } : {}),
|
|
1899
|
+
...(staleCopies.some((row) => notHeld(row.path))
|
|
1900
|
+
? { staleCopies: staleCopies.filter((row) => notHeld(row.path)) }
|
|
1901
|
+
: {}),
|
|
1902
|
+
...(commentOnlyEdits.some(notHeld) ? { commentOnlyEdits: commentOnlyEdits.filter(notHeld) } : {}),
|
|
1665
1903
|
headingsAdded: headings.written.map(sitePath),
|
|
1666
1904
|
bracesEscaped,
|
|
1667
1905
|
...(backfilled !== undefined ? { backfilled } : {}),
|
|
@@ -1720,11 +1958,17 @@ export function formatUpdateReport(result) {
|
|
|
1720
1958
|
["Page heading added", result.headingsAdded],
|
|
1721
1959
|
["Placeholder brace escaped", result.bracesEscaped],
|
|
1722
1960
|
];
|
|
1961
|
+
// #11147 — why a moved file's bytes were not the site's.
|
|
1962
|
+
const notes = new Map();
|
|
1963
|
+
for (const { path, version } of result.staleCopies ?? [])
|
|
1964
|
+
notes.set(path, `a stale copy of the ${version} template`);
|
|
1965
|
+
for (const path of result.commentOnlyEdits ?? [])
|
|
1966
|
+
notes.set(path, "comment-only edit");
|
|
1723
1967
|
for (const [label, paths] of sections) {
|
|
1724
1968
|
if (paths.length === 0)
|
|
1725
1969
|
continue;
|
|
1726
1970
|
lines.push(`${label} (${paths.length}):`);
|
|
1727
|
-
lines.push(...paths.map((path) => ` ${path}`));
|
|
1971
|
+
lines.push(...paths.map((path) => (notes.has(path) ? ` ${path} — ${notes.get(path)}` : ` ${path}`)));
|
|
1728
1972
|
}
|
|
1729
1973
|
if (result.review.length > 0) {
|
|
1730
1974
|
lines.push(`Needs review (${result.review.length}):`);
|
|
@@ -1735,6 +1979,11 @@ export function formatUpdateReport(result) {
|
|
|
1735
1979
|
lines.push(`Held back with ${file}${missing ? " (not in this site)" : ""} (${held.length}):`);
|
|
1736
1980
|
lines.push(...held.map((path) => ` ${path}`));
|
|
1737
1981
|
}
|
|
1982
|
+
for (const { file, importers, edit } of result.heldImports ?? []) {
|
|
1983
|
+
const count = `${importers.length} moved file${importers.length === 1 ? "" : "s"}`;
|
|
1984
|
+
lines.push(`Held back: ${file} — imported by ${count}; ${edit}`);
|
|
1985
|
+
lines.push(...importers.map((path) => ` ${path}`));
|
|
1986
|
+
}
|
|
1738
1987
|
if (result.envRowsAdded !== undefined) {
|
|
1739
1988
|
lines.push(`project.yaml env_contract rows added (${result.envRowsAdded.length}):`);
|
|
1740
1989
|
lines.push(...result.envRowsAdded.map((name) => ` ${name}`));
|
|
@@ -1801,14 +2050,23 @@ edited file whose template copy also changed is three-way merged with
|
|
|
1801
2050
|
\`git\` (git must be on PATH); a conflict leaves the file alone and is
|
|
1802
2051
|
listed under "Needs review"; an apps/web/messages catalog instead gains the
|
|
1803
2052
|
template's new keys and keeps every value it has, and is reviewed only when a
|
|
1804
|
-
key is an object on one side and a value on the other.
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
2053
|
+
key is an object on one side and a value on the other. An edited file whose
|
|
2054
|
+
bytes are another published create-ailk version's copy is a stale copy, not
|
|
2055
|
+
an edit: it is overwritten or removed as an untouched file is, listed with
|
|
2056
|
+
the version it matched. An edit that touches only comment lines is listed as
|
|
2057
|
+
"comment-only edit"; on a conflict the template's copy lands. Every template
|
|
2058
|
+
test, and every site-edited template file, that imports a file left under
|
|
2059
|
+
"Needs review" or "Skipped" (by a relative or @/ import, transitively) is held
|
|
2060
|
+
at the site's version with it, its record entry is not advanced, and it is
|
|
2061
|
+
listed under "Held back with <file>" — reconcile the file, then run update
|
|
2062
|
+
again to bring it forward. A file whose own bytes are the record's is not
|
|
2063
|
+
held by what it imports: it moves, unless it names an export the held copy
|
|
2064
|
+
lacks, and the held file is listed as "Held back: <file> — imported by N
|
|
2065
|
+
moved files; the site edit is <hunk summary>". A written file whose import
|
|
2066
|
+
names a file the site will not have is held the same way, under "Held back
|
|
2067
|
+
with <file> (not in this site)", and a file the template removed is kept
|
|
2068
|
+
while any file still in the site imports it. Every other file in the run
|
|
2069
|
+
still updates. When project.yaml has an env_contract block, each
|
|
1812
2070
|
env var the written files read that has no row gains one; no row is edited.
|
|
1813
2071
|
A record row at a path create-ailk no longer records is dropped and listed.
|
|
1814
2072
|
A surface the site's .ailk-site-manifest.json names a page on but
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-ailk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.37.0",
|
|
4
4
|
"description": "Scaffolder for AI Launch Kit — `pnpm create ailk@latest <dir>` produces a starter repo consuming @working-theory/* from npm (per ADR 0007).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"tar": "^7.5.21"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@working-theory/schema": "0.
|
|
32
|
-
"@working-theory/templates": "0.
|
|
31
|
+
"@working-theory/schema": "0.61.0",
|
|
32
|
+
"@working-theory/templates": "0.61.0"
|
|
33
33
|
},
|
|
34
34
|
"repository": {
|
|
35
35
|
"type": "git",
|
package/templates/.env.example
CHANGED
|
@@ -202,6 +202,27 @@ CONTENT_ADAPTER=mdx
|
|
|
202
202
|
# default.
|
|
203
203
|
# RESEND_AUDIENCE_ID=
|
|
204
204
|
#
|
|
205
|
+
# ── Text messages (Twilio, apps/api) ─────────────────────────────────────────
|
|
206
|
+
# Phone verification (#11106 D9): a signed-in person sets and verifies a phone
|
|
207
|
+
# on the hub's Account page. apps/web's phone plugin signs one body with
|
|
208
|
+
# AUTH_EMAIL_WEBHOOK_SECRET and POSTs it to apps/api's
|
|
209
|
+
# /v1/auth/transactional-sms, which texts one fixed message ("Your
|
|
210
|
+
# verification code is …") through Twilio's Messages API. With any of the
|
|
211
|
+
# three unset the relay answers 503 sms_not_configured and no text is sent.
|
|
212
|
+
# Budgets (fail closed): 3 per number per hour, 5 per user per day, 200 per
|
|
213
|
+
# deployment per hour.
|
|
214
|
+
# TWILIO_ACCOUNT_SID=
|
|
215
|
+
# TWILIO_AUTH_TOKEN=
|
|
216
|
+
# TWILIO_FROM_NUMBER=
|
|
217
|
+
#
|
|
218
|
+
# The calling codes a code may be texted to, comma-separated (default "1").
|
|
219
|
+
# Read by BOTH apps: apps/web refuses any other number before a code exists,
|
|
220
|
+
# and the apps/api relay re-checks it — set the same value on both.
|
|
221
|
+
# Calling code 1 covers the whole North American Numbering Plan, Caribbean
|
|
222
|
+
# premium-rate destinations included: turn on Twilio's Geo Permissions (US and
|
|
223
|
+
# Canada only) and its SMS pumping protection for the sending account.
|
|
224
|
+
# AILK_SMS_COUNTRY_CODES=1
|
|
225
|
+
#
|
|
205
226
|
# Request-and-confirm (#5970) — the callback request a site owner confirms by
|
|
206
227
|
# an emailed link, which mints a Stripe Payment Link for the customer to pay
|
|
207
228
|
# on. Off by default: with the flag unset the callback route behaves exactly as
|
|
@@ -461,6 +482,23 @@ CONTENT_ADAPTER=mdx
|
|
|
461
482
|
# No rekey walk: rotation and the leaked-key rule in apps/api/.env.example.
|
|
462
483
|
# SLACK_CONNECTION_KEY=
|
|
463
484
|
# SLACK_CONNECTION_KEY_PREVIOUS=
|
|
485
|
+
# The key every connection on the shared connection model is encrypted under
|
|
486
|
+
# (#11173, ADR 0039) — the Google connection today — and the key it replaced
|
|
487
|
+
# during a rotation: 32 random bytes each, `openssl rand -base64 32`, distinct
|
|
488
|
+
# from each other and from every other credential key above. Unset = a
|
|
489
|
+
# connection cannot be written and reads as not connected, but can be removed;
|
|
490
|
+
# any other shape stops the API. No rekey walk: rotation and the leaked-key
|
|
491
|
+
# rule in apps/api/.env.example.
|
|
492
|
+
# CONNECTION_KEY=
|
|
493
|
+
# CONNECTION_KEY_PREVIOUS=
|
|
494
|
+
# The Google OAuth client the Google connection uses (#11173): all three set,
|
|
495
|
+
# or none; one or two stops the API. The redirect URI is the Admin's
|
|
496
|
+
# /integrations/google/callback page, registered verbatim in the Google
|
|
497
|
+
# console (https on a deployment, http on localhost only; no query, fragment or
|
|
498
|
+
# userinfo). A different client from AILK_GOOGLE_ONE_TAP_CLIENT_ID.
|
|
499
|
+
# GOOGLE_CONNECTION_CLIENT_ID=
|
|
500
|
+
# GOOGLE_CONNECTION_CLIENT_SECRET=
|
|
501
|
+
# GOOGLE_CONNECTION_REDIRECT_URI=
|
|
464
502
|
# The Organization that owns STRIPE_SECRET_KEY (#9285): with the multi-tenant
|
|
465
503
|
# module selected in AILK_ENABLED_MODULES, only the Organization whose id is
|
|
466
504
|
# named here sells through it; unset means nobody. That holds whether or not
|
|
@@ -21,6 +21,13 @@ FRONTEND_URL=http://localhost:3000
|
|
|
21
21
|
# trust — list only origins the deployment owner operates.
|
|
22
22
|
# AILK_TRUSTED_ORIGINS=https://admin.your-domain.com,https://spoke.example
|
|
23
23
|
|
|
24
|
+
# Google One Tap on a hub's spokes (#11096 D10), off by default: the hub's own
|
|
25
|
+
# Google OAuth client id. Set, POST /v1/hub-sign-in/google verifies a spoke's
|
|
26
|
+
# One Tap ID token against Google's keys with this as its audience, and client
|
|
27
|
+
# info names it to the spoke. List each One Tap spoke's origin on that Google
|
|
28
|
+
# client's authorized JavaScript origins. Unset: the route answers 404.
|
|
29
|
+
# AILK_GOOGLE_ONE_TAP_CLIENT_ID=
|
|
30
|
+
|
|
24
31
|
# =============================================================================
|
|
25
32
|
# MCP OAuth issuer (#10912)
|
|
26
33
|
# =============================================================================
|
|
@@ -157,6 +164,44 @@ STRIPE_WEBHOOK_SECRET=whsec_xxx
|
|
|
157
164
|
# SLACK_CONNECTION_KEY=
|
|
158
165
|
# SLACK_CONNECTION_KEY_PREVIOUS=
|
|
159
166
|
#
|
|
167
|
+
# The shared connection model's key (#11173, ADR 0039): every integration on
|
|
168
|
+
# the model — the Google connection today — stores ONE credential payload
|
|
169
|
+
# encrypted under CONNECTION_KEY, bound to its provider, scope and
|
|
170
|
+
# Organization, and the OAuth state tokens the browser carries are sealed
|
|
171
|
+
# under the same key. The same shape rule as the keys above: exactly 32
|
|
172
|
+
# random bytes in canonical standard base64 (`openssl rand -base64 32`), and
|
|
173
|
+
# never the same bytes as SCHEDULING_CREDENTIAL_KEY, STRIPE_CONNECTION_KEY,
|
|
174
|
+
# STRIPE_CONNECTION_KEY_PREVIOUS, SLACK_CONNECTION_KEY or
|
|
175
|
+
# SLACK_CONNECTION_KEY_PREVIOUS. Any other value stops the API at startup.
|
|
176
|
+
# Unset means every connect answers 503 credential_key_not_configured, every
|
|
177
|
+
# model-backed connection reads as not connected, and disconnect still works.
|
|
178
|
+
# ONE KEY PER DATABASE: a database holding live connections gets its key on
|
|
179
|
+
# production only — never on a preview sharing that database.
|
|
180
|
+
#
|
|
181
|
+
# ROTATION. Set CONNECTION_KEY_PREVIOUS to the old key and CONNECTION_KEY to a
|
|
182
|
+
# new one, and redeploy. Every connect and every token refresh writes under
|
|
183
|
+
# the new key; a row written under the old one reads as connected while
|
|
184
|
+
# _PREVIOUS is set, and as unavailable once it is unset, until its owner
|
|
185
|
+
# reconnects. There is no rekey walk. A rotation made because the old key
|
|
186
|
+
# LEAKED is not complete until each connected owner reconnects (a Google grant
|
|
187
|
+
# is re-consented, which issues new tokens): the old key still opens every
|
|
188
|
+
# row written under it. _PREVIOUS without a current key, or equal to it,
|
|
189
|
+
# stops the API.
|
|
190
|
+
# CONNECTION_KEY=
|
|
191
|
+
# CONNECTION_KEY_PREVIOUS=
|
|
192
|
+
#
|
|
193
|
+
# The Google OAuth client the Google connection uses (#11173 D6): the web
|
|
194
|
+
# application client's id and secret from the Google Cloud console, and the
|
|
195
|
+
# redirect URI registered on it — the Admin's /integrations/google/callback
|
|
196
|
+
# page, byte for byte. All three set, or none; one or two stops the API at
|
|
197
|
+
# startup naming the missing variable. The redirect URI must be an absolute
|
|
198
|
+
# https URL (http on localhost only) with no query, fragment or userinfo. This
|
|
199
|
+
# is a different client from AILK_GOOGLE_ONE_TAP_CLIENT_ID (the hub's
|
|
200
|
+
# sign-in), which stays where it is.
|
|
201
|
+
# GOOGLE_CONNECTION_CLIENT_ID=
|
|
202
|
+
# GOOGLE_CONNECTION_CLIENT_SECRET=
|
|
203
|
+
# GOOGLE_CONNECTION_REDIRECT_URI=
|
|
204
|
+
#
|
|
160
205
|
# The Organization that owns STRIPE_SECRET_KEY (#9285). On a deployment whose
|
|
161
206
|
# AILK_ENABLED_MODULES selects the multi-tenant module, only the Organization
|
|
162
207
|
# whose id is named here sees that key as its Stripe connection and sells its
|