@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,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.entitiesAtNode = exports.homesOf = exports.actionKinds = exports.sameInstance = void 0;
|
|
4
|
+
// The ACCESS GRAPH helpers: the vocabulary of action kinds, the homes an entity
|
|
5
|
+
// may live in, and the "same instance" question for a repeating node. Split
|
|
6
|
+
// from the builder so each file stays small and the decisions are named.
|
|
7
|
+
const location_1 = require("@md-code/follow-architecture/entities/location");
|
|
8
|
+
const gate_1 = require("@md-code/follow-architecture/utils/gate");
|
|
9
|
+
const kinds_1 = require("@md-code/follow-architecture/entities/kinds");
|
|
10
|
+
// Two node templates address the same instance when their DIRECTORY segments
|
|
11
|
+
// agree position by position: literals must be equal, a placeholder on both
|
|
12
|
+
// sides lines up, and a placeholder against a literal cannot be the same folder.
|
|
13
|
+
// "The same instance" only constrains a node that CAN repeat: the root store is
|
|
14
|
+
// declared once, so every action may import it (the engine's own rule).
|
|
15
|
+
const isVar = (s) => /^\{[^}]+\}$/.test(s);
|
|
16
|
+
const dirsOf = (node) => (0, location_1.segmentsOf)(node.paths[0]).slice(0, -1);
|
|
17
|
+
const dirsAgree = (da, db) => {
|
|
18
|
+
if (da.length !== db.length)
|
|
19
|
+
return false;
|
|
20
|
+
return da.every((seg, i) => (isVar(seg) && isVar(db[i]) ? true : seg === db[i]));
|
|
21
|
+
};
|
|
22
|
+
const sameInstance = (a, b) => {
|
|
23
|
+
const single = !isVar((0, location_1.segmentsOf)(b.paths[0]).at(-1) ?? "");
|
|
24
|
+
const repeats = dirsOf(b).some(isVar);
|
|
25
|
+
return (0, gate_1.admitsWhenNoneReject)({ a, b }, [() => !single, () => repeats && !dirsAgree(dirsOf(a), dirsOf(b))]);
|
|
26
|
+
};
|
|
27
|
+
exports.sameInstance = sameInstance;
|
|
28
|
+
// The action names the config uses, in declaration order: the relation
|
|
29
|
+
// vocabulary first, then any name the config invented. A kind no entity mentions
|
|
30
|
+
// is still listed — "0 edges" is a fact about the architecture, not a gap.
|
|
31
|
+
const actionKinds = (entities) => {
|
|
32
|
+
const kinds = [...kinds_1.FACT_KINDS];
|
|
33
|
+
const seen = new Set(kinds);
|
|
34
|
+
for (const def of Object.values(entities)) {
|
|
35
|
+
for (const kind of Object.keys(def.actions ?? {})) {
|
|
36
|
+
if (seen.has(kind))
|
|
37
|
+
continue;
|
|
38
|
+
seen.add(kind);
|
|
39
|
+
kinds.push(kind);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return kinds;
|
|
43
|
+
};
|
|
44
|
+
exports.actionKinds = actionKinds;
|
|
45
|
+
// Folders an entity may live in: the node children that declare `entity:`. An entity
|
|
46
|
+
// with no such child cannot appear on this graph.
|
|
47
|
+
const homesOf = (slug, arch, bySlug) => {
|
|
48
|
+
const out = [];
|
|
49
|
+
for (const h of arch.nodes.entityHomes[slug] ?? []) {
|
|
50
|
+
const node = h.node ? bySlug.get(h.node) : undefined;
|
|
51
|
+
if (node && !out.includes(node))
|
|
52
|
+
out.push(node);
|
|
53
|
+
}
|
|
54
|
+
return out;
|
|
55
|
+
};
|
|
56
|
+
exports.homesOf = homesOf;
|
|
57
|
+
// Which entities live in a folder — so an arrow can be attributed to the entity that
|
|
58
|
+
// OWNS the source side, not only to the entity it points at.
|
|
59
|
+
const entitiesAtNode = (entities, arch, nodes, bySlug) => {
|
|
60
|
+
const map = new Map(nodes.map((n) => [n.slug, []]));
|
|
61
|
+
for (const slug of Object.keys(entities)) {
|
|
62
|
+
for (const node of homesOf(slug, arch, bySlug))
|
|
63
|
+
map.get(node.slug)?.push(slug);
|
|
64
|
+
}
|
|
65
|
+
return map;
|
|
66
|
+
};
|
|
67
|
+
exports.entitiesAtNode = entitiesAtNode;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Arch } from "@md-code/follow-architecture/entities/architecture";
|
|
2
|
+
import type { NodeSummary } from "@md-code/follow-architecture/entities/overview/summaries";
|
|
3
|
+
import type { EnrichedFinding } from "@md-code/follow-architecture/entities/overview/finding";
|
|
4
|
+
import type { AccessGraph, ObservedEdge } from "@md-code/follow-architecture/entities/overview/graph";
|
|
5
|
+
type GraphAsk = {
|
|
6
|
+
arch: Arch;
|
|
7
|
+
nodes: NodeSummary[];
|
|
8
|
+
findings: EnrichedFinding[];
|
|
9
|
+
observed?: ObservedEdge[];
|
|
10
|
+
};
|
|
11
|
+
declare const buildAccessGraph: (input: GraphAsk) => AccessGraph;
|
|
12
|
+
export { buildAccessGraph };
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildAccessGraph = void 0;
|
|
4
|
+
// The access graph the Graph screen draws: folder→folder edges per declared
|
|
5
|
+
// action (with mirrored pairs drawn once), the violations that break them,
|
|
6
|
+
// per-folder adjacency, and the entity-level graph beside it.
|
|
7
|
+
//
|
|
8
|
+
// Data in, data out — no DOM, no React. Every number is computed here from the
|
|
9
|
+
// architecture and the findings, so the picture never invents a rule.
|
|
10
|
+
const index_1 = require("@md-code/follow-architecture/entities/tree/index");
|
|
11
|
+
const distinct_1 = require("@md-code/follow-architecture/utils/distinct");
|
|
12
|
+
const graph_helpers_1 = require("./graph-helpers");
|
|
13
|
+
const graph_edges_1 = require("./graph-edges");
|
|
14
|
+
const graph_entities_1 = require("./graph-entities");
|
|
15
|
+
// What is actually broken: a finding that names both the folder the file sits
|
|
16
|
+
// in and the folder it reached. A refused relation's target is a ENTITY, resolved
|
|
17
|
+
// to the node its path lands in.
|
|
18
|
+
const slugOfPath = (path, arch) => path ? ((0, index_1.deepestMatch)(String(path), arch)?.node?.slug ?? null) : null;
|
|
19
|
+
const violationOf = (f, arch) => ({
|
|
20
|
+
kind: f.violation?.kind ?? "",
|
|
21
|
+
from: f.ownerNode ?? "",
|
|
22
|
+
to: slugOfPath(f.violation?.targetPath, arch) ?? f.violation?.targetNode ?? "",
|
|
23
|
+
entity: f.violation?.targetNode ?? "",
|
|
24
|
+
file: f.file,
|
|
25
|
+
line: f.line,
|
|
26
|
+
title: f.title,
|
|
27
|
+
});
|
|
28
|
+
const graphViolations = (findings, arch) => findings.filter((f) => f.violation && f.ownerNode && f.violation.targetNode).map((f) => violationOf(f, arch));
|
|
29
|
+
// The arrows that ARE the finding: same pair, same action.
|
|
30
|
+
const markBroken = (edges, violations) => {
|
|
31
|
+
const brokenBy = new Map();
|
|
32
|
+
for (const v of violations) {
|
|
33
|
+
const key = `${v.kind}|${v.from}|${v.to}`;
|
|
34
|
+
brokenBy.set(key, [...(brokenBy.get(key) ?? []), v]);
|
|
35
|
+
}
|
|
36
|
+
return edges.map((e) => {
|
|
37
|
+
const broken = brokenBy.get(`${e.kind}|${e.from}|${e.to}`) ?? null;
|
|
38
|
+
return {
|
|
39
|
+
...e,
|
|
40
|
+
kinds: [e.kind],
|
|
41
|
+
scope: [...(e.scope ?? [])],
|
|
42
|
+
...(broken ? { broken: true, brokenCount: broken.length } : {}),
|
|
43
|
+
};
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
// Per-folder adjacency, keyed by slug. A plain object, not a Map: the payload
|
|
47
|
+
// is JSON inlined into the HTML, where a Map would serialize to nothing.
|
|
48
|
+
const adjacencyOf = (nodes, edges) => {
|
|
49
|
+
const byNode = Object.fromEntries(nodes.map((n) => [n.slug, { in: [], out: [] }]));
|
|
50
|
+
for (const e of edges) {
|
|
51
|
+
byNode[e.from]?.out.push(e);
|
|
52
|
+
byNode[e.to]?.in.push(e);
|
|
53
|
+
}
|
|
54
|
+
return byNode;
|
|
55
|
+
};
|
|
56
|
+
// The entities that actually produce an arrow — the chooser on the Graph screen.
|
|
57
|
+
const entityKinds = (edges) => (0, distinct_1.distinctFlat)(edges, (e) => [e.target]);
|
|
58
|
+
// Every declared action, walked entity by entity into folder→folder edges.
|
|
59
|
+
const collectEdges = (ask, entitiesAt, bySlug) => {
|
|
60
|
+
const { arch } = ask;
|
|
61
|
+
const unplaceable = [];
|
|
62
|
+
const mentions = {};
|
|
63
|
+
const seen = new Set();
|
|
64
|
+
const edges = [];
|
|
65
|
+
for (const [targetSlug, def] of Object.entries(arch.entities)) {
|
|
66
|
+
const targets = (0, graph_helpers_1.homesOf)(targetSlug, arch, bySlug);
|
|
67
|
+
for (const [kind, action] of Object.entries(def.actions ?? {})) {
|
|
68
|
+
edges.push(...(0, graph_edges_1.actionEdges)({ kind, action, targetSlug, targets, arch, bySlug, entitiesAt, seen, unplaceable, mentions }));
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return { edges, unplaceable, mentions };
|
|
72
|
+
};
|
|
73
|
+
const buildAccessGraph = (input) => {
|
|
74
|
+
const { arch, nodes, findings } = input;
|
|
75
|
+
const observed = input.observed ?? [];
|
|
76
|
+
const entities = arch.entities;
|
|
77
|
+
const bySlug = new Map(nodes.map((n) => [n.slug, n]));
|
|
78
|
+
const entitiesAt = (0, graph_helpers_1.entitiesAtNode)(entities, arch, nodes, bySlug);
|
|
79
|
+
const kinds = (0, graph_helpers_1.actionKinds)(entities);
|
|
80
|
+
const { edges, unplaceable, mentions } = collectEdges(input, entitiesAt, bySlug);
|
|
81
|
+
const drawn = (0, graph_edges_1.withoutMirrored)(edges, bySlug);
|
|
82
|
+
const violations = graphViolations(findings ?? [], arch);
|
|
83
|
+
const merged = markBroken(drawn, violations);
|
|
84
|
+
return {
|
|
85
|
+
kinds,
|
|
86
|
+
entities: entityKinds(merged),
|
|
87
|
+
edges: merged,
|
|
88
|
+
violations,
|
|
89
|
+
unplaceable,
|
|
90
|
+
mentions,
|
|
91
|
+
byNode: adjacencyOf(nodes, merged),
|
|
92
|
+
entityNodes: (0, graph_entities_1.entityNodes)(entities, arch),
|
|
93
|
+
entityEdges: (0, graph_entities_1.entityEdges)(edges, violations, mentions, observed),
|
|
94
|
+
observed,
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
exports.buildAccessGraph = buildAccessGraph;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Arch, RawNode } from "@md-code/follow-architecture/entities/architecture";
|
|
2
|
+
import type { NodeSummary } from "@md-code/follow-architecture/entities/overview/summaries";
|
|
3
|
+
declare const rawList: (raw: Arch["raw"]["nodes"]) => RawNode[];
|
|
4
|
+
declare const buildNodes: (args: {
|
|
5
|
+
arch: Arch;
|
|
6
|
+
files: readonly string[];
|
|
7
|
+
repoRoot: string;
|
|
8
|
+
}) => {
|
|
9
|
+
nodes: NodeSummary[];
|
|
10
|
+
};
|
|
11
|
+
export { buildNodes, rawList };
|
|
@@ -0,0 +1,116 @@
|
|
|
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.rawList = exports.buildNodes = void 0;
|
|
37
|
+
// Node summaries for the overview: every declared folder/file node with its
|
|
38
|
+
// resolved paths, allowed children, and the real files that land in it.
|
|
39
|
+
//
|
|
40
|
+
// A node is STRUCTURE only: a folder, and the children it allows. Its `entity:`
|
|
41
|
+
// children are what give an entity a home, so they are shown here.
|
|
42
|
+
const path = __importStar(require("node:path"));
|
|
43
|
+
const index_1 = require("@md-code/follow-architecture/entities/tree/index");
|
|
44
|
+
const index_2 = require("@md-code/follow-architecture/nodes/finally/index");
|
|
45
|
+
const scan_1 = require("./scan");
|
|
46
|
+
const keyed_1 = require("@md-code/follow-architecture/utils/keyed");
|
|
47
|
+
const field_1 = require("@md-code/follow-architecture/utils/field");
|
|
48
|
+
const read_field_1 = require("@md-code/follow-architecture/utils/read-field");
|
|
49
|
+
// The nodes section as a list — the shared list-or-map walk, the same one the
|
|
50
|
+
// tree builder reads. A map value that is not a record is dropped (null).
|
|
51
|
+
const rawList = (raw) => (0, keyed_1.keyedDefs)(raw).filter((n) => n != null);
|
|
52
|
+
exports.rawList = rawList;
|
|
53
|
+
const childName = (c) => {
|
|
54
|
+
if (typeof c === "string")
|
|
55
|
+
return c;
|
|
56
|
+
const base = c.node ? `→ ${c.node}` : (c.name ?? JSON.stringify(c));
|
|
57
|
+
const entities = (0, field_1.toList)(c.entity).filter((r) => typeof r === "string");
|
|
58
|
+
return entities.length ? `${base} → ${entities.join(", ")}` : base;
|
|
59
|
+
};
|
|
60
|
+
// Files that land in a folder which failed its node's `required` children are
|
|
61
|
+
// NOT in the tree: that folder is not a node of the architecture, so counting
|
|
62
|
+
// its files under the node would claim they live somewhere legal.
|
|
63
|
+
const fileLanding = (files, arch) => {
|
|
64
|
+
const byNode = new Map();
|
|
65
|
+
for (const rel of files) {
|
|
66
|
+
const hit = (0, index_1.deepestMatch)(rel, arch);
|
|
67
|
+
if (!hit)
|
|
68
|
+
continue;
|
|
69
|
+
if ((0, index_2.missingRequiredChild)(hit.node, arch, rel, [...files]))
|
|
70
|
+
continue;
|
|
71
|
+
const slug = hit.node.slug;
|
|
72
|
+
const list = byNode.get(slug);
|
|
73
|
+
if (list)
|
|
74
|
+
list.push(rel);
|
|
75
|
+
else
|
|
76
|
+
byNode.set(slug, [rel]);
|
|
77
|
+
}
|
|
78
|
+
return byNode;
|
|
79
|
+
};
|
|
80
|
+
const reportText = (raw) => {
|
|
81
|
+
const report = raw.report;
|
|
82
|
+
if (typeof report === "string")
|
|
83
|
+
return report;
|
|
84
|
+
return (0, field_1.isObj)(report) ? (0, read_field_1.stringField)(report, "description") || (0, read_field_1.stringField)(report, "message") || null : null;
|
|
85
|
+
};
|
|
86
|
+
const nodeSummary = (n, raw, owned, repoRoot) => ({
|
|
87
|
+
slug: n.slug,
|
|
88
|
+
name: n.name,
|
|
89
|
+
paths: n.variants.map((v) => v.path),
|
|
90
|
+
isFile: Boolean(n.isFile),
|
|
91
|
+
parents: n.parents.filter((p) => Boolean(p)),
|
|
92
|
+
children: (raw.children ?? []).map(childName),
|
|
93
|
+
report: reportText(raw),
|
|
94
|
+
files: owned.slice(0, 40),
|
|
95
|
+
fileCount: owned.length,
|
|
96
|
+
lineCount: owned.reduce((sum, rel) => sum + (0, scan_1.lineCount)(path.join(repoRoot, rel)), 0),
|
|
97
|
+
exampleFile: owned[0] ?? null,
|
|
98
|
+
sample: owned[0] ? { file: owned[0], ...(0, scan_1.snippet)(path.join(repoRoot, owned[0]), 1, { max: 12 }) } : null,
|
|
99
|
+
entities: [],
|
|
100
|
+
});
|
|
101
|
+
// Which code entities this node gives a home to: its own `entity:` children.
|
|
102
|
+
const entitiesOfNode = (slug, arch) => Object.keys(arch.nodes.entityHomes).filter((entity) => arch.nodes.entityHomes[entity].some((h) => h.node === slug));
|
|
103
|
+
const buildNodes = (args) => {
|
|
104
|
+
const { arch, files, repoRoot } = args;
|
|
105
|
+
const rawBySlug = new Map(rawList(arch.raw.nodes).map((n) => [n.slug, n]));
|
|
106
|
+
const landings = fileLanding(files, arch);
|
|
107
|
+
const nodes = arch.nodes.all.map((n) => {
|
|
108
|
+
const raw = rawBySlug.get(n.slug) ?? { name: n.name };
|
|
109
|
+
const owned = (landings.get(n.slug) ?? []).sort();
|
|
110
|
+
const summary = nodeSummary(n, raw, owned, repoRoot);
|
|
111
|
+
summary.entities = entitiesOfNode(n.slug, arch);
|
|
112
|
+
return summary;
|
|
113
|
+
});
|
|
114
|
+
return { nodes };
|
|
115
|
+
};
|
|
116
|
+
exports.buildNodes = buildNodes;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type FieldValue } from "@md-code/follow-architecture/utils/field";
|
|
2
|
+
import type { Arch } from "@md-code/follow-architecture/entities/architecture";
|
|
3
|
+
import type { Finding } from "@md-code/follow-architecture/entities/findings";
|
|
4
|
+
import type { RuleSummary } from "@md-code/follow-architecture/entities/overview/summaries";
|
|
5
|
+
declare const describeCondition: (query: FieldValue) => string[];
|
|
6
|
+
declare const buildRules: (arch: Arch, findings: readonly Finding[]) => RuleSummary[];
|
|
7
|
+
export { buildRules, describeCondition };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.describeCondition = exports.buildRules = void 0;
|
|
4
|
+
// The entry labeller is the engine's — a `where` reads the same in the report as
|
|
5
|
+
// it does in the rule.
|
|
6
|
+
const location_1 = require("@md-code/follow-architecture/entities/location");
|
|
7
|
+
const describe_1 = require("@md-code/follow-architecture/report/user-report/shared/describe");
|
|
8
|
+
const field_1 = require("@md-code/follow-architecture/utils/field");
|
|
9
|
+
const read_field_1 = require("@md-code/follow-architecture/utils/read-field");
|
|
10
|
+
// Rule summaries: the YAML `infer` block is a nested query object.
|
|
11
|
+
// The overview turns each one into a short, readable condition so a reader can
|
|
12
|
+
// tell what the rule actually demands. `where` and `ignore` are labelled by the
|
|
13
|
+
// same describer the engine uses — never `String(entry)`.
|
|
14
|
+
const IGNORED = ["report", "message", "fix", "key", "line"];
|
|
15
|
+
const describeCondition = (query) => (0, describe_1.describeQuery)(query, { ignore: IGNORED, setValue: "" });
|
|
16
|
+
exports.describeCondition = describeCondition;
|
|
17
|
+
// The report text a rule states: a bare string, or `{ description | message }`.
|
|
18
|
+
const reportMessage = (report) => {
|
|
19
|
+
if (typeof report === "string")
|
|
20
|
+
return report;
|
|
21
|
+
if (!(0, field_1.isObj)(report))
|
|
22
|
+
return null;
|
|
23
|
+
const desc = report.description;
|
|
24
|
+
const msg = report.message;
|
|
25
|
+
return (typeof desc === "string" ? desc : "") || (typeof msg === "string" ? msg : "") || null;
|
|
26
|
+
};
|
|
27
|
+
const summarizeRule = (entry, inv) => {
|
|
28
|
+
const report = (0, field_1.isObj)(entry) ? (0, field_1.fieldOf)(entry, "report") : inv.report;
|
|
29
|
+
return {
|
|
30
|
+
conditions: describeCondition(entry ?? {}),
|
|
31
|
+
message: reportMessage(report),
|
|
32
|
+
fix: ((0, field_1.isObj)(report) ? report.fix : null) ?? null,
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
const labelsOf = (entries) => (entries ?? []).map(location_1.labelOf);
|
|
36
|
+
// The raw rule by id, for the `when` block the built model does not carry.
|
|
37
|
+
const rawWhen = (raw) => {
|
|
38
|
+
const when = (0, field_1.isObj)(raw) ? (0, field_1.fieldOf)(raw, "when") : null;
|
|
39
|
+
return when ? describeCondition(when) : [];
|
|
40
|
+
};
|
|
41
|
+
const ruleSummary = (inv, raw, counts) => ({
|
|
42
|
+
id: inv.id,
|
|
43
|
+
where: labelsOf(inv.where),
|
|
44
|
+
ignore: labelsOf(inv.ignore),
|
|
45
|
+
when: rawWhen(raw),
|
|
46
|
+
dedupeBy: labelsOf(inv.dedupeBy),
|
|
47
|
+
report: reportMessage(inv.report),
|
|
48
|
+
infer: (inv.infer ?? []).map((e) => summarizeRule(e, inv)),
|
|
49
|
+
findingCount: counts.get(inv.id) ?? 0,
|
|
50
|
+
});
|
|
51
|
+
const buildRules = (arch, findings) => {
|
|
52
|
+
const rawList = arch.raw.rules ?? [];
|
|
53
|
+
const rawById = new Map(rawList.map((i) => [String((0, field_1.isObj)(i) ? (0, field_1.fieldOf)(i, "id") : ""), i]));
|
|
54
|
+
const counts = new Map();
|
|
55
|
+
for (const f of findings) {
|
|
56
|
+
const id = /^rule:([^:]+)/.exec((0, read_field_1.stringField)(f, "dedupeKey") || (0, read_field_1.stringField)(f, "key"))?.[1];
|
|
57
|
+
if (id)
|
|
58
|
+
counts.set(id, (counts.get(id) ?? 0) + 1);
|
|
59
|
+
}
|
|
60
|
+
return arch.rules.map((inv) => ruleSummary(inv, rawById.get(inv.id) ?? null, counts));
|
|
61
|
+
};
|
|
62
|
+
exports.buildRules = buildRules;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Snippet } from "@md-code/follow-architecture/entities/overview/summaries";
|
|
2
|
+
declare const readText: (abs: string) => string;
|
|
3
|
+
declare const snippet: (abs: string, line: number | null | undefined, opts?: {
|
|
4
|
+
before?: number;
|
|
5
|
+
max?: number;
|
|
6
|
+
}) => Snippet | null;
|
|
7
|
+
declare const lineCount: (abs: string) => number;
|
|
8
|
+
export { readText, snippet, lineCount };
|
|
@@ -0,0 +1,69 @@
|
|
|
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.lineCount = exports.snippet = exports.readText = void 0;
|
|
37
|
+
// Filesystem helpers for the overview report: cached file reads, code
|
|
38
|
+
// snippets around a declaration, and small path utilities. The overview
|
|
39
|
+
// re-reads sources (separately from the lint pass) so a single file is read
|
|
40
|
+
// once no matter how many entities/examples point at it.
|
|
41
|
+
const fs = __importStar(require("node:fs"));
|
|
42
|
+
const try_read_1 = require("@md-code/follow-architecture/utils/try-read");
|
|
43
|
+
const textCache = new Map();
|
|
44
|
+
const cacheRead = (abs) => {
|
|
45
|
+
const text = fs.readFileSync(abs, "utf8");
|
|
46
|
+
textCache.set(abs, text);
|
|
47
|
+
return text;
|
|
48
|
+
};
|
|
49
|
+
const readText = (abs) => {
|
|
50
|
+
const cached = textCache.get(abs);
|
|
51
|
+
return cached !== undefined ? cached : cacheRead(abs);
|
|
52
|
+
};
|
|
53
|
+
exports.readText = readText;
|
|
54
|
+
// A code window starting at `line` (1-based). `max` caps the height so a huge
|
|
55
|
+
// function does not blow up the payload; `before` adds leading context.
|
|
56
|
+
const snippet = (abs, line, opts = {}) => {
|
|
57
|
+
const { before = 0, max = 14 } = opts;
|
|
58
|
+
return (0, try_read_1.readOrFallback)(abs, (file) => {
|
|
59
|
+
const lines = readText(file).split("\n");
|
|
60
|
+
const start = Math.max(0, (line ?? 1) - 1 - before);
|
|
61
|
+
const body = lines.slice(start, start + max).map((l) => l.replace(/\t/g, " "));
|
|
62
|
+
while (body.length && body[body.length - 1].trim() === "")
|
|
63
|
+
body.pop();
|
|
64
|
+
return { startLine: start + 1, lines: body, truncated: lines.length > start + max };
|
|
65
|
+
}, null);
|
|
66
|
+
};
|
|
67
|
+
exports.snippet = snippet;
|
|
68
|
+
const lineCount = (abs) => (0, try_read_1.readOrFallback)(abs, (file) => readText(file).split("\n").length, 0);
|
|
69
|
+
exports.lineCount = lineCount;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.renderHtml = void 0;
|
|
4
|
+
// The HTML shell. It inlines the compiled React bundle and the JSON payload
|
|
5
|
+
// into ONE file, so the overview can be written anywhere and opened straight
|
|
6
|
+
// from disk (no server, no network, no sidecar files).
|
|
7
|
+
const bundle_1 = require("@md-code/follow-architecture/report/user-report/build/bundle");
|
|
8
|
+
const escapeForScript = (text) => String(text).replace(/<\/script/gi, "<\\/script");
|
|
9
|
+
const renderHtml = (data) => {
|
|
10
|
+
const js = escapeForScript((0, bundle_1.getBundle)());
|
|
11
|
+
const payload = escapeForScript(JSON.stringify(data));
|
|
12
|
+
return `<!doctype html>
|
|
13
|
+
<html lang="en">
|
|
14
|
+
<head>
|
|
15
|
+
<meta charset="utf-8" />
|
|
16
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
17
|
+
<title>Architecture overview — ${data.meta.repoName}</title>
|
|
18
|
+
</head>
|
|
19
|
+
<body>
|
|
20
|
+
<div id="root"></div>
|
|
21
|
+
<script type="application/json" id="arch-data">${payload}</script>
|
|
22
|
+
<script>${js}</script>
|
|
23
|
+
</body>
|
|
24
|
+
</html>
|
|
25
|
+
`;
|
|
26
|
+
};
|
|
27
|
+
exports.renderHtml = renderHtml;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { collectOverviewData } from "./data/collect";
|
|
2
|
+
import type { OverviewData } from "@md-code/follow-architecture/entities/overview/data";
|
|
3
|
+
declare const renderOverview: (data: OverviewData) => string;
|
|
4
|
+
declare const writeOverview: (data: OverviewData, outPath: string) => {
|
|
5
|
+
path: string;
|
|
6
|
+
bytes: number;
|
|
7
|
+
};
|
|
8
|
+
export { collectOverviewData, writeOverview, renderOverview };
|
|
@@ -0,0 +1,58 @@
|
|
|
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.renderOverview = exports.writeOverview = exports.collectOverviewData = void 0;
|
|
37
|
+
// Public entry for the interactive overview (`--overview`).
|
|
38
|
+
//
|
|
39
|
+
// const { collectOverviewData, renderOverview } = require("./report/user-report");
|
|
40
|
+
// const html = renderOverview(collectOverviewData({ ... }));
|
|
41
|
+
//
|
|
42
|
+
// The payload is plain JSON; the presentation is the React app in ./src,
|
|
43
|
+
// compiled on demand by ./build/bundle.js and inlined by ./html/shell.js.
|
|
44
|
+
const fs = __importStar(require("node:fs"));
|
|
45
|
+
const path = __importStar(require("node:path"));
|
|
46
|
+
const collect_1 = require("./data/collect");
|
|
47
|
+
Object.defineProperty(exports, "collectOverviewData", { enumerable: true, get: function () { return collect_1.collectOverviewData; } });
|
|
48
|
+
const shell_1 = require("./html/shell");
|
|
49
|
+
const renderOverview = (data) => (0, shell_1.renderHtml)(data);
|
|
50
|
+
exports.renderOverview = renderOverview;
|
|
51
|
+
// Write the overview and return the path plus a one-line summary for the CLI.
|
|
52
|
+
const writeOverview = (data, outPath) => {
|
|
53
|
+
const abs = path.resolve(outPath);
|
|
54
|
+
fs.mkdirSync(path.dirname(abs), { recursive: true });
|
|
55
|
+
fs.writeFileSync(abs, renderOverview(data), "utf8");
|
|
56
|
+
return { path: abs, bytes: fs.statSync(abs).size };
|
|
57
|
+
};
|
|
58
|
+
exports.writeOverview = writeOverview;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type FieldValue } from "@md-code/follow-architecture/utils/field";
|
|
2
|
+
type DescribeOptions = {
|
|
3
|
+
ignore?: readonly string[];
|
|
4
|
+
setValue?: string;
|
|
5
|
+
};
|
|
6
|
+
declare const describeQuery: (query: FieldValue, opts?: DescribeOptions) => string[];
|
|
7
|
+
export { describeQuery };
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.describeQuery = void 0;
|
|
4
|
+
// Turn a nested architecture query (`infer` blocks, rule conditions, `when`
|
|
5
|
+
// blocks) into short, readable lines: `subscriptions.length > 0`,
|
|
6
|
+
// `descendants[*].kind = ClassDeclaration`. ONE walk, shared by the Node-side
|
|
7
|
+
// summarizer (`data/rules`) and the browser describer
|
|
8
|
+
// (`src/utils/describe`), which used to carry the same algorithm twice and
|
|
9
|
+
// could drift.
|
|
10
|
+
//
|
|
11
|
+
// The two callers differ in PRESENTATION only, so that is what the options
|
|
12
|
+
// carry — never a second copy of the walk:
|
|
13
|
+
// ignore keys that are prose, not part of the condition (report/message/…)
|
|
14
|
+
// setValue the text an `is set` operator prints; `undefined` keeps the value
|
|
15
|
+
// the query carries (the browser reader), `""` blanks it (Node side)
|
|
16
|
+
const operators_1 = require("@md-code/follow-architecture/entities/operators");
|
|
17
|
+
const field_1 = require("@md-code/follow-architecture/utils/field");
|
|
18
|
+
const dispatch_1 = require("@md-code/follow-architecture/utils/dispatch");
|
|
19
|
+
const fmt = (v) => typeof v === "string" || typeof v === "number" || typeof v === "boolean" ? String(v) : JSON.stringify(v);
|
|
20
|
+
const scalarValue = (op, child, setValue) => op === "is set" && setValue !== undefined ? setValue : fmt(child);
|
|
21
|
+
// `at` picks ONE element: it reads as `segments[-2]`, not as a field called
|
|
22
|
+
// `at` with children — the index belongs to the path.
|
|
23
|
+
const walkAt = (child, trail, state) => {
|
|
24
|
+
const src = (0, field_1.isObj)(child) ? child : { index: child };
|
|
25
|
+
const index = src.index;
|
|
26
|
+
const by = { ...src };
|
|
27
|
+
delete by.index;
|
|
28
|
+
const path = `${trail.join(".")}[${fmt(index)}]`;
|
|
29
|
+
if (!Object.keys(by).length)
|
|
30
|
+
state.out.push({ path, op: "is set", value: "" });
|
|
31
|
+
else
|
|
32
|
+
walk(by, [path], state);
|
|
33
|
+
};
|
|
34
|
+
// The scalar operator a key names, if it is one (the table is the engine's own).
|
|
35
|
+
const scalarOpOf = (key) => Object.entries(operators_1.SCALAR_OPS).find(([k]) => k === key)?.[1];
|
|
36
|
+
const walkEntry = (key, child, state) => {
|
|
37
|
+
if (state.ignore.has(key))
|
|
38
|
+
return;
|
|
39
|
+
if (key === "at") {
|
|
40
|
+
walkAt(child, state.trail, state);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
if (operators_1.QUANTIFIERS.has(key)) {
|
|
44
|
+
walk(child, [...state.trail, "[*]"], state);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (operators_1.CONTAINERS.has(key)) {
|
|
48
|
+
walk(child, [...state.trail, key], state);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const op = scalarOpOf(key);
|
|
52
|
+
if (op) {
|
|
53
|
+
state.out.push({ path: state.trail.join(".") || key, op, value: scalarValue(op, child, state.setValue) });
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
walk(child, [...state.trail, key], state);
|
|
57
|
+
};
|
|
58
|
+
const walkRecord = (value, trail, state) => {
|
|
59
|
+
if (!(0, field_1.isObj)(value))
|
|
60
|
+
return;
|
|
61
|
+
for (const [key, child] of Object.entries(value))
|
|
62
|
+
walkEntry(key, child, { ...state, trail });
|
|
63
|
+
};
|
|
64
|
+
const walkLeaf = (value, trail, state) => {
|
|
65
|
+
state.out.push({ path: trail.join("."), op: "=", value: fmt(value) });
|
|
66
|
+
};
|
|
67
|
+
// A record walks its entries; anything else is one leaf condition. The dispatch
|
|
68
|
+
// is the shared `dispatchOn` core; the readers are this module's own.
|
|
69
|
+
const walk = (value, trail, state) => {
|
|
70
|
+
if (value == null)
|
|
71
|
+
return;
|
|
72
|
+
(0, dispatch_1.dispatchOn)(value, (v) => ((0, field_1.isObj)(v) && !(0, field_1.isList)(v) ? "record" : "leaf"), new Map([
|
|
73
|
+
["record", (v) => walkRecord(v, trail, state)],
|
|
74
|
+
["leaf", (v) => walkLeaf(v, trail, state)],
|
|
75
|
+
]), () => undefined);
|
|
76
|
+
};
|
|
77
|
+
// The condition lines for one query. `ignore` is a list of keys to skip;
|
|
78
|
+
// `setValue` overrides the text an `is set` operator prints (see the header).
|
|
79
|
+
const describeQuery = (query, opts = {}) => {
|
|
80
|
+
const out = [];
|
|
81
|
+
walk(query, [], { trail: [], out, ignore: new Set(opts.ignore ?? []), setValue: opts.setValue });
|
|
82
|
+
// `descendants[*].kind = X` reads better than `.some` colliding mid-path;
|
|
83
|
+
// `[*]` and `[n]` belong to the segment, so the dot before them goes.
|
|
84
|
+
return out.map((c) => `${c.path.replace(/\.\[/g, "[")} ${c.op} ${c.value}`.trim());
|
|
85
|
+
};
|
|
86
|
+
exports.describeQuery = describeQuery;
|