@starci/eslint-grammar-offset-pop 0.15.8 → 0.15.11

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/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.15.11 - 2026-10-29
4
+
5
+ - Changed: the peer moves to the 0.15.11 cohort; the bundled slot manifest 3.9.0 replaces the lite `app.supabase*` slots with `app.db` (`db/migrations`, `db/migrations/archive`, `db/seed.sql`, the managed `db/bootstrap.sql`), `be.integrations.supabase` with `be.integrations.passport` and `be.integrations.object-storage`, removes `fe.route.callback`, sets lite `schemaAuthority: sql`, gives lite TypeORM entities in `be.persistence`, adds `ruleParams.be.dbFunctions`, and moves the S3 SDKs to `integrations/object-storage` and the identity libraries to `integrations/passport` in `infraOwners` (`@supabase/*`, `minio` and `bcrypt` nowhere); the bundled rule catalog retires R216, R217, R219, R254 and R287 and adds R328-R334; the bundled canon pins name hfs 4.10.0, eslint-canon-be 3.7.0, eslint-canon-fe 9.5.0 and the Grammar family 0.15.11, pin `@nestjs/passport` 11.0.5 (CommonJS on the Nest 11 line), `passport` 0.7.0, `passport-google-oauth20` 2.0.0, `passport-local` 1.0.0, `bcryptjs` 3.0.3 and their types (tokens are signed and verified with `jose`; `@nestjs/jwt` stays allowed in `integrations/passport` but unpinned), and drop `@supabase/ssr`, `@supabase/supabase-js` and the `supabase` CLI. No rule changed.
6
+
7
+
8
+ ## 0.15.10 - 2026-10-29
9
+
10
+ - Changed: `@starci/eslint-grammar-core` 0.15.10 is the peer dependency; the bundled slot manifest gives the model libraries their owners in `ruleParams.be.infraOwners` (`@starci/ai-router` to `integrations/ai-gateway`, `@langchain/*` to `integrations/ai`; `openai`, `langchain`, `@langchain/langgraph`, `@langchain/community` and the provider SDKs nowhere) and lists R326 and R327 on `be.integrations`; the bundled canon pins name hfs 4.9.11, eslint-canon-be 3.6.8, eslint-canon-fe 9.4.9, the Grammar family 0.15.10 (grammar, eslint-grammar-core, eslint-grammar-offset-pop), and pin `@langchain/core` 1.3.1 and `@langchain/openai` 1.8.0. No rule changed.
11
+
12
+ ## 0.15.9 - 2026-10-29
13
+
14
+ - Changed: `@starci/eslint-grammar-core` 0.15.9 is the peer dependency; the bundled canon pins name hfs 4.9.10, eslint-canon-be 3.6.7, eslint-canon-fe 9.4.8, eslint-grammar-core 0.15.9 and eslint-grammar-offset-pop 0.15.9. No rule changed.
15
+
3
16
  ## 0.15.8 - 2026-10-29
4
17
 
5
18
  - Changed: versioned together with Grammar 0.15.8; `@starci/eslint-grammar-core` 0.15.8 is the peer dependency, so Offset Pop apps inherit R325's segment layout `Page` and the layout owner checks; the bundled canon pins name the Grammar family 0.15.8 (grammar, eslint-grammar-core, eslint-grammar-offset-pop), eslint-canon-fe 9.4.7 and eslint-canon-be 3.6.6.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@starci/eslint-grammar-offset-pop",
3
- "version": "0.15.8",
3
+ "version": "0.15.11",
4
4
  "description": "Offset Pop Grammar lint: the inherited Common component contract over its own visual family.",
