@starci/hfs 4.7.15 → 4.7.17

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.
@@ -0,0 +1,68 @@
1
+ // sonar-quality-gate.mjs - the verdict of the release gate's sonar row after the scanner exits 0. The scanner's exit code says only
2
+ // that the report was uploaded; the server computes the analysis afterwards. This reads the task the scanner wrote
3
+ // (`.scannerwork/report-task.txt`), polls `api/ce/task` until the compute-engine task ends, then reads the quality gate of that
4
+ // analysis from `api/qualitygates/project_status` with the same token. OK passes; ERROR is red and names every failed condition;
5
+ // a task that ends FAILED or CANCELED, an unreadable answer and a deadline passed are typed refusals in the row's detail.
6
+ import fs from 'node:fs';
7
+ import path from 'node:path';
8
+
9
+ const SONAR_GATE_FAILED = 'RELEASE_SONAR_GATE_FAILED';
10
+ const SONAR_GATE_TIMEOUT = 'RELEASE_SONAR_GATE_TIMEOUT';
11
+ const SONAR_GATE_UNREADABLE = 'RELEASE_SONAR_GATE_UNREADABLE';
12
+ const REPORT_TASK = path.join('.scannerwork', 'report-task.txt');
13
+ const DONE = new Set(['SUCCESS', 'FAILED', 'CANCELED']);
14
+ /** The bound of one compute-engine wait and the pause between polls (milliseconds). */
15
+ const QUALITY_GATE_WAIT = Object.freeze({ deadline: 600_000, interval: 5_000 });
16
+
17
+ /** The `key=value` lines of the scanner's report-task.txt under `cwd`, or null when the scanner wrote none. */
18
+ function reportTask(cwd) {
19
+ let text;
20
+ try { text = fs.readFileSync(path.join(cwd, REPORT_TASK), 'utf8'); } catch { return null; }
21
+ return Object.fromEntries(text.split(/\r?\n/u).map((line) => line.split('=')).filter(([key, ...rest]) => key && rest.length).map(([key, ...rest]) => [key.trim(), rest.join('=').trim()]));
22
+ }
23
+
24
+ /** One authenticated JSON GET; a failed request or a non-JSON body throws. */
25
+ async function getJson(ctx, url, token) {
26
+ const response = await ctx.fetch(url, { headers: { Authorization: `Basic ${Buffer.from(`${token}:`).toString('base64')}` }, signal: AbortSignal.timeout(30_000) });
27
+ if (!response.ok) throw new Error(`HTTP ${response.status} from ${url.split('?')[0]}`);
28
+ return response.json();
29
+ }
30
+
31
+ /** The failed conditions of a quality gate answer, as `metric comparator threshold (actual value)` lines. */
32
+ const failedConditions = (status) => (status?.conditions ?? []).filter((condition) => condition.status === 'ERROR')
33
+ .map((condition) => `${condition.metricKey} ${condition.comparator ?? ''} ${condition.errorThreshold ?? ''} (actual ${condition.actualValue ?? '?'})`.replace(/\s+/gu, ' '));
34
+
35
+ /**
36
+ * The quality-gate verdict of the analysis the scanner just uploaded from `cwd`: `{ pass, detail, conditions? }`. `token` is the
37
+ * scanner's token, `host` the declared server. `ctx.fetch`, `ctx.now` and `ctx.sleep` are the seams; `wait` bounds the poll.
38
+ */
39
+ export async function sonarQualityGate(ctx, { cwd, host, token, wait = QUALITY_GATE_WAIT }) {
40
+ const task = reportTask(cwd);
41
+ if (!task?.ceTaskId) return { pass: false, detail: `${SONAR_GATE_UNREADABLE}: the scanner wrote no ${REPORT_TASK.replaceAll('\\', '/')} with a ceTaskId` };
42
+ const server = String(task.serverUrl || host).replace(/\/$/u, '');
43
+ const sleep = ctx.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
44
+ const deadline = ctx.now() + wait.deadline;
45
+ let analysisId = null;
46
+ try {
47
+ for (;;) {
48
+ const state = (await getJson(ctx, `${server}/api/ce/task?id=${encodeURIComponent(task.ceTaskId)}`, token))?.task;
49
+ if (DONE.has(state?.status)) {
50
+ if (state.status !== 'SUCCESS') return { pass: false, detail: `${SONAR_GATE_FAILED}: compute-engine task ${task.ceTaskId} ended ${state.status}${state.errorMessage ? `: ${state.errorMessage}` : ''}` };
51
+ analysisId = state.analysisId;
52
+ break;
53
+ }
54
+ if (ctx.now() >= deadline) return { pass: false, detail: `${SONAR_GATE_TIMEOUT}: compute-engine task ${task.ceTaskId} is still ${state?.status ?? 'unknown'} after ${Math.round(wait.deadline / 1000)}s` };
55
+ await sleep(wait.interval);
56
+ }
57
+ const query = analysisId ? `analysisId=${encodeURIComponent(analysisId)}` : `projectKey=${encodeURIComponent(task.projectKey ?? '')}`;
58
+ const status = (await getJson(ctx, `${server}/api/qualitygates/project_status?${query}`, token))?.projectStatus;
59
+ if (status?.status === 'OK') return { pass: true, detail: 'exit 0, quality gate OK' };
60
+ if (status?.status === 'ERROR') {
61
+ const conditions = failedConditions(status);
62
+ return { pass: false, detail: `${SONAR_GATE_FAILED}: quality gate ERROR (${conditions.join('; ') || 'no condition listed'})${task.dashboardUrl ? ` ${task.dashboardUrl}` : ''}`, conditions };
63
+ }
64
+ return { pass: false, detail: `${SONAR_GATE_UNREADABLE}: quality gate status ${status?.status ?? 'missing'}` };
65
+ } catch (error) {
66
+ return { pass: false, detail: `${SONAR_GATE_UNREADABLE}: ${String(error?.message ?? error)}` };
67
+ }
68
+ }
@@ -29,14 +29,14 @@ pins:
29
29
  source: packages/grammar/package.json
