create-ailk 0.19.1 → 0.21.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 +84 -7
- package/component-catalog.json +184 -6
- package/component-catalog.md +20 -9
- package/dist/apply-design.d.ts +9 -0
- package/dist/apply-design.js +78 -31
- package/dist/cli.js +35 -0
- package/dist/copy.d.ts +41 -0
- package/dist/copy.js +87 -21
- package/dist/design-home.d.ts +54 -11
- package/dist/design-home.js +160 -22
- package/dist/lib/design-checks.d.ts +6 -1
- package/dist/lib/design-checks.js +23 -2
- package/dist/lib/fetch-template-snapshot.d.ts +21 -0
- package/dist/lib/fetch-template-snapshot.js +205 -0
- package/dist/lib/merge-three-way.d.ts +31 -0
- package/dist/lib/merge-three-way.js +65 -0
- package/dist/module-architecture.js +55 -2
- package/dist/programmatic.d.ts +7 -1
- package/dist/programmatic.js +76 -22
- package/dist/site-roster.d.ts +4 -2
- package/dist/site-roster.js +7 -5
- package/dist/spoke-checkout.d.ts +7 -0
- package/dist/spoke-checkout.js +8 -1
- package/dist/starter-grid.js +16 -0
- package/dist/surfaces.js +78 -2
- package/dist/sync-routes.d.ts +28 -0
- package/dist/sync-routes.js +123 -1
- package/dist/template-record.d.ts +59 -0
- package/dist/template-record.js +183 -0
- package/dist/update.d.ts +53 -0
- package/dist/update.js +606 -0
- package/package.json +3 -3
- package/site-templates/_base/ailk-template.json +2 -2
- package/site-templates/_base/content/en/WorkingAgreementPage/working-agreement.mdx +78 -0
- package/site-templates/designs/minimalism/DESIGN.md +1 -1
- package/site-templates/designs/minimalism/contact/local-business-service.mdx +23 -0
- package/site-templates/designs/minimalism/contact/organization-product.mdx +23 -0
- package/site-templates/designs/minimalism/contact/organization-service.mdx +23 -0
- package/site-templates/designs/minimalism/contact/person-service.mdx +23 -0
- package/site-templates/marketing-site/TEMPLATE-MANIFEST.json +18 -1
- package/site-templates/marketing-site/TEMPLATE-MANIFEST.md +11 -0
- package/site-templates/marketing-site-free/TEMPLATE-MANIFEST.json +18 -1
- package/site-templates/marketing-site-free/TEMPLATE-MANIFEST.md +34 -23
- package/site-templates/shapes/local-business-service/TEMPLATE-MANIFEST.json +18 -1
- package/site-templates/shapes/local-business-service/TEMPLATE-MANIFEST.md +33 -23
- package/site-templates/shapes/organization-service/TEMPLATE-MANIFEST.json +18 -1
- package/site-templates/shapes/organization-service/TEMPLATE-MANIFEST.md +33 -23
- package/site-templates/shapes/person-service/TEMPLATE-MANIFEST.json +18 -1
- package/site-templates/shapes/person-service/TEMPLATE-MANIFEST.md +31 -21
- package/templates/.claude/cloudparity-repo-hooks.json +9 -0
- package/templates/.claude/hooks/architecture-check.sh +8 -0
- package/templates/.claude/rules/loop-contract.md +129 -0
- package/templates/.claude/settings.json +3 -2
- package/templates/.env.example +13 -0
- package/templates/CLAUDE.md +1 -1
- package/templates/CONVENTIONS.md +3 -2
- package/templates/README.md +26 -25
- package/templates/_gitignore +162 -0
- package/templates/apps/api/CLAUDE.md +18 -10
- package/templates/apps/api/jest.config.cjs +1 -0
- package/templates/apps/api/package.json +2 -1
- package/templates/apps/api/src/__tests__/factories/in-memory-prisma.ts +22 -2
- package/templates/apps/api/src/__tests__/setup.ts +7 -0
- package/templates/apps/api/src/bin/__tests__/rate-limit-probe.test.ts +184 -0
- package/templates/apps/api/src/bin/rate-limit-probe.ts +53 -0
- package/templates/apps/api/src/lib/proposal-paid-store.ts +49 -0
- package/templates/apps/api/src/lib/rate-limit-probe.ts +165 -0
- package/templates/apps/api/src/lib/rate-limit-store.ts +142 -0
- package/templates/apps/api/src/middleware/__tests__/auth.hub-session-path.test.ts +5 -2
- package/templates/apps/api/src/middleware/__tests__/default-tenant.test.ts +2 -0
- package/templates/apps/api/src/middleware/__tests__/rate-limit-cross-isolate.db.test.ts +220 -0
- package/templates/apps/api/src/middleware/__tests__/rate-limit-store.test.ts +430 -0
- package/templates/apps/api/src/middleware/__tests__/rate-limit.test.ts +21 -14
- package/templates/apps/api/src/middleware/auth.ts +8 -4
- package/templates/apps/api/src/middleware/default-tenant.ts +9 -0
- package/templates/apps/api/src/middleware/rate-limit.ts +290 -82
- package/templates/apps/api/src/routes/project-listings/__tests__/drafts.test.ts +26 -0
- package/templates/apps/api/src/routes/webhooks/README.md +33 -5
- package/templates/apps/api/src/routes/webhooks/__tests__/stripe-proposal-paid.test.ts +369 -0
- package/templates/apps/api/src/routes/webhooks/__tests__/stripe-site-filter.test.ts +442 -0
- package/templates/apps/api/src/routes/webhooks/stripe.ts +184 -6
- package/templates/apps/api/src/server.ts +14 -2
- package/templates/apps/api/src/services/__tests__/audit-log.test.ts +91 -0
- package/templates/apps/api/src/services/audit-log.ts +72 -10
- package/templates/apps/api/src/services/default-tenant.ts +12 -3
- package/templates/apps/api/src/services/hub-sign-in.ts +2 -1
- package/templates/apps/api/src/services/project-listings.ts +6 -1
- package/templates/apps/api/src/services/public-site-resolver.ts +21 -2
- package/templates/apps/api/vercel.json +1 -1
- package/templates/apps/mcp/CLAUDE.md +19 -7
- package/templates/apps/mcp/__tests__/catalog-drift.test.ts +139 -44
- package/templates/apps/mcp/jest.config.cjs +1 -0
- package/templates/apps/mcp/src/tools/person_notes.ts +25 -0
- package/templates/apps/mcp/src/tools/proposals.ts +27 -0
- package/templates/apps/mcp/src/workspace-server.ts +16 -0
- package/templates/apps/web/CLAUDE.md +26 -1
- package/templates/apps/web/_gitignore +6 -0
- package/templates/apps/web/app/[locale]/(auth)/sign-up/__tests__/sign-up-card.test.tsx +165 -0
- package/templates/apps/web/app/[locale]/(auth)/sign-up/page.tsx +19 -0
- package/templates/apps/web/app/[locale]/(auth)/sign-up/sign-up-card.tsx +106 -23
- package/templates/apps/web/app/[locale]/(auth)/sign-up/sign-up.actions.ts +125 -0
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/agreements-prompt.test.tsx +281 -0
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/general.test.tsx +28 -83
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/hub-mode.test.tsx +27 -13
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/item.test.tsx +57 -2
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/layout.test.tsx +2 -0
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/notifications.test.tsx +102 -18
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/onboarding.test.tsx +323 -0
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/privacy.test.tsx +365 -0
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/settings.test.tsx +3 -2
- package/templates/apps/web/app/[locale]/(authed)/account/actions.ts +8 -0
- package/templates/apps/web/app/[locale]/(authed)/account/agreements-actions.ts +170 -0
- package/templates/apps/web/app/[locale]/(authed)/account/agreements-prompt.tsx +181 -0
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/page.tsx +88 -3
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/pay-form.tsx +65 -0
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/review-form.tsx +27 -0
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/page.test.tsx +176 -3
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/pay.test.tsx +193 -0
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/review.test.tsx +188 -0
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/artifact-actions.ts +65 -4
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/artifact-data.ts +17 -0
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/page.tsx +11 -2
- package/templates/apps/web/app/[locale]/(authed)/account/general/page.tsx +5 -24
- package/templates/apps/web/app/[locale]/(authed)/account/notifications/page.tsx +64 -18
- package/templates/apps/web/app/[locale]/(authed)/account/onboarding/actions.ts +120 -0
- package/templates/apps/web/app/[locale]/(authed)/account/onboarding/onboarding-form.tsx +322 -0
- package/templates/apps/web/app/[locale]/(authed)/account/onboarding/page.tsx +126 -0
- package/templates/apps/web/app/[locale]/(authed)/account/page.tsx +43 -1
- package/templates/apps/web/app/[locale]/(authed)/account/privacy/actions.ts +65 -0
- package/templates/apps/web/app/[locale]/(authed)/account/privacy/page.tsx +226 -0
- package/templates/apps/web/app/[locale]/(authed)/account/settings-frame.tsx +5 -3
- package/templates/apps/web/app/[locale]/about/[slug]/page.tsx +46 -0
- package/templates/apps/web/app/[locale]/about/__tests__/about-routes.test.tsx +350 -0
- package/templates/apps/web/app/[locale]/about/page.tsx +83 -1
- package/templates/apps/web/app/[locale]/careers/__tests__/page-renderer-migration.test.tsx +2 -2
- package/templates/apps/web/app/[locale]/case-studies/__tests__/page-renderer-migration.test.tsx +2 -2
- package/templates/apps/web/app/[locale]/consent-banner.tsx +32 -0
- package/templates/apps/web/app/[locale]/consent.actions.ts +71 -0
- package/templates/apps/web/app/[locale]/contact/ConversationalIntakeWrapper.tsx +7 -0
- package/templates/apps/web/app/[locale]/contact/__tests__/contact-form-magnet.test.ts +138 -0
- package/templates/apps/web/app/[locale]/contact/__tests__/contact-form-text.test.ts +17 -0
- package/templates/apps/web/app/[locale]/contact/__tests__/contact-magnet-page.test.tsx +347 -0
- package/templates/apps/web/app/[locale]/contact/__tests__/contact.actions.test.ts +73 -0
- package/templates/apps/web/app/[locale]/contact/__tests__/page-renderer-migration.test.tsx +5 -3
- package/templates/apps/web/app/[locale]/contact/contact-form-magnet.ts +77 -0
- package/templates/apps/web/app/[locale]/contact/contact-form-text.ts +2 -0
- package/templates/apps/web/app/[locale]/contact/contact.actions.ts +48 -4
- package/templates/apps/web/app/[locale]/contact/page.tsx +81 -9
- package/templates/apps/web/app/[locale]/courses/__tests__/page-renderer-migration.test.tsx +2 -2
- package/templates/apps/web/app/[locale]/flows/[slug]/flow.actions.ts +25 -3
- package/templates/apps/web/app/[locale]/how-to/__tests__/page-renderer-migration.test.tsx +1 -1
- package/templates/apps/web/app/[locale]/integrations/__tests__/page-renderer-migration.test.tsx +2 -2
- package/templates/apps/web/app/[locale]/layout.tsx +46 -4
- package/templates/apps/web/app/[locale]/newsletter/newsletter.actions.ts +12 -1
- package/templates/apps/web/app/[locale]/partners/__tests__/page-renderer-migration.test.tsx +2 -2
- package/templates/apps/web/app/[locale]/products/__tests__/page-renderer-migration.test.tsx +2 -2
- package/templates/apps/web/app/[locale]/services/__tests__/page-renderer-migration.test.tsx +2 -2
- package/templates/apps/web/app/[locale]/software/__tests__/page-renderer-migration.test.tsx +1 -1
- package/templates/apps/web/app/[locale]/tech-articles/__tests__/page-renderer-migration.test.tsx +1 -1
- package/templates/apps/web/app/[locale]/unsubscribe/__tests__/unsubscribe-rsc-boundary.test.tsx +209 -0
- package/templates/apps/web/app/[locale]/unsubscribe/__tests__/unsubscribe.test.tsx +158 -0
- package/templates/apps/web/app/[locale]/unsubscribe/page.tsx +54 -0
- package/templates/apps/web/app/[locale]/unsubscribe/unsubscribe-button.tsx +73 -0
- package/templates/apps/web/app/[locale]/unsubscribe/unsubscribe.actions.ts +55 -0
- package/templates/apps/web/app/[locale]/whitepapers/__tests__/page-renderer-migration.test.tsx +1 -1
- package/templates/apps/web/app/[locale]/working-agreement/__tests__/page.test.tsx +63 -0
- package/templates/apps/web/app/[locale]/working-agreement/page.tsx +41 -0
- package/templates/apps/web/app/robots.txt/route.ts +13 -10
- package/templates/apps/web/jest.config.cjs +4 -0
- package/templates/apps/web/lib/__tests__/consent-visitor.test.ts +163 -0
- package/templates/apps/web/lib/__tests__/deck-page.test.ts +244 -0
- package/templates/apps/web/lib/__tests__/relay.test.ts +49 -0
- package/templates/apps/web/lib/__tests__/structured-data.test.tsx +100 -9
- package/templates/apps/web/lib/account-config.ts +31 -16
- package/templates/apps/web/lib/consent-visitor.ts +103 -0
- package/templates/apps/web/lib/deck-page.ts +186 -0
- package/templates/apps/web/lib/relay.ts +20 -0
- package/templates/apps/web/messages/en.json +83 -9
- package/templates/apps/web/next.config.mjs +8 -2
- package/templates/database/CHANGELOG.md +48 -0
- package/templates/database/__tests__/outbound-message-action.db.test.ts +80 -0
- package/templates/database/__tests__/person-notes.db.test.ts +249 -0
- package/templates/database/__tests__/piece-kind-migration.test.ts +67 -0
- package/templates/database/__tests__/piece-kind.db.test.ts +208 -0
- package/templates/database/__tests__/seed.test.ts +39 -2
- package/templates/database/_gitignore +8 -0
- package/templates/database/inbox/schema.prisma +38 -12
- package/templates/database/jest.config.cjs +1 -0
- package/templates/database/migrations/20261015120000_person_notes/migration.sql +77 -0
- package/templates/database/migrations/20261015120000_rate_limit_counters/migration.sql +43 -0
- package/templates/database/migrations/20261016120000_piece_kind/migration.sql +95 -0
- package/templates/database/migrations/20261017120000_outbound_message_action/migration.sql +30 -0
- package/templates/database/ops/schema.prisma +16 -0
- package/templates/database/package.json +1 -1
- package/templates/database/seed.ts +29 -0
- package/templates/project.yaml +6 -3
- package/templates/tools/jest/pin-timezone.cjs +34 -0
- package/versions.json +35 -35
- package/templates/.claude/rules/preserve-existing-style.md +0 -51
|
@@ -155,6 +155,14 @@ model Person {
|
|
|
155
155
|
// NULL and `userId` is NULL, a capture may fill a blank field (D4).
|
|
156
156
|
contactConfirmedAt DateTime? @map("contact_confirmed_at")
|
|
157
157
|
contactConfirmedBy String? @map("contact_confirmed_by") @db.VarChar(16)
|
|
158
|
+
// #8514 D1 — the team's private note on this client: one per Person, never
|
|
159
|
+
// served to the client. Who last saved it (a user id of the auth namespace,
|
|
160
|
+
// no foreign key — ADR 0009) and when; both NULL until the first save.
|
|
161
|
+
// When an agent saved it, which agent (its person is notesUpdatedBy).
|
|
162
|
+
notes String? @db.VarChar(5000)
|
|
163
|
+
notesUpdatedAt DateTime? @map("notes_updated_at")
|
|
164
|
+
notesUpdatedBy String? @map("notes_updated_by")
|
|
165
|
+
notesUpdatedByAgent String? @map("notes_updated_by_agent")
|
|
158
166
|
createdAt DateTime @default(now()) @map("created_at")
|
|
159
167
|
updatedAt DateTime @updatedAt @map("updated_at")
|
|
160
168
|
|
|
@@ -174,7 +182,7 @@ model Person {
|
|
|
174
182
|
@@map("people")
|
|
175
183
|
}
|
|
176
184
|
|
|
177
|
-
/// Piece — one deliverable for one client (#7877). Written only through
|
|
185
|
+
/// Piece — one deliverable or proposal for one client (#7877, #8516). Written only through
|
|
178
186
|
/// tenantDb(tenant).memberArea; read by a client only through
|
|
179
187
|
/// lib/member-store.ts. `stage` is one of the workspace's declared stages
|
|
180
188
|
/// (WorkspacePieceStages), checked at write time, never an enum.
|
|
@@ -184,16 +192,32 @@ model Person {
|
|
|
184
192
|
/// review lands. Approval is a piece-level fact; the version's own `review`
|
|
185
193
|
/// records which version was approved.
|
|
186
194
|
model Piece {
|
|
187
|
-
id
|
|
188
|
-
workspaceId
|
|
189
|
-
personId
|
|
190
|
-
title
|
|
191
|
-
stage
|
|
192
|
-
needsClient
|
|
193
|
-
updatedBy
|
|
194
|
-
approvedAt
|
|
195
|
-
|
|
196
|
-
|
|
195
|
+
id String @id @default(dbgenerated("('piece_'::text || (uuidv7())::text)")) @db.Text
|
|
196
|
+
workspaceId String @map("workspace_id")
|
|
197
|
+
personId String @map("person_id")
|
|
198
|
+
title String @db.VarChar(200)
|
|
199
|
+
stage String @db.VarChar(40)
|
|
200
|
+
needsClient Boolean @default(false) @map("needs_client")
|
|
201
|
+
updatedBy String @map("updated_by")
|
|
202
|
+
approvedAt DateTime? @map("approved_at")
|
|
203
|
+
// #8516 D1 — what the piece is: a `deliverable` (every row before #8516) or a
|
|
204
|
+
// `proposal` the client approves or sends back. Never changes after create.
|
|
205
|
+
kind String @default("deliverable") @db.VarChar(16)
|
|
206
|
+
// A proposal's price, in minor units of a two-decimal currency; both or
|
|
207
|
+
// neither, and only on a proposal.
|
|
208
|
+
priceAmount Int? @map("price_amount")
|
|
209
|
+
priceCurrency String? @map("price_currency") @db.Char(3)
|
|
210
|
+
// The client's current Stripe Checkout Session (#8516 D11) — its id, URL and
|
|
211
|
+
// expiry. Never served to the operator. Replaced once five minutes or less
|
|
212
|
+
// remain; the replaced session is expired at Stripe.
|
|
213
|
+
checkoutSessionId String? @unique @map("checkout_session_id")
|
|
214
|
+
checkoutUrl String? @map("checkout_url") @db.VarChar(2048)
|
|
215
|
+
checkoutExpiresAt DateTime? @map("checkout_expires_at")
|
|
216
|
+
// When Stripe reported the proposal paid, and the session that paid it (D13).
|
|
217
|
+
paidAt DateTime? @map("paid_at")
|
|
218
|
+
paidSessionId String? @map("paid_session_id")
|
|
219
|
+
createdAt DateTime @default(now()) @map("created_at")
|
|
220
|
+
updatedAt DateTime @updatedAt @map("updated_at")
|
|
197
221
|
|
|
198
222
|
person Person @relation(fields: [personId, workspaceId], references: [id, workspaceId], onDelete: Restrict, map: "pieces_person_fk")
|
|
199
223
|
versions PieceVersion[]
|
|
@@ -249,7 +273,9 @@ model PieceVersion {
|
|
|
249
273
|
///
|
|
250
274
|
/// #8168 D3/D4 — `direction` is `outbound` (an operator's message, #7877) or
|
|
251
275
|
/// `inbound` (a client's own write); `kind` is `message`, `quote` or
|
|
252
|
-
/// `review`. An outbound row is always a `message`
|
|
276
|
+
/// `review`. An outbound row is always a `message` whose `payload` is null
|
|
277
|
+
/// or, since #8515 D6, exactly `{ "action": "onboarding" }` — the one outbound
|
|
278
|
+
/// action, rendered by the client's site as a link to `/account/onboarding`
|
|
253
279
|
/// (`interactions_outbound_shape`); a `quote` or `review` row carries the
|
|
254
280
|
/// stored payload `packages/validation`'s member.ts types. Every existing
|
|
255
281
|
/// reader filters to `direction: "outbound"`, so an inbound row is invisible
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
-- #8514 — the client record's private notes (spec
|
|
2
|
+
-- docs/specs/8514-redesign-the-person-record-page-spec.md D1, D2).
|
|
3
|
+
--
|
|
4
|
+
-- people (4 columns) — the team's one note on a client (never served to the
|
|
5
|
+
-- client), who last saved it (a user id of the auth
|
|
6
|
+
-- namespace, no foreign key — ADR 0009, the
|
|
7
|
+
-- piece_versions.delivered_by precedent), when, and which
|
|
8
|
+
-- agent when an agent saved it. Every column is nullable
|
|
9
|
+
-- and has no default, so Postgres changes only the catalog.
|
|
10
|
+
--
|
|
11
|
+
-- DDL first, then one data statement (D2b, below the marker): the DDL adds
|
|
12
|
+
-- columns and CHECKs only; the data half removes inert client grants from
|
|
13
|
+
-- agents of members. One directory, per the one-migration-per-milestone
|
|
14
|
+
-- check (the #8435 person_contact shape). Prisma runs this file as one
|
|
15
|
+
-- transaction; each CHECK below is added NOT VALID and then VALIDATEd over an
|
|
16
|
+
-- all-NULL column, and the data half touches "agents" alone.
|
|
17
|
+
--
|
|
18
|
+
-- Rollout: deploy this migration BEFORE the API code that reads and writes the
|
|
19
|
+
-- notes and gives members the client rows; code without the columns fails
|
|
20
|
+
-- every notes read, and code before the grant reset would switch the inert
|
|
21
|
+
-- grants on (SEC-8514-B).
|
|
22
|
+
--
|
|
23
|
+
-- Rollback: ALTER TABLE "people" DROP COLUMN "notes", DROP COLUMN
|
|
24
|
+
-- "notes_updated_at", DROP COLUMN "notes_updated_by", DROP COLUMN
|
|
25
|
+
-- "notes_updated_by_agent"; (the CHECKs go with them). The grant reset needs
|
|
26
|
+
-- none: every grant it removes was inert.
|
|
27
|
+
|
|
28
|
+
-- AlterTable
|
|
29
|
+
ALTER TABLE "people" ADD COLUMN "notes" VARCHAR(5000),
|
|
30
|
+
ADD COLUMN "notes_updated_at" TIMESTAMP(3),
|
|
31
|
+
ADD COLUMN "notes_updated_by" TEXT,
|
|
32
|
+
ADD COLUMN "notes_updated_by_agent" TEXT;
|
|
33
|
+
|
|
34
|
+
-- The editor is a user id of the auth namespace (the delivered_by shape).
|
|
35
|
+
ALTER TABLE "people" ADD CONSTRAINT "people_notes_updated_by_format"
|
|
36
|
+
CHECK ("notes_updated_by" IS NULL OR "notes_updated_by" ~ '^user_[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$') NOT VALID;
|
|
37
|
+
ALTER TABLE "people" VALIDATE CONSTRAINT "people_notes_updated_by_format";
|
|
38
|
+
|
|
39
|
+
-- The agent, when one saved it, is an agent id (the agents_id_format shape).
|
|
40
|
+
ALTER TABLE "people" ADD CONSTRAINT "people_notes_updated_by_agent_format"
|
|
41
|
+
CHECK ("notes_updated_by_agent" IS NULL OR "notes_updated_by_agent" ~ '^agent_[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$') NOT VALID;
|
|
42
|
+
ALTER TABLE "people" VALIDATE CONSTRAINT "people_notes_updated_by_agent_format";
|
|
43
|
+
|
|
44
|
+
-- Who and when are written together.
|
|
45
|
+
ALTER TABLE "people" ADD CONSTRAINT "people_notes_edit_pair"
|
|
46
|
+
CHECK (("notes_updated_at" IS NULL) = ("notes_updated_by" IS NULL)) NOT VALID;
|
|
47
|
+
ALTER TABLE "people" VALIDATE CONSTRAINT "people_notes_edit_pair";
|
|
48
|
+
|
|
49
|
+
-- An agent's save always names the agent's person.
|
|
50
|
+
ALTER TABLE "people" ADD CONSTRAINT "people_notes_agent_has_person"
|
|
51
|
+
CHECK ("notes_updated_by_agent" IS NULL OR "notes_updated_by" IS NOT NULL) NOT VALID;
|
|
52
|
+
ALTER TABLE "people" VALIDATE CONSTRAINT "people_notes_agent_has_person";
|
|
53
|
+
|
|
54
|
+
-- ===== #8514 D2b member agent grant reset (data only; runs after the DDL above) =====
|
|
55
|
+
-- #8514 — dormant client grants cleared from agents of members (spec
|
|
56
|
+
-- docs/specs/8514-redesign-the-person-record-page-spec.md D2b, SEC-8514-B).
|
|
57
|
+
--
|
|
58
|
+
-- Until #8514 a member held neither people-read nor member-pieces-manage, so
|
|
59
|
+
-- the agent clamp (`can(personTenant.role, p)`) dropped either grant stored on
|
|
60
|
+
-- a member's agent: it was inert. #8514 gives members both by role, and the
|
|
61
|
+
-- clamp would then switch those stored grants on with no admin action. This
|
|
62
|
+
-- removes them first, so a member's agent holds either only once an owner or
|
|
63
|
+
-- admin grants it after the deploy.
|
|
64
|
+
--
|
|
65
|
+
-- DATA ONLY. Changes no effective permission at the time it runs (every grant
|
|
66
|
+
-- it removes is inert). Idempotent: a second run matches no row.
|
|
67
|
+
--
|
|
68
|
+
-- Rollout: in the same deploy as, and BEFORE, the #8514 API code.
|
|
69
|
+
--
|
|
70
|
+
-- Rollback: none needed — every removed grant was inert.
|
|
71
|
+
|
|
72
|
+
UPDATE "agents" a
|
|
73
|
+
SET "grants" = array_remove(array_remove(a."grants", 'people-read'), 'member-pieces-manage')
|
|
74
|
+
FROM "memberships" m
|
|
75
|
+
WHERE m."id" = a."responsible_membership_id"
|
|
76
|
+
AND m."role" = 'member'
|
|
77
|
+
AND a."grants" && ARRAY['people-read', 'member-pieces-manage']::text[];
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
-- #5040 — the rate limiter's shared database store (spec
|
|
2
|
+
-- docs/specs/5040-the-api-s-rate-limiter-spec.md D2/D3). One row per bucket
|
|
3
|
+
-- key hash; the middleware's database store (`apps/api/src/lib/rate-limit-store.ts`)
|
|
4
|
+
-- is the only reader or writer. Belongs to the deployment, not a tenant: no
|
|
5
|
+
-- workspace_id, no tenancy fence. Rows are disposable — a lost counter only
|
|
6
|
+
-- resets a window.
|
|
7
|
+
--
|
|
8
|
+
-- Rollback (safe while no code selects the database store, i.e. deploy this
|
|
9
|
+
-- migration before the code that reads AILK_RATE_LIMIT_STORE=database or
|
|
10
|
+
-- defaults to it with DATABASE_URL set):
|
|
11
|
+
-- DROP TABLE "rate_limit_counters";
|
|
12
|
+
|
|
13
|
+
-- CreateTable
|
|
14
|
+
CREATE TABLE "rate_limit_counters" (
|
|
15
|
+
"id" TEXT NOT NULL DEFAULT ('rlc_'::text || (uuidv7())::text),
|
|
16
|
+
"key_hash" TEXT NOT NULL,
|
|
17
|
+
"window_start_ms" BIGINT NOT NULL,
|
|
18
|
+
"window_ms" INTEGER NOT NULL,
|
|
19
|
+
"count" INTEGER NOT NULL,
|
|
20
|
+
"created_at" TIMESTAMPTZ NOT NULL DEFAULT now(),
|
|
21
|
+
|
|
22
|
+
CONSTRAINT "rate_limit_counters_pkey" PRIMARY KEY ("id")
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
-- CreateIndex
|
|
26
|
+
CREATE UNIQUE INDEX "rate_limit_counters_key_hash_key" ON "rate_limit_counters"("key_hash");
|
|
27
|
+
|
|
28
|
+
-- CreateIndex
|
|
29
|
+
-- The sweep: DELETE WHERE window_start_ms + window_ms <= now.
|
|
30
|
+
CREATE INDEX "rate_limit_counters_window_start_ms_idx" ON "rate_limit_counters"("window_start_ms");
|
|
31
|
+
|
|
32
|
+
-- ADR-0031 rule 3 — rate_limit_counters: rlc_ (registered in
|
|
33
|
+
-- packages/ids/src/registry.ts; this migration's path is added to
|
|
34
|
+
-- migration-sync.test.ts's PK_CHECK_MIGRATIONS).
|
|
35
|
+
ALTER TABLE "rate_limit_counters" ALTER COLUMN "id" SET DEFAULT ('rlc_'::text || (uuidv7())::text);
|
|
36
|
+
ALTER TABLE "rate_limit_counters" ADD CONSTRAINT "rate_limit_counters_id_format" CHECK ("id" ~ '^rlc_[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$');
|
|
37
|
+
|
|
38
|
+
-- D2 — key_hash is always a sha256 hex digest, never the raw bucket key.
|
|
39
|
+
ALTER TABLE "rate_limit_counters" ADD CONSTRAINT "rate_limit_counters_key_hash_hex" CHECK ("key_hash" ~ '^[0-9a-f]{64}$');
|
|
40
|
+
|
|
41
|
+
-- D2 — window_ms > 0, count >= 1.
|
|
42
|
+
ALTER TABLE "rate_limit_counters" ADD CONSTRAINT "rate_limit_counters_window_ms_positive" CHECK ("window_ms" > 0);
|
|
43
|
+
ALTER TABLE "rate_limit_counters" ADD CONSTRAINT "rate_limit_counters_count_positive" CHECK ("count" >= 1);
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
-- #8516 — proposals as an artifact kind (spec
|
|
2
|
+
-- docs/specs/8516-proposals-as-an-artifact-kind-spec.md D1, D2).
|
|
3
|
+
--
|
|
4
|
+
-- pieces (8 columns) — what a piece is (`kind`: `deliverable` or
|
|
5
|
+
-- `proposal`), a proposal's optional price (minor units
|
|
6
|
+
-- of a two-decimal currency), the client's current Stripe
|
|
7
|
+
-- Checkout Session (id, URL, expiry) and when Stripe
|
|
8
|
+
-- reported the proposal paid, with the session that paid
|
|
9
|
+
-- it. Stripe objects are named by plain columns with a
|
|
10
|
+
-- format CHECK and no foreign key (ADR 0009).
|
|
11
|
+
--
|
|
12
|
+
-- DDL only. Every existing row reads `kind = 'deliverable'` from the constant
|
|
13
|
+
-- default — Postgres stores the default in the catalog and rewrites no row, so
|
|
14
|
+
-- `updated_at` and every other column of an existing piece are unchanged. The
|
|
15
|
+
-- seven other columns are nullable with no default. Each CHECK below is added
|
|
16
|
+
-- NOT VALID and then VALIDATEd; every existing row passes each one (a
|
|
17
|
+
-- deliverable with every new column NULL).
|
|
18
|
+
--
|
|
19
|
+
-- Rollout: deploy this migration BEFORE the API code that reads and writes the
|
|
20
|
+
-- columns; code without them fails every piece read.
|
|
21
|
+
--
|
|
22
|
+
-- Rollback: DROP INDEX "pieces_checkout_session_id_key"; ALTER TABLE "pieces"
|
|
23
|
+
-- DROP COLUMN "kind", DROP COLUMN "price_amount", DROP COLUMN
|
|
24
|
+
-- "price_currency", DROP COLUMN "checkout_session_id", DROP COLUMN
|
|
25
|
+
-- "checkout_url", DROP COLUMN "checkout_expires_at", DROP COLUMN "paid_at",
|
|
26
|
+
-- DROP COLUMN "paid_session_id"; (the CHECKs go with them).
|
|
27
|
+
|
|
28
|
+
-- AlterTable
|
|
29
|
+
ALTER TABLE "pieces" ADD COLUMN "kind" VARCHAR(16) NOT NULL DEFAULT 'deliverable',
|
|
30
|
+
ADD COLUMN "price_amount" INTEGER,
|
|
31
|
+
ADD COLUMN "price_currency" CHAR(3),
|
|
32
|
+
ADD COLUMN "checkout_session_id" TEXT,
|
|
33
|
+
ADD COLUMN "checkout_url" VARCHAR(2048),
|
|
34
|
+
ADD COLUMN "checkout_expires_at" TIMESTAMP(3),
|
|
35
|
+
ADD COLUMN "paid_at" TIMESTAMP(3),
|
|
36
|
+
ADD COLUMN "paid_session_id" TEXT;
|
|
37
|
+
|
|
38
|
+
-- CreateIndex
|
|
39
|
+
CREATE UNIQUE INDEX "pieces_checkout_session_id_key" ON "pieces"("checkout_session_id");
|
|
40
|
+
|
|
41
|
+
-- A piece is a deliverable or a proposal, nothing else.
|
|
42
|
+
ALTER TABLE "pieces" ADD CONSTRAINT "pieces_kind_allowed"
|
|
43
|
+
CHECK ("kind" IN ('deliverable', 'proposal')) NOT VALID;
|
|
44
|
+
ALTER TABLE "pieces" VALIDATE CONSTRAINT "pieces_kind_allowed";
|
|
45
|
+
|
|
46
|
+
-- An amount and its currency are written together.
|
|
47
|
+
ALTER TABLE "pieces" ADD CONSTRAINT "pieces_price_pair"
|
|
48
|
+
CHECK (("price_amount" IS NULL) = ("price_currency" IS NULL)) NOT VALID;
|
|
49
|
+
ALTER TABLE "pieces" VALIDATE CONSTRAINT "pieces_price_pair";
|
|
50
|
+
|
|
51
|
+
-- 1 to 100,000,000 minor units (PROPOSAL_PRICE_MAX_MINOR).
|
|
52
|
+
ALTER TABLE "pieces" ADD CONSTRAINT "pieces_price_range"
|
|
53
|
+
CHECK ("price_amount" IS NULL OR "price_amount" BETWEEN 1 AND 100000000) NOT VALID;
|
|
54
|
+
ALTER TABLE "pieces" VALIDATE CONSTRAINT "pieces_price_range";
|
|
55
|
+
|
|
56
|
+
-- A lower-case ISO-4217 code.
|
|
57
|
+
ALTER TABLE "pieces" ADD CONSTRAINT "pieces_price_currency_format"
|
|
58
|
+
CHECK ("price_currency" IS NULL OR "price_currency" ~ '^[a-z]{3}$') NOT VALID;
|
|
59
|
+
ALTER TABLE "pieces" VALIDATE CONSTRAINT "pieces_price_currency_format";
|
|
60
|
+
|
|
61
|
+
-- Only a proposal carries a price.
|
|
62
|
+
ALTER TABLE "pieces" ADD CONSTRAINT "pieces_price_proposal_only"
|
|
63
|
+
CHECK ("price_amount" IS NULL OR "kind" = 'proposal') NOT VALID;
|
|
64
|
+
ALTER TABLE "pieces" VALIDATE CONSTRAINT "pieces_price_proposal_only";
|
|
65
|
+
|
|
66
|
+
-- A Checkout Session's id, URL and expiry are written together.
|
|
67
|
+
ALTER TABLE "pieces" ADD CONSTRAINT "pieces_checkout_triple"
|
|
68
|
+
CHECK (("checkout_session_id" IS NULL) = ("checkout_url" IS NULL)
|
|
69
|
+
AND ("checkout_session_id" IS NULL) = ("checkout_expires_at" IS NULL)) NOT VALID;
|
|
70
|
+
ALTER TABLE "pieces" VALIDATE CONSTRAINT "pieces_checkout_triple";
|
|
71
|
+
|
|
72
|
+
-- A Stripe Checkout Session id.
|
|
73
|
+
ALTER TABLE "pieces" ADD CONSTRAINT "pieces_checkout_session_format"
|
|
74
|
+
CHECK ("checkout_session_id" IS NULL OR "checkout_session_id" ~ '^cs_(test|live)_[A-Za-z0-9]{1,250}$') NOT VALID;
|
|
75
|
+
ALTER TABLE "pieces" VALIDATE CONSTRAINT "pieces_checkout_session_format";
|
|
76
|
+
|
|
77
|
+
-- A Checkout URL is https.
|
|
78
|
+
ALTER TABLE "pieces" ADD CONSTRAINT "pieces_checkout_url_https"
|
|
79
|
+
CHECK ("checkout_url" IS NULL OR "checkout_url" ~ '^https://') NOT VALID;
|
|
80
|
+
ALTER TABLE "pieces" VALIDATE CONSTRAINT "pieces_checkout_url_https";
|
|
81
|
+
|
|
82
|
+
-- A Checkout Session opens only for an approved, priced proposal.
|
|
83
|
+
ALTER TABLE "pieces" ADD CONSTRAINT "pieces_checkout_needs_approved_price"
|
|
84
|
+
CHECK ("checkout_session_id" IS NULL OR ("price_amount" IS NOT NULL AND "approved_at" IS NOT NULL)) NOT VALID;
|
|
85
|
+
ALTER TABLE "pieces" VALIDATE CONSTRAINT "pieces_checkout_needs_approved_price";
|
|
86
|
+
|
|
87
|
+
-- When paid and the session that paid are written together.
|
|
88
|
+
ALTER TABLE "pieces" ADD CONSTRAINT "pieces_paid_pair"
|
|
89
|
+
CHECK (("paid_at" IS NULL) = ("paid_session_id" IS NULL)) NOT VALID;
|
|
90
|
+
ALTER TABLE "pieces" VALIDATE CONSTRAINT "pieces_paid_pair";
|
|
91
|
+
|
|
92
|
+
-- Only a priced proposal is paid.
|
|
93
|
+
ALTER TABLE "pieces" ADD CONSTRAINT "pieces_paid_needs_price"
|
|
94
|
+
CHECK ("paid_at" IS NULL OR "price_amount" IS NOT NULL) NOT VALID;
|
|
95
|
+
ALTER TABLE "pieces" VALIDATE CONSTRAINT "pieces_paid_needs_price";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
-- #8515 — an outbound message may carry the onboarding action (spec
|
|
2
|
+
-- docs/specs/8515-standard-client-onboarding-diagnostic-and-spec.md D6).
|
|
3
|
+
--
|
|
4
|
+
-- `interactions_outbound_shape` (20261012120000_member_contract) admitted an
|
|
5
|
+
-- outbound row only as a payload-free `message`. Start onboarding writes an
|
|
6
|
+
-- outbound `message` whose `payload` is exactly `{"action": "onboarding"}`,
|
|
7
|
+
-- which the client's own site renders as a link to its `/account/onboarding`.
|
|
8
|
+
-- The CHECK is replaced in place, under the same name, admitting that one
|
|
9
|
+
-- payload and nothing else; no other constraint changes and no row is
|
|
10
|
+
-- rewritten. The new CHECK is added NOT VALID and then VALIDATEd (the #8516
|
|
11
|
+
-- piece_kind shape). The DROP takes ACCESS EXCLUSIVE and, in the migration's
|
|
12
|
+
-- one transaction, holds it through the VALIDATE scan, so the table is locked
|
|
13
|
+
-- for that scan; in exchange there is no moment without the constraint. Every
|
|
14
|
+
-- existing outbound row is payload-free and passes.
|
|
15
|
+
--
|
|
16
|
+
-- Folder name: the spec named 20261016120000; #8516's 20261016120000_piece_kind
|
|
17
|
+
-- landed first at that timestamp, so this sorts after it (spec §5.3).
|
|
18
|
+
--
|
|
19
|
+
-- Rollback — only AFTER the code is rolled back (running code would write
|
|
20
|
+
-- rows the old CHECK refuses):
|
|
21
|
+
-- UPDATE "interactions" SET "payload" = NULL WHERE "direction" = 'outbound';
|
|
22
|
+
-- ALTER TABLE "interactions" DROP CONSTRAINT "interactions_outbound_shape";
|
|
23
|
+
-- ALTER TABLE "interactions" ADD CONSTRAINT "interactions_outbound_shape"
|
|
24
|
+
-- CHECK ("direction" <> 'outbound' OR ("kind" = 'message' AND "payload" IS NULL));
|
|
25
|
+
-- Clients then lose the Open onboarding link on those messages; the body stays.
|
|
26
|
+
|
|
27
|
+
ALTER TABLE "interactions" DROP CONSTRAINT "interactions_outbound_shape";
|
|
28
|
+
ALTER TABLE "interactions" ADD CONSTRAINT "interactions_outbound_shape"
|
|
29
|
+
CHECK ("direction" <> 'outbound' OR ("kind" = 'message' AND ("payload" IS NULL OR "payload" = '{"action": "onboarding"}'::jsonb))) NOT VALID;
|
|
30
|
+
ALTER TABLE "interactions" VALIDATE CONSTRAINT "interactions_outbound_shape";
|
|
@@ -25,3 +25,19 @@ model AuditLog {
|
|
|
25
25
|
@@index([workspaceId, targetType, targetId])
|
|
26
26
|
@@map("audit_logs")
|
|
27
27
|
}
|
|
28
|
+
|
|
29
|
+
/// RateLimitCounter — the shared per-bucket counter for `rateLimitMiddleware`'s
|
|
30
|
+
/// database store (#5040 D2). Belongs to the deployment, not a tenant: no
|
|
31
|
+
/// workspaceId, no tenancy fence. Rows are disposable — a lost counter only
|
|
32
|
+
/// resets a window. `key_hash` is sha256(bucketKey) hex, never the raw key.
|
|
33
|
+
model RateLimitCounter {
|
|
34
|
+
id String @id @default(dbgenerated("('rlc_'::text || (uuidv7())::text)")) @db.Text
|
|
35
|
+
keyHash String @unique @map("key_hash") @db.Text // sha256(bucketKey) hex
|
|
36
|
+
windowStartMs BigInt @map("window_start_ms")
|
|
37
|
+
windowMs Int @map("window_ms")
|
|
38
|
+
count Int
|
|
39
|
+
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz
|
|
40
|
+
|
|
41
|
+
@@index([windowStartMs], map: "rate_limit_counters_window_start_ms_idx")
|
|
42
|
+
@@map("rate_limit_counters")
|
|
43
|
+
}
|
|
@@ -26,6 +26,10 @@ import "dotenv/config";
|
|
|
26
26
|
import { basename } from "node:path";
|
|
27
27
|
|
|
28
28
|
import {
|
|
29
|
+
CONTACT_FORM_FLOW_SLUG,
|
|
30
|
+
CONTACT_FORM_FLOW_TITLE,
|
|
31
|
+
CONTACT_FORM_LANDING_PAGE,
|
|
32
|
+
contactFormFlowConfig,
|
|
29
33
|
REQUEST_QUOTE_FLOW_SLUG,
|
|
30
34
|
REQUEST_QUOTE_FLOW_TITLE,
|
|
31
35
|
requestQuoteFlowConfig,
|
|
@@ -74,6 +78,10 @@ export type DefaultWorkspacePrismaClient = Pick<
|
|
|
74
78
|
* backfill finds no workspace and seeds nothing; this is where the default
|
|
75
79
|
* workspace's magnet comes from. Insert-if-absent: an `upsert` with an empty
|
|
76
80
|
* `update`, so an existing `(site_id, slug)` row is never overwritten.
|
|
81
|
+
*
|
|
82
|
+
* #8661 D3 — and its live Contact form magnet, the same way. An existing
|
|
83
|
+
* deployment (a workspace already present) gets its row from the seed-presets
|
|
84
|
+
* CLI instead.
|
|
77
85
|
*/
|
|
78
86
|
export async function provisionDefaultWorkspace(
|
|
79
87
|
prisma: DefaultWorkspacePrismaClient,
|
|
@@ -129,6 +137,27 @@ export async function provisionDefaultWorkspace(
|
|
|
129
137
|
update: {},
|
|
130
138
|
});
|
|
131
139
|
|
|
140
|
+
await prisma.flowDefinition.upsert({
|
|
141
|
+
where: {
|
|
142
|
+
siteId_slug: {
|
|
143
|
+
siteId: DEFAULT_WORKSPACE_ID,
|
|
144
|
+
slug: CONTACT_FORM_FLOW_SLUG,
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
create: {
|
|
148
|
+
siteId: DEFAULT_WORKSPACE_ID,
|
|
149
|
+
workspaceId: DEFAULT_WORKSPACE_ID,
|
|
150
|
+
slug: CONTACT_FORM_FLOW_SLUG,
|
|
151
|
+
config: contactFormFlowConfig,
|
|
152
|
+
kind: "contact",
|
|
153
|
+
title: CONTACT_FORM_FLOW_TITLE,
|
|
154
|
+
status: "live",
|
|
155
|
+
customersEnabled: false,
|
|
156
|
+
landingPage: CONTACT_FORM_LANDING_PAGE,
|
|
157
|
+
},
|
|
158
|
+
update: {},
|
|
159
|
+
});
|
|
160
|
+
|
|
132
161
|
return { created: true };
|
|
133
162
|
}
|
|
134
163
|
|
package/templates/project.yaml
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
schema_version: 1
|
|
2
2
|
|
|
3
3
|
# project.yaml — per-repo configuration consumed by Claude Code skills and
|
|
4
|
-
# global rules. Replace REPLACE_ME
|
|
4
|
+
# global rules. Replace every REPLACE_ME value with your repo's own: its
|
|
5
|
+
# identity and its Slack channel.
|
|
5
6
|
#
|
|
6
7
|
# See https://github.com/working-theory-labs/ai-launch-kit/blob/main/project.yaml
|
|
7
8
|
# for AI Launch Kit's own canonical example.
|
|
@@ -10,10 +11,13 @@ identity:
|
|
|
10
11
|
name: REPLACE_ME # your repo slug, kebab-case
|
|
11
12
|
github_repo: REPLACE_ME/REPLACE_ME # owner/repo on GitHub
|
|
12
13
|
npm_scope: "@REPLACE_ME" # e.g. "@yourorg" — replace with your npm scope
|
|
13
|
-
visibility: private # "
|
|
14
|
+
visibility: private # "public" | "private" | "internal"
|
|
14
15
|
default_branch: main
|
|
15
16
|
branching_model: single_trunk
|
|
16
17
|
|
|
18
|
+
slack:
|
|
19
|
+
primary_channel: REPLACE_ME # channel name without "#", where this repo's CI and agent reports land
|
|
20
|
+
|
|
17
21
|
product:
|
|
18
22
|
identity_mode: organization # "organization" | "person" | null
|
|
19
23
|
default_locale: en
|
|
@@ -27,7 +31,6 @@ labels:
|
|
|
27
31
|
blocked: status/blocked
|
|
28
32
|
done: status/done
|
|
29
33
|
needs_spec: status/needs-spec
|
|
30
|
-
auto_merge: auto-merge-eligible
|
|
31
34
|
|
|
32
35
|
verification:
|
|
33
36
|
preflight: pnpm preflight
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* global process */
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Shared Jest `globalSetup` — pins every jest run in the workspace to one
|
|
6
|
+
* timezone (#8657).
|
|
7
|
+
*
|
|
8
|
+
* Jest otherwise inherits the developer's `TZ`, so a test that renders a date
|
|
9
|
+
* in local time (`formatDate`, `toLocaleDateString`, `getDate()`) passes in CI,
|
|
10
|
+
* which runs in UTC, and fails on a laptop that does not: the #8578 shape,
|
|
11
|
+
* where UTC-midnight consent fixtures rendered the previous day on an MDT
|
|
12
|
+
* machine and failed 11 release-check rows.
|
|
13
|
+
*
|
|
14
|
+
* WHY `globalSetup` AND NOT `setupFiles`: a setup file runs inside the test
|
|
15
|
+
* sandbox, whose `process.env` is jest's copy of the real one, so assigning
|
|
16
|
+
* `TZ` there never reaches the process clock. `globalSetup` runs in jest's
|
|
17
|
+
* parent process before any worker is spawned: the workers inherit the pinned
|
|
18
|
+
* `TZ`, and Node re-reads an assigned `process.env.TZ` at once, so an in-band
|
|
19
|
+
* run (`--runInBand`, a single test file) is pinned in place too.
|
|
20
|
+
*
|
|
21
|
+
* Every committed `jest.config.cjs` loads this file; the guard is
|
|
22
|
+
* `tests/architecture/jest-timezone-pin.test.ts`, and the value is documented
|
|
23
|
+
* in CONVENTIONS.md § Testing. A test that needs another zone formats with an
|
|
24
|
+
* explicit `timeZone` option rather than changing `TZ`. The create-ailk
|
|
25
|
+
* scaffold ships this file at the same path (`SNAPSHOT_FILES` in
|
|
26
|
+
* packages/create-ailk/scripts/build-templates.mjs), so its copied configs
|
|
27
|
+
* load it unchanged.
|
|
28
|
+
*/
|
|
29
|
+
const PINNED_TZ = "UTC";
|
|
30
|
+
|
|
31
|
+
module.exports = async function pinTimezone() {
|
|
32
|
+
process.env.TZ = PINNED_TZ;
|
|
33
|
+
};
|
|
34
|
+
module.exports.PINNED_TZ = PINNED_TZ;
|
package/versions.json
CHANGED
|
@@ -1,53 +1,53 @@
|
|
|
1
1
|
{
|
|
2
|
-
"@working-theory/admin-ui": "0.
|
|
3
|
-
"@working-theory/aeo": "0.
|
|
4
|
-
"@working-theory/agent-context": "0.
|
|
2
|
+
"@working-theory/admin-ui": "0.42.0",
|
|
3
|
+
"@working-theory/aeo": "0.42.0",
|
|
4
|
+
"@working-theory/agent-context": "0.42.0",
|
|
5
5
|
"@working-theory/agent-contract": "0.1.0",
|
|
6
6
|
"@working-theory/agent-memory": "0.0.0",
|
|
7
7
|
"@working-theory/ai": "0.1.0",
|
|
8
|
-
"@working-theory/analytics": "0.
|
|
9
|
-
"@working-theory/api-client": "0.
|
|
8
|
+
"@working-theory/analytics": "0.42.0",
|
|
9
|
+
"@working-theory/api-client": "0.42.0",
|
|
10
10
|
"@working-theory/cda-filesystem": "0.0.0",
|
|
11
|
-
"@working-theory/cli": "0.
|
|
12
|
-
"@working-theory/common": "0.
|
|
11
|
+
"@working-theory/cli": "0.42.0",
|
|
12
|
+
"@working-theory/common": "0.42.0",
|
|
13
13
|
"@working-theory/consent": "0.1.0",
|
|
14
|
-
"@working-theory/content-adapters": "0.
|
|
15
|
-
"@working-theory/content-projection": "0.
|
|
16
|
-
"@working-theory/email": "0.
|
|
14
|
+
"@working-theory/content-adapters": "0.42.0",
|
|
15
|
+
"@working-theory/content-projection": "0.42.0",
|
|
16
|
+
"@working-theory/email": "0.42.0",
|
|
17
17
|
"@working-theory/env": "0.0.0",
|
|
18
|
-
"@working-theory/eslint-config": "0.
|
|
19
|
-
"@working-theory/fumadocs-schema": "0.
|
|
20
|
-
"@working-theory/ids": "0.
|
|
21
|
-
"@working-theory/jsonld": "0.
|
|
22
|
-
"@working-theory/license": "0.
|
|
23
|
-
"@working-theory/metadata": "0.
|
|
24
|
-
"@working-theory/observability": "0.
|
|
25
|
-
"@working-theory/page-renderer": "0.
|
|
18
|
+
"@working-theory/eslint-config": "0.42.0",
|
|
19
|
+
"@working-theory/fumadocs-schema": "0.42.0",
|
|
20
|
+
"@working-theory/ids": "0.14.0",
|
|
21
|
+
"@working-theory/jsonld": "0.42.0",
|
|
22
|
+
"@working-theory/license": "0.42.0",
|
|
23
|
+
"@working-theory/metadata": "0.42.0",
|
|
24
|
+
"@working-theory/observability": "0.42.0",
|
|
25
|
+
"@working-theory/page-renderer": "0.42.0",
|
|
26
26
|
"@working-theory/plugin-mcp": "0.1.3",
|
|
27
|
-
"@working-theory/schema": "0.
|
|
28
|
-
"@working-theory/schema-pack-registry": "0.
|
|
29
|
-
"@working-theory/schema-validator": "0.
|
|
30
|
-
"@working-theory/sections-registry": "0.
|
|
31
|
-
"@working-theory/site-config": "0.
|
|
32
|
-
"@working-theory/spoke-checkout": "0.5.
|
|
33
|
-
"@working-theory/stripe-client": "0.
|
|
34
|
-
"@working-theory/templates": "0.
|
|
35
|
-
"@working-theory/theme": "0.
|
|
36
|
-
"@working-theory/ui": "0.
|
|
37
|
-
"@working-theory/validation": "0.
|
|
38
|
-
"@working-theory/web-i18n": "0.
|
|
27
|
+
"@working-theory/schema": "0.42.0",
|
|
28
|
+
"@working-theory/schema-pack-registry": "0.42.0",
|
|
29
|
+
"@working-theory/schema-validator": "0.42.0",
|
|
30
|
+
"@working-theory/sections-registry": "0.42.0",
|
|
31
|
+
"@working-theory/site-config": "0.42.0",
|
|
32
|
+
"@working-theory/spoke-checkout": "0.5.3",
|
|
33
|
+
"@working-theory/stripe-client": "0.42.0",
|
|
34
|
+
"@working-theory/templates": "0.42.0",
|
|
35
|
+
"@working-theory/theme": "0.42.0",
|
|
36
|
+
"@working-theory/ui": "0.42.0",
|
|
37
|
+
"@working-theory/validation": "0.42.0",
|
|
38
|
+
"@working-theory/web-i18n": "0.42.0",
|
|
39
39
|
"@working-theory/billing-client": "0.0.0",
|
|
40
40
|
"@working-theory/branding": "0.0.0",
|
|
41
41
|
"@working-theory/license-client": "0.0.0",
|
|
42
42
|
"@working-theory/license-manifest": "0.0.0",
|
|
43
43
|
"@working-theory/partner-session": "0.0.0",
|
|
44
44
|
"@working-theory/preview-protocol": "0.0.0",
|
|
45
|
-
"@working-theory/ui-commerce": "0.23.
|
|
46
|
-
"@working-theory/ui-docs-blog": "0.23.
|
|
47
|
-
"@working-theory/ui-scheduling": "0.
|
|
48
|
-
"@working-theory/ui-signal-collectors": "0.25.
|
|
45
|
+
"@working-theory/ui-commerce": "0.23.20",
|
|
46
|
+
"@working-theory/ui-docs-blog": "0.23.20",
|
|
47
|
+
"@working-theory/ui-scheduling": "0.24.0",
|
|
48
|
+
"@working-theory/ui-signal-collectors": "0.25.9",
|
|
49
49
|
"@working-theory/web": "0.0.0",
|
|
50
50
|
"@working-theory/api": "1.0.0",
|
|
51
51
|
"@working-theory/mcp": "0.0.0",
|
|
52
|
-
"@working-theory/database": "0.
|
|
52
|
+
"@working-theory/database": "0.42.0"
|
|
53
53
|
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
# Preserve Existing Style
|
|
2
|
-
|
|
3
|
-
When editing existing files, preserve their existing formatting. Do
|
|
4
|
-
**not** reformat, reflow, reorganize imports, change quote style,
|
|
5
|
-
change indentation, or rearrange whitespace on lines that aren't
|
|
6
|
-
materially changing as part of your task.
|
|
7
|
-
|
|
8
|
-
Your diff should contain only the lines you deliberately touched. A
|
|
9
|
-
20-line functional change should produce a ~20-line diff, not a
|
|
10
|
-
900-line diff with 880 lines of formatting churn.
|
|
11
|
-
|
|
12
|
-
## Why
|
|
13
|
-
|
|
14
|
-
Formatting churn:
|
|
15
|
-
|
|
16
|
-
- Obscures real changes during code review.
|
|
17
|
-
- Creates noise in `git blame` / `git log`.
|
|
18
|
-
- Triggers unnecessary merge conflicts.
|
|
19
|
-
- Violates the spirit of "behavior must not change unless the
|
|
20
|
-
acceptance criteria say so" — even if runtime behavior is identical,
|
|
21
|
-
the meaning to a human reader has changed.
|
|
22
|
-
|
|
23
|
-
## How to apply
|
|
24
|
-
|
|
25
|
-
- **Before committing:** run `git diff --stat`. If the delta is
|
|
26
|
-
wildly larger than the work you did, investigate before pushing.
|
|
27
|
-
- **If your editor runs a formatter on save:** disable it for the
|
|
28
|
-
session, configure it to match the existing style, or revert
|
|
29
|
-
formatting-only lines before committing.
|
|
30
|
-
- **If quotes, semicolons, or import grouping differ from the
|
|
31
|
-
existing file:** match the existing file, not your editor's
|
|
32
|
-
defaults.
|
|
33
|
-
- **The diff is the contract.** A reviewer should see only the lines
|
|
34
|
-
you meant to change.
|
|
35
|
-
|
|
36
|
-
## Not covered by this rule
|
|
37
|
-
|
|
38
|
-
- Deliberate cleanup (removing dead code, inlining single-use
|
|
39
|
-
helpers, collapsing redundant abstraction) is fine when it's the
|
|
40
|
-
point of the task and called out in the PR.
|
|
41
|
-
- Net-new files set their own style, subject to the project's
|
|
42
|
-
existing conventions.
|
|
43
|
-
- A task whose acceptance criteria explicitly say "reformat file X"
|
|
44
|
-
(rare).
|
|
45
|
-
|
|
46
|
-
## Escalation
|
|
47
|
-
|
|
48
|
-
If you believe the existing style is genuinely wrong and want to
|
|
49
|
-
change it: stop. Note it in the PR description and propose the
|
|
50
|
-
reformat as a separate PR. Do not unilaterally reformat the codebase
|
|
51
|
-
as a side effect of an unrelated task.
|