@starci/eslint-grammar-core 0.21.13 → 0.21.15
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 +10 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +9 -1
- package/package.json +2 -2
- package/runtime/bundle.json +1 -0
- package/runtime/knowledge/hfs/canon-pins.yaml +65 -11
- package/runtime/knowledge/hfs/rules.yaml +67 -15
- package/runtime/knowledge/hfs/slots.yaml +168 -28
- package/runtime/scripts/hfs/architecture/config.mjs +25 -1
- package/runtime/scripts/hfs/architecture/root-packages.mjs +78 -0
- package/runtime/scripts/hfs/architecture/type-context.mjs +30 -0
- package/runtime/scripts/hfs/architecture/typescript.mjs +21 -1
- package/runtime/scripts/hfs/manifest-shape.mjs +1 -1
- package/runtime/scripts/hfs/slots.mjs +1 -1
- package/runtime/scripts/hfs/view.mjs +68 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.21.15 - 2026-11-03
|
|
4
|
+
|
|
5
|
+
- Changed: requires `@starci/eslint-canon-fe` 9.12.0; the runtime copies carry the R06 and R295 laws and the `@starci/nest-kit` and `@starci/next-i18n` pins.
|
|
6
|
+
- Added: `coreGrammarPackagesConfig`: the family rules over the front-end subpaths of the root workspace packages (`src/workbench/**`, `src/public/**`), the config of `coreGrammarConfig` narrowed by `scopeToPackages` of the universal canon.
|
|
7
|
+
- Changed: the runtime copy of the slot manifest carries the slots `app.packages`, `app.module-registry` and `app.packages-lint`.
|
|
8
|
+
|
|
9
|
+
## 0.21.14 - 2026-11-03
|
|
10
|
+
|
|
11
|
+
- Changed: requires `@starci/eslint-canon-fe` 9.11.0; the runtime copies of the slot manifest, stack and pins carry the `@starci/auth` rows.
|
|
12
|
+
|
|
3
13
|
## 0.21.13
|
|
4
14
|
|
|
5
15
|
- Changed: Require the updated FE canon, carry the rule catalog of @starci/hfs 5.1.0 (R368) and align the Grammar family.
|
package/dist/index.d.ts
CHANGED
|
@@ -43,5 +43,13 @@ export declare const coreGrammarConfig: (input: {
|
|
|
43
43
|
readonly hfs: GrammarHfsView;
|
|
44
44
|
readonly family?: GrammarFamilyId;
|
|
45
45
|
}) => Linter.Config[];
|
|
46
|
+
/**
|
|
47
|
+
* The Grammar family's rules for the front-end subpaths of an app's root workspace packages (`packages/<pkg>/src/workbench/**` and `src/public/**`):
|
|
48
|
+
* the config of `coreGrammarConfig` over the package view (`loadPackagesHfs` of the universal canon), narrowed to those subpaths, so a module
|
|
49
|
+
* package draws with the Grammar's components alone under the very laws of the front end (FE-PACKAGES-2).
|
|
50
|
+
* @param input - The package view of the app root and the family.
|
|
51
|
+
* @returns A typed source block with every family rule at error over the package subpaths.
|
|
52
|
+
*/
|
|
53
|
+
export declare const coreGrammarPackagesConfig: typeof coreGrammarConfig;
|
|
46
54
|
export { crossFileInputs } from "./lib/cross-file-inputs.js";
|
|
47
55
|
export type { CrossFileInput } from "./lib/cross-file-inputs.js";
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import tsParser from "@typescript-eslint/parser";
|
|
2
|
-
import { SOURCE_FILES, linterOptions as canonLinterOptions } from "@starci/eslint-canon-fe/lib/config.mjs";
|
|
2
|
+
import { SOURCE_FILES, linterOptions as canonLinterOptions, scopeToPackages } from "@starci/eslint-canon-fe/lib/config.mjs";
|
|
3
3
|
import { rules as appShellRules } from "./app-shell.js";
|
|
4
4
|
import { rules as chipLabelRules } from "./chip-label.js";
|
|
5
5
|
import { rules as drawingRules } from "./drawing.js";
|
|
@@ -85,5 +85,13 @@ export const coreGrammarConfig = ({ hfs, family = "core" } = {}) => {
|
|
|
85
85
|
rules: { ...recommended },
|
|
86
86
|
}];
|
|
87
87
|
};
|
|
88
|
+
/**
|
|
89
|
+
* The Grammar family's rules for the front-end subpaths of an app's root workspace packages (`packages/<pkg>/src/workbench/**` and `src/public/**`):
|
|
90
|
+
* the config of `coreGrammarConfig` over the package view (`loadPackagesHfs` of the universal canon), narrowed to those subpaths, so a module
|
|
91
|
+
* package draws with the Grammar's components alone under the very laws of the front end (FE-PACKAGES-2).
|
|
92
|
+
* @param input - The package view of the app root and the family.
|
|
93
|
+
* @returns A typed source block with every family rule at error over the package subpaths.
|
|
94
|
+
*/
|
|
95
|
+
export const coreGrammarPackagesConfig = (input) => scopeToPackages(coreGrammarConfig(input));
|
|
88
96
|
// The result cache of `starci app check --gate lint` (contexts/project/check-cache.md) reads the disk inputs the family rules declare.
|
|
89
97
|
export { crossFileInputs } from "./lib/cross-file-inputs.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@starci/eslint-grammar-core",
|
|
3
|
-
"version": "0.21.
|
|
3
|
+
"version": "0.21.15",
|
|
4
4
|
"description": "ESLint rules for the core Grammar's component, token and composition contracts.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"node": ">=22"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"@starci/eslint-canon-fe": "9.
|
|
44
|
+
"@starci/eslint-canon-fe": "9.12.0",
|
|
45
45
|
"eslint": ">=9",
|
|
46
46
|
"typescript": ">=5.9"
|
|
47
47
|
},
|
package/runtime/bundle.json
CHANGED
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"scripts/hfs/allows.mjs",
|
|
25
25
|
"scripts/hfs/architecture/component-tiers.mjs",
|
|
26
26
|
"scripts/hfs/architecture/config.mjs",
|
|
27
|
+
"scripts/hfs/architecture/root-packages.mjs",
|
|
27
28
|
"scripts/hfs/architecture/side-boundary.mjs",
|
|
28
29
|
"scripts/hfs/architecture/type-context.mjs",
|
|
29
30
|
"scripts/hfs/architecture/typescript.mjs",
|
|
@@ -30,43 +30,57 @@ pins:
|
|
|
30
30
|
side: fe
|
|
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
|
+
'@starci/next-data':
|
|
34
|
+
version: 0.1.0
|
|
35
|
+
group: starci
|
|
36
|
+
install: registry
|
|
37
|
+
side: fe
|
|
38
|
+
source: packages/next-data/package.json
|
|
39
|
+
why: 'the SWR data helpers of every front end (fe-stack data, owner:next-data-package): pollingRestart, the viewer and tenant key helpers, viewerSwrConfig and the viewer cache; each operation hook stays in the app and the package holds no component.'
|
|
33
40
|
'@starci/grammar':
|
|
34
|
-
version: 0.21.
|
|
41
|
+
version: 0.21.15
|
|
35
42
|
group: starci
|
|
36
43
|
install: registry
|
|
37
44
|
side: fe
|
|
38
45
|
source: packages/grammar/package.json
|
|
39
46
|
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.'
|
|
47
|
+
'@starci/next-i18n':
|
|
48
|
+
version: 0.1.0
|
|
49
|
+
group: starci
|
|
50
|
+
install: registry
|
|
51
|
+
side: fe
|
|
52
|
+
source: packages/next-i18n/package.json
|
|
53
|
+
why: 'the next-intl stack of every front end (fe-stack i18n, owner:next-i18n-package): defineI18n over the locales of the app, the locale-negotiating proxy, the locale-aware navigation, the request config that loads the catalogs of the app and the locale read of the [locale] layout; the app keeps its message catalogs and writes none of the stack.'
|
|
40
54
|
'@starci/eslint-canon-be':
|
|
41
|
-
version: 3.
|
|
55
|
+
version: 3.14.0
|
|
42
56
|
group: starci
|
|
43
57
|
install: registry
|
|
44
58
|
side: be
|
|
45
59
|
source: packages/eslint-canon-be/package.json
|
|
46
60
|
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
61
|
'@starci/eslint-canon-fe':
|
|
48
|
-
version: 9.
|
|
62
|
+
version: 9.12.0
|
|
49
63
|
group: starci
|
|
50
64
|
install: registry
|
|
51
65
|
side: fe
|
|
52
66
|
source: packages/eslint-canon-fe/package.json
|
|
53
67
|
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
68
|
'@starci/eslint-grammar-core':
|
|
55
|
-
version: 0.21.
|
|
69
|
+
version: 0.21.15
|
|
56
70
|
group: starci
|
|
57
71
|
install: registry
|
|
58
72
|
side: fe
|
|
59
73
|
source: packages/eslint-grammar-core/package.json
|
|
60
74
|
why: 'the StarCi Grammar component API lint, versioned with @starci/grammar; front ends compose this family package with the universal FE canon.'
|
|
61
75
|
'@starci/eslint-grammar-offset-pop':
|
|
62
|
-
version: 0.21.
|
|
76
|
+
version: 0.21.15
|
|
63
77
|
group: starci
|
|
64
78
|
install: registry
|
|
65
79
|
side: fe
|
|
66
80
|
source: packages/eslint-grammar-offset-pop/package.json
|
|
67
81
|
why: 'the Offset Pop Grammar component API lint, versioned with @starci/grammar; its shared component contract comes from the StarCi family lint without copying rules.'
|
|
68
82
|
'@starci/stylelint-canon':
|
|
69
|
-
version: 2.
|
|
83
|
+
version: 2.6.0
|
|
70
84
|
group: starci
|
|
71
85
|
install: registry
|
|
72
86
|
side: fe
|
|
@@ -85,7 +99,7 @@ pins:
|
|
|
85
99
|
side: both
|
|
86
100
|
source: packages/prettier-config/package.json
|
|
87
101
|
'@starci/jest-preset':
|
|
88
|
-
version: 2.6.
|
|
102
|
+
version: 2.6.2
|
|
89
103
|
group: starci
|
|
90
104
|
install: registry
|
|
91
105
|
side: be
|
|
@@ -105,8 +119,43 @@ pins:
|
|
|
105
119
|
side: be
|
|
106
120
|
source: packages/ai-router/package.json
|
|
107
121
|
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.'
|
|
122
|
+
'@starci/nest-kit':
|
|
123
|
+
version: 0.1.0
|
|
124
|
+
group: starci
|
|
125
|
+
install: registry
|
|
126
|
+
side: be
|
|
127
|
+
source: packages/nest-kit/package.json
|
|
128
|
+
why: 'the module definition of every back-end module: defineConfigurableModule and defineCapabilityModule return the module base class, the options token and the options types with their types stated, so a <x>.module-definition.ts is one call that the lint on stated export types (R368) and the duplicate-code check (R21) both accept; @starci/jest-preset compiles it as an ESM-only dependency.'
|
|
129
|
+
'@starci/auth':
|
|
130
|
+
version: 0.2.0
|
|
131
|
+
group: starci
|
|
132
|
+
install: registry
|
|
133
|
+
side: both
|
|
134
|
+
source: packages/auth/package.json
|
|
135
|
+
why: 'the lite sign-in: the NestJS module (EdDSA access tokens with a multi-key JWKS, passwords, Google OAuth with state and PKCE, rotating refresh sessions, the sign-in budget, the refresh cookie), the front-end client and its React bindings, the door contracts and test doubles; the one importer of the identity libraries, reached by a back end only through integrations/passport; @starci/jest-preset compiles it as an ESM-only dependency.'
|
|
136
|
+
'@starci/auth-oidc':
|
|
137
|
+
version: 0.1.0
|
|
138
|
+
group: starci
|
|
139
|
+
install: registry
|
|
140
|
+
side: both
|
|
141
|
+
source: packages/auth-oidc/package.json
|
|
142
|
+
why: 'the full sign-in: the OIDC client of the identity provider (Keycloak) behind the PrincipalVerifier of @starci/auth, so guards do not change between editions: the NestJS module (issuer discovery, the JWKS with caching and rotation, algorithm-pinned token checks, role mapping, the authorization code flow with PKCE and nonce), the front-end client (PKCE redirect, one shared refresh, tokens in memory) and the fake issuer for tests; the one importer of jose in a full app, reached by a back end only through integrations/keycloak; @starci/jest-preset compiles it as an ESM-only dependency.'
|
|
143
|
+
'@starci/object-storage':
|
|
144
|
+
version: 0.1.0
|
|
145
|
+
group: starci
|
|
146
|
+
install: registry
|
|
147
|
+
side: be
|
|
148
|
+
source: packages/object-storage/package.json
|
|
149
|
+
why: 'object storage of a back end: a NestJS module and the ObjectStorage port over S3-compatible storage (presigned PUT and GET that sign the content type and size, head, get, put, list, delete, bucket setup, size and content-type limits, coded errors), with @starci/object-storage/testing for its specs; the only importer of @aws-sdk/client-s3 and @aws-sdk/s3-request-presigner (R331).'
|
|
150
|
+
'@starci/mail':
|
|
151
|
+
version: 0.1.0
|
|
152
|
+
group: starci
|
|
153
|
+
install: registry
|
|
154
|
+
side: be
|
|
155
|
+
source: packages/mail/package.json
|
|
156
|
+
why: 'outgoing mail of a back end: a NestJS module and the Mailer port over SMTP (connect, greeting, socket and total timeouts, STARTTLS required by default, recipient, message and attachment checks, a shared SMTP target policy, coded errors, typed escaping render helpers returning { subject, text, html }), with @starci/mail/testing for its specs; the only importer of nodemailer (R90).'
|
|
108
157
|
'@starci/hfs':
|
|
109
|
-
version: 5.
|
|
158
|
+
version: 5.3.0
|
|
110
159
|
group: starci
|
|
111
160
|
install: registry
|
|
112
161
|
side: both
|
|
@@ -543,12 +592,17 @@ pins:
|
|
|
543
592
|
version: 3.1150.0
|
|
544
593
|
group: framework
|
|
545
594
|
side: be
|
|
546
|
-
why: 'the S3 transport
|
|
595
|
+
why: 'the S3 transport inside @starci/object-storage, the one ObjectStorage adapter of both editions (MinIO, S3, Spaces), which depends on it at exactly this version and which no app file imports; 3.1150.0 is the release of 2026-10-12, chosen over newer ones that had not aged two weeks.'
|
|
547
596
|
'@aws-sdk/s3-request-presigner':
|
|
548
597
|
version: 3.1150.0
|
|
549
598
|
group: framework
|
|
550
599
|
side: be
|
|
551
|
-
why: 'signs the presigned PUT and GET
|
|
600
|
+
why: 'signs the presigned PUT and GET inside @starci/object-storage locally, the same release as client-s3; no app file imports it.'
|
|
601
|
+
nodemailer:
|
|
602
|
+
version: 10.1.7
|
|
603
|
+
group: framework
|
|
604
|
+
side: be
|
|
605
|
+
why: 'the SMTP client inside @starci/mail, which depends on it at exactly this version and which no app file imports; 10.1.7 is the release of 2026-10-18, chosen over newer ones that had not aged two weeks.'
|
|
552
606
|
'@apollo/server':
|
|
553
607
|
version: 5.5.1
|
|
554
608
|
group: framework
|
|
@@ -649,7 +703,7 @@ pins:
|
|
|
649
703
|
version: 6.2.12
|
|
650
704
|
group: framework
|
|
651
705
|
side: be
|
|
652
|
-
why: signs the app's own
|
|
706
|
+
why: signs the app's own access tokens and verifies them against its own key set inside @starci/auth, and verifies the identity provider's tokens against its JWKS inside @starci/auth-oidc; no app file imports it.
|
|
653
707
|
class-transformer:
|
|
654
708
|
version: 0.5.1
|
|
655
709
|
group: framework
|
|
@@ -133,8 +133,8 @@ rules:
|
|
|
133
133
|
- {path: packages/hfs/src/hfs-managed-file-drift.spec.mjs, edition: full, codes: [HFS_MANAGED_FILE_DRIFT]}
|
|
134
134
|
- id: R06
|
|
135
135
|
code: "HFS_PLAINTEXT_SECRET"
|
|
136
|
-
law: "Secrets exist only as `.starcistacks/<env>/secrets/<slug>.enc`."
|
|
137
|
-
kinds: [check, design]
|
|
136
|
+
law: "Secrets exist only as `.starcistacks/<env>/secrets/<slug>.enc`; the committed check cache (`.starcistacks/cache/check/secrets/`) holds codes, paths, positions and digests only, and is judged by what it holds."
|
|
137
|
+
kinds: [check, design, codemod]
|
|
138
138
|
gates: [pre-commit, land, ci]
|
|
139
139
|
failureCodes: ["HFS_PLAINTEXT_SECRET"]
|
|
140
140
|
enforcers:
|
|
@@ -143,7 +143,7 @@ rules:
|
|
|
143
143
|
editions: [lite, full]
|
|
144
144
|
docs: [docs/legacy-managed-rule-coverage.md#r06-plaintext-secrets]
|
|
145
145
|
templateNa: "Encrypted secrets are supplied by the app secret command; plaintext secret files are forbidden and are never scaffolded."
|
|
146
|
-
proves: [packages/hfs/src/hfs-plaintext-secret.spec.mjs]
|
|
146
|
+
proves: [packages/hfs/src/hfs-plaintext-secret.spec.mjs, packages/hfs/src/check-cache-secret-records.spec.mjs]
|
|
147
147
|
exemplifiedBy:
|
|
148
148
|
- {path: packages/hfs/src/hfs-plaintext-secret.spec.mjs, editions: [lite, full]}
|
|
149
149
|
witness:
|
|
@@ -1216,7 +1216,7 @@ rules:
|
|
|
1216
1216
|
code: "FE_I18N_PLACEMENT"
|
|
1217
1217
|
editions: [lite, full]
|
|
1218
1218
|
docs: [docs/architecture.md#r59]
|
|
1219
|
-
law: "`next-intl` with `[locale]`;
|
|
1219
|
+
law: "`next-intl` with `[locale]`; the stack (routing, proxy, navigation, request config, the layout's locale read) is built by `@starci/next-i18n` over the app's `defineI18n` description and by no product source. A single app keeps the description and its request config in `modules/i18n` and builds its navigation with `createI18nNavigation` in the `modules/routes` public entry; apps that share a product share one `fe/packages/<family>-i18n` workspace package that holds the description and composes the package's factories through `createAppI18n`. The proxy is `createProxy` of `@starci/next-i18n/proxy` and never evaluates navigation runtime."
|
|
1220
1220
|
kinds: [check, codemod, lint]
|
|
1221
1221
|
gates: [settle, land, ci]
|
|
1222
1222
|
failureCodes: ["FE_I18N_PLACEMENT", "FE_I18N_NAVIGATION", "FE_I18N_FORMATTER"]
|
|
@@ -1269,6 +1269,7 @@ rules:
|
|
|
1269
1269
|
- {kind: stylelint, id: raw-brand-value}
|
|
1270
1270
|
- {kind: stylelint, id: no-apply-raw}
|
|
1271
1271
|
- {kind: stylelint, id: no-important}
|
|
1272
|
+
- {kind: stylelint, id: no-self-reference}
|
|
1272
1273
|
- {kind: stylelint, id: globals-shape}
|
|
1273
1274
|
- {kind: stylelint, id: globals-import-order}
|
|
1274
1275
|
- {kind: stylelint, id: no-token-redefinition}
|
|
@@ -4084,6 +4085,7 @@ rules:
|
|
|
4084
4085
|
enforcers:
|
|
4085
4086
|
- {kind: hfs, id: fe-stack, at: scripts/hfs/rules/fe-stack.mjs}
|
|
4086
4087
|
- {kind: eslint-fe, id: fe-stack-import}
|
|
4088
|
+
- {kind: eslint-fe, id: swr-extension-from-package}
|
|
4087
4089
|
proves:
|
|
4088
4090
|
- {path: packages/eslint/fe/frontend-boundary-coverage.spec.mjs, editions: [lite, full], codes: [FE_STACK_FORBIDDEN]}
|
|
4089
4091
|
- {path: packages/hfs/src/frontend-boundary-coverage.spec.mjs, editions: [lite, full], codes: [FE_STACK_FORBIDDEN]}
|
|
@@ -4262,7 +4264,7 @@ rules:
|
|
|
4262
4264
|
editionWhy: "owner:lite-backing-services makes the db service lite's database; application-role and forced-RLS requirements apply to that backing."
|
|
4263
4265
|
docs: [docs/microservices.md#r255]
|
|
4264
4266
|
templateNa: "Application roles and table ownership are product-authored db migration content, rather than a scaffolded SQL surface."
|
|
4265
|
-
law: "The declared back-end database role (app_be by default) has only the privileges it needs: role declarations refuse superuser and bypassrls, require noinherit and nobypassrls,
|
|
4267
|
+
law: "The declared back-end database role (app_be by default) has only the privileges it needs: role declarations refuse superuser and bypassrls, require noinherit and nobypassrls, never grant all schema or table privileges, and leave it with no grant after the last migration on schema auth, on a table or sequence in it, or by default privilege for it (accounts are reached through SECURITY DEFINER doors; a later migration that revokes a grant clears it). Tables owned by that role enable and force row level security by default; a forceRls exemption identifies the table and carries a nonempty reason. This applies to every edition that declares Supabase."
|
|
4266
4268
|
kinds: [check]
|
|
4267
4269
|
gates: [settle, land, ci]
|
|
4268
4270
|
failureCodes: ["DB_APP_ROLE", "DB_FORCE_RLS_DEFAULT"]
|
|
@@ -4772,7 +4774,7 @@ rules:
|
|
|
4772
4774
|
|
|
4773
4775
|
- id: R279
|
|
4774
4776
|
code: "BE_THIRD_PARTY_OWNER"
|
|
4775
|
-
law: "Third-party SDK ownership is derived from the app's package.json dependencies rather than a finite SDK table. A dependency outside the pure-library and framework allowlists is imported only by one integrations/<provider> capability; domain services call that integration's public API. Existing infrastructure owner restrictions remain in force."
|
|
4777
|
+
law: "Third-party SDK ownership is derived from the app's package.json dependencies rather than a finite SDK table. A dependency outside the pure-library and framework allowlists is imported only by one integrations/<provider> capability; domain services call that integration's public API. A workspace package of the app itself (a folder the root workspaces of package.json name) is first-party source and no SDK; what it imports is judged over its own files. Existing infrastructure owner restrictions remain in force."
|
|
4776
4778
|
kinds: [lint]
|
|
4777
4779
|
gates: [pre-commit, settle, land, ci]
|
|
4778
4780
|
failureCodes: ["BE_THIRD_PARTY_OWNER"]
|
|
@@ -5082,7 +5084,7 @@ rules:
|
|
|
5082
5084
|
- {path: packages/hfs/src/hfs-stacks-deploy.spec.mjs, editions: [lite, full]}
|
|
5083
5085
|
- id: R295
|
|
5084
5086
|
code: "BE_MODULE_DEFINITION_MISSING"
|
|
5085
|
-
law: "Every NestJS module of the product has a module definition (owner ruling 2026-10-15, owner:module-definition-everywhere): capability modules, sub-modules, features, transport modules and cli groups alike. For a module `<x>` the folder holds `<x>.module-definition.ts` (`export const { ConfigurableModuleClass, MODULE_OPTIONS_TOKEN, OPTIONS_TYPE } =
|
|
5087
|
+
law: "Every NestJS module of the product has a module definition (owner ruling 2026-10-15, owner:module-definition-everywhere): capability modules, sub-modules, features, transport modules and cli groups alike. For a module `<x>` the folder holds `<x>.module-definition.ts` (`export const { ConfigurableModuleClass, MODULE_OPTIONS_TOKEN, OPTIONS_TYPE, ASYNC_OPTIONS_TYPE } = defineConfigurableModule<XOptions>()` of `@starci/nest-kit`, which states the exported types so the file is neither an inferred surface (R368) nor a clone of its neighbour (R21); the representative module of a capability calls `defineCapabilityModule<XOptions>()`, which adds the `isGlobal` extra defaulting to `false`; `starci app codemod module-definition` rewrites a definition written with `ConfigurableModuleBuilder`), `<x>.options.ts` (`export type XOptions`, `Record<string, never>` with a one-line doc when it takes nothing yet) and `<x>.module.ts` (`@Module({...}) export class XModule extends ConfigurableModuleClass {}`, no `register` override except the capability representative's). A module appears in an `imports` array or in an app composition group only as `XModule.register({...})`, never as a bare class. The `AppModule` of an app root and the test world are composition roots and are not judged."
|
|
5086
5088
|
kinds: [lint, codemod]
|
|
5087
5089
|
gates: [pre-commit, settle, land, ci]
|
|
5088
5090
|
failureCodes: ["BE_MODULE_DEFINITION_MISSING"]
|
|
@@ -5696,20 +5698,23 @@ rules:
|
|
|
5696
5698
|
ruling: "A model call made straight from code uses LangChain with retrieved context, through the ai-router gateway (owner ruling be-ai-langchain-gateway): the LangChain clients point at the gateway's base URL with its virtual key."
|
|
5697
5699
|
- id: R328
|
|
5698
5700
|
code: "BE_AUTH_PASSPORT_OWNER"
|
|
5699
|
-
law: "The identity libraries (@nestjs/passport, passport, passport-google-oauth20, passport-local, @nestjs/jwt, jose and bcryptjs) are
|
|
5701
|
+
law: "The identity libraries (@nestjs/passport, passport, passport-google-oauth20, passport-local, @nestjs/jwt, jose and bcryptjs) are the dependencies of @starci/auth (lite) and of @starci/auth-oidc (full, which owns jose for its provider tokens) and are imported by no app file; @starci/auth/server is imported only by integrations/passport and @starci/auth-oidc/server only by integrations/keycloak, each package's one glue. bcrypt and every Supabase client are owned nowhere."
|
|
5700
5702
|
kinds: [lint]
|
|
5701
5703
|
gates: [pre-commit, settle, land, ci]
|
|
5702
5704
|
failureCodes: ["BE_AUTH_PASSPORT_OWNER"]
|
|
5703
5705
|
enforcers:
|
|
5704
5706
|
- {kind: eslint-be, id: infra-import-owner}
|
|
5705
|
-
editions: [lite]
|
|
5707
|
+
editions: [lite, full]
|
|
5706
5708
|
docs: [contexts/code/be/api-auth.md]
|
|
5707
5709
|
proves:
|
|
5708
5710
|
- packages/eslint-canon-be/src/auth-passport.spec.ts
|
|
5711
|
+
- packages/eslint-canon-be/src/auth-oidc-package.spec.ts
|
|
5709
5712
|
exemplifiedBy:
|
|
5710
5713
|
- {path: packages/hfs/templates/be/skeleton-lite/src/modules/integrations/passport/passport.tokens.ts, edition: lite}
|
|
5714
|
+
- {path: packages/auth-oidc/src/server/index.ts, edition: full}
|
|
5711
5715
|
witness:
|
|
5712
5716
|
- {path: packages/eslint-canon-be/src/auth-passport.spec.ts, edition: lite, codes: [BE_AUTH_PASSPORT_OWNER]}
|
|
5717
|
+
- {path: packages/eslint-canon-be/src/auth-oidc-package.spec.ts, edition: full, codes: [BE_AUTH_PASSPORT_OWNER]}
|
|
5713
5718
|
cases:
|
|
5714
5719
|
- id: case-1
|
|
5715
5720
|
date: "2026-10-29"
|
|
@@ -5718,7 +5723,7 @@ rules:
|
|
|
5718
5723
|
ruling: "Lite leaves Supabase: its identity is the app own Passport integration (Google OAuth and email/password) on its self-hosted PostgreSQL; full keeps Keycloak."
|
|
5719
5724
|
- id: R329
|
|
5720
5725
|
code: "BE_AUTH_JWT_OWN_JWKS"
|
|
5721
|
-
law: "A lite back-end principal comes only from the app's own access token verified by
|
|
5726
|
+
law: "A lite back-end principal comes only from the app's own access token, verified by @starci/auth (EdDSA pinned, issuer and audience checked, a local key set that may hold several keys), never from a remote JWKS, a token decoded without its signature check, a jwtVerify call in the app or a body claim."
|
|
5722
5727
|
kinds: [check, lint]
|
|
5723
5728
|
gates: [pre-commit, settle, land, ci]
|
|
5724
5729
|
failureCodes: ["BE_AUTH_JWT_OWN_JWKS"]
|
|
@@ -5742,7 +5747,7 @@ rules:
|
|
|
5742
5747
|
ruling: "The lite back end verifies its own asymmetric access tokens against its own JWKS; it trusts no remote identity provider."
|
|
5743
5748
|
- id: R330
|
|
5744
5749
|
code: "BE_AUTH_REFRESH_COOKIE"
|
|
5745
|
-
law: "A refresh token travels only in
|
|
5750
|
+
law: "A refresh token travels only in the httpOnly, Secure cookie that @starci/auth sets, rotates (with a reuse grace window and reuse detection) and clears; no app file writes that cookie, and the token never appears as a field of a request or response body."
|
|
5746
5751
|
kinds: [lint]
|
|
5747
5752
|
gates: [pre-commit, settle, land, ci]
|
|
5748
5753
|
failureCodes: ["BE_AUTH_REFRESH_COOKIE"]
|
|
@@ -5764,7 +5769,7 @@ rules:
|
|
|
5764
5769
|
ruling: "The refresh token of the lite identity rotates and lives only in an httpOnly cookie; the browser holds no credential."
|
|
5765
5770
|
- id: R331
|
|
5766
5771
|
code: "BE_STORAGE_OWNER"
|
|
5767
|
-
law: "The S3 client (@aws-sdk/client-s3 and @aws-sdk/s3-request-presigner)
|
|
5772
|
+
law: "The S3 client libraries (@aws-sdk/client-s3 and @aws-sdk/s3-request-presigner) are the dependencies of @starci/object-storage, the ObjectStorage port over S3-compatible storage (MinIO in lite) with presigned PUT and GET, and are imported by no app file; @starci/object-storage is imported only by integrations/object-storage, its one glue; no module imports minio."
|
|
5768
5773
|
kinds: [lint]
|
|
5769
5774
|
gates: [pre-commit, settle, land, ci]
|
|
5770
5775
|
failureCodes: ["BE_STORAGE_OWNER"]
|
|
@@ -5773,11 +5778,11 @@ rules:
|
|
|
5773
5778
|
editions: [lite, full]
|
|
5774
5779
|
docs: [contexts/code/be/infra.md]
|
|
5775
5780
|
proves:
|
|
5776
|
-
- packages/eslint-canon-be/src/
|
|
5781
|
+
- packages/eslint-canon-be/src/object-storage-package.spec.ts
|
|
5777
5782
|
exemplifiedBy:
|
|
5778
|
-
- {path: packages/hfs/templates/be/skeleton-lite/src/modules/integrations/object-storage/object-storage.
|
|
5783
|
+
- {path: packages/hfs/templates/be/skeleton-lite/src/modules/integrations/object-storage/object-storage.module.ts, edition: lite}
|
|
5779
5784
|
witness:
|
|
5780
|
-
- {path: packages/eslint-canon-be/src/
|
|
5785
|
+
- {path: packages/eslint-canon-be/src/object-storage-package.spec.ts, editions: [lite, full], codes: [BE_STORAGE_OWNER]}
|
|
5781
5786
|
cases:
|
|
5782
5787
|
- id: case-1
|
|
5783
5788
|
date: "2026-10-29"
|
|
@@ -6576,3 +6581,50 @@ rules:
|
|
|
6576
6581
|
source: owner
|
|
6577
6582
|
quote: "no lint caught it"
|
|
6578
6583
|
ruling: "A directive below an import broke Nivo's CI build on 2026-11-02; the directive is the first statement of its module and a lint reports it elsewhere."
|
|
6584
|
+
- id: R372
|
|
6585
|
+
code: "STACKS_LOCAL_CONFIG_INVALID"
|
|
6586
|
+
law: "In lite and full apps, every docker-compose environment of .starcistacks/application-stacks.yaml declares a coherent `local` block, judged by the same normalizeLocal the dev verbs of `starci app stack` (doctor, prepare, up, status, logs, verify, down) use: closed fields, one loopback port each, compose services that exist in the compose files, an environment-owned database role (never postgres, never the app role), dev-only custody generators and loopback probes; and a lite app declares at least one such dev environment, so `starci app stack up --env dev` has something to run."
|
|
6587
|
+
kinds: [check]
|
|
6588
|
+
gates: [settle, land, ci]
|
|
6589
|
+
failureCodes: ["STACKS_LOCAL_CONFIG_INVALID", "STACKS_DEV_UNDECLARED"]
|
|
6590
|
+
enforcers:
|
|
6591
|
+
- {kind: hfs, id: stacks-local, at: scripts/hfs/rules/stacks-local.mjs}
|
|
6592
|
+
editions: [lite, full]
|
|
6593
|
+
docs:
|
|
6594
|
+
- {path: contexts/project/stacks.md#project-stacks-6-every-runbook-declares-the-same-operations, editions: [lite, full]}
|
|
6595
|
+
proves:
|
|
6596
|
+
- {path: packages/hfs/src/stack-local.spec.mjs, editions: [lite, full]}
|
|
6597
|
+
exemplifiedBy:
|
|
6598
|
+
- {path: packages/hfs/templates/app/skeleton-lite/.starcistacks, edition: lite}
|
|
6599
|
+
witness:
|
|
6600
|
+
- {path: packages/hfs/src/stack-local.spec.mjs, editions: [lite, full]}
|
|
6601
|
+
- id: R373
|
|
6602
|
+
code: "STACKS_RUNBOOK_DOCKER_COMMAND"
|
|
6603
|
+
law: "The runbook of a docker-compose environment names `starci app stack up --env <env>` and carries no `docker build|run|compose|create|start|stop|pull|push` or `docker stack deploy` command: Docker is run by the harness verb, never by hand (hard rule 8)."
|
|
6604
|
+
kinds: [check]
|
|
6605
|
+
gates: [settle, land, ci]
|
|
6606
|
+
failureCodes: ["STACKS_RUNBOOK_DOCKER_COMMAND"]
|
|
6607
|
+
enforcers:
|
|
6608
|
+
- {kind: hfs, id: stacks-local, at: scripts/hfs/rules/stacks-local.mjs}
|
|
6609
|
+
editions: [lite, full]
|
|
6610
|
+
docs:
|
|
6611
|
+
- {path: contexts/project/stacks.md#project-stacks-10-local-runs, editions: [lite, full]}
|
|
6612
|
+
proves:
|
|
6613
|
+
- {path: packages/hfs/src/stack-local.spec.mjs, editions: [lite, full]}
|
|
6614
|
+
exemplifiedBy:
|
|
6615
|
+
- {path: packages/hfs/templates/app/skeleton-lite/.starcistacks, edition: lite}
|
|
6616
|
+
witness:
|
|
6617
|
+
- {path: packages/hfs/src/stack-local.spec.mjs, editions: [lite, full]}
|
|
6618
|
+
- id: R374
|
|
6619
|
+
code: "STACKS_CODE_BIND_MOUNT"
|
|
6620
|
+
law: "A service the app customises runs from an image built out of `.starcistacks/images/<name>/` (a Dockerfile whose every FROM is digest-pinned and whose final stage is the harness's image for that service, the fork or its runtime layer, when the harness owns one), the same image in every environment; no stack or compose file bind-mounts code, plugins or scripts into a service container (data volumes, secrets, least grants and read-only plain config data files stay allowed)."
|
|
6621
|
+
kinds: [check]
|
|
6622
|
+
gates: [settle, land, ci]
|
|
6623
|
+
failureCodes: ["STACKS_CODE_BIND_MOUNT", "STACKS_IMAGE_BASE_UNPINNED", "STACKS_IMAGE_BASE_NOT_FORK", "STACKS_IMAGE_ENV_DIVERGES"]
|
|
6624
|
+
enforcers:
|
|
6625
|
+
- {kind: hfs, id: stacks-service-images, at: scripts/hfs/rules/stacks-service-images.mjs}
|
|
6626
|
+
editions: [lite, full]
|
|
6627
|
+
docs:
|
|
6628
|
+
- {path: contexts/project/stacks.md#project-stacks-11-a-customised-service-is-an-image-the-app-builds-the-same-in-every-environment, editions: [lite, full]}
|
|
6629
|
+
proves:
|
|
6630
|
+
- {path: packages/hfs/src/stacks-service-images.spec.mjs, editions: [lite, full]}
|
|
@@ -236,17 +236,29 @@ ruleParams:
|
|
|
236
236
|
"node:https": [platform/http]
|
|
237
237
|
http: [platform/http]
|
|
238
238
|
https: [platform/http]
|
|
239
|
-
"@aws-sdk/client-s3": [
|
|
240
|
-
"@aws-sdk/s3-request-presigner": [
|
|
241
|
-
|
|
239
|
+
"@aws-sdk/client-s3": [] # the S3 client is a dependency of @starci/object-storage, imported by no app file (R331)
|
|
240
|
+
"@aws-sdk/s3-request-presigner": []
|
|
241
|
+
"@starci/object-storage": [integrations/object-storage] # the ObjectStorage port: one S3 adapter for MinIO, S3 and Spaces (R331)
|
|
242
|
+
minio: [] # storage goes through @starci/object-storage
|
|
243
|
+
nodemailer: [] # the SMTP client is a dependency of @starci/mail alone; no app file imports it
|
|
244
|
+
"@starci/mail": [integrations/mail] # outgoing mail: the Mailer port, parsed and registered by its one glue
|
|
242
245
|
"@supabase": [] # no Supabase client in a back end
|
|
243
|
-
"@nestjs/passport": [
|
|
244
|
-
passport: [
|
|
245
|
-
passport-google-oauth20: [
|
|
246
|
-
passport-local: [
|
|
247
|
-
"@nestjs/jwt": [
|
|
248
|
-
jose: [
|
|
249
|
-
bcryptjs: [
|
|
246
|
+
"@nestjs/passport": [] # the identity libraries are @starci/auth's dependencies, never an app's (R328)
|
|
247
|
+
passport: []
|
|
248
|
+
passport-google-oauth20: []
|
|
249
|
+
passport-local: []
|
|
250
|
+
"@nestjs/jwt": []
|
|
251
|
+
jose: []
|
|
252
|
+
bcryptjs: []
|
|
253
|
+
jsonwebtoken: [] # no other JWT or OIDC client library in a back end: the tokens of an identity provider are verified by @starci/auth-oidc (R328)
|
|
254
|
+
jwks-rsa: []
|
|
255
|
+
jwt-decode: []
|
|
256
|
+
passport-jwt: []
|
|
257
|
+
openid-client: []
|
|
258
|
+
"@starci/auth": [integrations/passport] # the lite sign-in package: its server entry is reached only through integrations/passport (R328)
|
|
259
|
+
"@starci/auth/testing": [integrations/passport] # its test doubles, for the glue's specs
|
|
260
|
+
"@starci/auth-oidc": [integrations/keycloak] # the full sign-in package (jose is its dependency, imported by no app file): its server entry is reached only through integrations/keycloak (R328)
|
|
261
|
+
"@starci/auth-oidc/testing": [integrations/keycloak] # its fake issuer, for the glue's specs
|
|
250
262
|
bcrypt: []
|
|
251
263
|
cache-manager: [integrations/cache, integrations/redis]
|
|
252
264
|
"@nestjs/cache-manager": [integrations/cache, integrations/redis] # the CACHE_MANAGER token: caching goes through the cache capability
|
|
@@ -460,6 +472,14 @@ ruleParams:
|
|
|
460
472
|
- {name: public.event_bus_bury, reason: "platform/event-bus (add webhook, lite): the move of an exhausted or malformed message to its consumer's dead-letter queue"}
|
|
461
473
|
- {name: public.event_bus_dead_letters, reason: "platform/event-bus (add webhook, lite): the operator read of a consumer's dead-letter queue"}
|
|
462
474
|
- {name: public.event_bus_requeue, reason: "platform/event-bus (add webhook, lite): the operator requeue of one dead letter"}
|
|
475
|
+
- {name: public.be_auth_user_by_email, reason: "domain/identity (lite sign-in): the account of an exact sign-in address with its bcrypt hash, through the account-doors definer of the baseline"}
|
|
476
|
+
- {name: public.be_auth_user_by_id, reason: "domain/identity (lite sign-in): the standing of one account by id (a refresh), through the account-doors definer"}
|
|
477
|
+
- {name: public.be_auth_user_by_google, reason: "domain/identity (lite sign-in): the account a Google subject is linked to, through the account-doors definer"}
|
|
478
|
+
- {name: public.be_auth_create_user, reason: "domain/identity (lite sign-in): the account a first Google sign-in creates, through the account-doors definer"}
|
|
479
|
+
- {name: public.be_auth_link_google, reason: "domain/identity (lite sign-in): the link of a Google subject to an account, through the account-doors definer"}
|
|
480
|
+
- {name: public.be_auth_touch_user, reason: "domain/identity (lite sign-in): the sign-in record of an account and its profile keys, through the account-doors definer"}
|
|
481
|
+
- {name: public.be_auth_confirm_user, reason: "domain/identity (lite sign-in): the confirmation stamp of a mailbox whose link was spent, through the account-doors definer"}
|
|
482
|
+
- {name: public.be_auth_set_password, reason: "domain/identity (lite sign-in): the new password hash of a spent reset link (and the mailbox it proved), through the account-doors definer"}
|
|
463
483
|
# R334 (lite): the only `.query(` outside platform/database's composer and the test world is the pass-through of a file listed here
|
|
464
484
|
# (or in hfs.json sides.be.sqlPassThrough), whose SQL text is not the app's own. Paths are relative to the side folder.
|
|
465
485
|
sqlPassThrough:
|
|
@@ -587,13 +607,24 @@ slots:
|
|
|
587
607
|
- id: app.tool-config-local
|
|
588
608
|
since: 3.1.0
|
|
589
609
|
profiles: [app]
|
|
590
|
-
path: "{tsconfig.json,.eslintrc,.eslintrc.*,.eslintignore,eslint.config
|
|
610
|
+
path: "{tsconfig.json,.eslintrc,.eslintrc.*,.eslintignore,eslint.config.js,eslint.config.cjs,eslint.config.ts,eslint.config.mts,eslint.config.cts,.stylelintrc,.stylelintrc.*,.stylelintignore,stylelint.config.*,.prettierrc.*,prettier.config.*,jest.config.*,lint-staged.config.*,.lintstagedrc*}"
|
|
591
611
|
presence: forbidden
|
|
592
612
|
tracked: external
|
|
593
613
|
tier: none
|
|
594
614
|
tests: none
|
|
595
|
-
goesTo: "nowhere at the app root: each side holds exactly its managed tool configuration (be.tool-config, fe.tool-config) and the root only the formatter (app.format-config)"
|
|
615
|
+
goesTo: "nowhere at the app root: each side holds exactly its managed tool configuration (be.tool-config, fe.tool-config) and the root only the formatter (app.format-config) and the eslint config of its root packages (app.packages-lint)"
|
|
596
616
|
rules: [HFS_TOOL_CONFIG_LOCAL]
|
|
617
|
+
- id: app.packages-lint
|
|
618
|
+
since: 3.17.0
|
|
619
|
+
profiles: [app]
|
|
620
|
+
# The one eslint config at the app root: `starci app sync` renders it when the app has root workspace packages (app.packages), and it lints their
|
|
621
|
+
# source by subpath (the back-end canon, the front-end canon and the Grammar family each over their own subpaths). No other tool config lives here.
|
|
622
|
+
path: eslint.config.mjs
|
|
623
|
+
presence: optional
|
|
624
|
+
tracked: tracked
|
|
625
|
+
tier: none
|
|
626
|
+
tests: none
|
|
627
|
+
rules: [HFS_MANAGED_FILE_DRIFT]
|
|
597
628
|
- id: app.quality-config
|
|
598
629
|
since: 3.1.0
|
|
599
630
|
profiles: [app]
|
|
@@ -825,6 +856,31 @@ slots:
|
|
|
825
856
|
rules: [HFS_PLAINTEXT_SECRET, HFS_SCRIPT_ONE_OFF, BE_SPEC_PLACEMENT, HFS_REPO_LOCAL_CHECK]
|
|
826
857
|
exemplifiedBy:
|
|
827
858
|
- {path: packages/hfs/src/hfs-slot-ownership.spec.mjs, editions: [lite, full]}
|
|
859
|
+
- id: app.packages
|
|
860
|
+
since: 3.17.0
|
|
861
|
+
profiles: [app]
|
|
862
|
+
editionWhy: Lite and full share the slot; a product's agent SDK and its agent modules are workspace packages in both.
|
|
863
|
+
# A workspace package of the app ROOT (packages/agent-sdk, packages/module-<name>): first-party source that both sides import through its
|
|
864
|
+
# package entry points and never past them (ARCH_INTERNAL_IMPORT_OUTSIDE), linted by the root eslint config by subpath.
|
|
865
|
+
path: "packages/{agent-sdk,module-<name>}/"
|
|
866
|
+
presence: optional
|
|
867
|
+
tracked: tracked
|
|
868
|
+
tier: none
|
|
869
|
+
requires: [package.json, tsconfig.json, src/index.ts]
|
|
870
|
+
tests: unit-beside
|
|
871
|
+
rules: [HFS_UNUSED_EXPORT]
|
|
872
|
+
- id: app.module-registry
|
|
873
|
+
since: 3.17.0
|
|
874
|
+
profiles: [app]
|
|
875
|
+
editionWhy: Lite and full share the slot; the registry lists the module packages of the app.
|
|
876
|
+
path: packages/modules/
|
|
877
|
+
presence: optional
|
|
878
|
+
tracked: tracked
|
|
879
|
+
tier: none
|
|
880
|
+
requires: [package.json, src/index.ts]
|
|
881
|
+
allows: [package.json, tsconfig.json, tsconfig.build.json, src/index.ts, src/template/index.ts, src/manifest/index.ts]
|
|
882
|
+
tests: none
|
|
883
|
+
rules: [HFS_MANAGED_FILE_DRIFT]
|
|
828
884
|
- id: app.sides
|
|
829
885
|
since: 3.1.0
|
|
830
886
|
profiles: [app]
|
|
@@ -1978,40 +2034,110 @@ slots:
|
|
|
1978
2034
|
editions: [lite]
|
|
1979
2035
|
exemplifiedBy:
|
|
1980
2036
|
- packages/hfs/templates/be/skeleton-lite/src/modules/integrations/passport/
|
|
1981
|
-
# The
|
|
1982
|
-
#
|
|
1983
|
-
#
|
|
1984
|
-
#
|
|
2037
|
+
# The glue of @starci/auth, the lite sign-in package (Google OAuth with state and PKCE, email and password, EdDSA access tokens with
|
|
2038
|
+
# their JWKS, rotating refresh sessions): the one importer of the package (ruleParams.be.infraOwners), which owns the identity
|
|
2039
|
+
# libraries (@nestjs/passport, passport, passport-google-oauth20, passport-local, @nestjs/jwt, jose, bcryptjs) that no app imports.
|
|
2040
|
+
# It parses the typed options, builds the verifier and names the injectors; domain/identity verifies a token through the kit and
|
|
2041
|
+
# builds the principal (contexts/code/be/api-auth.md).
|
|
1985
2042
|
path: "src/modules/integrations/passport/"
|
|
1986
2043
|
presence: required
|
|
1987
2044
|
tracked: tracked
|
|
1988
2045
|
tier: integrations
|
|
1989
2046
|
owner: true
|
|
1990
|
-
requires: [index.ts, passport.config.ts, passport.options.ts, passport.decorators.ts, passport.
|
|
1991
|
-
allows: [index.ts, passport.config.ts, passport.options.ts, passport.decorators.ts, passport.
|
|
1992
|
-
logic: [passport.
|
|
2047
|
+
requires: [index.ts, passport.config.ts, passport.options.ts, passport.decorators.ts, passport.kit.ts, passport.registration.ts] # Secrets, no defaults (R44); options and named injectors (R83); the kit and the module over @starci/auth
|
|
2048
|
+
allows: [index.ts, passport.config.ts, passport.options.ts, passport.decorators.ts, passport.kit.ts, passport.registration.ts, errors/]
|
|
2049
|
+
logic: [passport.kit.ts] # the verifier mapping over the package: measured at 100 per file
|
|
1993
2050
|
tests: unit-beside
|
|
1994
2051
|
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]
|
|
1995
2052
|
coverage: required
|
|
1996
2053
|
since: 3.9.0
|
|
2054
|
+
- id: be.identity.sign-in
|
|
2055
|
+
since: 3.16.0
|
|
2056
|
+
profiles: [be]
|
|
2057
|
+
editions: [lite]
|
|
2058
|
+
editionWhy: "lite signs people in with the package @starci/auth, so its sign-in glue is rendered, not written (owner ruling auth-package); full uses its identity provider."
|
|
2059
|
+
# The identity capability's sign-in glue over @starci/auth: the entities of the session, attempt, refresh-token and email-token tables, the account doors over auth.users and auth.identities, the stores the package asks for (sessions, accounts, rate counter), the authenticator and the service the doors call, with their specs. `starci app sync` renders them; a hand edit is drift.
|
|
2060
|
+
path: "{src/modules/domain/identity/account-directory.service.spec.ts,src/modules/domain/identity/account-directory.service.ts,src/modules/domain/identity/authenticator.service.spec.ts,src/modules/domain/identity/authenticator.service.ts,src/modules/domain/identity/identity-email.log-events.ts,src/modules/domain/identity/identity-email.service.spec.ts,src/modules/domain/identity/identity-email.service.ts,src/modules/domain/identity/identity-sign-in.log-events.ts,src/modules/domain/identity/persistence/account-doors.port.ts,src/modules/domain/identity/persistence/entities/identity-attempt.entity.ts,src/modules/domain/identity/persistence/entities/identity-email-token.entity.ts,src/modules/domain/identity/persistence/entities/identity-refresh-token.entity.ts,src/modules/domain/identity/persistence/entities/identity-session.entity.ts,src/modules/domain/identity/persistence/entities/index.ts,src/modules/domain/identity/rate-counter.service.spec.ts,src/modules/domain/identity/rate-counter.service.ts,src/modules/domain/identity/session-store.service.spec.ts,src/modules/domain/identity/session-store.service.ts,src/modules/domain/identity/sign-in.service.spec.ts,src/modules/domain/identity/sign-in.service.ts,src/tests/fixtures/builders/identity.builder.ts}"
|
|
2061
|
+
presence: optional
|
|
2062
|
+
tracked: tracked
|
|
2063
|
+
tier: inherit
|
|
2064
|
+
tests: unit-beside
|
|
2065
|
+
coverage: none
|
|
2066
|
+
managedBy: auth-lite
|
|
2067
|
+
managedOnly: true # lists files sync renders; the slot owning the path judges them
|
|
2068
|
+
rules: [HFS_MANAGED_FILE_DRIFT]
|
|
2069
|
+
- id: be.feature.auth
|
|
2070
|
+
since: 3.16.0
|
|
2071
|
+
profiles: [be]
|
|
2072
|
+
editions: [lite]
|
|
2073
|
+
editionWhy: "lite signs people in with the package @starci/auth, so its sign-in glue is rendered, not written (owner ruling auth-package); full uses its identity provider."
|
|
2074
|
+
# The auth feature: the REST doors under /auth (login, refresh, session, logout, Google start and callback, jwks) over IdentitySignInService, one command or query and handler per door.
|
|
2075
|
+
path: "{src/features/api/auth/application/auth.contracts.ts,src/features/api/auth/application/confirm.command.ts,src/features/api/auth/application/confirm.handler.ts,src/features/api/auth/application/forgot.command.ts,src/features/api/auth/application/forgot.handler.ts,src/features/api/auth/application/get-jwks.handler.ts,src/features/api/auth/application/get-jwks.query.ts,src/features/api/auth/application/google-begin.command.ts,src/features/api/auth/application/google-begin.handler.ts,src/features/api/auth/application/google-complete.command.ts,src/features/api/auth/application/google-complete.handler.ts,src/features/api/auth/application/login.command.ts,src/features/api/auth/application/login.handler.ts,src/features/api/auth/application/logout.command.ts,src/features/api/auth/application/logout.handler.ts,src/features/api/auth/application/refresh.command.ts,src/features/api/auth/application/refresh.handler.ts,src/features/api/auth/application/resend.command.ts,src/features/api/auth/application/resend.handler.ts,src/features/api/auth/application/reset.command.ts,src/features/api/auth/application/reset.handler.ts,src/features/api/auth/application/session.command.ts,src/features/api/auth/application/session.handler.ts,src/features/api/auth/application/signup.command.ts,src/features/api/auth/application/signup.handler.ts,src/features/api/auth/auth.module-definition.ts,src/features/api/auth/auth.module.ts,src/features/api/auth/auth.options.ts,src/features/api/auth/index.ts,src/features/api/auth/transport/http/auth-http.module-definition.ts,src/features/api/auth/transport/http/auth-http.module.ts,src/features/api/auth/transport/http/auth-http.options.ts,src/features/api/auth/transport/http/auth.controller.ts,src/features/api/auth/transport/http/dto/forgot.request.ts,src/features/api/auth/transport/http/dto/google-start.request.ts,src/features/api/auth/transport/http/dto/login.request.ts,src/features/api/auth/transport/http/dto/resend.request.ts,src/features/api/auth/transport/http/dto/reset.request.ts,src/features/api/auth/transport/http/dto/signup.request.ts,src/features/api/auth/transport/http/dto/token.request.ts}"
|
|
2076
|
+
presence: optional
|
|
2077
|
+
tracked: tracked
|
|
2078
|
+
tier: inherit
|
|
2079
|
+
tests: none
|
|
2080
|
+
coverage: none
|
|
2081
|
+
managedBy: auth-lite
|
|
2082
|
+
managedOnly: true # lists files sync renders; the slot owning the path judges them
|
|
2083
|
+
rules: [HFS_MANAGED_FILE_DRIFT]
|
|
2084
|
+
- id: be.integrations.mail
|
|
2085
|
+
profiles: [be]
|
|
2086
|
+
editions: [lite]
|
|
2087
|
+
exemplifiedBy:
|
|
2088
|
+
- packages/hfs/templates/be/skeleton-lite/src/modules/integrations/mail/
|
|
2089
|
+
# The glue of @starci/mail, the owner of the SMTP client (nodemailer): this folder parses the settings (the server, the sender and the
|
|
2090
|
+
# link lifetimes of the confirmation and reset mails), registers the module and names the injectors; no app file imports nodemailer,
|
|
2091
|
+
# and no other module imports the package. The words and layout of each mail belong to the domain that sends it.
|
|
2092
|
+
path: "src/modules/integrations/mail/"
|
|
2093
|
+
presence: required
|
|
2094
|
+
tracked: tracked
|
|
2095
|
+
tier: integrations
|
|
2096
|
+
owner: true
|
|
2097
|
+
requires: [index.ts, mail.config.ts, mail.options.ts, mail.decorators.ts, mail.module-definition.ts, mail.module.ts]
|
|
2098
|
+
allows: [index.ts, mail.config.ts, mail.options.ts, mail.decorators.ts, mail.module-definition.ts, mail.module.ts, errors/]
|
|
2099
|
+
tests: unit-beside
|
|
2100
|
+
rules: [BE_TIER_DIRECTION, BE_ERROR_HOME, BE_SECRET_DEFAULT, BE_INFRA_OWNER]
|
|
2101
|
+
coverage: required
|
|
2102
|
+
since: 5.3.0
|
|
1997
2103
|
- id: be.integrations.object-storage
|
|
1998
2104
|
profiles: [be]
|
|
1999
2105
|
exemplifiedBy:
|
|
2000
2106
|
- packages/hfs/templates/be/skeleton-lite/src/modules/integrations/object-storage/
|
|
2001
|
-
# The
|
|
2002
|
-
# lite): the
|
|
2107
|
+
# The glue of @starci/object-storage, the owner of the S3 client (@aws-sdk/client-s3 and @aws-sdk/s3-request-presigner) over
|
|
2108
|
+
# S3-compatible storage (MinIO in lite): this folder keeps the bucket, parses the settings and registers the module; no app
|
|
2109
|
+
# file imports an S3 SDK or minio, and no other module imports the package.
|
|
2003
2110
|
path: "src/modules/integrations/object-storage/"
|
|
2004
2111
|
presence: optional
|
|
2005
2112
|
litePresence: required
|
|
2006
2113
|
tracked: tracked
|
|
2007
2114
|
tier: integrations
|
|
2008
2115
|
owner: true
|
|
2009
|
-
requires: [index.ts, object-storage.config.ts, object-storage.options.ts, object-storage.decorators.ts, object-storage.
|
|
2010
|
-
allows: [index.ts, object-storage.
|
|
2116
|
+
requires: [index.ts, object-storage.config.ts, object-storage.options.ts, object-storage.decorators.ts, object-storage.module-definition.ts, object-storage.module.ts]
|
|
2117
|
+
allows: [index.ts, object-storage.config.ts, object-storage.options.ts, object-storage.decorators.ts, object-storage.module-definition.ts, object-storage.module.ts, errors/]
|
|
2011
2118
|
tests: unit-beside
|
|
2012
2119
|
rules: [BE_TIER_DIRECTION, BE_ERROR_HOME, BE_SECRET_DEFAULT, BE_INFRA_OWNER, BE_STORAGE_OWNER]
|
|
2013
2120
|
coverage: required
|
|
2014
2121
|
since: 3.9.0
|
|
2122
|
+
- id: be.integrations.keycloak
|
|
2123
|
+
profiles: [be]
|
|
2124
|
+
editions: [full]
|
|
2125
|
+
# The glue of @starci/auth-oidc, the OIDC client of the full edition's identity provider (Keycloak): discovery, the provider's JWKS,
|
|
2126
|
+
# algorithm-pinned token checks and the authorization code flow with PKCE and nonce behind the PrincipalVerifier of @starci/auth.
|
|
2127
|
+
# This folder parses the typed options, hands the package the app's bounded HTTP client and clock, and names the injectors;
|
|
2128
|
+
# no app file imports jose, and no other module imports the package (ruleParams.be.infraOwners).
|
|
2129
|
+
path: "src/modules/integrations/keycloak/"
|
|
2130
|
+
presence: optional
|
|
2131
|
+
tracked: tracked
|
|
2132
|
+
tier: integrations
|
|
2133
|
+
owner: true
|
|
2134
|
+
requires: [index.ts, keycloak.config.ts, keycloak.options.ts, keycloak.decorators.ts, keycloak.registration.ts]
|
|
2135
|
+
allows: [index.ts, keycloak.config.ts, keycloak.options.ts, keycloak.decorators.ts, keycloak.registration.ts, errors/, messages/]
|
|
2136
|
+
tests: unit-beside
|
|
2137
|
+
rules: [BE_TIER_DIRECTION, BE_ERROR_HOME, BE_SECRET_DEFAULT, BE_INFRA_OWNER, BE_AUTH_PASSPORT_OWNER, BE_INTEGRATION_SPEC_MISSING]
|
|
2138
|
+
coverage: required
|
|
2139
|
+
since: 3.17.0
|
|
2140
|
+
|
|
2015
2141
|
|
|
2016
2142
|
# ----- BE: tests (owner test layout 2026-09-30). Unit specs are <name>.service.spec.ts beside their service and nothing else; everything else
|
|
2017
2143
|
# lives under src/tests/, one folder per kind, and the folder and the file suffix always agree (a file whose suffix does
|
|
@@ -2485,9 +2611,9 @@ slots:
|
|
|
2485
2611
|
presence: required
|
|
2486
2612
|
tracked: tracked
|
|
2487
2613
|
tier: foundation
|
|
2488
|
-
# The app's
|
|
2489
|
-
#
|
|
2490
|
-
#
|
|
2614
|
+
# The app's description of its languages (defineI18n of @starci/next-i18n), its request config and catalogs, or its adapter to the
|
|
2615
|
+
# shared i18n workspace package. A single app builds its navigation (createI18nNavigation) in fe.modules.routes, keeping this
|
|
2616
|
+
# public entry safe for its proxy. A description shared by several apps belongs to fe.package.i18n.
|
|
2491
2617
|
requires: [index.ts]
|
|
2492
2618
|
tests: none
|
|
2493
2619
|
rules: [FE_I18N_PLACEMENT, FE_I18N_CATALOG]
|
|
@@ -2541,7 +2667,7 @@ slots:
|
|
|
2541
2667
|
profiles: [fe]
|
|
2542
2668
|
# The identity-provider client (fe-stack auth, FE-AUTH): the session, the access token the Apollo link attaches and the
|
|
2543
2669
|
# 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
|
|
2544
|
-
# the back end's httpOnly cookie and the access token in memory (ruling:lite-self-hosted-postgres-passport-minio).
|
|
2670
|
+
# the back end's httpOnly cookie and the access token in the memory of the one @starci/auth client (ruling:lite-self-hosted-postgres-passport-minio).
|
|
2545
2671
|
path: "apps/<app>/src/modules/auth/"
|
|
2546
2672
|
presence: optional
|
|
2547
2673
|
tracked: tracked
|
|
@@ -2551,6 +2677,20 @@ slots:
|
|
|
2551
2677
|
tests: none
|
|
2552
2678
|
since: 3.0.0
|
|
2553
2679
|
rules: [FE_STACK_FORBIDDEN]
|
|
2680
|
+
- id: fe.modules.auth.client
|
|
2681
|
+
since: 3.16.0
|
|
2682
|
+
profiles: [fe]
|
|
2683
|
+
editions: [lite]
|
|
2684
|
+
editionWhy: "lite signs people in with the package @starci/auth, so its auth client is rendered, not written (owner ruling auth-package); full wires its identity provider."
|
|
2685
|
+
# The AuthClient every edition shares, implemented by one @starci/auth/client instance over the app's own back-end auth doors.
|
|
2686
|
+
path: "apps/web/src/modules/auth/{client.ts,email-doors.ts,index.ts}"
|
|
2687
|
+
presence: optional
|
|
2688
|
+
tracked: tracked
|
|
2689
|
+
tier: inherit
|
|
2690
|
+
tests: none
|
|
2691
|
+
managedBy: auth-lite
|
|
2692
|
+
managedOnly: true # lists files sync renders; the slot owning the path judges them
|
|
2693
|
+
rules: [HFS_MANAGED_FILE_DRIFT]
|
|
2554
2694
|
- id: fe.modules.toast
|
|
2555
2695
|
profiles: [fe]
|
|
2556
2696
|
# Mutation feedback (fe-stack toast, FE-TOAST): the HeroUI toast wrapper, showGraphQLToast over a GraphQLResponse and the
|
|
@@ -2625,7 +2765,7 @@ slots:
|
|
|
2625
2765
|
owner: true
|
|
2626
2766
|
requires: [package.json, src/index.ts, tsconfig.json]
|
|
2627
2767
|
tests: none
|
|
2628
|
-
why: the
|
|
2768
|
+
why: the product's languages (defineI18n of @starci/next-i18n) written once and composed into the createAppI18n factory every app calls; the next-intl stack itself is the package's
|
|
2629
2769
|
rules: [FE_I18N_PLACEMENT, FE_PACKAGE_SHAPE, HFS_UNUSED_EXPORT]
|
|
2630
2770
|
|
|
2631
2771
|
# Checks that read this manifest (all ship from .claude; none keeps its own path list)
|
|
@@ -3,7 +3,8 @@ import path from 'node:path';
|
|
|
3
3
|
import { slash } from '../../lib/path-key.mjs';
|
|
4
4
|
import { readJsonFile as readJson } from '../../lib/json.mjs';
|
|
5
5
|
import { isInside } from '../../lib/walk.mjs';
|
|
6
|
-
import { openHfs } from '../slots.mjs';
|
|
6
|
+
import { createSlotResolver, openHfs, readRepoDeclaration } from '../slots.mjs';
|
|
7
|
+
import { ROOT_PACKAGE_SLOTS, rootPackageRecord, rootWorkspaceDirectories } from './root-packages.mjs';
|
|
7
8
|
import { byCodeUnit } from '../../lib/list.mjs';
|
|
8
9
|
import { grammarContractFor } from '../../lib/grammar-lint.mjs';
|
|
9
10
|
/** A file's identity: its resolved real path, or the resolved path when it does not exist. */
|
|
@@ -182,6 +183,28 @@ function workspaceDirectories(root, { packageRoot: appPackageRoot = root, side =
|
|
|
182
183
|
}
|
|
183
184
|
return [...directories].sort(byCodeUnit);
|
|
184
185
|
}
|
|
186
|
+
/**
|
|
187
|
+
* The workspace packages of the app root that no side owns: the `workspaces` patterns of the app's one package.json that do not start
|
|
188
|
+
* with a side folder (`packages/*`), and the directories the slots `app.packages` and `app.module-registry` place under `packages/`
|
|
189
|
+
* even when the manifest forgot to list them. A side imports them as first-party packages (through their entry points), never as
|
|
190
|
+
* "outside the side". A side of the app is judged here; the app root itself already counts them among its workspaces.
|
|
191
|
+
*/
|
|
192
|
+
function rootPackageRecords(root, packageRoot, side, opened) {
|
|
193
|
+
if (side === null)
|
|
194
|
+
return [];
|
|
195
|
+
const candidates = new Set(rootWorkspaceDirectories(packageRoot));
|
|
196
|
+
if (opened.manifest && existingDirectory(packageRoot, 'packages')) {
|
|
197
|
+
const resolver = createSlotResolver(opened.manifest, readRepoDeclaration(opened.manifest, packageRoot));
|
|
198
|
+
const container = path.join(packageRoot, 'packages');
|
|
199
|
+
for (const entry of fs.readdirSync(container, { withFileTypes: true }).filter(item => item.isDirectory())) {
|
|
200
|
+
const slot = resolver.classifyPath(`packages/${entry.name}`).slot;
|
|
201
|
+
if (slot !== undefined && ROOT_PACKAGE_SLOTS.has(slot))
|
|
202
|
+
candidates.add(path.join(container, entry.name));
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
return [...candidates].sort(byCodeUnit).filter(candidate => !isInside(root, candidate))
|
|
206
|
+
.flatMap(candidate => rootPackageRecord(packageRoot, candidate, canonical) ?? []);
|
|
207
|
+
}
|
|
185
208
|
function discoveredProjects(root, workspaces) {
|
|
186
209
|
const projects = [];
|
|
187
210
|
if (fs.existsSync(path.join(root, 'tsconfig.json')))
|
|
@@ -373,6 +396,7 @@ export function loadArchitectureConfig(repositoryRoot, { hfs } = {}) {
|
|
|
373
396
|
kinds,
|
|
374
397
|
projects,
|
|
375
398
|
workspaces,
|
|
399
|
+
rootPackages: rootPackageRecords(root, packageRoot, side, opened),
|
|
376
400
|
apps: apps.map(app => ({ name: app.name, kind: app.kind })),
|
|
377
401
|
hfs: opened,
|
|
378
402
|
owners: derivedOwners(root, opened),
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// root-packages.mjs - the workspace packages of an app ROOT (packages/agent-sdk, packages/module-<name>, the managed packages/modules).
|
|
2
|
+
// They lie outside both side folders and belong to no side; both sides import them by package name, through their package entry points
|
|
3
|
+
// (the `exports` of the manifest), so the import graph reads them as first-party packages and the back-end canon never reads them as
|
|
4
|
+
// a third-party library. The app root's one package.json lists them in `workspaces`; the patterns that start with a side folder
|
|
5
|
+
// (`fe/apps/*`) are that side's own workspaces and are not read here.
|
|
6
|
+
import fs from 'node:fs';
|
|
7
|
+
import path from 'node:path';
|
|
8
|
+
import { readJsonFile as readJson } from '../../lib/json.mjs';
|
|
9
|
+
import { byCodeUnit } from '../../lib/list.mjs';
|
|
10
|
+
import { isInside } from '../../lib/walk.mjs';
|
|
11
|
+
import { slash } from '../../lib/path-key.mjs';
|
|
12
|
+
/** The slots whose directories at the app root are first-party packages of the app (agent SDK, module packages, the managed registry). */
|
|
13
|
+
export const ROOT_PACKAGE_SLOTS = new Set(['app.packages', 'app.module-registry']);
|
|
14
|
+
const SIDE_PREFIX = /^(?:be|fe)\//;
|
|
15
|
+
/** A workspace pattern this reader expands (a literal path, or `*` as a whole segment); the others are judged by the workspace rules. */
|
|
16
|
+
const expandablePattern = (written) => !path.isAbsolute(written) && written.split('/').every(segment => segment !== '..' && (!segment.includes('*') || segment === '*'));
|
|
17
|
+
function expandSegment(base, segment) {
|
|
18
|
+
if (segment !== '*')
|
|
19
|
+
return [path.join(base, segment)];
|
|
20
|
+
if (!fs.existsSync(base) || !fs.lstatSync(base).isDirectory())
|
|
21
|
+
return [];
|
|
22
|
+
return fs.readdirSync(base, { withFileTypes: true }).filter(item => item.isDirectory()).sort((a, b) => byCodeUnit(a.name, b.name)).map(item => path.join(base, item.name));
|
|
23
|
+
}
|
|
24
|
+
/** A package folder with a regular package.json (a link is not one). */
|
|
25
|
+
export function packageDirectory(absolute) {
|
|
26
|
+
try {
|
|
27
|
+
if (!fs.lstatSync(absolute).isDirectory())
|
|
28
|
+
return false;
|
|
29
|
+
const manifest = fs.lstatSync(path.join(absolute, 'package.json'));
|
|
30
|
+
return manifest.isFile() && !manifest.isSymbolicLink();
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/** The folders the `workspaces` of the app root's package.json name that no side owns, as absolute paths in code-unit order. */
|
|
37
|
+
export function rootWorkspaceDirectories(packageRoot) {
|
|
38
|
+
const manifest = readJson(path.join(packageRoot, 'package.json'));
|
|
39
|
+
const declared = manifest?.workspaces;
|
|
40
|
+
const patterns = Array.isArray(declared) ? declared : declared?.packages;
|
|
41
|
+
const found = new Set();
|
|
42
|
+
for (const pattern of Array.isArray(patterns) ? patterns : []) {
|
|
43
|
+
if (typeof pattern !== 'string' || !pattern.trim())
|
|
44
|
+
continue;
|
|
45
|
+
const written = slash(pattern.trim()).replace(/^\.\//, '');
|
|
46
|
+
if (SIDE_PREFIX.test(written) || !expandablePattern(written))
|
|
47
|
+
continue;
|
|
48
|
+
let bases = [packageRoot];
|
|
49
|
+
for (const segment of written.split('/'))
|
|
50
|
+
bases = bases.flatMap(base => expandSegment(base, segment));
|
|
51
|
+
for (const base of bases)
|
|
52
|
+
found.add(path.resolve(base));
|
|
53
|
+
}
|
|
54
|
+
return [...found].sort(byCodeUnit);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* The record of one package folder of the app root, or null when it is no named package inside the app root.
|
|
58
|
+
* `canonical` is the file-identity function of the caller (the real path), so a record agrees with the files the graph reads.
|
|
59
|
+
*/
|
|
60
|
+
export function rootPackageRecord(packageRoot, directory, canonical) {
|
|
61
|
+
if (!packageDirectory(directory) || !isInside(packageRoot, directory))
|
|
62
|
+
return null;
|
|
63
|
+
const manifest = readJson(path.join(directory, 'package.json'));
|
|
64
|
+
const name = manifest?.['name'];
|
|
65
|
+
if (manifest === null || typeof name !== 'string' || !name)
|
|
66
|
+
return null;
|
|
67
|
+
return { root: canonical(directory), relative: slash(path.relative(packageRoot, directory)), name, exports: manifest['exports'], manifest, workspace: true, app: false };
|
|
68
|
+
}
|
|
69
|
+
/** The names of the workspace packages of the app root: what the back-end canon must not read as third-party libraries. */
|
|
70
|
+
export function rootPackageNames(packageRoot) {
|
|
71
|
+
const names = new Set();
|
|
72
|
+
for (const directory of rootWorkspaceDirectories(packageRoot)) {
|
|
73
|
+
const record = rootPackageRecord(packageRoot, directory, (file) => file);
|
|
74
|
+
if (record !== null)
|
|
75
|
+
names.add(record.name);
|
|
76
|
+
}
|
|
77
|
+
return names;
|
|
78
|
+
}
|
|
@@ -241,8 +241,38 @@ function appendEdge(from, sourceFile, project, owningWorkspace, reference, actua
|
|
|
241
241
|
errors.push(helpers.boundaryViolation(config.root, edge, owningWorkspace, targetWorkspace, 'ARCH_PACKAGE_EXPORT_BYPASS', 'Cross-package imports must use the target package name and a declared package export.'));
|
|
242
242
|
}
|
|
243
243
|
}
|
|
244
|
+
/**
|
|
245
|
+
* An import of one of the app's root workspace packages (`@scope/agent-sdk`, `@scope/agent-sdk/workbench`). The package lies outside the side
|
|
246
|
+
* folder, yet it is first-party source both sides may import: through its package entry points (the `exports` of its manifest) and never past
|
|
247
|
+
* them. An entry point is no import that leaves the side and adds no edge (the package is not part of this side's graph; the package's own
|
|
248
|
+
* lint judges its files); a path into the package's source is refused. Returns true when the reference was settled here.
|
|
249
|
+
*/
|
|
250
|
+
function rootPackageReference(sourceFile, project, reference, state) {
|
|
251
|
+
const { config, errors, helpers, host, ts } = state;
|
|
252
|
+
if (!config.rootPackages?.length)
|
|
253
|
+
return false;
|
|
254
|
+
const item = helpers.rootPackageOf(config, reference.specifier);
|
|
255
|
+
if (item === null)
|
|
256
|
+
return false;
|
|
257
|
+
if (!helpers.rootPackageEntryDeclared(item, reference.specifier)) {
|
|
258
|
+
errors.push({
|
|
259
|
+
ruleId: 'ARCH_INTERNAL_IMPORT_OUTSIDE',
|
|
260
|
+
project: project.relative,
|
|
261
|
+
path: helpers.relativePath(config.root, sourceFile.fileName),
|
|
262
|
+
...helpers.sourceLocation(sourceFile, reference.node),
|
|
263
|
+
specifier: reference.specifier,
|
|
264
|
+
message: `Internal import ${reference.specifier} reaches into the package ${item.name} past its package entry points; import ${helpers.rootPackageEntries(item).join(', ')} instead.`,
|
|
265
|
+
});
|
|
266
|
+
return true;
|
|
267
|
+
}
|
|
268
|
+
// An entry point that a path alias sends outside the package is no entry point: the ordinary boundary judges it.
|
|
269
|
+
const resolved = helpers.resolveTypeScriptModule(ts, reference.specifier, sourceFile.fileName, project.options, host, resolutionCache(state, project));
|
|
270
|
+
return resolved === undefined || helpers.isInside(item.root, helpers.canonical(resolved));
|
|
271
|
+
}
|
|
244
272
|
function processReference(from, sourceFile, project, owningWorkspace, reference, state) {
|
|
245
273
|
const { config, ts, workspaceNames, workspaces, host, errors, helpers } = state;
|
|
274
|
+
if (rootPackageReference(sourceFile, project, reference, state))
|
|
275
|
+
return;
|
|
246
276
|
// A workspace package is read at its source, never at its build: the same import resolves whether or not dist exists.
|
|
247
277
|
const workspaceTarget = workspaces.filter(item => item.root !== helpers.canonical(config.root)).map(item => helpers.workspaceSourceEntry(ts, item, reference.specifier)).find(Boolean);
|
|
248
278
|
const resolvedName = workspaceTarget ?? helpers.resolveTypeScriptModule(ts, reference.specifier, sourceFile.fileName, project.options, host, resolutionCache(state, project));
|
|
@@ -385,6 +385,26 @@ function packageExported(ts, workspace, specifier, actualTarget) {
|
|
|
385
385
|
return expected === canonical(actualTarget) || sourceOfTarget(ts, workspace, target) === canonical(actualTarget);
|
|
386
386
|
});
|
|
387
387
|
}
|
|
388
|
+
/** The root workspace package of the app (`packages/agent-sdk`) a specifier names, its name or a subpath of it; the longest name when several match. */
|
|
389
|
+
export function rootPackageOf(config, specifier) {
|
|
390
|
+
let found = null;
|
|
391
|
+
for (const item of config.rootPackages ?? [])
|
|
392
|
+
if (sameOrUnder(specifier, item.name) && (found === null || item.name.length > found.name.length))
|
|
393
|
+
found = item;
|
|
394
|
+
return found;
|
|
395
|
+
}
|
|
396
|
+
/** Whether a specifier into a root package names one of its entry points: a subpath its `exports` declare, or its root through `exports`, `main`/`types` or `src/index`. A path into its source is not an entry point. */
|
|
397
|
+
export function rootPackageEntryDeclared(item, specifier) {
|
|
398
|
+
if (exportCandidates(item, specifier).length > 0)
|
|
399
|
+
return true;
|
|
400
|
+
return specifier === item.name && !item.exports && (manifestEntryTargets(item.manifest).length > 0 || packageIndexSource(item) !== null);
|
|
401
|
+
}
|
|
402
|
+
/** The subpaths a root package declares for import (`.` first), for the message of a refused deep import. */
|
|
403
|
+
export function rootPackageEntries(item) {
|
|
404
|
+
const declaration = item.exports;
|
|
405
|
+
const keys = declaration && typeof declaration === 'object' && !Array.isArray(declaration) ? Object.keys(declaration).filter(key => key.startsWith('.')) : ['.'];
|
|
406
|
+
return (keys.length ? keys : ['.']).map(key => (key === '.' ? item.name : `${item.name}${key.slice(1)}`));
|
|
407
|
+
}
|
|
388
408
|
function boundaryViolation(root, edge, fromWorkspace, toWorkspace, ruleId, message) {
|
|
389
409
|
return {
|
|
390
410
|
ruleId,
|
|
@@ -413,7 +433,7 @@ function typeScriptContext(config, loaded, paths) {
|
|
|
413
433
|
canonical, compilerError, isInside, slash, readTypeScriptProject, typeScriptProjectReferencePath,
|
|
414
434
|
sameOrUnder, createTypeScriptProgram, isProductionSource, sourceLocation, workspaceMetadata, workspaceOf,
|
|
415
435
|
pathAliasMatches, moduleReferences, workspaceSourceEntry, resolveTypeScriptModule, crossesSide, assetExtension: ASSET_EXTENSION,
|
|
416
|
-
relativePath, packageExported, boundaryViolation,
|
|
436
|
+
relativePath, packageExported, boundaryViolation, rootPackageOf, rootPackageEntryDeclared, rootPackageEntries,
|
|
417
437
|
});
|
|
418
438
|
}
|
|
419
439
|
export function relativePath(root, fileName) {
|
|
@@ -121,7 +121,7 @@ export const MANIFEST_KINDS = [APP_KIND, RUNTIME_KIND];
|
|
|
121
121
|
export const manifestKind = (m) => (isPlainObject(m) && m.kind !== undefined ? m.kind : APP_KIND);
|
|
122
122
|
const strList = (v) => stringList(v);
|
|
123
123
|
|
|
124
|
-
const APP_SLOT_KEYS = ['id', 'profiles', 'path', 'presence', 'tracked', 'tier', 'tests', 'owner', 'appKind', 'minInstances', 'requiredWhen', 'requiredInstances', 'requires', 'pattern', 'trigger', 'allows', 'forbids', 'layers', 'kinds', 'roles', 'composedBy', 'budget', 'managedBy', 'liteManagedBy', 'rules', 'goesTo', 'why', 'since', 'perConnection', 'parent', 'editions', 'editionWhy', 'litePresence', 'lite', 'provider', 'coverage', 'entries', 'outcomeHome', 'templateNa', 'exemplifiedBy', 'role', 'importedBy', 'logic'];
|
|
124
|
+
const APP_SLOT_KEYS = ['id', 'profiles', 'path', 'presence', 'tracked', 'tier', 'tests', 'owner', 'appKind', 'minInstances', 'requiredWhen', 'requiredInstances', 'requires', 'pattern', 'trigger', 'allows', 'forbids', 'layers', 'kinds', 'roles', 'composedBy', 'budget', 'managedBy', 'liteManagedBy', 'rules', 'goesTo', 'why', 'since', 'perConnection', 'parent', 'editions', 'editionWhy', 'litePresence', 'lite', 'provider', 'coverage', 'entries', 'outcomeHome', 'templateNa', 'exemplifiedBy', 'role', 'importedBy', 'logic', 'managedOnly'];
|
|
125
125
|
/** The roles a file slot may play that a rule reads (`role`): the entity registry of persistence.md BE-PERSISTENCE-3 (architecture/entity-registry.mjs). */
|
|
126
126
|
const SLOT_ROLES = ['entity-registry'];
|
|
127
127
|
/** The fields a slot's `lite` overlay may hold: the same keys it would carry in the slot body, resolved under edition lite. */
|
|
@@ -232,7 +232,7 @@ export function readRepoDeclaration(manifest, repoRoot) {
|
|
|
232
232
|
function createScopeResolver(manifest, repo) {
|
|
233
233
|
const profile = repo.profile;
|
|
234
234
|
const edition = repo.edition ?? 'full';
|
|
235
|
-
const slots = manifest.slots.filter((s) => s.profiles.includes(profile) && slotInEdition(manifest, s, edition)).map((s) => effectiveSlot(s, profile, edition));
|
|
235
|
+
const slots = manifest.slots.filter((s) => s.managedOnly !== true && s.profiles.includes(profile) && slotInEdition(manifest, s, edition)).map((s) => effectiveSlot(s, profile, edition));
|
|
236
236
|
const scope = { manifest, repo, profile, slots, byId: new Map(slots.map((s) => [s.id, s])), variants: slots.flatMap(variantsOf), appKind: new Map(repo.apps.map((a) => [a.name, a.kind])) };
|
|
237
237
|
const classifyPath = (input) => classifyIn(scope, input);
|
|
238
238
|
/** tracked | ignored | external for the slot owning `p`, or null when no slot owns it. */
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import path from 'node:path';
|
|
6
6
|
import { allowsFile } from './allows.mjs';
|
|
7
7
|
import { openHfs } from './slots.mjs';
|
|
8
|
+
import { ROOT_PACKAGE_SLOTS } from './architecture/root-packages.mjs';
|
|
8
9
|
const posix = (p) => String(p).replaceAll('\\', '/');
|
|
9
10
|
const isAbsoluteAny = (text) => path.isAbsolute(text) || /^[A-Za-z]:\//.test(text);
|
|
10
11
|
/**
|
|
@@ -69,3 +70,70 @@ export const openHfsView = ({ runtimeRoot, repoRoot }) => hfsView(openHfs({ root
|
|
|
69
70
|
* @returns {object} The frozen view.
|
|
70
71
|
*/
|
|
71
72
|
export const declaredHfsView = ({ runtimeRoot, declaration, repoRoot, side }) => hfsView(openHfs({ root: runtimeRoot, declaration, side }), repoRoot);
|
|
73
|
+
/**
|
|
74
|
+
* The view of the root workspace packages of an app (`packages/<pkg>/src/**`, slots app.packages and app.module-registry), as the lint of one
|
|
75
|
+
* side sees them: the rule parameters, the apps and the Grammar of `side` (a package is judged by the laws of the side whose subpath a file
|
|
76
|
+
* sits in), and the paths of the APP ROOT (`repoRoot` is the app root, not a side folder). The slots answer for the root paths; a file of a
|
|
77
|
+
* package is of the tier `package` and has no owner: the owner laws (one `index.ts` per owner root) are the module folders', a package's public
|
|
78
|
+
* surface being the `exports` of its manifest.
|
|
79
|
+
*
|
|
80
|
+
* @param {object} opened - The result of `openHfs` for the app root (profile app, both sides resolved).
|
|
81
|
+
* @param {string} repoRoot - The absolute app root.
|
|
82
|
+
* @param {string} side - `be` or `fe`: the side whose laws the file is judged by.
|
|
83
|
+
* @returns {object} The frozen view: the profile of the side over the paths of the app root.
|
|
84
|
+
*/
|
|
85
|
+
function packagesView(opened, repoRoot, side) {
|
|
86
|
+
const scope = opened.sides?.[side];
|
|
87
|
+
const sideRepo = opened.repo.sides?.[side];
|
|
88
|
+
if (scope === undefined || sideRepo === undefined)
|
|
89
|
+
throw new Error('the view of the root packages needs the declaration of an app with both sides');
|
|
90
|
+
const rel = (file) => {
|
|
91
|
+
const text = posix(file);
|
|
92
|
+
return isAbsoluteAny(text) ? posix(path.relative(repoRoot, file)) : text.replace(/^\.\//, '');
|
|
93
|
+
};
|
|
94
|
+
const cache = new Map();
|
|
95
|
+
const classify = (file) => {
|
|
96
|
+
const key = rel(file);
|
|
97
|
+
if (!cache.has(key))
|
|
98
|
+
cache.set(key, opened.classifyPath(key));
|
|
99
|
+
return cache.get(key);
|
|
100
|
+
};
|
|
101
|
+
const packageOf = (file) => {
|
|
102
|
+
const slot = classify(file).slot;
|
|
103
|
+
const relative = rel(file);
|
|
104
|
+
return slot !== undefined && ROOT_PACKAGE_SLOTS.has(slot) ? relative.split('/').slice(0, 2).join('/') : null;
|
|
105
|
+
};
|
|
106
|
+
return Object.freeze({
|
|
107
|
+
repoRoot,
|
|
108
|
+
profile: side,
|
|
109
|
+
side,
|
|
110
|
+
edition: opened.repo.edition ?? 'full',
|
|
111
|
+
...(sideRepo.grammar === undefined ? {} : { grammar: sideRepo.grammar }),
|
|
112
|
+
apps: sideRepo.apps,
|
|
113
|
+
connections: sideRepo.connections,
|
|
114
|
+
patterns: Object.freeze([...(sideRepo.patterns ?? [])]),
|
|
115
|
+
ruleParams: scope.ruleParams(),
|
|
116
|
+
relative: rel,
|
|
117
|
+
classify,
|
|
118
|
+
slotOf: (file) => classify(file).slot ?? null,
|
|
119
|
+
tierOf: (file) => (packageOf(file) === null ? null : 'package'),
|
|
120
|
+
// A package is no owner of the module laws (one index.ts at the owner root): its public surface is the `exports` of its manifest, so no file of it has an owner.
|
|
121
|
+
ownerOf: () => null,
|
|
122
|
+
allows: (file) => allowsFile(opened, rel(file)),
|
|
123
|
+
slot: (id) => opened.slot(id),
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* The view of the root packages of the app at `repoRoot` (the app root, where the root `eslint.config.mjs` lives), for the laws of `side`.
|
|
128
|
+
*
|
|
129
|
+
* @param {{ runtimeRoot: string, repoRoot: string, side: string }} input - Where the manifest copy lives, the app root, and the side whose laws apply.
|
|
130
|
+
* @returns {object} The frozen view.
|
|
131
|
+
*/
|
|
132
|
+
export const openPackagesHfsView = ({ runtimeRoot, repoRoot, side }) => packagesView(openHfs({ root: runtimeRoot, repoRoot }), repoRoot, side);
|
|
133
|
+
/**
|
|
134
|
+
* The view of the root packages of an in-memory app declaration (rule tests): no file is read except the manifest.
|
|
135
|
+
*
|
|
136
|
+
* @param {{ runtimeRoot: string, declaration: object, repoRoot: string, side: string }} input - Manifest root, the app hfs.json object, the app root and the side.
|
|
137
|
+
* @returns {object} The frozen view.
|
|
138
|
+
*/
|
|
139
|
+
export const declaredPackagesHfsView = ({ runtimeRoot, declaration, repoRoot, side }) => packagesView(openHfs({ root: runtimeRoot, declaration }), repoRoot, side);
|