30
30
  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.'
31
31
  '@starci/eslint-canon-be':
32
- version: 3.4.23
32
+ version: 3.4.25
33
33
  group: starci
34
34
  install: registry
35
35
  side: be
36
36
  source: packages/eslint/be/package.json
37
37
  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.'
38
38
  '@starci/eslint-canon-fe':
39
- version: 8.4.22
39
+ version: 8.4.24
40
40
  group: starci
41
41
  install: registry
42
42
  side: fe
@@ -62,7 +62,7 @@ pins:
62
62
  side: both
63
63
  source: packages/prettier-config/package.json
64
64
  '@starci/jest-preset':
65
- version: 2.3.2
65
+ version: 2.3.3
66
66
  group: starci
67
67
  install: registry
68
68
  side: be
@@ -76,14 +76,14 @@ pins:
76
76
  source: packages/test-world/package.json
77
77
  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.'
78
78
  '@starci/cli':
79
- version: 1.7.15
79
+ version: 1.7.17
80
80
  group: starci
81
81
  install: registry
82
82
  side: both
83
83
  source: packages/cli/package.json
84
84
  why: 'the only StarCi command package; product repositories install it for starci app, while @starci/hfs remains its pinned transitive implementation.'
85
85
  '@starci/hfs':
86
- version: 4.7.15
86
+ version: 4.7.17
87
87
  group: starci
88
88
  install: registry
89
89
  side: both
@@ -3754,7 +3754,7 @@ rules:
3754
3754
  - {path: packages/eslint/be/sonar-parity-editions.spec.mjs, edition: full}
3755
3755
  - {path: packages/eslint/fe/sonar-parity-editions.spec.mjs, edition: lite}
3756
3756
  - {path: packages/eslint/fe/sonar-parity-editions.spec.mjs, edition: full}
