@starci/hfs 5.0.7 → 5.0.8
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 +11 -0
- package/README.md +7 -8
- package/cache/fake-session.mjs +1 -1
- package/cache/hfs-family.mjs +22 -9
- package/cache/import-graph.d.mts +32 -4
- package/cache/import-graph.mjs +143 -11
- package/cache/lint-family.d.mts +0 -2
- package/cache/lint-family.mjs +54 -33
- package/cache/records.d.mts +7 -0
- package/cache/records.mjs +17 -1
- package/cache/run.d.mts +1 -1
- package/cache/session.mjs +6 -2
- package/cache/side-key.d.mts +2 -0
- package/cache/side-key.mjs +5 -1
- package/cache/structure-memo.d.mts +34 -0
- package/cache/structure-memo.mjs +150 -0
- package/cache/types.d.mts +6 -2
- package/cache/wiring-family.mjs +1 -1
- package/codemod/small-renames.mjs +22 -2
- package/lint/eslint-list.cjs +26 -0
- package/lint/run.d.mts +18 -58
- package/lint/run.mjs +54 -284
- package/package.json +1 -1
- package/release/lint-report.d.mts +1 -1
- package/release/lint-report.mjs +3 -3
- package/report/sonar.d.mts +1 -1
- package/report/sonar.mjs +3 -3
- package/report/stylelint-findings.d.mts +23 -0
- package/report/stylelint-findings.mjs +9 -0
- package/runtime/knowledge/hfs/canon-pins.yaml +7 -7
- package/runtime/knowledge/hfs/ci-standard.yaml +2 -2
- package/runtime/knowledge/hfs/rules.yaml +4 -4
- package/runtime/knowledge/hfs/slots.yaml +1 -1
- package/runtime/knowledge/sonar-gate.yaml +2 -2
- package/runtime/modules/kernel/failure-codes.yaml +4 -4
- package/runtime/scripts/api/node/run-node.d.mts +5 -0
- package/runtime/scripts/hfs/check.d.mts +16 -1
- package/runtime/scripts/hfs/check.mjs +18 -7
- package/runtime/scripts/hfs/gate-threshold.mjs +1 -1
- package/runtime/scripts/hfs/rule-memo.d.mts +30 -0
- package/runtime/scripts/hfs/rule-memo.mjs +24 -0
- package/runtime/scripts/hfs/rules/a15-findings.d.mts +6 -0
- package/runtime/scripts/hfs/rules/a15-findings.mjs +11 -2
- package/runtime/scripts/hfs/rules/ci-standard.mjs +2 -2
- package/runtime/scripts/hfs/rules/monorepo.d.mts +1 -3
- package/runtime/scripts/hfs/rules/monorepo.mjs +9 -11
- package/runtime/scripts/hfs/rules/pipeline.mjs +13 -9
- package/runtime/scripts/hfs/rules/read.d.mts +5 -0
- package/runtime/scripts/hfs/rules/read.mjs +13 -0
- package/runtime/scripts/hfs/rules/secrets.d.mts +2 -0
- package/runtime/scripts/hfs/rules/secrets.mjs +4 -1
- package/runtime/scripts/hfs/rules/stacks-release.mjs +35 -21
- package/runtime/scripts/lib/worktree-exclude.mjs +1 -1
- package/scaffold/app.mjs +3 -3
- package/src/check-cache-structure-support.d.mts +52 -0
- package/src/main.d.mts +3 -2
- package/src/main.mjs +123 -109
- package/sync/ci-commands.d.mts +2 -1
- package/sync/ci-commands.mjs +19 -20
- package/sync/index.mjs +2 -2
- package/templates/app/package-scripts/core.json +2 -2
- package/templates/app/task-graph/turbo.json +0 -3
package/release/lint-report.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// lint-report.mjs - the external issues report the release gate's sonar row produces before it runs the scanner.
|
|
2
|
-
// The app declares `sonar.externalIssuesReportPaths=reports/lint.sonar.json`; the managed CI makes it with `lint --side <side> --out reports/lint.<side>.sonar.json`
|
|
2
|
+
// The app declares `sonar.externalIssuesReportPaths=reports/lint.sonar.json`; the managed CI makes it with `app check --gate lint --side <side> --out reports/lint.<side>.sonar.json`
|
|
3
3
|
// per lint matrix side and a "merge Sonar lint reports" step. This module does the same locally, through the same process seam as every gate
|
|
4
4
|
// (an argument array through ctx.spawn, never a shell). The merge below is the one in packages/hfs/sync/ci-commands.mjs (sonarMergeSteps): keep them identical.
|
|
5
5
|
import fs from 'node:fs';
|
|
@@ -17,7 +17,7 @@ function mergeSonarReports(reports) {
|
|
|
17
17
|
/** The sides the app has: a be/ or fe/ folder beside the app root. */
|
|
18
18
|
const sidesOf = (root) => LINT_SIDES.filter((side) => fs.existsSync(path.join(root, side)));
|
|
19
19
|
/**
|
|
20
|
-
* Runs `starci app lint --side <side> --out <file>` for every side the app has, then writes reports/lint.sonar.json.
|
|
20
|
+
* Runs `starci app check --gate lint --side <side> --out <file>` for every side the app has, then writes reports/lint.sonar.json.
|
|
21
21
|
* `launch` turns an argv into [command, args] for the platform. Returns { pass, text }: the honest log of every lint run and the verdict.
|
|
22
22
|
* A lint that exits non-zero (findings or error) or writes no report fails the row; nothing is skipped.
|
|
23
23
|
*/
|
|
@@ -30,7 +30,7 @@ export function produceLintReports(ctx, { launch, platform, env }) {
|
|
|
30
30
|
for (const side of sides) {
|
|
31
31
|
const file = path.join(ctx.cwd, sideReport(side));
|
|
32
32
|
fs.rmSync(file, { force: true });
|
|
33
|
-
const argv = ['npx', 'starci', 'app', 'lint', '--side', side, '--out', sideReport(side)];
|
|
33
|
+
const argv = ['npx', 'starci', 'app', 'check', '--gate', 'lint', '--side', side, '--out', sideReport(side)];
|
|
34
34
|
const [command, args] = launch(argv, platform);
|
|
35
35
|
out.push(`$ ${argv.join(' ')}\n`);
|
|
36
36
|
const run = tool(ctx, command, args, { cwd: ctx.cwd, env });
|
package/report/sonar.d.mts
CHANGED
|
@@ -48,7 +48,7 @@ interface CheckFinding {
|
|
|
48
48
|
line?: number;
|
|
49
49
|
}
|
|
50
50
|
type LinterResult = any;
|
|
51
|
-
/** One document of several (the starci-hfs, eslint and stylelint documents of one app
|
|
51
|
+
/** One document of several (the starci-hfs, eslint and stylelint documents of one app check): rules by id, issues in the one sort order. */
|
|
52
52
|
export declare function mergeReports(reports: readonly SonarDocument[]): SonarDocument;
|
|
53
53
|
/**
|
|
54
54
|
* The Generic Issue Import document of a check's findings (the `findings` of checkRepository, each with the catalog's
|
package/report/sonar.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
// Sonar documents of the
|
|
1
|
+
// Sonar documents of the lint gate of `starci app check` (`--out`): the building blocks that turn the
|
|
2
2
|
// findings of the StarCi canon into a Sonar Generic Issue Import document (SonarQube 10.3+ format: `{ rules, issues }`).
|
|
3
3
|
// sonarReport(findings) the repository findings of `starci app check`, engineId `starci-hfs`, rule id = the finding code
|
|
4
4
|
// linterReport(kind, results) a linter's own json output (`eslint -f json`, `stylelint --formatter json`), engineId `eslint` / `stylelint`,
|
|
5
5
|
// rule id = the linter's rule. Sonar's own ESLint import (sonar.eslint.reportPaths) is not used: it drops an
|
|
6
6
|
// issue on a file outside sonar.sources, and a stylelint result has no native import at all.
|
|
7
|
-
// mergeReports(reports) the documents of one `starci app
|
|
7
|
+
// mergeReports(reports) the documents of one `starci app check` run as ONE file
|
|
8
8
|
// One placement rule for every engine: Sonar imports an issue only on a file it indexes (a tracked source or stylesheet under
|
|
9
9
|
// sonar.sources). A finding on any other path (hfs.json, a workflow, a package under an unindexed root, e2e/, a directory) is filed
|
|
10
10
|
// on the first source file of sonar.sources and its message names the real path, so no finding is dropped.
|
|
@@ -33,7 +33,7 @@ function document(rules, issues) {
|
|
|
33
33
|
const used = new Set(sorted.map((issue) => issue.ruleId));
|
|
34
34
|
return { rules: [...rules.values()].filter((rule) => used.has(rule.id)).sort((a, b) => cmp(a.id, b.id)), issues: sorted };
|
|
35
35
|
}
|
|
36
|
-
/** One document of several (the starci-hfs, eslint and stylelint documents of one app
|
|
36
|
+
/** One document of several (the starci-hfs, eslint and stylelint documents of one app check): rules by id, issues in the one sort order. */
|
|
37
37
|
export function mergeReports(reports) {
|
|
38
38
|
const rules = new Map(reports.flatMap((report) => report.rules).map((rule) => [rule.id, rule]));
|
|
39
39
|
return document(rules, reports.flatMap((report) => report.issues));
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** A stylelint result as the `--formatter json` output carries it: the stylesheet and its warnings. */
|
|
2
|
+
export interface StylelintFileResult {
|
|
3
|
+
source?: string;
|
|
4
|
+
warnings?: readonly {
|
|
5
|
+
rule?: string;
|
|
6
|
+
text: string;
|
|
7
|
+
line?: number;
|
|
8
|
+
column?: number;
|
|
9
|
+
}[];
|
|
10
|
+
}
|
|
11
|
+
/** One stylelint warning as a check finding. */
|
|
12
|
+
export interface StylelintFinding {
|
|
13
|
+
engine: 'stylelint';
|
|
14
|
+
rule: string;
|
|
15
|
+
code: string;
|
|
16
|
+
level: 'error';
|
|
17
|
+
path: string;
|
|
18
|
+
line: number | null;
|
|
19
|
+
column: number | null;
|
|
20
|
+
message: string;
|
|
21
|
+
}
|
|
22
|
+
/** The findings of stylelint results; `appRoot` makes their paths app-relative. */
|
|
23
|
+
export declare function stylelintFindings(results: readonly StylelintFileResult[], appRoot: string): StylelintFinding[];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// stylelint-findings.mts - the stylelint results of the lint gate of `starci app check` as findings, one per warning, paths app-relative.
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
/** The findings of stylelint results; `appRoot` makes their paths app-relative. */
|
|
4
|
+
export function stylelintFindings(results, appRoot) {
|
|
5
|
+
return results.flatMap((result) => (result.warnings ?? []).map((warning) => {
|
|
6
|
+
const rule = warning.rule || 'stylelint-error';
|
|
7
|
+
return { engine: 'stylelint', rule, code: rule, level: 'error', path: path.relative(appRoot, result.source ?? '').replace(/\\/g, '/'), line: warning.line ?? null, column: warning.column ?? null, message: warning.text };
|
|
8
|
+
}));
|
|
9
|
+
}
|
|
@@ -31,42 +31,42 @@ pins:
|
|
|
31
31
|
source: packages/event-stream/package.json
|
|
32
32
|
why: 'the one server-sent-events client of every front end (fe-stack event-stream, owner:event-stream-package): the transport client layer (modules/api/sse/clients) creates one instance for the app with the bearer token source and the stream operations follow on it; it carries Last-Event-ID resume, the capped doubling backoff, the heartbeat timeout, the single 401 renewal and the useSWRSubscription adapter, so no app keeps a hand-written reader.'
|
|
33
33
|
'@starci/grammar':
|
|
34
|
-
version: 0.21.
|
|
34
|
+
version: 0.21.12
|
|
35
35
|
group: starci
|
|
36
36
|
install: registry
|
|
37
37
|
side: fe
|
|
38
38
|
source: packages/grammar/package.json
|
|
39
39
|
why: 'the grammar front ends read: the brand layer sets `--font-sans` and `--font-mono` and the grammar reads them; it carries the Input tel kind, the copyable and read-only Input, the IconButton disclosure props and count badge, ChatBubble, FillViewport, Textarea mentions and Enter-to-send, the leading PrimaryRailLayout rail, the plate-less Image, ListRow, the soft Alert, Progress steps, the floating primary IconButton, FlowGraph, the STATE-8 loading views and the bordered selectable TagGroup chips. The runtime source version wins for a @starci package.'
|
|
40
40
|
'@starci/eslint-canon-be':
|
|
41
|
-
version: 3.11.
|
|
41
|
+
version: 3.11.19
|
|
42
42
|
group: starci
|
|
43
43
|
install: registry
|
|
44
44
|
side: be
|
|
45
45
|
source: packages/eslint-canon-be/package.json
|
|
46
46
|
why: 'the back-end ESLint canon: `loadHfs(import.meta.url)` of be/eslint.config.mjs finds the app-root hfs.json (kind app) and gives every linted file the view of the be side, and the project graph is built per side; its bundled runtime copies (slots, canon-pins, failure codes, the architecture machine) put .starcistacks and .sops.yaml at the app root; `starciBeConfig({ hfs: loadHfs(import.meta.url) })` is the typed factory and the BE-CONVENTION laws are its rules.'
|
|
47
47
|
'@starci/eslint-canon-fe':
|
|
48
|
-
version: 9.9.
|
|
48
|
+
version: 9.9.12
|
|
49
49
|
group: starci
|
|
50
50
|
install: registry
|
|
51
51
|
side: fe
|
|
52
52
|
source: packages/eslint-canon-fe/package.json
|
|
53
53
|
why: 'the front-end ESLint canon: `loadHfs(import.meta.url)` of fe/eslint.config.mjs finds the app-root hfs.json (kind app) and gives every linted file the view of the fe side, and the project graph is built per side; its bundled runtime copies (slots, canon-pins, failure codes, the architecture machine) put .starcistacks and .sops.yaml at the app root; the front end has no tests (FE_NO_TESTS R97 in hfs) and no-vietnamese-in-source (R91) applies.'
|
|
54
54
|
'@starci/eslint-grammar-core':
|
|
55
|
-
version: 0.21.
|
|
55
|
+
version: 0.21.12
|
|
56
56
|
group: starci
|
|
57
57
|
install: registry
|
|
58
58
|
side: fe
|
|
59
59
|
source: packages/eslint-grammar-core/package.json
|
|
60
60
|
why: 'the StarCi Grammar component API lint, versioned with @starci/grammar; front ends compose this family package with the universal FE canon.'
|
|
61
61
|
'@starci/eslint-grammar-offset-pop':
|
|
62
|
-
version: 0.21.
|
|
62
|
+
version: 0.21.12
|
|
63
63
|
group: starci
|
|
64
64
|
install: registry
|
|
65
65
|
side: fe
|
|
66
66
|
source: packages/eslint-grammar-offset-pop/package.json
|
|
67
67
|
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
68
|
'@starci/stylelint-canon':
|
|
69
|
-
version: 2.5.
|
|
69
|
+
version: 2.5.1
|
|
70
70
|
group: starci
|
|
71
71
|
install: registry
|
|
72
72
|
side: fe
|
|
@@ -106,7 +106,7 @@ pins:
|
|
|
106
106
|
source: packages/ai-router/package.json
|
|
107
107
|
why: 'the AI pool router of a back end: a NestJS module that routes OpenAI-compatible chat, stream and embeddings calls across keys, models and providers, with @starci/ai-router/testing for its specs; @starci/jest-preset compiles it as an ESM-only dependency.'
|
|
108
108
|
'@starci/hfs':
|
|
109
|
-
version: 5.0.
|
|
109
|
+
version: 5.0.8
|
|
110
110
|
group: starci
|
|
111
111
|
install: registry
|
|
112
112
|
side: both
|
|
@@ -37,7 +37,7 @@ defaults:
|
|
|
37
37
|
# The steps that need a raised Node heap on the GitHub runner, matched on their `run` text, and the least heap they must declare in NODE_OPTIONS.
|
|
38
38
|
heap:
|
|
39
39
|
minMiB: 6144
|
|
40
|
-
steps: ['npm run typecheck', 'npm run lint', 'app lint', 'app coverage verify', 'npm run db:lint']
|
|
40
|
+
steps: ['npm run typecheck', 'npm run lint', 'app check --gate lint', 'app coverage verify', 'npm run db:lint']
|
|
41
41
|
|
|
42
42
|
items:
|
|
43
43
|
- id: candidate-trigger
|
|
@@ -77,7 +77,7 @@ items:
|
|
|
77
77
|
check: ci-standard
|
|
78
78
|
- id: sonar-lint-per-side
|
|
79
79
|
title: the Sonar lint runs per side
|
|
80
|
-
requires: "a lint with a Sonar import (--out) names its side (--side be|fe); the reports are merged into reports/lint.sonar.json afterwards; no combined lint with Sonar"
|
|
80
|
+
requires: "a lint with a Sonar import (`starci app check --gate lint --out`) names its side (--side be|fe); the reports are merged into reports/lint.sonar.json afterwards; no combined lint with Sonar"
|
|
81
81
|
covers: [app-ci, runtime]
|
|
82
82
|
check: ci-standard
|
|
83
83
|
- id: test-sharding
|
|
@@ -21,9 +21,9 @@ version: 3.1.0
|
|
|
21
21
|
gates:
|
|
22
22
|
pre-commit: the managed L0 hook runs app check --staged, managed-file drift, ESLint per side and stylelint on staged source, and prettier on staged files; typecheck and targeted specs belong to the op gate under R225
|
|
23
23
|
pre-push: the managed app hook invokes the bundled push policy under R225; it starts no source check, build or test
|
|
24
|
-
settle: the op gate `starci gate run` over the op's changed files (merge guard, starci app
|
|
24
|
+
settle: the op gate `starci gate run` over the op's changed files (merge guard, starci app check, codegen, tsc, the slice's specs; only findings new against the workflow's previous checkpoint block), re-read at starci kernel settle, which refuses a red done; a green settle commits the op's checkpoint on wf-<workflowId>
|
|
25
25
|
land: the workflow's finish, the only time main is touched - gate.mjs over the whole workflow branch against its merge-base with main, the merge guard, review.verify of the exact head that lands, the branch rebased onto main, then main fast-forwarded and pushed
|
|
26
|
-
ci: GitHub Actions runs the same pinned starci app lint, format:check, typecheck, unit with the per-file coverage threshold, build:be and build:fe, then the Sonar scan and gate
|
|
26
|
+
ci: GitHub Actions runs the same pinned starci app check --gate lint, format:check, typecheck, unit with the per-file coverage threshold, build:be and build:fe, then the Sonar scan and gate
|
|
27
27
|
sonar: Sonar quality gate (knowledge/sonar-gate.yaml) - the imported lint findings, duplication, cognitive complexity and the coverage of the logic of be/src/modules at 100
|
|
28
28
|
runtime: "`starci runtime check` (npm run check) of the StarCi runtime repository itself: scripts/checks/check-runtime.mjs runs node --check, scripts/hfs/runtime-check.mjs with knowledge/hfs/runtime-slots.yaml, and the retained self-checks"
|
|
29
29
|
enforcerKinds:
|
|
@@ -229,7 +229,7 @@ rules:
|
|
|
229
229
|
editions: [lite, full]
|
|
230
230
|
docs: [docs/hfs-legacy-tooling.md#ci-and-hooks]
|
|
231
231
|
code: "HFS_CI_MISSING_CANON"
|
|
232
|
-
law: "CI runs the pinned `starci app lint` (`npm run lint`), a clone never redirects `core.hooksPath` away from husky, and the folder a set `core.hooksPath` names holds the installed hooks in every checkout (husky's dispatcher in `.husky/_`), so no commit lands without the pre-commit gate."
|
|
232
|
+
law: "CI runs the pinned `starci app check --gate lint` (`npm run lint`), a clone never redirects `core.hooksPath` away from husky, and the folder a set `core.hooksPath` names holds the installed hooks in every checkout (husky's dispatcher in `.husky/_`), so no commit lands without the pre-commit gate."
|
|
233
233
|
kinds: [check, codemod]
|
|
234
234
|
gates: [land, ci]
|
|
235
235
|
failureCodes: ["HFS_CI_MISSING_CANON", "HFS_HOOKS_PATH_REDIRECTED", "HFS_HOOKS_NOT_INSTALLED"]
|
|
@@ -2503,7 +2503,7 @@ rules:
|
|
|
2503
2503
|
- {path: packages/hfs/src/legacy-monorepo-coverage.spec.mjs, edition: full, codes: [HFS_MONO_WORKSPACES]}
|
|
2504
2504
|
- id: R144
|
|
2505
2505
|
code: "HFS_MONO_FE_WORKSPACE"
|
|
2506
|
-
law: "Every fe app `fe/apps/<app>` is an npm workspace: its `package.json` is named `@<project>/<app>`, is private, declares its own runtime dependencies and has exactly the scripts `build: next build`, `dev: next dev`, `
|
|
2506
|
+
law: "Every fe app `fe/apps/<app>` is an npm workspace: its `package.json` is named `@<project>/<app>`, is private, declares its own runtime dependencies and has exactly the scripts `build: next build`, `dev: next dev`, `start: next start` and `typecheck: tsc --noEmit`; every fe package `fe/packages/<pkg>` is private with `build` and `typecheck`; no workspace has a `lint` script, the app is linted once from the root with `starci app check --gate lint`."
|
|
2507
2507
|
kinds: [check]
|
|
2508
2508
|
gates: [settle, land, ci]
|
|
2509
2509
|
failureCodes: ["HFS_MONO_FE_WORKSPACE"]
|
|
@@ -1037,7 +1037,7 @@ slots:
|
|
|
1037
1037
|
rules: [HFS_MANAGED_FILE_DRIFT]
|
|
1038
1038
|
- id: app.starcistacks.cache
|
|
1039
1039
|
profiles: [app]
|
|
1040
|
-
# The committed result cache of `starci app check`
|
|
1040
|
+
# The committed result cache of `starci app check` (ruling app-check-cache, contexts/project/check-cache.md): JSON Lines records keyed by
|
|
1041
1041
|
# content, one folder per family. App-owned and written only by the CLI; sync never renders, overwrites or judges it. Both editions.
|
|
1042
1042
|
path: ".starcistacks/cache/"
|
|
1043
1043
|
presence: optional
|
|
@@ -40,11 +40,11 @@ newCode:
|
|
|
40
40
|
metric: new_security_hotspots_reviewed
|
|
41
41
|
minReviewedPercent: 100
|
|
42
42
|
unreviewedMax: 0
|
|
43
|
-
# The whole code, not only the new code. Every finding of the HFS canon reaches Sonar through ONE entry, `starci app lint`
|
|
43
|
+
# The whole code, not only the new code. Every finding of the HFS canon reaches Sonar through ONE entry, `starci app check --gate lint --out`
|
|
44
44
|
# (packages/hfs, contract changes hfs-sonar-import and hfs-lint-entry). CI runs it per side with --side and --out,
|
|
45
45
|
# then merges rules by id and joins issues into ONE file, reports/lint.sonar.json, named by sonar.externalIssuesReportPaths; the gate holds the open-issue count of
|
|
46
46
|
# the whole project at zero. The file carries three engines:
|
|
47
|
-
# starci-hfs the repository findings of
|
|
47
|
+
# starci-hfs the repository findings of the gates a run selects (managed files, tree, pins, CI, contracts; the rule id is the finding code)
|
|
48
48
|
# eslint ESLint's json over the repository (the BE and FE canon plugins alike, per-file and project-graph rules)
|
|
49
49
|
# stylelint stylelint's json over the style glob (front ends)
|
|
50
50
|
# The engines share ONE placement rule (a finding on a file Sonar does not index is filed on the first source file); Sonar's own
|
|
@@ -3305,11 +3305,11 @@ HFS_CANON_PIN_DRIFT:
|
|
|
3305
3305
|
kind: check-finding
|
|
3306
3306
|
|
|
3307
3307
|
HFS_CI_MISSING_CANON:
|
|
3308
|
-
title: "CI runs the pinned `starci app lint`; pre-push runs typecheck and lint"
|
|
3308
|
+
title: "CI runs the pinned `starci app check --gate lint`; pre-push runs typecheck and lint"
|
|
3309
3309
|
title_vi: "CI thiếu bước canon"
|
|
3310
3310
|
meaning_vi: "Workflow/husky thiếu bước `<step>`. Cấu trúc chỉ được kiểm khi agent chạy — CI phải tự kiểm."
|
|
3311
3311
|
causes_vi:
|
|
3312
|
-
- "Vi phạm luật R13: CI phải chạy `starci app lint`; pre-push phải có `typecheck` + `lint`."
|
|
3312
|
+
- "Vi phạm luật R13: CI phải chạy `starci app check --gate lint`; pre-push phải có `typecheck` + `lint`."
|
|
3313
3313
|
nextStep_vi: "Op vừa tạo ra bản này sẽ được chạy lại để sửa theo lời nhắn của bộ kiểm tra (nợ hàng loạt có codemod của HFS); không cần ai can thiệp thêm."
|
|
3314
3314
|
owner: op-retry
|
|
3315
3315
|
kind: check-finding
|
|
@@ -3698,7 +3698,7 @@ HFS_CHECK_CACHE_MISSING:
|
|
|
3698
3698
|
HFS_FORMAT:
|
|
3699
3699
|
title: "Prettier is the only formatter"
|
|
3700
3700
|
title_vi: "Chưa format bằng Prettier"
|
|
3701
|
-
meaning_vi: "`<file>` chưa được format. Chạy `
|
|
3701
|
+
meaning_vi: "`<file>` chưa được format. Chạy `npm run format`."
|
|
3702
3702
|
causes_vi:
|
|
3703
3703
|
- "Vi phạm luật R19: Prettier (config `@starci/prettier-config`) là formatter duy nhất; ESLint không còn luật định dạng."
|
|
3704
3704
|
nextStep_vi: "Op vừa tạo ra bản này sẽ được chạy lại để sửa theo lời nhắn của bộ kiểm tra (nợ hàng loạt có codemod của HFS); không cần ai can thiệp thêm."
|
|
@@ -3899,7 +3899,7 @@ HFS_MODULE_TIER_INVALID:
|
|
|
3899
3899
|
HFS_MONO_FE_WORKSPACE:
|
|
3900
3900
|
title: "An fe workspace manifest breaks the workspace shape"
|
|
3901
3901
|
title_vi: "Manifest của một workspace fe sai hình dạng"
|
|
3902
|
-
meaning_vi: "Mỗi app fe `fe/apps/<app>` là workspace `@<project>/<app>`, private, có đúng các script build, dev,
|
|
3902
|
+
meaning_vi: "Mỗi app fe `fe/apps/<app>` là workspace `@<project>/<app>`, private, có đúng các script build, dev, start và typecheck; mỗi gói `fe/packages/<pkg>` là private và có build, typecheck; workspace không có script lint, lint chạy một lần từ gốc bằng `starci app check --gate lint`."
|
|
3903
3903
|
causes_vi:
|
|
3904
3904
|
- "Vi phạm luật R144: turbo chạy các task theo script của từng workspace; tên, script hoặc cờ private sai khiến build, lint hoặc typecheck của app bị bỏ qua hoặc chạy khác chuẩn."
|
|
3905
3905
|
nextStep_vi: "Op vừa tạo ra bản này sẽ được chạy lại để sửa theo lời nhắn của bộ kiểm tra: đặt tên `@<project>/<app>`, `\"private\": true` và đúng bộ script trong `package.json` của workspace đó."
|
|
@@ -8,6 +8,11 @@ export interface HeavyNodeRequest {
|
|
|
8
8
|
/** When supplied, this is the entire child environment, not an overlay. */
|
|
9
9
|
readonly env?: NodeJS.ProcessEnv | undefined;
|
|
10
10
|
readonly timeoutMs?: number | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* The number of source files the child judges, when it is a whole-program lint of them. The CLI scales the liveness budget of the kind with it
|
|
13
|
+
* (ops/liveness.yaml heavy.timeoutMinutesPer1000Files): a larger side legitimately runs longer, and the budget still ends a hung child.
|
|
14
|
+
*/
|
|
15
|
+
readonly files?: number | undefined;
|
|
11
16
|
readonly maxBuffer: number;
|
|
12
17
|
}
|
|
13
18
|
/** Normal red exits are measurements; an interrupted child is not one. */
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { type SlotManifest } from './slots.mjs';
|
|
1
|
+
import { type RepoView, type Resolver, type SlotManifest } from './slots.mjs';
|
|
2
2
|
import { type Finding, type Summary, type Why } from './check-results.mjs';
|
|
3
|
+
import { type FileRule } from './rule-memo.mjs';
|
|
3
4
|
import type { Surface } from './architecture/index.mjs';
|
|
4
5
|
export { REFUSAL_CODES } from './refusal-codes.mjs';
|
|
5
6
|
export { checkDatabase } from './rules/database.mjs';
|
|
@@ -65,10 +66,24 @@ export interface RepositoryResult extends CheckResult {
|
|
|
65
66
|
[key: string]: unknown;
|
|
66
67
|
}
|
|
67
68
|
type CheckManifest = SlotManifest;
|
|
69
|
+
type CheckRepo = RepoView;
|
|
70
|
+
type CheckResolver = Resolver;
|
|
68
71
|
/** {code: {title, title_vi, meaning_vi, nextStep_vi}} for the codes asked for, read from the failure-code catalog under `root`. */
|
|
69
72
|
export declare function readWhy(root?: string, codes?: readonly string[]): Record<string, Why>;
|
|
70
73
|
/** Repository-relative tracked paths (git ls-files, posix separators; what the index holds, whatever the work tree shows). A directory that is not a Git work tree is a refusal. */
|
|
71
74
|
export declare function trackedFiles(repoRoot: string): string[];
|
|
75
|
+
/**
|
|
76
|
+
* The rules whose findings for a file depend on that file alone (and the files `deps` names), so the result cache keeps them per file by content hash
|
|
77
|
+
* (contexts/project/check-cache.md "Which step reuses what"): the plaintext secrets (R06 and the lite custody L17), the bypass markers (R303) and, in a side, the soft file size.
|
|
78
|
+
* Each rule's findings carry the path of the file they judge; `check-cache-structure-rules.spec.mts` proves that and the declared `deps` under a file-system recorder.
|
|
79
|
+
*/
|
|
80
|
+
export declare function perFileRules({ repoRoot, repo, resolver, inScope, isRoot }: {
|
|
81
|
+
repoRoot: string;
|
|
82
|
+
repo: CheckRepo;
|
|
83
|
+
resolver: CheckResolver;
|
|
84
|
+
inScope: (file: string) => boolean;
|
|
85
|
+
isRoot: boolean;
|
|
86
|
+
}): FileRule[];
|
|
72
87
|
/**
|
|
73
88
|
* The check of one app. `repoRoot` is the app root (a side folder is checked as that side alone). `harness` ({ version }) is the CLI
|
|
74
89
|
* that runs the check, whose version is the app's starci-harness pin (canon-pins.mjs). `declaration` overrides hfs.json
|
|
@@ -84,7 +84,8 @@ import { lintSuppressionFindings } from './rules/lint-suppression.mjs';
|
|
|
84
84
|
import { bypassMarkerFindings } from './rules/bypass-markers.mjs';
|
|
85
85
|
import { repoLocalCheckFindings } from './rules/repo-local-checks.mjs';
|
|
86
86
|
import { liteSecretFindings } from './rules/lite-secrets.mjs';
|
|
87
|
-
import { untrackedSecretFindings } from './rules/secrets.mjs';
|
|
87
|
+
import { readmeManifestOf, untrackedSecretFindings } from './rules/secrets.mjs';
|
|
88
|
+
import { memoFiles } from './rule-memo.mjs';
|
|
88
89
|
import { liteStarciworkFinding, pathFindings } from './path-findings.mjs';
|
|
89
90
|
import { onLintSurface } from './architecture/surface.mjs';
|
|
90
91
|
import { checkAppRoot, trackedTreeView } from './architecture/hfs.mjs';
|
|
@@ -207,15 +208,26 @@ function minimumInstanceFindings(resolver, required, instances) {
|
|
|
207
208
|
}
|
|
208
209
|
return findings;
|
|
209
210
|
}
|
|
210
|
-
|
|
211
|
+
/**
|
|
212
|
+
* The rules whose findings for a file depend on that file alone (and the files `deps` names), so the result cache keeps them per file by content hash
|
|
213
|
+
* (contexts/project/check-cache.md "Which step reuses what"): the plaintext secrets (R06 and the lite custody L17), the bypass markers (R303) and, in a side, the soft file size.
|
|
214
|
+
* Each rule's findings carry the path of the file they judge; `check-cache-structure-rules.spec.mts` proves that and the declared `deps` under a file-system recorder.
|
|
215
|
+
*/
|
|
216
|
+
export function perFileRules({ repoRoot, repo, resolver, inScope, isRoot }) {
|
|
217
|
+
return [
|
|
218
|
+
{ id: 'secret', run: (list) => liteSecretFindings({ repoRoot, files: list.filter((file) => inScope(file)), resolver, repo }), deps: (file) => readmeManifestOf(file) ?? [] },
|
|
219
|
+
{ id: 'bypass-marker', run: (list) => bypassMarkerFindings({ repoRoot, files: list.filter((file) => inScope(file)) }) },
|
|
220
|
+
...(isRoot ? [] : [{ id: 'size-soft', run: (list) => sizeSoftFindings({ repoRoot, resolver, files: list, inScope }) }]),
|
|
221
|
+
];
|
|
222
|
+
}
|
|
223
|
+
function contentRuleFindings({ repoRoot, repo, resolver, files, all, scoped, pins, fileFindings, inScope, isRoot, appSide, editionDeclaration, manifest, phase }) {
|
|
211
224
|
const findings = [
|
|
212
225
|
...pinFindings({ repoRoot, files, profile: repo.profile, pins, only: scoped }),
|
|
213
|
-
...
|
|
226
|
+
...fileFindings,
|
|
214
227
|
...editionFindings({ repoRoot, files: files.filter((file) => inScope(file)), repo, resolver, manifest, withDeclaration: editionDeclaration }),
|
|
215
228
|
...feStackFindings({ repoRoot, files: files.filter((file) => inScope(file)), repo, manifest }),
|
|
216
229
|
...repoLocalCheckFindings({ repoRoot, files }),
|
|
217
230
|
...lintSuppressionFindings({ repoRoot, files }),
|
|
218
|
-
...bypassMarkerFindings({ repoRoot, files: files.filter((file) => inScope(file)) }),
|
|
219
231
|
...a15Findings({ repoRoot, files, all, repo, resolver, manifest, isRoot, appSide, inScope }),
|
|
220
232
|
];
|
|
221
233
|
findings.push(...trackedStacksGateFindings({ repoRoot, files, all, repo, resolver, manifest, isRoot, inScope, existingFindings: findings }));
|
|
@@ -262,9 +274,8 @@ function scopeFindings({ repoRoot, root, harness, repo, resolver, files, all = f
|
|
|
262
274
|
if (repo.kind === RUNTIME_KIND)
|
|
263
275
|
return findings;
|
|
264
276
|
const pins = canonPins({ root, ...(harness ? { harness } : {}) });
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
findings.push(...sizeSoftFindings({ repoRoot, resolver, files, inScope }));
|
|
277
|
+
const fileFindings = memoFiles(repoRoot, files, perFileRules({ repoRoot, repo, resolver, inScope, isRoot }));
|
|
278
|
+
findings.push(...contentRuleFindings({ repoRoot, repo, resolver, files, all, scoped, pins, fileFindings, inScope, isRoot, appSide, editionDeclaration, manifest, phase }));
|
|
268
279
|
return findings;
|
|
269
280
|
}
|
|
270
281
|
export function checkRepo({ repoRoot, root = skillRoot, harness, declaration, files, only, extraFindings = [], tree = files === undefined, manifest = loadSlotManifest({ root }), surface = 'all', phase = 'workspace' }) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// gate-threshold.mjs - the verdict of `starci app check`
|
|
1
|
+
// gate-threshold.mjs - the verdict of `starci app check` (owner ruling gate-threshold-20, 2026-10-30): green
|
|
2
2
|
// while fewer than GATE_ERROR_LIMIT error findings remain and none of them is a hard blocker, so a release is not held back finding
|
|
3
3
|
// by finding (5, 4, 3, ...) by the last few structural nits. A plaintext secret, a failed boot proof, a forged check cache record and a broken migration block at
|
|
4
4
|
// any count. Every finding is still printed; only the exit code changes. Typecheck, build and the tests are not judged here.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { CheckFinding } from './check.mjs';
|
|
2
|
+
/** A rule whose findings for one file depend on that file alone (and the files `deps` names), so the cache reuses them per file. */
|
|
3
|
+
export interface FileRule {
|
|
4
|
+
/** Names the rule in its record and in the spec that proves its declaration. */
|
|
5
|
+
readonly id: string;
|
|
6
|
+
/** The findings over `files` (scope-relative tracked paths); every finding's `path` is one of `files`. */
|
|
7
|
+
run(files: string[]): CheckFinding[];
|
|
8
|
+
/** Other scope-relative files whose content the findings for `file` read. */
|
|
9
|
+
deps?(file: string): string[];
|
|
10
|
+
}
|
|
11
|
+
/** What the cache gives the rule runner. */
|
|
12
|
+
export interface RuleMemo {
|
|
13
|
+
/** The findings of `rules` over the tracked `files` of the scope at `scopeRoot` (absolute), reusing what the cache holds per file. */
|
|
14
|
+
files(scopeRoot: string, files: readonly string[], rules: readonly FileRule[]): CheckFinding[];
|
|
15
|
+
/** The findings of the cross-file rule `id` of the scope at `scopeRoot`, reused while every file it read and the tracked path list are unchanged. */
|
|
16
|
+
keyed(scopeRoot: string, id: string, run: () => CheckFinding[]): CheckFinding[];
|
|
17
|
+
/**
|
|
18
|
+
* The value `compute` yields for `file` (scope-relative) of the scope at `scopeRoot`, reused while the file's bytes and `extra` (every other input the value
|
|
19
|
+
* depends on, as text) are unchanged. `compute` reads only that file; the value is plain JSON; `empty` is the value a file with nothing to say yields.
|
|
20
|
+
*/
|
|
21
|
+
unit<T>(scopeRoot: string, id: string, file: string, extra: string, empty: T, compute: () => T): T;
|
|
22
|
+
}
|
|
23
|
+
/** Runs `run` with `memo` serving the per-file and cross-file rules of every checkRepo inside it. */
|
|
24
|
+
export declare function withRuleMemo<T>(memo: RuleMemo, run: () => T): T;
|
|
25
|
+
/** The findings of per-file `rules` over `files`, from the cache when one is installed. Rules run in order, each over the files it must judge. */
|
|
26
|
+
export declare function memoFiles(scopeRoot: string, files: readonly string[], rules: readonly FileRule[]): CheckFinding[];
|
|
27
|
+
/** The value of a per-file unit of a cross-file rule, from the cache when one is installed (see `RuleMemo.unit`). */
|
|
28
|
+
export declare function memoUnit<T>(scopeRoot: string, id: string, file: string, extra: string, empty: T, compute: () => T): T;
|
|
29
|
+
/** The findings of a cross-file rule, from the cache when one is installed. */
|
|
30
|
+
export declare function memoKeyed(scopeRoot: string, id: string, run: () => CheckFinding[]): CheckFinding[];
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
let active = null;
|
|
2
|
+
/** Runs `run` with `memo` serving the per-file and cross-file rules of every checkRepo inside it. */
|
|
3
|
+
export function withRuleMemo(memo, run) {
|
|
4
|
+
const before = active;
|
|
5
|
+
active = memo;
|
|
6
|
+
try {
|
|
7
|
+
return run();
|
|
8
|
+
}
|
|
9
|
+
finally {
|
|
10
|
+
active = before;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
/** The findings of per-file `rules` over `files`, from the cache when one is installed. Rules run in order, each over the files it must judge. */
|
|
14
|
+
export function memoFiles(scopeRoot, files, rules) {
|
|
15
|
+
return active ? active.files(scopeRoot, files, rules) : rules.flatMap((rule) => rule.run([...files]));
|
|
16
|
+
}
|
|
17
|
+
/** The value of a per-file unit of a cross-file rule, from the cache when one is installed (see `RuleMemo.unit`). */
|
|
18
|
+
export function memoUnit(scopeRoot, id, file, extra, empty, compute) {
|
|
19
|
+
return active ? active.unit(scopeRoot, id, file, extra, empty, compute) : compute();
|
|
20
|
+
}
|
|
21
|
+
/** The findings of a cross-file rule, from the cache when one is installed. */
|
|
22
|
+
export function memoKeyed(scopeRoot, id, run) {
|
|
23
|
+
return active ? active.keyed(scopeRoot, id, run) : run();
|
|
24
|
+
}
|
|
@@ -14,5 +14,11 @@ import type { Parsed } from './rule-types.mjs';
|
|
|
14
14
|
/** The failure codes the finders above emit, so `starci app check` ships their labels (check.mjs adds them to CHECK_CODES). Append-only; the coordinator regenerates it at merge time. */
|
|
15
15
|
export declare const A15_CODES: string[];
|
|
16
16
|
export declare const FINDERS: (typeof feBuildArgsFindings | typeof featureFileFindings | typeof assetsFindings | typeof unusedSymbolFindings | typeof databaseBaselineFindings | typeof databaseConfigFindings | typeof docFreshFindings | typeof releaseProvenanceFindings | typeof secretCustodyOnlyFindings | typeof scriptHygieneFindings | typeof supplyChainFindings | typeof liteProofLaneFindings)[];
|
|
17
|
+
/**
|
|
18
|
+
* The finders the result cache keeps by the files they read: each reads the tracked tree only through `readText` / `readJson` (rules/read.mts) and the tracked
|
|
19
|
+
* path lists it is given, so its findings are a function of those. `check-cache-structure-rules.spec.mts` proves every member under a file-system recorder
|
|
20
|
+
* and fails on a read it does not go through the gateway. A finder that stats, lists or walks the work tree (stacks-release, the stacks gate) is not a member.
|
|
21
|
+
*/
|
|
22
|
+
export declare const KEYED_FINDERS: ReadonlySet<(context: Parsed) => Parsed>;
|
|
17
23
|
/** Findings of every alpha.15 content rule over one repository. */
|
|
18
24
|
export declare function a15Findings(context: Parsed): any[];
|
|
@@ -38,6 +38,7 @@ import { ciCustodyFindings } from './ci-custody.mjs';
|
|
|
38
38
|
import { workflowContextsFindings } from './workflow-contexts.mjs';
|
|
39
39
|
import { ciStandardAppFindings } from './ci-standard.mjs';
|
|
40
40
|
import { feBuildArgsFindings } from './fe-build-args.mjs';
|
|
41
|
+
import { memoKeyed } from '../rule-memo.mjs';
|
|
41
42
|
// finders-import-end
|
|
42
43
|
/** The failure codes the finders above emit, so `starci app check` ships their labels (check.mjs adds them to CHECK_CODES). Append-only; the coordinator regenerates it at merge time. */
|
|
43
44
|
export const A15_CODES = [
|
|
@@ -90,15 +91,23 @@ export const FINDERS = [
|
|
|
90
91
|
ciCustodyFindings,
|
|
91
92
|
// finders-end
|
|
92
93
|
];
|
|
94
|
+
/**
|
|
95
|
+
* The finders the result cache keeps by the files they read: each reads the tracked tree only through `readText` / `readJson` (rules/read.mts) and the tracked
|
|
96
|
+
* path lists it is given, so its findings are a function of those. `check-cache-structure-rules.spec.mts` proves every member under a file-system recorder
|
|
97
|
+
* and fails on a read it does not go through the gateway. A finder that stats, lists or walks the work tree (stacks-release, the stacks gate) is not a member.
|
|
98
|
+
*/
|
|
99
|
+
export const KEYED_FINDERS = new Set([docFreshFindings, scriptHygieneFindings, databaseConfigFindings, feBuildArgsFindings]);
|
|
93
100
|
/** Findings of every alpha.15 content rule over one repository. */
|
|
94
101
|
export function a15Findings(context) {
|
|
95
102
|
// `starci app check` always passes the full context; a partial one (a finder spec driving the registry with only the fields its rule reads) must not crash the finders of other rules.
|
|
96
103
|
const full = Boolean(context.repoRoot && context.repo && context.resolver && context.manifest);
|
|
97
104
|
return FINDERS.flatMap((finder) => {
|
|
105
|
+
const run = () => finder(context);
|
|
106
|
+
const once = KEYED_FINDERS.has(finder) && full ? () => memoKeyed(context.repoRoot, finder.name, run) : run;
|
|
98
107
|
if (full)
|
|
99
|
-
return
|
|
108
|
+
return once();
|
|
100
109
|
try {
|
|
101
|
-
return
|
|
110
|
+
return once();
|
|
102
111
|
}
|
|
103
112
|
catch {
|
|
104
113
|
return [];
|
|
@@ -149,7 +149,7 @@ function fullHistory(doc, say) {
|
|
|
149
149
|
for (const [id, job] of jobsOf(doc)) {
|
|
150
150
|
const steps = stepsOf(job);
|
|
151
151
|
const base = steps.findIndex((step) => /STARCI_BASE_REF=.*>>\s*"?\$GITHUB_ENV"?/.test(runOf(step)));
|
|
152
|
-
const lint = steps.findIndex((step) => /\bnpm run lint\b|\
|
|
152
|
+
const lint = steps.findIndex((step) => /\bnpm run lint\b|\bapp check\b[^\n]*--gate[ =]lint\b/.test(runOf(step)));
|
|
153
153
|
if (lint >= 0 && (base < 0 || base > lint))
|
|
154
154
|
out.push(say('full-history-base-ref', `job ${id} must write STARCI_BASE_REF to GITHUB_ENV before its first lint step`));
|
|
155
155
|
}
|
|
@@ -174,7 +174,7 @@ function sonarLintPerSide(doc, say) {
|
|
|
174
174
|
for (const [id, job] of jobsOf(doc)) {
|
|
175
175
|
for (const step of stepsOf(job)) {
|
|
176
176
|
const run = runOf(step);
|
|
177
|
-
if (/\b(?:npm run lint|
|
|
177
|
+
if (/\b(?:npm run lint|app check)\b/.test(run) && /\s--out\b/.test(run) && !/\s--side\s+(?:be\b|fe\b|\$\{\{\s*matrix\.side\s*\}\})/.test(run)) {
|
|
178
178
|
out.push(say('sonar-lint-per-side', `job ${id}, step ${step.name ?? 'lint'}: a lint with a Sonar import must name its side (--side be|fe) and the reports are merged afterwards; a combined lint with Sonar breaks the standard`));
|
|
179
179
|
}
|
|
180
180
|
}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import type { Parsed, Repo } from './rule-types.mjs';
|
|
2
2
|
/** The npm workspaces of every app, in this order. */
|
|
3
3
|
export declare const WORKSPACES: readonly string[];
|
|
4
|
-
/** The
|
|
5
|
-
export declare const WORKSPACE_LINT = "starci app lint --workspace .";
|
|
6
|
-
/** The scripts of every fe app workspace, exactly: turbo runs build, dev, lint and typecheck; start serves a build. */
|
|
4
|
+
/** The scripts of every fe app workspace, exactly: turbo runs build, dev and typecheck; start serves a build. The lint is the root's (`starci app check --gate lint`), never a workspace script. */
|
|
7
5
|
export declare const FE_APP_SCRIPTS: Readonly<Record<string, string>>;
|
|
8
6
|
/** The package manager every app root declares (turbo reads it to parse the lockfile); the starci app scaffold writes it. */
|
|
9
7
|
export declare const PACKAGE_MANAGER = "npm@11.6.2";
|
|
@@ -22,12 +22,10 @@ const MONO_NEST_PROJECTS = 'HFS_MONO_NEST_PROJECTS';
|
|
|
22
22
|
const MONO_WORKSPACE_DEP = 'HFS_MONO_WORKSPACE_DEP';
|
|
23
23
|
/** The npm workspaces of every app, in this order. */
|
|
24
24
|
export const WORKSPACES = Object.freeze(['fe/apps/*', 'fe/packages/*']);
|
|
25
|
-
/** The
|
|
26
|
-
export const
|
|
27
|
-
/** The scripts
|
|
28
|
-
|
|
29
|
-
/** The scripts every fe package workspace has (its build and typecheck commands are its own; its lint is the workspace lint). */
|
|
30
|
-
const FE_PACKAGE_SCRIPTS = Object.freeze(['build', 'typecheck', 'lint']);
|
|
25
|
+
/** The scripts of every fe app workspace, exactly: turbo runs build, dev and typecheck; start serves a build. The lint is the root's (`starci app check --gate lint`), never a workspace script. */
|
|
26
|
+
export const FE_APP_SCRIPTS = Object.freeze({ build: 'next build', dev: 'next dev', start: 'next start', typecheck: 'tsc --noEmit' });
|
|
27
|
+
/** The scripts every fe package workspace has (its build and typecheck commands are its own); it has no lint script. */
|
|
28
|
+
const FE_PACKAGE_SCRIPTS = Object.freeze(['build', 'typecheck']);
|
|
31
29
|
/** The package manager every app root declares (turbo reads it to parse the lockfile); the starci app scaffold writes it. */
|
|
32
30
|
export const PACKAGE_MANAGER = 'npm@11.6.2';
|
|
33
31
|
/** The npm name of an fe app workspace. */
|
|
@@ -61,7 +59,7 @@ function rootFindings(repoRoot) {
|
|
|
61
59
|
if (!PACKAGE_MANAGER_FORM.test(String(pkg.packageManager ?? '')))
|
|
62
60
|
findings.push(found(MONO_WORKSPACES, MANIFEST, `${MANIFEST} declares packageManager ${JSON.stringify(pkg.packageManager ?? null)}; turbo needs \`npm@<exact version>\` there.`, { packageManager: pkg.packageManager ?? null }));
|
|
63
61
|
if (typeof pkg.devDependencies?.turbo !== 'string')
|
|
64
|
-
findings.push(found(MONO_WORKSPACES, MANIFEST, `${MANIFEST} does not declare turbo in its devDependencies; the turbo task graph (turbo.json) runs build, dev
|
|
62
|
+
findings.push(found(MONO_WORKSPACES, MANIFEST, `${MANIFEST} does not declare turbo in its devDependencies; the turbo task graph (turbo.json) runs build, dev and typecheck over the fe workspaces.`, { missing: 'turbo' }));
|
|
65
63
|
return findings;
|
|
66
64
|
}
|
|
67
65
|
/** R144: the manifest of each fe workspace. */
|
|
@@ -73,16 +71,16 @@ function appWorkspaceScriptFindings(file, project, name, pkg, scripts) {
|
|
|
73
71
|
const want = Object.keys(FE_APP_SCRIPTS).sort(byCodeUnit);
|
|
74
72
|
const off = [...new Set([...want, ...Object.keys(scripts)])].sort(byCodeUnit).filter((key) => scripts[key] !== FE_APP_SCRIPTS[key]);
|
|
75
73
|
if (off.length)
|
|
76
|
-
findings.push(found(MONO_FE_WORKSPACE, file, `${file} has scripts ${JSON.stringify(scripts)}; an fe app workspace has exactly ${JSON.stringify(FE_APP_SCRIPTS)} (turbo runs build, dev
|
|
74
|
+
findings.push(found(MONO_FE_WORKSPACE, file, `${file} has scripts ${JSON.stringify(scripts)}; an fe app workspace has exactly ${JSON.stringify(FE_APP_SCRIPTS)} (turbo runs build, dev and typecheck; the lint is the root's, \`starci app check --gate lint\`; differs at ${off.join(', ')}).`, { scripts: off }));
|
|
77
75
|
return findings;
|
|
78
76
|
}
|
|
79
77
|
function packageWorkspaceScriptFindings(file, scripts) {
|
|
80
78
|
const findings = [];
|
|
81
79
|
const missing = FE_PACKAGE_SCRIPTS.filter((key) => typeof scripts[key] !== 'string' || !scripts[key]);
|
|
82
80
|
if (missing.length)
|
|
83
|
-
findings.push(found(MONO_FE_WORKSPACE, file, `${file} has no ${missing.join(', ')} script; an fe package workspace builds
|
|
84
|
-
|
|
85
|
-
findings.push(found(MONO_FE_WORKSPACE, file, `${file}
|
|
81
|
+
findings.push(found(MONO_FE_WORKSPACE, file, `${file} has no ${missing.join(', ')} script; an fe package workspace builds and type-checks (turbo builds it before the apps that import it).`, { scripts: missing }));
|
|
82
|
+
if (scripts.lint !== undefined)
|
|
83
|
+
findings.push(found(MONO_FE_WORKSPACE, file, `${file} has a lint script; a workspace has none, the app is linted once from the root with \`starci app check --gate lint\`.`, { scripts: ['lint'] }));
|
|
86
84
|
return findings;
|
|
87
85
|
}
|
|
88
86
|
function workspaceManifestFindings(repoRoot, project, workspaces) {
|