@md-code/follow-architecture 0.1.1 → 0.3.2
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 +37 -0
- package/LICENSE +202 -0
- package/README.md +1420 -139
- package/dist/aliases.d.ts +3 -0
- package/dist/aliases.js +12 -0
- package/dist/args.d.ts +18 -0
- package/dist/args.js +94 -0
- package/dist/bin/follow-architecture.d.ts +2 -0
- package/dist/bin/follow-architecture.js +23 -0
- package/dist/closure-project.d.ts +4 -0
- package/dist/closure-project.js +132 -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-entities/entities.js +227 -0
- package/dist/code-entities/project.d.ts +21 -0
- package/dist/code-entities/project.js +259 -0
- package/dist/code-entities/walk.d.ts +31 -0
- package/dist/code-entities/walk.js +105 -0
- package/dist/config-options.d.ts +76 -0
- package/dist/config-options.js +52 -0
- package/dist/config-project.d.ts +4 -0
- package/dist/config-project.js +92 -0
- package/dist/config-report.d.ts +19 -0
- package/dist/config-report.js +161 -0
- package/dist/config-rule.d.ts +95 -0
- package/dist/config-rule.js +211 -0
- package/dist/config-state.d.ts +25 -0
- package/dist/config-state.js +269 -0
- package/dist/config.d.ts +107 -0
- package/dist/config.js +38 -0
- package/dist/css/index.d.ts +31 -0
- package/dist/css/index.js +251 -0
- package/dist/css/syntax/css/gate.d.ts +2 -0
- package/dist/css/syntax/css/gate.js +69 -0
- package/dist/css/syntax/css/index.d.ts +7 -0
- package/dist/css/syntax/css/index.js +51 -0
- package/dist/css/syntax/css/reference.d.ts +3 -0
- package/dist/css/syntax/css/reference.js +36 -0
- package/dist/css/syntax/language.d.ts +25 -0
- package/dist/css/syntax/language.js +81 -0
- package/dist/css/syntax/scss/index.d.ts +25 -0
- package/dist/css/syntax/scss/index.js +95 -0
- package/dist/css/syntax/scss/reference.d.ts +3 -0
- package/dist/css/syntax/scss/reference.js +17 -0
- package/dist/css/syntax/styled/document.d.ts +68 -0
- package/dist/css/syntax/styled/document.js +261 -0
- package/dist/css/syntax/styled/markup.d.ts +6 -0
- package/dist/css/syntax/styled/markup.js +84 -0
- 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.d.ts +23 -0
- package/dist/css/syntax/styled/template.js +67 -0
- package/dist/css/syntax/tailwind/tailwind-engine.d.ts +23 -0
- package/dist/css/syntax/tailwind/tailwind-engine.js +37 -0
- package/dist/css/syntax/tailwind/tailwind.d.ts +26 -0
- package/dist/css/syntax/tailwind/tailwind.js +118 -0
- package/dist/css/value/check.d.ts +86 -0
- package/dist/css/value/check.js +122 -0
- package/dist/css/value/expression/arithmetic.d.ts +7 -0
- package/dist/css/value/expression/arithmetic.js +73 -0
- package/dist/css/value/expression/block.d.ts +9 -0
- package/dist/css/value/expression/block.js +92 -0
- package/dist/css/value/expression/conditional.d.ts +8 -0
- package/dist/css/value/expression/conditional.js +53 -0
- package/dist/css/value/expression/index.d.ts +5 -0
- package/dist/css/value/expression/index.js +73 -0
- package/dist/css/value/expression/map.d.ts +7 -0
- package/dist/css/value/expression/map.js +113 -0
- package/dist/css/value/object/index.d.ts +5 -0
- package/dist/css/value/object/index.js +113 -0
- package/dist/css/value/object/members.d.ts +7 -0
- package/dist/css/value/object/members.js +103 -0
- package/dist/css/value/object/node.d.ts +8 -0
- package/dist/css/value/object/node.js +134 -0
- package/dist/css/value/object/path.d.ts +10 -0
- package/dist/css/value/object/path.js +152 -0
- package/dist/css/value/pieces.d.ts +61 -0
- package/dist/css/value/pieces.js +65 -0
- package/dist/css/value/resolve.d.ts +33 -0
- package/dist/css/value/resolve.js +104 -0
- package/dist/css/value/scope.d.ts +28 -0
- package/dist/css/value/scope.js +205 -0
- package/dist/css/value/substitute.d.ts +10 -0
- package/dist/css/value/substitute.js +145 -0
- package/dist/css/value/values.d.ts +23 -0
- package/dist/css/value/values.js +131 -0
- package/dist/entities/architecture.d.ts +165 -0
- package/dist/entities/architecture.js +2 -0
- package/dist/entities/ast/assignments-nodes.d.ts +10 -0
- package/dist/entities/ast/assignments-nodes.js +64 -0
- package/dist/entities/ast/assignments-raw.d.ts +6 -0
- package/dist/entities/ast/assignments-raw.js +139 -0
- package/dist/entities/ast/assignments-tagged.d.ts +5 -0
- package/dist/entities/ast/assignments-tagged.js +195 -0
- package/dist/entities/ast/assignments.d.ts +9 -0
- package/dist/entities/ast/assignments.js +80 -0
- package/dist/entities/ast/branches.d.ts +4 -0
- package/dist/entities/ast/branches.js +32 -0
- package/dist/entities/ast/calls.d.ts +6 -0
- package/dist/entities/ast/calls.js +150 -0
- package/dist/entities/ast/classes.d.ts +5 -0
- package/dist/entities/ast/classes.js +61 -0
- package/dist/entities/ast/climb.d.ts +12 -0
- package/dist/entities/ast/climb.js +17 -0
- package/dist/entities/ast/comments.d.ts +5 -0
- package/dist/entities/ast/comments.js +130 -0
- package/dist/entities/ast/declaration.d.ts +4 -0
- package/dist/entities/ast/declaration.js +26 -0
- package/dist/entities/ast/depth.d.ts +17 -0
- package/dist/entities/ast/depth.js +166 -0
- package/dist/entities/ast/enums.d.ts +6 -0
- package/dist/entities/ast/enums.js +17 -0
- 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 +7 -0
- package/dist/entities/ast/file-exports.js +101 -0
- package/dist/entities/ast/file-facts.d.ts +16 -0
- package/dist/entities/ast/file-facts.js +64 -0
- package/dist/entities/ast/file-imports.d.ts +5 -0
- package/dist/entities/ast/file-imports.js +100 -0
- package/dist/entities/ast/file.d.ts +5 -0
- package/dist/entities/ast/file.js +23 -0
- package/dist/entities/ast/functions.d.ts +8 -0
- package/dist/entities/ast/functions.js +111 -0
- package/dist/entities/ast/heritage.d.ts +4 -0
- package/dist/entities/ast/heritage.js +44 -0
- package/dist/entities/ast/index.d.ts +9 -0
- package/dist/entities/ast/index.js +181 -0
- package/dist/entities/ast/kind.d.ts +5 -0
- package/dist/entities/ast/kind.js +34 -0
- package/dist/entities/ast/loose.d.ts +37 -0
- package/dist/entities/ast/loose.js +2 -0
- package/dist/entities/ast/modifiers.d.ts +5 -0
- package/dist/entities/ast/modifiers.js +32 -0
- package/dist/entities/ast/project.d.ts +9 -0
- package/dist/entities/ast/project.js +106 -0
- package/dist/entities/ast/properties.d.ts +11 -0
- package/dist/entities/ast/properties.js +176 -0
- package/dist/entities/ast/resolve.d.ts +16 -0
- package/dist/entities/ast/resolve.js +317 -0
- package/dist/entities/ast/tree.d.ts +31 -0
- package/dist/entities/ast/tree.js +518 -0
- package/dist/entities/ast/types.d.ts +6 -0
- package/dist/entities/ast/types.js +46 -0
- package/dist/entities/ast/usage.d.ts +11 -0
- package/dist/entities/ast/usage.js +81 -0
- package/dist/entities/ast/variables.d.ts +8 -0
- package/dist/entities/ast/variables.js +91 -0
- package/dist/entities/context.d.ts +29 -0
- package/dist/entities/context.js +2 -0
- package/dist/entities/facts.d.ts +284 -0
- package/dist/entities/facts.js +2 -0
- package/dist/entities/findings.d.ts +19 -0
- package/dist/entities/findings.js +2 -0
- package/dist/entities/kinds.d.ts +40 -0
- package/dist/entities/kinds.js +332 -0
- package/dist/entities/location/homes.d.ts +28 -0
- package/dist/entities/location/homes.js +195 -0
- package/dist/entities/location/place.d.ts +10 -0
- package/dist/entities/location/place.js +63 -0
- package/dist/entities/location/where.d.ts +19 -0
- package/dist/entities/location/where.js +277 -0
- package/dist/entities/location.d.ts +16 -0
- package/dist/entities/location.js +140 -0
- package/dist/entities/operators.d.ts +14 -0
- package/dist/entities/operators.js +30 -0
- package/dist/entities/overview/data.d.ts +43 -0
- package/dist/entities/overview/data.js +2 -0
- package/dist/entities/overview/decision.d.ts +60 -0
- package/dist/entities/overview/decision.js +2 -0
- package/dist/entities/overview/file-tree.d.ts +10 -0
- package/dist/entities/overview/file-tree.js +2 -0
- package/dist/entities/overview/finding.d.ts +58 -0
- package/dist/entities/overview/finding.js +2 -0
- package/dist/entities/overview/graph.d.ts +82 -0
- package/dist/entities/overview/graph.js +2 -0
- package/dist/entities/overview/input.d.ts +15 -0
- package/dist/entities/overview/input.js +2 -0
- package/dist/entities/overview/summaries.d.ts +81 -0
- package/dist/entities/overview/summaries.js +2 -0
- package/dist/entities/place.d.ts +5 -0
- package/dist/entities/place.js +2 -0
- package/dist/entities/queries.d.ts +9 -0
- package/dist/entities/queries.js +375 -0
- package/dist/entities/repair.d.ts +16 -0
- package/dist/entities/repair.js +29 -0
- package/dist/entities/schema.d.ts +22 -0
- package/dist/entities/schema.js +81 -0
- package/dist/entities/story.d.ts +47 -0
- package/dist/entities/story.js +2 -0
- package/dist/entities/structure-facts.d.ts +11 -0
- package/dist/entities/structure-facts.js +2 -0
- package/dist/entities/token.d.ts +23 -0
- package/dist/entities/token.js +2 -0
- package/dist/entities/tree/build.d.ts +6 -0
- package/dist/entities/tree/build.js +313 -0
- package/dist/entities/tree/entries.d.ts +7 -0
- package/dist/entities/tree/entries.js +145 -0
- package/dist/entities/tree/index.d.ts +6 -0
- package/dist/entities/tree/index.js +21 -0
- package/dist/entities/tree/match.d.ts +17 -0
- package/dist/entities/tree/match.js +190 -0
- 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 +242 -0
- package/dist/fa-store.d.ts +22 -0
- package/dist/fa-store.js +232 -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 +297 -0
- package/dist/frameworks/angular/index.d.ts +7 -0
- package/dist/frameworks/angular/index.js +18 -0
- package/dist/frameworks/facet.d.ts +18 -0
- package/dist/frameworks/facet.js +15 -0
- package/dist/frameworks/index.d.ts +9 -0
- package/dist/frameworks/index.js +134 -0
- package/dist/frameworks/react/index.d.ts +7 -0
- package/dist/frameworks/react/index.js +237 -0
- package/dist/frameworks/test/index.d.ts +6 -0
- package/dist/frameworks/test/index.js +157 -0
- package/dist/frameworks/vue/index.d.ts +7 -0
- package/dist/frameworks/vue/index.js +18 -0
- package/dist/ignore.d.ts +3 -0
- package/dist/ignore.js +62 -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 +219 -0
- package/dist/main.d.ts +10 -0
- package/dist/main.js +411 -0
- package/dist/nodes/child-entities.d.ts +3 -0
- package/dist/nodes/child-entities.js +12 -0
- package/dist/nodes/children.d.ts +25 -0
- package/dist/nodes/children.js +165 -0
- package/dist/nodes/finally/emit.d.ts +6 -0
- package/dist/nodes/finally/emit.js +71 -0
- package/dist/nodes/finally/entities.d.ts +13 -0
- package/dist/nodes/finally/entities.js +42 -0
- package/dist/nodes/finally/index.d.ts +8 -0
- package/dist/nodes/finally/index.js +35 -0
- package/dist/nodes/finally/queries.d.ts +5 -0
- package/dist/nodes/finally/queries.js +25 -0
- package/dist/nodes/finally/relations-access.d.ts +5 -0
- package/dist/nodes/finally/relations-access.js +50 -0
- package/dist/nodes/finally/relations-edge.d.ts +29 -0
- package/dist/nodes/finally/relations-edge.js +148 -0
- package/dist/nodes/finally/relations-group.d.ts +31 -0
- package/dist/nodes/finally/relations-group.js +106 -0
- package/dist/nodes/finally/relations.d.ts +5 -0
- package/dist/nodes/finally/relations.js +85 -0
- package/dist/nodes/finally/required.d.ts +5 -0
- package/dist/nodes/finally/required.js +92 -0
- package/dist/nodes/finally/violation.d.ts +17 -0
- package/dist/nodes/finally/violation.js +2 -0
- package/dist/nodes/similar.d.ts +21 -0
- package/dist/nodes/similar.js +178 -0
- package/dist/piece-forms.d.ts +9 -0
- package/dist/piece-forms.js +68 -0
- package/dist/pipeline-entities.d.ts +6 -0
- package/dist/pipeline-entities.js +79 -0
- package/dist/pipeline-facts.d.ts +12 -0
- package/dist/pipeline-facts.js +114 -0
- package/dist/pipeline-unclassified.d.ts +14 -0
- package/dist/pipeline-unclassified.js +188 -0
- package/dist/pipeline.d.ts +7 -0
- package/dist/pipeline.js +28 -0
- package/dist/plugin.d.ts +2 -0
- package/dist/plugin.js +3 -0
- package/dist/release-file.d.ts +3 -0
- package/dist/release-file.js +13 -0
- package/dist/report/asks.d.ts +55 -0
- package/dist/report/asks.js +60 -0
- package/dist/report/cli-report.d.ts +2 -0
- package/dist/report/cli-report.js +13 -0
- package/dist/report/config-error-guard.d.ts +8 -0
- package/dist/report/config-error-guard.js +5 -0
- package/dist/report/configErrors.d.ts +126 -0
- package/dist/report/configErrors.js +121 -0
- package/dist/report/errorTypes/codes/structure.d.ts +15 -0
- package/dist/report/errorTypes/codes/structure.js +76 -0
- package/dist/report/errorTypes/decision-maker.d.ts +23 -0
- package/dist/report/errorTypes/decision-maker.js +109 -0
- package/dist/report/errorTypes/destinations.d.ts +38 -0
- package/dist/report/errorTypes/destinations.js +165 -0
- package/dist/report/errorTypes/finding-type.d.ts +11 -0
- package/dist/report/errorTypes/finding-type.js +2 -0
- package/dist/report/errorTypes/index.d.ts +15 -0
- package/dist/report/errorTypes/index.js +55 -0
- package/dist/report/errorTypes/types/fileContents.d.ts +9 -0
- package/dist/report/errorTypes/types/fileContents.js +40 -0
- package/dist/report/errorTypes/types/unknownEntity.d.ts +9 -0
- package/dist/report/errorTypes/types/unknownEntity.js +27 -0
- package/dist/report/errorTypes/types/wrongAction.d.ts +22 -0
- package/dist/report/errorTypes/types/wrongAction.js +140 -0
- package/dist/report/errorTypes/types/wrongPlacement.d.ts +9 -0
- package/dist/report/errorTypes/types/wrongPlacement.js +67 -0
- package/dist/report/errorTypes/vocabulary/ids.d.ts +5 -0
- package/dist/report/errorTypes/vocabulary/ids.js +16 -0
- package/dist/report/errorTypes/vocabulary/phrases.d.ts +10 -0
- package/dist/report/errorTypes/vocabulary/phrases.js +187 -0
- package/dist/report/errorTypes/vocabulary/places.d.ts +8 -0
- package/dist/report/errorTypes/vocabulary/places.js +36 -0
- package/dist/report/errorTypes/vocabulary/verbs.d.ts +7 -0
- package/dist/report/errorTypes/vocabulary/verbs.js +30 -0
- package/dist/report/finding-from.d.ts +9 -0
- package/dist/report/finding-from.js +108 -0
- package/dist/report/notices.d.ts +9 -0
- package/dist/report/notices.js +57 -0
- package/dist/report/observed.d.ts +19 -0
- package/dist/report/observed.js +87 -0
- package/dist/report/render-report.d.ts +12 -0
- package/dist/report/render-report.js +145 -0
- package/dist/report/user-report/build/bundle.d.ts +3 -0
- package/dist/report/user-report/build/bundle.js +188 -0
- package/dist/report/user-report/build/bundle.prebuilt.js +1262 -0
- package/dist/report/user-report/data/collect.d.ts +4 -0
- package/dist/report/user-report/data/collect.js +93 -0
- package/dist/report/user-report/data/entities.d.ts +7 -0
- package/dist/report/user-report/data/entities.js +88 -0
- package/dist/report/user-report/data/entity-examples.d.ts +16 -0
- package/dist/report/user-report/data/entity-examples.js +136 -0
- package/dist/report/user-report/data/entity-filters.d.ts +15 -0
- package/dist/report/user-report/data/entity-filters.js +79 -0
- package/dist/report/user-report/data/entity-marks.d.ts +5 -0
- package/dist/report/user-report/data/entity-marks.js +79 -0
- package/dist/report/user-report/data/file-tree.d.ts +9 -0
- package/dist/report/user-report/data/file-tree.js +80 -0
- package/dist/report/user-report/data/finding-boundary.d.ts +9 -0
- package/dist/report/user-report/data/finding-boundary.js +21 -0
- package/dist/report/user-report/data/finding-plan.d.ts +16 -0
- package/dist/report/user-report/data/finding-plan.js +45 -0
- package/dist/report/user-report/data/finding-title.d.ts +12 -0
- package/dist/report/user-report/data/finding-title.js +36 -0
- package/dist/report/user-report/data/findings.d.ts +10 -0
- package/dist/report/user-report/data/findings.js +181 -0
- package/dist/report/user-report/data/graph-edges.d.ts +19 -0
- package/dist/report/user-report/data/graph-edges.js +109 -0
- 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 +7 -0
- package/dist/report/user-report/data/graph-helpers.js +67 -0
- package/dist/report/user-report/data/graph.d.ts +12 -0
- package/dist/report/user-report/data/graph.js +97 -0
- package/dist/report/user-report/data/nodes.d.ts +11 -0
- package/dist/report/user-report/data/nodes.js +116 -0
- package/dist/report/user-report/data/rules.d.ts +7 -0
- package/dist/report/user-report/data/rules.js +62 -0
- package/dist/report/user-report/data/scan.d.ts +8 -0
- package/dist/report/user-report/data/scan.js +69 -0
- package/dist/report/user-report/html/shell.d.ts +3 -0
- package/dist/report/user-report/html/shell.js +27 -0
- package/dist/report/user-report/index.d.ts +8 -0
- package/dist/report/user-report/index.js +58 -0
- package/dist/report/user-report/shared/describe.d.ts +7 -0
- package/dist/report/user-report/shared/describe.js +86 -0
- package/dist/rules/index.d.ts +7 -0
- package/dist/rules/index.js +327 -0
- package/dist/rules/list-vars.d.ts +5 -0
- package/dist/rules/list-vars.js +149 -0
- package/dist/rules/name.d.ts +16 -0
- package/dist/rules/name.js +18 -0
- package/dist/rules/normalize.d.ts +5 -0
- package/dist/rules/normalize.js +108 -0
- package/dist/rules/vars.d.ts +22 -0
- package/dist/rules/vars.js +117 -0
- package/dist/scan-run.d.ts +20 -0
- package/dist/scan-run.js +130 -0
- package/dist/scripts/audit-report.d.ts +2 -0
- package/dist/scripts/audit-report.js +157 -0
- package/dist/usage-index.d.ts +4 -0
- package/dist/usage-index.js +282 -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 +264 -0
- package/dist/utils/accumulate.d.ts +6 -0
- package/dist/utils/accumulate.js +18 -0
- package/dist/utils/aliases.d.ts +22 -0
- package/dist/utils/aliases.js +173 -0
- package/dist/utils/article.d.ts +2 -0
- package/dist/utils/article.js +12 -0
- package/dist/utils/classify.d.ts +12 -0
- package/dist/utils/classify.js +25 -0
- package/dist/utils/configs.d.ts +25 -0
- package/dist/utils/configs.js +97 -0
- package/dist/utils/count.d.ts +7 -0
- package/dist/utils/count.js +13 -0
- package/dist/utils/dispatch.d.ts +2 -0
- package/dist/utils/dispatch.js +27 -0
- package/dist/utils/distinct.d.ts +2 -0
- package/dist/utils/distinct.js +14 -0
- package/dist/utils/field.d.ts +14 -0
- package/dist/utils/field.js +60 -0
- package/dist/utils/file-name.d.ts +2 -0
- package/dist/utils/file-name.js +11 -0
- package/dist/utils/files.d.ts +7 -0
- package/dist/utils/files.js +77 -0
- package/dist/utils/fixpoint.d.ts +2 -0
- package/dist/utils/fixpoint.js +19 -0
- package/dist/utils/gate.d.ts +2 -0
- package/dist/utils/gate.js +12 -0
- package/dist/utils/group.d.ts +3 -0
- package/dist/utils/group.js +33 -0
- package/dist/utils/host.d.ts +3 -0
- package/dist/utils/host.js +16 -0
- package/dist/utils/imports.d.ts +12 -0
- package/dist/utils/imports.js +185 -0
- package/dist/utils/judged.d.ts +5 -0
- package/dist/utils/judged.js +19 -0
- package/dist/utils/keyed.d.ts +2 -0
- package/dist/utils/keyed.js +23 -0
- package/dist/utils/map-record.d.ts +2 -0
- package/dist/utils/map-record.js +11 -0
- package/dist/utils/packages.d.ts +15 -0
- package/dist/utils/packages.js +207 -0
- package/dist/utils/path-label.d.ts +6 -0
- package/dist/utils/path-label.js +37 -0
- package/dist/utils/pattern.d.ts +19 -0
- package/dist/utils/pattern.js +231 -0
- package/dist/utils/permission.d.ts +16 -0
- package/dist/utils/permission.js +18 -0
- package/dist/utils/plural.d.ts +2 -0
- package/dist/utils/plural.js +9 -0
- package/dist/utils/qualified.d.ts +2 -0
- package/dist/utils/qualified.js +21 -0
- package/dist/utils/rank.d.ts +2 -0
- package/dist/utils/rank.js +24 -0
- package/dist/utils/read-field.d.ts +12 -0
- package/dist/utils/read-field.js +50 -0
- package/dist/utils/read-when.d.ts +2 -0
- package/dist/utils/read-when.js +17 -0
- package/dist/utils/reason.d.ts +4 -0
- package/dist/utils/reason.js +9 -0
- package/dist/utils/record.d.ts +3 -0
- package/dist/utils/record.js +21 -0
- package/dist/utils/resolve.d.ts +2 -0
- package/dist/utils/resolve.js +24 -0
- package/dist/utils/search.d.ts +2 -0
- package/dist/utils/search.js +21 -0
- package/dist/utils/seen.d.ts +6 -0
- package/dist/utils/seen.js +27 -0
- package/dist/utils/span.d.ts +5 -0
- package/dist/utils/span.js +2 -0
- package/dist/utils/speak.d.ts +2 -0
- package/dist/utils/speak.js +18 -0
- package/dist/utils/split.d.ts +8 -0
- package/dist/utils/split.js +21 -0
- package/dist/utils/template.d.ts +5 -0
- package/dist/utils/template.js +5 -0
- package/dist/utils/text.d.ts +4 -0
- package/dist/utils/text.js +42 -0
- package/dist/utils/tokenize.d.ts +2 -0
- package/dist/utils/tokenize.js +18 -0
- package/dist/utils/try-read.d.ts +4 -0
- package/dist/utils/try-read.js +24 -0
- package/dist/utils/typed-field.d.ts +3 -0
- package/dist/utils/typed-field.js +16 -0
- package/dist/utils/verdicts.d.ts +4 -0
- package/dist/utils/verdicts.js +20 -0
- package/entities/operators.ts +31 -0
- package/package.json +101 -47
- package/report/errorTypes/vocabulary/ids.ts +17 -0
- package/report/errorTypes/vocabulary/phrases.ts +181 -0
- package/report/errorTypes/vocabulary/places.ts +51 -0
- package/report/errorTypes/vocabulary/verbs.ts +31 -0
- package/report/user-report/shared/describe.ts +107 -0
- package/ast.js +0 -107
- package/bin/follow-architecture.js +0 -6
- package/config.js +0 -101
- package/entities/aliases.js +0 -10
- package/entities/invariants.js +0 -134
- package/entities/nodes.js +0 -112
- package/main.js +0 -96
- package/plugin.js +0 -5
- package/report.js +0 -73
- package/utils.js +0 -104
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import type { FieldValue } from "@md-code/follow-architecture/utils/field";
|
|
2
|
+
type ConfigError = Error & {
|
|
3
|
+
isConfigError: boolean;
|
|
4
|
+
};
|
|
5
|
+
declare const unreadable: ({ code }: {
|
|
6
|
+
code?: string;
|
|
7
|
+
}) => ConfigError;
|
|
8
|
+
declare const unparseable: ({ reason }: {
|
|
9
|
+
reason: string;
|
|
10
|
+
}) => ConfigError;
|
|
11
|
+
declare const notAnObject: () => ConfigError;
|
|
12
|
+
declare const unknownTopKey: ({ key }: {
|
|
13
|
+
key: string;
|
|
14
|
+
}) => ConfigError;
|
|
15
|
+
declare const legacyRoleKey: () => ConfigError;
|
|
16
|
+
declare const legacyFilterKey: () => ConfigError;
|
|
17
|
+
declare const legacyReference: ({ ref }: {
|
|
18
|
+
ref: string;
|
|
19
|
+
}) => ConfigError;
|
|
20
|
+
declare const limitNotPositiveInteger: ({ key, value }: {
|
|
21
|
+
key: string;
|
|
22
|
+
value: FieldValue;
|
|
23
|
+
}) => ConfigError;
|
|
24
|
+
declare const withoutNodes: () => ConfigError;
|
|
25
|
+
declare const duplicateRuleIds: (ids: readonly string[]) => ConfigError;
|
|
26
|
+
declare const nodeEntityUnknown: (entity: string) => ConfigError;
|
|
27
|
+
declare const entityNotAnObject: () => ConfigError;
|
|
28
|
+
declare const entityWithoutSlug: () => ConfigError;
|
|
29
|
+
declare const entityInfersUnknown: ({ entity, entry }: {
|
|
30
|
+
entity: FieldValue;
|
|
31
|
+
entry: string;
|
|
32
|
+
}) => ConfigError;
|
|
33
|
+
declare const entityInfersItself: ({ entity }: {
|
|
34
|
+
entity: FieldValue;
|
|
35
|
+
}) => ConfigError;
|
|
36
|
+
declare const unknownEntityKey: ({ entity, key }: {
|
|
37
|
+
entity: FieldValue;
|
|
38
|
+
key: string;
|
|
39
|
+
}) => ConfigError;
|
|
40
|
+
declare const entityWhereNotAllowed: ({ entity }: {
|
|
41
|
+
entity: FieldValue;
|
|
42
|
+
}) => ConfigError;
|
|
43
|
+
declare const actionNotAnObject: ({ entity, action }: {
|
|
44
|
+
entity: FieldValue;
|
|
45
|
+
action: string;
|
|
46
|
+
}) => ConfigError;
|
|
47
|
+
declare const actionWithoutWhere: ({ entity, action }: {
|
|
48
|
+
entity: FieldValue;
|
|
49
|
+
action: string;
|
|
50
|
+
}) => ConfigError;
|
|
51
|
+
declare const unknownActionKey: ({ name, key }: {
|
|
52
|
+
name: string;
|
|
53
|
+
key: string;
|
|
54
|
+
}) => ConfigError;
|
|
55
|
+
declare const unknownActionFact: ({ value, known }: {
|
|
56
|
+
value: FieldValue;
|
|
57
|
+
known: readonly string[];
|
|
58
|
+
}) => ConfigError;
|
|
59
|
+
declare const scopeNotOneOf: ({ got, allowed }: {
|
|
60
|
+
got: FieldValue;
|
|
61
|
+
allowed: readonly string[];
|
|
62
|
+
}) => ConfigError;
|
|
63
|
+
declare const emptyAccessorSegments: ({ scope }: {
|
|
64
|
+
scope: string;
|
|
65
|
+
}) => ConfigError;
|
|
66
|
+
declare const accessorTypeUnqualified: ({ got }: {
|
|
67
|
+
got: string;
|
|
68
|
+
}) => ConfigError;
|
|
69
|
+
declare const unknownNodeKey: ({ node, key }: {
|
|
70
|
+
node: string;
|
|
71
|
+
key: string;
|
|
72
|
+
}) => ConfigError;
|
|
73
|
+
declare const unknownChildKey: ({ node, key }: {
|
|
74
|
+
node: string;
|
|
75
|
+
key: string;
|
|
76
|
+
}) => ConfigError;
|
|
77
|
+
declare const unknownNodeParent: ({ node, parent }: {
|
|
78
|
+
node: string;
|
|
79
|
+
parent: string;
|
|
80
|
+
}) => ConfigError;
|
|
81
|
+
declare const unknownNodeChild: ({ node, child }: {
|
|
82
|
+
node: string;
|
|
83
|
+
child: string;
|
|
84
|
+
}) => ConfigError;
|
|
85
|
+
declare const unknownAlias: ({ specifier, known }: {
|
|
86
|
+
specifier: string;
|
|
87
|
+
known: readonly string[];
|
|
88
|
+
}) => ConfigError;
|
|
89
|
+
declare const aliasOutsideNode: ({ node, child, place }: {
|
|
90
|
+
node: string;
|
|
91
|
+
child: string;
|
|
92
|
+
place: string;
|
|
93
|
+
}) => ConfigError;
|
|
94
|
+
declare const unknownWhereKey: ({ key }: {
|
|
95
|
+
key: string;
|
|
96
|
+
}) => ConfigError;
|
|
97
|
+
declare const ruleNotAnObject: () => ConfigError;
|
|
98
|
+
declare const ruleWithoutId: () => ConfigError;
|
|
99
|
+
declare const unknownRuleKey: ({ id, key }: {
|
|
100
|
+
id: FieldValue;
|
|
101
|
+
key: string;
|
|
102
|
+
}) => ConfigError;
|
|
103
|
+
declare const dedupeByNotAPlace: ({ value }: {
|
|
104
|
+
value: string;
|
|
105
|
+
}) => ConfigError;
|
|
106
|
+
declare const relationWithoutProducer: ({ relation }: {
|
|
107
|
+
relation: string;
|
|
108
|
+
}) => ConfigError;
|
|
109
|
+
declare const undeclaredRelation: ({ relation }: {
|
|
110
|
+
relation: string;
|
|
111
|
+
}) => ConfigError;
|
|
112
|
+
declare const styleLanguageIncomplete: () => ConfigError;
|
|
113
|
+
declare const unknownOperator: ({ op }: {
|
|
114
|
+
op: string;
|
|
115
|
+
}) => ConfigError;
|
|
116
|
+
declare const unknownListOperator: ({ op }: {
|
|
117
|
+
op: string;
|
|
118
|
+
}) => ConfigError;
|
|
119
|
+
declare const atWithoutIndex: () => ConfigError;
|
|
120
|
+
declare const invalidPattern: ({ where, pattern, reason }: {
|
|
121
|
+
where: string;
|
|
122
|
+
pattern: string;
|
|
123
|
+
reason: string;
|
|
124
|
+
}) => ConfigError;
|
|
125
|
+
export { unreadable, unparseable, notAnObject, unknownTopKey, legacyRoleKey, legacyFilterKey, legacyReference, withoutNodes, duplicateRuleIds, nodeEntityUnknown, entityNotAnObject, entityWithoutSlug, entityInfersUnknown, entityInfersItself, unknownEntityKey, entityWhereNotAllowed, actionNotAnObject, actionWithoutWhere, unknownActionKey, unknownActionFact, scopeNotOneOf, emptyAccessorSegments, accessorTypeUnqualified, unknownNodeKey, unknownChildKey, unknownNodeParent, unknownNodeChild, unknownAlias, aliasOutsideNode, unknownWhereKey, ruleNotAnObject, ruleWithoutId, unknownRuleKey, dedupeByNotAPlace, relationWithoutProducer, undeclaredRelation, styleLanguageIncomplete, limitNotPositiveInteger, unknownOperator, unknownListOperator, atWithoutIndex, invalidPattern, };
|
|
126
|
+
export type { ConfigError };
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.invalidPattern = exports.atWithoutIndex = exports.unknownListOperator = exports.unknownOperator = exports.limitNotPositiveInteger = exports.styleLanguageIncomplete = exports.undeclaredRelation = exports.relationWithoutProducer = exports.dedupeByNotAPlace = exports.unknownRuleKey = exports.ruleWithoutId = exports.ruleNotAnObject = exports.unknownWhereKey = exports.aliasOutsideNode = exports.unknownAlias = exports.unknownNodeChild = exports.unknownNodeParent = exports.unknownChildKey = exports.unknownNodeKey = exports.accessorTypeUnqualified = exports.emptyAccessorSegments = exports.scopeNotOneOf = exports.unknownActionFact = exports.unknownActionKey = exports.actionWithoutWhere = exports.actionNotAnObject = exports.entityWhereNotAllowed = exports.unknownEntityKey = exports.entityInfersItself = exports.entityInfersUnknown = exports.entityWithoutSlug = exports.entityNotAnObject = exports.nodeEntityUnknown = exports.duplicateRuleIds = exports.withoutNodes = exports.legacyReference = exports.legacyFilterKey = exports.legacyRoleKey = exports.unknownTopKey = exports.notAnObject = exports.unparseable = exports.unreadable = void 0;
|
|
4
|
+
// Everything the tool says about a CONFIG it cannot read. One place, because a
|
|
5
|
+
// message about `architecture.yaml` is shown to a person who has to fix that
|
|
6
|
+
// file: it must name the key, the allowed keys and why — never a stack trace
|
|
7
|
+
// with the reason buried in it.
|
|
8
|
+
//
|
|
9
|
+
// Each builder returns an `Error`: the caller decides whether that is fatal
|
|
10
|
+
// (a config is loaded once, at the start) but never what it SAYS.
|
|
11
|
+
//
|
|
12
|
+
// A message that lists the vocabulary lists its MEANINGS too (`entities/schema`
|
|
13
|
+
// holds both), so a reader can write the right key without a manual — and it
|
|
14
|
+
// never guesses what an old key meant.
|
|
15
|
+
const schema_1 = require("@md-code/follow-architecture/entities/schema");
|
|
16
|
+
const fail = (message) => Object.assign(new Error(message), { isConfigError: true });
|
|
17
|
+
const list = (xs) => [...xs].map((x) => `\`${x}\``).join(", ");
|
|
18
|
+
const fenced = (xs) => [...xs].join(" | ");
|
|
19
|
+
// Every key of a section on ONE line, then each key's meaning on its own.
|
|
20
|
+
const meanings = (docs) => docs.map((d) => `\n - \`${d.key}\` — ${d.meaning}`).join("");
|
|
21
|
+
const dictionary = (docs) => `${list(docs.map((d) => d.key))}${meanings(docs)}`;
|
|
22
|
+
// ── the architecture file itself ──────────────────────────────────────────
|
|
23
|
+
const unreadable = ({ code }) => fail(`architecture: cannot read the file${code ? ` (${code})` : ""}`);
|
|
24
|
+
exports.unreadable = unreadable;
|
|
25
|
+
const unparseable = ({ reason }) => fail(`architecture: not YAML or JSON — ${reason}`);
|
|
26
|
+
exports.unparseable = unparseable;
|
|
27
|
+
const notAnObject = () => fail(`architecture: expected an object — the file must be a map of ${dictionary(schema_1.SECTIONS)}`);
|
|
28
|
+
exports.notAnObject = notAnObject;
|
|
29
|
+
const unknownTopKey = ({ key }) => fail(`architecture: \`${key}\` is not a section. Available sections are ${dictionary(schema_1.SECTIONS)}`);
|
|
30
|
+
exports.unknownTopKey = unknownTopKey;
|
|
31
|
+
const legacyRoleKey = () => fail(`architecture: \`role\` is not a key in this format. Available \`where\` entries are ${dictionary(schema_1.WHERE_KEYS)}\nAvailable node keys are ${dictionary(schema_1.NODE_KEYS)}`);
|
|
32
|
+
exports.legacyRoleKey = legacyRoleKey;
|
|
33
|
+
const legacyFilterKey = () => fail("architecture: `codeRole` is not a key in this format. Available references: `$entity` — the project-wide pieces of an entity, keyed by its slug");
|
|
34
|
+
exports.legacyFilterKey = legacyFilterKey;
|
|
35
|
+
const legacyReference = ({ ref }) => fail(`architecture: \`${ref}\` is not a reference in this format. Available references: \`$entity\` — the project-wide pieces of an entity, keyed by its slug`);
|
|
36
|
+
exports.legacyReference = legacyReference;
|
|
37
|
+
// The barrel budget is the TOOL's (the rule option `barrelDepth`, the CLI's
|
|
38
|
+
// `--barrel-depth`), so the sentence names the option, not a config section.
|
|
39
|
+
const limitNotPositiveInteger = ({ key, value }) => fail(`${key}: must be a positive integer (a budget of 0 is no budget at all) — got ${JSON.stringify(value)}`);
|
|
40
|
+
exports.limitNotPositiveInteger = limitNotPositiveInteger;
|
|
41
|
+
const withoutNodes = () => fail("architecture.nodes: must be a non-empty array or object — a tree with no nodes describes no place");
|
|
42
|
+
exports.withoutNodes = withoutNodes;
|
|
43
|
+
const duplicateRuleIds = (ids) => fail(`architecture.rules: ids must be unique — repeated: ${list([...new Set(ids.filter((id, i) => ids.indexOf(id) !== i))])}`);
|
|
44
|
+
exports.duplicateRuleIds = duplicateRuleIds;
|
|
45
|
+
const nodeEntityUnknown = (entity) => fail(`nodes: \`entity: ${entity}\` names no entity — the node gives a home to code the config never describes`);
|
|
46
|
+
exports.nodeEntityUnknown = nodeEntityUnknown;
|
|
47
|
+
// ── entities ─────────────────────────────────────────────────────────────
|
|
48
|
+
const entityNotAnObject = () => fail("entities: each entry must be an object with a `slug`");
|
|
49
|
+
exports.entityNotAnObject = entityNotAnObject;
|
|
50
|
+
const entityWithoutSlug = () => fail("entities: each entry needs a `slug`");
|
|
51
|
+
exports.entityWithoutSlug = entityWithoutSlug;
|
|
52
|
+
const entityInfersUnknown = ({ entity, entry }) => fail(`entities: \`${entity}\` infers by unknown entity \`${entry}\``);
|
|
53
|
+
exports.entityInfersUnknown = entityInfersUnknown;
|
|
54
|
+
const entityInfersItself = ({ entity }) => fail(`entities: \`${entity}\` infers by itself`);
|
|
55
|
+
exports.entityInfersItself = entityInfersItself;
|
|
56
|
+
const unknownEntityKey = ({ entity, key }) => fail(`entities: \`${entity}.${key}\` is not an entity key — an entity is ${dictionary(schema_1.ENTITY_KEYS)}; actions belong under \`actions\``);
|
|
57
|
+
exports.unknownEntityKey = unknownEntityKey;
|
|
58
|
+
const entityWhereNotAllowed = ({ entity }) => fail(`entities: \`${entity}.where\` — an entity says WHAT code is, a node says WHERE it lives: move it to a child of the node that holds it — \`- { name: <file>, entity: ${entity} }\` for one file, \`- { name: <folder>, entity: ${entity} }\` for a whole folder`);
|
|
59
|
+
exports.entityWhereNotAllowed = entityWhereNotAllowed;
|
|
60
|
+
const actionNotAnObject = ({ entity, action }) => fail(`entities: \`${entity}.actions.${action}\` must be an object with \`where\``);
|
|
61
|
+
exports.actionNotAnObject = actionNotAnObject;
|
|
62
|
+
const actionWithoutWhere = ({ entity, action }) => fail(`entities: \`${entity}.actions.${action}\` has no \`where\` — a permission that names nobody allows nobody`);
|
|
63
|
+
exports.actionWithoutWhere = actionWithoutWhere;
|
|
64
|
+
const unknownActionKey = ({ name, key }) => fail(`entities: \`${name}.${key}\` is not an action key. An action is ${dictionary(schema_1.ACTION_KEYS)}`);
|
|
65
|
+
exports.unknownActionKey = unknownActionKey;
|
|
66
|
+
const unknownActionFact = ({ value, known }) => fail(`entities: action says \`of: ${value}\` — the fact layer produces ${fenced(known)}`);
|
|
67
|
+
exports.unknownActionFact = unknownActionFact;
|
|
68
|
+
const scopeNotOneOf = ({ got, allowed }) => fail(`entities: scopeAccess \`scope\` must be one of ${fenced(allowed)}, got ${JSON.stringify(got)}`);
|
|
69
|
+
exports.scopeNotOneOf = scopeNotOneOf;
|
|
70
|
+
const emptyAccessorSegments = ({ scope }) => fail(`entities: scopeAccess entry for scope \`${scope}\` needs a non-empty \`segments\` list`);
|
|
71
|
+
exports.emptyAccessorSegments = emptyAccessorSegments;
|
|
72
|
+
// A door named by a TYPE states where the type is declared: `module.Type`. A bare
|
|
73
|
+
// name says nothing about which `DefaultTheme` is meant.
|
|
74
|
+
const accessorTypeUnqualified = ({ got }) => fail(`entities: scopeAccess \`type\` must be \`module.Type\` (e.g. \`styled-components.DefaultTheme\`), got ${JSON.stringify(got)}`);
|
|
75
|
+
exports.accessorTypeUnqualified = accessorTypeUnqualified;
|
|
76
|
+
// ── nodes and their children ──────────────────────────────────────────────
|
|
77
|
+
const unknownNodeKey = ({ node, key }) => fail(`nodes: \`${node}.${key}\` is not a node key — a node is structure only: ${dictionary(schema_1.NODE_KEYS)}`);
|
|
78
|
+
exports.unknownNodeKey = unknownNodeKey;
|
|
79
|
+
const unknownChildKey = ({ node, key }) => fail(`nodes: \`${node}\` child key \`${key}\` is not part of the format. A child is ${dictionary(schema_1.CHILD_KEYS)}`);
|
|
80
|
+
exports.unknownChildKey = unknownChildKey;
|
|
81
|
+
const unknownNodeParent = ({ node, parent }) => fail(`nodes: \`${node}\` names unknown parent \`${parent}\``);
|
|
82
|
+
exports.unknownNodeParent = unknownNodeParent;
|
|
83
|
+
const unknownNodeChild = ({ node, child }) => fail(`nodes: \`${node}\` names unknown child \`${child}\``);
|
|
84
|
+
exports.unknownNodeChild = unknownNodeChild;
|
|
85
|
+
// ── the `aliases` map ─────────────────────────────────────────────────────
|
|
86
|
+
// A path that starts with `@` claims to be an alias. An unknown one is a
|
|
87
|
+
// declaration the config believes it made, so it fails loudly instead of
|
|
88
|
+
// matching nothing.
|
|
89
|
+
const unknownAlias = ({ specifier, known }) => fail(`aliases: \`${specifier}\` names no alias — declared aliases are ${list(known)}`);
|
|
90
|
+
exports.unknownAlias = unknownAlias;
|
|
91
|
+
// A child named by an alias must be a child of ITS node: the alias names a place
|
|
92
|
+
// in the repo, and a place outside the node's folder is not one of its children.
|
|
93
|
+
const aliasOutsideNode = ({ node, child, place }) => fail(`nodes: \`${node}\` declares child \`${child}\`, which is \`${place}\` — outside the node's own folder`);
|
|
94
|
+
exports.aliasOutsideNode = aliasOutsideNode;
|
|
95
|
+
// ── the `where` grammar ───────────────────────────────────────────────────
|
|
96
|
+
const unknownWhereKey = ({ key }) => fail(`architecture: \`where\` entry key \`${key}\` is not part of the format. A \`where\` entry is one of ${dictionary(schema_1.WHERE_KEYS)}`);
|
|
97
|
+
exports.unknownWhereKey = unknownWhereKey;
|
|
98
|
+
// ── rules ────────────────────────────────────────────────────────────
|
|
99
|
+
const ruleNotAnObject = () => fail("rules: each entry must be an object with an `id`");
|
|
100
|
+
exports.ruleNotAnObject = ruleNotAnObject;
|
|
101
|
+
const ruleWithoutId = () => fail("rules: each entry needs an `id`");
|
|
102
|
+
exports.ruleWithoutId = ruleWithoutId;
|
|
103
|
+
const unknownRuleKey = ({ id, key }) => fail(`rules: \`${id}.${key}\` is not a key — a rule is ${dictionary(schema_1.RULE_KEYS)}`);
|
|
104
|
+
exports.unknownRuleKey = unknownRuleKey;
|
|
105
|
+
const dedupeByNotAPlace = ({ value }) => fail(`rules: \`dedupeBy: ${value}\` is not a place — use a \`where\` entry (\`{ node: <slug> }\`, a glob, or a filter)`);
|
|
106
|
+
exports.dedupeByNotAPlace = dedupeByNotAPlace;
|
|
107
|
+
// ── the engine's own tables (a broken build, not a user mistake) ───────────
|
|
108
|
+
const relationWithoutProducer = ({ relation }) => fail(`kinds: relation \`${relation}\` is declared but has no producer`);
|
|
109
|
+
exports.relationWithoutProducer = relationWithoutProducer;
|
|
110
|
+
const undeclaredRelation = ({ relation }) => fail(`kinds: \`${relation}\` has a producer but is not declared`);
|
|
111
|
+
exports.undeclaredRelation = undeclaredRelation;
|
|
112
|
+
const styleLanguageIncomplete = () => fail("css/syntax: a style language needs an `id` and `facts(text)`");
|
|
113
|
+
exports.styleLanguageIncomplete = styleLanguageIncomplete;
|
|
114
|
+
const unknownOperator = ({ op }) => fail(`queries: unknown operator \`${op}\``);
|
|
115
|
+
exports.unknownOperator = unknownOperator;
|
|
116
|
+
const unknownListOperator = ({ op }) => fail(`queries: unknown list operator \`${op}\``);
|
|
117
|
+
exports.unknownListOperator = unknownListOperator;
|
|
118
|
+
const atWithoutIndex = () => fail("queries: `at` needs a numeric `index`");
|
|
119
|
+
exports.atWithoutIndex = atWithoutIndex;
|
|
120
|
+
const invalidPattern = ({ where, pattern, reason }) => fail(`${where}: invalid pattern \`${pattern}\` — ${reason}`);
|
|
121
|
+
exports.invalidPattern = invalidPattern;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { StructureFacts } from "@md-code/follow-architecture/entities/structure-facts";
|
|
2
|
+
type StructureCode = {
|
|
3
|
+
ask: string;
|
|
4
|
+
message: (f: StructureFacts) => string;
|
|
5
|
+
fix: (f: StructureFacts) => string;
|
|
6
|
+
};
|
|
7
|
+
declare const CODES: Record<string, StructureCode>;
|
|
8
|
+
declare const choose: (facts: StructureFacts) => string;
|
|
9
|
+
declare const render: (id: string, facts: StructureFacts) => {
|
|
10
|
+
code: string;
|
|
11
|
+
ask: string;
|
|
12
|
+
message: string;
|
|
13
|
+
fix: string;
|
|
14
|
+
};
|
|
15
|
+
export { choose, render, CODES };
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CODES = exports.render = exports.choose = void 0;
|
|
4
|
+
// structure.* codes: this entry does not belong in this folder. Each code is a
|
|
5
|
+
// pair of sentence templates (message + fix) over the SAME facts the tree check
|
|
6
|
+
// states; `choose` picks the code by the facts, `render` fills the templates.
|
|
7
|
+
const location_1 = require("@md-code/follow-architecture/entities/location");
|
|
8
|
+
const held = (f) => f.held?.[0] ?? f.named ?? "";
|
|
9
|
+
const CODES = {
|
|
10
|
+
// The fallback: the entry is not declared, and no destination is certain.
|
|
11
|
+
"structure.entry": {
|
|
12
|
+
ask: "entity",
|
|
13
|
+
message: (f) => `\`{basename}\` is not an entry this folder declares.${f.seen ?? ""}`,
|
|
14
|
+
// A file the tree does not name has no home and no kind: the fix is to
|
|
15
|
+
// declare it (the folder's own list is right there) or to move it where it
|
|
16
|
+
// is declared. `null` here printed a card with nothing to do.
|
|
17
|
+
fix: (f) => `Move what \`{basename}\` holds into ${f.named ? `\`${f.named}\`` : "the files this folder declares"}, or delete it: this folder has no place for it.`,
|
|
18
|
+
},
|
|
19
|
+
// A DIRECTORY: its contents have a home, the directory itself does not.
|
|
20
|
+
"structure.directory": {
|
|
21
|
+
ask: "move",
|
|
22
|
+
message: (f) => `\`{basename}\` is not an entry this folder declares.${f.seen ?? ""}${f.held?.length ? ` What it holds is \`${f.held[0]}\` code.` : ""}`,
|
|
23
|
+
fix: (f) => `Move what \`{basename}/\` holds ${f.dest ? `into \`${f.dest}\`` : `into the files this folder declares (${f.named})`}, then delete the directory.`,
|
|
24
|
+
},
|
|
25
|
+
// One certain destination: the entry belongs there, whole.
|
|
26
|
+
"structure.belongs-in": {
|
|
27
|
+
ask: "move",
|
|
28
|
+
message: (f) => `\`{basename}\` belongs in \`${f.dest}\`.${f.seen ?? ""} It holds a \`${held(f)}\`.`,
|
|
29
|
+
fix: (f) => `Move \`{basename}\` to \`${f.dest}\`.`,
|
|
30
|
+
},
|
|
31
|
+
// A second copy of a file that already lives here.
|
|
32
|
+
"structure.duplicate": {
|
|
33
|
+
ask: "remove",
|
|
34
|
+
message: (f) => `\`{basename}\` is not an entry this folder declares.${f.seen ?? ""} It duplicates \`${(0, location_1.leafOf)(f.duplicate).segments.at(-1)}\` — one file per folder, and this is a second copy.`,
|
|
35
|
+
fix: (f) => `Merge \`{basename}\` into \`${f.duplicate}\` and delete \`{basename}\`.`,
|
|
36
|
+
},
|
|
37
|
+
// The folder is right and the NAME is not.
|
|
38
|
+
"structure.rename": {
|
|
39
|
+
ask: "move",
|
|
40
|
+
message: (f) => `\`{basename}\` is not an entry this folder declares.${f.seen ?? ""} The folder is right, the name is not: this folder may hold \`${f.named}\`.`,
|
|
41
|
+
fix: (f) => `Rename \`{basename}\` to \`${f.named}\`.`,
|
|
42
|
+
},
|
|
43
|
+
"structure.entity-no-home": {
|
|
44
|
+
ask: "entity",
|
|
45
|
+
message: (f) => `\`{basename}\` is not an entry this folder declares.${f.seen ?? ""} It holds a \`${f.entities?.[0]}\`, and that entity has no declared home — the architecture names no destination for this file.`,
|
|
46
|
+
fix: () => `Delete it: the code in here belongs to no place the tree has, so there is nothing to move it into.`,
|
|
47
|
+
},
|
|
48
|
+
"structure.contents": {
|
|
49
|
+
ask: "move",
|
|
50
|
+
message: (f) => `\`{basename}\` is not an entry this folder declares.${f.seen ?? ""} Nothing in it belongs to an entity this folder holds.`,
|
|
51
|
+
fix: (f) => `Move what \`{basename}\` holds into the files this folder declares (${f.named}), then delete \`{basename}\`.`,
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
exports.CODES = CODES;
|
|
55
|
+
// The code the facts earn, first claim wins: a directory, a certain destination,
|
|
56
|
+
// a duplicate, a rename, a homeless entity, else the folder's contents.
|
|
57
|
+
const choose = (facts) => {
|
|
58
|
+
if (facts.asDir)
|
|
59
|
+
return "structure.directory";
|
|
60
|
+
if (facts.dest)
|
|
61
|
+
return "structure.belongs-in";
|
|
62
|
+
if (facts.duplicate)
|
|
63
|
+
return "structure.duplicate";
|
|
64
|
+
if (facts.homeHere?.length)
|
|
65
|
+
return "structure.rename";
|
|
66
|
+
if (facts.entities?.length)
|
|
67
|
+
return "structure.entity-no-home";
|
|
68
|
+
return "structure.contents";
|
|
69
|
+
};
|
|
70
|
+
exports.choose = choose;
|
|
71
|
+
const codeOf = (id) => CODES[id] ?? CODES["structure.entry"];
|
|
72
|
+
const render = (id, facts) => {
|
|
73
|
+
const code = codeOf(id);
|
|
74
|
+
return { code: id, ask: code.ask, message: code.message(facts), fix: code.fix(facts) };
|
|
75
|
+
};
|
|
76
|
+
exports.render = render;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { decide, resolveWeights, resolveThresholds, DEFAULT_WEIGHTS, DEFAULT_THRESHOLDS } from "./destinations";
|
|
2
|
+
import { normalizeRepairs, type StatedRepair } from "@md-code/follow-architecture/entities/repair";
|
|
3
|
+
import type { DecisionCtx } from "@md-code/follow-architecture/entities/overview/decision";
|
|
4
|
+
import type { Arch } from "@md-code/follow-architecture/entities/architecture";
|
|
5
|
+
import type { Described } from "@md-code/follow-architecture/entities/story";
|
|
6
|
+
import type { FindingType } from "./finding-type";
|
|
7
|
+
declare const TYPES: FindingType[];
|
|
8
|
+
declare const normalize: (list: readonly (string | StatedRepair | null | undefined)[] | null | undefined) => ReturnType<typeof normalizeRepairs>;
|
|
9
|
+
/**
|
|
10
|
+
* ctx = { finding, file, key, violation, ownerNode, plan, nodes, arch, rule }
|
|
11
|
+
*
|
|
12
|
+
* → { type, label, story, message, options }
|
|
13
|
+
*
|
|
14
|
+
* story what the finding is about (nodes + script of the picture), plus
|
|
15
|
+
* `destinations` — the decision above, already made
|
|
16
|
+
* message the sentence the reader sees
|
|
17
|
+
* options [{ code, text, to }] — code is the repair kind, `to` are the
|
|
18
|
+
* boxes it lands in, `text` is the line printed for it
|
|
19
|
+
*/
|
|
20
|
+
declare const describe: (ctx: Omit<DecisionCtx, "places"> & {
|
|
21
|
+
arch: Arch;
|
|
22
|
+
}) => Described;
|
|
23
|
+
export { describe, TYPES, normalize, decide, resolveWeights, resolveThresholds, DEFAULT_WEIGHTS, DEFAULT_THRESHOLDS };
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.DEFAULT_THRESHOLDS = exports.DEFAULT_WEIGHTS = exports.resolveThresholds = exports.resolveWeights = exports.decide = exports.normalize = exports.TYPES = exports.describe = void 0;
|
|
37
|
+
// THE decision maker — one file, three jobs, in this order:
|
|
38
|
+
//
|
|
39
|
+
// 1. WHICH KIND of finding this is (`TYPES`, first claim wins);
|
|
40
|
+
// 2. WHAT the reader is told (`message`) and WHAT THEY CAN DO
|
|
41
|
+
// (`options`, one shape for all of them);
|
|
42
|
+
// 3. WHERE the code belongs (`decide`, in ./destinations).
|
|
43
|
+
//
|
|
44
|
+
// Both representations read only its output:
|
|
45
|
+
//
|
|
46
|
+
// report/cli-report.ts text ← view.message + view.options[].text
|
|
47
|
+
// user-report/src/graph/ graph ← view.story + view.options[].to
|
|
48
|
+
//
|
|
49
|
+
// Nothing downstream re-decides anything, so the sentence and the picture cannot
|
|
50
|
+
// disagree: an option with three destinations IS three arrows and three lines.
|
|
51
|
+
const places_1 = require("./vocabulary/places");
|
|
52
|
+
const ids = __importStar(require("./vocabulary/ids"));
|
|
53
|
+
const destinations_1 = require("./destinations");
|
|
54
|
+
Object.defineProperty(exports, "decide", { enumerable: true, get: function () { return destinations_1.decide; } });
|
|
55
|
+
Object.defineProperty(exports, "resolveWeights", { enumerable: true, get: function () { return destinations_1.resolveWeights; } });
|
|
56
|
+
Object.defineProperty(exports, "resolveThresholds", { enumerable: true, get: function () { return destinations_1.resolveThresholds; } });
|
|
57
|
+
Object.defineProperty(exports, "DEFAULT_WEIGHTS", { enumerable: true, get: function () { return destinations_1.DEFAULT_WEIGHTS; } });
|
|
58
|
+
Object.defineProperty(exports, "DEFAULT_THRESHOLDS", { enumerable: true, get: function () { return destinations_1.DEFAULT_THRESHOLDS; } });
|
|
59
|
+
const repair_1 = require("@md-code/follow-architecture/entities/repair");
|
|
60
|
+
const wrongAction = __importStar(require("./types/wrongAction"));
|
|
61
|
+
const wrongPlacement = __importStar(require("./types/wrongPlacement"));
|
|
62
|
+
const unknownEntity = __importStar(require("./types/unknownEntity"));
|
|
63
|
+
const fileContents = __importStar(require("./types/fileContents"));
|
|
64
|
+
// Order is the decision: the first type that claims the finding wins, and
|
|
65
|
+
// fileContents claims everything, so it stays last.
|
|
66
|
+
const TYPES = [wrongAction, wrongPlacement, unknownEntity, fileContents];
|
|
67
|
+
exports.TYPES = TYPES;
|
|
68
|
+
// One shape for every option, whatever produced it: an old string-returning type
|
|
69
|
+
// cannot reintroduce a second format. The walk lives in `entities/repair`.
|
|
70
|
+
const normalize = (list) => (0, repair_1.normalizeRepairs)(list);
|
|
71
|
+
exports.normalize = normalize;
|
|
72
|
+
/**
|
|
73
|
+
* ctx = { finding, file, key, violation, ownerNode, plan, nodes, arch, rule }
|
|
74
|
+
*
|
|
75
|
+
* → { type, label, story, message, options }
|
|
76
|
+
*
|
|
77
|
+
* story what the finding is about (nodes + script of the picture), plus
|
|
78
|
+
* `destinations` — the decision above, already made
|
|
79
|
+
* message the sentence the reader sees
|
|
80
|
+
* options [{ code, text, to }] — code is the repair kind, `to` are the
|
|
81
|
+
* boxes it lands in, `text` is the line printed for it
|
|
82
|
+
*/
|
|
83
|
+
const describe = (ctx) => {
|
|
84
|
+
const places = (0, places_1.make)({ nodes: ctx.nodes ?? [], arch: ctx.arch });
|
|
85
|
+
const full = { ...ctx, places };
|
|
86
|
+
for (const type of TYPES) {
|
|
87
|
+
const story = type.classify(full, places);
|
|
88
|
+
if (!story)
|
|
89
|
+
continue;
|
|
90
|
+
// WHERE the code belongs is decided HERE, once, for every type: the type
|
|
91
|
+
// module renders a destination, it never picks one.
|
|
92
|
+
const withDestinations = { ...story, destinations: (0, destinations_1.decide)({ story, ctx: full }) };
|
|
93
|
+
return {
|
|
94
|
+
type: type.id,
|
|
95
|
+
label: type.label,
|
|
96
|
+
story: withDestinations,
|
|
97
|
+
message: type.message(withDestinations, full) ?? null,
|
|
98
|
+
options: normalize(type.fixes(withDestinations, full)),
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
return {
|
|
102
|
+
type: ids.FILE_CONTENTS,
|
|
103
|
+
label: fileContents.label,
|
|
104
|
+
story: { type: ids.FILE_CONTENTS, from: null, to: [] },
|
|
105
|
+
message: null,
|
|
106
|
+
options: [],
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
exports.describe = describe;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { DecisionCtx } from "@md-code/follow-architecture/entities/overview/decision";
|
|
2
|
+
import type { Story, Destination } from "@md-code/follow-architecture/entities/story";
|
|
3
|
+
declare const DEFAULT_WEIGHTS: {
|
|
4
|
+
declared: number;
|
|
5
|
+
inferred: number;
|
|
6
|
+
named: number;
|
|
7
|
+
hostable: number;
|
|
8
|
+
branch: number;
|
|
9
|
+
};
|
|
10
|
+
declare const DEFAULT_THRESHOLDS: {
|
|
11
|
+
move: number;
|
|
12
|
+
};
|
|
13
|
+
declare const KEYS: readonly ["declared", "inferred", "named", "hostable", "branch"];
|
|
14
|
+
type SignalKey = (typeof KEYS)[number];
|
|
15
|
+
type Weights = Record<SignalKey, number>;
|
|
16
|
+
type Thresholds = {
|
|
17
|
+
move: number;
|
|
18
|
+
};
|
|
19
|
+
declare const resolveWeights: (override: Partial<Weights> | null | undefined) => Weights;
|
|
20
|
+
declare const resolveThresholds: (override: Partial<Thresholds> | null | undefined) => Thresholds;
|
|
21
|
+
/**
|
|
22
|
+
* → [{ entity, node, path, confidence, tier, reason, signals, contributions,
|
|
23
|
+
* evidence, thresholds, weights }] best first, max 3.
|
|
24
|
+
*
|
|
25
|
+
* Empty when there is no tree to ask, when the code already sits where its entity
|
|
26
|
+
* lives, when the code's own entity is unknown, or when the relation stays
|
|
27
|
+
* forbidden at the candidate's place.
|
|
28
|
+
*/
|
|
29
|
+
type Tuning = {
|
|
30
|
+
weights?: Partial<Weights>;
|
|
31
|
+
thresholds?: Partial<Thresholds>;
|
|
32
|
+
};
|
|
33
|
+
declare const decide: (args: {
|
|
34
|
+
story: Story;
|
|
35
|
+
ctx: DecisionCtx;
|
|
36
|
+
tuning?: Tuning;
|
|
37
|
+
}) => Destination[];
|
|
38
|
+
export { decide, resolveWeights, resolveThresholds, DEFAULT_WEIGHTS, DEFAULT_THRESHOLDS };
|