@starci/eslint-canon-be 3.0.10 → 3.2.0

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.
Files changed (149) hide show
  1. package/CHANGELOG.md +7 -1
  2. package/README.md +2 -1
  3. package/builders.mjs +1 -1
  4. package/comments.mjs +1 -1
  5. package/config-owner.mjs +1 -1
  6. package/index.mjs +2 -0
  7. package/lib/config.mjs +4 -1
  8. package/lib/doors.mjs +3 -1
  9. package/module-shape.mjs +1 -2
  10. package/package.json +1 -1
  11. package/resilience.mjs +1 -1
  12. package/runtime/config.example.yaml +194 -0
  13. package/runtime/engine/by-code-unit.mjs +12 -0
  14. package/runtime/engine/config.mjs +222 -239
  15. package/runtime/engine/invalid-config.mjs +5 -5
  16. package/runtime/engine/model-config.mjs +90 -0
  17. package/runtime/engine/orca-config.mjs +3 -1
  18. package/runtime/engine/release-config.mjs +28 -0
  19. package/runtime/engine/removed-vocabulary.mjs +28 -0
  20. package/runtime/engine/resources-config.mjs +52 -0
  21. package/runtime/engine/runtime-root.mjs +17 -0
  22. package/runtime/engine/secrets.mjs +35 -31
  23. package/runtime/engine/sonar-config.mjs +21 -0
  24. package/runtime/engine/temp-root.mjs +32 -0
  25. package/runtime/knowledge/hfs/canon-pins.yaml +14 -14
  26. package/runtime/knowledge/hfs/rules.yaml +161 -65
  27. package/runtime/knowledge/hfs/slots.yaml +11 -14
  28. package/runtime/modules/kernel/removed-vocabulary.yaml +268 -0
  29. package/runtime/modules/models/registry.yaml +25 -359
  30. package/runtime/modules/models/runtimes.yaml +126 -265
  31. package/runtime/modules/models/tiers.yaml +66 -0
  32. package/runtime/scripts/api/git/lib.mjs +34 -1
  33. package/runtime/scripts/hfs/allows.mjs +3 -3
  34. package/runtime/scripts/hfs/architecture/ast-walks.mjs +63 -50
  35. package/runtime/scripts/hfs/architecture/automatic-gates.mjs +96 -0
  36. package/runtime/scripts/hfs/architecture/backend.mjs +261 -175
  37. package/runtime/scripts/hfs/architecture/background-unowned.mjs +69 -34
  38. package/runtime/scripts/hfs/architecture/client-reaches-server.mjs +55 -54
  39. package/runtime/scripts/hfs/architecture/clones.mjs +179 -106
  40. package/runtime/scripts/hfs/architecture/config-unread.mjs +5 -22
  41. package/runtime/scripts/hfs/architecture/config.mjs +95 -80
  42. package/runtime/scripts/hfs/architecture/connection-map.mjs +233 -141
  43. package/runtime/scripts/hfs/architecture/constructor-deps.mjs +15 -9
  44. package/runtime/scripts/hfs/architecture/context-coupling.mjs +76 -52
  45. package/runtime/scripts/hfs/architecture/context-map.mjs +215 -141
  46. package/runtime/scripts/hfs/architecture/context-owner.mjs +39 -30
  47. package/runtime/scripts/hfs/architecture/context-platform-tables.mjs +31 -17
  48. package/runtime/scripts/hfs/architecture/context-transaction.mjs +38 -25
  49. package/runtime/scripts/hfs/architecture/contract-fixture-guard.mjs +86 -40
  50. package/runtime/scripts/hfs/architecture/contracts-readonly.mjs +342 -0
  51. package/runtime/scripts/hfs/architecture/contracts.mjs +263 -455
  52. package/runtime/scripts/hfs/architecture/cross-app-duplicate.mjs +43 -34
  53. package/runtime/scripts/hfs/architecture/dead-exports.mjs +201 -154
  54. package/runtime/scripts/hfs/architecture/default-deny.mjs +118 -93
  55. package/runtime/scripts/hfs/architecture/doc-language.mjs +2 -1
  56. package/runtime/scripts/hfs/architecture/entrypoint.mjs +45 -30
  57. package/runtime/scripts/hfs/architecture/error-codes.mjs +19 -12
  58. package/runtime/scripts/hfs/architecture/error-masked.mjs +39 -26
  59. package/runtime/scripts/hfs/architecture/fe-slot-allows.mjs +2 -1
  60. package/runtime/scripts/hfs/architecture/feature-shape.mjs +26 -20
  61. package/runtime/scripts/hfs/architecture/framework-pinned.mjs +1 -1
  62. package/runtime/scripts/hfs/architecture/frontend-grammar.mjs +190 -0
  63. package/runtime/scripts/hfs/architecture/frontend-routing.mjs +186 -0
  64. package/runtime/scripts/hfs/architecture/frontend-world-render.mjs +311 -0
  65. package/runtime/scripts/hfs/architecture/frontend-world.mjs +328 -0
  66. package/runtime/scripts/hfs/architecture/frontend.mjs +109 -829
  67. package/runtime/scripts/hfs/architecture/hfs-graph.mjs +14 -2
  68. package/runtime/scripts/hfs/architecture/hfs.mjs +120 -288
  69. package/runtime/scripts/hfs/architecture/hooks-are-hooks.mjs +46 -26
  70. package/runtime/scripts/hfs/architecture/i18n-keys.mjs +114 -76
  71. package/runtime/scripts/hfs/architecture/index.mjs +164 -104
  72. package/runtime/scripts/hfs/architecture/injection-token-exported.mjs +33 -28
  73. package/runtime/scripts/hfs/architecture/machine-ast.mjs +180 -144
  74. package/runtime/scripts/hfs/architecture/managed-scripts.mjs +8 -2
  75. package/runtime/scripts/hfs/architecture/module-per-transport.mjs +150 -101
  76. package/runtime/scripts/hfs/architecture/next-data-contract.mjs +51 -43
  77. package/runtime/scripts/hfs/architecture/next-data-key.mjs +338 -0
  78. package/runtime/scripts/hfs/architecture/next-data.mjs +179 -427
  79. package/runtime/scripts/hfs/architecture/owners.mjs +27 -13
  80. package/runtime/scripts/hfs/architecture/package-shape.mjs +51 -23
  81. package/runtime/scripts/hfs/architecture/presentation.mjs +165 -0
  82. package/runtime/scripts/hfs/architecture/reachability.mjs +127 -61
  83. package/runtime/scripts/hfs/architecture/register-once.mjs +112 -63
  84. package/runtime/scripts/hfs/architecture/registration.mjs +187 -110
  85. package/runtime/scripts/hfs/architecture/required-files.mjs +121 -70
  86. package/runtime/scripts/hfs/architecture/route-files-thin.mjs +83 -58
  87. package/runtime/scripts/hfs/architecture/schema-owner.mjs +182 -108
  88. package/runtime/scripts/hfs/architecture/source-names-shape.mjs +318 -0
  89. package/runtime/scripts/hfs/architecture/source-names.mjs +83 -248
  90. package/runtime/scripts/hfs/architecture/sql-owner.mjs +175 -118
  91. package/runtime/scripts/hfs/architecture/sql-returning.mjs +39 -28
  92. package/runtime/scripts/hfs/architecture/sql-tokens.mjs +302 -172
  93. package/runtime/scripts/hfs/architecture/supabase-ast.mjs +1 -1
  94. package/runtime/scripts/hfs/architecture/supabase-be.mjs +55 -45
  95. package/runtime/scripts/hfs/architecture/supabase-results.mjs +182 -0
  96. package/runtime/scripts/hfs/architecture/supabase-tables.mjs +20 -12
  97. package/runtime/scripts/hfs/architecture/supabase.mjs +191 -263
  98. package/runtime/scripts/hfs/architecture/symbols.mjs +175 -99
  99. package/runtime/scripts/hfs/architecture/test-world-files.mjs +82 -41
  100. package/runtime/scripts/hfs/architecture/tiers.mjs +120 -69
  101. package/runtime/scripts/hfs/architecture/transport-owner.mjs +84 -57
  102. package/runtime/scripts/hfs/architecture/type-context.mjs +282 -0
  103. package/runtime/scripts/hfs/architecture/typescript.mjs +116 -276
  104. package/runtime/scripts/hfs/architecture/unit-spec-providers.mjs +84 -62
  105. package/runtime/scripts/hfs/declaration-shape.mjs +77 -36
  106. package/runtime/scripts/hfs/declaration-slots.mjs +1 -1
  107. package/runtime/scripts/hfs/edition-slots.mjs +5 -3
  108. package/runtime/scripts/hfs/linear-text.mjs +30 -0
  109. package/runtime/scripts/hfs/manifest-shape.mjs +164 -63
  110. package/runtime/scripts/hfs/path-findings.mjs +58 -38
  111. package/runtime/scripts/hfs/project-graph.mjs +4 -1
  112. package/runtime/scripts/hfs/repo-identity.mjs +21 -4
  113. package/runtime/scripts/hfs/rule-catalog.mjs +194 -0
  114. package/runtime/scripts/hfs/rule-params-shape.mjs +33 -27
  115. package/runtime/scripts/hfs/rules/fe-no-tests.mjs +36 -16
  116. package/runtime/scripts/hfs/rules/secrets.mjs +4 -3
  117. package/runtime/scripts/hfs/slot-app-view.mjs +102 -0
  118. package/runtime/scripts/hfs/slot-classify.mjs +65 -0
  119. package/runtime/scripts/hfs/slot-errors.mjs +11 -0
  120. package/runtime/scripts/hfs/slot-imports.mjs +76 -0
  121. package/runtime/scripts/hfs/slot-manifest-shape.mjs +73 -0
  122. package/runtime/scripts/hfs/slot-match.mjs +153 -0
  123. package/runtime/scripts/hfs/slot-path.mjs +8 -0
  124. package/runtime/scripts/hfs/slot-required.mjs +76 -0
  125. package/runtime/scripts/hfs/slot-semantic-problems.mjs +148 -0
  126. package/runtime/scripts/hfs/slot-side-problems.mjs +28 -0
  127. package/runtime/scripts/hfs/slots.mjs +74 -695
  128. package/runtime/scripts/hfs/trailing-slashes.mjs +8 -0
  129. package/runtime/scripts/hfs/typescript-programs.mjs +6 -4
  130. package/runtime/scripts/hfs/view.mjs +1 -1
  131. package/runtime/scripts/lib/dockerfile.mjs +56 -33
  132. package/runtime/scripts/lib/git.mjs +2 -2
  133. package/runtime/scripts/lib/i18n.mjs +3 -2
  134. package/runtime/scripts/lib/language.mjs +3 -3
  135. package/runtime/scripts/lib/list.mjs +8 -1
  136. package/runtime/scripts/lib/path-key.mjs +38 -5
  137. package/runtime/scripts/lib/regex.mjs +1 -1
  138. package/runtime/scripts/lib/secret-patterns.mjs +6 -2
  139. package/runtime/scripts/lib/sonar-syntax-rules.mjs +225 -0
  140. package/runtime/scripts/lib/sops-envelope.mjs +95 -48
  141. package/runtime/scripts/lib/stack-services.mjs +1 -2
  142. package/runtime/scripts/lib/ts-ast.mjs +9 -0
  143. package/runtime/scripts/lib/walk.mjs +6 -1
  144. package/runtime/scripts/lib/yaml-cached.mjs +14 -0
  145. package/schema-authority.mjs +1 -1
  146. package/service-deps.mjs +1 -1
  147. package/sonar-parity.mjs +19 -0
  148. package/suppression.mjs +2 -6
  149. package/test-world.mjs +2 -10