3757
- law: "Code carries none of the smells SonarCloud measures that a lint rule can decide: no `await` inside a loop (S9382; an endless loop is spared), no `charCodeAt`/`fromCharCode` (S7758), no string that only escapes backslashes (S7780; a Next `matcher` is spared, it is read statically), no nested conditional expression (S3358), no `void` on anything but a call (S3735), no unused import (S1128), no import that is only handed on instead of `export ... from` (S7763), no prop of a component's props type the component never reads (S6767, front end), and, through typescript-eslint with type information, no deprecated API (S1874), no object turned into text (S6551) and no `async` function that never awaits and returns no promise (S7503). The files a unit or an end-to-end spec names are outside the scan, so outside these rules."
3757
+ law: "Code carries none of the smells SonarCloud measures that a lint rule can decide: no `await` inside a loop (S9382; an endless loop is spared), no `charCodeAt`/`fromCharCode` (S7758), no string that only escapes backslashes (S7780; a Next `matcher` is spared, it is read statically), no nested conditional expression (S3358), no `void` on anything but a call (S3735), no unused import (S1128), no import that is only handed on instead of `export ... from` (S7763), no prop of a component's props type the component never reads (S6767, front end), no `<video>` or `<audio>` without a captions track unless muted (S4084, front end), and, through typescript-eslint with type information, no deprecated API (S1874), no object turned into text (S6551) and no `async` function that never awaits and returns no promise (S7503). Every other rule of the Sonar way TypeScript profile with an ESLint equivalent (scripts/lib/sonar-way.mjs: eslint-plugin-sonarjs' Sonar way set, the core, typescript-eslint and unicorn rules it builds on) is on at error in both canons. The files a unit or an end-to-end spec names are outside the scan, so outside these rules."
3758
3758
  kinds: [lint, codemod]
3759
3759
  gates: [pre-commit, settle, land, ci]
3760
3760
  failureCodes: ["SCAN_SMELL"]
@@ -3774,6 +3774,7 @@ rules:
3774
3774
  - {kind: eslint-fe, id: no-unused-import}
3775
3775
  - {kind: eslint-fe, id: prefer-export-from}
3776
3776
  - {kind: eslint-fe, id: no-unused-prop-types}
3777
+ - {kind: eslint-fe, id: media-has-caption}
3777
3778
  - id: R236
3778
3779
  code: "RT_GATE_LOOSENING"
3779
3780
  editions: [lite, full]
@@ -38,7 +38,7 @@ versioning:
38
38
  # or environment reads (BE_APP_OPTIONS_COMPOSITION). Secrets use EnvSource.secret(): <NAME>_FILE first, plain <NAME> only
39
39
  # when the file key is absent; .starcistacks owns custody. Capability <capability>.config.ts roles stay unchanged.
40
40
  # 3.3.0 is a minor (alpha.16): it ADDS the optional app.ci-stack-deploy slot, the managed workflow of the starci app stack verbs.
41
- # 3.4.0 is a minor (alpha.24): it ADDS the opt-in be.contract.mcp-tools slot, the committed MCP tool-catalog snapshot of an app.
41
+ # 3.4.0 is a minor (alpha.25): it ADDS the opt-in be.contract.mcp-tools slot, the committed MCP tool-catalog snapshot of an app.
42
42
 
43
43
  # Field meaning, per slot.
44
44
  # id stable name, never changes meaning inside a major.
@@ -1,7 +1,7 @@
1
1
  // GENERATED by scripts/cli/gen-catalog.mjs — do not edit
