@xhulz/nina 0.46.0 → 0.47.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. package/README.md +1 -1
  2. package/package.json +1 -1
  3. package/releases/0.47.0/core/GAPS.md +125 -0
  4. package/releases/0.47.0/core/answered.json +44 -0
  5. package/releases/0.47.0/core/defaults/tree/.claude/agents/architect.md +1 -0
  6. package/releases/0.47.0/core/defaults/tree/.claude/agents/dba.md +3 -0
  7. package/releases/0.47.0/core/defaults/tree/.claude/agents/devops.md +1 -0
  8. package/releases/0.47.0/core/defaults/tree/.claude/agents/implementer.md +1 -0
  9. package/releases/0.47.0/core/defaults/tree/.claude/agents/integration-tester.md +3 -0
  10. package/releases/0.47.0/core/defaults/tree/.claude/agents/qa.md +7 -0
  11. package/releases/0.47.0/core/defaults/tree/.claude/agents/reviewer.md +3 -0
  12. package/releases/0.47.0/core/defaults/tree/.claude/agents/secops.md +3 -0
  13. package/releases/0.47.0/core/defaults/tree/.claude/agents/solidity-auditor.md +3 -0
  14. package/releases/0.47.0/core/defaults/tree/.claude/agents/solidity-dev.md +3 -0
  15. package/releases/0.47.0/core/tree/.claude/agents/architect.md +127 -0
  16. package/releases/0.47.0/core/tree/.claude/agents/dba.md +117 -0
  17. package/releases/0.47.0/core/tree/.claude/agents/devops.md +118 -0
  18. package/releases/0.47.0/core/tree/.claude/agents/implementer.md +160 -0
  19. package/releases/0.47.0/core/tree/.claude/agents/integration-tester.md +168 -0
  20. package/releases/0.47.0/core/tree/.claude/agents/planner.md +132 -0
  21. package/releases/0.47.0/core/tree/.claude/agents/qa.md +150 -0
  22. package/releases/0.47.0/core/tree/.claude/agents/reviewer.md +183 -0
  23. package/releases/0.47.0/core/tree/.claude/agents/secops.md +120 -0
  24. package/releases/0.47.0/core/tree/.claude/agents/solidity-auditor.md +126 -0
  25. package/releases/0.47.0/core/tree/.claude/agents/solidity-dev.md +123 -0
  26. package/releases/0.47.0/core/tree/.claude/agents-overview.md +64 -0
  27. package/releases/0.47.0/core/tree/.claude/frontend.md +10 -0
  28. package/releases/0.47.0/core/tree/.claude/graph.md +75 -0
  29. package/releases/0.47.0/core/tree/.claude/patterns.md +251 -0
  30. package/releases/0.47.0/core/tree/.claude/pills/README.md +147 -0
  31. package/releases/0.47.0/core/tree/.claude/pipeline.md +101 -0
  32. package/releases/0.47.0/core/tree/.claude/retrieval.md +103 -0
  33. package/releases/0.47.0/core/tree/.claude/router.md +198 -0
  34. package/releases/0.47.0/core/tree/.claude/templates/integration.md +45 -0
  35. package/releases/0.47.0/core/tree/CLAUDE.md +164 -0
  36. package/releases/0.47.0/core/tree/scripts/cost-watch.mjs +25 -0
  37. package/releases/0.47.0/core/tree/scripts/edit-guard.mjs +24 -0
  38. package/releases/0.47.0/core/tree/scripts/harness-check.mjs +71 -0
  39. package/releases/0.47.0/core/tree/scripts/loop-gate.mjs +19 -0
  40. package/releases/0.47.0/core/vocabulary.json +13 -0
  41. package/releases/0.47.0/surfaces/blockchain/tree/.claude/agents/architect.md +5 -0
  42. package/releases/0.47.0/surfaces/blockchain/tree/.claude/agents/devops.md +5 -0
  43. package/releases/0.47.0/surfaces/blockchain/tree/.claude/agents/reviewer.md +5 -0
  44. package/releases/0.47.0/surfaces/blockchain/tree/.claude/agents/solidity-auditor.md +18 -0
  45. package/releases/0.47.0/surfaces/blockchain/tree/.claude/agents/solidity-dev.md +16 -0
  46. package/releases/0.47.0/surfaces/blockchain/tree/.claude/agents-overview.md +6 -0
  47. package/releases/0.47.0/surfaces/blockchain/tree/.claude/graph.md +11 -0
  48. package/releases/0.47.0/surfaces/blockchain/tree/.claude/router.md +6 -0
  49. package/releases/0.47.0/surfaces/blockchain/tree/CLAUDE.md +12 -0
  50. package/releases/0.47.0/surfaces/d1/tree/.claude/agents/dba.md +13 -0
  51. package/releases/0.47.0/surfaces/d1/tree/.claude/agents/devops.md +2 -0
  52. package/releases/0.47.0/surfaces/d1/tree/.claude/agents/implementer.md +2 -0
  53. package/releases/0.47.0/surfaces/d1/tree/.claude/patterns.md +8 -0
  54. package/releases/0.47.0/surfaces/d1/tree/CLAUDE.md +2 -0
  55. package/releases/0.47.0/surfaces/db/tree/.claude/agents/architect.md +5 -0
  56. package/releases/0.47.0/surfaces/db/tree/.claude/agents/dba.md +54 -0
  57. package/releases/0.47.0/surfaces/db/tree/.claude/agents/devops.md +5 -0
  58. package/releases/0.47.0/surfaces/db/tree/.claude/agents/implementer.md +2 -0
  59. package/releases/0.47.0/surfaces/db/tree/.claude/agents/integration-tester.md +10 -0
  60. package/releases/0.47.0/surfaces/db/tree/.claude/agents/planner.md +2 -0
  61. package/releases/0.47.0/surfaces/db/tree/.claude/agents/reviewer.md +22 -0
  62. package/releases/0.47.0/surfaces/db/tree/.claude/agents/secops.md +2 -0
  63. package/releases/0.47.0/surfaces/db/tree/.claude/agents-overview.md +5 -0
  64. package/releases/0.47.0/surfaces/db/tree/.claude/graph.md +8 -0
  65. package/releases/0.47.0/surfaces/db/tree/.claude/patterns.md +22 -0
  66. package/releases/0.47.0/surfaces/db/tree/.claude/pipeline.md +13 -0
  67. package/releases/0.47.0/surfaces/db/tree/.claude/retrieval.md +5 -0
  68. package/releases/0.47.0/surfaces/db/tree/.claude/router.md +4 -0
  69. package/releases/0.47.0/surfaces/db/tree/CLAUDE.md +17 -0
  70. package/releases/0.47.0/surfaces/drizzle/tree/.claude/agents/dba.md +9 -0
  71. package/releases/0.47.0/surfaces/drizzle/tree/.claude/agents/devops.md +5 -0
  72. package/releases/0.47.0/surfaces/drizzle/tree/.claude/agents/implementer.md +2 -0
  73. package/releases/0.47.0/surfaces/drizzle/tree/.claude/patterns.md +7 -0
  74. package/releases/0.47.0/surfaces/edge-cf/tree/.claude/agents/architect.md +14 -0
  75. package/releases/0.47.0/surfaces/edge-cf/tree/.claude/agents/dba.md +2 -0
  76. package/releases/0.47.0/surfaces/edge-cf/tree/.claude/agents/devops.md +29 -0
  77. package/releases/0.47.0/surfaces/edge-cf/tree/.claude/agents/implementer.md +14 -0
  78. package/releases/0.47.0/surfaces/edge-cf/tree/.claude/agents/integration-tester.md +11 -0
  79. package/releases/0.47.0/surfaces/edge-cf/tree/.claude/agents/qa.md +3 -0
  80. package/releases/0.47.0/surfaces/edge-cf/tree/.claude/agents/reviewer.md +8 -0
  81. package/releases/0.47.0/surfaces/edge-cf/tree/.claude/agents/secops.md +8 -0
  82. package/releases/0.47.0/surfaces/edge-cf/tree/.claude/patterns.md +17 -0
  83. package/releases/0.47.0/surfaces/edge-cf/tree/.claude/retrieval.md +8 -0
  84. package/releases/0.47.0/surfaces/edge-cf/tree/CLAUDE.md +27 -0
  85. package/releases/0.47.0/surfaces/frontend/tree/.claude/agents/architect.md +20 -0
  86. package/releases/0.47.0/surfaces/frontend/tree/.claude/agents/devops.md +28 -0
  87. package/releases/0.47.0/surfaces/frontend/tree/.claude/agents/implementer.md +25 -0
  88. package/releases/0.47.0/surfaces/frontend/tree/.claude/agents/qa.md +17 -0
  89. package/releases/0.47.0/surfaces/frontend/tree/.claude/agents/reviewer.md +56 -0
  90. package/releases/0.47.0/surfaces/frontend/tree/.claude/patterns.md +8 -0
  91. package/releases/0.47.0/surfaces/frontend/tree/.claude/retrieval.md +2 -0
  92. package/releases/0.47.0/surfaces/frontend/tree/.claude/router.md +14 -0
  93. package/releases/0.47.0/surfaces/frontend/tree/CLAUDE.md +5 -0
  94. package/releases/0.47.0/surfaces/integrations/tree/.claude/agents/architect.md +16 -0
  95. package/releases/0.47.0/surfaces/integrations/tree/.claude/agents/implementer.md +12 -0
  96. package/releases/0.47.0/surfaces/integrations/tree/.claude/agents/integration-tester.md +20 -0
  97. package/releases/0.47.0/surfaces/integrations/tree/.claude/agents/planner.md +2 -0
  98. package/releases/0.47.0/surfaces/integrations/tree/.claude/agents/reviewer.md +21 -0
  99. package/releases/0.47.0/surfaces/integrations/tree/.claude/agents/secops.md +2 -0
  100. package/releases/0.47.0/surfaces/integrations/tree/.claude/agents-overview.md +8 -0
  101. package/releases/0.47.0/surfaces/integrations/tree/.claude/graph.md +10 -0
  102. package/releases/0.47.0/surfaces/integrations/tree/.claude/patterns.md +38 -0
  103. package/releases/0.47.0/surfaces/integrations/tree/.claude/pipeline.md +16 -0
  104. package/releases/0.47.0/surfaces/integrations/tree/.claude/retrieval.md +16 -0
  105. package/releases/0.47.0/surfaces/integrations/tree/.claude/router.md +6 -0
  106. package/releases/0.47.0/surfaces/integrations/tree/CLAUDE.md +17 -0
  107. package/releases/0.47.0/surfaces/money/tree/.claude/agents/architect.md +12 -0
  108. package/releases/0.47.0/surfaces/money/tree/.claude/agents/dba.md +14 -0
  109. package/releases/0.47.0/surfaces/money/tree/.claude/agents/implementer.md +11 -0
  110. package/releases/0.47.0/surfaces/money/tree/.claude/agents/integration-tester.md +3 -0
  111. package/releases/0.47.0/surfaces/money/tree/.claude/agents/reviewer.md +23 -0
  112. package/releases/0.47.0/surfaces/money/tree/.claude/agents/secops.md +5 -0
  113. package/releases/0.47.0/surfaces/money/tree/.claude/agents/solidity-auditor.md +4 -0
  114. package/releases/0.47.0/surfaces/money/tree/.claude/agents/solidity-dev.md +4 -0
  115. package/releases/0.47.0/surfaces/money/tree/.claude/graph.md +2 -0
  116. package/releases/0.47.0/surfaces/money/tree/.claude/patterns.md +49 -0
  117. package/releases/0.47.0/surfaces/money/tree/.claude/pipeline.md +2 -0
  118. package/releases/0.47.0/surfaces/money/tree/.claude/retrieval.md +2 -0
  119. package/releases/0.47.0/surfaces/money/tree/CLAUDE.md +11 -0
  120. package/releases/0.47.0/surfaces/pii/tree/.claude/agents/dba.md +2 -0
  121. package/releases/0.47.0/surfaces/pii/tree/.claude/agents/devops.md +8 -0
  122. package/releases/0.47.0/surfaces/pii/tree/.claude/agents/reviewer.md +8 -0
  123. package/releases/0.47.0/surfaces/pii/tree/.claude/agents/secops.md +2 -0
  124. package/releases/0.47.0/surfaces/pii/tree/.claude/agents/solidity-auditor.md +5 -0
  125. package/releases/0.47.0/surfaces/pii/tree/CLAUDE.md +5 -0
  126. package/releases/0.47.0/surfaces/prisma/tree/.claude/agents/architect.md +2 -0
  127. package/releases/0.47.0/surfaces/prisma/tree/.claude/agents/dba.md +42 -0
  128. package/releases/0.47.0/surfaces/prisma/tree/.claude/agents/devops.md +11 -0
  129. package/releases/0.47.0/surfaces/prisma/tree/.claude/agents/implementer.md +2 -0
  130. package/releases/0.47.0/surfaces/prisma/tree/.claude/agents/integration-tester.md +2 -0
  131. package/releases/0.47.0/surfaces/prisma/tree/.claude/agents/reviewer.md +2 -0
  132. package/releases/0.47.0/surfaces/prisma/tree/.claude/patterns.md +15 -0
  133. package/releases/0.47.0/surfaces/prisma/tree/CLAUDE.md +5 -0
  134. package/src/commands/check.mjs +10 -4
  135. package/src/commands/compose.mjs +3 -3
  136. package/src/commands/init.mjs +5 -3
  137. package/src/commands/upgrade.mjs +2 -2
  138. package/src/surfaces.mjs +19 -3