package/CHANGELOG.md CHANGED
@@ -1,6 +1,12 @@
1
1
  # Changelog
2
2
 
3
- ## Unreleased
3
+ ## 3.2.0 - 2026-10-09
4
+
5
+ - Changed: the bundled runtime copies (engine config, architecture machine, slot manifest, canon pins, failure codes) follow the runtime of 1.0.0-alpha.9; no rule is added or removed. Version 3.1.0 on the registry carries the copies of an earlier runtime.
6
+
7
+ ## 3.1.0 - 2026-10-08
8
+
9
+ - New: the `sonar-parity` law (R235 `SCAN_SMELL`): `no-await-in-loop` (S9382), `prefer-code-point` (S7758), `prefer-string-raw` (S7780), `no-nested-conditional` (S3358), `no-void-operator` (S3735), `no-unused-import` (S1128) and `prefer-export-from` (S7763), each the syntax-tree form of the Sonar rule SonarCloud flagged in the example apps, shared with the front-end canon through the bundled `runtime/scripts/lib/sonar-syntax-rules.mjs`. The factory also turns on the typescript-eslint rules `no-deprecated` (S1874), `no-base-to-string` (S6551) and `require-await` (S7503).
4
10
 
5
11
  - New: `feature-thin` (R203 `BE_FEATURE_THIN`, law `feature-thin`): a feature-tier file of a role of `ruleParams.be.thinRoles` (handler, resolver, controller, consumer, processor, step, saga, saga-step, compensation, webhook, gateway, subscription, cli, mapper, the saga orchestrator service) maps its parameters and makes ONE delegating call into modules/, with no branch, loop, ternary, try, throw or computation. The slot manifest copy gains `coverage` on every tracked be slot and `ruleParams.be.logicRoles` and `thinRoles`.