2
2
  export const CATALOG = {
3
3
  "schema": "starci/cli-catalog@1",
4
- "hash": "c7ef5f72727b2b906b541669c413050b7abd34206c123a87fe90502330271856",
4
+ "hash": "ce01a03c949f8154644bec5d1068bf0b5316478f328b2231b2369c937f89e118",
5
5
  "global": [
6
6
  {
7
7
  "name": "json",
@@ -1234,6 +1234,9 @@ export const CATALOG = {
1234
1234
  "declared release.gates gets audit appended if missing",
1235
1235
  "--sonar appends @sonar/scan@4.3.0 against services.sonar.host (host.public for a host mapping), plus organization for sonarcloud;",
1236
1236
  "disabled or unavailable Sonar or an unset token refuses RELEASE_SONAR_UNAVAILABLE",
1237
+ "a scanner exit 0 is not a pass: the row polls api/ce/task until the analysis ends, then reads api/qualitygates/project_status with the same token",
1238
+ "OK passes; ERROR is red as RELEASE_SONAR_GATE_FAILED naming each failed condition, as is a FAILED or CANCELED task",
1239
+ "a task still running after 600 s is RELEASE_SONAR_GATE_TIMEOUT; no report-task, an HTTP error or no gate is RELEASE_SONAR_GATE_UNREADABLE",
1237
1240
  "OWNER RULING candidate-ci (2026-10-18): the gate no longer reads the default-branch CI; the verdict is the candidate run of the sha",
1238
1241
  "push --execute sends HEAD to refs/heads/release/candidate-<version> first and waits for its ci.yml run (it triggers on release/candidate-*)",
1239
1242
  "green moves the branch and the tag in one atomic push; red refuses RELEASE_CANDIDATE_CI_RED naming the failing jobs",
@@ -1246,7 +1249,7 @@ export const CATALOG = {
1246
1249
  "runtimeSide": "host"
1247
1250
  },
1248
1251
  "scaffold": {
1249
- "summary": "create a full or lite StarCi app, including an empty unborn main Git repository",
1252
+ "summary": "create a full or lite StarCi app in its own Git repository (unborn main)",
1250
1253
  "owner": "@starci/hfs",
1251
1254
  "positional": [
1252
1255
  {
@@ -0,0 +1 @@
1
+ ["**/*.spec.ts", "**/*.e2e-spec.ts", "**/dist/**", "**/coverage/**"]
@@ -392,8 +392,15 @@ function sourceNames(ts, text, file) {
392
392
  return names;
393
393
  }
394
394
 
395
+ /**
396
+ * Whether a be/src source references a destroyed object. A column (`<schema>.<table>.<column>`) is referenced only by a source that
397
+ * names both its table and the column, so a same-named column of another table is not a reference; the check stays conservative,
398
+ * since any mention of the table beside the column counts. Every other object kind is referenced by its leaf name.
399
+ */
400
+ const referencesObject = (names, object) => names.has(object.leaf) && (object.kind !== 'column' || !object.table || names.has(object.table));
401
+
395
402
  function destructiveObjectFinding(file, object, contract, references) {
396
- const reference = references.find(({ names }) => names.has(object.leaf));
403
+ const reference = references.find(({ names }) => referencesObject(names, object));
397
404
  if (contract && !reference) return null;
398
405
  const reason = reference && contract ? `${reference.file} still references this object; remove the reference before the contract migration`
399
406
  : 'use a *_contract_* migration after the application stops using this object';
package/scaffold/app.mjs CHANGED
@@ -10,7 +10,8 @@
10
10
  // is in sync by construction. The lockfile is never written by hand: once the files are written, npm resolves the real one
11
11
  // (`npm install --package-lock-only`, no node_modules, no scripts), so `npm ci` installs the new app as it is. When npm cannot
12
12
  // resolve it the scaffold fails (HFS_SCAFFOLD_LOCK_FAILED), names the step and unlinks its own generated entries. Replaced or
13
- // occupied entries are retained with a cleanup message. The only existing root accepted is an empty unborn main Git repository.
13
+ // occupied entries are retained with a cleanup message. The only existing root accepted is an empty unborn main Git repository; a
14
+ // new path is made one first (git init, branch main).
14
15
  import fs from 'node:fs';
15
16
  import path from 'node:path';
16
17
  import { spawnSync } from 'node:child_process';
@@ -27,6 +28,7 @@ import { initializeAppIdentity } from '../runtime/scripts/hfs/secret-init.mjs';
27
28
  import { declaredSealedMembers, materializeDeclaredPlaceholders } from '../runtime/scripts/hfs/sealed-members.mjs';
28
29
  import { revParseQuery } from '../runtime/scripts/api/git/rev-parse-query.mjs';
29
30
  import { lsFiles } from '../runtime/scripts/api/git/ls-files.mjs';
31
+ import { init as gitInit } from '../runtime/scripts/api/git/init.mjs';
30
32
  import { insidePath, samePath } from '../runtime/scripts/lib/path-key.mjs';
31
33
  import { byCodeUnit } from '../report/order.mjs';
32
34
  import { sonarGateName } from '../sync/sonar-key.mjs';
@@ -629,8 +631,9 @@ function emitScaffoldDatabaseTypes(root, name, writes, emitTypes) {
629
631
 
630
632
  /**
631
633
  * `starci app scaffold <name>`: writes the new app under `into`, resolves its lockfile with npm (`lock`, npmLock), and returns
632
- * `{ root, files }` (app-relative paths, sorted). `presets` is what sync loads from the installed @starci/jest-preset (the Sonar
633
- * exclusions); the CLI passes the one it resolves. Failure removes only scaffold-owned entries, retaining an existing .git.
634
+ * `{ root, files }` (app-relative paths, sorted). A new path is first made an empty repository with unborn main (`initGit`), so the
635
+ * app always lives in its own Git repository. `presets` are the jest preset's Sonar exclusions; the CLI passes the copy @starci/hfs
636
+ * ships (bundledPresets). Failure removes only scaffold-owned entries, retaining the .git.
634
637
  */
635
638
  /** Seal declared starter members to a fresh app recipient through the scaffold rollback owner. */
636
639
  function initializeScaffoldSecrets(root, writes) {
@@ -641,13 +644,25 @@ function initializeScaffoldSecrets(root, writes) {
641
644
  return [...initialized.files, ...materialized.members];
642
645
  }
643
646
 
644
- export function scaffoldApp({ name, into, presets, edition = 'full', authCallback = false, registryVisibility = 'public', manifest = loadSlotManifest(), pins = bundledPins(), lock = npmLock, emitTypes = generateDbTypes, now = () => new Date() }) {
647
+ /**
648
+ * A new app path becomes the one accepted existing root first: an empty repository with unborn main (git init), so the app is always
649
+ * created inside its own Git repository and `starci npm ci` can install the hooks. A failed init is a refusal before any file is written.
650
+ */
651
+ function bornRepository(root, initGit) {
652
+ fs.mkdirSync(root, { recursive: true });
653
+ const made = initGit(root, { branch: 'main' });
654
+ if (!made?.ok) throw new ScaffoldError('HFS_SCAFFOLD_GIT_INIT_FAILED', `git init could not create the repository of ${root} (${String(made?.stderr ?? '').trim() || 'no output'}); remove ${root}, check git, then run starci app scaffold again`);
655
+ return fs.lstatSync(root);
656
+ }
657
+
658
+ export function scaffoldApp({ name, into, presets, edition = 'full', authCallback = false, registryVisibility = 'public', manifest = loadSlotManifest(), pins = bundledPins(), lock = npmLock, emitTypes = generateDbTypes, initGit = gitInit, now = () => new Date() }) {
645
659
  if (!NAME.test(String(name))) throw new ScaffoldError('HFS_SCAFFOLD_NAME_INVALID', `the app name ${name} must be kebab-case (a project name: ${NAME})`);
646
660
  const root = path.resolve(into, name);
647
- const original = fs.lstatSync(root, { throwIfNoEntry: false });
648
- if (original && !emptyUnbornGit(root, original)) throw new ScaffoldError('HFS_SCAFFOLD_EXISTS', `${root} already exists; only a plain directory containing solely .git with unborn main and an empty index can be scaffolded`);
661
+ const existing = fs.lstatSync(root, { throwIfNoEntry: false });
662
+ if (existing && !emptyUnbornGit(root, existing)) throw new ScaffoldError('HFS_SCAFFOLD_EXISTS', `${root} already exists; only a plain directory containing solely .git with unborn main and an empty index can be scaffolded`);
649
663
  if (!['public', 'private'].includes(registryVisibility)) throw new ScaffoldError('HFS_SCAFFOLD_REGISTRY_VISIBILITY', `--registry-visibility accepts public or private (got ${registryVisibility})`);
650
664
  if (typeof authCallback !== 'boolean') throw new ScaffoldError('HFS_SCAFFOLD_NAME_INVALID', 'authCallback must be a boolean');
665
+ const original = existing ?? bornRepository(root, initGit);
651
666
  const declaration = starterDeclaration(name, manifest, edition);
652
667
  if (authCallback) enableAuthCallback(declaration);
653
668
  const app = resolveRepoDeclaration(manifest, declaration);
package/src/main.mjs CHANGED
@@ -69,7 +69,7 @@ import { formatCoverageReport } from '../runtime/scripts/hfs/coverage-from.mjs';
69
69
  import { HFS_DECLARATION_FILE, HfsSlotsError, loadSlotManifest, readRepoDeclaration } from '../runtime/scripts/hfs/slots.mjs';
70
70
  import { formatFindings } from '../sync/format.mjs';
71
71
  import { main as syncMain } from '../sync/cli.mjs';
72
- import { SyncError, loadPresets } from '../sync/index.mjs';
72
+ import { SyncError, bundledPresets } from '../sync/index.mjs';
73
73
  import { managedFindings } from '../sync/managed.mjs';
74
74
  import { emitContracts } from '../emit/contracts.mjs';
75
75
  import { dbTypesEmitter } from '../emit/db-types.mjs';
@@ -282,14 +282,10 @@ async function lintMain(argv, { cwd, stdout, presets, prettier }) {
282
282
  }
283
283
 
284
284
  /**
285
- * The jest preset a new app renders its Sonar exclusions from: the one installed beside this @starci/hfs. None is a refusal,
286
- * never a render without it.
285
+ * The jest preset a new app renders its Sonar exclusions from: the copy this @starci/hfs ships (bundledPresets), the same version the
286
+ * scaffold pins, so `npx @starci/cli app scaffold` works before any dependency of the app is installed.
287
287
  */
288
- async function scaffoldPresets() {
289
- try { return await loadPresets(path.dirname(fileURLToPath(import.meta.url))); } catch (error) {
290
- throw new SyncError('HFS_SYNC_PRESET_MISSING', `${error.message.replace(/^[A-Z_]+: /, '')}; install @starci/jest-preset beside @starci/cli, then run starci app scaffold <name>`);
291
- }
292
- }
288
+ const scaffoldPresets = () => bundledPresets();
293
289
 
294
290
  function globalValueArgument(arg, args) {
295
291
  const inline = arg.startsWith('--cwd=') || arg.startsWith('--edition=');
@@ -389,7 +385,7 @@ function addMain(opts, { cwd: repoRoot, stdout: out }) {
389
385
  async function scaffoldMain(opts, { cwd, edition = 'full', presets, lock, stdout: out }) {
390
386
  const [name, ...extra] = opts.positional;
391
387
  if (!name || extra.length) throw new Error('starci app scaffold takes `<name> [--into <dir>] [--edition full|lite] [--registry-visibility public|private]`');
392
- const { root: created, files } = scaffoldApp({ name, into: path.resolve(cwd, opts.into ?? '.'), edition, presets: presets ?? await scaffoldPresets(), ...(opts['registry-visibility'] === undefined ? {} : { registryVisibility: opts['registry-visibility'] }), ...(lock ? { lock } : {}) });
388
+ const { root: created, files } = scaffoldApp({ name, into: path.resolve(cwd, opts.into ?? '.'), edition, presets: presets ?? scaffoldPresets(), ...(opts['registry-visibility'] === undefined ? {} : { registryVisibility: opts['registry-visibility'] }), ...(lock ? { lock } : {}) });
393
389
  out(`starci app scaffold: created ${created} (${files.length} files); next: starci npm ci (the lockfile, then the git hooks through npm run prepare; after a raw npm ci --ignore-scripts run npm run prepare), then starci app lint\n`);
394
390
  return 0;
395
391
  }
package/sync/index.mjs CHANGED
@@ -158,6 +158,24 @@ export async function loadPresets(root) {
158
158
  return { sonarExclusions: require(resolved).sonarExclusions() };
159
159
  }
160
160
 
161
+ /**
162
+ * The jest preset's Sonar exclusions as @starci/hfs ships them: `@starci/jest-preset/sonar-exclusions.json`, copied byte for byte into
163
+ * packages/hfs/runtime by scripts/hfs/sync-runtime.mjs, so a fresh `starci app scaffold` (nothing installed yet) and an upgrade render the
164
+ * same list the app's installed preset answers. A missing copy is a refusal, never a render without it.
165
+ */
166
+ const BUNDLED_SONAR_EXCLUSIONS = new URL('../runtime/packages/jest-preset/sonar-exclusions.json', import.meta.url);
167
+
168
+ /** The presets ({ sonarExclusions }) of the jest preset version this @starci/hfs pins, read from its bundled copy. */
169
+ export function bundledPresets() {
170
+ let list;
171
+ try {
172
+ list = JSON.parse(fs.readFileSync(BUNDLED_SONAR_EXCLUSIONS, 'utf8'));
173
+ } catch {
174
+ throw new SyncError('HFS_SYNC_PRESET_MISSING', '@starci/hfs ships no runtime/packages/jest-preset/sonar-exclusions.json; reinstall @starci/hfs at its published version');
175
+ }
176
+ return { sonarExclusions: list.join(',') };
177
+ }
178
+
161
179
  /** Where the be unit run writes the lcov report (jest `coverageDirectory` coverage under be/, reporter lcov), from the app root. */
162
180
  const LCOV_REPORT = 'be/coverage/lcov.info';
163
181
 
@@ -11,6 +11,6 @@ export const createRetryLink = () =>
11
11
  delay: { initial: RETRY_POLICY.initialDelayMs, max: RETRY_POLICY.maxDelayMs, jitter: true },
12
12
  attempts: {
13
13
  max: RETRY_POLICY.maxAttempts,
14
- retryIf: (error) => error !== undefined && !CombinedGraphQLErrors.is(error),
14
+ retryIf: (error) => !CombinedGraphQLErrors.is(error),
15
15
  },
16
16
  })
package/upgrade/index.mjs CHANGED
@@ -18,6 +18,7 @@ import { byCodeUnit } from "../report/order.mjs";
18
18
  import {
19
19
  TEMPLATES_DIR,
20
20
  appSource,
21
+ bundledPresets,
21
22
  checkTargets,
22
23
  imageFiles,
23
24
  loadHfs,
@@ -48,7 +49,7 @@ const FULL_DEPENDENCIES = Object.freeze(["nest-commander"]);
48
49
  // ruling lacks (a current lite app already has it, and the e2e world's @starci/test-world is what full adds). These are the preset's two
49
50
  // public sync inputs; once apply resolves the new dependency, normal full sync reads them from @starci/jest-preset again.
50
51
  export const UPGRADE_PRESETS = Object.freeze({
51
- sonarExclusions: "**/*.spec.ts,**/*.e2e-spec.ts,**/dist/**,**/coverage/**",
52
+ sonarExclusions: bundledPresets().sonarExclusions,
52
53
  coverageSources: Object.freeze([
53
54
  "src/**/*.service.ts",
54
55
  "src/features/cli/**/*.cli.ts",