@starci/eslint-canon-fe 9.1.7 → 9.1.9
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/control-height.mjs +77 -0
- package/docs/control-height.md +12 -0
- package/index.mjs +4 -0
- package/lib/config.mjs +1 -1
- package/lib/why.mjs +20 -0
- package/package.json +1 -1
- package/runtime/config.example.yaml +9 -10
- package/runtime/engine/config.mjs +3 -3
- package/runtime/engine/release-config.mjs +5 -5
- package/runtime/knowledge/hfs/canon-pins.yaml +14 -7
- package/runtime/knowledge/hfs/fe-stack.yaml +12 -1
- package/runtime/knowledge/hfs/slots.yaml +5 -5
- package/runtime/modules/kernel/removed-vocabulary.yaml +33 -7
- package/runtime/scripts/hfs/architecture/index.mjs +2 -1
- package/runtime/scripts/hfs/architecture/type-context.mjs +38 -23
- package/runtime/scripts/hfs/typescript-programs.mjs +30 -3
- package/surface-rules.mjs +83 -3
- package/ui-rulings.mjs +134 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 9.1.9 - 2026-10-26
|
|
4
|
+
|
|
5
|
+
- Added: starci-fe/control-height (R320 FE_CONTROL_HEIGHT), selection-fill-no-check and no-grammar-internal-selector.
|
|
6
|
+
- Changed: the bundled runtime copies carry the light push gate and the owner rulings of 2026-10-26.
|
|
7
|
+
|
|
8
|
+
## 9.1.8 - 2026-10-26
|
|
9
|
+
|
|
10
|
+
- Added: the `divider-full-bleed` rule (a Grammar `Divider` between full-bleed regions is itself full bleed), the SegmentedControl `size="control"` carve-out and the `@starci/event-stream` registration in the fe-stack concern.
|
|
11
|
+
- Changed: the bundled canon pins follow the final package versions (Grammar 0.12.12 with the lint families).
|
|
12
|
+
|
|
3
13
|
## 9.1.7 - 2026-10-26
|
|
4
14
|
|
|
5
15
|
- Changed: the alpha.31.1 round folded into alpha.31; the bundled canon pins and runtime copies follow the final package versions. No rule changes.
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/** CONTROL-HEIGHT-1: one control height; the app never picks a larger step or mixes steps in one row. */
|
|
2
|
+
import { attributeValue, stringOf } from "./lib/ast.mjs"
|
|
3
|
+
import { importOf } from "./lib/bindings.mjs"
|
|
4
|
+
|
|
5
|
+
const GRAMMAR_ENTRY = /^@starci\/grammar(?:\/(?:common|core|heritage|offset-pop))?$/
|
|
6
|
+
const CONTROLS = new Set(["Button", "IconButton", "Switch", "Input", "SearchField", "Select", "Tabs", "SegmentedControl", "Textarea", "NumberField", "ComboBox"])
|
|
7
|
+
/** A marketing hero call to action on a landing page is the one place the 48px step is allowed. */
|
|
8
|
+
const LANDING_PATH = /[\\/](?:landing|hero|marketing)[\\/]|(?:Landing|Hero)[^\\/]*[\\/]/
|
|
9
|
+
/** The default size and its two spellings: the vendor `md` and Grammar's `control` are the same 40px height. */
|
|
10
|
+
const DEFAULT_SIZE = new Set(["md", "control"])
|
|
11
|
+
|
|
12
|
+
/** The Grammar control a JSX name resolves to; a shadowed or foreign component of the same name is not one. */
|
|
13
|
+
const controlOf = (context, name) => {
|
|
14
|
+
let root = name
|
|
15
|
+
const parts = []
|
|
16
|
+
while (root.type === "JSXMemberExpression") {
|
|
17
|
+
parts.unshift(root.property.name)
|
|
18
|
+
root = root.object
|
|
19
|
+
}
|
|
20
|
+
if (root.type !== "JSXIdentifier") return null
|
|
21
|
+
const imported = importOf(context, root)
|
|
22
|
+
if (!imported || !GRAMMAR_ENTRY.test(imported.source)) return null
|
|
23
|
+
const role = imported.imported ?? parts.shift()
|
|
24
|
+
return role !== undefined && parts.length === 0 && CONTROLS.has(role) ? role : null
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** The statically authored size of a control: `control` when absent, null when it is dynamic. */
|
|
28
|
+
const sizeOf = (opening) => {
|
|
29
|
+
const attribute = opening.attributes.find((entry) => entry.type === "JSXAttribute" && entry.name.name === "size")
|
|
30
|
+
if (!attribute) return "control"
|
|
31
|
+
const text = stringOf(attributeValue(attribute))
|
|
32
|
+
if (text === null) return null
|
|
33
|
+
return DEFAULT_SIZE.has(text) ? "control" : text
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** The Grammar controls a row holds directly, looking through fragments. */
|
|
37
|
+
const rowControls = (context, element) => element.children.flatMap((child) => {
|
|
38
|
+
if (child.type === "JSXFragment") return rowControls(context, child)
|
|
39
|
+
if (child.type !== "JSXElement") return []
|
|
40
|
+
return controlOf(context, child.openingElement.name) === null ? [] : [child.openingElement]
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
const controlHeight = {
|
|
44
|
+
meta: { type: "problem", docs: { description: "CONTROL-HEIGHT-1: one 40px control height, no larger step outside a landing hero, no mixed sizes in one row." }, schema: [], messages: {
|
|
45
|
+
FE_CONTROL_HEIGHT: "FE_CONTROL_HEIGHT: {{detail}} Grammar draws every standalone control at one 40px height; omit size (sm is for a control nested in an item or a dense toolbar, lg only for a landing hero call to action).",
|
|
46
|
+
} },
|
|
47
|
+
create(context) {
|
|
48
|
+
const landing = LANDING_PATH.test(context.filename)
|
|
49
|
+
const reported = new Set()
|
|
50
|
+
const report = (node, detail) => {
|
|
51
|
+
if (reported.has(node)) return
|
|
52
|
+
reported.add(node)
|
|
53
|
+
context.report({ node, messageId: "FE_CONTROL_HEIGHT", data: { detail } })
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
JSXOpeningElement(opening) {
|
|
57
|
+
const role = controlOf(context, opening.name)
|
|
58
|
+
if (role === null) return
|
|
59
|
+
const size = sizeOf(opening)
|
|
60
|
+
if (size === "xl" || (size === "lg" && !landing)) report(opening, `${role} size="${size}" is a larger control step than the app chrome allows.`)
|
|
61
|
+
},
|
|
62
|
+
"JSXElement, JSXFragment"(element) {
|
|
63
|
+
const controls = rowControls(context, element)
|
|
64
|
+
const sizes = controls.map(sizeOf)
|
|
65
|
+
if (sizes.includes(null) || new Set(sizes).size < 2) return
|
|
66
|
+
const index = sizes.findIndex((size) => size !== sizes[0])
|
|
67
|
+
report(controls[index], "this control sits in a row with controls of another size.")
|
|
68
|
+
},
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** The one rule of the law. */
|
|
74
|
+
export const rules = { "control-height": controlHeight }
|
|
75
|
+
|
|
76
|
+
/** The rule reaches consumers at error. */
|
|
77
|
+
export const recommended = Object.fromEntries(Object.keys(rules).map((name) => [`starci-fe/${name}`, "error"]))
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Control height (CONTROL-HEIGHT-1)
|
|
2
|
+
|
|
3
|
+
Owner ruling `control-height-40` (2026-10-26). One control height, 40px (HeroUI's own `h-10`), is the default of every standalone Grammar control: Button, IconButton, Input, SearchField, Select, Tabs, SegmentedControl, Switch, the chrome Avatar, Textarea and the composer send button. Grammar draws it; an app never states it.
|
|
4
|
+
|
|
5
|
+
| Rule | Finding code | Required behavior |
|
|
6
|
+
| --- | --- | --- |
|
|
7
|
+
| `starci-fe/control-height` | `FE_CONTROL_HEIGHT` | Omit `size` on a control (or pass `md`/`control`, the same 40px). `size="lg"` (48px) is only for a landing hero call to action; `xl` is never used. Controls that share one JSX row share one size, so a row never mixes `sm` with the default. `sm` (32px) is for a control nested in an item or a dense toolbar where every control of the row is `sm`. |
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
<IconButton intent="dismiss" label="Notifications" source={bell} />
|
|
11
|
+
<Switch label="Dark mode" size="control" />
|
|
12
|
+
```
|
package/index.mjs
CHANGED
|
@@ -13,6 +13,7 @@ import { join } from "node:path"
|
|
|
13
13
|
import { pathToFileURL } from "node:url"
|
|
14
14
|
import { recommended as brandValuesRecommended, rules as brandValuesRules } from "./brand-values.mjs"
|
|
15
15
|
import { recommended as buttonIntentRecommended, rules as buttonIntentRules } from "./button-intent.mjs"
|
|
16
|
+
import { recommended as controlHeightRecommended, rules as controlHeightRules } from "./control-height.mjs"
|
|
16
17
|
import { recommended as clientBoundaryRecommended, rules as clientBoundaryRules } from "./client-boundary.mjs"
|
|
17
18
|
import { recommended as commentsRecommended, rules as commentsRules } from "./comments.mjs"
|
|
18
19
|
import { recommended as classNamesRecommended, rules as classNamesRules } from "./class-names.mjs"
|
|
@@ -44,12 +45,15 @@ import { recommended as projectGraphRecommended, rules as projectGraphRules } fr
|
|
|
44
45
|
import { recommended as sonarParityRecommended, rules as sonarParityRules } from "./sonar-parity.mjs"
|
|
45
46
|
import { buildFeConfig, buildPlainSourceConfig } from "./lib/config.mjs"
|
|
46
47
|
import { why } from "./lib/why.mjs"
|
|
48
|
+
import { recommended as uiRulingsRecommended, rules as uiRulingsRules } from "./ui-rulings.mjs"
|
|
47
49
|
|
|
48
50
|
/** Each law's contribution, kept separate so a duplicate name is detectable rather than silent. */
|
|
49
51
|
const CONTRIBUTIONS = [
|
|
52
|
+
{ law: "ui-rulings", rules: uiRulingsRules, recommended: uiRulingsRecommended },
|
|
50
53
|
{ law: "project-graph", rules: projectGraphRules, recommended: projectGraphRecommended },
|
|
51
54
|
{ law: "brand-values", rules: brandValuesRules, recommended: brandValuesRecommended },
|
|
52
55
|
{ law: "button-intent", rules: buttonIntentRules, recommended: buttonIntentRecommended },
|
|
56
|
+
{ law: "control-height", rules: controlHeightRules, recommended: controlHeightRecommended },
|
|
53
57
|
{ law: "client-boundary", rules: clientBoundaryRules, recommended: clientBoundaryRecommended },
|
|
54
58
|
{ law: "comments", rules: commentsRules, recommended: commentsRecommended },
|
|
55
59
|
{
|
package/lib/config.mjs
CHANGED
|
@@ -98,7 +98,7 @@ export const SLOT_FREE_RULES = Object.freeze([
|
|
|
98
98
|
"no-native-anchor", "no-inline-parameter-type", "no-hand-rolled-polling", "no-copy-in-call", "no-alert", "no-failure-collapse",
|
|
99
99
|
"outcome-kinds-exhaustive", "no-await-in-loop", "prefer-code-point", "prefer-string-raw", "no-nested-conditional", "no-void-operator", "no-unused-import",
|
|
100
100
|
"prefer-export-from", "no-unused-prop-types", "media-has-caption", "max-params",
|
|
101
|
-
"nested-control-variant", "no-list-panel-padding", "no-app-surface-paint",
|
|
101
|
+
"nested-control-variant", "no-list-panel-padding", "no-app-surface-paint", "divider-full-bleed", "control-height", "selection-fill-no-check",
|
|
102
102
|
"button-intent-required", "button-no-variant", "destructive-confirm-in-dialog", "single-commit-per-render", "no-commit-in-collection-item",
|
|
103
103
|
])
|
|
104
104
|
|
package/lib/why.mjs
CHANGED
|
@@ -19,11 +19,31 @@
|
|
|
19
19
|
|
|
20
20
|
/** @type {Record<string, Why>} */
|
|
21
21
|
export const why = {
|
|
22
|
+
"selection-fill-no-check": {
|
|
23
|
+
code: "FE_NESTED_VARIANT",
|
|
24
|
+
en: "`<file>` adds a check indicator to a navigation-like single-select list.",
|
|
25
|
+
fix: 'Set selectionIndicator="none" and let the row fill carry selection.',
|
|
26
|
+
},
|
|
27
|
+
"no-grammar-internal-selector": {
|
|
28
|
+
code: "FE_GRAMMAR_LAYOUT_ONLY",
|
|
29
|
+
en: "`<file>` targets a Grammar internal class from application styles.",
|
|
30
|
+
fix: "Use the Grammar public props and slots; keep internal selectors inside Grammar.",
|
|
31
|
+
},
|
|
32
|
+
"divider-full-bleed": {
|
|
33
|
+
code: "FE_DIVIDER_FULL_BLEED",
|
|
34
|
+
en: "`<file>` insets a horizontal Grammar divider with wrapper padding.",
|
|
35
|
+
fix: "Move horizontal padding to the sibling content bands so the divider reaches both surface edges.",
|
|
36
|
+
},
|
|
22
37
|
"button-intent-required": {
|
|
23
38
|
code: "FE_BUTTON_INTENT_REQUIRED",
|
|
24
39
|
en: "`<file>` renders a Button or IconButton without the command's intent.",
|
|
25
40
|
fix: "Declare intent from the command's consequence and rank so Grammar supplies its variant.",
|
|
26
41
|
},
|
|
42
|
+
"control-height": {
|
|
43
|
+
code: "FE_CONTROL_HEIGHT",
|
|
44
|
+
en: "`<file>` picks a larger control size or mixes control sizes in one row.",
|
|
45
|
+
fix: "Omit size so Grammar draws the one 40px control height; use sm only for every control of an item or dense toolbar row, and lg only for a landing hero call to action.",
|
|
46
|
+
},
|
|
27
47
|
"button-no-variant": {
|
|
28
48
|
code: "FE_BUTTON_NO_VARIANT",
|
|
29
49
|
en: "`<file>` chooses a Button or IconButton variant directly.",
|
package/package.json
CHANGED
|
@@ -38,8 +38,9 @@ parallel: {gear: 1}
|
|
|
38
38
|
# kernel (docs/supervisor.md) also takes, optional, defaults in home.mjs DEFAULTS:
|
|
39
39
|
# kernel: {agent, model, effort} its agent pin (default: the kernel pin below)
|
|
40
40
|
# workers: {base, max} the adaptive [Worker] cap, 0 to 10 (0 = the Supervisor runs no fix worker)
|
|
41
|
-
# landGate: {mode: shared}
|
|
42
|
-
# fast-forwards LOCAL main
|
|
41
|
+
# landGate: {mode: shared, push: true} shared lets running lanes commit directly; exclusive = gate only. A land
|
|
42
|
+
# fast-forwards LOCAL main; main reaches the remote right after a green scoped check through
|
|
43
|
+
# `starci release push` (push: true, the default; false locks the remote). CI is the critic.
|
|
43
44
|
supervisor:
|
|
44
45
|
# mode: chat (default) - the owner's desktop chat session is the Supervisor: it owns channel 'main'
|
|
45
46
|
# and reads Decision Items; nothing starts a [Supervisor] kernel. kernel - the optional [Supervisor]
|
|
@@ -49,7 +50,7 @@ supervisor:
|
|
|
49
50
|
pollIntervalMs: null
|
|
50
51
|
repos: []
|
|
51
52
|
# frozenMinutes: <n> # Host seat check: a busy frame unchanged this long is frozen, not busy
|
|
52
|
-
# landGate: {mode: shared|exclusive}
|
|
53
|
+
# landGate: {mode: shared|exclusive, push: true|false}
|
|
53
54
|
# delegation — while the owner is away, a named delegate (e.g. the supervisor chat) may
|
|
54
55
|
# answer owner asks until the given time; excluded classes stay owner-only. null = none.
|
|
55
56
|
# delegation: {asks: supervisor, until: 2026-09-23T09:00:00+07:00,
|
|
@@ -185,11 +186,9 @@ sonar: {organization: null}
|
|
|
185
186
|
# minFreeRamPct free-RAM percentage below which no new heavy op starts
|
|
186
187
|
# set them only in the gitignored config.yaml copy, e.g.
|
|
187
188
|
# resources: {minFreeDiskGb: 5, minFreeDiskPct: 1, minFreeRamPct: 10}
|
|
188
|
-
# release - where the
|
|
189
|
-
# suite: local the shipped default: `starci release cut` runs the
|
|
190
|
-
#
|
|
191
|
-
#
|
|
192
|
-
#
|
|
193
|
-
# A release can reach GitHub and its tag before the Linux parity has run; a red CI is fixed forward with the next pre-release (starci release ci-status).
|
|
194
|
-
# "none" is refused: the Linux parity does not vanish, it moves to CI. Set it only in the gitignored config.yaml copy: release: {suite: ci}
|
|
189
|
+
# release - where the full suite of a release is judged (scripts/guards/release-suite-mode.mjs; docs/releasing.md "Where the suite runs"). One key:
|
|
190
|
+
# suite: local the shipped default: `starci release cut` also runs the L4 rows on this host (root rows, example apps, Sonar proofs, Linux parity container) before it tags; it never gates a push
|
|
191
|
+
# suite: ci the owner's recorded choice (2026-10-09, widened 2026-10-26 by push-main-after-scoped-check): EVERY row is judged by the GitHub workflows (ci, examples, sonar) on each push to main;
|
|
192
|
+
# the cut runs none and lists each row as delegated, never green. A red CI opens the next alpha.N.M and never blocks the next push (starci release ci-status).
|
|
193
|
+
# "none" is refused: the suite does not vanish, it moves to CI. Set it only in the gitignored config.yaml copy: release: {suite: ci}
|
|
195
194
|
release: {suite: local}
|
|
@@ -294,13 +294,13 @@ const validateSupervisorBlock=(supervisor,profile)=>{
|
|
|
294
294
|
throw new Error('Invalid config.yaml: supervisor.mode must be chat or kernel, or null.');
|
|
295
295
|
// The [Supervisor] kernel seat (scripts/machine/home.mjs supervisorSettings): kernel {agent?, model?, effort?}
|
|
296
296
|
// pins its agent (default: the kernel pin), workers {base?, max?} its adaptive [Worker] cap (0 to 10; the shipped default is 0 fix workers),
|
|
297
|
-
// landGate {mode?: shared|exclusive} the land gate (scripts/supervisor/land.mjs).
|
|
297
|
+
// landGate {mode?: shared|exclusive, push?: boolean} the land gate (scripts/supervisor/land.mjs); push (default true, owner ruling push-main-after-scoped-check) lets `starci release push` send main to the remote after a green scoped check, false is the owner's lock on the remote.
|
|
298
298
|
const seat=supervisor.kernel,workers=supervisor.workers,gate=supervisor.landGate;
|
|
299
299
|
if(seat!==undefined&&seat!==null)validateAgentSeat(seat,'supervisor.kernel',profile);
|
|
300
300
|
if(!(workers===undefined||workers===null||(plain(workers)&&Object.keys(workers).every(key=>['base','max'].includes(key)&&Number.isInteger(workers[key])&&workers[key]>=0&&workers[key]<=10))))
|
|
301
301
|
throw new Error('Invalid config.yaml: supervisor.workers must be {base?, max?} integers from 0 to 10, or null.');
|
|
302
|
-
if(!(gate===undefined||gate===null||(plain(gate)&&Object.keys(gate).every(key=>key==='mode'&&['shared','exclusive'].includes(gate.mode)))))
|
|
303
|
-
throw new Error('Invalid config.yaml: supervisor.landGate must be {mode?: shared|exclusive}, or null.');
|
|
302
|
+
if(!(gate===undefined||gate===null||(plain(gate)&&Object.keys(gate).every(key=>(key==='mode'&&['shared','exclusive'].includes(gate.mode))||(key==='push'&&typeof gate.push==='boolean')))))
|
|
303
|
+
throw new Error('Invalid config.yaml: supervisor.landGate must be {mode?: shared|exclusive, push?: boolean}, or null.');
|
|
304
304
|
// stallMinutes: scripts/supervisor/stall.mjs calls a running workflow STALLED after this many minutes with no progress.
|
|
305
305
|
// frozenMinutes: scripts/supervisor/supervisor-watchdog.mjs reads a busy seat frame with no turn progress for this long as frozen.
|
|
306
306
|
const frozen=supervisor.frozenMinutes;
|
|
@@ -3,14 +3,14 @@ import {invalid} from './invalid-config.mjs';
|
|
|
3
3
|
|
|
4
4
|
/** The keys of the release block. */
|
|
5
5
|
export const RELEASE_KEYS=Object.freeze(['suite']);
|
|
6
|
-
/** Where the full test suite of a release is judged: `local` (the release cut runs it, the shipped default) or `ci` (the GitHub
|
|
6
|
+
/** Where the full test suite of a release is judged: `local` (the release cut also runs the L4 rows before it tags, the shipped default) or `ci` (the GitHub workflows judge EVERY row on each push to main; the cut runs none). */
|
|
7
7
|
export const SUITE_MODES=Object.freeze(['local','ci']);
|
|
8
|
-
|
|
8
|
+
const RELEASE_DEFAULTS=Object.freeze({suite:'local'});
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* config.yaml `release` - {suite?: local | ci}: who judges the full suite of a release (docs/releasing.md "Where the suite runs"). `local` is the shipped
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
* config.yaml `release` - {suite?: local | ci}: who judges the full suite of a release (docs/releasing.md "Where the suite runs"). `local` is the shipped default: `starci release cut` also runs the
|
|
12
|
+
* L4 rows on this host before it tags. `ci` is the owner's recorded choice (2026-10-09, widened 2026-10-26 by push-main-after-scoped-check): the full suite runs on GitHub only, on every push
|
|
13
|
+
* to main; the cut runs no row and the verdict is read with `starci release ci-status`. The push of main needs neither mode: it needs a green scoped check.
|
|
14
14
|
* `none` is refused: the suite does not vanish, it moves to CI, and the value says so.
|
|
15
15
|
*/
|
|
16
16
|
export function validateRelease(release){
|
|
@@ -22,36 +22,43 @@ pins:
|
|
|
22
22
|
side: fe
|
|
23
23
|
source: packages/heroicons/package.json
|
|
24
24
|
why: 'StarCi custom Heroicons-compatible cuts; eslint-grammar-starci (icon.mjs) admits @starci/heroicons/24/outline and /16/solid as icon sources, so an app that uses them gets this exact version.'
|
|
25
|
+
'@starci/event-stream':
|
|
26
|
+
version: 0.1.0
|
|
27
|
+
group: starci
|
|
28
|
+
install: registry
|
|
29
|
+
side: fe
|
|
30
|
+
source: packages/event-stream/package.json
|
|
31
|
+
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.'
|
|
25
32
|
'@starci/grammar':
|
|
26
|
-
version: 0.12.
|
|
33
|
+
version: 0.12.13
|
|
27
34
|
group: starci
|
|
28
35
|
install: registry
|
|
29
36
|
side: fe
|
|
30
37
|
source: packages/grammar/package.json
|
|
31
38
|
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.'
|
|
32
39
|
'@starci/eslint-canon-be':
|
|
33
|
-
version: 3.4.
|
|
40
|
+
version: 3.4.55
|
|
34
41
|
group: starci
|
|
35
42
|
install: registry
|
|
36
43
|
side: be
|
|
37
44
|
source: packages/eslint/be/package.json
|
|
38
45
|
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.'
|
|
39
46
|
'@starci/eslint-canon-fe':
|
|
40
|
-
version: 9.1.
|
|
47
|
+
version: 9.1.9
|
|
41
48
|
group: starci
|
|
42
49
|
install: registry
|
|
43
50
|
side: fe
|
|
44
51
|
source: packages/eslint/fe/package.json
|
|
45
52
|
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.'
|
|
46
53
|
'@starci/eslint-grammar-starci':
|
|
47
|
-
version: 0.12.
|
|
54
|
+
version: 0.12.13
|
|
48
55
|
group: starci
|
|
49
56
|
install: registry
|
|
50
57
|
side: fe
|
|
51
58
|
source: packages/eslint/grammar-starci/package.json
|
|
52
59
|
why: 'the StarCi Grammar component API lint, versioned with @starci/grammar; front ends compose this family package with the universal FE canon.'
|
|
53
60
|
'@starci/eslint-grammar-offset-pop':
|
|
54
|
-
version: 0.12.
|
|
61
|
+
version: 0.12.13
|
|
55
62
|
group: starci
|
|
56
63
|
install: registry
|
|
57
64
|
side: fe
|
|
@@ -91,14 +98,14 @@ pins:
|
|
|
91
98
|
source: packages/test-world/package.json
|
|
92
99
|
why: 'the shared e2e library of every back end (R47, R48), a devDependency of every back end: the warm stack behind toxiproxy, the network-edge fakes, the Nest boot, the typed useTestWorld handle, useSandbox for contract specs and the outage lock. Kafka is real own infra (the one digest-pinned apache/kafka KRaft image, a broker listener and proxy per slot, slot-prefixed topics, consumer groups and client ids) and Postgres is schema-per-context (a schema and a login role per context in a shared database). Each worker has its own data slot (<ns>_w<k>) with its own databases, Keycloak realm, leased Redis DB, bucket/collection/topic prefixes, fakes host, toxiproxy proxies and outage lock; a run provisions min(jest workers, workers cap, default 2) slots, and state file protocol 2 pairs exactly with @starci/jest-preset (TEST_WORLD_PAIR_MISMATCH otherwise). A modules world boots real peer apps beside its modules, world.apps.<name>.during(fn) is the outage of a peer app, w.keycloak.clientSecret(client) answers the run-generated secret of a confidential realm client, world.keycloak.events/sessions read the realm user events and live sessions, world.infra.postgresql.connection(name) takes one database connection down while the others serve, and world.resolve and scope.resolve take any Nest token. Every path a declaration names (`stack`, seeds, the realm, Dockerfiles) resolves from the app root (the directory of hfs.json); the globalSetup registers the path aliases as TypeScript resolves them. Its CLI main is exported at ./cli for starci app stack.'
|
|
93
100
|
'@starci/cli':
|
|
94
|
-
version: 1.7.
|
|
101
|
+
version: 1.7.46
|
|
95
102
|
group: starci
|
|
96
103
|
install: registry
|
|
97
104
|
side: both
|
|
98
105
|
source: packages/cli/package.json
|
|
99
106
|
why: 'the only StarCi command package; product repositories install it for starci app, while @starci/hfs remains its pinned transitive implementation.'
|
|
100
107
|
'@starci/hfs':
|
|
101
|
-
version: 4.7.
|
|
108
|
+
version: 4.7.46
|
|
102
109
|
group: starci
|
|
103
110
|
install: registry
|
|
104
111
|
side: both
|
|
@@ -82,7 +82,18 @@ concerns:
|
|
|
82
82
|
home: [fe.hooks.socketio]
|
|
83
83
|
pattern: FE-REALTIME
|
|
84
84
|
forbids: [subscriptions-transport-ws, '@supabase/realtime-js', pusher-js, ably]
|
|
85
|
-
why: one socket.io-client singleton per namespace and one side-effect component that dispatches to redux and SWR; both editions run the gateway in the be api process. A one-way channel served as server-sent events
|
|
85
|
+
why: one socket.io-client singleton per namespace and one side-effect component that dispatches to redux and SWR; both editions run the gateway in the be api process. A one-way channel served as server-sent events is the event-stream concern below (FE-REALTIME).
|
|
86
|
+
- id: event-stream
|
|
87
|
+
tier: opt
|
|
88
|
+
packages: ['@starci/event-stream']
|
|
89
|
+
home: [fe.transport.stream]
|
|
90
|
+
pattern: FE-REALTIME
|
|
91
|
+
forbids: ['@microsoft/fetch-event-source', eventsource, event-source-polyfill, eventsource-parser, reconnecting-eventsource, 'sse.js', 'fetch-sse', 'sse-ts']
|
|
92
|
+
why: >-
|
|
93
|
+
the one server-sent-events client (owner:event-stream-package): the app creates one instance in modules/api/sse/clients/event-stream.ts
|
|
94
|
+
with createEventStream (the bearer token source, one renewal on a 401, backoff, heartbeat timeout), each stream operation
|
|
95
|
+
(sse/<area>/stream-<channel>.ts) follows on it, and the useSubscribe<Channel>Swr hook reads that operation. No app keeps a
|
|
96
|
+
hand-written reader (read-event-stream.ts) and no second SSE library is installed.
|
|
86
97
|
- id: auth
|
|
87
98
|
tier: core
|
|
88
99
|
packages: []
|
|
@@ -305,7 +305,7 @@ ruleParams:
|
|
|
305
305
|
- {typeSuffix: Options, names: [options], nameSuffix: Options}
|
|
306
306
|
# R89 BE_SOURCE_FORM: the closed role-suffix vocabulary of a source file name (<kebab-name>.<suffix>.ts; BE-CONVENTION 1.15)
|
|
307
307
|
# and the suffixes that are never a role. index.ts, main.ts, app.module.ts and the migrations of be.persistence are the
|
|
308
|
-
# only names outside it.
|
|
308
|
+
# only names outside it. Typed realtime topic builders use the existing policy role (BE-REALTIME-3 of knowledge/patterns/be/realtime.yaml).
|
|
309
309
|
suffixes: [module, module-definition, decorators, options, config, connection, service, schema, command, query, handler, templates, compensation, saga-state, saga-step, saga, contracts, port, resolver, controller, gateway, webhook, subscription, consumer, cli, event, queue, projection, projection-entity, processor, step, input, type, args, request, response, mapper, policy, entity, sql, rows, error, messages, log-events, cache-keys, guard, interceptor, filter, client, adapter, spec, integration-spec, e2e-spec, contract-spec, global-setup, builder]
|
|
310
310
|
# R47 BE_CONTRACT_UNGUARDED: the world's shape vocabulary. `helper` names the function a contract spec imports to erase the values of a JSON
|
|
311
311
|
# payload (`shapeOf`); a contract spec proves a fake's fixtures by asserting helper(real) equals helper(fixture).
|
|
@@ -1617,7 +1617,7 @@ slots:
|
|
|
1617
1617
|
requires: [index.ts]
|
|
1618
1618
|
# <name>.templates.ts holds the capability's static templates, copy and presets as TS constants (owner ruling 2026-10-13);
|
|
1619
1619
|
# user-editable ones are seed rows, large or user media live in object storage.
|
|
1620
|
-
allows: ["<capability>.module.ts", "<capability>.module-definition.ts", "<capability>.config.ts", "<capability>.options.ts", errors/, messages/, persistence/, policies/, "*.service.ts", "*.service.spec.ts", "*.contracts.ts", "*.templates.ts", "*.schema.ts", "*.schema.spec.ts"]
|
|
1620
|
+
allows: ["<capability>.module.ts", "<capability>.module-definition.ts", "<capability>.config.ts", "<capability>.options.ts", errors/, messages/, persistence/, policies/, "*.service.ts", "*.service.spec.ts", "*.contracts.ts", "*.templates.ts", "*.schema.ts", "*.schema.spec.ts", "*.policy.ts", "*.policy.spec.ts"]
|
|
1621
1621
|
forbids: [testing/, exceptions/, utils/, helpers/, shared/]
|
|
1622
1622
|
tests: unit-beside # <name>.service.spec.ts beside each <name>.service.ts, nothing else
|
|
1623
1623
|
coverage: required
|
|
@@ -2336,8 +2336,8 @@ slots:
|
|
|
2336
2336
|
# The browser's calls to the back end (owner ruling 2026-10-13, fe-stack graphql/rest/codegen, FE-API-GRAPHQL): the auth and
|
|
2337
2337
|
# no-auth Apollo clients with their link chain (graphql/clients), one file per operation (graphql/queries/query-<x>.ts,
|
|
2338
2338
|
# graphql/mutations/mutation-<x>.ts and graphql/subscriptions/subscription-<x>.ts, each with its gql document map and typed request/response in types/), the generated wire types
|
|
2339
|
-
# (graphql/__generated__), the axios calls (rest/<area>/*.ts) for uploads, presigned URLs and auth endpoints and the
|
|
2340
|
-
# server-sent-events streams (sse/<area>/stream-<channel>.ts, one operation per stream, run on the stream
|
|
2339
|
+
# (graphql/__generated__), the axios calls (rest/<area>/*.ts) for uploads, presigned URLs and auth endpoints and the
|
|
2340
|
+
# server-sent-events streams (sse/<area>/stream-<channel>.ts, one operation per stream, run on the app's @starci/event-stream instance in sse/clients). A repository has
|
|
2341
2341
|
# exactly ONE client folder and ONE GraphQLResponse union: the app's (fe.transport.client/outcome) when one app calls the back end,
|
|
2342
2342
|
# or the api package's (fe.package.api.client/outcome) when several do (FE_TRANSPORT_OWNER, machine).
|
|
2343
2343
|
requires: [index.ts]
|
|
@@ -2381,7 +2381,7 @@ slots:
|
|
|
2381
2381
|
tier: transport
|
|
2382
2382
|
allows: ["*.ts"]
|
|
2383
2383
|
tests: none
|
|
2384
|
-
why: "the
|
|
2384
|
+
why: "the event-stream client of the one app that calls the back end, the stream half of the transport client layer (FE-REALTIME): event-stream.ts creates the app's one @starci/event-stream instance (createEventStream with the bearer access token source, which opens the stream with fetch, parses the events and reopens it with Last-Event-ID after a capped, doubling wait); a stream operation (sse/<area>/stream-<channel>.ts) follows on it and a useSubscribe hook of hooks/swr reads that operation; no hand-written reader lives here (owner:event-stream-package) and only a stream operation imports this folder (FE_TRANSPORT_OWNER); a repository where several apps stream keeps one instance in each of them"
|
|
2385
2385
|
rules: [FE_TRANSPORT_OWNER]
|
|
2386
2386
|
exemplifiedBy:
|
|
2387
2387
|
- {path: packages/eslint/fe/r50-transport-owner-coverage.spec.mjs, editions: [lite, full]}
|
|
@@ -131,12 +131,6 @@ removed:
|
|
|
131
131
|
use: '`starci debug digest` (read-only) and `starci debug run <probe>`'
|
|
132
132
|
since: 1.0.0-alpha.6
|
|
133
133
|
match: '(?<![\w-])debug pass\b'
|
|
134
|
-
- id: config-supervisor-landgate-push
|
|
135
|
-
kind: config-key
|
|
136
|
-
name: supervisor.landGate.push
|
|
137
|
-
use: 'a land fast-forwards local main only and never pushes; the remote main of the runtime moves once per release, through starci release cut'
|
|
138
|
-
since: 1.0.0-alpha.7
|
|
139
|
-
match: 'landGate\.push\b'
|
|
140
134
|
- id: flag-land-no-push
|
|
141
135
|
kind: flag
|
|
142
136
|
name: --no-push
|
|
@@ -355,7 +349,7 @@ removed:
|
|
|
355
349
|
- id: verb-test-run
|
|
356
350
|
kind: verb
|
|
357
351
|
name: starci test run
|
|
358
|
-
use: 'the L1 to L4 spec ladder is gone with the runtime specs; `starci runtime verify` proves a change,
|
|
352
|
+
use: 'the L1 to L4 spec ladder is gone with the runtime specs; `starci runtime verify` proves a change, CI runs the release rows'
|
|
359
353
|
since: 1.0.0-alpha.19
|
|
360
354
|
match: '\bstarci test run\b'
|
|
361
355
|
- id: verb-gate-runtime-coverage
|
|
@@ -430,3 +424,35 @@ removed:
|
|
|
430
424
|
use: 'DropdownMenuItem.tone uses neutral or danger; destructive commands use danger'
|
|
431
425
|
since: 1.0.0-alpha.31
|
|
432
426
|
match: 'DropdownMenuItem(?:Tone|\.tone)[^\r\n]*["'']negative["'']'
|
|
427
|
+
|
|
428
|
+
- id: code-release-receipt-missing
|
|
429
|
+
kind: code
|
|
430
|
+
name: RELEASE_RECEIPT_MISSING
|
|
431
|
+
use: 'the push of main asks for a fast-forward and a clean secret scan; a release tag asks for no receipt'
|
|
432
|
+
since: 1.0.0-alpha.31.1
|
|
433
|
+
- id: code-release-receipt-incomplete
|
|
434
|
+
kind: code
|
|
435
|
+
name: RELEASE_RECEIPT_INCOMPLETE
|
|
436
|
+
use: 'the push of main asks for a fast-forward and a clean secret scan; CI judges the full suite'
|
|
437
|
+
since: 1.0.0-alpha.31.1
|
|
438
|
+
- id: code-release-suite-mode
|
|
439
|
+
kind: code
|
|
440
|
+
name: RELEASE_SUITE_MODE
|
|
441
|
+
use: 'release.suite chooses whether the cut also runs the L4 rows; no record or gate reads the mode'
|
|
442
|
+
since: 1.0.0-alpha.31.1
|
|
443
|
+
- id: code-release-version-unchanged
|
|
444
|
+
kind: code
|
|
445
|
+
name: RELEASE_VERSION_UNCHANGED
|
|
446
|
+
use: 'main is pushed without a version move; RELEASE_VERSION_NOT_NEXT judges the version of a tag against the v* tags'
|
|
447
|
+
since: 1.0.0-alpha.31.1
|
|
448
|
+
- id: code-release-remote-head-unknown
|
|
449
|
+
kind: code
|
|
450
|
+
name: RELEASE_REMOTE_HEAD_UNKNOWN
|
|
451
|
+
use: 'a release tag is judged against the v* tags, not against the remote main head'
|
|
452
|
+
since: 1.0.0-alpha.31.1
|
|
453
|
+
- id: config-release-candidate-blocking
|
|
454
|
+
kind: config-key
|
|
455
|
+
name: candidate.blocking
|
|
456
|
+
use: 'the runtime cut has no candidate step; the ci, examples and sonar workflows judge each push to main (suite.ci.workflows)'
|
|
457
|
+
since: 1.0.0-alpha.31.1
|
|
458
|
+
match: 'candidate\.blocking\b'
|
|
@@ -2,6 +2,7 @@ import path from 'node:path';
|
|
|
2
2
|
import { canonical, loadArchitectureConfig } from './config.mjs';
|
|
3
3
|
import { sameOrUnder } from '../../lib/path-key.mjs';
|
|
4
4
|
import { buildTypeScriptContext, relativePath } from './typescript.mjs';
|
|
5
|
+
import { withTypeScriptProgramRun } from '../typescript-programs.mjs';
|
|
5
6
|
import { checkBackend } from './backend.mjs';
|
|
6
7
|
import { checkBackendContracts, PUBLIC_CONTRACT_RULE_ID, READONLY_BOUNDARY_RULE_ID } from './contracts.mjs';
|
|
7
8
|
import { checkFrontend } from './frontend.mjs';
|
|
@@ -324,7 +325,7 @@ function scopeFindings({ config, context, violations, paths, surface }) {
|
|
|
324
325
|
* that read the whole repository to answer (clones, dead exports, repository-wide symbols); the pre-push check of the changed owners uses it.
|
|
325
326
|
*/
|
|
326
327
|
export function checkArchitecture(options = {}) {
|
|
327
|
-
return withTreeCache(() => checkArchitectureOnce(options));
|
|
328
|
+
return withTypeScriptProgramRun(() => withTreeCache(() => checkArchitectureOnce(options)));
|
|
328
329
|
}
|
|
329
330
|
|
|
330
331
|
function checkArchitectureOnce({ repositoryRoot, injectedTypeScript, paths = [], base, fast = false, hfs: openedHfs, surface = 'all' }) {
|
|
@@ -103,36 +103,35 @@ function createProjects(config, paths, state, selection, ts, helpers) {
|
|
|
103
103
|
return projects;
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
+
function ownershipRank(config, project, file, helpers) {
|
|
107
|
+
return helpers.isInside(path.dirname(path.join(config.root, ...project.relative.split('/'))), file)
|
|
108
|
+
? project.relative.split('/').length : -1;
|
|
109
|
+
}
|
|
110
|
+
|
|
106
111
|
function collectProjectFiles(config, projects, helpers) {
|
|
107
|
-
const
|
|
108
|
-
const
|
|
112
|
+
const fileMap = new Map();
|
|
113
|
+
const ownerByFile = new Map();
|
|
114
|
+
// Retain only the winning source occurrence while visiting each project. Equal ranks keep the first project,
|
|
115
|
+
// as does a file outside every project directory; the deepest enclosing tsconfig otherwise owns its checker.
|
|
116
|
+
// Within that project the last realpath alias supplies the source, matching the compiler's occurrence order.
|
|
109
117
|
for (const project of projects) {
|
|
110
|
-
for (const sourceFile of project.program.getSourceFiles()
|
|
118
|
+
for (const sourceFile of project.program.getSourceFiles()) {
|
|
119
|
+
if (!helpers.isProductionSource(config.root, sourceFile)) continue;
|
|
111
120
|
const name = helpers.canonical(sourceFile.fileName);
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
121
|
+
const owner = ownerByFile.get(name);
|
|
122
|
+
if (owner === project) { fileMap.set(name, sourceFile); continue; }
|
|
123
|
+
if (owner && ownershipRank(config, owner, name, helpers) >= ownershipRank(config, project, name, helpers)) continue;
|
|
124
|
+
ownerByFile.set(name, project);
|
|
125
|
+
fileMap.set(name, sourceFile);
|
|
115
126
|
}
|
|
116
127
|
}
|
|
117
|
-
return {
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
function owningProject(config, candidates, file, helpers) {
|
|
121
|
-
return candidates.filter(item => helpers.isInside(path.dirname(path.join(config.root, ...item.relative.split('/'))), file))
|
|
122
|
-
.sort((x, y) => y.relative.split('/').length - x.relative.split('/').length)[0] ?? candidates[0];
|
|
128
|
+
return { fileMap, ownerByFile };
|
|
123
129
|
}
|
|
124
130
|
|
|
125
131
|
function makeFileGraph(config, projects, helpers) {
|
|
126
|
-
const {
|
|
127
|
-
const fileMap = new Map();
|
|
132
|
+
const { fileMap, ownerByFile } = collectProjectFiles(config, projects, helpers);
|
|
128
133
|
const checkerByFile = new Map();
|
|
129
|
-
const
|
|
130
|
-
for (const [name, candidates] of occurrences) {
|
|
131
|
-
const owner = owningProject(config, candidates, name, helpers);
|
|
132
|
-
ownerByFile.set(name, owner);
|
|
133
|
-
fileMap.set(name, sourceIn.get(`${owner.relative}|${name}`));
|
|
134
|
-
checkerByFile.set(name, owner.program.getTypeChecker());
|
|
135
|
-
}
|
|
134
|
+
for (const [name, owner] of ownerByFile) checkerByFile.set(name, owner.program.getTypeChecker());
|
|
136
135
|
const files = [...fileMap.entries()].sort(([a], [b]) => a.localeCompare(b)).map(([, file]) => file);
|
|
137
136
|
const edges = new Map([...fileMap.keys()].map(file => [file, []]));
|
|
138
137
|
for (const [file, sourceFile] of fileMap) {
|
|
@@ -142,6 +141,21 @@ function makeFileGraph(config, projects, helpers) {
|
|
|
142
141
|
return { fileMap, checkerByFile, ownerByFile, files, edges };
|
|
143
142
|
}
|
|
144
143
|
|
|
144
|
+
// Resolution entries contain failed lookup paths as well as hits. Keep only one bounded batch for the current project;
|
|
145
|
+
// graph edges retain the resolved targets, so rotating this scratch cache changes neither coverage nor findings.
|
|
146
|
+
const RESOLUTION_BATCH_SIZE = 1024;
|
|
147
|
+
|
|
148
|
+
function resolutionCache(state, project) {
|
|
149
|
+
if (state.resolutionProject !== project || state.resolutionCount === RESOLUTION_BATCH_SIZE) {
|
|
150
|
+
state.resolutionProject = project;
|
|
151
|
+
state.resolutionCount = 0;
|
|
152
|
+
state.resolutionCache = state.ts.createModuleResolutionCache(state.config.root,
|
|
153
|
+
file => state.ts.sys.useCaseSensitiveFileNames ? file : file.toLowerCase(), project.options);
|
|
154
|
+
}
|
|
155
|
+
state.resolutionCount += 1;
|
|
156
|
+
return state.resolutionCache;
|
|
157
|
+
}
|
|
158
|
+
|
|
145
159
|
function addUnprovenFindings(sourceFile, project, references, errors, config, helpers) {
|
|
146
160
|
for (const item of references.unproven) errors.push({
|
|
147
161
|
ruleId: 'ARCH_DYNAMIC_DEPENDENCY_UNPROVEN',
|
|
@@ -229,7 +243,7 @@ function processReference(from, sourceFile, project, owningWorkspace, reference,
|
|
|
229
243
|
const { config, ts, workspaceNames, workspaces, host, errors, helpers } = state;
|
|
230
244
|
// A workspace package is read at its source, never at its build: the same import resolves whether or not dist exists.
|
|
231
245
|
const workspaceTarget = workspaces.filter(item => item.root !== helpers.canonical(config.root)).map(item => helpers.workspaceSourceEntry(ts, item, reference.specifier)).find(Boolean);
|
|
232
|
-
const resolvedName = workspaceTarget ?? helpers.resolveTypeScriptModule(ts, reference.specifier, sourceFile.fileName, project.options, host);
|
|
246
|
+
const resolvedName = workspaceTarget ?? helpers.resolveTypeScriptModule(ts, reference.specifier, sourceFile.fileName, project.options, host, resolutionCache(state, project));
|
|
233
247
|
if (!resolvedName) {
|
|
234
248
|
unresolvedReferenceFinding(reference, sourceFile, project, config, workspaceNames, errors, helpers);
|
|
235
249
|
return;
|
|
@@ -279,7 +293,8 @@ export function contextFromProjects(config, loaded, paths, helpers) {
|
|
|
279
293
|
const fileGraph = makeFileGraph(config, projects, helpers);
|
|
280
294
|
const { edges, workspaces } = dependencyGraph(config, loaded, fileGraph, fileGraph.ownerByFile, errors, helpers);
|
|
281
295
|
if (projects.length && fileGraph.files.length === 0) errors.push({ ruleId: 'ARCH_NO_SOURCE', message: 'The configured TypeScript projects contain no production TypeScript or JavaScript source.' });
|
|
296
|
+
const { checkerByFile } = fileGraph;
|
|
282
297
|
return { loaded, errors, files: fileGraph.files, edges, programs: projects.map(item => item.program), program: projects[0]?.program ?? null, projects, ts, workspaces,
|
|
283
|
-
checkerFor: file =>
|
|
298
|
+
checkerFor: file => checkerByFile.get(helpers.canonical(file)) ?? null,
|
|
284
299
|
workspaceOf: file => helpers.workspaceOf(workspaces, helpers.canonical(file)) };
|
|
285
300
|
}
|
|
@@ -9,6 +9,11 @@ import { byCodeUnit } from '../lib/list.mjs';
|
|
|
9
9
|
// builds afresh.
|
|
10
10
|
const runs = new AsyncLocalStorage();
|
|
11
11
|
|
|
12
|
+
/** Share compiler inputs only until this check finishes; nested callers join the same run. */
|
|
13
|
+
export function withTypeScriptProgramRun(run) {
|
|
14
|
+
return runs.getStore() ? run() : runs.run(new Map(), run);
|
|
15
|
+
}
|
|
16
|
+
|
|
12
17
|
|
|
13
18
|
function keyOf(value) {
|
|
14
19
|
if (value === undefined) return 'u';
|
|
@@ -48,7 +53,28 @@ export function sharedInProgramRun(kind, ts, input, build) {
|
|
|
48
53
|
/** ts.createProgram, shared inside a program run. */
|
|
49
54
|
export function createTypeScriptProgram(ts, { rootNames, options, projectReferences }) {
|
|
50
55
|
return sharedInProgramRun('program', ts, { rootNames, options, projectReferences },
|
|
51
|
-
() => ts.createProgram({ rootNames, options, projectReferences }));
|
|
56
|
+
() => ts.createProgram({ rootNames, options, projectReferences, host: sharedSourceHost(ts, options) }));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function sharedSourceHost(ts, options) {
|
|
60
|
+
if (!runs.getStore()) return undefined;
|
|
61
|
+
const registry = sharedInProgramRun('documents', ts, null,
|
|
62
|
+
() => ts.createDocumentRegistry(ts.sys.useCaseSensitiveFileNames, ts.sys.getCurrentDirectory()));
|
|
63
|
+
const host = ts.createCompilerHost(options);
|
|
64
|
+
const readSource = host.getSourceFile;
|
|
65
|
+
// TypeScript's registry separates parse-affecting settings and Node module formats. Sharing syntax trees leaves
|
|
66
|
+
// module resolution and symbol/type caches with each program, including projects with different path aliases.
|
|
67
|
+
host.getSourceFile = (file, sourceOptions, onError, fresh) => {
|
|
68
|
+
if (fresh) return readSource(file, sourceOptions, onError, fresh);
|
|
69
|
+
let text;
|
|
70
|
+
try { text = host.readFile(file); } catch (error) {
|
|
71
|
+
onError?.(String(error.message ?? error));
|
|
72
|
+
text = '';
|
|
73
|
+
}
|
|
74
|
+
if (text === undefined) return undefined;
|
|
75
|
+
return registry.acquireDocument(file, options, ts.ScriptSnapshot.fromString(text), '0', undefined, sourceOptions);
|
|
76
|
+
};
|
|
77
|
+
return host;
|
|
52
78
|
}
|
|
53
79
|
|
|
54
80
|
/** Read and expand a tsconfig with the caller's TypeScript compiler and optional tracked file reader. */
|
|
@@ -66,6 +92,7 @@ export function typeScriptProjectReferencePath(ts, reference) {
|
|
|
66
92
|
}
|
|
67
93
|
|
|
68
94
|
/** Resolve an import using the selected project's compiler options. */
|
|
69
|
-
export function resolveTypeScriptModule(ts, specifier, from, options, host
|
|
70
|
-
|
|
95
|
+
export function resolveTypeScriptModule(ts, specifier, from, options, host, cache) {
|
|
96
|
+
const resolverHost = host === undefined ? ts.sys : host;
|
|
97
|
+
return ts.resolveModuleName(specifier, from, options, resolverHost, cache).resolvedModule?.resolvedFileName;
|
|
71
98
|
}
|
package/surface-rules.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Grammar owns surface nesting and the single content edge of a panel list (ANATOMY-2, PADDING-0). */
|
|
2
|
-
import { attributeValue, stringOf } from "./lib/ast.mjs"
|
|
3
|
-
import { importOf, isFn, patternPath, unwrap, variableOf } from "./lib/bindings.mjs"
|
|
2
|
+
import { attributeValue, stringOf, walk } from "./lib/ast.mjs"
|
|
3
|
+
import { functionOf, importOf, isFn, patternPath, unwrap, variableOf } from "./lib/bindings.mjs"
|
|
4
4
|
import { typedClassStrings, typedPropertyStrings } from "./lib/typed-class-values.mjs"
|
|
5
5
|
import { reactHookOf } from "./lib/react.mjs"
|
|
6
6
|
|
|
@@ -356,8 +356,88 @@ export const noListPanelPadding = {
|
|
|
356
356
|
},
|
|
357
357
|
}
|
|
358
358
|
|
|
359
|
+
/** BOUNDARY-1 case-5: only content bands carry inset; horizontal separators reach the surface edges. */
|
|
360
|
+
export const dividerFullBleed = {
|
|
361
|
+
meta: {
|
|
362
|
+
type: "problem",
|
|
363
|
+
docs: {
|
|
364
|
+
description:
|
|
365
|
+
"BOUNDARY-1 case-5: horizontal Grammar dividers are full-bleed.",
|
|
366
|
+
},
|
|
367
|
+
schema: [],
|
|
368
|
+
messages: {
|
|
369
|
+
padding:
|
|
370
|
+
"FE_DIVIDER_FULL_BLEED: horizontal padding on this wrapper insets a Grammar Divider/Separator. Move padding to the sibling content bands so the divider reaches both surface edges.",
|
|
371
|
+
},
|
|
372
|
+
},
|
|
373
|
+
create(context) {
|
|
374
|
+
// Follow rendered same-file components, helper calls and JSX constants, with cycle protection.
|
|
375
|
+
const containsDivider = (root, seen = new Set()) => {
|
|
376
|
+
if (!root || seen.has(root)) return false
|
|
377
|
+
seen.add(root)
|
|
378
|
+
let found = false
|
|
379
|
+
const follow = (node) => {
|
|
380
|
+
found = containsDivider(node, seen) || found
|
|
381
|
+
}
|
|
382
|
+
walk(context.sourceCode, root, (node) => {
|
|
383
|
+
if (found) return false
|
|
384
|
+
if (isFn(node)) return false
|
|
385
|
+
if (node.type === "JSXOpeningElement") {
|
|
386
|
+
const name = grammarName(context, node.name)
|
|
387
|
+
if (
|
|
388
|
+
name?.length === 1 &&
|
|
389
|
+
["Divider", "Separator"].includes(name[0])
|
|
390
|
+
) {
|
|
391
|
+
const orientations = node.attributes.flatMap((entry) =>
|
|
392
|
+
propStrings(context, entry, "orientation", "variant"),
|
|
393
|
+
)
|
|
394
|
+
if (
|
|
395
|
+
!orientations.length ||
|
|
396
|
+
orientations.some((entry) => entry.text !== "vertical")
|
|
397
|
+
)
|
|
398
|
+
found = true
|
|
399
|
+
} else if (node.name.type === "JSXIdentifier") {
|
|
400
|
+
for (const definition of variableOf(context, node.name)?.defs ??
|
|
401
|
+
[]) {
|
|
402
|
+
if (definition.type === "FunctionName")
|
|
403
|
+
follow(definition.node.body)
|
|
404
|
+
if (definition.type === "Variable")
|
|
405
|
+
follow(functionOf(context, definition.node.init)?.body)
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
if (node.type === "CallExpression") {
|
|
410
|
+
follow(functionOf(context, node.callee)?.body)
|
|
411
|
+
for (const argument of node.arguments)
|
|
412
|
+
if (isFn(argument)) follow(argument.body)
|
|
413
|
+
}
|
|
414
|
+
if (
|
|
415
|
+
node.type === "Identifier" &&
|
|
416
|
+
node.parent?.type === "JSXExpressionContainer"
|
|
417
|
+
) {
|
|
418
|
+
for (const value of bindingValues(context, node)) follow(value)
|
|
419
|
+
}
|
|
420
|
+
return undefined
|
|
421
|
+
})
|
|
422
|
+
return found
|
|
423
|
+
}
|
|
424
|
+
return {
|
|
425
|
+
JSXOpeningElement(node) {
|
|
426
|
+
const padding = node.attributes.find((entry) =>
|
|
427
|
+
propStrings(context, entry, "className").some((value) =>
|
|
428
|
+
classTokens(value.text).some(horizontalPadding),
|
|
429
|
+
),
|
|
430
|
+
)
|
|
431
|
+
if (!padding) return
|
|
432
|
+
if (node.parent.children.some((child) => containsDivider(child)))
|
|
433
|
+
context.report({ node: padding, messageId: "padding" })
|
|
434
|
+
},
|
|
435
|
+
}
|
|
436
|
+
},
|
|
437
|
+
}
|
|
438
|
+
|
|
359
439
|
/** The surface laws ship at error in every composing source tree. */
|
|
360
|
-
export const rules = { "nested-control-variant": nestedControlVariant, "no-list-panel-padding": noListPanelPadding, "no-app-surface-paint": noAppSurfacePaint }
|
|
440
|
+
export const rules = { "divider-full-bleed": dividerFullBleed, "nested-control-variant": nestedControlVariant, "no-list-panel-padding": noListPanelPadding, "no-app-surface-paint": noAppSurfacePaint }
|
|
361
441
|
|
|
362
442
|
/** No app can lower or omit a surface law. */
|
|
363
443
|
export const recommended = Object.fromEntries(Object.keys(rules).map((name) => [`starci-fe/${name}`, "error"]))
|
package/ui-rulings.mjs
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/** Owner UI rulings: selection uses fill, and applications respect Grammar styling ownership. */
|
|
2
|
+
import { attribute, attributeValue, staticText } from "./lib/ast.mjs";
|
|
3
|
+
import { importOf } from "./lib/bindings.mjs";
|
|
4
|
+
import { isProductSource } from "./lib/scope.mjs";
|
|
5
|
+
import { typedClassStrings } from "./lib/typed-class-values.mjs";
|
|
6
|
+
|
|
7
|
+
/** Resolve a named or namespace import at its use, preserving lexical shadowing. */
|
|
8
|
+
const grammarComponent = (context, opening, expected) => {
|
|
9
|
+
const name = opening.name;
|
|
10
|
+
const root = name.type === "JSXMemberExpression" ? name.object : name;
|
|
11
|
+
if (root.type !== "JSXIdentifier") return false;
|
|
12
|
+
const binding = importOf(context, root);
|
|
13
|
+
if (
|
|
14
|
+
!binding ||
|
|
15
|
+
!/^@starci\/grammar(?:\/(?:common|core|heritage|offset-pop))?$/.test(
|
|
16
|
+
binding.source,
|
|
17
|
+
)
|
|
18
|
+
)
|
|
19
|
+
return false;
|
|
20
|
+
return name.type === "JSXMemberExpression"
|
|
21
|
+
? binding.imported === null && name.property.name === expected
|
|
22
|
+
: binding.imported === expected;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/** Only a final explicit attribute is proof when an opaque spread could override a value. */
|
|
26
|
+
const propText = (opening, key) => {
|
|
27
|
+
let value = null;
|
|
28
|
+
for (const entry of opening.attributes) {
|
|
29
|
+
if (entry.type === "JSXSpreadAttribute") value = null;
|
|
30
|
+
else if (entry.name.name === key) value = staticText(entry.value);
|
|
31
|
+
}
|
|
32
|
+
return value;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/** Navigation and rail/list placement are structurally identifiable without guessing from product names. */
|
|
36
|
+
const navigationList = (context, opening) => {
|
|
37
|
+
for (let node = opening.parent; node; node = node.parent) {
|
|
38
|
+
if (node.type !== "JSXElement") continue;
|
|
39
|
+
const parent = node.openingElement;
|
|
40
|
+
if (
|
|
41
|
+
["nav", "ul", "ol"].includes(parent.name.name) ||
|
|
42
|
+
["navigation", "list"].includes(propText(parent, "role"))
|
|
43
|
+
)
|
|
44
|
+
return true;
|
|
45
|
+
if (
|
|
46
|
+
["Rail", "Sidebar"].some((role) =>
|
|
47
|
+
grammarComponent(context, parent, role),
|
|
48
|
+
)
|
|
49
|
+
)
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
return false;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
/** Navigation-like single selection uses the row fill instead of a second check indicator. */
|
|
56
|
+
export const selectionFillNoCheck = {
|
|
57
|
+
meta: {
|
|
58
|
+
type: "problem",
|
|
59
|
+
docs: {
|
|
60
|
+
description:
|
|
61
|
+
"Navigation-like single-select ListBox rows use selectionIndicator=none.",
|
|
62
|
+
},
|
|
63
|
+
schema: [],
|
|
64
|
+
messages: {
|
|
65
|
+
indicator:
|
|
66
|
+
'Use selectionIndicator="none" on this navigation-like single-select ListBox; the row fill carries selection.',
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
create(context) {
|
|
70
|
+
return {
|
|
71
|
+
JSXOpeningElement(node) {
|
|
72
|
+
if (
|
|
73
|
+
!grammarComponent(context, node, "ListBox") ||
|
|
74
|
+
!navigationList(context, node)
|
|
75
|
+
)
|
|
76
|
+
return;
|
|
77
|
+
if (["none", "multiple"].includes(propText(node, "selectionMode")))
|
|
78
|
+
return;
|
|
79
|
+
if (propText(node, "selectionIndicator") !== "none")
|
|
80
|
+
context.report({ node, messageId: "indicator" });
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
/** Grammar internal selectors belong to Grammar, including selectors in colocated class declarations. */
|
|
87
|
+
export const noGrammarInternalSelector = {
|
|
88
|
+
meta: {
|
|
89
|
+
type: "problem",
|
|
90
|
+
docs: {
|
|
91
|
+
description: "Application styles cannot target starci-core internals.",
|
|
92
|
+
},
|
|
93
|
+
schema: [],
|
|
94
|
+
messages: {
|
|
95
|
+
internal:
|
|
96
|
+
"Remove this starci-core- selector. Compose the Grammar public API; message actions belong in the ChatBubble floating toolbar.",
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
create(context) {
|
|
100
|
+
if (!isProductSource(context)) return {};
|
|
101
|
+
const selector = /(?:\.|_|\[class[^\]]*)starci-core-/;
|
|
102
|
+
const report = (node, text) => {
|
|
103
|
+
if (text && selector.test(text))
|
|
104
|
+
context.report({ node, messageId: "internal" });
|
|
105
|
+
};
|
|
106
|
+
return {
|
|
107
|
+
Literal(node) {
|
|
108
|
+
if (typeof node.value === "string") report(node, node.value);
|
|
109
|
+
},
|
|
110
|
+
TemplateElement(node) {
|
|
111
|
+
report(node, node.value.cooked);
|
|
112
|
+
},
|
|
113
|
+
JSXAttribute(node) {
|
|
114
|
+
if (node.name.name !== "className") return;
|
|
115
|
+
const value = attributeValue(attribute(node.parent, "className"));
|
|
116
|
+
if (value?.type !== "Identifier" && value?.type !== "MemberExpression")
|
|
117
|
+
return;
|
|
118
|
+
const strings = typedClassStrings(context, value, "classes");
|
|
119
|
+
if (strings.some((entry) => selector.test(entry.text)))
|
|
120
|
+
context.report({ node, messageId: "internal" });
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
},
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
export const rules = {
|
|
127
|
+
"selection-fill-no-check": selectionFillNoCheck,
|
|
128
|
+
"no-grammar-internal-selector": noGrammarInternalSelector,
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
/** Both owner rulings are universal errors in the frontend canon. */
|
|
132
|
+
export const recommended = Object.fromEntries(
|
|
133
|
+
Object.keys(rules).map((name) => [`starci-fe/${name}`, "error"]),
|
|
134
|
+
);
|