@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,4 @@
|
|
|
1
|
+
import type { OverviewInput } from "@md-code/follow-architecture/entities/overview/input";
|
|
2
|
+
import type { OverviewData } from "@md-code/follow-architecture/entities/overview/data";
|
|
3
|
+
declare const collectOverviewData: (input: OverviewInput) => OverviewData;
|
|
4
|
+
export { collectOverviewData };
|
|
@@ -0,0 +1,93 @@
|
|
|
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.collectOverviewData = void 0;
|
|
37
|
+
// Assemble the single JSON payload the overview UI renders. Everything the
|
|
38
|
+
// browser needs is computed here, so the React bundle stays dumb and the HTML
|
|
39
|
+
// file is fully self-contained (openable from disk, no server, no network).
|
|
40
|
+
const path = __importStar(require("node:path"));
|
|
41
|
+
const nodes_1 = require("./nodes");
|
|
42
|
+
const entities_1 = require("./entities");
|
|
43
|
+
const rules_1 = require("./rules");
|
|
44
|
+
const findings_1 = require("./findings");
|
|
45
|
+
const file_tree_1 = require("./file-tree");
|
|
46
|
+
const observed_1 = require("@md-code/follow-architecture/report/observed");
|
|
47
|
+
const graph_1 = require("./graph");
|
|
48
|
+
const count_1 = require("@md-code/follow-architecture/utils/count");
|
|
49
|
+
const collectOverviewData = (input) => {
|
|
50
|
+
const { arch, findings, orphans, files, repoFiles, repoRoot, architecturePath, project, generatedAt } = input;
|
|
51
|
+
const { nodes } = (0, nodes_1.buildNodes)({ arch, files, repoRoot });
|
|
52
|
+
const enriched = (0, findings_1.enrichFindings)({ findings, arch, nodes });
|
|
53
|
+
const entities = (0, entities_1.buildEntities)({ arch, files, repoRoot, repoFiles, project, nodes });
|
|
54
|
+
const rules = (0, rules_1.buildRules)(arch, findings);
|
|
55
|
+
// Folder→folder arrows, derived from the entity actions. This is what the
|
|
56
|
+
// Graph screen draws and what the tree highlights.
|
|
57
|
+
// …and what the scan itself saw, aggregated by the engine: the observed pairs
|
|
58
|
+
// are the arrows' numbers, the declared ones stay muted beside them.
|
|
59
|
+
const access = (0, graph_1.buildAccessGraph)({ arch, nodes, findings: enriched, observed: (0, observed_1.observedFor)(repoRoot) });
|
|
60
|
+
return {
|
|
61
|
+
meta: {
|
|
62
|
+
repoRoot,
|
|
63
|
+
repoName: path.basename(repoRoot),
|
|
64
|
+
architecturePath: architecturePath ? path.relative(repoRoot, architecturePath) : "the architecture config",
|
|
65
|
+
generatedAt: generatedAt ?? new Date().toISOString(),
|
|
66
|
+
filesScanned: files.length,
|
|
67
|
+
orphans: orphans ?? [],
|
|
68
|
+
},
|
|
69
|
+
stats: {
|
|
70
|
+
nodes: nodes.length,
|
|
71
|
+
folders: nodes.filter((n) => !n.isFile).length,
|
|
72
|
+
fileNodes: nodes.filter((n) => n.isFile).length,
|
|
73
|
+
entities: entities.length,
|
|
74
|
+
rules: rules.length,
|
|
75
|
+
findings: enriched.length,
|
|
76
|
+
filesWithFindings: new Set(enriched.map((f) => f.file)).size,
|
|
77
|
+
edges: access.edges.length,
|
|
78
|
+
orphans: (orphans ?? []).length,
|
|
79
|
+
},
|
|
80
|
+
nodes,
|
|
81
|
+
access,
|
|
82
|
+
entities,
|
|
83
|
+
rules,
|
|
84
|
+
findings: enriched,
|
|
85
|
+
fileTree: (0, file_tree_1.buildFileTree)({ files, arch, findings: enriched }),
|
|
86
|
+
groups: {
|
|
87
|
+
byCategory: (0, count_1.countBy)(enriched, (f) => f.category),
|
|
88
|
+
byRule: (0, count_1.countBy)(enriched, (f) => f.ruleId ?? "structure"),
|
|
89
|
+
byNode: (0, count_1.countBy)(enriched, (f) => f.ownerNode ?? "—"),
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
exports.collectOverviewData = collectOverviewData;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { NodeSummary, EntitySummary } from "@md-code/follow-architecture/entities/overview/summaries";
|
|
2
|
+
import type { OverviewInput } from "@md-code/follow-architecture/entities/overview/input";
|
|
3
|
+
type EntitiesAsk = Pick<OverviewInput, "arch" | "files" | "repoRoot" | "repoFiles" | "project"> & {
|
|
4
|
+
nodes?: NodeSummary[];
|
|
5
|
+
};
|
|
6
|
+
declare const buildEntities: (ask: EntitiesAsk) => EntitySummary[];
|
|
7
|
+
export { buildEntities };
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildEntities = void 0;
|
|
4
|
+
// Code-entity summaries: the entity's identity, its infer as written, its report
|
|
5
|
+
// unwrapped to the two sentence fields the card shows, what may be DONE with
|
|
6
|
+
// code of this entity, where it may live, and the real examples from this repo.
|
|
7
|
+
const location_1 = require("@md-code/follow-architecture/entities/location");
|
|
8
|
+
const keyed_1 = require("@md-code/follow-architecture/utils/keyed");
|
|
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 read_when_1 = require("@md-code/follow-architecture/utils/read-when");
|
|
12
|
+
const entity_examples_1 = require("./entity-examples");
|
|
13
|
+
// The entities section as written: a list of `{ slug, … }` or a map keyed by
|
|
14
|
+
// slug — the ONE keyed-section reader answers both.
|
|
15
|
+
const rawEntities = (raw) => {
|
|
16
|
+
const defs = (0, keyed_1.keyedDefs)(raw);
|
|
17
|
+
const out = new Map();
|
|
18
|
+
for (const def of defs) {
|
|
19
|
+
if (!(0, field_1.isObj)(def))
|
|
20
|
+
continue;
|
|
21
|
+
const slug = (0, read_field_1.stringField)(def, "slug");
|
|
22
|
+
if (slug)
|
|
23
|
+
out.set(slug, def);
|
|
24
|
+
}
|
|
25
|
+
return out;
|
|
26
|
+
};
|
|
27
|
+
// The report as written: a sentence, or `{ description | message, fix }`.
|
|
28
|
+
const messageOf = (report) => (0, read_when_1.readWhen)(report, field_1.isObj, (r) => (0, read_field_1.stringField)(r, "description", (0, read_field_1.stringField)(r, "message")) || null, typeof report === "string" ? report : null);
|
|
29
|
+
const reportOf = (rawDef) => {
|
|
30
|
+
const report = (0, field_1.fieldOf)(rawDef, "report");
|
|
31
|
+
const fix = (0, field_1.fieldOf)(report, "fix");
|
|
32
|
+
const fixText = typeof fix === "string" ? fix : (0, read_field_1.stringField)(fix, "message") || null;
|
|
33
|
+
return { message: messageOf(report), fix: fixText };
|
|
34
|
+
};
|
|
35
|
+
// What may be DONE with code of this entity, and by whom. A custom action name
|
|
36
|
+
// (`emit: { of: call }`) states which fact class it is checked against.
|
|
37
|
+
const actionsOf = (def) => Object.entries(def.actions ?? {}).map(([kind, action]) => ({
|
|
38
|
+
kind,
|
|
39
|
+
of: action.of ?? null,
|
|
40
|
+
from: (action.where ?? []).map(location_1.labelOf),
|
|
41
|
+
scopeAccess: action.scopeAccess ?? [],
|
|
42
|
+
}));
|
|
43
|
+
// Where code of this entity may be declared — ONE row per node: a folder that
|
|
44
|
+
// declares the entity twice is still one place.
|
|
45
|
+
const addLabel = (home, template) => {
|
|
46
|
+
if (template && !home.labels.includes(template))
|
|
47
|
+
home.labels.push(template);
|
|
48
|
+
};
|
|
49
|
+
const homesOf = (slug, arch, nodeBySlug) => {
|
|
50
|
+
const homes = [];
|
|
51
|
+
for (const h of arch.nodes.entityHomes[slug] ?? []) {
|
|
52
|
+
const seen = homes.find((x) => x.slug === h.node);
|
|
53
|
+
if (seen) {
|
|
54
|
+
addLabel(seen, h.template);
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
const node = h.node ? nodeBySlug.get(h.node) : undefined;
|
|
58
|
+
homes.push({
|
|
59
|
+
slug: h.node ?? "",
|
|
60
|
+
paths: node?.paths ?? [],
|
|
61
|
+
label: h.template,
|
|
62
|
+
labels: h.template ? [h.template] : [],
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
return homes;
|
|
66
|
+
};
|
|
67
|
+
const entitySummary = (slug, def, ask) => {
|
|
68
|
+
const rawDef = ask.raw.get(slug) ?? {};
|
|
69
|
+
const bucket = ask.examples.get(slug) ?? { list: [], overflow: 0 };
|
|
70
|
+
return {
|
|
71
|
+
slug,
|
|
72
|
+
name: def.name ?? slug,
|
|
73
|
+
infer: (0, field_1.fieldOf)(rawDef, "infer") ?? def.infer ?? null,
|
|
74
|
+
report: reportOf(rawDef),
|
|
75
|
+
actions: actionsOf(def),
|
|
76
|
+
homes: homesOf(slug, ask.arch, ask.nodeBySlug),
|
|
77
|
+
examples: bucket.list,
|
|
78
|
+
exampleCount: bucket.list.length + bucket.overflow,
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
const buildEntities = (ask) => {
|
|
82
|
+
const { arch, nodes } = ask;
|
|
83
|
+
const raw = rawEntities(arch.raw?.entities);
|
|
84
|
+
const examples = (0, entity_examples_1.collectExamples)(ask);
|
|
85
|
+
const nodeBySlug = new Map((nodes ?? []).map((n) => [n.slug, n]));
|
|
86
|
+
return Object.entries(arch.entities ?? {}).map(([slug, def]) => entitySummary(slug, def, { arch, raw, examples, nodeBySlug }));
|
|
87
|
+
};
|
|
88
|
+
exports.buildEntities = buildEntities;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Project } from "ts-morph";
|
|
2
|
+
import type { Arch } from "@md-code/follow-architecture/entities/architecture";
|
|
3
|
+
import type { EntityExample } from "@md-code/follow-architecture/entities/overview/summaries";
|
|
4
|
+
type ExampleBucket = {
|
|
5
|
+
list: EntityExample[];
|
|
6
|
+
overflow: number;
|
|
7
|
+
};
|
|
8
|
+
declare const collectExamples: (ask: {
|
|
9
|
+
arch: Arch;
|
|
10
|
+
files: string[];
|
|
11
|
+
repoRoot: string;
|
|
12
|
+
repoFiles: string[];
|
|
13
|
+
project: Project;
|
|
14
|
+
}) => Map<string, ExampleBucket>;
|
|
15
|
+
export { collectExamples };
|
|
16
|
+
export type { ExampleBucket };
|
|
@@ -0,0 +1,136 @@
|
|
|
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.collectExamples = void 0;
|
|
37
|
+
// The REAL EXAMPLES on an entity card: the overview re-walks the sources and
|
|
38
|
+
// classifies candidates with the same engines the rule uses, so every card
|
|
39
|
+
// shows actual matches from this repository with a code snippet and the marks
|
|
40
|
+
// of what made the piece that entity.
|
|
41
|
+
const path = __importStar(require("node:path"));
|
|
42
|
+
const walk_1 = require("@md-code/follow-architecture/code-entities/walk");
|
|
43
|
+
const group_1 = require("@md-code/follow-architecture/utils/group");
|
|
44
|
+
const scan_1 = require("./scan");
|
|
45
|
+
const entity_marks_1 = require("./entity-marks");
|
|
46
|
+
const MAX_EXAMPLES_PER_ENTITY = 8;
|
|
47
|
+
// A NAMED piece beats an anonymous one as the face of an entity: anonymous
|
|
48
|
+
// matches are kept (they are real matches) but sorted after the named ones.
|
|
49
|
+
const exampleRank = (c) => (c.name ? 0 : 1);
|
|
50
|
+
// The candidates of one file, with the facets and file facts attached in the
|
|
51
|
+
// engine's own order, then classified. A file the engines cannot read is
|
|
52
|
+
// skipped — the card shows what IS there, never a guess.
|
|
53
|
+
const classifiedFile = (rel, ask) => {
|
|
54
|
+
const { arch, repoRoot, repoFiles, project } = ask;
|
|
55
|
+
try {
|
|
56
|
+
// The SAME walk the engine runs (`code-entities/walk`): the cards show the
|
|
57
|
+
// classification the run made, not a second opinion assembled here.
|
|
58
|
+
const walked = (0, walk_1.walkFile)({
|
|
59
|
+
rel,
|
|
60
|
+
arch,
|
|
61
|
+
repoRoot,
|
|
62
|
+
repoFiles,
|
|
63
|
+
aliases: arch.aliases ?? {},
|
|
64
|
+
project,
|
|
65
|
+
usage: false,
|
|
66
|
+
});
|
|
67
|
+
return { candidates: walked.classified.candidates, present: walked.classified.present, fileFacts: walked.fileFacts };
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
return { candidates: [], present: [], fileFacts: null };
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
// A MODULE entity (a barrel) is the file itself: no piece names it, so the card
|
|
74
|
+
// shows the file as its own row. The marks are the file's — the same facts
|
|
75
|
+
// `classifyEntities` classified it by, read through the candidate view the marks
|
|
76
|
+
// walk (`lines`, `kind`, `location`).
|
|
77
|
+
const moduleExampleOf = (rel, entity, fileFacts, ask) => ({
|
|
78
|
+
file: rel,
|
|
79
|
+
line: 1,
|
|
80
|
+
name: rel.slice(rel.lastIndexOf("/") + 1),
|
|
81
|
+
rank: 0,
|
|
82
|
+
code: (0, scan_1.snippet)(path.join(ask.repoRoot, rel), 1),
|
|
83
|
+
matched: (0, entity_marks_1.matchedRanges)(fileFacts, ask.arch.entities?.[entity]?.infer),
|
|
84
|
+
});
|
|
85
|
+
// One example row: the piece, its window, and the marks of its own infer.
|
|
86
|
+
const exampleOf = (c, rel, ask) => {
|
|
87
|
+
const line = c.lines?.[0] ?? 1;
|
|
88
|
+
return {
|
|
89
|
+
file: rel,
|
|
90
|
+
line,
|
|
91
|
+
name: c.name ?? "(anonymous)",
|
|
92
|
+
rank: exampleRank(c),
|
|
93
|
+
code: (0, scan_1.snippet)(path.join(ask.repoRoot, rel), line),
|
|
94
|
+
matched: (0, entity_marks_1.matchedRanges)(c, ask.arch.entities?.[c.entity ?? ""]?.infer),
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
const capped = (list) => {
|
|
98
|
+
list.sort((a, b) => a.rank - b.rank);
|
|
99
|
+
if (list.length <= MAX_EXAMPLES_PER_ENTITY)
|
|
100
|
+
return { list, overflow: 0 };
|
|
101
|
+
return { list: list.slice(0, MAX_EXAMPLES_PER_ENTITY), overflow: list.length - MAX_EXAMPLES_PER_ENTITY };
|
|
102
|
+
};
|
|
103
|
+
const collectExamples = (ask) => {
|
|
104
|
+
const rows = [];
|
|
105
|
+
// One row per (entity, file, line, name): the same declaration is collected
|
|
106
|
+
// twice (the `const Box = …` and the arrow it holds) and a card counts what
|
|
107
|
+
// the code SHOWS, not how many node shapes the walk produced.
|
|
108
|
+
const seen = new Set();
|
|
109
|
+
const push = (entity, example) => {
|
|
110
|
+
const key = `${entity}|${example.file}|${example.line}|${example.name}`;
|
|
111
|
+
if (seen.has(key))
|
|
112
|
+
return;
|
|
113
|
+
seen.add(key);
|
|
114
|
+
rows.push({ entity, example });
|
|
115
|
+
};
|
|
116
|
+
for (const rel of ask.files) {
|
|
117
|
+
const file = classifiedFile(rel, ask);
|
|
118
|
+
const carried = new Set();
|
|
119
|
+
for (const c of file.candidates) {
|
|
120
|
+
if (!c.entity)
|
|
121
|
+
continue;
|
|
122
|
+
carried.add(c.entity);
|
|
123
|
+
push(c.entity, exampleOf(c, rel, ask));
|
|
124
|
+
}
|
|
125
|
+
// The entities the FILE answered for itself (a barrel) with no piece to carry them.
|
|
126
|
+
if (!file.fileFacts)
|
|
127
|
+
continue;
|
|
128
|
+
for (const entity of file.present) {
|
|
129
|
+
if (!carried.has(entity))
|
|
130
|
+
push(entity, moduleExampleOf(rel, entity, file.fileFacts, ask));
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
const buckets = (0, group_1.groupBy)(rows, (r) => r.entity);
|
|
134
|
+
return new Map(buckets.map(([entity, items]) => [entity, capped(items.map((r) => r.example))]));
|
|
135
|
+
};
|
|
136
|
+
exports.collectExamples = collectExamples;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type FieldValue } from "@md-code/follow-architecture/utils/field";
|
|
2
|
+
import type { Candidate } from "@md-code/follow-architecture/entities/facts";
|
|
3
|
+
type ListFilter = {
|
|
4
|
+
path: string;
|
|
5
|
+
sub: FieldValue;
|
|
6
|
+
leaf?: boolean;
|
|
7
|
+
};
|
|
8
|
+
type CssHit = {
|
|
9
|
+
readonly [key: string]: FieldValue;
|
|
10
|
+
};
|
|
11
|
+
declare const listFiltersOf: (filter: FieldValue, prefix: string, out: ListFilter[]) => ListFilter[];
|
|
12
|
+
declare const valueAt: (obj: FieldValue, path: string) => FieldValue;
|
|
13
|
+
declare const deepestFilters: (filters: readonly ListFilter[], c: Candidate) => ListFilter[];
|
|
14
|
+
export { listFiltersOf, deepestFilters, valueAt };
|
|
15
|
+
export type { ListFilter, CssHit };
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.valueAt = exports.deepestFilters = exports.listFiltersOf = void 0;
|
|
4
|
+
// WHERE an entity's infer actually matched, as line ranges RELATIVE to the
|
|
5
|
+
// snippet's first line — so the reader sees WHICH declarations make this piece
|
|
6
|
+
// a `cssVariable` / `styleInversion` / … instead of three identical-looking
|
|
7
|
+
// windows. The ranges are derived from the ENTITY'S OWN infer filters run
|
|
8
|
+
// against the candidate's facts (the same `hitOf` the engine uses), so the mark
|
|
9
|
+
// can never disagree with the classification.
|
|
10
|
+
//
|
|
11
|
+
// The list filters the infer addresses are collected with their field path
|
|
12
|
+
// (`css.templates`, `css.templates.declarations`, `css.classes`). Composition
|
|
13
|
+
// (`or`/`and`/…) is looked through, quantifiers unwrapped — the same reading
|
|
14
|
+
// the rule report uses. Operator operands (`in: [...]`, `gt: 0`) are
|
|
15
|
+
// demands on a value, not roads to a deeper list, so they are never walked.
|
|
16
|
+
// The operator vocabulary is the engine's own (`KNOWN_OPS`), never a copy.
|
|
17
|
+
const field_1 = require("@md-code/follow-architecture/utils/field");
|
|
18
|
+
const queries_1 = require("@md-code/follow-architecture/entities/queries");
|
|
19
|
+
const gate_1 = require("@md-code/follow-architecture/utils/gate");
|
|
20
|
+
// A quantified list entry (`any`/`every`/`none`/`where`): a demand on the items,
|
|
21
|
+
// recorded with its path; the inner filter may name a deeper list still.
|
|
22
|
+
const isQuantified = (sub) => sub.any !== undefined || sub.every !== undefined || sub.none !== undefined || sub.where !== undefined;
|
|
23
|
+
// `length` ALONE asks about the list's size ("at least one template").
|
|
24
|
+
const isLengthLeaf = (sub) => sub.length !== undefined && Object.keys(sub).length === 1;
|
|
25
|
+
// One filter key: composition is looked through, an operator is a demand on
|
|
26
|
+
// the current value, a record names a deeper field.
|
|
27
|
+
const keyFilters = (key, sub, prefix, out) => {
|
|
28
|
+
if (queries_1.COMPOSITION_OPS.has(key)) {
|
|
29
|
+
for (const f of (0, field_1.toList)(sub))
|
|
30
|
+
listFiltersOf(f, prefix, out);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
if (queries_1.KNOWN_OPS.has(key) || !(0, field_1.isObj)(sub))
|
|
34
|
+
return;
|
|
35
|
+
const path = prefix ? `${prefix}.${key}` : key;
|
|
36
|
+
if (isQuantified(sub)) {
|
|
37
|
+
out.push({ path, sub });
|
|
38
|
+
const inner = (0, queries_1.innerFilterOf)(sub);
|
|
39
|
+
if ((0, field_1.isObj)(inner))
|
|
40
|
+
listFiltersOf(inner, path, out);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
if (isLengthLeaf(sub)) {
|
|
44
|
+
out.push({ path, sub: {}, leaf: true });
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
listFiltersOf(sub, path, out);
|
|
48
|
+
};
|
|
49
|
+
const listFiltersOf = (filter, prefix, out) => {
|
|
50
|
+
if ((0, field_1.isList)(filter)) {
|
|
51
|
+
for (const f of filter)
|
|
52
|
+
listFiltersOf(f, prefix, out);
|
|
53
|
+
return out;
|
|
54
|
+
}
|
|
55
|
+
if (!(0, field_1.isObj)(filter))
|
|
56
|
+
return out;
|
|
57
|
+
for (const [key, sub] of Object.entries(filter))
|
|
58
|
+
keyFilters(key, sub, prefix, out);
|
|
59
|
+
return out;
|
|
60
|
+
};
|
|
61
|
+
exports.listFiltersOf = listFiltersOf;
|
|
62
|
+
// A field path off a fact — `utils/field#fieldOf` is the single reader of
|
|
63
|
+
// `a.b.c`, list-aware the same way a `$ref` is.
|
|
64
|
+
const valueAt = (obj, path) => (0, field_1.fieldOf)(obj, path);
|
|
65
|
+
exports.valueAt = valueAt;
|
|
66
|
+
// A `length` leaf whose items are SCALARS (a `vars` list of names) is not a
|
|
67
|
+
// place — drop it, so the enclosing declaration demand becomes the deepest.
|
|
68
|
+
const isPlaceFilter = (f, c) => {
|
|
69
|
+
const items = (0, field_1.toList)(valueAt(c, f.path));
|
|
70
|
+
const objectItems = items.length > 0 && items.every((item) => (0, field_1.isObj)(item));
|
|
71
|
+
return (0, gate_1.admitsWhenNoneReject)(f, [() => f.leaf && !objectItems]);
|
|
72
|
+
};
|
|
73
|
+
// The DEEPEST demand on each branch decides the mark: an entity that names
|
|
74
|
+
// declarations marks those declarations, not the whole template.
|
|
75
|
+
const deepestFilters = (filters, c) => {
|
|
76
|
+
const places = filters.filter((f) => isPlaceFilter(f, c));
|
|
77
|
+
return places.filter((f) => !places.some((g) => g !== f && g.path.startsWith(`${f.path}.`)));
|
|
78
|
+
};
|
|
79
|
+
exports.deepestFilters = deepestFilters;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type FieldValue } from "@md-code/follow-architecture/utils/field";
|
|
2
|
+
import type { Candidate } from "@md-code/follow-architecture/entities/facts";
|
|
3
|
+
import type { MatchedRange } from "@md-code/follow-architecture/entities/overview/summaries";
|
|
4
|
+
declare const matchedRanges: (c: Candidate, infer: FieldValue) => MatchedRange[];
|
|
5
|
+
export { matchedRanges };
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.matchedRanges = void 0;
|
|
4
|
+
// The MARKS on an entity example: which lines of the snippet the entity's own infer
|
|
5
|
+
// caught, and why. Template-relative CSS lines are shifted by the template's
|
|
6
|
+
// own start line, because the facet numbers them inside the template text.
|
|
7
|
+
const field_1 = require("@md-code/follow-architecture/utils/field");
|
|
8
|
+
const read_field_1 = require("@md-code/follow-architecture/utils/read-field");
|
|
9
|
+
const speak_1 = require("@md-code/follow-architecture/utils/speak");
|
|
10
|
+
const queries_1 = require("@md-code/follow-architecture/entities/queries");
|
|
11
|
+
const entity_filters_1 = require("./entity-filters");
|
|
12
|
+
const rangePush = (out, seen) => (from, to, why) => {
|
|
13
|
+
if (from < 0 || to < from)
|
|
14
|
+
return;
|
|
15
|
+
if ((0, speak_1.speakOnce)(seen, `${from}:${to}:${why}`))
|
|
16
|
+
out.push({ from, to, why });
|
|
17
|
+
};
|
|
18
|
+
// A declaration's line: template-relative when it sits in a template,
|
|
19
|
+
// file-relative when it is a class on an attribute.
|
|
20
|
+
const declarationMark = (item, c, start, push) => {
|
|
21
|
+
const templates = c.framework?.css?.templates ?? [];
|
|
22
|
+
const template = templates.find((t) => (t.declarations ?? []).some((d) => d === item));
|
|
23
|
+
const base = template ? (template.startLine ?? template.line ?? start) - start - 1 : 0;
|
|
24
|
+
const at = base + (0, read_field_1.numberField)(item, "line", 1);
|
|
25
|
+
const prop = (0, read_field_1.stringField)(item, "prop", "declaration");
|
|
26
|
+
const rule = (0, field_1.fieldOf)(item, "rule");
|
|
27
|
+
push(at, at, `${prop}${rule ? ` in ${String(rule)}` : ""}`);
|
|
28
|
+
};
|
|
29
|
+
const templateMark = (item, start, push) => {
|
|
30
|
+
const base = (0, read_field_1.numberField)(item, "startLine", (0, read_field_1.numberField)(item, "line", start)) - start;
|
|
31
|
+
const decls = (0, field_1.toList)((0, field_1.fieldOf)(item, "declarations"));
|
|
32
|
+
const lastDecl = decls.length ? Math.max(...decls.map((d) => (0, read_field_1.numberField)(d, "line", 1))) : 0;
|
|
33
|
+
push(base, base + lastDecl, "css template");
|
|
34
|
+
};
|
|
35
|
+
// One hit's mark, chosen by the field path the demand named.
|
|
36
|
+
const hitMark = (ask) => {
|
|
37
|
+
const { path, item, c, start, push } = ask;
|
|
38
|
+
if (path.endsWith(".declarations"))
|
|
39
|
+
return declarationMark(item, c, start, push);
|
|
40
|
+
if (path.endsWith(".templates"))
|
|
41
|
+
return templateMark(item, start, push);
|
|
42
|
+
const line = (0, field_1.fieldOf)(item, "line");
|
|
43
|
+
if (path.endsWith(".classes")) {
|
|
44
|
+
if (line != null)
|
|
45
|
+
push(Number(line) - start, Number(line) - start, `class ${(0, read_field_1.stringField)(item, "raw")}`);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (line != null)
|
|
49
|
+
push(Number(line) - start, Number(line) - start, path);
|
|
50
|
+
};
|
|
51
|
+
// The marks one deepest demand earns: its list, filtered by the entity's own
|
|
52
|
+
// item filter, each hit marked by the path that named it.
|
|
53
|
+
const demandMarks = (ask) => {
|
|
54
|
+
const { path, sub, c, start, push } = ask;
|
|
55
|
+
const list = (0, entity_filters_1.valueAt)(c, path);
|
|
56
|
+
if (!(0, field_1.isList)(list))
|
|
57
|
+
return;
|
|
58
|
+
const hits = (0, queries_1.hitOf)(list, sub, { arch: (0, field_1.fieldOf)(c.file, "arch") });
|
|
59
|
+
for (const item of hits) {
|
|
60
|
+
if (!(0, field_1.isObj)(item))
|
|
61
|
+
continue;
|
|
62
|
+
hitMark({ path, item, c, start, push });
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
const matchedRanges = (c, infer) => {
|
|
66
|
+
const start = c.lines?.[0] ?? 1;
|
|
67
|
+
const out = [];
|
|
68
|
+
const push = rangePush(out, new Set());
|
|
69
|
+
const filters = (0, entity_filters_1.listFiltersOf)((0, field_1.isList)(infer) ? infer : [infer], "", []);
|
|
70
|
+
for (const { path, sub } of (0, entity_filters_1.deepestFilters)(filters, c))
|
|
71
|
+
demandMarks({ path, sub, c, start, push });
|
|
72
|
+
// A function-shaped match (helper, component, …): the piece's own span.
|
|
73
|
+
const lines = c.lines ?? [];
|
|
74
|
+
if (!out.length && lines.length) {
|
|
75
|
+
push(0, lines[lines.length - 1] - start, c.framework?.component ? "renders JSX" : "function-shaped piece");
|
|
76
|
+
}
|
|
77
|
+
return out;
|
|
78
|
+
};
|
|
79
|
+
exports.matchedRanges = matchedRanges;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Arch } from "@md-code/follow-architecture/entities/architecture";
|
|
2
|
+
import type { Finding } from "@md-code/follow-architecture/entities/findings";
|
|
3
|
+
import type { FileTreeEntry } from "@md-code/follow-architecture/entities/overview/file-tree";
|
|
4
|
+
declare const buildFileTree: (args: {
|
|
5
|
+
files: readonly string[];
|
|
6
|
+
arch: Arch;
|
|
7
|
+
findings: readonly Finding[];
|
|
8
|
+
}) => FileTreeEntry;
|
|
9
|
+
export { buildFileTree };
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildFileTree = void 0;
|
|
4
|
+
// The real repository tree (only scanned files), annotated with the node each
|
|
5
|
+
// file lands in and how many findings it carries. The UI renders this next to
|
|
6
|
+
// the declared architecture so "declared" and "actual" can be compared.
|
|
7
|
+
const index_1 = require("@md-code/follow-architecture/entities/tree/index");
|
|
8
|
+
const location_1 = require("@md-code/follow-architecture/entities/location");
|
|
9
|
+
const read_field_1 = require("@md-code/follow-architecture/utils/read-field");
|
|
10
|
+
const emptyDir = (name, path) => ({
|
|
11
|
+
name,
|
|
12
|
+
path,
|
|
13
|
+
type: "dir",
|
|
14
|
+
nodeSlug: null,
|
|
15
|
+
children: [],
|
|
16
|
+
files: 0,
|
|
17
|
+
findings: 0,
|
|
18
|
+
});
|
|
19
|
+
const fileEntry = (rel, arch, count) => ({
|
|
20
|
+
name: (0, location_1.segmentsOf)(rel).at(-1) ?? "",
|
|
21
|
+
path: rel,
|
|
22
|
+
type: "file",
|
|
23
|
+
nodeSlug: (0, index_1.deepestMatch)(rel, arch)?.node?.slug ?? null,
|
|
24
|
+
findings: count,
|
|
25
|
+
children: [],
|
|
26
|
+
files: 1,
|
|
27
|
+
});
|
|
28
|
+
// Roll counts up so a collapsed folder still shows how much is inside.
|
|
29
|
+
const rollUp = (dir) => {
|
|
30
|
+
let files = 0;
|
|
31
|
+
let findings = 0;
|
|
32
|
+
for (const child of dir.children) {
|
|
33
|
+
if (child.type === "dir")
|
|
34
|
+
rollUp(child);
|
|
35
|
+
files += child.files;
|
|
36
|
+
findings += child.findings;
|
|
37
|
+
}
|
|
38
|
+
dir.files = files;
|
|
39
|
+
dir.findings = findings;
|
|
40
|
+
return dir;
|
|
41
|
+
};
|
|
42
|
+
const byType = (a, b) => {
|
|
43
|
+
if (a.type === b.type)
|
|
44
|
+
return a.name.localeCompare(b.name);
|
|
45
|
+
return a.type === "dir" ? -1 : 1;
|
|
46
|
+
};
|
|
47
|
+
const sortDir = (dir) => {
|
|
48
|
+
dir.children.sort(byType);
|
|
49
|
+
for (const child of dir.children)
|
|
50
|
+
if (child.type === "dir")
|
|
51
|
+
sortDir(child);
|
|
52
|
+
};
|
|
53
|
+
const buildFileTree = (args) => {
|
|
54
|
+
const { files, arch, findings } = args;
|
|
55
|
+
const findingCount = new Map();
|
|
56
|
+
for (const f of findings) {
|
|
57
|
+
const file = (0, read_field_1.stringField)(f, "file");
|
|
58
|
+
findingCount.set(file, (findingCount.get(file) ?? 0) + 1);
|
|
59
|
+
}
|
|
60
|
+
const root = emptyDir(".", "");
|
|
61
|
+
const dirs = new Map([["", root]]);
|
|
62
|
+
const ensureDir = (dirPath) => {
|
|
63
|
+
const existing = dirs.get(dirPath);
|
|
64
|
+
if (existing)
|
|
65
|
+
return existing;
|
|
66
|
+
const parent = ensureDir((0, location_1.parentOf)(dirPath));
|
|
67
|
+
const node = emptyDir((0, location_1.segmentsOf)(dirPath).at(-1) ?? "", dirPath);
|
|
68
|
+
parent.children.push(node);
|
|
69
|
+
dirs.set(dirPath, node);
|
|
70
|
+
return node;
|
|
71
|
+
};
|
|
72
|
+
for (const rel of [...files].sort()) {
|
|
73
|
+
const parent = ensureDir((0, location_1.parentOf)(rel));
|
|
74
|
+
parent.children.push(fileEntry(rel, arch, findingCount.get(rel) ?? 0));
|
|
75
|
+
}
|
|
76
|
+
rollUp(root);
|
|
77
|
+
sortDir(root);
|
|
78
|
+
return root;
|
|
79
|
+
};
|
|
80
|
+
exports.buildFileTree = buildFileTree;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ArchNode } from "@md-code/follow-architecture/entities/architecture";
|
|
2
|
+
import type { NodeSummary } from "@md-code/follow-architecture/entities/overview/summaries";
|
|
3
|
+
import type { Boundary } from "@md-code/follow-architecture/entities/overview/finding";
|
|
4
|
+
declare const boundaryDetail: (args: {
|
|
5
|
+
ownerNode: ArchNode | null;
|
|
6
|
+
targetNode: NodeSummary | null;
|
|
7
|
+
entities: readonly string[];
|
|
8
|
+
}) => Boundary | null;
|
|
9
|
+
export { boundaryDetail };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.boundaryDetail = void 0;
|
|
4
|
+
const boundaryDetail = (args) => {
|
|
5
|
+
const { ownerNode, targetNode, entities } = args;
|
|
6
|
+
if (!targetNode)
|
|
7
|
+
return null;
|
|
8
|
+
const where = targetNode.paths.join(" | ");
|
|
9
|
+
const list = entities.filter(Boolean);
|
|
10
|
+
const ownerPath = ownerNode ? ownerNode.path : "";
|
|
11
|
+
const ownerText = ownerNode ? `\`${ownerNode.slug}\` (${ownerPath})` : "no declared node";
|
|
12
|
+
return {
|
|
13
|
+
targetNode: targetNode.slug,
|
|
14
|
+
targetPaths: targetNode.paths,
|
|
15
|
+
ownerNode: ownerNode?.slug ?? null,
|
|
16
|
+
ownerPaths: ownerNode ? [ownerNode.path] : [],
|
|
17
|
+
summary: `\`${targetNode.slug}\` (${where}) may be reached only from: ${list.length ? list.join(", ") : "—"}. This file belongs to ${ownerText}, which is not on that list.`,
|
|
18
|
+
allowed: list,
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
exports.boundaryDetail = boundaryDetail;
|