5
5
  "keywords": [
6
6
  "eslint",
@@ -44,7 +44,7 @@
44
44
  "peerDependencies": {
45
45
  "eslint": ">=9",
46
46
  "typescript": ">=5.9",
47
- "@starci/eslint-grammar-core": "0.15.8"
47
+ "@starci/eslint-grammar-core": "0.15.11"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@starci/eslint-canon-fe": "file:../eslint-canon-fe",
@@ -31,35 +31,35 @@ pins:
31
31
  source: packages/event-stream/package.json
32
32
  why: 'the one server-sent-events client of every front end (fe-stack event-stream, owner:event-stream-package): the transport client layer (modules/api/sse/clients) creates one instance for the app with the bearer token source and the stream operations follow on it; it carries Last-Event-ID resume, the capped doubling backoff, the heartbeat timeout, the single 401 renewal and the useSWRSubscription adapter, so no app keeps a hand-written reader.'
33
33
  '@starci/grammar':
34
- version: 0.15.8
34
+ version: 0.15.11
35
35
  group: starci
36
36
  install: registry
37
37
  side: fe
38
38
  source: packages/grammar/package.json
39
39
  why: 'the grammar front ends read: the brand layer sets `--font-sans` and `--font-mono` and the grammar reads them; it carries the Input tel kind, the copyable and read-only Input, the IconButton disclosure props and count badge, ChatBubble, FillViewport, Textarea mentions and Enter-to-send, the leading PrimaryRailLayout rail, the plate-less Image, ListRow, the soft Alert, Progress steps, the floating primary IconButton, FlowGraph, the STATE-8 loading views and the bordered selectable TagGroup chips. The runtime source version wins for a @starci package.'
40
40
  '@starci/eslint-canon-be':
41
- version: 3.6.6
41
+ version: 3.7.0
42
42
  group: starci
43
43
  install: registry
44
44
  side: be
45
45
  source: packages/eslint-canon-be/package.json
46
46
  why: 'the back-end ESLint canon: `loadHfs(import.meta.url)` of be/eslint.config.mjs finds the app-root hfs.json (kind app) and gives every linted file the view of the be side, and the project graph is built per side; its bundled runtime copies (slots, canon-pins, failure codes, the architecture machine) put .starcistacks and .sops.yaml at the app root; `starciBeConfig({ hfs: loadHfs(import.meta.url) })` is the typed factory and the BE-CONVENTION laws are its rules.'
47
47
  '@starci/eslint-canon-fe':
48
- version: 9.4.7
48
+ version: 9.5.0
49
49
  group: starci
50
50
  install: registry
51
51
  side: fe
52
52
  source: packages/eslint-canon-fe/package.json
53
53
  why: 'the front-end ESLint canon: `loadHfs(import.meta.url)` of fe/eslint.config.mjs finds the app-root hfs.json (kind app) and gives every linted file the view of the fe side, and the project graph is built per side; its bundled runtime copies (slots, canon-pins, failure codes, the architecture machine) put .starcistacks and .sops.yaml at the app root; the front end has no tests (FE_NO_TESTS R97 in hfs) and no-vietnamese-in-source (R91) applies.'
54
54
  '@starci/eslint-grammar-core':
55
- version: 0.15.8
55
+ version: 0.15.11
56
56
  group: starci
57
57
  install: registry
58
58
  side: fe
59
59
  source: packages/eslint-grammar-core/package.json
60
60
  why: 'the StarCi Grammar component API lint, versioned with @starci/grammar; front ends compose this family package with the universal FE canon.'
61
61
  '@starci/eslint-grammar-offset-pop':
62
- version: 0.15.8
62
+ version: 0.15.11
63
63
  group: starci
64
64
  install: registry
65
65
  side: fe
@@ -85,12 +85,12 @@ pins:
85
85
  side: both
86
86
  source: packages/prettier-config/package.json
87
87
  '@starci/jest-preset':
88
- version: 2.4.1
88
+ version: 2.5.0
89
89
  group: starci
90
90
  install: registry
91
91
  side: be
92
92
  source: packages/jest-preset/package.json
93
- why: 'the Jest preset of a back end: the world runner runs up to min(--maxWorkers, slots) world files at once, each in its own process bound to one data slot of the test world (STARCI_TEST_WORLD_SLOT), and reads test-world state protocol 2 only: it pairs exactly with @starci/test-world, and any other state file is JEST_PRESET_WORLD_PAIR_MISMATCH. The unit run writes the lcov Sonar and Codecov import (services only); the integration, e2e and contract projects run every spec file in a worker process of its own (world-runner.cjs), so a process-global framework registry (@nestjs/graphql type metadata) never leaks between e2e files; it ships the unit kit (mockEntityManager, fakeTransaction, fakeIds, FakeClock, Outcome matchers) and the recordingOutbox claim side.'
93
+ why: 'the Jest preset of a back end: the world runner runs up to min(--maxWorkers, slots) world files at once, each in its own process bound to one data slot of the test world (STARCI_TEST_WORLD_SLOT), and reads test-world state protocol 2 only: it pairs exactly with @starci/test-world, and any other state file is JEST_PRESET_WORLD_PAIR_MISMATCH. The unit run writes the lcov Sonar and Codecov import (services only); the integration, e2e and contract projects run every spec file in a worker process of its own (world-runner.cjs), so a process-global framework registry (@nestjs/graphql type metadata) never leaks between e2e files; it ships the unit kit (mockEntityManager, fakeTransaction, fakeQueryBuilder, queueQueryBuilders, fakeIds, FakeClock, Outcome matchers) and the recordingOutbox claim side.'
94
94
  '@starci/test-world':
95
95
  version: 1.2.3
96
96
  group: starci
@@ -106,7 +106,7 @@ pins:
106
106
  source: packages/ai-router/package.json
107
107
  why: 'the AI pool router of a back end: a NestJS module that routes OpenAI-compatible chat, stream and embeddings calls across keys, models and providers, with @starci/ai-router/testing for its specs; @starci/jest-preset compiles it as an ESM-only dependency.'
108
108
  '@starci/hfs':
109
- version: 4.9.9
109
+ version: 4.10.0
110
110
  group: starci
111
111
  install: registry
112
112
  side: both
@@ -241,6 +241,16 @@ pins:
241
241
  group: framework
242
242
  side: be
243
243
  why: readiness probes with dependency indicators use Terminus (the liveness route of the scaffolded skeleton does not, being a thin door over the liveness service); every measured product back end resolves 11.1.1.
244
+ '@langchain/core':
245
+ version: 1.3.1
246
+ group: framework
247
+ side: be
248
+ why: 'the LangChain core of the one AI integration (BE-AI-3): prompt templates, output parsers, runnables and BaseRetriever; @langchain/openai takes it as its peer. The registry latest on 2026-10-29.'
249
+ '@langchain/openai':
250
+ version: 1.8.0
251
+ group: framework
252
+ side: be
253
+ why: 'ChatOpenAI and OpenAIEmbeddings of the one AI integration, pointed at the ai-router gateway with a virtual key (BE-AI-1, BE-AI-3, R327); peer @langchain/core ^1.3.1. The registry latest on 2026-10-29.'
244
254
  '@nestjs/cqrs':
245
255
  version: 11.0.3
246
256
  group: framework
@@ -533,7 +543,7 @@ pins:
533
543
  version: 3.1150.0
534
544
  group: framework
535
545
  side: be
536
- why: 'the S3 transport of integrations/object-storage, the one ObjectStorage adapter of both editions (MinIO, S3, Spaces, Supabase Storage); 3.1150.0 is the release of 2026-10-12, chosen over newer ones that had not aged two weeks.'
546
+ why: 'the S3 transport of integrations/object-storage, the one ObjectStorage adapter of both editions (MinIO, S3, Spaces); 3.1150.0 is the release of 2026-10-12, chosen over newer ones that had not aged two weeks.'
537
547
  '@aws-sdk/s3-request-presigner':
538
548
  version: 3.1150.0
539
549
  group: framework
@@ -584,27 +594,47 @@ pins:
584
594
  group: framework
585
595
  side: be
586
596
  why: 'the Express 5 integration @nestjs/apollo loads at boot (R111 nestjs-apollo-express5, knowledge/hfs/peer-integrations.yaml); every api app that serves GraphQL installs it; the latest registry version on 2026-10-13.'
587
- # --- Supabase lite
588
- '@supabase/ssr':
589
- version: 0.12.7
597
+ # --- lite identity (integrations/passport, ruling lite-self-hosted-postgres-passport-minio)
598
+ '@nestjs/passport':
599
+ version: 11.0.5
590
600
  group: framework
591
- side: fe
592
- why: the one server/browser client factory for a lite Next app; exact version registry-checked for the lite scaffold.
593
- '@supabase/supabase-js':
594
- version: 2.117.2
601
+ side: be
602
+ why: 'PassportStrategy of integrations/passport; 11.0.5 is CommonJS on the Nest 11 line (12.0.0 is ESM-only and breaks Nest 11 jest under the CommonJS transform of @starci/jest-preset), as nivo-lite runs it.'
603
+ passport:
604
+ version: 0.7.0
595
605
  group: framework
596
- side: both
597
- why: the generated Database-typed client used by the FE data owner and the BE Auth/Storage integration.
606
+ side: be
607
+ why: the strategy runtime under @nestjs/passport (its peer range ^0.5 || ^0.6 || ^0.7).
608
+ passport-google-oauth20:
609
+ version: 2.0.0
610
+ group: framework
611
+ side: be
612
+ why: Google OAuth 2.0 (authorization code with state and PKCE) of integrations/passport.
613
+ passport-local:
614
+ version: 1.0.0
615
+ group: framework
616
+ side: be
617
+ why: the email and password strategy of integrations/passport.
618
+ bcryptjs:
619
+ version: 3.0.3
620
+ group: framework
621
+ side: be
622
+ why: 'bcrypt in pure JavaScript (no native build on the alpine image); verifies the $2a$/$2b$ hashes auth.users carries over.'
623
+ '@types/passport-google-oauth20':
624
+ version: 2.0.17
625
+ group: framework
626
+ side: be
627
+ why: types of passport-google-oauth20.
628
+ '@types/passport-local':
629
+ version: 1.0.38
630
+ group: framework
631
+ side: be
632
+ why: types of passport-local.
598
633
  jose:
599
634
  version: 6.2.12
600
635
  group: framework
601
636
  side: be
602
- why: verifies Supabase access tokens against the project JWKS with issuer, audience, expiry and algorithm checks.
603
- supabase:
604
- version: 2.119.0
605
- group: tooling
606
- side: both
607
- why: the root CLI wrapper owns local schema lifecycle and generates the committed database types.
637
+ why: signs the app's own ES256 access tokens and verifies them against its own key set (createLocalJWKSet) in integrations/passport.
608
638
  class-transformer:
609
639
  version: 0.5.1
610
640
  group: framework
@@ -7,7 +7,7 @@
7
7
  # catalog READ this file through scripts/hfs/slots.mjs; none of them hardcodes a path.
8
8
  # Shape: modules/schemas/hfs-slots.schema.yaml. The repository side is hfs.json: modules/schemas/hfs-repo.schema.yaml.
9
9
  schema: starci/hfs-slots@3
10
- version: 3.7.0
10
+ version: 3.9.0
11
11
 
12
12
  versioning:
13
13
  # MAJOR.MINOR.PATCH of this manifest. A repository pins only the MAJOR in hfs.json ("hfs": 3).
@@ -38,6 +38,9 @@ versioning:
38
38
  # or environment reads (BE_APP_OPTIONS_COMPOSITION). Secrets use EnvSource.secret(): <NAME>_FILE first, plain <NAME> only
39
39
  # when the file key is absent; .starcistacks owns custody. Capability <capability>.config.ts roles stay unchanged.
40
40
  # 3.3.0 is a minor (alpha.16): it ADDS the optional app.ci-stack-deploy slot, the managed workflow of the starci app stack verbs.
41
+ # 3.9.0 (ruling:lite-self-hosted-postgres-passport-minio, 2026-10-29) is a major for lite and changes no full slot but the S3 owner's
42
+ # folder: lite leaves Supabase. The app.supabase* and be.integrations.supabase slots and fe.route.callback are removed; app.db (db/, its
43
+ # migrations, archive, seed and managed bootstrap), be.integrations.passport and be.integrations.object-storage are added; lite's schemaAuthority is sql.
41
44
  # 3.4.0 is a minor (alpha.25): it ADDS the opt-in be.contract.mcp-tools slot, the committed MCP tool-catalog snapshot of an app.
42
45
  # 3.5.0 is a minor (alpha.27): it ADDS the opt-in app.browser-config slot, the managed browser/tsconfig.json that type-checks the browser
43
46
  # journey (enabled with app.browser by `browser: true`).
@@ -102,34 +105,34 @@ versioning:
102
105
  # requiredInstances, why), each shaped as the same field in the slot body; every other field is the edition's.
103
106
  # `why` under lite names the adapter behind the slot's ports (pgmq, Postgres locks, in-process socket.io).
104
107
  # `tests` is never overlaid: a lite slot owes exactly the unit specs its full slot owes.
105
- # provider the hfs.json connections[].provider that enables this opt-in slot (supabase); never an app kind.
108
+ # provider the hfs.json connections[].provider that enables this opt-in slot (postgres); never an app kind.
106
109
  # since the manifest version that introduced the slot.
107
110
  presenceValues: [required, optional, opt-in, forbidden]
108
111
  trackedValues: [tracked, ignored, external]
109
112
  testValues: [unit-beside, e2e, none]
110
113
 
111
114
  # The editions a repository declares in hfs.json `edition` (absent means full). ruling:R212/case-2 (owner:lite-production-swarm) (with the Work boundary amended by ruling:R212/case-4): lite IS
112
- # the full architecture with Supabase backing services - the same monorepo, slots, CQRS shape and patterns (queue,
115
+ # the full architecture on its own self-hosted PostgreSQL (ruling:lite-self-hosted-postgres-passport-minio) - the same monorepo, slots, CQRS shape and patterns (queue,
113
116
  # event bus, saga, reactors, projection, realtime, webhooks, fenced job), declared in hfs.json the same way, and the same unit
114
117
  # specs (unitRoles, logicRoles, 100 per file, @starci/jest-preset doubles, builders). What differs is ADAPTERS and DELIVERY
115
- # (ruling:R212/case-10): schema authority in supabase/migrations, the queue port on BullMQ over the Redis hfs.json
118
+ # (ruling:R212/case-10): schema authority in db/migrations, the queue port on BullMQ over the Redis hfs.json
116
119
  # sides.be.backing declares (as in full, fed by the Postgres outbox), event-bus ports on pgmq-backed topics or in-process
117
120
  # delivery, cache and locks on Postgres or the declared Redis, schedules on pg_cron (+ pg_net) enqueueing through the queue
118
- # outbox, storage and auth on Supabase. Realtime uses SSE or the socket.io gateway
121
+ # outbox, storage on S3-compatible MinIO (integrations/object-storage) and auth through integrations/passport. Realtime uses SSE or the socket.io gateway
119
122
  # in the api process, which scales horizontally and stateless (memory hub for one replica or tests; the Redis hub and @socket.io/redis-adapter when Redis is declared, else the Postgres hub and @socket.io/postgres-adapter, for N replicas; websocket only, no sticky sessions). Integration and provider sandbox contract specs are optional;
120
123
  # declared patterns owe their integration proofs (R284). Lite has no e2e world. Production uses declared docker-swarm under
121
- # .starcistacks/production/infra/swarm/ (owner ruling 2026-10-14); lite runs no self-hosted database, and runs only the backing
122
- # services sides.be.backing declares. The front end is full's (R97).
124
+ # .starcistacks/production/infra/swarm/ (owner ruling 2026-10-14); lite runs its PostgreSQL as the db service of its
125
+ # stack and only the backing services sides.be.backing declares. The front end is full's (R97).
123
126
  # Lite is this same manifest filtered: a slot whose `editions` lacks lite does not exist for a lite app, `litePresence` replaces
124
127
  # presence and a `lite` map replaces the fields it names. The edition is chosen once at scaffold; there is no upgrade
125
128
  # or downgrade between lite and full. Lite contracts are allowed (owner decision 2026-10-14).
126
129
  editions: [full, lite]
127
130
 
128
131
  # The two sides of an app: the folder of each is its profile name (be/, fe/). `reads` lists the only paths of the OTHER side a side
129
- # may read (hfs.json sides.<side>.reads names a subset), or a tree an app-root slot owns (supabase/types/); nothing else crosses sides.
132
+ # may read (hfs.json sides.<side>.reads names a subset), or a tree an app-root slot owns; nothing else crosses sides.
130
133
  sides:
131
- be: {reads: [supabase/types/]} # the generated Database types of a Supabase connection (server code types its PostgREST calls)
132
- fe: {reads: [be/contracts/, supabase/types/]} # be/contracts/: the committed contract snapshots, the input of the front end's codegen; supabase/types/: the same generated types
134
+ be: {reads: []}
135
+ fe: {reads: [be/contracts/]} # be/contracts/: the committed contract snapshots, the input of the front end's codegen
133
136
 
134
137
  # The trigger kinds of the back end's features: what starts the work of a feature. A feature slot names its kind in `trigger`; no kind imports another
135
138
  # (BE_KIND_ISOLATION), every cross-kind call is an event on the bus, and only be/apps/* compose features.
@@ -192,9 +195,9 @@ crossApp: apps never import each other; shared code is a packages/<pkg> slot.
192
195
  ruleParams:
193
196
  db:
194
197
  # R259: btree_gist supplies UUID equality for the booking interval exclusion constraint.
195
- # R259: unaccent is a first-party Supabase extension used by Vietnamese-content search functions.
198
+ # R259: unaccent ships in the supabase/postgres image of the db service, used by Vietnamese-content search functions.
196
199
  extensions: [pgmq, pg_cron, pgcrypto, pg_trgm, vector, uuid-ossp, pg_net, supabase_vault, unaccent, btree_gist]
197
- # R258 DB_CRON_OWNED: THE queue outbox of a Supabase schema (the relay hands its unsent rows to BullMQ, ruling:R212/case-10). A pg_cron
200
+ # R258 DB_CRON_OWNED: THE queue outbox of a lite schema (the relay hands its unsent rows to BullMQ, ruling:R212/case-10). A pg_cron
198
201
  # job enqueues only by inserting one row into this table, writing only these columns, one of which is `queue`.
199
202
  queueOutbox: {table: public.queue, columns: [queue, payload, created_at, correlation_id]}
200
203
  common:
@@ -218,8 +221,18 @@ ruleParams:
218
221
  "node:https": [platform/http]
219
222
  http: [platform/http]
220
223
  https: [platform/http]
221
- "@aws-sdk/client-s3": [integrations/object-storage] # the ObjectStorage port: one S3 adapter for MinIO, S3, Spaces and Supabase Storage
224
+ "@aws-sdk/client-s3": [integrations/object-storage] # the ObjectStorage port: one S3 adapter for MinIO, S3 and Spaces (R331)
222
225
  "@aws-sdk/s3-request-presigner": [integrations/object-storage]
226
+ minio: [] # storage goes through the S3 client of integrations/object-storage
227
+ "@supabase": [] # no Supabase client in a back end
228
+ "@nestjs/passport": [integrations/passport] # the identity libraries (R328)
229
+ passport: [integrations/passport]
230
+ passport-google-oauth20: [integrations/passport]
231
+ passport-local: [integrations/passport]
232
+ "@nestjs/jwt": [integrations/passport]
233
+ jose: [integrations/passport]
234
+ bcryptjs: [integrations/passport]
235
+ bcrypt: []
223
236
  cache-manager: [integrations/cache, integrations/redis]
224
237
  "@nestjs/cache-manager": [integrations/cache, integrations/redis] # the CACHE_MANAGER token: caching goes through the cache capability
225
238
  redis: [integrations/cache, integrations/redis]
@@ -254,6 +267,25 @@ ruleParams:
254
267
  "@socket.io/postgres-adapter": [platform/realtime] # the stateless socket.io adapter of a scaled lite back end without Redis
255
268
  "@socket.io/redis-adapter": [platform/realtime] # the sharded socket.io adapter of a scaled back end on the declared Redis
256
269
  pg: [platform/realtime] # the LISTEN connection of the Postgres hub; every other query goes through TypeORM
270
+ # BE-AI-1, BE-AI-3: every model call goes through the ai-router gateway. Its custody owner registers @starci/ai-router with the
271
+ # provider keys; the one LangChain integration owns @langchain/*; no provider SDK, openai client or agent framework is imported.
272
+ "@starci/ai-router": [integrations/ai-gateway]
273
+ "@starci/ai-router/testing": [integrations/ai-gateway, integrations/ai] # the fake provider a spec of either side boots the gateway with
274
+ "@langchain": [integrations/ai] # a scope key: every @langchain/* package
275
+ "@langchain/langgraph": [] # an agent loop runs in the agent runtime, never in code
276
+ "@langchain/community": [] # retrieval reads the app's own persistence through its owner
277
+ langchain: [] # createAgent is an agent loop
278
+ openai: [] # code calls models through @langchain/openai
279
+ "@anthropic-ai/sdk": []
280
+ "@google/genai": []
281
+ "@google/generative-ai": []
282
+ "@mistralai/mistralai": []
283
+ "@openrouter/ai-sdk-provider": []
284
+ "@ai-sdk": []
285
+ ai: []
286
+ cohere-ai: []
287
+ groq-sdk: []
288
+ ollama: []
257
289
  # R87 BE_CQRS_SHAPE no-event-bus: the in-process event vocabulary the rule refuses. `imports` maps a module
258
290
  # specifier to the member names that are an in-process event; `[]` flags the package itself (its emitter packages
259
291
  # are the `[]` owners of infraOwners above). `classes` maps a module specifier to the class names that are an
@@ -372,21 +404,41 @@ ruleParams:
372
404
  # end may declare in hfs.json sides.be.backing. `clients` are the libraries that consume the service: one of them as a dependency
373
405
  # is its consumer, and under lite none of them may be a dependency while the service is undeclared. `patterns` are the declared
374
406
  # patterns that need the service. `images` are the image repositories (the last path segment) a stack runs it from.
375
- # `editions` limits admission: owner:lite-vector-is-pgvector keeps vector search on Supabase pgvector in lite.
407
+ # `editions` limits admission: owner:lite-vector-is-pgvector keeps vector search on pgvector in lite.
376
408
  backing:
377
409
  redis: {clients: [bullmq, "@nestjs/bullmq", bull, "@nestjs/bull", ioredis, redis, "@keyv/redis", cache-manager-redis-yet, cache-manager-ioredis-yet, "@socket.io/redis-adapter"], patterns: [queue, fenced-job], images: [redis, redis-stack, redis-stack-server]}
378
410
  qdrant: {clients: ["@qdrant/js-client-rest", "@qdrant/qdrant-js"], patterns: [], images: [qdrant], editions: [full]}
379
411
  # Edition lite (ruleParams(manifest, 'be', 'lite') merges these keys over the base; a map merges one level deep): the schema
380
- # authority is the Supabase migration tree (supabase/migrations/*.sql, forward-only), so a lite back end holds no TypeORM
412
+ # authority is the SQL migration tree (db/migrations/*.sql, forward-only), so a lite back end holds no TypeORM
381
413
  # migration or entity under be/ (R34/R35 read schemaAuthority; be.persistence's lite overlay allows neither). The unit roles,
382
414
  # logic roles and spec doubles are full's (owner ruling 2026-10-12 (owner:lite-production-swarm), with the Work boundary amended by ruling:R212/case-4). infraOwners: full's owners,
383
415
  # bullmq in platform/queue and ioredis/redis in integrations/cache and integrations/redis (ruling:R212/case-10: the queue is
384
416
  # Redis in both editions; a backing library is legal only when hfs.json sides.be.backing declares its service, which
385
- # HFS_BACKING_UNDECLARED checks), except Kafka, which is owned nowhere (platform/event-bus runs Supabase Queues (pgmq) through
417
+ # HFS_BACKING_UNDECLARED checks), except Kafka, which is owned nowhere (platform/event-bus runs pgmq queues through
386
418
  # the shared EntityManager); realtime is the same socket.io gateway as full, run inside the api process, scaled horizontally and stateless (hub redis when
387
419
  # Redis is declared, else hub postgres with @socket.io/postgres-adapter; no sticky sessions).
420
+ # R334: the database functions code may call through platform/database's callDbFunction, advisoryXactLock and notify helpers,
421
+ # each {name, reason}; the canon lists the pg built-ins it uses itself, and an app adds its own in hfs.json sides.be.dbFunctions.
422
+ dbFunctions:
423
+ - {name: pg_advisory_xact_lock, reason: "advisoryXactLock: a transaction-scoped lock TypeORM has no API for"}
424
+ - {name: hashtextextended, reason: "advisoryXactLock: the 64-bit key of a text lock name"}
425
+ - {name: pg_notify, reason: "notify: LISTEN/NOTIFY of the Postgres realtime hub"}
426
+ - {name: to_regproc, reason: "callDbFunction: whether an optional database function exists"}
427
+ - {name: job_claim, reason: "platform/jobs (add job, lite): the fenced claim upsert of jobs.sql"}
428
+ - {name: job_advance, reason: "platform/jobs (add job, lite): the token-guarded step write of jobs.sql"}
429
+ - {name: job_complete, reason: "platform/jobs (add job, lite): the token-guarded completion of jobs.sql"}
430
+ - {name: job_fail, reason: "platform/jobs (add job, lite): the token-guarded failure of jobs.sql"}
431
+ - {name: queue_write, reason: "platform/queue (add queue, lite): the outbox insert of queue-outbox.sql"}
432
+ - {name: queue_waiting, reason: "platform/queue (add queue, lite): the relay read FOR UPDATE SKIP LOCKED of queue-outbox.sql"}
433
+ - {name: queue_mark_sent, reason: "platform/queue (add queue, lite): the relay mark of queue-outbox.sql"}
434
+ - {name: inbox_claim_event, reason: "platform/inbox (add webhook, lite): the conflict-safe delivery claim"}
435
+ - {name: inbox_claim_client, reason: "platform/inbox (add webhook, lite): the client claim upsert returning its committed outcome"}
436
+ - {name: inbox_save_client_outcome, reason: "platform/inbox (add webhook, lite): the saved client outcome"}
437
+ - {name: inbox_sweep_clients, reason: "platform/inbox (add webhook, lite): the bounded retention sweep FOR UPDATE SKIP LOCKED"}
438
+ - {name: event_bus_write, reason: "platform/event-bus (add webhook, lite): the typed envelope insert of the outbox"}
439
+
388
440
  lite:
389
- schemaAuthority: supabase
441
+ schemaAuthority: sql
390
442
  infraOwners:
391
443
  kafkajs: []
392
444
  "@qdrant/js-client-rest": []
@@ -416,7 +468,7 @@ slots:
416
468
  - id: app.package-manifest
417
469
  since: 3.1.0
418
470
  profiles: [app]
419
- editionWhy: "ruling:R212/case-2 (with the Work boundary amended by ruling:R212/case-4): lite manages Supabase and wiring scripts; full also manages e2e and stack test scripts. Both may run optional contracts."
471
+ editionWhy: "ruling:R212/case-2 (with the Work boundary amended by ruling:R212/case-4): lite manages its database and wiring scripts; full also manages e2e and stack test scripts. Both may run optional contracts."
420
472
  # The one package.json of the app, at the app root: be's dependencies and every tool, and every script; npm workspaces are
421
473
  # exactly fe/apps/* and fe/packages/* (HFS_MONO_WORKSPACES), each with its own package.json. be has no package.json of its own.
422
474
  path: package.json
@@ -485,7 +537,7 @@ slots:
485
537
  - id: app.format-config
486
538
  since: 3.1.0
487
539
  profiles: [app]
488
- editionWhy: "ruling:R212/case-2 (with the Work boundary amended by ruling:R212/case-4): lite additionally ignores Supabase-generated row types when formatting; full has its TypeORM schema authority."
540
+ editionWhy: "ruling:R212/case-2 (with the Work boundary amended by ruling:R212/case-4): lite additionally ignores the generated database row types when formatting; full has its TypeORM schema authority."
489
541
  # The one formatter configuration of the app (prettier walks up from every file of both sides to it): .prettierrc names
490
542
  # @starci/prettier-config, .prettierignore is the template.
491
543
  path: "{.prettierrc,.prettierignore}"
@@ -494,7 +546,7 @@ slots:
494
546
  tier: none
495
547
  tests: none
496
548
  managedBy: tool-config
497
- liteManagedBy: tool-config-lite # the same files plus the generated supabase/types, which the Supabase CLI writes unformatted
549
+ liteManagedBy: tool-config-lite # the same files as full
498
550
  rules: [HFS_MANAGED_FILE_DRIFT, HFS_TOOL_CONFIG_LOCAL]
499
551
  - id: app.tool-config-optional
500
552
  since: 3.1.0
@@ -537,7 +589,7 @@ slots:
537
589
  - id: app.ci
538
590
  since: 3.1.0
539
591
  profiles: [app]
540
- editionWhy: "ruling:R212/case-2 (with the Work boundary amended by ruling:R212/case-4): lite CI proves boot through R272 wiring and checks Supabase artifacts; full also provides its e2e lane."
592
+ editionWhy: "ruling:R212/case-2 (with the Work boundary amended by ruling:R212/case-4): lite CI proves boot through R272 wiring and checks its database artifacts; full also provides its e2e lane."
541
593
  path: ".github/workflows/ci.yml"
542
594
  presence: required
543
595
  tracked: tracked
@@ -562,7 +614,7 @@ slots:
562
614
  - id: app.ci-images
563
615
  since: 3.1.0
564
616
  profiles: [app]
565
- editionWhy: "ruling:R212/case-2 (with the Work boundary amended by ruling:R212/case-4): lite renders its Supabase-backed image workflow; full renders images for its separately deployed services."
617
+ editionWhy: "ruling:R212/case-2 (with the Work boundary amended by ruling:R212/case-4): lite renders its image workflow; full renders images for its separately deployed services."
566
618
  # Builds every image of the app (one matrix entry per declared app, path-filtered), never pushes: rendered by starci app sync.
567
619
  path: ".github/workflows/images.yml"
568
620
  presence: required
@@ -577,7 +629,7 @@ slots:
577
629
  exemplifiedBy:
578
630
  - packages/hfs/templates/app/ci-workflows-lite/github/workflows/db-deploy.yml
579
631
  - {path: packages/hfs/src/hfs-release-provenance.spec.mjs, edition: full}
580
- editionWhy: "ruling:R212/case-2 (with the Work boundary amended by ruling:R212/case-4): lite manages its Supabase database deploy workflow; full owns an optional provider-specific workflow."
632
+ editionWhy: "ruling:R212/case-2 (with the Work boundary amended by ruling:R212/case-4): lite manages its database deploy workflow; full owns an optional provider-specific workflow."
581
633
  # The database deploy workflow: workflow_dispatch only (like app.ci-e2e); starci app sync renders it under the managed ci group.
582
634
  path: ".github/workflows/db-deploy.yml"
583
635
  presence: optional
@@ -615,7 +667,7 @@ slots:
615
667
  since: 3.1.0
616
668
  profiles: [app]
617
669
  # Production delivery tooling for the app's own processes: compose files, Caddyfile, *.env.example and ops shell scripts.
618
- # Lite still keeps its backing services on Supabase and its encrypted custody in app.starcistacks; R06 scans every file here.
670
+ # Lite keeps its encrypted custody in app.starcistacks; R06 scans every file here.
619
671
  path: "deploy/"
620
672
  presence: optional
621
673
  tracked: tracked
@@ -699,7 +751,7 @@ slots:
699
751
  profiles: [app]
700
752
  exemplifiedBy:
701
753
  - {path: packages/hfs/templates/app/skeleton/scripts/codegen.mjs, edition: full}
702
- editionWhy: "Lite manages its Supabase codegen script; full owns operational scripts through the generic path (ruling:R212/case-2 (with the Work boundary amended by ruling:R212/case-4))."
754
+ editionWhy: "Lite manages its database-types codegen script; full owns operational scripts through the generic path (ruling:R212/case-2 (with the Work boundary amended by ruling:R212/case-4))."
703
755
  # The app's operational scripts only (`*.mjs`, `*.cjs`, `*.ps1`, `*.sh`), or nothing: an empty folder is `scripts/.gitkeep`, which
704
756
  # `starci app scaffold` writes. A spec or a test (BE_SPEC_PLACEMENT, FE_NO_TESTS), a check or lint source (`check-*`, `eslint-local-rules*`,
705
757
  # a local eslint plugin: HFS_REPO_LOCAL_CHECK) and anything that re-implements a canon check is not an operational script and has no place here.
@@ -784,7 +836,7 @@ slots:
784
836
  - id: app.starcistacks
785
837
  since: 3.1.0
786
838
  profiles: [app]
787
- editionWhy: "owner:lite-production-swarm: lite requires declared docker-swarm production with Supabase backing; owner:dev-docker-prod-swarm keeps dependencies in Docker Linux containers in dev and the app and dependencies on Swarm in prod except hosted Supabase."
839
+ editionWhy: "owner:lite-production-swarm: lite requires declared docker-swarm production with its PostgreSQL as a stack service; owner:dev-docker-prod-swarm keeps dependencies in Docker Linux containers in dev and the app and dependencies on Swarm in prod."
788
840
  exemplifiedBy:
789
841
  - {path: packages/hfs/templates/app/skeleton/.starcistacks/, edition: full}
790
842
  - {path: packages/hfs/templates/app/skeleton-lite/.starcistacks/, edition: lite}
@@ -799,7 +851,7 @@ slots:
799
851
  "<env>/runtime/{config,env}/**", "<env>/runtime/env/KEYS.md", "<env>/secrets/<slug>.enc", "<env>/secrets/.gitkeep", "<env>/seeds/**"]
800
852
  forbids: ["<env>/runtime/files/**", "**/*.enc outside <env>/secrets/", DESIGN.md, deployment.json, "k8s/ at root"]
801
853
  # Owner ruling 2026-10-14: lite declares docker-swarm production, app runtime config, sealed custody and seed data.
802
- # Supabase supplies the database and broker; production has no Compose or host cron.
854
+ # The db service supplies the database and broker (pgmq, pg_cron); production has no Compose or host cron.
803
855
  lite:
804
856
  requires: [application-stacks.yaml]
805
857
  allows: [application-stacks.yaml, "<env>/README.md", "<env>/environment.json", "<env>/infra/swarm/**", "<env>/infra/metadata.json",
@@ -862,122 +914,78 @@ slots:
862
914
  goesTo: ".starcistacks/<env>/secrets/<slug>.enc (at the app root); decrypted values only in memory or under %LOCALAPPDATA%/StarCi/secrets/<project>/<env>/ via *_FILE"
863
915
  rules: [HFS_PLAINTEXT_SECRET]
864
916
 
865
- # ----- app root: the Supabase project of an app whose connection declares provider: supabase (every lite app) -------
866
- - id: app.supabase
867
- profiles: [app]
868
- exemplifiedBy:
869
- - packages/hfs/templates/app/skeleton-lite/supabase/
870
- - {path: packages/hfs/src/hfs-database-access.spec.mjs, edition: full}
871
- editionWhy: "ruling:R212/case-2 (owner:lite-production-swarm) (with the Work boundary amended by ruling:R212/case-4): Supabase is required in lite; full enables it only through a declared connection."
872
- # The one Supabase project directory, at the app root beside be/, fe/ and .starcistacks (never under a side).
873
- path: "supabase/"
874
- presence: opt-in # enabled by a connection with provider: supabase; required under edition lite
875
- provider: supabase
876
- litePresence: required
877
- tracked: tracked
878
- tier: none
879
- tests: none
880
- since: 2.1.0
881
- - id: app.supabase.config
917
+ # ----- app root: the database of a lite app (ruling:lite-self-hosted-postgres-passport-minio): a self-hosted PostgreSQL in the app's
918
+ # stack (the `db` service, image supabase/postgres for pg_cron, pg_net, pgmq, vector, unaccent and pgcrypto), migrated by
919
+ # `starci app db migrate --url-env <NAME>`. A full app keeps its TypeORM migrations under be/ and has no such folder.
920
+ - id: app.db
882
921
  profiles: [app]
922
+ editions: [lite]
883
923
  exemplifiedBy:
884
- - packages/hfs/templates/app/skeleton-lite/supabase/config.toml
885
- - {path: packages/hfs/src/db-config-policy.spec.mjs, edition: full}
886
- editionWhy: "ruling:R212/case-2 (owner:lite-production-swarm) (with the Work boundary amended by ruling:R212/case-4): lite requires Supabase configuration; full requires it only when Supabase is declared."
887
- # The project configuration: auth keys are env(NAME) references, never literals (L08 judges its policy keys).
888
- path: "supabase/config.toml"
889
- presence: opt-in
890
- provider: supabase
891
- litePresence: required
924
+ - packages/hfs/templates/app/skeleton-lite/db/
925
+ # The one database directory, at the app root beside be/, fe/ and .starcistacks (never under a side).
926
+ path: "db/"
927
+ presence: required
892
928
  tracked: tracked
893
929
  tier: none
894
930
  tests: none
895
- since: 2.1.0
896
- - id: app.supabase.migrations
931
+ since: 3.9.0
932
+ - id: app.db.migrations
897
933
  profiles: [app]
934
+ editions: [lite]
898
935
  exemplifiedBy:
899
- - packages/hfs/templates/app/skeleton-lite/supabase/migrations/__timestamp___baseline.sql
900
- - {path: packages/hfs/src/db-migration-shape.spec.mjs, edition: full}
901
- editionWhy: "ruling:R212/case-2 (owner:lite-production-swarm) (with the Work boundary amended by ruling:R212/case-4): lite uses Supabase schema authority and requires a migration; full opts into that provider."
902
- # The schema authority of an app on Supabase: forward-only SQL migrations named <timestamp14>_<kebab-name>.sql,
903
- # one file per change, immutable once on origin/main (L02-L08 judge them).
904
- path: "supabase/migrations/<stamp>_<name>.sql"
905
- presence: opt-in
906
- provider: supabase
907
- litePresence: required
908
- lite: {minInstances: 1}
936
+ - packages/hfs/templates/app/skeleton-lite/db/migrations/__timestamp___baseline.sql
937
+ - {path: packages/hfs/src/db-migration-shape.spec.mjs, edition: lite}
938
+ # The schema authority of a lite app: forward-only SQL migrations named <timestamp14>_<kebab-name>.sql, one file per change,
939
+ # immutable once on origin/main, applied in order by `starci app db migrate` and recorded in the history table.
940
+ path: "db/migrations/<stamp>_<name>.sql"
941
+ presence: required
942
+ minInstances: 1
909
943
  tracked: tracked
910
944
  tier: none
911
945
  tests: none
912
- since: 2.1.0
913
- - id: app.supabase.migrations.archive
946
+ since: 3.9.0
947
+ rules: [DB_MIGRATION_SHAPE, LITE_DB_MIGRATION]
948
+ - id: app.db.migrations.archive
914
949
  profiles: [app]
915
- # The migrations an existing app retired at its cutover (owner ruling 2026-10-13, migration baseline policy): the live schema is
916
- # dumped into ONE baseline migration written to the current standard, marked applied on production without a re-run, and the
917
- # older files move here. The Supabase CLI applies only supabase/migrations/<stamp>_<name>.sql, never this folder, and no
918
- # migration rule (L02-L08) judges it; new migrations append after the baseline.
919
- path: "supabase/migrations/_archive/"
920
- presence: opt-in
921
- provider: supabase
950
+ editions: [lite]
951
+ # The migrations an app retired at a baseline cutover: the live schema is dumped into ONE baseline migration, marked applied
952
+ # without a re-run, and the older files move here. `starci app db migrate` never applies this folder and no migration rule judges it.
953
+ path: "db/migrations/archive/"
954
+ presence: optional
922
955
  tracked: tracked
923
956
  tier: none
924
957
  tests: none
925
- since: 3.0.0
926
- - id: app.supabase.seed
958
+ since: 3.9.0
959
+ - id: app.db.seed
927
960
  profiles: [app]
928
- path: "supabase/seed.sql"
961
+ editions: [lite]
962
+ path: "db/seed.sql"
929
963
  presence: optional # synthetic dev data only; a lite app seeds nothing it cannot regenerate
930
964
  tracked: tracked
931
965
  tier: none
932
966
  tests: none
933
- since: 2.1.0
934
- - id: app.supabase.types
935
- profiles: [app]
936
- templateNa: "Database row types are generated from the app's Supabase schema by contract:emit; a hand-authored scaffold template would invent the schema contract."
937
- editionWhy: "ruling:R212/case-2 (owner:lite-production-swarm) (with the Work boundary amended by ruling:R212/case-4): lite requires generated Supabase row types; full enables them with the provider."
938
- # The generated Database types (database.types.ts) contract:emit writes from the migrations; both sides read it
939
- # (sides.<side>.reads supabase/types/); drift against regeneration is L09.
940
- path: "supabase/types/database.types.ts"
941
- presence: opt-in
942
- provider: supabase
943
- litePresence: required
944
- tracked: tracked
945
- tier: none
946
- tests: none
947
- since: 2.1.0
948
- exemplifiedBy:
949
- - {path: packages/hfs/src/db-types-returned-collector.spec.mjs, edition: full}
950
- - id: app.supabase.templates
967
+ since: 3.9.0
968
+ - id: app.db.bootstrap
951
969
  profiles: [app]
952
- path: "supabase/templates/*.html"
953
- presence: optional # the auth e-mail templates Supabase serves
970
+ editions: [lite]
971
+ # The managed pre-migration bootstrap (templates/app/db-bootstrap): the auth, storage and extensions schemas, auth.users with the
972
+ # GoTrue column set, auth.uid/role/jwt stubs, the NOLOGIN browser roles and the realtime publication, so migrations written for a
973
+ # hosted Supabase apply to the self-hosted db service. `starci app db migrate` applies it before the first migration of an empty database.
974
+ path: "db/bootstrap.sql"
975
+ presence: required
954
976
  tracked: tracked
977
+ managedBy: db-bootstrap
955
978
  tier: none
956
979
  tests: none
957
- since: 2.1.0
958
- - id: app.supabase.local-state
959
- profiles: [app]
960
- path: "supabase/{.temp,.branches}/"
961
- presence: optional
962
- tracked: ignored # the local CLI's working state: exists, never committed
963
- tier: none
964
- tests: none
965
- since: 2.1.0
966
- - id: app.supabase.functions
967
- profiles: [app]
968
- path: "supabase/functions/"
969
- presence: forbidden # a Deno runtime is a second language runtime outside the lint canon and the slot machine (lite v1)
970
- tracked: external
971
- tier: none
972
- tests: none
973
- goesTo: "a be feature: webhooks/<provider> for a third-party callback, api for an endpoint, a job of a queue (BullMQ on the declared Redis, its tick enqueued through the queue outbox) or a cli command on a schedule (pg_cron / pg_net)"
974
- since: 2.1.0
980
+ since: 3.9.0
981
+ rules: [HFS_MANAGED_FILE_DRIFT]
982
+
975
983
 
976
984
  # ----- side root (both sides): what a standalone repository root holds, less the app-root files ----------
977
985
  - id: repo.side-root-forbidden
978
986
  since: 3.1.0
979
987
  profiles: [be, fe]
980
- path: "{package.json,package-lock.json,hfs.json,README.md,.gitignore,.gitattributes,.husky/,.github/,.starciwork/,.starcistacks/,supabase/,.sops.yaml,sonar-project.properties,codecov.yml,.prettierrc,.prettierignore,scripts/}"
988
+ path: "{package.json,package-lock.json,hfs.json,README.md,.gitignore,.gitattributes,.husky/,.github/,.starciwork/,.starcistacks/,db/,.sops.yaml,sonar-project.properties,codecov.yml,.prettierrc,.prettierignore,scripts/}"
981
989
  presence: forbidden
982
990
  tracked: external
983
991
  tier: none
@@ -1247,8 +1255,8 @@ slots:
1247
1255
  - {path: packages/hfs/src/mcp-tools-snapshot.spec.mjs, editions: [lite, full]}
1248
1256
 
1249
1257
  # ----- BE: apps (one slot per app kind; a new kind = a new slot, minor bump) ---------------------------
1250
- # The files of every app (owner ruling 2026-10-14, R245 and R246, since 3.1.0), each with a line budget that
1251
- # BE_APP_COMPOSITION_BUDGET holds absolutely (not a ratchet):
1258
+ # The files of every app (owner ruling 2026-10-14, R245 and R246, since 3.1.0), each with a line budget (lines excluding
1259
+ # import declarations, multi-line imports included) that BE_APP_COMPOSITION_BUDGET holds absolutely (not a ratchet):
1252
1260
  # main.ts the entry: builds EnvSource once, imports and calls read<App>Env from <app>.env.ts, builds options and boots.
1253
1261
  # <app>.env.ts exports interface <App>Env and read<App>Env(env: EnvSource): <App>Env (for example ApiEnv/readApiEnv);
1254
1262
  # fail-fast environment parsing only, via EnvSource and unchanged capability parse helpers; no localhost
@@ -1298,7 +1306,7 @@ slots:
1298
1306
  - id: be.app.cli
1299
1307
  since: 3.1.0
1300
1308
  profiles: [be]
1301
- editionWhy: "ruling:R212/case-2 (owner:lite-production-swarm) (with the Work boundary amended by ruling:R212/case-4): Supabase CLI owns lite migrations; a lite cli app is optional for declared operator commands."
1309
+ editionWhy: "ruling:R212/case-2 (owner:lite-production-swarm) (with the Work boundary amended by ruling:R212/case-4): `starci app db migrate` owns lite migrations; a lite cli app is optional for declared operator commands."
1302
1310
  # The ONE app of every one-off action (migrate, seed, sync, backup, any operator command): be/apps/cli, on nest-commander.
1303
1311
  # main.ts boots with CommandFactory.run (BE_CLI_BOOTSTRAP); app.module.ts composes the platform and the cli feature root
1304
1312
  # (src/features/cli/cli.module.ts); cli.env.ts exports CliEnv and readCliEnv(env: EnvSource): CliEnv, and cli.options.ts carries the env-derived values,
@@ -1308,7 +1316,7 @@ slots:
1308
1316
  path: "apps/<app>/src/"
1309
1317
  appKind: cli
1310
1318
  presence: opt-in
1311
- litePresence: optional # lite: schema migration is the Supabase CLI's job; a cli app exists only when the app declares one
1319
+ litePresence: optional # lite: schema migration is `starci app db migrate`'s job; a cli app exists only when the app declares one
1312
1320
  tracked: tracked
1313
1321
  tier: app
1314
1322
  owner: true
@@ -1659,7 +1667,7 @@ slots:
1659
1667
  - id: be.persistence
1660
1668
  since: 3.1.0
1661
1669
  profiles: [be]
1662
- editionWhy: "ruling:R212/case-2 (owner:lite-production-swarm) (with the Work boundary amended by ruling:R212/case-4): Supabase migrations own lite tables, with SQL and row types here; full keeps TypeORM entities and migrations here."
1670
+ editionWhy: "ruling:R212/case-2 (owner:lite-production-swarm) (with the Work boundary amended by ruling:R212/case-4): db/migrations own lite tables and both editions map them with TypeORM entities here (ruling:lite-persistence-typeorm-entities); full also keeps its TypeORM migrations here."
1663
1671
  path: "src/modules/{domain,platform,projections}/<capability>/persistence/"
1664
1672
  # R178: the platform capabilities whose tables exist on EVERY connection that uses them (the event-bus outbox, the inbox of every service, the job table); their arrays may be
1665
1673
  # registered on several declared connections. Any other capability registers its arrays on exactly one (BE_SCHEMA_OWNER).
@@ -1670,15 +1678,17 @@ slots:
1670
1678
  requires: [connection.ts] # the capability's <c>Entities / <c>Migrations arrays (the owner index re-exports the two arrays by name); no CONNECTION alias: the connection is the one the apps register the arrays on
1671
1679
  allows: ["entities/<table>.entity.ts", "migrations/<epochMs13>-<kebab-name>.ts", "<name>.sql.ts", "<name>.rows.ts", connection.ts]
1672
1680
  forbids: [index.ts, "<name>.repository.ts"]
1673
- # Lite keeps the shared-EntityManager persistence (raw SqlText + rows types over the generated Database row types) but the
1674
- # schema authority is supabase/migrations (ruleParams.be.lite.schemaAuthority): no TypeORM entity and no be migration.
1681
+ # Lite maps its tables with the same TypeORM entities as full (ruling:lite-persistence-typeorm-entities): each capability's
1682
+ # persistence/entities/<table>.entity.ts and an entities/index.ts exporting its <c>Entities array, which platform/database
1683
+ # lists by name; the schema authority stays db/migrations (ruleParams.be.lite.schemaAuthority), so no be migration and no
1684
+ # raw SQL file (R334 BE_PERSISTENCE_NO_RAW_SQL).
1675
1685
  lite:
1676
- requires: [] # no TypeORM arrays to re-export: the persistence of a lite capability is its sql and rows files
1677
- allows: ["<name>.sql.ts", "<name>.rows.ts", connection.ts]
1678
- forbids: [index.ts, "<name>.repository.ts", entities/, migrations/]
1686
+ requires: []
1687
+ allows: ["entities/<table>.entity.ts", entities/index.ts, connection.ts]
1688
+ forbids: [index.ts, "<name>.repository.ts", migrations/, "<name>.sql.ts", "<name>.rows.ts"]
1679
1689
  tests: none
1680
1690
  coverage: none
1681
- rules: [BE_SCHEMA_OWNER, BE_SCHEMA_AUTHORITY, BE_SQL_OUTSIDE_PERSISTENCE, BE_SQL_TABLE_OWNER, BE_SQL_RETURNING_SHAPE, BE_CONTEXT_COUPLING, BE_CONTEXT_PLATFORM_TABLES]
1691
+ rules: [BE_SCHEMA_OWNER, BE_SCHEMA_AUTHORITY, BE_SQL_OUTSIDE_PERSISTENCE, BE_PERSISTENCE_NO_RAW_SQL, BE_SQL_TABLE_OWNER, BE_SQL_RETURNING_SHAPE, BE_CONTEXT_COUPLING, BE_CONTEXT_PLATFORM_TABLES]
1682
1692
  - id: be.platform
1683
1693
  since: 3.1.0
1684
1694
  profiles: [be]
@@ -1729,7 +1739,7 @@ slots:
1729
1739
  owner: true
1730
1740
  lite:
1731
1741
  why: >-
1732
- the same EventPublisher and EventConsumer ports on Supabase Queues (pgmq): the outbox relay sends each committed row to the
1742
+ the same EventPublisher and EventConsumer ports on pgmq queues: the outbox relay sends each committed row to the
1733
1743
  pgmq queue of every consumer group of its topic through the shared EntityManager, a consumer reads with a visibility
1734
1744
  timeout, retries by letting it lapse and archives the message on dead letter (read_ct over the budget); a single api may
1735
1745
  deliver in process. No Kafka (knowledge/patterns/be/event-bus.yaml liteAdapter)
@@ -1743,7 +1753,7 @@ slots:
1743
1753
  - id: be.platform.queue
1744
1754
  since: 3.1.0
1745
1755
  profiles: [be]
1746
- editionWhy: "ruling:R212/case-10: both editions implement the queue ports with BullMQ on Redis; lite declares its Redis in hfs.json sides.be.backing and keeps the outbox table in a supabase migration."
1756
+ editionWhy: "ruling:R212/case-10: both editions implement the queue ports with BullMQ on Redis; lite declares its Redis in hfs.json sides.be.backing and keeps the outbox table in a db migration."
1747
1757
  path: "src/modules/platform/queue/"
1748
1758
  presence: opt-in
1749
1759
  pattern: queue # the ONE BullMQ owner: the outbox relay into queues (jobId = outbox id) and job schedulers (knowledge/patterns/be/queues.yaml)
@@ -1754,7 +1764,7 @@ slots:
1754
1764
  why: >-
1755
1765
  the same QueueOutbox and QueueWorkerRegistry ports and full's BullMQ adapter on the declared Redis (backing: [redis]): the
1756
1766
  relay adds each committed outbox row with the outbox id as the job id, workers retry with exponential backoff and keep a
1757
- job that exhausts its attempts as failed (the dead letter); the outbox table comes from a supabase migration, and a
1767
+ job that exhausts its attempts as failed (the dead letter); the outbox table comes from a db migration, and a
1758
1768
  schedule is a BullMQ job scheduler or a pg_cron tick that inserts one outbox row (knowledge/patterns/be/queues.yaml liteAdapter)
1759
1769
  requires: [index.ts, queue.module.ts, queue.port.ts, queue.contracts.ts, queue-outbox.service.ts, queue-outbox.service.spec.ts]
1760
1770
  tests: unit-beside
@@ -1848,7 +1858,7 @@ slots:
1848
1858
  - id: be.platform.jobs
1849
1859
  since: 3.1.0
1850
1860
  profiles: [be]
1851
- editionWhy: "ruling:R212/case-2 (owner:lite-production-swarm) (with the Work boundary amended by ruling:R212/case-4): lite persists fenced claims in Supabase migrations and dispatches through the BullMQ queue on its declared Redis (ruling:R212/case-10); full uses TypeORM schema authority and the same queue adapter."
1861
+ editionWhy: "ruling:R212/case-2 (owner:lite-production-swarm) (with the Work boundary amended by ruling:R212/case-4): lite persists fenced claims in db migrations and dispatches through the BullMQ queue on its declared Redis (ruling:R212/case-10); full uses TypeORM schema authority and the same queue adapter."
1852
1862
  path: "src/modules/platform/jobs/"
1853
1863
  presence: opt-in
1854
1864
  pattern: fenced-job # the ONE fencing primitive: the job entity, the claim that bumps the token, guarded writes (knowledge/patterns/be/jobs.yaml)
@@ -1863,7 +1873,7 @@ slots:
1863
1873
  - id: be.projections
1864
1874
  since: 3.1.0
1865
1875
  profiles: [be]
1866
- editionWhy: "ruling:R212/case-2 (owner:lite-production-swarm) (with the Work boundary amended by ruling:R212/case-4): lite projection tables live in Supabase migrations; full keeps the TypeORM projection entity beside its projection."
1876
+ editionWhy: "ruling:R212/case-2 (owner:lite-production-swarm) (with the Work boundary amended by ruling:R212/case-4): lite projection tables live in db migrations; full keeps the TypeORM projection entity beside its projection."
1867
1877
  path: "src/modules/projections/<name>/"
1868
1878
  presence: opt-in
1869
1879
  pattern: projection # a read model: only its projection writes its table; recompute is idempotent and replayable; readers use get*
@@ -1872,7 +1882,7 @@ slots:
1872
1882
  owner: true
1873
1883
  requires: [index.ts, "<name>.module.ts", "<name>.projection.ts", "<name>.projection-entity.ts"]
1874
1884
  allows: [index.ts, "<name>.module.ts", "<name>.module-definition.ts", "<name>.options.ts", "<name>.projection.ts", "<name>.projection-entity.ts", "<name>.contracts.ts", persistence/]
1875
- lite: # the read model's table is a supabase migration with its rows type (lite's schema authority): no TypeORM projection entity
1885
+ lite: # the read model's table is a db migration (lite's schema authority) mapped by its entity under persistence/entities/ (R334)
1876
1886
  requires: [index.ts, "<name>.module.ts", "<name>.projection.ts"]
1877
1887
  allows: [index.ts, "<name>.module.ts", "<name>.module-definition.ts", "<name>.options.ts", "<name>.projection.ts", "<name>.contracts.ts", persistence/]
1878
1888
  tests: unit-beside # a measured slot: <name>.projection.spec.ts beside its projection is legal (the file owes 100 per file; a spec of its own is optional)
@@ -1892,7 +1902,7 @@ slots:
1892
1902
  tests: unit-beside # <name>.service.spec.ts beside each <name>.service.ts; plus src/tests/integration/<provider>/ (R112)
1893
1903
  coverage: required
1894
1904
  budget: {indexExports: 80} # a provider's port surface includes clients, config, options, tokens and errors
1895
- rules: [BE_TIER_DIRECTION, BE_ERROR_HOME, BE_SECRET_DEFAULT, BE_INTEGRATION_SPEC_MISSING]
1905
+ rules: [BE_TIER_DIRECTION, BE_ERROR_HOME, BE_SECRET_DEFAULT, BE_INTEGRATION_SPEC_MISSING, BE_AI_KEY_CUSTODY, BE_AI_GATEWAY_CLIENT]
1896
1906
  - id: be.integrations.model
1897
1907
  since: 3.1.0
1898
1908
  profiles: [be]
@@ -1902,31 +1912,47 @@ slots:
1902
1912
  tier: integrations
1903
1913
  tests: none
1904
1914
  coverage: required
1905
- why: an ML or LLM model client is an integration; weights and datasets are never in git
1915
+ why: a self-hosted ML model client is an integration; weights and datasets are never in git, and a language model is called through the ai-router gateway by the integrations/ai LangChain client (BE-AI-1, BE-AI-3)
1906
1916
  rules: [BE_TIER_DIRECTION, BE_INFRA_OWNER, BE_INTEGRATION_SPEC_MISSING]
1907
1917
 
1908
- - id: be.integrations.supabase
1918
+ - id: be.integrations.passport
1909
1919
  profiles: [be]
1920
+ editions: [lite]
1910
1921
  exemplifiedBy:
1911
- - packages/hfs/templates/be/skeleton-lite/src/modules/integrations/supabase/
1912
- - {path: packages/hfs/src/be-supabase-jwt-verified.spec.mjs, edition: full}
1913
- editionWhy: "ruling:R212/case-2 (owner:lite-production-swarm) (with the Work boundary amended by ruling:R212/case-4): lite requires the Supabase Auth and Storage integration; full opts in through a connection."
1914
- # The only be import of @supabase/* (L10): the Auth admin and Storage admin client, plus the JWKS-based verification of
1915
- # the Supabase access token the guard chain reads (L16). The connection itself is ordinary Postgres (the shared
1916
- # EntityManager of the declared connection); what lives here are the service calls no database role covers.
1917
- path: "src/modules/integrations/supabase/"
1918
- presence: opt-in # enabled by a connection with provider: supabase; required under edition lite
1919
- provider: supabase
1922
+ - packages/hfs/templates/be/skeleton-lite/src/modules/integrations/passport/
1923
+ # The one owner of the lite identity libraries (ruleParams.be.infraOwners: @nestjs/passport, passport, passport-google-oauth20,
1924
+ # passport-local, @nestjs/jwt, jose, bcryptjs): the Google OAuth 2.0 strategy (state and PKCE), the local email and password
1925
+ # strategy (bcrypt), the app's own asymmetric access tokens and their JWKS, and the rotating refresh cookie. domain/identity
1926
+ # verifies a token through this integration's verifier and builds the principal (contexts/code/be/api-auth.md).
1927
+ path: "src/modules/integrations/passport/"
1928
+ presence: required
1929
+ tracked: tracked
1930
+ tier: integrations
1931
+ owner: true
1932
+ requires: [index.ts, passport.config.ts, passport.options.ts, passport.decorators.ts, passport.tokens.ts, passport.password.ts, passport.cookie.ts] # Secrets, no defaults (R44); options and named injectors (R83); tokens and JWKS; bcrypt; the refresh cookie
1933
+ allows: [index.ts, passport.config.ts, passport.options.ts, passport.decorators.ts, passport.tokens.ts, passport.password.ts, passport.cookie.ts, strategies/, errors/]
1934
+ tests: unit-beside
1935
+ rules: [BE_TIER_DIRECTION, BE_ERROR_HOME, BE_SECRET_DEFAULT, BE_INFRA_OWNER, BE_AUTH_PASSPORT_OWNER, BE_AUTH_JWT_OWN_JWKS, BE_AUTH_REFRESH_COOKIE]
1936
+ coverage: required
1937
+ since: 3.9.0
1938
+ - id: be.integrations.object-storage
1939
+ profiles: [be]
1940
+ exemplifiedBy:
1941
+ - packages/hfs/templates/be/skeleton-lite/src/modules/integrations/object-storage/
1942
+ # The one owner of the S3 client (@aws-sdk/client-s3 and @aws-sdk/s3-request-presigner) over S3-compatible storage (MinIO in
1943
+ # lite): the ObjectStorage port with presigned PUT and GET; no other module imports an S3 SDK or minio.
1944
+ path: "src/modules/integrations/object-storage/"
1945
+ presence: optional
1920
1946
  litePresence: required
1921
1947
  tracked: tracked
1922
1948
  tier: integrations
1923
1949
  owner: true
1924
- requires: [index.ts, supabase.config.ts, supabase.options.ts, supabase.decorators.ts, supabase.client.ts, supabase.jwks.ts] # Secrets, no defaults (R44); the options and the named injector (R83); the admin client; the token verification
1925
- allows: [index.ts, supabase.config.ts, supabase.options.ts, supabase.decorators.ts, supabase.client.ts, supabase.jwks.ts, errors/]
1950
+ requires: [index.ts, storage.config.ts, storage.options.ts, storage.decorators.ts, storage.client.ts]
1951
+ allows: [index.ts, storage.config.ts, storage.options.ts, storage.decorators.ts, storage.client.ts, errors/]
1926
1952
  tests: unit-beside
1927
- rules: [BE_TIER_DIRECTION, BE_ERROR_HOME, BE_SECRET_DEFAULT]
1953
+ rules: [BE_TIER_DIRECTION, BE_ERROR_HOME, BE_SECRET_DEFAULT, BE_INFRA_OWNER, BE_STORAGE_OWNER]
1928
1954
  coverage: required
1929
- since: 2.1.0
1955
+ since: 3.9.0
1930
1956
 
1931
1957
  # ----- BE: tests (owner test layout 2026-09-30). Unit specs are <name>.service.spec.ts beside their service and nothing else; everything else
1932
1958
  # lives under src/tests/, one folder per kind, and the folder and the file suffix always agree (a file whose suffix does
@@ -1934,15 +1960,15 @@ slots:
1934
1960
  - id: be.tests.world
1935
1961
  since: 3.1.0
1936
1962
  profiles: [be]
1937
- editionWhy: "ruling:R212/case-2 (owner:lite-production-swarm) (with the Work boundary amended by ruling:R212/case-4): lite integration proofs use the local Supabase stack and network fakes; full also boots apps and self-hosted services."
1963
+ editionWhy: "ruling:R212/case-2 (owner:lite-production-swarm) (with the Work boundary amended by ruling:R212/case-4): lite integration proofs use the local db service and network fakes; full also boots apps and self-hosted services."
1938
1964
  path: "src/tests/world/"
1939
1965
  presence: optional
1940
1966
  tracked: tracked
1941
1967
  tier: e2e
1942
1968
  lite:
1943
1969
  why: >-
1944
- the world of the optional integration specs of a lite app: global-setup.ts connects to the local Supabase CLI stack
1945
- (`starci supabase start`, with the migrations applied by the local stack) and starts no container, no toxiproxy and no stack of its
1970
+ the world of the optional integration specs of a lite app: global-setup.ts connects to the local db service
1971
+ (`npm run db:start`, with the migrations applied by `npm run db:push`) and starts no container, no toxiproxy and no stack of its
1946
1972
  own; use-test-world.ts exports useTestWorld({ modules: [...] }) -> world.db.<connection> (the shared EntityManager) and
1947
1973
  world.fake.<provider> (a network-edge fake of an external SaaS). There is no world.apps (no e2e) and no world.infra
1948
1974
  (no self-hosted service to cut)
@@ -2011,7 +2037,7 @@ slots:
2011
2037
  - id: be.tests.integration
2012
2038
  since: 3.1.0
2013
2039
  profiles: [be]
2014
- editionWhy: "Lite integration specs use the local Supabase CLI stack without containers or toxiproxy (ruling:R212/case-1, amended by ruling:R212/case-2 (owner:lite-production-swarm) and ruling:R212/case-4, with contracts allowed by owner:lite-contract-specs); R284 requires declared-pattern proofs there. Full additionally proves infrastructure outages through its world (R112)."
2040
+ editionWhy: "Lite integration specs use the local db service without containers or toxiproxy (ruling:R212/case-1, amended by ruling:R212/case-2 (owner:lite-production-swarm) and ruling:R212/case-4, with contracts allowed by owner:lite-contract-specs); R284 requires declared-pattern proofs there. Full additionally proves infrastructure outages through its world (R112)."
2015
2041
  path: "src/tests/integration/<capability>/*.integration-spec.ts"
2016
2042
  presence: optional
2017
2043
  tracked: tracked
@@ -2020,8 +2046,8 @@ slots:
2020
2046
  coverage: none
2021
2047
  lite:
2022
2048
  why: >-
2023
- optional under lite: one capability module through useTestWorld({ modules }) against the local Supabase CLI stack
2024
- (`starci supabase start`), run by test:integration; no container, no toxiproxy and no outage through the world (R112 is full's)
2049
+ optional under lite: one capability module through useTestWorld({ modules }) against the local db service
2050
+ (`npm run db:start`), run by test:integration; no container, no toxiproxy and no outage through the world (R112 is full's)
2025
2051
  why: one capability module through useTestWorld({ modules }), no HTTP door of ours (SQL, transactions, concurrency, inbox claims on the real database; and every integration client, `<capability>` being its provider folder, against our real infra, a real peer app or the library fake at the network edge, with its success, its ErrorCode refusal mapping and an outage through the world, R112); run by test:integration
2026
2052
  rules: [BE_TEST_TOPOLOGY, BE_INTEGRATION_SPEC_MISSING]
2027
2053
  - id: be.tests.e2e
@@ -2034,7 +2060,7 @@ slots:
2034
2060
  tracked: tracked
2035
2061
  tier: e2e
2036
2062
  tests: e2e
2037
- goesTo: "the full edition: a lite app has no e2e world; its logic is proven by unit specs and its database by optional integration specs on `starci supabase start`"
2063
+ goesTo: "the full edition: a lite app has no e2e world; its logic is proven by unit specs and its database by optional integration specs on `npm run db:start`"
2038
2064
  coverage: none
2039
2065
  why: flow e2e through useTestWorld({ apps }); external services are the world's network fakes; run by test:e2e
2040
2066
  rules: [HFS_CI_E2E_AUTOMATIC, BE_TEST_TOPOLOGY, BE_E2E_FLOW]
@@ -2093,7 +2119,7 @@ slots:
2093
2119
  tracked: tracked
2094
2120
  tier: route
2095
2121
  # ruling:R212/case-2 (owner:lite-production-swarm) (with the Work boundary amended by ruling:R212/case-4) (lite = full): routes are thin and the front end serves no API - health/live is the one
2096
- # route handler of this slot, the Supabase auth callback is fe.route.callback, and no file holds a Server Action
2122
+ # route handler of this slot, the OAuth callback is a back-end door, and no file holds a Server Action
2097
2123
  # (FE_ROUTE_HANDLER_FORBIDDEN, FE_SERVER_ACTION_FORBIDDEN).
2098
2124
  allows: ["[locale]/**/{page,layout,template,loading,error,not-found,default}.tsx", "[locale]/providers.tsx",
2099
2125
  global-error.tsx, page.tsx, # the root page.tsx only redirects (FE_ROUTE_FILES_THIN)
@@ -2124,20 +2150,6 @@ slots:
2124
2150
  tests: none
2125
2151
  goesTo: "apps/<app>/src/proxy.ts: Next >= 16 reads proxy.ts and refuses middleware.ts"
2126
2152
  rules: [FE_NEXT_CONVENTIONS]
2127
- - id: fe.route.callback
2128
- profiles: [fe]
2129
- # The auth callback of a Supabase session (the PKCE code exchange), kept only when the auth flow truly needs a server exchange
2130
- # (prefer the client-side PKCE exchange in fe.modules.auth): the one non-health route handler of an app with a Supabase
2131
- # connection; an app without one has no route handler in fe/ (L15).
2132
- path: "apps/<app>/src/app/auth/callback/route.ts"
2133
- presence: opt-in
2134
- provider: supabase
2135
- tracked: tracked
2136
- tier: route
2137
- tests: none
2138
- since: 2.1.0
2139
- rules: [FE_ROUTE_HANDLER_FORBIDDEN, FE_CALLBACK_SHAPE, FE_SUPABASE_CLIENT_OWNER, FE_SERVICE_ROLE_FORBIDDEN]
2140
-
2141
2153
  - id: fe.feature
2142
2154
  since: 3.1.0
2143
2155
  profiles: [fe]
@@ -2469,18 +2481,17 @@ slots:
2469
2481
  - id: fe.modules.auth
2470
2482
  profiles: [fe]
2471
2483
  # The identity-provider client (fe-stack auth, FE-AUTH): the session, the access token the Apollo link attaches and the
2472
- # sign-in/sign-out calls. With a Supabase connection it is the ONLY fe importer of @supabase/supabase-js and uses its auth API
2473
- # only; Supabase on the front end never reads or writes data (owner ruling 2026-10-13).
2484
+ # sign-in/sign-out calls. It talks only to the app's own back-end auth doors and holds no credential: the refresh token lives in
2485
+ # the back end's httpOnly cookie and the access token in memory (ruling:lite-self-hosted-postgres-passport-minio).
2474
2486
  path: "apps/<app>/src/modules/auth/"
2475
2487
  presence: optional
2476
2488
  tracked: tracked
2477
2489
  tier: modules
2478
2490
  owner: true
2479
2491
  requires: [index.ts]
2480
- entries: [server.ts] # the server-only PKCE exchange API used by the opted-in callback route
2481
2492
  tests: none
2482
2493
  since: 3.0.0
2483
- rules: [FE_SUPABASE_CLIENT_OWNER, FE_SERVICE_ROLE_FORBIDDEN]
2494
+ rules: [FE_STACK_FORBIDDEN]
2484
2495
  - id: fe.modules.toast
2485
2496
  profiles: [fe]
2486
2497
  # Mutation feedback (fe-stack toast, FE-TOAST): the HeroUI toast wrapper, showGraphQLToast over a GraphQLResponse and the
@@ -2,27 +2,23 @@
2
2
  // against a loaded manifest remain in slots.mjs; this module mirrors modules/schemas/hfs-repo.schema.yaml only.
3
3
  import { isPlainObject } from '../../engine/plain-object.mjs';
4
4
  import { APP_KIND, connectionShapeProblems, NAME, PACKAGE_NAME, RUNTIME_KIND, SLOT_ID } from './manifest-shape.mjs';
5
+ import { dbFunctionsOk } from './rule-params-shape.mjs';
5
6
  import { kindShapeProblems, patternShapeProblems } from './declaration-slots.mjs';
6
7
  import { byCodeUnit } from '../lib/list.mjs';
7
8
 
8
- /** Shape problems of the optional hfs.json `supabase` block whose auth posture DB_CONFIG_POLICY checks. */
9
- const isSupabaseStringList = (value) => Array.isArray(value) && value.every((entry) => typeof entry === 'string' && entry.trim());
9
+ /** Shape problems of the optional hfs.json `db` block of a lite app: the environment variable naming its database, its image, forced RLS and its application role. */
10
+ const isStringList = (value) => Array.isArray(value) && value.every((entry) => typeof entry === 'string' && entry.trim());
10
11
 
11
- function supabaseValueProblems(block) {
12
- const bad = [];
13
- if (block.enableSignup !== undefined && typeof block.enableSignup !== 'boolean') bad.push('supabase.enableSignup must be true or false');
14
- if (block.jwtExpiry !== undefined && !(Number.isInteger(block.jwtExpiry) && block.jwtExpiry > 0 && block.jwtExpiry <= 3600)) bad.push('supabase.jwtExpiry must be an integer of seconds, 3600 at most');
15
- if (block.siteUrl !== undefined && (typeof block.siteUrl !== 'string' || !block.siteUrl.trim())) bad.push('supabase.siteUrl must be a URL string');
16
- for (const key of ['redirectUrls', 'forceRls']) if (block[key] !== undefined && !isSupabaseStringList(block[key])) bad.push(`supabase.${key} must be a list of strings`);
17
- return bad;
18
- }
19
-
20
- function supabaseBlockProblems(block) {
12
+ function dbBlockProblems(block) {
21
13
  if (block === undefined) return [];
22
- if (!isPlainObject(block)) return ['supabase must be an object'];
14
+ if (!isPlainObject(block)) return ['db must be an object'];
23
15
  const bad = [];
24
- for (const key of Object.keys(block)) if (!['enableSignup', 'jwtExpiry', 'siteUrl', 'redirectUrls', 'forceRls'].includes(key)) bad.push(`supabase has unknown key ${key}`);
25
- bad.push(...supabaseValueProblems(block));
16
+ for (const key of Object.keys(block)) if (!['urlEnv', 'image', 'forceRls', 'forceRlsExemptions', 'appRole'].includes(key)) bad.push(`db has unknown key ${key}`);
17
+ if (block.urlEnv !== undefined && (typeof block.urlEnv !== 'string' || !/^[A-Z][A-Z0-9_]*$/.test(block.urlEnv))) bad.push('db.urlEnv must name an UPPER_CASE environment variable');
18
+ if (block.image !== undefined && (typeof block.image !== 'string' || !/@sha256:[0-9a-f]{64}$/.test(block.image))) bad.push('db.image must be a digest-pinned image reference');
19
+ if (block.forceRls !== undefined && !isStringList(block.forceRls)) bad.push('db.forceRls must be a list of strings');
20
+ if (block.appRole !== undefined && (typeof block.appRole !== 'string' || !/^[a-z][a-z0-9_]*$/.test(block.appRole))) bad.push('db.appRole must name a role');
21
+ if (block.forceRlsExemptions !== undefined && !Array.isArray(block.forceRlsExemptions)) bad.push('db.forceRlsExemptions must be a list of { table, reason }');
26
22
  return bad;
27
23
  }
28
24
 
@@ -95,7 +91,8 @@ function declarationSideProblems(side, value, names) {
95
91
  const bad = [];
96
92
  const at = `sides.${side}`;
97
93
  if (!isPlainObject(value)) return [`${at} must be an object`];
98
- for (const key of Object.keys(value)) if (!['apps', 'optionalSlots', 'patterns', 'kinds', 'connections', 'reads', 'extraPackages', 'grammar', 'backing', 'queueOutbox'].includes(key)) bad.push(`${at} has unknown key ${key}`);
94
+ for (const key of Object.keys(value)) if (!['apps', 'optionalSlots', 'patterns', 'kinds', 'connections', 'reads', 'extraPackages', 'grammar', 'backing', 'queueOutbox', 'dbFunctions'].includes(key)) bad.push(`${at} has unknown key ${key}`);
95
+ if (value.dbFunctions !== undefined && (side !== 'be' || !dbFunctionsOk(value.dbFunctions))) bad.push(`${at}.dbFunctions belongs to the be side and lists {name, reason} database functions with unique names`);
99
96
  bad.push(...appShapeProblems(value.apps, at, side, names));
100
97
  if (isBadUniqueList(value.optionalSlots, (slot) => SLOT_ID.test(String(slot)))) bad.push(`${at}.optionalSlots must be a unique list of slot ids`);
101
98
  if (value.backing !== undefined && side !== 'be') bad.push('backing belongs to the be side');
@@ -127,13 +124,13 @@ function observeBlockProblems(observe) {
127
124
  return bad;
128
125
  }
129
126
 
130
- const DECLARATION_KEYS = new Set(['hfs', 'kind', 'project', 'edition', 'supabase', 'sides', 'browser', 'lexicon', 'observe']);
127
+ const DECLARATION_KEYS = new Set(['hfs', 'kind', 'project', 'edition', 'db', 'sides', 'browser', 'lexicon', 'observe']);
131
128
  const RUNTIME_DECLARATION_KEYS = new Set(['hfs', 'kind', 'project']);
132
129
 
133
130
  function productDeclarationProblems(declaration, profiles) {
134
131
  const bad = [];
135
132
  for (const key of Object.keys(declaration)) if (!DECLARATION_KEYS.has(key)) bad.push(`unknown key ${key}`);
136
- bad.push(...supabaseBlockProblems(declaration.supabase), ...lexiconBlockProblems(declaration.lexicon), ...observeBlockProblems(declaration.observe));
133
+ bad.push(...dbBlockProblems(declaration.db), ...lexiconBlockProblems(declaration.lexicon), ...observeBlockProblems(declaration.observe));
137
134
  if (declaration.browser !== undefined && declaration.browser !== true) bad.push('browser is `true` when the app has a browser journey (slot app.browser), and is left out otherwise');
138
135
  if (declaration.kind !== APP_KIND) bad.push(`kind must be ${APP_KIND} (a product is one app repository with a be and an fe side) or ${RUNTIME_KIND} (the StarCi runtime repository)`);
139
136
  if (!isPlainObject(declaration.sides) || Object.keys(declaration.sides).sort(byCodeUnit).join() !== profiles.join()) { bad.push('sides must declare exactly be and fe'); return bad; }
@@ -15,12 +15,12 @@ const ENV_PREFIX =/^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$/;
15
15
  const CONTEXT_ISOLATIONS = Object.freeze(["database", "schema"]);
16
16
  /** The app kinds that may own a context: the services, never the migrate or cli apps that only run migrations. */
17
17
  const CONTEXT_OWNER_KINDS = Object.freeze(["api", "worker"]);
18
- /** The database engines a connection may run on: a self-described Postgres, or the Postgres of a Supabase project. */
19
- const CONNECTION_PROVIDERS = Object.freeze(["postgres", "supabase"]);
18
+ /** The database engine a connection runs on. */
19
+ const CONNECTION_PROVIDERS = Object.freeze(["postgres"]);
20
20
  /** The editions an app repository may declare in hfs.json (`full` when absent): the filter slots.mjs applies. */
21
21
  export const EDITIONS = Object.freeze(["full", "lite"]);
22
- /** What decides where schema changes live (ruleParams.<side>.schemaAuthority): TypeORM migrations under persistence/, or the Supabase migration tree. */
23
- export const SCHEMA_AUTHORITIES = Object.freeze(["typeorm", "supabase"]);
22
+ /** What decides where schema changes live (ruleParams.<side>.schemaAuthority): TypeORM migrations under persistence/, or the SQL migration tree db/migrations. */
23
+ export const SCHEMA_AUTHORITIES = Object.freeze(["typeorm", "sql"]);
24
24
  /**
25
25
  * The shape problems of the `connections` of one side: a list of {name, envPrefix, owner, isolation}, the owner an api or worker app
26
26
  * of the same side (a connection is a bounded context and one service owns it), isolation `database` or `schema`.
@@ -62,6 +62,9 @@ function beSpecificProblems(be, manifest) {
62
62
  return bad;
63
63
  }
64
64
 
65
+ /** True for an absent list or a list of {name, reason} database functions, names unique. */
66
+ export const dbFunctionsOk = (list) => list === undefined || (Array.isArray(list) && list.every((entry) => isPlainObject(entry) && Object.keys(entry).sort().join() === 'name,reason' && /^[a-z_][a-z0-9_]*(?:\.[a-z_][a-z0-9_]*)?$/.test(entry.name) && typeof entry.reason === 'string' && entry.reason.trim().length > 0) && new Set(list.map((entry) => entry.name)).size === list.length);
67
+
65
68
  /** The shape problems of `m.ruleParams`. */
66
69
  export function ruleParamsProblems(m) {
67
70
  const bad = [];
@@ -71,7 +74,7 @@ export function ruleParamsProblems(m) {
71
74
  // common holds the parameters both sides share; a side may restate one of them (a valid value) as an override, nothing else.
72
75
  // Edition lite: a side's optional `lite` map overrides keys of the same side (never `lite` itself) when the app declares edition lite.
73
76
  if (!sideOk(rp.common, []) || !fileLinesOk(rp.common.fileLines) || !blockOk(rp.common.duplicateBlock)) bad.push('ruleParams.common needs fileLines {soft, hardGrowth} and duplicateBlock {lines >= 2, tokens >= 1}; optional functionLines and featureFiles must be positive integers');
74
- if (!sideOk(rp.be, BE_OWN, ['schemaAuthority', 'lite']) || (rp.be.schemaAuthority !== undefined && !SCHEMA_AUTHORITIES.includes(rp.be.schemaAuthority)) || !liteOk(rp.be.lite, [...BE_OWN, ...SHARED_KEYS, 'schemaAuthority'])) bad.push('ruleParams.be needs infraOwners, eventBus, specDoubles, paramNames, suffixes, bannedSuffixes, contractShape {helper}, unitRoles, logicRoles, thinRoles, patternScenarios, kindPatterns, addKinds and backing (shared parameters live in ruleParams.common, a side may override them); optional: schemaAuthority (' + SCHEMA_AUTHORITIES.join(' | ') + ') and lite (overrides of the same keys)'); else bad.push(...unitRolesProblems(rp.be), ...roleListProblems(rp.be));
77
+ if (!sideOk(rp.be, BE_OWN, ['schemaAuthority', 'lite', 'dbFunctions']) || (rp.be.schemaAuthority !== undefined && !SCHEMA_AUTHORITIES.includes(rp.be.schemaAuthority)) || !dbFunctionsOk(rp.be.dbFunctions) || !liteOk(rp.be.lite, [...BE_OWN, ...SHARED_KEYS, 'schemaAuthority', 'dbFunctions'])) bad.push('ruleParams.be needs infraOwners, eventBus, specDoubles, paramNames, suffixes, bannedSuffixes, contractShape {helper}, unitRoles, logicRoles, thinRoles, patternScenarios, kindPatterns, addKinds and backing (shared parameters live in ruleParams.common, a side may override them); optional: schemaAuthority (' + SCHEMA_AUTHORITIES.join(' | ') + '), dbFunctions ([{name, reason}]) and lite (overrides of the same keys)'); else bad.push(...unitRolesProblems(rp.be), ...roleListProblems(rp.be));
75
78
  bad.push(...beSpecificProblems(rp.be, m));
76
79
  if (rp.fe !== undefined && (!sideOk(rp.fe, [], ['lite']) || !liteOk(rp.fe.lite, SHARED_KEYS))) bad.push('ruleParams.fe may only restate the shared parameters of ruleParams.common, and carry a lite override of them');
77
80
  if (!dbParamsOk(rp.db)) bad.push('ruleParams.db may contain only extensions (a list of unique non-empty extension names) and queueOutbox ({table: <schema>.<table>, columns: [unique column names including queue]})');
@@ -49,7 +49,7 @@ function sideCrossing(repo, fromSide, toSide, toPath) {
49
49
  function importAllowedApp({ repo, root, sides }, fromPath, toPath) {
50
50
  const from = splitSide(fromPath);
51
51
  const to = splitSide(toPath);
52
- // A side file may read an app-root path (supabase/types/) only through a declared read, exactly as it reads the other side.
52
+ // A side file may read an app-root path (db/types/) only through a declared read, exactly as it reads the other side.
53
53
  if (from && from.side !== to?.side) return sideCrossing(repo, from.side, to?.side ?? null, toPath);
54
54
  if (from && to) return sides[from.side].importAllowed(from.rest, to.rest);
55
55
  return root.importAllowed(fromPath, toPath);
@@ -120,6 +120,7 @@ function sideDeclaration(manifest, declaration, name, edition, providers) {
120
120
  connections: Object.freeze((s.connections ?? []).map(connectionView)),
121
121
  providers,
122
122
  reads: Object.freeze([...(s.reads ?? [])]),
123
+ dbFunctions: Object.freeze((s.dbFunctions ?? []).map((entry) => Object.freeze({ ...entry }))),
123
124
  ...(s.grammar === undefined ? {} : { grammar: s.grammar }),
124
125
  ...(s.extraPackages === undefined ? {} : { extraPackages: Object.freeze(s.extraPackages.map(entry => Object.freeze({ ...entry }))) }),
125
126
  manifestVersion: manifest.version,
@@ -221,7 +222,8 @@ function createScopeResolver(manifest, repo) {
221
222
  trackingOf,
222
223
  /** True only for a path a slot owns and requires to be committed. */
223
224
  isTracked: (p) => trackingOf(p) === 'tracked',
224
- ruleParams: () => ruleParams(manifest, profile, edition),
225
+ // The app's own database functions (hfs.json sides.be.dbFunctions) join the canon's list (R334).
226
+ ruleParams: () => withDeclaredDbFunctions(ruleParams(manifest, profile, edition), repo.dbFunctions),
225
227
  allowedImports: (tier) => manifest.tiers[profile]?.[tier]?.mayImport ?? null,
226
228
  });
227
229
  }
@@ -235,13 +237,17 @@ function createScopeResolver(manifest, repo) {
235
237
  */
236
238
  export function createSlotResolver(manifest, repo) {
237
239
  if (repo.profile !== APP_SCOPE) return createScopeResolver(manifest, repo);
238
- // The root declares no connection of its own, yet a provider slot of the app profile (app.supabase*) is enabled by a
240
+ // The root declares no connection of its own, yet a provider slot of the app profile is enabled by a
239
241
  // side's connection with that provider: the root scope reads the union of the sides' connections.
240
242
  const root = createScopeResolver(manifest, { ...repo, connections: SIDES.flatMap((side) => repo.sides[side].connections) });
241
243
  const sides = Object.fromEntries(PROFILES.map((side) => [side, createScopeResolver(manifest, repo.sides[side])]));
242
244
  return appResolver(repo, root, sides);
243
245
  }
244
246
 
247
+ /** The rule parameters with the app's declared database functions appended to `dbFunctions` (be only), frozen. */
248
+ const withDeclaredDbFunctions = (params, declared = []) => (params.dbFunctions === undefined && !declared.length ? params
249
+ : Object.freeze({ ...params, dbFunctions: Object.freeze([...(params.dbFunctions ?? []), ...declared]) }));
250
+
245
251
  /** The rule parameters of one profile (be: infraOwners, suffixes, bannedSuffixes and the rest over the shared ruleParams.common fileLines and duplicateBlock; fe: common alone or with its overrides; runtime: ruleParams.runtime of a runtime manifest), as a frozen deep copy. Under `edition` lite the `lite` overrides of ruleParams.<profile> merge over the base (the `lite` key itself is never returned). */
246
252
  export function ruleParams(manifest, profile, edition = 'full') {
247
253
  const profiles = manifestKind(manifest) === RUNTIME_KIND ? [RUNTIME_KIND] : PROFILES;