@@ -0,0 +1,49 @@
1
+ <!-- nina:slot money.1 -->
2
+
3
+ ---
4
+
5
+ ## Monetary values & percentages
6
+
7
+ - **Money is an integer of the currency's minor unit**, end to end — {{MINOR_UNIT}}, never a float, never a type that can hold a fraction of one. Source of precision: `{{MONEY_MODULE}}`.
8
+ - **Percentages are basis points** (`40% → 4000`, `100% → 10000`) so a distribution is exact without floating point.
9
+ - **Parsing, formatting and percentage arithmetic live in one module and nowhere else.** A second place that turns a string into money is a second rounding rule, and the two will disagree on a value somebody is owed.
10
+ - **Never** convert to a floating-point type before formatting, and never let a display format round a stored value.
11
+ - Monetary database columns are integer. JSON responses serialize them as **strings**, not numbers, so no client parses them into a float. The service owns the conversion.
12
+
13
+ <!-- nina:slot money.2 -->
14
+
15
+ ---
16
+
17
+ ## Distribution invariants (enforced by reviewer + unit tests)
18
+
19
+ The distribution engine lives in `{{CORE_PKG}}`. It is pure and total over integer {{MINOR_UNIT}}:
20
+
21
+ - A destination is either a percentage (basis points of the amount) or a fixed value.
22
+ - `total = Σ destinations`, computed in {{MINOR_UNIT}}.
23
+ - `total > amount` → **reject.** Never clamp, never distribute what is not there.
24
+ - `total < amount` → **allow**, surface the shortfall, and leave the remainder **parked**. Silence is the defect here: an unexplained remainder is indistinguishable from a bug.
25
+ - `total = amount` → OK.
26
+ - A retention is just another destination — the same arithmetic applies to it, with no special case.
27
+
28
+ <!-- nina:slot money.3 -->
29
+
30
+ ---
31
+
32
+ ## State machines & idempotency (enforced by reviewer)
33
+
34
+ - **Every money-moving entity is a state machine.** Its states and legal transitions are declared in `.claude/architecture.md`; the code follows the declaration, not the other way round. Illegal transitions throw; they are never silently coerced.
35
+ - **Every transition writes an audit row** (entity type, entity id, from, to, actor). No transition without a trail — the trail is what makes a money bug diagnosable after the money has moved.
36
+ - **Outbound transfers are idempotent.** Each carries a unique key, and dedupe happens before the side effect, at the serialization point.
37
+ - **One serialization point per balance.** Whatever computes and dispatches against a single balance never runs concurrently with itself. Two concurrent runs over one balance is how a double send happens even when every individual write is correct.
38
+
39
+ <!-- nina:slot money.4 -->
40
+ - **Money computation and dispatch go through the serialization point.** Routes, queue consumers and tools never run a distribution or a transfer synchronously in the request path.
41
+
42
+ <!-- nina:slot money.5 -->
43
+ - **The distribution engine lives in `{{CORE_PKG}}`.** Services call it as a pure function; they do not embed money logic inline.
44
+
45
+ <!-- nina:slot money.6 -->
46
+ - Idempotency on money-moving writes: the record carries an idempotency key, and the serialization point refuses the second attempt *before* the side effect.
47
+
48
+ <!-- nina:slot money.7 -->
49
+ - `{{CORE_PKG}}` is the most-tested package — pure functions over fixtures. Cover the distribution invariants exhaustively: over, under, exact, mixed percentage and fixed, and rounding.
@@ -0,0 +1,2 @@
1
+ <!-- nina:slot money.1 -->
2
+ - **Money invariants respected** — a distribution never exceeds the amount; a shortfall is parked, not distributed; transfers idempotent; every transition audited.
@@ -0,0 +1,2 @@
1
+ <!-- nina:slot money.1 -->
2
+ | New distribution / transfer logic | `.claude/architecture.md` § *Money*, `.claude/patterns.md` § *Distribution invariants*, `{{CORE_PKG}}/` | architect → implementer → reviewer → qa |
@@ -0,0 +1,11 @@
1
+ <!-- nina:slot money.1 -->
2
+ 3. **An outbound transfer is idempotent — it is NEVER sent twice.** Every transfer carries an idempotency key, and deduplication happens at a single serialization point **before** the side effect, never after it. A retry, a re-delivered queue message, a double-click and a replayed webhook must all collapse to one transfer. This is the highest-blast-radius invariant in the system: almost everything else can be corrected afterwards, and a duplicated transfer cannot.
3
+
4
+ <!-- nina:slot money.2 -->
5
+ 4. **Conservation — what comes in equals what goes out plus what is retained.** A distribution may NEVER exceed the amount it distributes → **block**. If it is **less**, **alert** and leave the remainder **parked** and visible — never silently distributed, never silently absorbed. All arithmetic is integer {{MINOR_UNIT}}; percentages are basis points. The LLM never computes a monetary value.
6
+
7
+ <!-- nina:slot money.3 -->
8
+ 5. **State-machine integrity.** Every money-moving entity has an explicit set of states and legal transitions, declared in `.claude/architecture.md` § *State machines* — not inferred from whatever code happens to exist. Only declared transitions are legal; an illegal one throws and is never silently coerced. **Every transition writes an audit row** (entity, id, from → to, actor, when). Skipping a state, inventing one, or landing a transition with no audit row is a hard reject.
9
+
10
+ <!-- nina:slot money.4 -->
11
+ - **money movement**: anything that creates, moves, settles or records a balance
@@ -0,0 +1,2 @@
1
+ <!-- nina:slot pii.1 -->
2
+ - **Privacy.** No sensitive value in clear text where it must not be. The categories are declared in `.claude/architecture.md` § *Privacy* — they are not decided per query, and not decided by you. **Document bytes live only in the object store, referenced by key: the column holds the key, never the bytes.** Any column the architect's spec flagged for masking must be encrypted at rest. Reject a schema that widens what is stored in the clear.
@@ -0,0 +1,8 @@
1
+ <!-- nina:slot pii.1 -->
2
+
3
+ **Point it at an UNAUTHENTICATED route — a sign-in page is the right one.** Never sign in, and never
4
+ screenshot a signed-in page. Accounts on deployed environments hold real personal data, and a
5
+ screenshot or a console dump pulls it into agent transcripts and logs, where it persists and nobody
6
+ ever looks for it again. That is a privacy leak with no upside here: the sign-in page proves
7
+ everything this check is for. It renders from the same bundle, it exercises the same build-time env
8
+ inlining (a missing variable blanks it identically), and it needs no session.
@@ -0,0 +1,8 @@
1
+ <!-- nina:slot pii.1 -->
2
+ - Check for privacy regressions: **no sensitive value in a log, an error message — a library's own included — a URL or a test fixture**, per the categories in `.claude/architecture.md` § *Privacy*; document bytes only in the object store, never plaintext in the database; no leaked secret.
3
+
4
+ <!-- nina:slot pii.2 -->
5
+ - **privacy** — the privacy check above, in full: no sensitive value in a log, an error message, a
6
+ URL or a test fixture; document bytes only in the object store; no leaked secret. Where
7
+ **tenant-and-privacy** is dispatched, its reviewer owns this too and there is no separate one; where
8
+ it is not, this is a dimension of its own. Either way it is never nobody's.
@@ -0,0 +1,2 @@
1
+ <!-- nina:slot pii.1 -->
2
+ - **Privacy (Hard Rule #8)** — the categories declared in `.claude/architecture.md` § *Privacy* must never appear in logs, in responses that do not need them, in error paths, or in the database in clear text. Check every endpoint that returns a person's record for fields it includes by accident: a `select` that quietly grew a column is the usual way this leaks. Check the error paths too — they are written last and reviewed least — and what the libraries on them print or carry in their own errors, bound values included.
@@ -0,0 +1,5 @@
1
+ <!-- nina:slot pii.1 -->
2
+ - **Nothing personal reaches the chain.** What is written on-chain is public, permanent, and beyond
3
+ deletion by anyone — including by you, and including after a subject asks. A hash of a personal
4
+ identifier is not a protection: it is a lookup table for whoever holds the input set. Reject a
5
+ personal datum stored in state, emitted in an event, or passed as calldata.
@@ -0,0 +1,5 @@
1
+ <!-- nina:slot pii.1 -->
2
+ 8. **Sensitive personal data is classified, and the classification is enforced.** What counts as sensitive here — identity documents, financial identifiers, anything a person would not expect to be readable by whoever can read a log — is declared in `.claude/architecture.md` § *Privacy*, along with the regime that governs it ({{PRIVACY_REGIME}}). Encrypted at rest. **No sensitive value in a log, an error message, a URL, an analytics event, or an agent transcript** — the places nobody thinks about are exactly the ones that persist. That includes what a library puts in its own errors and prints itself: a database client's error can carry the query and every bound value, and a framework can log a whole error past the logger it was given. A database error is mapped at the data layer to a typed error from a closed list before anything logs or returns it, and a test proves that a bound value it writes reaches no thrown error. Document bytes live only in the object store, referenced by key, never in the database in clear text.
3
+
4
+ <!-- nina:slot pii.2 -->
5
+ - **personal data**: where it is collected, stored, logged or sent
@@ -0,0 +1,2 @@
1
+ <!-- nina:slot prisma.1 -->
2
+ | `prisma-client-api` | a new or changed Prisma query |
@@ -0,0 +1,42 @@
1
+ <!-- nina:slot prisma.1 -->
2
+ | `prisma-cli` | **before ANY `prisma` CLI command** — `validate`, `format`, `migrate dev`, `migrate diff`, `migrate deploy`. Flags differ between versions, and one of them (`migrate diff --shadow-database-url` against a live database) destroys the database it points at |
3
+ | `prisma-client-api` | auditing a new or changed query — filters, operators, `$transaction` semantics. Through a driver adapter, cite the adapter's installed source for what a transaction does: the skill describes the default engine, and an adapter can roll back less |
4
+
5
+ <!-- nina:slot prisma.2 -->
6
+ Neither skill covers a **caching or edge layer sitting on top of the client** — cache strategy,
7
+ edge-client behaviour and the rule about never caching a read that authorizes a write belong to that
8
+ layer's own integration doc, declared like any other integration. A skill does not replace it.
9
+
10
+ <!-- nina:slot prisma.3 -->
11
+ - **With Prisma, both offline.** Run `pnpm --filter {{DB_PKG_NAME}} exec prisma validate`; it must pass. Then run `prisma migrate diff` in its **offline, file-only form** and read the generated SQL, not just the Prisma delta. Its flags changed in Prisma 7, so read the installed major (`prisma --version`) before writing the command:
12
+
13
+ ```
14
+ # Prisma 6. Compare the PREVIOUS schema against the working one — pure file-to-file, no database.
15
+ git show HEAD:{{DB_PKG}}/prisma/schema.prisma > /tmp/schema-head.prisma
16
+ pnpm --filter {{DB_PKG_NAME}} exec prisma migrate diff \
17
+ --from-schema-datamodel /tmp/schema-head.prisma \
18
+ --to-schema-datamodel prisma/schema.prisma \
19
+ --script
20
+ ```
21
+
22
+ From Prisma 7 the two flags are `--from-schema` and `--to-schema`, and the schema engine starts from the
23
+ datasource in `prisma.config.ts` even for this diff: with none there, it prints nothing and exits 0. For
24
+ SQLite a placeholder the diff never opens is enough, a `file:` URL under a gitignored directory; for any
25
+ other provider, find out what the diff opens before you give it one. Never a real database's URL. A first schema has nothing at `HEAD`: diff it `--from-empty`. Compare the output against the
26
+ hand-written `migration.sql` to confirm the declarative parts match.
27
+
28
+ ⚠️ **Do NOT reach for `--from-migrations`.** It looks like the natural choice and it is a trap:
29
+ Prisma refuses it without a shadow database (`--shadow-database-url`, or from Prisma 7 a
30
+ `shadowDatabaseUrl` in `prisma.config.ts`), which pushes you toward supplying a database URL — the exact move that destroys databases (below). The file-to-file form above answers the
31
+ same question with no database involved.
32
+
33
+ ⛔ **NEVER point `--shadow-database-url`, `--from-url`, `--to-url`, `--from-schema-datasource` — or, from Prisma 7, a `shadowDatabaseUrl` or the config datasource behind `--from-config-datasource` — at a real database, most of all not the one `{{SECRETS_LOCAL}}` names.** Prisma **executes** the entire migration history against whatever database those flags name, which **DESTROYS ALL DATA** in it. A shadow database must be a disposable, empty database and nothing else. It does not announce itself: the command completes with a reassuring "empty migration" result and no error, having already destroyed everything in the database it was pointed at. If the offline form above cannot answer your question, **STOP and report that to the orchestrator** instead of reaching for a database URL.
34
+
35
+ <!-- nina:slot prisma.4 -->
36
+ - **Where reads are cached through Prisma Accelerate,** every `findUnique` / `findMany` on a hot read path names its `cacheStrategy` (`ttl` / `swr`), and one that feeds a correctness-critical write names none.
37
+
38
+ <!-- nina:slot prisma.5 -->
39
+ - **On an edge runtime,** new Prisma code paths use the edge client of the installed major: `@prisma/client/edge` up to Prisma 6; from 7, the client the `prisma-client` generator writes with the platform's `runtime` set, imported from where it is generated — `@prisma/client/edge` fails there with `MODULE_NOT_FOUND`.
40
+
41
+ <!-- nina:slot prisma.6 -->
42
+ - Run a Prisma command that writes to a real database — `prisma migrate dev`, `migrate deploy`, `migrate reset`, `migrate resolve`, `db push`, `db execute`, `$executeRaw*` — or **any `prisma migrate diff` variant carrying a database URL**, which silently wipes the database it points at.
@@ -0,0 +1,11 @@
1
+ <!-- nina:slot prisma.1 -->
2
+ - **`prisma-cli`** — before `migrate deploy` or any other Prisma CLI command against a real database.
3
+
4
+ <!-- nina:slot prisma.2 -->
5
+ - **Prisma migrations go out with `prisma migrate deploy`**, and nothing else changes a shared database's schema.
6
+
7
+ <!-- nina:slot prisma.3 -->
8
+ - Run `prisma migrate diff --shadow-database-url <url>` against any live database. It **executes** the migration history against that database, destroying everything in it, and reports success. Use a disposable shadow database or don't run it.
9
+
10
+ <!-- nina:slot prisma.4 -->
11
+ - Run `prisma migrate reset` against a shared database, ever.
@@ -0,0 +1,2 @@
1
+ <!-- nina:slot prisma.1 -->
2
+ | `prisma-client-api` | a new or changed Prisma query |
@@ -0,0 +1,2 @@
1
+ <!-- nina:slot prisma.1 -->
2
+ | `prisma-cli` | a Prisma CLI command |
@@ -0,0 +1,2 @@
1
+ <!-- nina:slot prisma.1 -->
2
+ | `prisma-client-api` | a new or changed Prisma query |
@@ -0,0 +1,15 @@
1
+ <!-- nina:slot prisma.1 -->
2
+ - **Database table/column names** (Prisma `@map` / `@@map`): `snake_case` in SQL, `camelCase` in TS.
3
+
4
+ <!-- nina:slot prisma.2 -->
5
+ - Where Prisma reads are cached through Accelerate, `cacheStrategy` lives in `{{DB_PKG}}`: services do not add, strip, or override cache policies.
6
+
7
+ <!-- nina:slot prisma.3 -->
8
+
9
+ ### Prisma
10
+
11
+ - Schema lives in `{{DB_PKG}}/prisma/schema.prisma`. Nowhere else.
12
+ - **Never write raw SQL** unless justified in a code comment with perf data.
13
+ - N+1 is solved with `include` / `select`, chosen deliberately.
14
+ - Where reads are cached through Accelerate, every `findUnique` / `findMany` on a hot path defines its `cacheStrategy`, and no direct connection string is embedded in code.
15
+ - Tests run a real Prisma client against a real database; the client is never mocked.
@@ -0,0 +1,5 @@
1
+ <!-- nina:slot prisma.1 -->
2
+ | Run any `prisma` CLI command (the database gate, devops, and the integration gate where there is one) | `prisma-cli` | flags differ between versions; `migrate diff --shadow-database-url` against a live DB wiped dev/staging once |
3
+
4
+ <!-- nina:slot prisma.2 -->
5
+ | Write or audit a Prisma query (architect, implementer, the database gate, reviewer) | `prisma-client-api` | filters, operators, `$transaction` semantics. a caching or edge layer on top of the client is **NOT covered** — its cache strategy belongs to that layer's own integration doc |
@@ -18,7 +18,7 @@ import { existsSync } from 'node:fs';
18
18
  import { join, resolve, sep } from 'node:path';
19
19
  import { SLOT, closedGate, defaultedSlots, layerRootFor, noticeOf, readLayerText, stripWhy, walk } from './compose.mjs';
20
20
  import { PLACEHOLDER, defaultVocabulary } from '../vocabulary.mjs';
21
- import { NEEDS } from '../surfaces.mjs';
21
+ import { missingNeeds } from '../surfaces.mjs';
22
22
 
23
23
  /** Fields every declared integration must carry, and why each one matters. */
24
24
  const INTEGRATION_FIELDS = {
@@ -232,7 +232,8 @@ export async function check(argv, ctx) {
232
232
  }
233
233
  for (const s of new Set(surfaces)) {
234
234
  if (surfaces.filter((x) => x === s).length > 1) notes.push(`surface "${s}" is declared more than once`);
235
- if (NEEDS[s] && !surfaces.includes(NEEDS[s])) problems.push(`surface "${s}" is a stack of "${NEEDS[s]}", which this profile does not declare — its rules have nowhere to land`);
235
+ const missing = missingNeeds(s, surfaces);
236
+ if (missing.length > 0) problems.push(`surface "${s}" is a stack of "${missing.join('" and "')}", which this profile does not declare — its rules have nowhere to land`);
236
237
  }
237
238
 
238
239
  // What the project has chosen to decide later, and why: a vocabulary name, a document or a project slot,
@@ -281,9 +282,14 @@ export async function check(argv, ctx) {
281
282
  for (const [field, why] of Object.entries(INTEGRATION_FIELDS)) {
282
283
  if (!entry?.[field]) problems.push(`${label} has no "${field}" — it ${why}`);
283
284
  }
284
- if (entry?.kind && !KINDS.includes(entry.kind)) {
285
- problems.push(`${label} has kind "${entry.kind}" — expected one of ${KINDS.join(', ')}`);
285
+ // A client library over a platform binding is both kinds: its own behavior is cited from its installed
286
+ // source, the binding's from the emulator, and one kind left half its premises with no form of evidence.
287
+ const kinds = [entry?.kind].flat().filter((kind) => kind !== undefined && kind !== null && kind !== '');
288
+ if (Array.isArray(entry?.kind) && kinds.length === 0) problems.push(`${label} has no "kind" — it ${INTEGRATION_FIELDS.kind}`);
289
+ for (const kind of kinds) {
290
+ if (!KINDS.includes(kind)) problems.push(`${label} has kind "${kind}" — expected one of ${KINDS.join(', ')}, or a list of them`);
286
291
  }
292
+ if (new Set(kinds).size < kinds.length) notes.push(`${label} lists a kind more than once`);
287
293
  if (entry?.slug && !existsSync(join(target, '.claude', 'integrations', `${entry.slug}.md`))) {
288
294
  owe(`.claude/integrations/${entry.slug}.md`, `${label} has no doc at .claude/integrations/${entry.slug}.md — a premise has nowhere to live`);
289
295
  }
@@ -33,7 +33,7 @@ export { layerRootFor };
33
33
  * to write it nothing about what belongs there. Matching keys on the id, so a fragment
34
34
  * written without the label still fills the slot.
35
35
  */
36
- export const SLOT = /^<!-- nina:slot ([a-z-]+\.\d+)(?:\s+([^>]*?))?\s*-->$/;
36
+ export const SLOT = /^<!-- nina:slot ([a-z][a-z0-9-]*\.\d+)(?:\s+([^>]*?))?\s*-->$/;
37
37
 
38
38
  /** A passage that tells why a rule exists as history: kept in the layers, dropped from what is composed. */
39
39
  const WHY = /<!-- nina:why -->[\s\S]*?<!-- \/nina:why -->/g;
@@ -60,7 +60,7 @@ export function stripWhy(text, { keepLines = false } = {}) {
60
60
  * `integration-tester` because there is an external service. Composing them into a
61
61
  * project that declares neither would hand it a gate with nothing to gate.
62
62
  */
63
- export const REQUIRES = /^<!-- nina:requires ([a-z-]+) -->\n/;
63
+ export const REQUIRES = /^<!-- nina:requires ([a-z][a-z0-9-]*) -->\n/;
64
64
 
65
65
  /**
66
66
  * The surface a core file is gated on when the project does not declare it — the file is not composed there —
@@ -79,7 +79,7 @@ export function closedGate(text, surfaces) {
79
79
  * A slot inside a line — text before it, and the marker last. Filled with its fragment collapsed
80
80
  * to one line; dropped, like any slot, when its surface is not declared.
81
81
  */
82
- const INLINE_SLOT = /<!-- nina:slot ([a-z-]+\.\d+)(?:\s+[^>]*?)?\s*-->/g;
82
+ const INLINE_SLOT = /<!-- nina:slot ([a-z][a-z0-9-]*\.\d+)(?:\s+[^>]*?)?\s*-->/g;
83
83
 
84
84
  /**
85
85
  * Matches YAML frontmatter at the very start of a file.
@@ -21,7 +21,7 @@ import { join, resolve } from 'node:path';
21
21
  import { REQUIRES, SLOT, byVersion, closedGate, composedPaths, composeProject, defaultedSlots, layerRootFor, projectOwned, walk } from './compose.mjs';
22
22
  import { owedDocuments } from './check.mjs';
23
23
  import { PLACEHOLDER, defaultVocabulary } from '../vocabulary.mjs';
24
- import { DETECTABLE, NEEDS } from '../surfaces.mjs';
24
+ import { DETECTABLE, missingNeeds } from '../surfaces.mjs';
25
25
  import { bold, dim, green, pink } from '../look.mjs';
26
26
 
27
27
  /**
@@ -35,11 +35,13 @@ const QUESTIONS = {
35
35
  'external-api': 'Does it depend on anything whose behavior it does not define?',
36
36
  db: 'Does it own persistent data of its own?',
37
37
  prisma: 'Does it reach that data through Prisma?',
38
+ drizzle: 'Does it reach that data through Drizzle?',
38
39
  money: 'Does it conserve and distribute an amount — money in equals money out plus retained?',
39
40
  pii: 'Does it hold data about people that would harm someone specific if it leaked?',
40
41
  integrations: 'Does it depend on anything whose behavior it does not define?',
41
42
  frontend: 'Does it render a screen a person looks at?',
42
43
  'edge-cf': 'Does it run on Cloudflare Workers or Pages?',
44
+ d1: 'Does it keep that data in Cloudflare D1?',
43
45
  // Not "does it use blockchain" — that is a technology, and a technology is not a reason to
44
46
  // gate anything. What this surface costs is immutability: code that ships cannot be edited.
45
47
  blockchain: 'Does it deploy code that cannot be changed once it is live?',
@@ -59,7 +61,7 @@ function questionFor(surface) {
59
61
  * The order the interview asks in: the surfaces most projects have first, the rare ones last. Asked
60
62
  * alphabetically, the first question a web app met was whether it deploys immutable code.
61
63
  */
62
- const ASK_ORDER = ['db', 'prisma', 'frontend', 'integrations', 'pii', 'money', 'edge-cf', 'blockchain'];
64
+ const ASK_ORDER = ['db', 'prisma', 'drizzle', 'frontend', 'integrations', 'pii', 'money', 'edge-cf', 'd1', 'blockchain'];
63
65
 
64
66
  /**
65
67
  * The surfaces a core offers, in the order the interview asks them; one it does not know goes last.
@@ -223,7 +225,7 @@ async function interview(available, matched, impacts) {
223
225
  for (const [n, s] of order.entries()) {
224
226
  // A stack is asked about only where its concern was answered yes: asked whether data it does not
225
227
  // own goes through Prisma, a project has nothing true to answer.
226
- if (NEEDS[s] && !surfaces.includes(NEEDS[s])) continue;
228
+ if (missingNeeds(s, surfaces).length > 0) continue;
227
229
  const i = impacts[s];
228
230
  const reason = matched.find((d) => d.surface === s)?.why;
229
231
  // What a yes brings, in what a person would recognise: roles, rules, agents. The count of
@@ -15,7 +15,7 @@ import { describeMove, HARNESS, interruptedMove, movedFrom, moveJournal, readPro
15
15
  import { existsSync, lstatSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from 'node:fs';
16
16
  import { dirname, join, resolve } from 'node:path';
17
17
  import { REMOVED, composeProject, composedPaths, defaultedSlots, layerRootFor, walk } from './compose.mjs';
18
- import { NEEDS, detected } from '../surfaces.mjs';
18
+ import { detected, missingNeeds } from '../surfaces.mjs';
19
19
  import { filledSlots, projectSlots, referencedVocabulary } from './check.mjs';
20
20
  import { EXPECT_ENV } from '../expected.mjs';
21
21
  import { closeAnswered } from './learn.mjs';
@@ -297,7 +297,7 @@ export async function upgrade(argv, ctx) {
297
297
  // them in silence: the rules that were in its specs yesterday are not there after the move.
298
298
  const offeredBefore = (await surfacesIn(from.dir));
299
299
  const offered = detected(await walk(target)).filter(
300
- (d) => available.includes(d.surface) && !offeredBefore.includes(d.surface) && !surfaces.includes(d.surface) && (!NEEDS[d.surface] || kept.includes(NEEDS[d.surface])),
300
+ (d) => available.includes(d.surface) && !offeredBefore.includes(d.surface) && !surfaces.includes(d.surface) && missingNeeds(d.surface, kept).length === 0,
301
301
  );
302
302
 
303
303
  const [vocabBefore, vocabAfter] = [
package/src/surfaces.mjs CHANGED
@@ -12,17 +12,33 @@
12
12
  * `init`, `check` and `upgrade` all read this, so a surface's evidence and its prerequisite are stated once.
13
13
  */
14
14
 
15
+ /** A drizzle-kit config, which a Drizzle project usually has and nothing else names so. */
16
+ const DRIZZLE_CONFIG = /(^|\/)drizzle\.config\.[cm]?[jt]s$/;
17
+
15
18
  /** Surfaces a repository reveals by its files. The rest are claims about the domain. */
16
19
  export const DETECTABLE = [
17
- { surface: 'db', why: 'a Prisma schema', test: (f) => f.some((p) => p.endsWith('schema.prisma')) },
20
+ { surface: 'db', why: 'a Prisma schema or a drizzle-kit config', test: (f) => f.some((p) => p.endsWith('schema.prisma') || DRIZZLE_CONFIG.test(p)) },
18
21
  { surface: 'prisma', why: 'a Prisma schema', test: (f) => f.some((p) => p.endsWith('schema.prisma')) },
22
+ { surface: 'drizzle', why: 'a drizzle-kit config', test: (f) => f.some((p) => DRIZZLE_CONFIG.test(p)) },
19
23
  { surface: 'edge-cf', why: 'a wrangler config', test: (f) => f.some((p) => /(^|\/)wrangler\.(toml|jsonc?)$/.test(p)) },
20
24
  { surface: 'frontend', why: 'a Vite config', test: (f) => f.some((p) => /(^|\/)vite\.config\.[cm]?[jt]s$/.test(p)) },
21
25
  { surface: 'blockchain', why: 'a Foundry or Hardhat config', test: (f) => f.some((p) => /(^|\/)(foundry\.toml|hardhat\.config\.[cm]?[jt]s)$/.test(p)) },
22
26
  ];
23
27
 
24
- /** A stack surface, and the concern it is a stack of: declared without it, its rules have nowhere to land. */
25
- export const NEEDS = { prisma: 'db' };
28
+ /**
29
+ * A stack surface, and every surface it is a stack of: declared without one of them, its rules have nowhere
30
+ * to land. Most stacks need one concern; an engine that only runs on one platform needs the platform too.
31
+ */
32
+ export const NEEDS = { prisma: ['db'], drizzle: ['db'], d1: ['db', 'edge-cf'] };
33
+
34
+ /**
35
+ * What a stack needs that a profile does not declare — empty for a surface that is not a stack.
36
+ *
37
+ * @param {string} surface - The surface asked about.
38
+ * @param {string[]} declared - The surfaces declared, or answered yes so far.
39
+ * @returns {string[]}
40
+ */
41
+ export const missingNeeds = (surface, declared) => (NEEDS[surface] ?? []).filter((need) => !declared.includes(need));
26
42
 
27
43
  /**
28
44
  * The surfaces a project's files reveal, with the evidence for each.