6
12
  - Changed: `unit-test-colocated` also allows `<name>.<role>.spec.ts` beside a logic role (policy, client, guard, mapper, ...) inside a slot whose coverage is required; the spec stays required only for the roles of `ruleParams.be.unitRoles`, and the texts say so.
package/README.md CHANGED
@@ -41,10 +41,11 @@ A sample, not the list:
41
41
  | **Schema authority** | Migrations only: every DataSource or TypeORM options object states the literal `synchronize: false` (found by the contextual type), no `migrationsRun`, no DDL string outside a migration, no entity glob; no `@Entity` type reachable from a transport signature, a handler `execute`, a contract or a message, and no GraphQL or validator import in an entity file (`no-runtime-schema`, `no-entity-in-contract`) |
42
42
  | **Config and secrets** | `process.env` (any form), `@nestjs/config`, `dotenv` only in the file of `platform/config` that declares `EnvSource` (and the test world, slot `be.tests.world`, for `process.env`); a function exported by a `<capability>.config.ts` is called only from `apps/<app>/src/main.ts` and `<app>.options.ts`, its own config file or spec, the test world and a provider contract spec (`config-parsed-in-main`); no default of any kind for a value typed `Secret` or `Url`; secrets compare with `timingSafeEqual` (`no-direct-env-read`, `config-parsed-in-main`, `no-secret-default`, `secret-compare-timing-safe`) |
43
43
  | **Ambient ids** (R142) | `randomUUID` of Node's crypto (named, namespace or global), the `v1`, `v4`, `v6` and `v7` generators of `uuid`, `nanoid` and `ulid` are used only inside `platform/ids`, specs included: code asks the injected `Ids` port and a spec provides `fakeIds()`; the generators are found by the module they are imported from, never by a local name (`no-ambient-id`) |
44
+ | **Sonar parity** (R235) | The smells SonarCloud measures that a lint rule can decide: no `await` inside a loop (`no-await-in-loop`, S9382; `for (;;)` and `while (true)` are spared), no `charCodeAt`/`fromCharCode` (`prefer-code-point`), no string that only escapes backslashes (`prefer-string-raw`), no nested conditional (`no-nested-conditional`), `void` only on a call (`no-void-operator`), no unused import (`no-unused-import`), `export ... from` for an import that is only handed on (`prefer-export-from`); the factory also turns on typescript-eslint `no-deprecated`, `no-base-to-string` and `require-await`. The files `*.spec.ts` and `*.e2e-spec.ts` are outside the scan, so outside these rules |
44
45
  | **Cookies** (R141) | A cookie a door writes through the response of Express or Fastify (`cookie`, `setCookie`) states `httpOnly: true`, `secure: true` and `sameSite` `lax` or `strict` in options typed with those literals, and `Set-Cookie` is never written as a header; the call is recognised by where its signature is declared (`response-cookie-attributes`). A secret-derived value is compared with `timingSafeEqual`: a `Secret` of `platform/config` and the `.digest()` of a `Hash` or `Hmac` of Node's crypto are recognised by type (`secret-compare-timing-safe`) |
45
46
  | **Default deny** | Typed bodies and arguments, no `GraphQLJSON` tunnel, no `switch (operation)`, `@Public` carries a `PublicReason` member of `domain/identity`, and no `@UseGuards` (the global `APP_GUARD` chain decides) (`no-untyped-body`, `public-needs-reason`, `no-auth-use-guards`) |
