@md-code/follow-architecture 0.3.0 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +38 -0
- package/README.md +1341 -472
- package/dist/args.d.ts +4 -0
- package/dist/args.js +18 -1
- package/dist/bin/follow-architecture.js +3 -3
- package/dist/closure-project.d.ts +4 -0
- package/dist/closure-project.js +122 -0
- package/dist/code-entities/classify.d.ts +11 -0
- package/dist/code-entities/classify.js +45 -0
- package/dist/code-entities/connector.d.ts +8 -0
- package/dist/code-entities/connector.js +119 -0
- package/dist/code-entities/entities.d.ts +9 -0
- package/dist/{code-roles/roles.js → code-entities/entities.js} +81 -54
- package/dist/code-entities/project.d.ts +21 -0
- package/dist/code-entities/project.js +249 -0
- package/dist/code-entities/walk.d.ts +31 -0
- package/dist/code-entities/walk.js +95 -0
- package/dist/config-options.d.ts +23 -0
- package/dist/config-options.js +18 -1
- package/dist/config-project.js +10 -2
- package/dist/config-report.d.ts +1 -1
- package/dist/config-report.js +20 -3
- package/dist/config-rule.d.ts +25 -0
- package/dist/config-rule.js +89 -6
- package/dist/config-state.d.ts +14 -3
- package/dist/config-state.js +180 -17
- package/dist/config.d.ts +25 -0
- package/dist/css/index.d.ts +11 -7
- package/dist/css/index.js +124 -23
- package/dist/css/syntax/css/gate.js +5 -5
- package/dist/css/syntax/css/index.d.ts +1 -1
- package/dist/css/syntax/css/index.js +1 -1
- package/dist/css/syntax/css/reference.d.ts +1 -1
- package/dist/css/syntax/css/reference.js +15 -3
- package/dist/css/syntax/language.d.ts +1 -1
- package/dist/css/syntax/language.js +4 -2
- package/dist/css/syntax/scss/index.d.ts +2 -2
- package/dist/css/syntax/scss/index.js +1 -1
- package/dist/css/syntax/scss/reference.d.ts +1 -1
- package/dist/css/syntax/scss/reference.js +7 -1
- package/dist/css/syntax/styled/document.d.ts +3 -3
- package/dist/css/syntax/styled/document.js +17 -7
- package/dist/css/syntax/styled/markup.d.ts +1 -1
- package/dist/css/syntax/styled/markup.js +22 -14
- package/dist/css/syntax/styled/tags.d.ts +2 -0
- package/dist/css/syntax/styled/tags.js +22 -0
- package/dist/css/syntax/styled/template.js +10 -4
- package/dist/css/syntax/tailwind/tailwind.js +4 -4
- package/dist/css/value/check.d.ts +1 -1
- package/dist/css/value/check.js +1 -1
- package/dist/css/value/expression/arithmetic.d.ts +2 -2
- package/dist/css/value/expression/arithmetic.js +7 -3
- package/dist/css/value/expression/block.d.ts +2 -2
- package/dist/css/value/expression/block.js +4 -3
- package/dist/css/value/expression/conditional.d.ts +2 -2
- package/dist/css/value/expression/conditional.js +1 -1
- package/dist/css/value/expression/index.d.ts +2 -2
- package/dist/css/value/expression/index.js +10 -6
- package/dist/css/value/expression/map.d.ts +2 -2
- package/dist/css/value/expression/map.js +2 -2
- package/dist/css/value/object/index.d.ts +2 -2
- package/dist/css/value/object/index.js +14 -4
- package/dist/css/value/object/members.d.ts +2 -2
- package/dist/css/value/object/node.js +9 -4
- package/dist/css/value/object/path.d.ts +3 -3
- package/dist/css/value/object/path.js +10 -4
- package/dist/css/value/pieces.d.ts +3 -3
- package/dist/css/value/pieces.js +14 -4
- package/dist/css/value/resolve.js +15 -5
- package/dist/css/value/scope.d.ts +3 -2
- package/dist/css/value/scope.js +25 -7
- package/dist/css/value/substitute.js +43 -11
- package/dist/entities/architecture.d.ts +28 -25
- package/dist/entities/ast/assignments-raw.d.ts +1 -1
- package/dist/entities/ast/assignments-raw.js +61 -8
- package/dist/entities/ast/assignments-tagged.d.ts +1 -1
- package/dist/entities/ast/assignments-tagged.js +22 -7
- package/dist/entities/ast/assignments.d.ts +1 -1
- package/dist/entities/ast/assignments.js +6 -4
- package/dist/entities/ast/branches.d.ts +1 -1
- package/dist/entities/ast/calls.d.ts +1 -1
- package/dist/entities/ast/calls.js +19 -3
- package/dist/entities/ast/classes.d.ts +1 -1
- package/dist/entities/ast/classes.js +5 -1
- package/dist/entities/ast/comments.d.ts +3 -2
- package/dist/entities/ast/comments.js +47 -17
- package/dist/entities/ast/declaration.d.ts +1 -1
- package/dist/entities/ast/depth.d.ts +2 -2
- package/dist/entities/ast/depth.js +15 -8
- package/dist/entities/ast/enums.d.ts +1 -1
- package/dist/entities/ast/export-chain.d.ts +15 -0
- package/dist/entities/ast/export-chain.js +171 -0
- package/dist/entities/ast/file-exports.d.ts +1 -1
- package/dist/entities/ast/file-exports.js +26 -3
- package/dist/entities/ast/file-facts.d.ts +6 -3
- package/dist/entities/ast/file-facts.js +33 -4
- package/dist/entities/ast/file-imports.d.ts +1 -1
- package/dist/entities/ast/file-imports.js +26 -3
- package/dist/entities/ast/file.d.ts +2 -2
- package/dist/entities/ast/file.js +2 -1
- package/dist/entities/ast/functions.d.ts +1 -1
- package/dist/entities/ast/functions.js +13 -4
- package/dist/entities/ast/heritage.d.ts +1 -1
- package/dist/entities/ast/heritage.js +9 -1
- package/dist/entities/ast/index.d.ts +6 -3
- package/dist/entities/ast/index.js +82 -26
- package/dist/entities/ast/kind.d.ts +1 -1
- package/dist/entities/ast/kind.js +7 -1
- package/dist/entities/ast/modifiers.d.ts +1 -1
- package/dist/entities/ast/modifiers.js +4 -4
- package/dist/entities/ast/project.js +33 -2
- package/dist/entities/ast/properties.d.ts +1 -1
- package/dist/entities/ast/properties.js +10 -5
- package/dist/entities/ast/resolve.d.ts +1 -1
- package/dist/entities/ast/resolve.js +4 -4
- package/dist/entities/ast/tree.d.ts +4 -2
- package/dist/entities/ast/tree.js +184 -17
- package/dist/entities/ast/types.d.ts +1 -1
- package/dist/entities/ast/types.js +2 -1
- package/dist/entities/ast/usage.d.ts +1 -1
- package/dist/entities/ast/usage.js +1 -1
- package/dist/entities/ast/variables.d.ts +1 -1
- package/dist/entities/context.d.ts +4 -4
- package/dist/entities/facts.d.ts +36 -13
- package/dist/entities/findings.d.ts +3 -3
- package/dist/entities/kinds.d.ts +1 -1
- package/dist/entities/kinds.js +131 -30
- package/dist/entities/location/homes.d.ts +10 -10
- package/dist/entities/location/homes.js +74 -48
- package/dist/entities/location/place.d.ts +1 -1
- package/dist/entities/location/place.js +10 -3
- package/dist/entities/location/where.d.ts +8 -6
- package/dist/entities/location/where.js +79 -30
- package/dist/entities/location.d.ts +3 -3
- package/dist/entities/location.js +17 -17
- package/dist/entities/operators.js +1 -1
- package/dist/entities/overview/data.d.ts +6 -6
- package/dist/entities/overview/decision.d.ts +11 -11
- package/dist/entities/overview/finding.d.ts +10 -10
- package/dist/entities/overview/graph.d.ts +28 -11
- package/dist/entities/overview/input.d.ts +2 -2
- package/dist/entities/overview/summaries.d.ts +17 -15
- package/dist/entities/queries.d.ts +1 -1
- package/dist/entities/queries.js +72 -12
- package/dist/entities/repair.d.ts +1 -1
- package/dist/entities/repair.js +8 -2
- package/dist/entities/schema.d.ts +17 -3
- package/dist/entities/schema.js +74 -16
- package/dist/entities/story.d.ts +5 -5
- package/dist/entities/structure-facts.d.ts +1 -1
- package/dist/entities/token.d.ts +4 -4
- package/dist/entities/tree/build.d.ts +4 -3
- package/dist/entities/tree/build.js +95 -44
- package/dist/entities/tree/entries.d.ts +3 -3
- package/dist/entities/tree/entries.js +41 -16
- package/dist/entities/tree/index.d.ts +2 -2
- package/dist/entities/tree/index.js +1 -1
- package/dist/entities/tree/match.d.ts +2 -2
- package/dist/entities/tree/match.js +9 -5
- package/dist/fa-index.d.ts +16 -0
- package/dist/fa-index.js +165 -0
- package/dist/fa-open.d.ts +51 -0
- package/dist/fa-open.js +232 -0
- package/dist/fa-store.d.ts +22 -0
- package/dist/fa-store.js +222 -0
- package/dist/fa-values.d.ts +37 -0
- package/dist/fa-values.js +104 -0
- package/dist/facts-record.d.ts +45 -0
- package/dist/facts-record.js +287 -0
- package/dist/frameworks/angular/index.d.ts +2 -2
- package/dist/frameworks/angular/index.js +2 -1
- package/dist/frameworks/facet.d.ts +3 -1
- package/dist/frameworks/facet.js +13 -0
- package/dist/frameworks/index.d.ts +1 -1
- package/dist/frameworks/index.js +8 -4
- package/dist/frameworks/react/index.d.ts +2 -2
- package/dist/frameworks/react/index.js +33 -10
- package/dist/frameworks/test/index.d.ts +6 -0
- package/dist/frameworks/test/index.js +157 -0
- package/dist/frameworks/vue/index.d.ts +2 -2
- package/dist/frameworks/vue/index.js +2 -1
- package/dist/ignore.d.ts +3 -0
- package/dist/ignore.js +48 -0
- package/dist/index-file.d.ts +43 -0
- package/dist/index-file.js +218 -0
- package/dist/index-run.d.ts +39 -0
- package/dist/index-run.js +217 -0
- package/dist/index-zone.d.ts +25 -0
- package/dist/index-zone.js +209 -0
- package/dist/main.d.ts +5 -2
- package/dist/main.js +207 -34
- package/dist/nodes/child-entities.d.ts +3 -0
- package/dist/nodes/child-entities.js +12 -0
- package/dist/nodes/children.d.ts +4 -4
- package/dist/nodes/children.js +54 -11
- package/dist/nodes/finally/emit.d.ts +3 -3
- package/dist/nodes/finally/emit.js +26 -10
- package/dist/nodes/finally/entities.d.ts +13 -0
- package/dist/nodes/finally/entities.js +42 -0
- package/dist/nodes/finally/index.d.ts +6 -6
- package/dist/nodes/finally/index.js +8 -8
- package/dist/nodes/finally/queries.d.ts +2 -2
- package/dist/nodes/finally/queries.js +7 -4
- package/dist/nodes/finally/relations-access.d.ts +2 -2
- package/dist/nodes/finally/relations-access.js +22 -18
- package/dist/nodes/finally/relations-edge.d.ts +5 -5
- package/dist/nodes/finally/relations-edge.js +67 -44
- package/dist/nodes/finally/relations-group.d.ts +7 -7
- package/dist/nodes/finally/relations-group.js +28 -25
- package/dist/nodes/finally/relations.d.ts +2 -2
- package/dist/nodes/finally/relations.js +16 -12
- package/dist/nodes/finally/required.d.ts +3 -3
- package/dist/nodes/finally/required.js +9 -7
- package/dist/nodes/finally/violation.d.ts +2 -2
- package/dist/nodes/similar.d.ts +3 -3
- package/dist/nodes/similar.js +61 -49
- package/dist/piece-forms.d.ts +9 -0
- package/dist/piece-forms.js +68 -0
- package/dist/{pipeline-roles.d.ts → pipeline-entities.d.ts} +2 -2
- package/dist/{pipeline-roles.js → pipeline-entities.js} +32 -28
- package/dist/pipeline-facts.d.ts +4 -3
- package/dist/pipeline-facts.js +47 -55
- package/dist/{pipeline-unroled.d.ts → pipeline-unclassified.d.ts} +2 -2
- package/dist/{pipeline-unroled.js → pipeline-unclassified.js} +58 -63
- package/dist/pipeline.js +19 -64
- package/dist/release-file.d.ts +3 -0
- package/dist/release-file.js +13 -0
- package/dist/report/asks.d.ts +3 -3
- package/dist/report/asks.js +16 -6
- package/dist/report/configErrors.d.ts +55 -27
- package/dist/report/configErrors.js +81 -35
- package/dist/report/errorTypes/codes/structure.d.ts +1 -1
- package/dist/report/errorTypes/codes/structure.js +9 -9
- package/dist/report/errorTypes/decision-maker.d.ts +5 -5
- package/dist/report/errorTypes/decision-maker.js +4 -4
- package/dist/report/errorTypes/destinations.d.ts +5 -5
- package/dist/report/errorTypes/destinations.js +52 -34
- package/dist/report/errorTypes/finding-type.d.ts +3 -3
- package/dist/report/errorTypes/index.d.ts +1 -1
- package/dist/report/errorTypes/types/fileContents.d.ts +4 -4
- package/dist/report/errorTypes/types/fileContents.js +11 -5
- package/dist/report/errorTypes/types/unknownEntity.d.ts +9 -0
- package/dist/report/errorTypes/types/{unknownRole.js → unknownEntity.js} +12 -7
- package/dist/report/errorTypes/types/wrongAction.d.ts +5 -5
- package/dist/report/errorTypes/types/wrongAction.js +18 -13
- package/dist/report/errorTypes/types/wrongPlacement.d.ts +4 -4
- package/dist/report/errorTypes/types/wrongPlacement.js +19 -9
- package/dist/report/errorTypes/vocabulary/ids.d.ts +2 -2
- package/dist/report/errorTypes/vocabulary/ids.js +3 -3
- package/dist/report/errorTypes/vocabulary/phrases.d.ts +2 -2
- package/dist/report/errorTypes/vocabulary/phrases.js +39 -26
- package/dist/report/errorTypes/vocabulary/places.d.ts +3 -3
- package/dist/report/errorTypes/vocabulary/places.js +13 -13
- package/dist/report/finding-from.d.ts +3 -3
- package/dist/report/finding-from.js +14 -9
- package/dist/report/notices.d.ts +6 -1
- package/dist/report/notices.js +46 -20
- package/dist/report/observed.d.ts +19 -0
- package/dist/report/observed.js +87 -0
- package/dist/report/render-report.d.ts +1 -1
- package/dist/report/render-report.js +33 -30
- package/dist/report/user-report/build/bundle.js +9 -0
- package/dist/report/user-report/build/bundle.prebuilt.js +799 -297
- package/dist/report/user-report/data/collect.d.ts +2 -2
- package/dist/report/user-report/data/collect.js +15 -12
- package/dist/report/user-report/data/entities.d.ts +7 -0
- package/dist/report/user-report/data/{roles.js → entities.js} +27 -22
- package/dist/report/user-report/data/{role-examples.d.ts → entity-examples.d.ts} +3 -3
- package/dist/report/user-report/data/entity-examples.js +126 -0
- package/dist/report/user-report/data/{role-filters.d.ts → entity-filters.d.ts} +2 -2
- package/dist/report/user-report/data/{role-filters.js → entity-filters.js} +7 -7
- package/dist/report/user-report/data/entity-marks.d.ts +5 -0
- package/dist/report/user-report/data/{role-marks.js → entity-marks.js} +11 -11
- package/dist/report/user-report/data/file-tree.d.ts +3 -3
- package/dist/report/user-report/data/file-tree.js +13 -5
- package/dist/report/user-report/data/finding-boundary.d.ts +4 -4
- package/dist/report/user-report/data/finding-boundary.js +2 -2
- package/dist/report/user-report/data/finding-plan.d.ts +5 -5
- package/dist/report/user-report/data/finding-plan.js +10 -10
- package/dist/report/user-report/data/finding-title.d.ts +2 -2
- package/dist/report/user-report/data/finding-title.js +8 -8
- package/dist/report/user-report/data/findings.d.ts +4 -4
- package/dist/report/user-report/data/findings.js +30 -20
- package/dist/report/user-report/data/graph-edges.d.ts +4 -4
- package/dist/report/user-report/data/graph-edges.js +19 -19
- package/dist/report/user-report/data/graph-entities.d.ts +6 -0
- package/dist/report/user-report/data/graph-entities.js +158 -0
- package/dist/report/user-report/data/graph-helpers.d.ts +5 -5
- package/dist/report/user-report/data/graph-helpers.js +15 -15
- package/dist/report/user-report/data/graph.d.ts +5 -4
- package/dist/report/user-report/data/graph.js +28 -21
- package/dist/report/user-report/data/nodes.d.ts +2 -2
- package/dist/report/user-report/data/nodes.js +16 -16
- package/dist/report/user-report/data/rules.d.ts +7 -0
- package/dist/report/user-report/data/{invariants.js → rules.js} +13 -13
- package/dist/report/user-report/data/scan.d.ts +1 -1
- package/dist/report/user-report/data/scan.js +2 -2
- package/dist/report/user-report/html/shell.d.ts +1 -1
- package/dist/report/user-report/html/shell.js +1 -1
- package/dist/report/user-report/index.d.ts +1 -1
- package/dist/report/user-report/shared/describe.d.ts +1 -1
- package/dist/report/user-report/shared/describe.js +6 -6
- package/dist/rules/index.d.ts +7 -0
- package/dist/{invariants → rules}/index.js +85 -57
- package/dist/{invariants → rules}/list-vars.d.ts +2 -2
- package/dist/{invariants → rules}/list-vars.js +9 -3
- package/dist/{invariants → rules}/name.js +2 -2
- package/dist/rules/normalize.d.ts +5 -0
- package/dist/{invariants → rules}/normalize.js +35 -32
- package/dist/{invariants → rules}/vars.d.ts +9 -7
- package/dist/{invariants → rules}/vars.js +5 -5
- package/dist/scan-run.d.ts +20 -0
- package/dist/scan-run.js +130 -0
- package/dist/scripts/audit-report.js +2 -2
- package/dist/usage-index.d.ts +4 -0
- package/dist/usage-index.js +272 -0
- package/dist/usage-mode.d.ts +7 -0
- package/dist/usage-mode.js +16 -0
- package/dist/usage-pass.d.ts +19 -0
- package/dist/usage-pass.js +136 -0
- package/dist/usage-prepare.d.ts +2 -0
- package/dist/usage-prepare.js +22 -0
- package/dist/usage-sweep.d.ts +10 -0
- package/dist/usage-sweep.js +254 -0
- package/dist/utils/aliases.d.ts +22 -0
- package/dist/utils/aliases.js +163 -0
- package/dist/utils/classify.d.ts +2 -2
- package/dist/utils/classify.js +4 -4
- package/dist/utils/distinct.js +4 -2
- package/dist/utils/files.js +24 -30
- package/dist/utils/fixpoint.js +2 -2
- package/dist/utils/host.d.ts +1 -1
- package/dist/utils/host.js +4 -1
- package/dist/utils/imports.js +66 -12
- package/dist/utils/keyed.js +2 -2
- package/dist/utils/map-record.js +2 -2
- package/dist/utils/packages.d.ts +15 -0
- package/dist/utils/packages.js +197 -0
- package/dist/utils/path-label.js +3 -1
- package/dist/utils/pattern.d.ts +5 -4
- package/dist/utils/pattern.js +38 -8
- package/dist/utils/permission.d.ts +3 -3
- package/dist/utils/permission.js +4 -2
- package/dist/utils/plural.js +2 -2
- package/dist/utils/qualified.js +4 -4
- package/dist/utils/rank.js +2 -2
- package/dist/utils/record.js +1 -1
- package/dist/utils/search.js +7 -2
- package/dist/utils/speak.js +1 -1
- package/dist/utils/split.js +14 -1
- package/dist/utils/template.d.ts +1 -1
- package/dist/utils/template.js +1 -1
- package/dist/utils/tokenize.js +6 -1
- package/dist/utils/typed-field.js +2 -2
- package/dist/utils/verdicts.js +1 -1
- package/entities/operators.ts +1 -1
- package/package.json +101 -90
- package/report/errorTypes/vocabulary/ids.ts +7 -2
- package/report/errorTypes/vocabulary/phrases.ts +47 -27
- package/report/errorTypes/vocabulary/places.ts +21 -16
- package/report/user-report/shared/describe.ts +7 -7
- package/dist/code-roles/classify.d.ts +0 -11
- package/dist/code-roles/classify.js +0 -43
- package/dist/code-roles/connector.d.ts +0 -5
- package/dist/code-roles/connector.js +0 -114
- package/dist/code-roles/project.d.ts +0 -12
- package/dist/code-roles/project.js +0 -122
- package/dist/code-roles/roles.d.ts +0 -8
- package/dist/invariants/index.d.ts +0 -6
- package/dist/invariants/normalize.d.ts +0 -4
- package/dist/nodes/child-roles.d.ts +0 -3
- package/dist/nodes/child-roles.js +0 -12
- package/dist/nodes/finally/roles.d.ts +0 -13
- package/dist/nodes/finally/roles.js +0 -41
- package/dist/report/errorTypes/types/unknownRole.d.ts +0 -9
- package/dist/report/user-report/data/graph-roles.d.ts +0 -5
- package/dist/report/user-report/data/graph-roles.js +0 -71
- package/dist/report/user-report/data/invariants.d.ts +0 -7
- package/dist/report/user-report/data/role-examples.js +0 -94
- package/dist/report/user-report/data/role-marks.d.ts +0 -5
- package/dist/report/user-report/data/roles.d.ts +0 -7
- /package/dist/{invariants → rules}/name.d.ts +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { DecisionCtx, Places } from "
|
|
2
|
-
import type { Story } from "
|
|
3
|
-
import type { StatedRepair } from "
|
|
1
|
+
import type { DecisionCtx, Places } from "@md-code/follow-architecture/entities/overview/decision";
|
|
2
|
+
import type { Story } from "@md-code/follow-architecture/entities/story";
|
|
3
|
+
import type { StatedRepair } from "@md-code/follow-architecture/entities/repair";
|
|
4
4
|
type FindingType = {
|
|
5
5
|
id: string;
|
|
6
6
|
label: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { describe, TYPES } from "./decision-maker";
|
|
2
2
|
import * as ids from "./vocabulary/ids";
|
|
3
3
|
import * as wrongAction from "./types/wrongAction";
|
|
4
|
-
import type { FieldValue } from "
|
|
4
|
+
import type { FieldValue } from "@md-code/follow-architecture/utils/field";
|
|
5
5
|
type Token = {
|
|
6
6
|
code?: string;
|
|
7
7
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { FILE_CONTENTS } from "
|
|
2
|
-
import type { FileContentsStory } from "
|
|
3
|
-
import type { DecisionCtx, Places } from "
|
|
4
|
-
import type { StatedRepair } from "
|
|
1
|
+
import { FILE_CONTENTS } from "@md-code/follow-architecture/report/errorTypes/vocabulary/ids";
|
|
2
|
+
import type { FileContentsStory } from "@md-code/follow-architecture/entities/story";
|
|
3
|
+
import type { DecisionCtx, Places } from "@md-code/follow-architecture/entities/overview/decision";
|
|
4
|
+
import type { StatedRepair } from "@md-code/follow-architecture/entities/repair";
|
|
5
5
|
declare const classify: (ctx: DecisionCtx, places: Places) => FileContentsStory;
|
|
6
6
|
declare const message: () => null;
|
|
7
7
|
declare const fixes: (story: FileContentsStory, ctx: DecisionCtx) => StatedRepair[];
|
|
@@ -4,11 +4,15 @@ exports.fixes = exports.message = exports.classify = exports.label = exports.id
|
|
|
4
4
|
// The finding judges the file itself — no place, no relation. The repair is
|
|
5
5
|
// whatever the rule that fired already said — and it is read from `data.repair`,
|
|
6
6
|
// the ONE object the producer stated, never re-derived from the sentence.
|
|
7
|
-
const ids_1 = require("
|
|
7
|
+
const ids_1 = require("@md-code/follow-architecture/report/errorTypes/vocabulary/ids");
|
|
8
8
|
Object.defineProperty(exports, "id", { enumerable: true, get: function () { return ids_1.FILE_CONTENTS; } });
|
|
9
|
-
const field_1 = require("
|
|
10
|
-
const read_field_1 = require("
|
|
11
|
-
const classify = (ctx, places) => ({
|
|
9
|
+
const field_1 = require("@md-code/follow-architecture/utils/field");
|
|
10
|
+
const read_field_1 = require("@md-code/follow-architecture/utils/read-field");
|
|
11
|
+
const classify = (ctx, places) => ({
|
|
12
|
+
type: ids_1.FILE_CONTENTS,
|
|
13
|
+
from: places.folderOf(ctx.ownerNode?.slug),
|
|
14
|
+
to: [],
|
|
15
|
+
});
|
|
12
16
|
exports.classify = classify;
|
|
13
17
|
const message = () => null;
|
|
14
18
|
exports.message = message;
|
|
@@ -18,7 +22,9 @@ exports.message = message;
|
|
|
18
22
|
// only `to` is resolved here.
|
|
19
23
|
const statedFix = (stated, ctx) => {
|
|
20
24
|
const to = (0, read_field_1.stringListField)(stated, "to");
|
|
21
|
-
const boxes = to.length
|
|
25
|
+
const boxes = to.length
|
|
26
|
+
? to
|
|
27
|
+
: [ctx.places.nodeAtPath((0, read_field_1.stringField)(stated, "path") || null)].filter((b) => Boolean(b));
|
|
22
28
|
return { ...stated, to: boxes };
|
|
23
29
|
};
|
|
24
30
|
const fixes = (story, ctx) => {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { UNKNOWN_ENTITY } from "@md-code/follow-architecture/report/errorTypes/vocabulary/ids";
|
|
2
|
+
import type { UnknownEntityStory } from "@md-code/follow-architecture/entities/story";
|
|
3
|
+
import type { DecisionCtx, Places } from "@md-code/follow-architecture/entities/overview/decision";
|
|
4
|
+
import type { StatedRepair } from "@md-code/follow-architecture/entities/repair";
|
|
5
|
+
declare const classify: (ctx: DecisionCtx, places: Places) => UnknownEntityStory | null;
|
|
6
|
+
declare const message: () => null;
|
|
7
|
+
declare const fixes: (story: UnknownEntityStory) => StatedRepair[];
|
|
8
|
+
declare const __exported_label = "No entity describes this code";
|
|
9
|
+
export { UNKNOWN_ENTITY as id, __exported_label as label, classify, message, fixes };
|
|
@@ -3,20 +3,25 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.fixes = exports.message = exports.classify = exports.label = exports.id = void 0;
|
|
4
4
|
// Nothing declares this kind of code here. One repair, because there is one
|
|
5
5
|
// thing the reader can do with code the architecture does not describe.
|
|
6
|
-
const ids_1 = require("
|
|
7
|
-
Object.defineProperty(exports, "id", { enumerable: true, get: function () { return ids_1.
|
|
8
|
-
const qualified_1 = require("
|
|
9
|
-
// The finding is an
|
|
6
|
+
const ids_1 = require("@md-code/follow-architecture/report/errorTypes/vocabulary/ids");
|
|
7
|
+
Object.defineProperty(exports, "id", { enumerable: true, get: function () { return ids_1.UNKNOWN_ENTITY; } });
|
|
8
|
+
const qualified_1 = require("@md-code/follow-architecture/utils/qualified");
|
|
9
|
+
// The finding is an unclassified piece AND its box can be drawn: both guards must
|
|
10
10
|
// pass before the story is told (the shared qualified-answer walk).
|
|
11
|
-
const classify = (ctx, places) => (0, qualified_1.answerWhenAllPass)(ctx, [(c) => /:
|
|
11
|
+
const classify = (ctx, places) => (0, qualified_1.answerWhenAllPass)(ctx, [(c) => /:unclassified:/.test(c.key ?? ""), (c) => Boolean(places.folderOf(c.ownerNode?.slug))], (c) => ({ type: ids_1.UNKNOWN_ENTITY, from: places.folderOf(c.ownerNode?.slug), to: [] }));
|
|
12
12
|
exports.classify = classify;
|
|
13
13
|
const message = () => null;
|
|
14
14
|
exports.message = message;
|
|
15
15
|
const fixes = (story) => [
|
|
16
16
|
// `from` = the box the code sits in: the picture crosses it out, so "Delete"
|
|
17
17
|
// is drawn, not only printed.
|
|
18
|
-
{
|
|
18
|
+
{
|
|
19
|
+
code: "delete",
|
|
20
|
+
to: [],
|
|
21
|
+
from: story.from,
|
|
22
|
+
text: "Delete it — nothing in the architecture describes this code, so nothing may rely on it.",
|
|
23
|
+
},
|
|
19
24
|
];
|
|
20
25
|
exports.fixes = fixes;
|
|
21
|
-
const __exported_label = "No
|
|
26
|
+
const __exported_label = "No entity describes this code";
|
|
22
27
|
exports.label = __exported_label;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { WRONG_ACTION } from "
|
|
2
|
-
import type { WrongActionStory } from "
|
|
3
|
-
import type { RelationToken } from "
|
|
4
|
-
import type { DecisionCtx, Places } from "
|
|
5
|
-
import type { StatedRepair } from "
|
|
1
|
+
import { WRONG_ACTION } from "@md-code/follow-architecture/report/errorTypes/vocabulary/ids";
|
|
2
|
+
import type { WrongActionStory } from "@md-code/follow-architecture/entities/story";
|
|
3
|
+
import type { RelationToken } from "@md-code/follow-architecture/entities/token";
|
|
4
|
+
import type { DecisionCtx, Places } from "@md-code/follow-architecture/entities/overview/decision";
|
|
5
|
+
import type { StatedRepair } from "@md-code/follow-architecture/entities/repair";
|
|
6
6
|
declare const classify: (ctx: DecisionCtx, places: Places) => WrongActionStory | null;
|
|
7
7
|
declare const message: (story: WrongActionStory, ctx: DecisionCtx) => string | null;
|
|
8
8
|
declare const fixes: (story: WrongActionStory, ctx: {
|
|
@@ -6,14 +6,14 @@ exports.describeToken = exports.fixes = exports.message = exports.classify = exp
|
|
|
6
6
|
// The repairs are OBJECTS, not sentences: `{ code, text, to }`. The `to` array
|
|
7
7
|
// is the same one the picture draws, so a repair with three destinations is
|
|
8
8
|
// three arrows in the graph and three lines in the text — computed once.
|
|
9
|
-
const ids_1 = require("
|
|
9
|
+
const ids_1 = require("@md-code/follow-architecture/report/errorTypes/vocabulary/ids");
|
|
10
10
|
Object.defineProperty(exports, "id", { enumerable: true, get: function () { return ids_1.WRONG_ACTION; } });
|
|
11
|
-
const verbs_1 = require("
|
|
12
|
-
const kinds_1 = require("
|
|
13
|
-
const phrases_1 = require("
|
|
14
|
-
const field_1 = require("
|
|
15
|
-
const read_field_1 = require("
|
|
16
|
-
const qualified_1 = require("
|
|
11
|
+
const verbs_1 = require("@md-code/follow-architecture/report/errorTypes/vocabulary/verbs");
|
|
12
|
+
const kinds_1 = require("@md-code/follow-architecture/entities/kinds");
|
|
13
|
+
const phrases_1 = require("@md-code/follow-architecture/report/errorTypes/vocabulary/phrases");
|
|
14
|
+
const field_1 = require("@md-code/follow-architecture/utils/field");
|
|
15
|
+
const read_field_1 = require("@md-code/follow-architecture/utils/read-field");
|
|
16
|
+
const qualified_1 = require("@md-code/follow-architecture/utils/qualified");
|
|
17
17
|
// The target a refused relation names: the exact path when the engine saw one,
|
|
18
18
|
// else the box's own path. `exact` says whether the path is a file or a pattern.
|
|
19
19
|
const targetPaths = (targetNode, targetPath, places) => {
|
|
@@ -45,7 +45,7 @@ const classify = (ctx, places) => {
|
|
|
45
45
|
to: [p.to],
|
|
46
46
|
line: (0, read_field_1.numberField)(violation, "line", 0) || null,
|
|
47
47
|
target: targetOf(targetNode, (0, read_field_1.stringField)(violation, "targetPath") || null, places),
|
|
48
|
-
actors: (0, read_field_1.stringListField)((0, field_1.fieldOf)(violation, "token"), "why.
|
|
48
|
+
actors: (0, read_field_1.stringListField)((0, field_1.fieldOf)(violation, "token"), "why.entities").filter(Boolean),
|
|
49
49
|
token: violation?.token ?? null,
|
|
50
50
|
}));
|
|
51
51
|
};
|
|
@@ -62,15 +62,15 @@ const fallbackMessage = (story, file) => {
|
|
|
62
62
|
};
|
|
63
63
|
const message = (story, ctx) => story.token?.fact ? (0, phrases_1.relationMessage)(story.token, { file: ctx.file }) : fallbackMessage(story, ctx.file);
|
|
64
64
|
exports.message = message;
|
|
65
|
-
// WHERE IT BELONGS — already decided by the decision maker, from code
|
|
65
|
+
// WHERE IT BELONGS — already decided by the decision maker, from code entities.
|
|
66
66
|
// Each place is one arrow and one line; the percentage is the decision's own
|
|
67
67
|
// confidence, so the reader sees why this box and not another.
|
|
68
68
|
const moveFixes = (story, them) => (story.destinations ?? []).map((place) => ({
|
|
69
69
|
code: "move",
|
|
70
|
-
text: `Move ${them} into \`${place.path}\` — that is where a \`${place.
|
|
70
|
+
text: `Move ${them} into \`${place.path}\` — that is where a \`${place.entity}\` lives (fit ${Math.round(place.confidence * 100)}%).`,
|
|
71
71
|
to: [place.node],
|
|
72
72
|
}));
|
|
73
|
-
// The repair for a write with no destination: the code must leave, but no
|
|
73
|
+
// The repair for a write with no destination: the code must leave, but no entity
|
|
74
74
|
// owns it here, so the repair only marks the code that has to go.
|
|
75
75
|
const writeOutFix = (them, plural, from) => ({
|
|
76
76
|
code: "move",
|
|
@@ -96,7 +96,12 @@ const fixes = (story, ctx) => {
|
|
|
96
96
|
else if (touched) {
|
|
97
97
|
// `from` is what a removal POINTS AT: the box whose code goes away. The
|
|
98
98
|
// picture marks it, so a sentence with "Remove" is never drawn as nothing.
|
|
99
|
-
out.push({
|
|
99
|
+
out.push({
|
|
100
|
+
code: "remove",
|
|
101
|
+
text: `Remove the ${noun} of \`${touched}\` from \`${ctx.file}\` — this relation is not allowed here.`,
|
|
102
|
+
to: [],
|
|
103
|
+
from: story.from,
|
|
104
|
+
});
|
|
100
105
|
}
|
|
101
106
|
return out;
|
|
102
107
|
};
|
|
@@ -114,7 +119,7 @@ const tokenStory = (token, targetPath) => {
|
|
|
114
119
|
to: [],
|
|
115
120
|
line: null,
|
|
116
121
|
target: { node: (0, read_field_1.stringField)(why, "targetNode") || null, paths, exact: Boolean(targetPath) },
|
|
117
|
-
actors: (0, read_field_1.stringListField)(why, "
|
|
122
|
+
actors: (0, read_field_1.stringListField)(why, "entities"),
|
|
118
123
|
token,
|
|
119
124
|
};
|
|
120
125
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { WRONG_PLACEMENT } from "
|
|
2
|
-
import type { WrongPlacementStory } from "
|
|
3
|
-
import type { DecisionCtx } from "
|
|
4
|
-
import type { StatedRepair } from "
|
|
1
|
+
import { WRONG_PLACEMENT } from "@md-code/follow-architecture/report/errorTypes/vocabulary/ids";
|
|
2
|
+
import type { WrongPlacementStory } from "@md-code/follow-architecture/entities/story";
|
|
3
|
+
import type { DecisionCtx } from "@md-code/follow-architecture/entities/overview/decision";
|
|
4
|
+
import type { StatedRepair } from "@md-code/follow-architecture/entities/repair";
|
|
5
5
|
declare const classify: (ctx: DecisionCtx) => WrongPlacementStory | null;
|
|
6
6
|
declare const message: () => null;
|
|
7
7
|
declare const fixes: (story: WrongPlacementStory, ctx: DecisionCtx) => StatedRepair[];
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.fixes = exports.message = exports.classify = exports.label = exports.id = void 0;
|
|
4
4
|
// The code sits where it may not: one destination (move) or many (split).
|
|
5
5
|
// Repairs are objects `{ code, text, to }` — the picture draws `to`.
|
|
6
|
-
const ids_1 = require("
|
|
6
|
+
const ids_1 = require("@md-code/follow-architecture/report/errorTypes/vocabulary/ids");
|
|
7
7
|
Object.defineProperty(exports, "id", { enumerable: true, get: function () { return ids_1.WRONG_PLACEMENT; } });
|
|
8
8
|
// The destination is the STRUCTURED one the producer stated (`fix.location` →
|
|
9
9
|
// `plan.after`, a violation's `destination`), never a path scraped out of the
|
|
@@ -21,8 +21,8 @@ const classify = (ctx) => {
|
|
|
21
21
|
shape: "move",
|
|
22
22
|
from: before,
|
|
23
23
|
to: [to],
|
|
24
|
-
//
|
|
25
|
-
|
|
24
|
+
// A rule states a rule; a folder walk states where this file goes.
|
|
25
|
+
rule: ctx.rule ?? null,
|
|
26
26
|
};
|
|
27
27
|
};
|
|
28
28
|
exports.classify = classify;
|
|
@@ -31,24 +31,34 @@ const message = () => null;
|
|
|
31
31
|
exports.message = message;
|
|
32
32
|
const splitFix = (story, from, to) => {
|
|
33
33
|
if (to.length === 1) {
|
|
34
|
-
return {
|
|
34
|
+
return {
|
|
35
|
+
code: "split",
|
|
36
|
+
to: story.to,
|
|
37
|
+
text: `Split the file: the code that belongs in ${to[0]} goes there, the rest stays in ${from} — one file may hold one entity.`,
|
|
38
|
+
};
|
|
35
39
|
}
|
|
36
40
|
return {
|
|
37
41
|
code: "split",
|
|
38
42
|
to: story.to,
|
|
39
|
-
text: `Split the file by
|
|
43
|
+
text: `Split the file by entity: the part that belongs in ${to.slice(0, -1).join(", ")} and ${to[to.length - 1]} moves there, the part that is allowed in ${from} stays — one file may hold one entity.`,
|
|
40
44
|
};
|
|
41
45
|
};
|
|
42
46
|
const fixes = (story, ctx) => {
|
|
43
47
|
const pathOf = (slug) => ctx.places.pathOf(slug);
|
|
44
48
|
const from = `\`${pathOf(story.from ?? "")}\``;
|
|
45
49
|
const to = story.to.map((slug) => `\`${pathOf(slug)}\``);
|
|
46
|
-
//
|
|
47
|
-
// spans folders (`one file, one
|
|
48
|
-
if (story.
|
|
50
|
+
// A rule cannot be satisfied by moving a file: it describes a rule that
|
|
51
|
+
// spans folders (`one file, one entity`), so the only repair is to divide it.
|
|
52
|
+
if (story.rule)
|
|
49
53
|
return [splitFix(story, from, to)];
|
|
50
54
|
if (story.shape === "split") {
|
|
51
|
-
return [
|
|
55
|
+
return [
|
|
56
|
+
{
|
|
57
|
+
code: "split",
|
|
58
|
+
to: story.to,
|
|
59
|
+
text: `Divide the file: each part goes to its own destination (${to.join(", ")}), and nothing stays in ${from}.`,
|
|
60
|
+
},
|
|
61
|
+
];
|
|
52
62
|
}
|
|
53
63
|
return [{ code: "move", to: story.to, text: `Move the whole file to ${to[0]} — nothing of it stays in ${from}.` }];
|
|
54
64
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
declare const __exported_WRONG_ACTION = "wrongAction";
|
|
2
2
|
declare const __exported_WRONG_PLACEMENT = "wrongPlacement";
|
|
3
|
-
declare const
|
|
3
|
+
declare const __exported_UNKNOWN_ENTITY = "unknownEntity";
|
|
4
4
|
declare const __exported_FILE_CONTENTS = "fileContents";
|
|
5
|
-
export { __exported_WRONG_ACTION as WRONG_ACTION, __exported_WRONG_PLACEMENT as WRONG_PLACEMENT,
|
|
5
|
+
export { __exported_WRONG_ACTION as WRONG_ACTION, __exported_WRONG_PLACEMENT as WRONG_PLACEMENT, __exported_UNKNOWN_ENTITY as UNKNOWN_ENTITY, __exported_FILE_CONTENTS as FILE_CONTENTS, };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FILE_CONTENTS = exports.
|
|
3
|
+
exports.FILE_CONTENTS = exports.UNKNOWN_ENTITY = exports.WRONG_PLACEMENT = exports.WRONG_ACTION = void 0;
|
|
4
4
|
// The ids shared by the report and the picture.
|
|
5
5
|
// a relation the architecture forbids
|
|
6
6
|
// the code is in the wrong place (move, or split between places)
|
|
@@ -10,7 +10,7 @@ const __exported_WRONG_ACTION = "wrongAction";
|
|
|
10
10
|
exports.WRONG_ACTION = __exported_WRONG_ACTION;
|
|
11
11
|
const __exported_WRONG_PLACEMENT = "wrongPlacement";
|
|
12
12
|
exports.WRONG_PLACEMENT = __exported_WRONG_PLACEMENT;
|
|
13
|
-
const
|
|
14
|
-
exports.
|
|
13
|
+
const __exported_UNKNOWN_ENTITY = "unknownEntity";
|
|
14
|
+
exports.UNKNOWN_ENTITY = __exported_UNKNOWN_ENTITY;
|
|
15
15
|
const __exported_FILE_CONTENTS = "fileContents";
|
|
16
16
|
exports.FILE_CONTENTS = __exported_FILE_CONTENTS;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type FieldValue } from "
|
|
2
|
-
import { article } from "
|
|
1
|
+
import { type FieldValue } from "@md-code/follow-architecture/utils/field";
|
|
2
|
+
import { article } from "@md-code/follow-architecture/utils/article";
|
|
3
3
|
declare const pluralize: (text: string) => string;
|
|
4
4
|
declare const factText: (fact: FieldValue) => string;
|
|
5
5
|
declare const subjectText: (subject: FieldValue, file: string) => string;
|
|
@@ -5,10 +5,10 @@ exports.article = exports.pluralize = exports.relationMessage = exports.whyText
|
|
|
5
5
|
// The fact is the engine's own (`entities/kinds` producers); the words here are
|
|
6
6
|
// the ONE spelling the text and the picture read. Every field is read through
|
|
7
7
|
// the shared field readers — a fact is plain data, never an `any`.
|
|
8
|
-
const kinds_1 = require("
|
|
9
|
-
const field_1 = require("
|
|
10
|
-
const read_field_1 = require("
|
|
11
|
-
const article_1 = require("
|
|
8
|
+
const kinds_1 = require("@md-code/follow-architecture/entities/kinds");
|
|
9
|
+
const field_1 = require("@md-code/follow-architecture/utils/field");
|
|
10
|
+
const read_field_1 = require("@md-code/follow-architecture/utils/read-field");
|
|
11
|
+
const article_1 = require("@md-code/follow-architecture/utils/article");
|
|
12
12
|
Object.defineProperty(exports, "article", { enumerable: true, get: function () { return article_1.article; } });
|
|
13
13
|
const q = (s) => (s == null ? "—" : `\`${s}\``);
|
|
14
14
|
const list = (xs) => xs.map(q).join(", ");
|
|
@@ -81,9 +81,9 @@ const callText = (fact) => `calls ${q((0, field_1.fieldOf)(fact, "action"))} of
|
|
|
81
81
|
const mutateText = (fact) => {
|
|
82
82
|
if ((0, read_field_1.booleanField)(fact, "onThis"))
|
|
83
83
|
return `changes ${q((0, field_1.fieldOf)(fact, "target"))} of its own file`;
|
|
84
|
-
const
|
|
85
|
-
if (
|
|
86
|
-
return `changes ${q((0, field_1.fieldOf)(fact, "target"))} of the ${q(
|
|
84
|
+
const ownerEntity = (0, field_1.fieldOf)(fact, "ownerEntity");
|
|
85
|
+
if (ownerEntity)
|
|
86
|
+
return `changes ${q((0, field_1.fieldOf)(fact, "target"))} of the ${q(ownerEntity)} (${q((0, field_1.fieldOf)(fact, "module"))})`;
|
|
87
87
|
return `changes ${q((0, field_1.fieldOf)(fact, "target"))} of ${q((0, field_1.fieldOf)(fact, "module"))}`;
|
|
88
88
|
};
|
|
89
89
|
const declareText = (fact) => {
|
|
@@ -92,7 +92,18 @@ const declareText = (fact) => {
|
|
|
92
92
|
return `re-declares ${q((0, field_1.fieldOf)(renames, "action"))} of ${q((0, field_1.fieldOf)(renames, "module"))}`;
|
|
93
93
|
return "is declared here";
|
|
94
94
|
};
|
|
95
|
-
|
|
95
|
+
// A named import names the SYMBOLS it takes (and the file that declares them):
|
|
96
|
+
// `imports `codeEditor` of `packages/styles/themes/editor.ts``. A module-level
|
|
97
|
+
// import keeps its one-word form.
|
|
98
|
+
const importText = (fact) => {
|
|
99
|
+
if ((0, read_field_1.stringField)(fact, "form") !== "statement")
|
|
100
|
+
return `requires ${q((0, field_1.fieldOf)(fact, "source"))}`;
|
|
101
|
+
const names = (0, field_1.fieldOf)(fact, "names");
|
|
102
|
+
const symbols = Array.isArray(names) ? names.filter((name) => typeof name === "string") : [];
|
|
103
|
+
return symbols.length
|
|
104
|
+
? `imports ${list(symbols)} of ${q((0, field_1.fieldOf)(fact, "resolved"))}`
|
|
105
|
+
: `imports ${q((0, field_1.fieldOf)(fact, "resolved"))}`;
|
|
106
|
+
};
|
|
96
107
|
const assignText = (fact) => {
|
|
97
108
|
const method = (0, field_1.fieldOf)(fact, "method");
|
|
98
109
|
return `writes into ${q((0, field_1.fieldOf)(fact, "target"))}${method ? ` through ${q(`${method}()`)}` : ""}`;
|
|
@@ -124,23 +135,23 @@ const factText = (fact) => {
|
|
|
124
135
|
return `does a \`${kind}\` the architecture does not describe`;
|
|
125
136
|
};
|
|
126
137
|
exports.factText = factText;
|
|
127
|
-
const
|
|
128
|
-
if (!
|
|
138
|
+
const entitiesSuffix = (entities) => {
|
|
139
|
+
if (!entities.length)
|
|
129
140
|
return "";
|
|
130
|
-
return
|
|
141
|
+
return entities.length === 1 ? ` (${entities[0]})` : ` (${entities.join(" / ")})`;
|
|
131
142
|
};
|
|
132
143
|
const subjectText = (subject, file) => {
|
|
133
|
-
const
|
|
134
|
-
const
|
|
135
|
-
const
|
|
144
|
+
const entityNames = (0, read_field_1.stringListField)(subject, "entities").filter(Boolean);
|
|
145
|
+
const entities = entityNames.map(q);
|
|
146
|
+
const entitiesPart = entitiesSuffix(entities);
|
|
136
147
|
if (!(0, field_1.isObj)(subject) || (0, read_field_1.booleanField)(subject, "scope")) {
|
|
137
|
-
return `the module scope of ${q(file)}${
|
|
148
|
+
return `the module scope of ${q(file)}${entitiesPart}`;
|
|
138
149
|
}
|
|
139
150
|
const pieces = (0, read_field_1.stringListField)(subject, "pieces").filter(Boolean).map(q);
|
|
140
151
|
if (!pieces.length)
|
|
141
|
-
return `the module scope of ${q(file)}${
|
|
142
|
-
const who =
|
|
143
|
-
return `${pieces.join(", ")}${who || " (which no
|
|
152
|
+
return `the module scope of ${q(file)}${entitiesPart}`;
|
|
153
|
+
const who = entityNames.length === 1 ? ` (${(0, article_1.article)(entityNames[0])} ${q(entityNames[0])})` : entitiesPart;
|
|
154
|
+
return `${pieces.join(", ")}${who || " (which no entity describes)"}`;
|
|
144
155
|
};
|
|
145
156
|
exports.subjectText = subjectText;
|
|
146
157
|
// WHY it is refused — a code from the engine, not a sentence.
|
|
@@ -149,19 +160,21 @@ const whyText = (why) => {
|
|
|
149
160
|
return "it is not allowed";
|
|
150
161
|
if ((0, read_field_1.stringField)(why, "code") === "silent")
|
|
151
162
|
return "nothing in the architecture allows it";
|
|
152
|
-
const same = new Set((0, read_field_1.stringListField)(why, "
|
|
153
|
-
//
|
|
154
|
-
// limit the sentence reads as "this
|
|
163
|
+
const same = new Set((0, read_field_1.stringListField)(why, "sameEntities"));
|
|
164
|
+
// An entity the rule limits to the SAME feature instance says so: without the
|
|
165
|
+
// limit the sentence reads as "this entity may not do it at all", which is the
|
|
155
166
|
// opposite of what the architecture declares.
|
|
156
|
-
const
|
|
157
|
-
|
|
167
|
+
const entities = (0, read_field_1.stringListField)(why, "entities")
|
|
168
|
+
.filter(Boolean)
|
|
169
|
+
.map((r) => (same.has(r) ? `${q(r)} in the same feature` : q(r)));
|
|
170
|
+
// The entity DOES allow the call — what it refuses is the value handed over.
|
|
158
171
|
if ((0, read_field_1.booleanField)(why, "outward"))
|
|
159
172
|
return "that value may not be handed to it";
|
|
160
|
-
if (!
|
|
173
|
+
if (!entities.length)
|
|
161
174
|
return (0, read_field_1.stringField)(why, "code") === "nobody" ? "no code may do it" : "it is not allowed";
|
|
162
175
|
if ((0, read_field_1.booleanField)(why, "self"))
|
|
163
|
-
return `only ${
|
|
164
|
-
return `only ${
|
|
176
|
+
return `only ${entities.join(", ")} may do it`;
|
|
177
|
+
return `only ${entities.join(", ")} may do it with ${q((0, field_1.fieldOf)(why, "targetNode"))} code`;
|
|
165
178
|
};
|
|
166
179
|
exports.whyText = whyText;
|
|
167
180
|
// The one sentence a refused relation gets.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Arch } from "
|
|
2
|
-
import type { NodeSummary } from "
|
|
3
|
-
import type { Places } from "
|
|
1
|
+
import type { Arch } from "@md-code/follow-architecture/entities/architecture";
|
|
2
|
+
import type { NodeSummary } from "@md-code/follow-architecture/entities/overview/summaries";
|
|
3
|
+
import type { Places } from "@md-code/follow-architecture/entities/overview/decision";
|
|
4
4
|
declare const make: ({ nodes, arch }: {
|
|
5
5
|
nodes: NodeSummary[];
|
|
6
6
|
arch: Arch;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.make = void 0;
|
|
4
|
-
// Engine names → report names:
|
|
4
|
+
// Engine names → report names: entity → box, place → node.
|
|
5
5
|
// ONE source for every place question. `homeFor`, `nodeAtPath`, `homeTemplates`
|
|
6
6
|
// and `pathOf` used to be spelled again here, in a second wording, next to the
|
|
7
7
|
// real ones in `entities/location.js` — the report and the engine then disagreed
|
|
8
|
-
// about where
|
|
9
|
-
const location_1 = require("
|
|
8
|
+
// about where an entity lives. This file only NAMES things now.
|
|
9
|
+
const location_1 = require("@md-code/follow-architecture/entities/location");
|
|
10
10
|
const make = ({ nodes, arch }) => {
|
|
11
11
|
const folderOf = (slug) => {
|
|
12
12
|
if (!slug)
|
|
@@ -17,20 +17,20 @@ const make = ({ nodes, arch }) => {
|
|
|
17
17
|
};
|
|
18
18
|
// A node slug as the path a human recognises.
|
|
19
19
|
const pathOf = (slug) => nodes.find((n) => n.slug === slug)?.paths?.[0] ?? slug;
|
|
20
|
-
// EVERY
|
|
21
|
-
//
|
|
22
|
-
const
|
|
23
|
-
//
|
|
20
|
+
// EVERY entity that declares a place — the set a destination decision chooses
|
|
21
|
+
// from: everything the tree says could be here.
|
|
22
|
+
const entities = () => Object.keys(arch.nodes.entityHomes);
|
|
23
|
+
// Entities whose declared home covers this path, most specific first: what this
|
|
24
24
|
// file already IS, according to the tree.
|
|
25
|
-
const
|
|
26
|
-
// The path templates
|
|
27
|
-
const homeTemplates = (
|
|
28
|
-
// Where this
|
|
25
|
+
const entitiesAtPath = (rel) => (0, location_1.entitiesAtPath)(arch, rel);
|
|
26
|
+
// The path templates an entity declares (`…/constants.ts`, `…/actions/**`).
|
|
27
|
+
const homeTemplates = (entity) => (0, location_1.homesOf)(arch, entity).map((h) => h.template);
|
|
28
|
+
// Where this entity's code belongs FOR THIS FILE, and the box that hosts it —
|
|
29
29
|
// the engine's own answer, never a folder invented here.
|
|
30
|
-
const homeFor = (
|
|
30
|
+
const homeFor = (entity, rel) => (0, location_1.homeForEntity)(arch, entity, rel);
|
|
31
31
|
// The box that HOLDS a path — `apps/backend/document/store.ts` → the node that
|
|
32
32
|
// owns `apps/backend/document`.
|
|
33
33
|
const nodeAtPath = (path) => (0, location_1.boxOfPlace)(arch, path);
|
|
34
|
-
return { folderOf, pathOf,
|
|
34
|
+
return { folderOf, pathOf, entities, entitiesAtPath, homeTemplates, homeFor, nodeAtPath };
|
|
35
35
|
};
|
|
36
36
|
exports.make = make;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { substitute, type TemplateVars } from "
|
|
2
|
-
import type { FindingFrom } from "
|
|
3
|
-
import type { ReportObject } from "
|
|
1
|
+
import { substitute, type TemplateVars } from "@md-code/follow-architecture/utils/template";
|
|
2
|
+
import type { FindingFrom } from "@md-code/follow-architecture/entities/findings";
|
|
3
|
+
import type { ReportObject } from "@md-code/follow-architecture/entities/architecture";
|
|
4
4
|
declare const renderSpec: (spec: ReportObject | string, vars: TemplateVars) => {
|
|
5
5
|
message: string | null;
|
|
6
6
|
fix: string | null;
|
|
@@ -10,11 +10,11 @@ exports.substitute = exports.renderSpec = exports.findingFrom = void 0;
|
|
|
10
10
|
// The report spec is the engine's own (`ReportObject`); the substitution is the
|
|
11
11
|
// shared template walk; the repair shape is the ONE contract in entities/repair.
|
|
12
12
|
const asks_1 = require("./asks");
|
|
13
|
-
const template_1 = require("
|
|
13
|
+
const template_1 = require("@md-code/follow-architecture/utils/template");
|
|
14
14
|
Object.defineProperty(exports, "substitute", { enumerable: true, get: function () { return template_1.substitute; } });
|
|
15
|
-
const field_1 = require("
|
|
16
|
-
const read_field_1 = require("
|
|
17
|
-
const resolve_1 = require("
|
|
15
|
+
const field_1 = require("@md-code/follow-architecture/utils/field");
|
|
16
|
+
const read_field_1 = require("@md-code/follow-architecture/utils/read-field");
|
|
17
|
+
const resolve_1 = require("@md-code/follow-architecture/utils/resolve");
|
|
18
18
|
// The fix text a spec states: a bare string, or the structured `{ message }`.
|
|
19
19
|
const fixTextOf = (spec) => {
|
|
20
20
|
const fix = spec.fix;
|
|
@@ -27,7 +27,10 @@ const renderSpec = (spec, vars) => {
|
|
|
27
27
|
return { message: (0, template_1.substitute)(spec, vars), fix: null };
|
|
28
28
|
const message = spec.description ?? spec.message ?? null;
|
|
29
29
|
const fixText = fixTextOf(spec);
|
|
30
|
-
return {
|
|
30
|
+
return {
|
|
31
|
+
message: message != null ? (0, template_1.substitute)(message, vars) : null,
|
|
32
|
+
fix: fixText != null ? (0, template_1.substitute)(fixText, vars) : null,
|
|
33
|
+
};
|
|
31
34
|
};
|
|
32
35
|
exports.renderSpec = renderSpec;
|
|
33
36
|
// The spec a finding item carries: an explicit `report`, or the legacy flat
|
|
@@ -46,14 +49,14 @@ const specOf = (item) => {
|
|
|
46
49
|
// The place a spec names: `place` (already resolved) or `path`, never parsed
|
|
47
50
|
// out of the sentence. A string spec names no place.
|
|
48
51
|
const placeOf = (spec) => (0, resolve_1.resolveReference)(spec, (s) => (typeof s === "string" ? null : s), (s) => s.place ?? s.path ?? null);
|
|
49
|
-
// The finding's identity and subject: what it is about, and which
|
|
52
|
+
// The finding's identity and subject: what it is about, and which entity.
|
|
50
53
|
const subjectOf = (item, key, vars) => ({
|
|
51
54
|
what: (0, read_field_1.stringField)(vars, "what") || null,
|
|
52
|
-
|
|
55
|
+
entity: /^entity:([^:]+)/.exec(key)?.[1] ?? item.entity ?? null,
|
|
53
56
|
});
|
|
54
57
|
// The message and fix sentences a finding carries: the rendered spec's, or the
|
|
55
58
|
// run's own vars, or the fallback.
|
|
56
|
-
const scopeOf = (vars, place) =>
|
|
59
|
+
const scopeOf = (vars, place) => place ? { ...vars, destination: place } : vars;
|
|
57
60
|
const sentencesOf = (item, vars) => {
|
|
58
61
|
const spec = specOf(item);
|
|
59
62
|
const place = placeOf(spec);
|
|
@@ -68,7 +71,9 @@ const sentencesOf = (item, vars) => {
|
|
|
68
71
|
// The evidence bag with the stated repair attached — the SAME object the CLI
|
|
69
72
|
// prints and the picture draws.
|
|
70
73
|
const dataOf = (item, spec, fix, place) => {
|
|
71
|
-
const stated = spec != null
|
|
74
|
+
const stated = spec != null
|
|
75
|
+
? (0, asks_1.repair)({ code: spec.code ?? spec.ask, fix }, { to: spec.to ?? [], from: spec.from ?? null, path: place })
|
|
76
|
+
: null;
|
|
72
77
|
const evidence = (0, field_1.isObj)(item.data) ? item.data : null;
|
|
73
78
|
return stated ? { ...(evidence ?? {}), repair: { ...stated, text: fix } } : evidence;
|
|
74
79
|
};
|
package/dist/report/notices.d.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
declare const notice: (subject: string, reason: string) => string;
|
|
2
|
+
declare const beginNotices: () => {
|
|
3
|
+
lines: string[];
|
|
4
|
+
end: () => string[];
|
|
5
|
+
};
|
|
6
|
+
declare const replayNotices: (lines: readonly string[] | null | undefined) => void;
|
|
2
7
|
declare const takeNotices: () => string[];
|
|
3
8
|
declare const resetNotices: () => void;
|
|
4
|
-
export { notice, takeNotices, resetNotices };
|
|
9
|
+
export { notice, beginNotices, replayNotices, takeNotices, resetNotices };
|