@nifrajs/cli 4.0.2 → 5.1.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.
- package/README.md +10 -2
- package/dist/agent-files.d.ts +107 -0
- package/dist/agent-files.d.ts.map +1 -0
- package/dist/agent-files.js +162 -0
- package/dist/agent-files.js.map +1 -0
- package/dist/app-files.d.ts +6 -0
- package/dist/app-files.d.ts.map +1 -1
- package/dist/app-files.js +27 -2
- package/dist/app-files.js.map +1 -1
- package/dist/assure-hydration.d.ts.map +1 -1
- package/dist/assure-hydration.js +9 -2
- package/dist/assure-hydration.js.map +1 -1
- package/dist/assure.d.ts +12 -2
- package/dist/assure.d.ts.map +1 -1
- package/dist/assure.js +59 -8
- package/dist/assure.js.map +1 -1
- package/dist/capabilities-tool.d.ts.map +1 -1
- package/dist/capabilities-tool.js +36 -9
- package/dist/capabilities-tool.js.map +1 -1
- package/dist/check-diagnostics.d.ts +22 -2
- package/dist/check-diagnostics.d.ts.map +1 -1
- package/dist/check-diagnostics.js +54 -7
- package/dist/check-diagnostics.js.map +1 -1
- package/dist/check-scan.d.ts +83 -24
- package/dist/check-scan.d.ts.map +1 -1
- package/dist/check-scan.js +1516 -318
- package/dist/check-scan.js.map +1 -1
- package/dist/check.d.ts +2 -2
- package/dist/check.d.ts.map +1 -1
- package/dist/check.js +203 -70
- package/dist/check.js.map +1 -1
- package/dist/cli.d.ts +9 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +215 -50
- package/dist/cli.js.map +1 -1
- package/dist/client-module.d.ts +20 -0
- package/dist/client-module.d.ts.map +1 -0
- package/dist/client-module.js +73 -0
- package/dist/client-module.js.map +1 -0
- package/dist/command-catalog.d.ts +24 -5
- package/dist/command-catalog.d.ts.map +1 -1
- package/dist/command-catalog.js +194 -45
- package/dist/command-catalog.js.map +1 -1
- package/dist/component-check.d.ts +13 -0
- package/dist/component-check.d.ts.map +1 -0
- package/dist/component-check.js +59 -0
- package/dist/component-check.js.map +1 -0
- package/dist/contract-proof.d.ts +1 -1
- package/dist/contract-proof.d.ts.map +1 -1
- package/dist/contract-proof.js +2 -24
- package/dist/contract-proof.js.map +1 -1
- package/dist/contracts.d.ts +19 -0
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js +50 -3
- package/dist/contracts.js.map +1 -1
- package/dist/db-tool.d.ts.map +1 -1
- package/dist/db-tool.js +4 -3
- package/dist/db-tool.js.map +1 -1
- package/dist/dev-bun-config.d.ts +5 -1
- package/dist/dev-bun-config.d.ts.map +1 -1
- package/dist/dev-bun-config.js +44 -11
- package/dist/dev-bun-config.js.map +1 -1
- package/dist/dev-feed-tool.d.ts +18 -1
- package/dist/dev-feed-tool.d.ts.map +1 -1
- package/dist/dev-feed-tool.js +93 -0
- package/dist/dev-feed-tool.js.map +1 -1
- package/dist/diagnostics.d.ts +3 -0
- package/dist/diagnostics.d.ts.map +1 -1
- package/dist/diagnostics.js.map +1 -1
- package/dist/diff-tool.d.ts +9 -8
- package/dist/diff-tool.d.ts.map +1 -1
- package/dist/diff-tool.js +28 -24
- package/dist/diff-tool.js.map +1 -1
- package/dist/doctor.d.ts +13 -0
- package/dist/doctor.d.ts.map +1 -1
- package/dist/doctor.js +23 -15
- package/dist/doctor.js.map +1 -1
- package/dist/env-file.d.ts +6 -0
- package/dist/env-file.d.ts.map +1 -1
- package/dist/env-file.js +6 -0
- package/dist/env-file.js.map +1 -1
- package/dist/fix-recipes.d.ts +2 -0
- package/dist/fix-recipes.d.ts.map +1 -1
- package/dist/fix-recipes.js +102 -2
- package/dist/fix-recipes.js.map +1 -1
- package/dist/hand-built-manifest.d.ts +27 -0
- package/dist/hand-built-manifest.d.ts.map +1 -0
- package/dist/hand-built-manifest.js +124 -0
- package/dist/hand-built-manifest.js.map +1 -0
- package/dist/hooks-report.d.ts +23 -0
- package/dist/hooks-report.d.ts.map +1 -0
- package/dist/hooks-report.js +104 -0
- package/dist/hooks-report.js.map +1 -0
- package/dist/init-agents.d.ts +18 -2
- package/dist/init-agents.d.ts.map +1 -1
- package/dist/init-agents.js +20 -13
- package/dist/init-agents.js.map +1 -1
- package/dist/internal/config-paths.d.ts +16 -0
- package/dist/internal/config-paths.d.ts.map +1 -0
- package/dist/internal/config-paths.js +124 -0
- package/dist/internal/config-paths.js.map +1 -0
- package/dist/internal/installed-package.d.ts +4 -0
- package/dist/internal/installed-package.d.ts.map +1 -0
- package/dist/internal/installed-package.js +17 -0
- package/dist/internal/installed-package.js.map +1 -0
- package/dist/internal/nifra-project.d.ts +41 -0
- package/dist/internal/nifra-project.d.ts.map +1 -0
- package/dist/internal/nifra-project.js +183 -0
- package/dist/internal/nifra-project.js.map +1 -0
- package/dist/internal/project-specifiers.d.ts +29 -0
- package/dist/internal/project-specifiers.d.ts.map +1 -0
- package/dist/internal/project-specifiers.js +435 -0
- package/dist/internal/project-specifiers.js.map +1 -0
- package/dist/internal/script-kind.d.ts.map +1 -1
- package/dist/internal/script-kind.js +2 -1
- package/dist/internal/script-kind.js.map +1 -1
- package/dist/internal/source-facts.d.ts +8 -1
- package/dist/internal/source-facts.d.ts.map +1 -1
- package/dist/internal/source-facts.js +22 -5
- package/dist/internal/source-facts.js.map +1 -1
- package/dist/internal/typescript-import.d.ts +1 -1
- package/dist/internal/typescript-import.d.ts.map +1 -1
- package/dist/internal/typescript-import.js +10 -6
- package/dist/internal/typescript-import.js.map +1 -1
- package/dist/introspect.d.ts +15 -6
- package/dist/introspect.d.ts.map +1 -1
- package/dist/introspect.js +87 -25
- package/dist/introspect.js.map +1 -1
- package/dist/levels-tool.d.ts.map +1 -1
- package/dist/levels-tool.js +98 -23
- package/dist/levels-tool.js.map +1 -1
- package/dist/load.d.ts +33 -10
- package/dist/load.d.ts.map +1 -1
- package/dist/load.js +60 -10
- package/dist/load.js.map +1 -1
- package/dist/mcp-context.d.ts +5 -5
- package/dist/mcp-context.d.ts.map +1 -1
- package/dist/mcp-context.js +8 -23
- package/dist/mcp-context.js.map +1 -1
- package/dist/mcp-delegate.d.ts +2 -2
- package/dist/mcp-delegate.d.ts.map +1 -1
- package/dist/mcp-delegate.js +19 -7
- package/dist/mcp-delegate.js.map +1 -1
- package/dist/mcp-exec.d.ts +13 -4
- package/dist/mcp-exec.d.ts.map +1 -1
- package/dist/mcp-exec.js +56 -14
- package/dist/mcp-exec.js.map +1 -1
- package/dist/mcp-http.js +1 -1
- package/dist/mcp-io.d.ts +30 -0
- package/dist/mcp-io.d.ts.map +1 -1
- package/dist/mcp-io.js +63 -0
- package/dist/mcp-io.js.map +1 -1
- package/dist/mcp-isolate.d.ts.map +1 -1
- package/dist/mcp-isolate.js +3 -2
- package/dist/mcp-isolate.js.map +1 -1
- package/dist/mcp-path.d.ts +2 -1
- package/dist/mcp-path.d.ts.map +1 -1
- package/dist/mcp-path.js +9 -24
- package/dist/mcp-path.js.map +1 -1
- package/dist/mcp-project-child.js +1 -1
- package/dist/mcp-project-child.js.map +1 -1
- package/dist/mcp-root.d.ts.map +1 -1
- package/dist/mcp-root.js +50 -10
- package/dist/mcp-root.js.map +1 -1
- package/dist/mcp-ws.d.ts.map +1 -1
- package/dist/mcp-ws.js +3 -1
- package/dist/mcp-ws.js.map +1 -1
- package/dist/mcp.d.ts.map +1 -1
- package/dist/mcp.js +48 -19
- package/dist/mcp.js.map +1 -1
- package/dist/migrate-layout.d.ts +47 -1
- package/dist/migrate-layout.d.ts.map +1 -1
- package/dist/migrate-layout.js +1972 -170
- package/dist/migrate-layout.js.map +1 -1
- package/dist/output-schemas.d.ts +128 -0
- package/dist/output-schemas.d.ts.map +1 -0
- package/dist/output-schemas.js +975 -0
- package/dist/output-schemas.js.map +1 -0
- package/dist/port.d.ts.map +1 -1
- package/dist/port.js +3 -2
- package/dist/port.js.map +1 -1
- package/dist/project-facts.d.ts +15 -4
- package/dist/project-facts.d.ts.map +1 -1
- package/dist/project-facts.js +1 -0
- package/dist/project-facts.js.map +1 -1
- package/dist/project-path.d.ts +6 -0
- package/dist/project-path.d.ts.map +1 -1
- package/dist/project-path.js +48 -14
- package/dist/project-path.js.map +1 -1
- package/dist/recipes/5.0.0.d.ts +11 -0
- package/dist/recipes/5.0.0.d.ts.map +1 -0
- package/dist/recipes/5.0.0.js +34 -0
- package/dist/recipes/5.0.0.js.map +1 -0
- package/dist/recipes/index.d.ts +7 -0
- package/dist/recipes/index.d.ts.map +1 -1
- package/dist/recipes/index.js +2 -0
- package/dist/recipes/index.js.map +1 -1
- package/dist/release-verification.d.ts +5 -0
- package/dist/release-verification.d.ts.map +1 -1
- package/dist/release-verification.js +14 -0
- package/dist/release-verification.js.map +1 -1
- package/dist/replay.d.ts.map +1 -1
- package/dist/replay.js +12 -3
- package/dist/replay.js.map +1 -1
- package/dist/review.d.ts +3 -1
- package/dist/review.d.ts.map +1 -1
- package/dist/review.js +43 -7
- package/dist/review.js.map +1 -1
- package/dist/rules/codes.d.ts +12 -0
- package/dist/rules/codes.d.ts.map +1 -1
- package/dist/rules/codes.js +12 -0
- package/dist/rules/codes.js.map +1 -1
- package/dist/rules/comment-markers.d.ts +16 -7
- package/dist/rules/comment-markers.d.ts.map +1 -1
- package/dist/rules/comment-markers.js +58 -19
- package/dist/rules/comment-markers.js.map +1 -1
- package/dist/rules/contract-visibility.d.ts +3 -0
- package/dist/rules/contract-visibility.d.ts.map +1 -0
- package/dist/rules/contract-visibility.js +337 -0
- package/dist/rules/contract-visibility.js.map +1 -0
- package/dist/rules/data-guard.d.ts +13 -0
- package/dist/rules/data-guard.d.ts.map +1 -1
- package/dist/rules/data-guard.js +356 -37
- package/dist/rules/data-guard.js.map +1 -1
- package/dist/rules/layout.d.ts +4 -0
- package/dist/rules/layout.d.ts.map +1 -0
- package/dist/rules/layout.js +19 -0
- package/dist/rules/layout.js.map +1 -0
- package/dist/rules/legacy.d.ts.map +1 -1
- package/dist/rules/legacy.js +178 -44
- package/dist/rules/legacy.js.map +1 -1
- package/dist/rules/pages.d.ts +50 -0
- package/dist/rules/pages.d.ts.map +1 -1
- package/dist/rules/pages.js +436 -4
- package/dist/rules/pages.js.map +1 -1
- package/dist/rules/routes.d.ts +6 -0
- package/dist/rules/routes.d.ts.map +1 -1
- package/dist/rules/routes.js +111 -16
- package/dist/rules/routes.js.map +1 -1
- package/dist/rules/secrets.js +2 -2
- package/dist/rules/secrets.js.map +1 -1
- package/dist/rules/security.d.ts +13 -1
- package/dist/rules/security.d.ts.map +1 -1
- package/dist/rules/security.js +313 -69
- package/dist/rules/security.js.map +1 -1
- package/dist/rules/zones.d.ts +13 -0
- package/dist/rules/zones.d.ts.map +1 -1
- package/dist/rules/zones.js +218 -44
- package/dist/rules/zones.js.map +1 -1
- package/dist/scaffold.d.ts.map +1 -1
- package/dist/scaffold.js +6 -4
- package/dist/scaffold.js.map +1 -1
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js +14 -5
- package/dist/sdk.js.map +1 -1
- package/dist/stylex-migrate.d.ts.map +1 -1
- package/dist/stylex-migrate.js +290 -24
- package/dist/stylex-migrate.js.map +1 -1
- package/dist/test-tool.d.ts.map +1 -1
- package/dist/test-tool.js +6 -3
- package/dist/test-tool.js.map +1 -1
- package/dist/typecheck-coverage.d.ts +20 -0
- package/dist/typecheck-coverage.d.ts.map +1 -0
- package/dist/typecheck-coverage.js +129 -0
- package/dist/typecheck-coverage.js.map +1 -0
- package/dist/upgrade.d.ts +84 -0
- package/dist/upgrade.d.ts.map +1 -1
- package/dist/upgrade.js +498 -78
- package/dist/upgrade.js.map +1 -1
- package/dist/verification-plan.d.ts.map +1 -1
- package/dist/verification-plan.js +16 -2
- package/dist/verification-plan.js.map +1 -1
- package/dist/version-drift.d.ts +22 -0
- package/dist/version-drift.d.ts.map +1 -0
- package/dist/version-drift.js +94 -0
- package/dist/version-drift.js.map +1 -0
- package/dist/web-app-options.d.ts +1 -1
- package/dist/web-app-options.d.ts.map +1 -1
- package/dist/web-app-options.js +1 -1
- package/dist/web-app-options.js.map +1 -1
- package/dist/work-graph.d.ts.map +1 -1
- package/dist/work-graph.js +20 -8
- package/dist/work-graph.js.map +1 -1
- package/docs/examples.json +55 -7
- package/docs/llms-full.txt +2043 -222
- package/docs/types.json +1573 -246
- package/package.json +11 -12
- package/src/agent-files.ts +203 -0
- package/src/app-files.ts +34 -4
- package/src/assure-hydration.ts +18 -2
- package/src/assure.ts +88 -10
- package/src/capabilities-tool.ts +47 -9
- package/src/check-diagnostics.ts +75 -9
- package/src/check-scan.ts +1816 -377
- package/src/check.ts +258 -81
- package/src/cli.ts +242 -37
- package/src/client-module.ts +97 -0
- package/src/command-catalog.ts +237 -52
- package/src/component-check.ts +79 -0
- package/src/contract-proof.ts +3 -25
- package/src/contracts.ts +60 -3
- package/src/db-tool.ts +5 -2
- package/src/dev-bun-config.ts +51 -10
- package/src/dev-feed-tool.ts +112 -1
- package/src/diagnostics.ts +3 -0
- package/src/diff-tool.ts +33 -26
- package/src/doctor.ts +43 -21
- package/src/env-file.ts +7 -0
- package/src/fix-recipes.ts +116 -2
- package/src/hand-built-manifest.ts +144 -0
- package/src/hooks-report.ts +135 -0
- package/src/init-agents.ts +21 -14
- package/src/internal/config-paths.ts +154 -0
- package/src/internal/installed-package.ts +15 -0
- package/src/internal/nifra-project.ts +191 -0
- package/src/internal/project-specifiers.ts +477 -0
- package/src/internal/script-kind.ts +2 -1
- package/src/internal/source-facts.ts +48 -5
- package/src/internal/typescript-import.ts +15 -6
- package/src/introspect.ts +104 -28
- package/src/levels-tool.ts +124 -29
- package/src/load.ts +107 -17
- package/src/mcp-context.ts +12 -25
- package/src/mcp-delegate.ts +22 -10
- package/src/mcp-exec.ts +68 -18
- package/src/mcp-http.ts +1 -1
- package/src/mcp-io.ts +74 -0
- package/src/mcp-isolate.ts +9 -2
- package/src/mcp-path.ts +8 -22
- package/src/mcp-project-child.ts +1 -1
- package/src/mcp-root.ts +58 -8
- package/src/mcp-ws.ts +4 -2
- package/src/mcp.ts +56 -22
- package/src/migrate-layout.ts +2257 -176
- package/src/output-schemas.ts +1240 -0
- package/src/port.ts +3 -2
- package/src/project-facts.ts +17 -3
- package/src/project-path.ts +44 -13
- package/src/recipes/5.0.0.ts +35 -0
- package/src/recipes/index.ts +10 -0
- package/src/release-verification.ts +20 -0
- package/src/replay.ts +14 -3
- package/src/review.ts +44 -10
- package/src/rules/codes.ts +12 -0
- package/src/rules/comment-markers.ts +57 -21
- package/src/rules/contract-visibility.ts +383 -0
- package/src/rules/data-guard.ts +391 -42
- package/src/rules/layout.ts +22 -0
- package/src/rules/legacy.ts +206 -52
- package/src/rules/pages.ts +481 -4
- package/src/rules/routes.ts +124 -16
- package/src/rules/secrets.ts +2 -2
- package/src/rules/security.ts +391 -72
- package/src/rules/zones.ts +232 -42
- package/src/scaffold.ts +6 -4
- package/src/sdk.ts +14 -5
- package/src/stylex-migrate.ts +251 -24
- package/src/test-tool.ts +12 -3
- package/src/typecheck-coverage.ts +134 -0
- package/src/upgrade.ts +576 -72
- package/src/verification-plan.ts +33 -2
- package/src/version-drift.ts +118 -0
- package/src/web-app-options.ts +2 -2
- package/src/work-graph.ts +17 -12
package/src/check-diagnostics.ts
CHANGED
|
@@ -10,7 +10,9 @@ import { join } from "node:path"
|
|
|
10
10
|
import type { AssuranceConfig, AssuranceReport } from "@nifrajs/core/assurance"
|
|
11
11
|
import type { CapabilityGap } from "@nifrajs/core/capabilities"
|
|
12
12
|
import type { ProjectEvidenceSnapshot } from "@nifrajs/core/evidence"
|
|
13
|
+
import type { ReflectedHookReport } from "@nifrajs/core/reflection"
|
|
13
14
|
import type { CapabilityProjectReport } from "./capabilities-tool.ts"
|
|
15
|
+
import { scanFetchText, scanStreamText } from "./check-scan.ts"
|
|
14
16
|
import {
|
|
15
17
|
type Diagnostic,
|
|
16
18
|
type DiagnosticSuggestion,
|
|
@@ -20,9 +22,11 @@ import {
|
|
|
20
22
|
import type { DuplicateInstallFinding } from "./doctor.ts"
|
|
21
23
|
import type { PipelineReport } from "./pipeline-report.ts"
|
|
22
24
|
import { freezeProjectFacts, type ProjectFactsSeed } from "./project-facts.ts"
|
|
25
|
+
import { contractVisibilityRule } from "./rules/contract-visibility.ts"
|
|
23
26
|
import { dataGuardRules } from "./rules/data-guard.ts"
|
|
24
27
|
import { parseRulePacks, runRuleRegistry } from "./rules/index.ts"
|
|
25
28
|
import { islandRules } from "./rules/islands.ts"
|
|
29
|
+
import { retiredLayoutRule } from "./rules/layout.ts"
|
|
26
30
|
import { LEGACY_RULE_CODES, LEGACY_RULE_ORDER, legacyRules } from "./rules/legacy.ts"
|
|
27
31
|
import { nanoRules } from "./rules/nano.ts"
|
|
28
32
|
import { pageRules } from "./rules/pages.ts"
|
|
@@ -72,8 +76,9 @@ export type CheckSuggestion = DiagnosticSuggestion
|
|
|
72
76
|
export interface CheckResult {
|
|
73
77
|
readonly ok: boolean
|
|
74
78
|
readonly typecheck: "pass" | "fail" | "skipped"
|
|
75
|
-
/** Why `typecheck` is `"skipped"` (no tsconfig.json, typescript not installed, lints-only mode)
|
|
76
|
-
*
|
|
79
|
+
/** Why `typecheck` is `"skipped"` (no tsconfig.json, typescript not installed, lints-only mode), or
|
|
80
|
+
* why it failed when the compiler itself passed (zoned files outside its program). Echoed in the
|
|
81
|
+
* human report so a skip is never a dim mystery. */
|
|
77
82
|
readonly typecheckNote?: string
|
|
78
83
|
readonly diagnostics: readonly CheckDiagnostic[]
|
|
79
84
|
/** Normalized diagnostics with stable codes for agents and external renderers. */
|
|
@@ -108,6 +113,13 @@ export interface CheckResult {
|
|
|
108
113
|
* the `duplicate-install` diagnostics; this field is what `--json` consumers parse instead.
|
|
109
114
|
*/
|
|
110
115
|
readonly identityPreflight?: IdentityPreflightResult
|
|
116
|
+
/**
|
|
117
|
+
* The hooks each backend route and each prefix's unmatched paths run (`nifra routes --hooks`), read
|
|
118
|
+
* from the `source` of `nifra.assurance.ts`, which check already loads - check runs no other app
|
|
119
|
+
* code. Omitted without that config, and when `maxDiagnostics` caps the output for the MCP transport,
|
|
120
|
+
* where `nifra_routes` with `hooks` returns it.
|
|
121
|
+
*/
|
|
122
|
+
readonly hooks?: ReflectedHookReport
|
|
111
123
|
}
|
|
112
124
|
|
|
113
125
|
/** The `identityPreflight` slice of {@link CheckResult}. */
|
|
@@ -172,7 +184,7 @@ const MAX_IGNORE_GLOB_ALTERNATIVES = 64
|
|
|
172
184
|
* The matcher supports the portable glob forms users expect here: `*`, `?`, `**`, character
|
|
173
185
|
* classes, and brace alternatives.
|
|
174
186
|
*/
|
|
175
|
-
function safeIgnoreGlobMatch(pattern: string, file: string): boolean {
|
|
187
|
+
export function safeIgnoreGlobMatch(pattern: string, file: string): boolean {
|
|
176
188
|
if (pattern.length === 0 || pattern.length > MAX_IGNORE_GLOB_LENGTH) return false
|
|
177
189
|
for (const alternative of expandIgnoreGlobBraces(pattern)) {
|
|
178
190
|
if (matchIgnoreGlobPath(alternative, file)) return true
|
|
@@ -356,6 +368,9 @@ export interface CheckTypecheckResult {
|
|
|
356
368
|
readonly note?: string
|
|
357
369
|
readonly output?: string
|
|
358
370
|
readonly missingTypeScript?: boolean
|
|
371
|
+
/** TypeScript sources found with no tsconfig.json to typecheck them. */
|
|
372
|
+
readonly sourcesWithoutTsconfig?: number
|
|
373
|
+
readonly outsideProgram?: readonly string[]
|
|
359
374
|
}
|
|
360
375
|
|
|
361
376
|
export interface CheckAnalysisInput {
|
|
@@ -367,6 +382,19 @@ export interface CheckDiagnosticsOptions {
|
|
|
367
382
|
readonly assurance?: CheckAssuranceContext
|
|
368
383
|
}
|
|
369
384
|
|
|
385
|
+
/**
|
|
386
|
+
* The prefixes of the mounts the assurance source declares `opaque` (a better-auth handler nifra
|
|
387
|
+
* cannot read): no typed client covers them, so a hand-written fetch into one is deliberate, exactly
|
|
388
|
+
* like a `nifra.check.json` `externalMounts` entry. A mount without that declaration stays checked.
|
|
389
|
+
*/
|
|
390
|
+
async function mountPrefixes(source: unknown): Promise<readonly string[]> {
|
|
391
|
+
if (source === undefined) return []
|
|
392
|
+
const { reflectMounts } = await import("@nifrajs/core/reflection")
|
|
393
|
+
return reflectMounts(source).flatMap((mount) =>
|
|
394
|
+
mount.opaque === undefined || mount.path === "/*" ? [] : [mount.path.slice(0, -"/*".length)],
|
|
395
|
+
)
|
|
396
|
+
}
|
|
397
|
+
|
|
370
398
|
export async function collectCheckDiagnostics(
|
|
371
399
|
cwd: string,
|
|
372
400
|
scan: CheckAnalysisInput,
|
|
@@ -422,6 +450,31 @@ export async function collectCheckDiagnostics(
|
|
|
422
450
|
rulePacks: applicationRulePacks,
|
|
423
451
|
},
|
|
424
452
|
}
|
|
453
|
+
const configuredMounts = factsSeed.policies.checkConfig.externalMounts
|
|
454
|
+
const appMounts = (await mountPrefixes(loadedPolicy?.config?.source)).filter(
|
|
455
|
+
(prefix) => !configuredMounts.includes(prefix),
|
|
456
|
+
)
|
|
457
|
+
if (appMounts.length > 0) {
|
|
458
|
+
const externalMounts = [...configuredMounts, ...appMounts]
|
|
459
|
+
const files = factsSeed.source.files.map((file) => ({
|
|
460
|
+
file,
|
|
461
|
+
content: factsSeed.source.read(file) ?? "",
|
|
462
|
+
}))
|
|
463
|
+
factsSeed = {
|
|
464
|
+
...factsSeed,
|
|
465
|
+
policies: {
|
|
466
|
+
...factsSeed.policies,
|
|
467
|
+
checkConfig: { ...factsSeed.policies.checkConfig, externalMounts },
|
|
468
|
+
},
|
|
469
|
+
sourceFindings: {
|
|
470
|
+
...factsSeed.sourceFindings,
|
|
471
|
+
fetches: files.flatMap(({ file, content }) => scanFetchText(file, content, externalMounts)),
|
|
472
|
+
streams: files.flatMap(({ file, content }) =>
|
|
473
|
+
scanStreamText(file, content, externalMounts),
|
|
474
|
+
),
|
|
475
|
+
},
|
|
476
|
+
}
|
|
477
|
+
}
|
|
425
478
|
const projectFacts = freezeProjectFacts(factsSeed)
|
|
426
479
|
const ruleContext = {
|
|
427
480
|
root: cwd,
|
|
@@ -433,9 +486,11 @@ export async function collectCheckDiagnostics(
|
|
|
433
486
|
}
|
|
434
487
|
|
|
435
488
|
const builtInRules = [
|
|
489
|
+
retiredLayoutRule,
|
|
436
490
|
...legacyRules,
|
|
437
491
|
...securityRules,
|
|
438
492
|
...routeRules,
|
|
493
|
+
contractVisibilityRule,
|
|
439
494
|
...pageRules,
|
|
440
495
|
...zoneRules,
|
|
441
496
|
...dataGuardRules,
|
|
@@ -514,7 +569,7 @@ export async function collectCheckDiagnostics(
|
|
|
514
569
|
if (knownLegacyCodes.has(item.code)) continue
|
|
515
570
|
compatibilityRows.push({
|
|
516
571
|
rule: item.code,
|
|
517
|
-
severity: item.severity === "
|
|
572
|
+
severity: item.severity === "warn" ? "warning" : item.severity,
|
|
518
573
|
code: item.code,
|
|
519
574
|
...(item.file === undefined ? {} : { file: item.file }),
|
|
520
575
|
...(item.line === undefined ? {} : { line: item.line }),
|
|
@@ -583,17 +638,27 @@ export async function collectCheckDiagnostics(
|
|
|
583
638
|
shown.length < total ? shown.length + nonLegacyStructuredCount : finalStructured.length
|
|
584
639
|
|
|
585
640
|
const doctor = projectFacts.packages.doctor
|
|
641
|
+
const outsideProgram = projectFacts.check.typecheck.outsideProgram?.length ?? 0
|
|
586
642
|
const knownGaps = projectFacts.policies.capability?.report.gaps ?? []
|
|
643
|
+
const hookSource = projectFacts.policies.assurance?.config?.source
|
|
644
|
+
const hooks =
|
|
645
|
+
hookSource === undefined || opts.maxDiagnostics !== undefined
|
|
646
|
+
? undefined
|
|
647
|
+
: (await import("@nifrajs/core/reflection")).reflectHooks(hookSource)
|
|
587
648
|
const result: CheckResult = {
|
|
588
649
|
ok: !finalDiagnostics.some((value) => value.severity === "error"),
|
|
589
|
-
typecheck: projectFacts.check.typecheck.ran
|
|
590
|
-
?
|
|
650
|
+
typecheck: !projectFacts.check.typecheck.ran
|
|
651
|
+
? "skipped"
|
|
652
|
+
: projectFacts.check.typecheck.ok && outsideProgram === 0
|
|
591
653
|
? "pass"
|
|
592
|
-
: "fail"
|
|
593
|
-
: "skipped",
|
|
654
|
+
: "fail",
|
|
594
655
|
...(!projectFacts.check.typecheck.ran && projectFacts.check.typecheck.note !== undefined
|
|
595
656
|
? { typecheckNote: projectFacts.check.typecheck.note }
|
|
596
|
-
:
|
|
657
|
+
: outsideProgram > 0
|
|
658
|
+
? {
|
|
659
|
+
typecheckNote: `${outsideProgram} file(s) in zone folders are outside tsc's program, so the typecheck never read them`,
|
|
660
|
+
}
|
|
661
|
+
: {}),
|
|
597
662
|
diagnostics: shown,
|
|
598
663
|
...(projectFacts.pipeline !== undefined ? { pipeline: projectFacts.pipeline } : {}),
|
|
599
664
|
...(doctor.ran
|
|
@@ -610,6 +675,7 @@ export async function collectCheckDiagnostics(
|
|
|
610
675
|
? {}
|
|
611
676
|
: { externalMounts: checkConfig.externalMounts }),
|
|
612
677
|
...(knownGaps.length === 0 ? {} : { knownGaps }),
|
|
678
|
+
...(hooks === undefined ? {} : { hooks }),
|
|
613
679
|
...(Object.keys(checkConfig.rules).length === 0 ? {} : { ruleOverrides: checkConfig.rules }),
|
|
614
680
|
...(shown.length < total ? { truncated: { shown: shown.length, total } } : {}),
|
|
615
681
|
}
|