46
47
  | **Module shape** | No `@Global()`; `isGlobal: true` only in an app's `app.module.ts`; no import of another owner's module; typed `ConfigurableModuleBuilder`; `static register` is the only factory; a capability's representative module extends the `ConfigurableModuleClass` of its own module definition and every sub-module or feature module is plain (`capability-module-shape`); one module per file; no `new` of a provider; no module-level `let` (`no-global-decorator`, `is-global-only-in-app`, `no-cross-owner-module-import`, `static-module-register`) |
47
- | **Suppression** | No `eslint-disable`, `eslint-env`, `/* global */`, `@ts-ignore`, `@ts-expect-error`, `@ts-nocheck`, `istanbul`, `c8` or `v8 ignore`, `NOSONAR`, `sonar-disable`, `prettier-ignore` or `vn-ok` comment, anywhere (`no-inline-suppression`) |
48
+ | **Suppression** | No `eslint-disable`, `eslint-env`, `/* global */`, `@ts-ignore`, `@ts-expect-error`, `@ts-nocheck`, `istanbul`, `c8` or `v8 ignore`, `NOSONAR`, `sonar-disable`, or `prettier-ignore` comment, anywhere (`no-inline-suppression`) |
48
49
  | **Size** | A source file, a spec included, over the manifest's line budget is not new and does not grow past its size at the parent commit; the rule takes no option (`file-size-growth`) |
49
50
  | **Query safety** | `.query(...)` takes only a `SqlText` built with the `sql` tag in a persistence `<name>.sql.ts`, and no query builder exists (`sql-text-only`, `no-query-builder`); the tag's only substitution is a `SqlIdent` and a `.query` string is never built by template or `+` (`no-interpolated-sql`); `find`, `findBy` and `findAndCount` on an `EntityManager` state `take` and no `EntityManager` read runs per loop element (`query-needs-limit`, `no-query-in-loop`) |
50
51
  | **Resilience** | An outbound HTTP call states a timeout or signal; `JSON.parse` of outside text sits in a `try`; a loop that catches and waits goes through `platform/retry` - the wait is `setTimeout`, `node:timers/promises` or a function outside `platform/retry` whose body waits, whatever it is called (`http-needs-timeout`, `json-parse-needs-guard`, `no-hand-rolled-retry`) |
package/builders.mjs CHANGED
@@ -72,7 +72,7 @@ const isEntityClass = (checker, declaration) => {
72
72
  const callee = ts.isCallExpression(decorator.expression) ? decorator.expression.expression : decorator.expression
73
73
  const symbol = checker.getSymbolAtLocation(callee)
74
74
  if (!symbol) return false
75
- const target = symbol.flags & ts.SymbolFlags.Alias ? checker.getAliasedSymbol(symbol) : symbol
75
+ const target = (symbol.flags & ts.SymbolFlags.Alias) !== 0 ? checker.getAliasedSymbol(symbol) : symbol
76
76
  return (target.getDeclarations?.() ?? []).some((found) => moduleOf(found, String(found.getSourceFile().fileName).replace(/\\/g, "/")) === "typeorm")
77
77
  })
78
78
  }
package/comments.mjs CHANGED
@@ -12,7 +12,7 @@
12
12
  * (`e2e`, `fixtures` of the slot manifest) document their spec-read shapes at the type.
13
13
  * - `require-enum-member-jsdoc` checks an adjacent non-empty description, never whether it states a
14
14
  * consequence. That half is read by a person, and the rule says so rather than pretending.
15
- * - `no-non-ascii-source` takes no exemption marker: HFS removed `vn-ok`, so text a program depends on
15
+ * - `no-non-ascii-source` takes no exemption marker, so text a program depends on
16
16
  * lives in a message catalog (slot be.domain.messages, of any module tier, or be.feature.messages), the only place Vietnamese may appear. Specs
17
17
  * and fixtures get no exemption.
18
18
  * - `no-restated-name-jsdoc` (law 7) holds the decidable slice of law 3 - a doc block whose only
package/config-owner.mjs CHANGED
@@ -213,7 +213,7 @@ export const configParsedInMain = {
213
213
  /** The brand classes of `platform/config` a default must never be given to. */
214
214
  const BRANDS = new Set(["Secret", "Url"])
215
215
  const SECRET_READERS = new Set(["secret", "url", "host"])
216
- const DEFAULT_LITERAL = /^(?:|localhost|127\.0\.0\.1|0\.0\.0\.0|https?:\/\/.*)$/i
216
+ const DEFAULT_LITERAL = /^(?:localhost|127\.0\.0\.1|0\.0\.0\.0|https?:\/\/.*)?$/i
217
217
 
218
218
  /** No secret or URL value has a default of any kind: a missing value stops the boot. */
219
219
  export const noSecretDefault = {
package/index.mjs CHANGED
@@ -65,6 +65,7 @@ import { recommended as webhooksRecommended, rules as webhooksRules } from "./we
65
65
  import { recommended as realtimeRecommended, rules as realtimeRules } from "./realtime.mjs"
66
66
  import { recommended as featureThinRecommended, rules as featureThinRules } from "./feature-thin.mjs"
67
67
  import { recommended as projectGraphRecommended, rules as projectGraphRules } from "./project-graph.mjs"
68
+ import { recommended as sonarParityRecommended, rules as sonarParityRules } from "./sonar-parity.mjs"
68
69
 
69
70
  /** Each law's contribution, kept separate so a duplicate name is detectable rather than silent. */
70
71
  const CONTRIBUTIONS = [
@@ -115,6 +116,7 @@ const CONTRIBUTIONS = [
115
116
  { law: "webhooks", rules: webhooksRules, recommended: webhooksRecommended },
116
117
  { law: "realtime", rules: realtimeRules, recommended: realtimeRecommended },
117
118
  { law: "feature-thin", rules: featureThinRules, recommended: featureThinRecommended },
119
+ { law: "sonar-parity", rules: sonarParityRules, recommended: sonarParityRecommended },
118
120
  ]
119
121
 
120
122
  /** Every gathered law. */
package/lib/config.mjs CHANGED
@@ -32,7 +32,7 @@ export const IGNORED = Object.freeze(["dist/**", "coverage/**", "**/node_modules
32
32
  */
33
33
  const ROOT_SCRIPTS = Object.freeze(["*.js", "*.mjs", "*.cjs"])
34
34
 
35
- /** The typescript-eslint rules the canon borrows (BE-CONVENTION 1.17, R72/R73), all `error`. */
35
+ /** The typescript-eslint rules the canon borrows (BE-CONVENTION 1.17, R72/R73; Sonar S1874, S6551 and S7503 through R235), all `error`. */
36
36
  export const BORROWED = Object.freeze({
37
37
  "@typescript-eslint/consistent-type-assertions": ["error", { assertionStyle: "never" }],
38
38
  "@typescript-eslint/no-explicit-any": "error",
@@ -41,6 +41,9 @@ export const BORROWED = Object.freeze({
41
41
  "@typescript-eslint/no-misused-promises": "error",
42
42
  "@typescript-eslint/switch-exhaustiveness-check": "error",
43
43
  "@typescript-eslint/array-type": ["error", { default: "generic", readonly: "generic" }],
44
+ "@typescript-eslint/no-deprecated": "error",
45
+ "@typescript-eslint/no-base-to-string": "error",
46
+ "@typescript-eslint/require-await": "error",
44
47
  "no-console": "error",
45
48
  })
46
49
 
package/lib/doors.mjs CHANGED
@@ -55,7 +55,9 @@ export const aliasTarget = (context, identifier) => {
55
55
  const { checker, toTs } = typed(context)
56
56
  const tsNode = toTs(identifier)
57
57
  const symbol = tsNode && checker.getSymbolAtLocation(tsNode)
58
- return symbol && (symbol.flags & ts.SymbolFlags.Alias) !== 0 ? checker.getAliasedSymbol(symbol) : symbol
58
+ if (!symbol) return symbol
59
+ const isAlias = (symbol.flags & ts.SymbolFlags.Alias) !== 0
60
+ return isAlias ? checker.getAliasedSymbol(symbol) : symbol
59
61
  }
60
62
 
61
63
  /** The methods of a class (instance, non-constructor) that carry one of the decorators `names` of `source`. */
package/module-shape.mjs CHANGED
@@ -4,8 +4,7 @@
4
4
  * Globality is a composition decision, not a property of a module: a capability is registered once per app, in the app's
5
5
  * `app.module.ts`, as `X.register({ isGlobal: true, ...options })`, and never listed in another module's `imports`.
6
6
  *
7
- * - `no-global-decorator` refuses `@Global()` anywhere, specs included. (It replaces `global-module-allowlist`: the
8
- * manifest no longer carries a list of modules that may be global.)
7
+ * - `no-global-decorator` refuses `@Global()` anywhere, specs included.
9
8
  * - `is-global-only-in-app` refuses `isGlobal: true` (and a dynamic module literal `global: true`) outside
10
9
  * `apps/<app>/src/app.module.ts`.
11
10
  * - `no-cross-owner-module-import` refuses a `@Module({ imports })` entry whose module class is declared by another
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@starci/eslint-canon-be",
3
- "version": "3.0.10",
3
+ "version": "3.2.0",
4
4
  "description": "The StarCi back-end lint canon: every rule its laws publish, gathered as one flat-config plugin.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/resilience.mjs CHANGED
@@ -185,7 +185,7 @@ const waitsThrough = (context, checker, call, depth, seen) => {
185
185
  const hfs = hfsOf(context)
186
186
  const target = ts.isPropertyAccessExpression(call.expression) ? call.expression.name : call.expression
187
187
  let symbol = checker.getSymbolAtLocation(target)
188
- if (symbol && symbol.flags & ts.SymbolFlags.Alias) symbol = checker.getAliasedSymbol(symbol)
188
+ if (symbol && (symbol.flags & ts.SymbolFlags.Alias) !== 0) symbol = checker.getAliasedSymbol(symbol)
189
189
  for (const declaration of symbol?.declarations ?? []) {
190
190
  if (seen.has(declaration)) continue
191
191
  seen.add(declaration)
@@ -0,0 +1,194 @@
1
+ # config.example.yaml — seed for the per-project owner config.
2
+ # The installer copies this file to the gitignored `config.yaml` next to it;
3
+ # owners edit that copy. Everything below is read at runtime — no key here is
4
+ # decorative. Kernel route precedence: explicit `--agent` flag >
5
+ # `kernel` below > the tier chain (modules/models/tiers.yaml).
6
+ language: vi
7
+ model: null
8
+ effort: medium
9
+ # Explicit current owner adoption is required; shipped defaults grant no trust or purge authority.
10
+ # launchTrust: {profile: automatic, approvedBy: owner, approvalRef: '<current approval>', roots: ['<exact absolute repository root>']}
11
+ # profile: declined preserves an explicit decision; provider-side declines also remain authoritative.
12
+ launchTrust: null
13
+ # retention: {workflowPurge: {approvedBy: owner, approvalRef: '<current approval>', repos: ['<exact absolute ledger-owner repo>']}}
14
+ retention: null
15
+ # kernel — the long-lived [Kernel] seat. It takes the `high` tier of modules/models/tiers.yaml (an ordered chain of
16
+ # members; the picker takes the first member with tokens after your bias and the balance step; docs/config-format.md).
17
+ # {agent?, model?, effort?}: agent and/or model PIN the seat — the bias `only`, keeping the tier's model of that agent
18
+ # (an explicit `--agent` flag is the same bias and wins). effort: the seat's effort; null takes the tier member's effort.
19
+ kernel: {effort: high}
20
+ # parallel — the one knob for how wide the workers run. `gear` indexes the agent
21
+ # table in modules/models/runtimes.yaml allocation.slicing.size: a long (`l`)
22
+ # operation asks for the `l.agents[gear]` agents, an extra-long (`xl`) one for
23
+ # `xl.agents[gear]`; `s` and `m` operations are always one agent. Declared gears
24
+ # are allocation.slicing.gears — an undeclared value fails closed. Absent means
25
+ # the first declared gear. A gear raises only what `starci kernel estimate` requests; it
26
+ # never raises a pool's maxParallel, maxParallelOps or budgets.maxOps below.
27
+ parallel: {gear: 1}
28
+ # supervisor — the optional chat digest cadence. pollIntervalMs controls
29
+ # scripts/supervisor/poll.mjs when run continuously (its floor is the config
30
+ # validation of engine/config.mjs); null uses scripts/machine/home.mjs
31
+ # DEFAULTS, and --interval-ms overrides this key.
32
+ # The reconciler engine owns host runtime cadence and restores seats after reboot.
33
+ # repos: managed product ledger-owner repositories for the reconciler and Supervisor tools,
34
+ # relative to the source root (the directory holding this skill) or absolute.
35
+ # --repo on the poll command line can add another. stallMinutes (optional,
36
+ # integer >= 5) marks a running workflow STALLED in scripts/supervisor/stall.mjs;
37
+ # the Workflow controller turns actionable findings into Decision Items. The [Supervisor]
38
+ # kernel (docs/supervisor.md) also takes, optional, defaults in home.mjs DEFAULTS:
39
+ # kernel: {agent, model, effort} its agent pin (default: the kernel pin below)
40
+ # workers: {base, max} the adaptive [Worker] cap, 0 to 10 (0 = the Supervisor runs no fix worker)
41
+ # landGate: {mode: shared} shared lets running lanes commit directly; exclusive = gate only. A land
42
+ # fast-forwards LOCAL main only: the remote main moves with a release (starci release cut)
43
+ supervisor:
44
+ # mode: chat (default) - the owner's desktop chat session is the Supervisor: it owns channel 'main'
45
+ # and reads Decision Items; nothing starts a [Supervisor] kernel. kernel - the optional [Supervisor]
46
+ # Orca kernel (scripts/supervisor/start-supervisor.mjs), kept alive by the reconciler Host controller.
47
+ # See docs/supervisor.md.
48
+ # mode: chat
49
+ pollIntervalMs: null
50
+ repos: []
51
+ # frozenMinutes: <n> # Host seat check: a busy frame unchanged this long is frozen, not busy
52
+ # landGate: {mode: shared|exclusive}
53
+ # delegation — while the owner is away, a named delegate (e.g. the supervisor chat) may
54
+ # answer owner asks until the given time; excluded classes stay owner-only. null = none.
55
+ # delegation: {asks: supervisor, until: 2026-09-23T09:00:00+07:00,
56
+ # excludes: [credentials, oauth-consent, payments, legal, payment-provider]}
57
+ delegation: null
58
+ # budgets — the owner's ceiling, surfaced by every plan before `ok`. Null = unbounded.
59
+ budgets:
60
+ maxOps: null # max concurrent dispatched ops one workflow may hold open;
61
+ # route/dispatch refuse `max-ops` at min(this, maxParallelOps)
62
+ # allocation — the owner's default grant for a pool whose capacity is an explicit grant (Devin).
63
+ # grants: '<pool>=<slots>@<role>+<role>' — the default grant every workflow gets. Once a grants list is
64
+ # declared it is the whole set: a pool whose registry.yaml capacityAuthority is explicit-workflow-quota
65
+ # (Devin) routes only for the roles and up to the running slots a grant names ([] closes it).
66
+ allocation:
67
+ grants: [devin-agent=10@implement+verify+write]
68
+ # models — optional overrides of the shipped model tiers (modules/models/tiers.yaml owns the defaults). Every key is optional:
69
+ # tiers: {<tier>: [{agent, model, effort?}, ...]} replaces or adds one tier's ordered member chain
70
+ # seats: {<seat>: <tier>} remaps a seat (supervisor, kernel, worker, planner, validator, kernelManager)
71
+ # balance: {maxStreak, maxSharePercent} a head member picked maxStreak times in a row, or holding more than
72
+ # maxSharePercent of the tier's running seats, yields to the next member
73
+ # usage: {reservePercent, biasPercent} a member at reservePercent of its tokens is skipped; an owner bias
74
+ # naming it keeps it usable up to biasPercent; never above it
75
+ models: {}
76
+ # connectors — the owner's public ask channel (docs/connectors.md). Everything is off by default.
77
+ # One local gateway (scripts/connectors/ask-gateway.mjs) fronts every serve-ask form; a Cloudflare
78
+ # tunnel (scripts/connectors/tunnel.mjs) publishes the gateway; when serve-ask binds a form, the
79
+ # kernel's ask path sends the owner one Telegram message (scripts/connectors/telegram.mjs) with the
80
+ # question, its options and the public link. Telegram carries owner asks only.
81
+ # SECRETS NEVER GO IN THIS FILE: tokenEnv/botTokenEnv NAME an environment variable holding the token
82
+ # (or <NAME>_FILE pointing at a custody file); a value that is not an UPPER_SNAKE env var name is refused.
83
+ # Host credentials use the canonical runtime root secret.env; docs/host-secrets.md owns setup.
84
+ # Supplied environment values win, including blank values. Missing local file adds no values.
85
+ # repos: ledger-owner repository roots whose asks go public, relative to the source root (the
86
+ # directory holding this skill) or absolute. [] = the source root plus every .workspaces project owner.
87
+ # gateway.port: the one fixed local port the tunnel points at (outside the 6969..7069 form band).
88
+ # cloudflare.mode: off | quick | named.
89
+ # quick — `cloudflared tunnel --url`, a random https://*.trycloudflare.com host, no account, no auth,
90
+ # a new host on every restart. Good for decisions only.
91
+ # named — a fixed `hostname`, authenticated one of two ways: `tunnel` (UUID) + `credentialsFile`
92
+ # (the JSON `cloudflared tunnel create` wrote; the manager writes its own ingress config mapping
93
+ # hostname -> the gateway and never reads ~/.cloudflared/config.yml), or a remotely managed tunnel
94
+ # token in `tokenEnv` (its public hostname is routed to http://127.0.0.1:<gateway.port> in the
95
+ # Cloudflare dashboard).
96
+ # cloudflare.access: whether a Cloudflare Access application guards `hostname` (informational; false
97
+ # prints a warning). Recommended for anything beyond yes/no decisions.
98
+ # telegram.enabled / chatId: the owner's chat with the bot (BotFather token in botTokenEnv). Send the
99
+ # bot /start, then `starci connect telegram discover-chat` prints the chat id.
100
+ # telegram.exposeCredentialAsks: false keeps a credential/secret ask off the public link — the message
101
+ # says to answer it on this machine and carries only the localhost link, and the gateway refuses it.
102
+ connectors:
103
+ repos: []
104
+ gateway: {port: 7070}
105
+ cloudflare: {mode: off, tunnel: null, credentialsFile: null, tokenEnv: CLOUDFLARE_TUNNEL_TOKEN, hostname: null, access: false}
106
+ telegram:
107
+ enabled: false
108
+ botTokenEnv: TELEGRAM_BOT_TOKEN
109
+ chatId: null
110
+ exposeCredentialAsks: false
111
+ # asks — owner asks that carry a recommended option (question.recommended, or exactly one option
112
+ # marked "(recommended)" or its Vietnamese equivalents). autoAcceptRecommended: true answers such an
113
+ # ask with its recommendation instead of serving the form: the ledger records ask-answered with
114
+ # answeredBy auto-recommended, the kernel is woken, and Telegram gets one plain message naming the
115
+ # pick. A later owner answer supersedes it. excludes lists the ask classes that always reach the owner:
116
+ # credential — any ask with secret fields, or of kind credential, account, access or consent;
117
+ # handover — every handover.review ask (always excluded, even when removed from this list);
118
+ # draw-review — the opt-out for drawings (interface.draw, scripts/work/draw-review.mjs): unlisted, a
119
+ # drawing the owner did not ask to review is accepted without the owner (its accept option is the
120
+ # recommendation); a drawing the owner asked for (a prior owner redraw of the record, the owner
121
+ # opened its form, or question.ownerRequested) always reaches the owner;
122
+ # or any ask kind: information, authority, business-decision, irreversible-confirmation, ...
123
+ asks:
124
+ autoAcceptRecommended: false
125
+ excludes: [credential, irreversible-confirmation, handover]
126
+ # uat — the machine-wide UAT ceiling. At most maxConcurrent UAT runs (a browser session, a player, the
127
+ # app it drives) execute at once on this host, across every workflow; the rest wait queued for a slot
128
+ # (scripts/uat/uat-slots.mjs, lock files under <runtime>/uat-slots). A slot whose holder died is
129
+ # reclaimed. STARCI_UAT_MAX_CONCURRENT overrides it for one process tree.
130
+ uat:
131
+ maxConcurrent: 10
132
+ # orca — the owner's Orca app settings the runtime must know (engine/orca-config.mjs orcaSettings). maxWorkerDepth MUST equal
133
+ # the worker depth set in the Orca app: the deepest worker Orca starts under the owner's chat (chat 0, Kernel or
134
+ # Supervisor 1, op or [Worker] 2, draw critic 3). Orca exposes no read of it, so the runtime trusts this value and refuses
135
+ # a deeper launch before worker-start (worker-depth-exceeded). `start --check` with STARCI_ORCA_LIVE=1 measures Orca's
136
+ # real limit and turns red when the two differ.
137
+ orca:
138
+ maxWorkerDepth: 4
139
+ # debugLoop — the debug watcher. Workflow DEBUG is a /loop of the chat that started the workflow (the /starci skill sets it up in
140
+ # Claude Code and Codex; no seat, no background agent, nothing in the runtime schedules it). Each tick runs the read-only
141
+ # `starci debug digest`. interval is the loop cadence (<n>s | <n>m | <n>h, default `10m` = `debugLoop.interval`); worktreeLimit is the
142
+ # per-repository core-watch alert threshold (default `40` = `debugLoop.worktreeLimit`). Both keys are optional (engine/config.mjs DEBUG_LOOP_DEFAULTS).
143
+ debugLoop:
144
+ interval: 10m
145
+ worktreeLimit: 40
146
+ # reconciler — the host's one reconciler engine (scripts/reconciler/engine.mjs; contract
147
+ # modules/reconciler/reconciler.yaml). Each controller runs off | shadow (reads, records what it would do as
148
+ # reconciler.would rows, runs nothing) | active (acts; the old loop yields that duty via scripts/reconciler/owns.mjs).
149
+ # profile — the operational default of every controller, so a host is never left all-shadow by accident:
150
+ # operational job, host, workflow, resource active (they settle jobs, start services and seats, wake stalled
151
+ # workflows, throttle); gc, workers, learning shadow. The `start` skill applies and checks it.
152
+ # observe every controller shadow (read-only; a debugging or audit host).
153
+ # (absent) only the explicit controllers.<name>.mode entries count; an unnamed controller is off.
154
+ # controllers.<name>.mode overrides the profile for that one controller (e.g. gc: {mode: active}).
155
+ # Rollback of a controller: set its mode to off (the old loops take the duty back within
156
+ # allocation.reconciler.heartbeatStaleMs). Numbers: modules/models/runtimes.yaml allocation.reconciler.
157
+ reconciler:
158
+ enabled: true
159
+ profile: operational
160
+ controllers: {}
161
+ # specs.unit / specs.e2e in workflows (the `specs` map near the top; owner 2026-09-28 "speed up development;
162
+ # test later when asked"; scripts/route/spec-deferral.mjs). Each op brief's policy.specsToggle says what it does:
163
+ # unit: false - backend.implement, interface.implement and code.refactor run no jest/vitest/test:ci/coverage
164
+ # and demand no changed-line coverage (Sonar still runs: bugs, smells, security gate);
165
+ # test.author legs are never dispatched; review/handover gates do not count unit tests or coverage.
166
+ # e2e: false - e2e.verify legs and e2e test authoring are never dispatched; uat.verify is not e2e.
167
+ # A leg that is not dispatched settles `deferred: specs.<class>=false` with no attempt spent and the workflow
168
+ # proceeds past it; starci kernel status lists testsDeferred and `starci kernel run-deferred-tests --workflow <id> [--kind unit|e2e]`
169
+ # runs them later. Read on every wake: flipping a switch needs no restart.
170
+ # roots — where this host keeps the archive, the lane worktrees and its temporary files, when the owner moves them off the defaults.
171
+ # All keys are optional absolute directories; env STARCI_ARCHIVE_ROOT / STARCI_LANES_ROOT / STARCI_TEMP_ROOT win over them, and an
172
+ # absent key means <starciLocalRoot>/archive (<runtime root>/.runtime/archive), the per-user profile lanes directory, kept out of the checkout (scripts/machine/home.mjs lanesRoot),
173
+ # and the OS temp directory (engine/temp-root.mjs tempRoot; the processes the runtime starts get it as TEMP/TMP/TMPDIR). No host location lives in
174
+ # a tracked file: set the real directories only in the gitignored config.yaml copy, e.g.
175
+ # roots: {archive: <absolute directory>, lanes: <absolute directory>, temp: <absolute directory>}
176
+ # sonar — the SonarCloud organization the release's Sonar proof of the example apps analyses in (scripts/supervisor/release-sonarcloud.mjs). It is configuration, not a secret,
177
+ # so it lives here and not in secret.env; the project keys are <organization>_starci-example-<app>. The environment variable SONAR_ORGANIZATION wins over it (CI reads the
178
+ # repository variable of the same name). Empty until the owner sets it in the gitignored config.yaml copy, e.g.
179
+ # sonar: {organization: <the organization key shown on sonarcloud.io>}
180
+ sonar: {organization: null}
181
+ # resources — the host capacity floors the dispatch gate enforces, over the shipped numbers of modules/models/runtimes.yaml allocation.resources
182
+ # (scripts/machine/host-resources.mjs; docs/config-format.md "Host resource floors"). Every key is optional (a number above 0, or null):
183
+ # minFreeDiskGb free GB a drive holding the temp root or the repository must keep
184
+ # minFreeDiskPct the same floor as a percentage of the drive's size; with minFreeDiskGb the larger requirement applies
185
+ # minFreeRamPct free-RAM percentage below which no new heavy op starts
186
+ # set them only in the gitignored config.yaml copy, e.g.
187
+ # resources: {minFreeDiskGb: 5, minFreeDiskPct: 1, minFreeRamPct: 10}
188
+ # release — where the full test suite of a release is judged (scripts/guards/release-suite-mode.mjs; docs/releasing.md "Where the suite runs"). One key:
189
+ # suite: local the shipped default: `starci release cut` runs the root suite and the Linux parity container before it pushes, and the pre-push gate asks for their green rows
190
+ # suite: ci the owner's recorded choice (2026-10-09): no local full suite and no Linux container; the GitHub ci workflow runs the suite (with coverage, Codecov, SonarCloud) AFTER the push.
191
+ # The cut still runs npm run check, npm run test:packages, the specs affected by the release, the live Orca smokes and the example apps; the record lists the root suite as
192
+ # delegated, never green. A release can reach GitHub and its tag before the suite has run; a red CI is fixed forward with the next pre-release (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}
194
+ release: {suite: local}
@@ -0,0 +1,12 @@
1
+ // by-code-unit.mjs - the comparator of a bare `Array.prototype.sort()`, owned beside the engine files that digest and canonicalize (scripts/lib/list.mjs re-exports it).
2
+
3
+ /**
4
+ * The comparator of a bare `Array.prototype.sort()`: values compared as strings by UTF-16 code unit. Pass it to `sort` and
5
+ * `toSorted` so the order is stated, and stays byte-identical to the default order that digests and canonical output depend on.
6
+ */
7
+ export const byCodeUnit = (a, b) => {
8
+ const left = String(a);
9
+ const right = String(b);
10
+ if (left < right) return -1;
11
+ return left > right ? 1 : 0;
12
+ };