@md-code/follow-architecture 0.1.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/LICENSE +202 -0
- package/README.md +584 -141
- package/dist/aliases.d.ts +3 -0
- package/dist/aliases.js +12 -0
- package/dist/args.d.ts +14 -0
- package/dist/args.js +77 -0
- package/dist/bin/follow-architecture.d.ts +2 -0
- package/dist/bin/follow-architecture.js +23 -0
- package/dist/code-roles/classify.d.ts +11 -0
- package/dist/code-roles/classify.js +43 -0
- package/dist/code-roles/connector.d.ts +5 -0
- package/dist/code-roles/connector.js +114 -0
- package/dist/code-roles/project.d.ts +12 -0
- package/dist/code-roles/project.js +122 -0
- package/dist/code-roles/roles.d.ts +8 -0
- package/dist/code-roles/roles.js +190 -0
- package/dist/config-options.d.ts +53 -0
- package/dist/config-options.js +35 -0
- package/dist/config-project.d.ts +4 -0
- package/dist/config-project.js +74 -0
- package/dist/config-report.d.ts +19 -0
- package/dist/config-report.js +134 -0
- package/dist/config-rule.d.ts +70 -0
- package/dist/config-rule.js +118 -0
- package/dist/config-state.d.ts +14 -0
- package/dist/config-state.js +96 -0
- package/dist/config.d.ts +82 -0
- package/dist/config.js +38 -0
- package/dist/css/index.d.ts +27 -0
- package/dist/css/index.js +140 -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 +41 -0
- package/dist/css/syntax/css/reference.d.ts +3 -0
- package/dist/css/syntax/css/reference.js +24 -0
- package/dist/css/syntax/language.d.ts +25 -0
- package/dist/css/syntax/language.js +69 -0
- package/dist/css/syntax/scss/index.d.ts +25 -0
- package/dist/css/syntax/scss/index.js +85 -0
- package/dist/css/syntax/scss/reference.d.ts +3 -0
- package/dist/css/syntax/scss/reference.js +11 -0
- package/dist/css/syntax/styled/document.d.ts +68 -0
- package/dist/css/syntax/styled/document.js +241 -0
- package/dist/css/syntax/styled/markup.d.ts +6 -0
- package/dist/css/syntax/styled/markup.js +76 -0
- package/dist/css/syntax/styled/template.d.ts +23 -0
- package/dist/css/syntax/styled/template.js +61 -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 +69 -0
- package/dist/css/value/expression/block.d.ts +9 -0
- package/dist/css/value/expression/block.js +91 -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 +69 -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 +103 -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 +129 -0
- package/dist/css/value/object/path.d.ts +10 -0
- package/dist/css/value/object/path.js +146 -0
- package/dist/css/value/pieces.d.ts +61 -0
- package/dist/css/value/pieces.js +55 -0
- package/dist/css/value/resolve.d.ts +33 -0
- package/dist/css/value/resolve.js +94 -0
- package/dist/css/value/scope.d.ts +27 -0
- package/dist/css/value/scope.js +187 -0
- package/dist/css/value/substitute.d.ts +10 -0
- package/dist/css/value/substitute.js +113 -0
- package/dist/css/value/values.d.ts +23 -0
- package/dist/css/value/values.js +131 -0
- package/dist/entities/architecture.d.ts +162 -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 +86 -0
- package/dist/entities/ast/assignments-tagged.d.ts +5 -0
- package/dist/entities/ast/assignments-tagged.js +180 -0
- package/dist/entities/ast/assignments.d.ts +9 -0
- package/dist/entities/ast/assignments.js +78 -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 +134 -0
- package/dist/entities/ast/classes.d.ts +5 -0
- package/dist/entities/ast/classes.js +57 -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 +4 -0
- package/dist/entities/ast/comments.js +100 -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 +149 -0
- package/dist/entities/ast/enums.d.ts +6 -0
- package/dist/entities/ast/enums.js +17 -0
- package/dist/entities/ast/file-exports.d.ts +7 -0
- package/dist/entities/ast/file-exports.js +78 -0
- package/dist/entities/ast/file-facts.d.ts +13 -0
- package/dist/entities/ast/file-facts.js +35 -0
- package/dist/entities/ast/file-imports.d.ts +5 -0
- package/dist/entities/ast/file-imports.js +77 -0
- package/dist/entities/ast/file.d.ts +5 -0
- package/dist/entities/ast/file.js +22 -0
- package/dist/entities/ast/functions.d.ts +8 -0
- package/dist/entities/ast/functions.js +102 -0
- package/dist/entities/ast/heritage.d.ts +4 -0
- package/dist/entities/ast/heritage.js +36 -0
- package/dist/entities/ast/index.d.ts +6 -0
- package/dist/entities/ast/index.js +125 -0
- package/dist/entities/ast/kind.d.ts +5 -0
- package/dist/entities/ast/kind.js +28 -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 +75 -0
- package/dist/entities/ast/properties.d.ts +11 -0
- package/dist/entities/ast/properties.js +171 -0
- package/dist/entities/ast/resolve.d.ts +16 -0
- package/dist/entities/ast/resolve.js +307 -0
- package/dist/entities/ast/tree.d.ts +29 -0
- package/dist/entities/ast/tree.js +351 -0
- package/dist/entities/ast/types.d.ts +6 -0
- package/dist/entities/ast/types.js +45 -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 +261 -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 +221 -0
- package/dist/entities/location/homes.d.ts +28 -0
- package/dist/entities/location/homes.js +169 -0
- package/dist/entities/location/place.d.ts +10 -0
- package/dist/entities/location/place.js +56 -0
- package/dist/entities/location/where.d.ts +17 -0
- package/dist/entities/location/where.js +218 -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 +65 -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 +79 -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 +305 -0
- package/dist/entities/repair.d.ts +16 -0
- package/dist/entities/repair.js +23 -0
- package/dist/entities/schema.d.ts +8 -0
- package/dist/entities/schema.js +23 -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 +5 -0
- package/dist/entities/tree/build.js +252 -0
- package/dist/entities/tree/entries.d.ts +7 -0
- package/dist/entities/tree/entries.js +120 -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 +176 -0
- package/dist/frameworks/angular/index.d.ts +7 -0
- package/dist/frameworks/angular/index.js +17 -0
- package/dist/frameworks/facet.d.ts +16 -0
- package/dist/frameworks/facet.js +2 -0
- package/dist/frameworks/index.d.ts +9 -0
- package/dist/frameworks/index.js +120 -0
- package/dist/frameworks/react/index.d.ts +7 -0
- package/dist/frameworks/react/index.js +214 -0
- package/dist/frameworks/vue/index.d.ts +7 -0
- package/dist/frameworks/vue/index.js +17 -0
- package/dist/invariants/index.d.ts +6 -0
- package/dist/invariants/index.js +299 -0
- package/dist/invariants/list-vars.d.ts +5 -0
- package/dist/invariants/list-vars.js +143 -0
- package/dist/invariants/name.d.ts +16 -0
- package/dist/invariants/name.js +18 -0
- package/dist/invariants/normalize.d.ts +4 -0
- package/dist/invariants/normalize.js +95 -0
- package/dist/invariants/vars.d.ts +20 -0
- package/dist/invariants/vars.js +117 -0
- package/dist/main.d.ts +7 -0
- package/dist/main.js +229 -0
- package/dist/nodes/child-roles.d.ts +3 -0
- package/dist/nodes/child-roles.js +12 -0
- package/dist/nodes/children.d.ts +25 -0
- package/dist/nodes/children.js +112 -0
- package/dist/nodes/finally/emit.d.ts +6 -0
- package/dist/nodes/finally/emit.js +55 -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 +22 -0
- package/dist/nodes/finally/relations-access.d.ts +5 -0
- package/dist/nodes/finally/relations-access.js +46 -0
- package/dist/nodes/finally/relations-edge.d.ts +29 -0
- package/dist/nodes/finally/relations-edge.js +125 -0
- package/dist/nodes/finally/relations-group.d.ts +31 -0
- package/dist/nodes/finally/relations-group.js +103 -0
- package/dist/nodes/finally/relations.d.ts +5 -0
- package/dist/nodes/finally/relations.js +81 -0
- package/dist/nodes/finally/required.d.ts +5 -0
- package/dist/nodes/finally/required.js +90 -0
- package/dist/nodes/finally/roles.d.ts +13 -0
- package/dist/nodes/finally/roles.js +41 -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 +156 -0
- package/dist/pipeline-facts.d.ts +11 -0
- package/dist/pipeline-facts.js +112 -0
- package/dist/pipeline-roles.d.ts +6 -0
- package/dist/pipeline-roles.js +75 -0
- package/dist/pipeline-unroled.d.ts +14 -0
- package/dist/pipeline-unroled.js +193 -0
- package/dist/pipeline.d.ts +7 -0
- package/dist/pipeline.js +73 -0
- package/dist/plugin.d.ts +2 -0
- package/dist/plugin.js +3 -0
- package/dist/report/asks.d.ts +55 -0
- package/dist/report/asks.js +50 -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 +98 -0
- package/dist/report/configErrors.js +75 -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 +99 -0
- package/dist/report/errorTypes/destinations.d.ts +38 -0
- package/dist/report/errorTypes/destinations.js +147 -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 +45 -0
- package/dist/report/errorTypes/types/fileContents.d.ts +9 -0
- package/dist/report/errorTypes/types/fileContents.js +34 -0
- package/dist/report/errorTypes/types/unknownRole.d.ts +9 -0
- package/dist/report/errorTypes/types/unknownRole.js +22 -0
- package/dist/report/errorTypes/types/wrongAction.d.ts +22 -0
- package/dist/report/errorTypes/types/wrongAction.js +135 -0
- package/dist/report/errorTypes/types/wrongPlacement.d.ts +9 -0
- package/dist/report/errorTypes/types/wrongPlacement.js +57 -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 +174 -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 +103 -0
- package/dist/report/notices.d.ts +4 -0
- package/dist/report/notices.js +31 -0
- package/dist/report/render-report.d.ts +12 -0
- package/dist/report/render-report.js +142 -0
- package/dist/report/user-report/build/bundle.d.ts +3 -0
- package/dist/report/user-report/build/bundle.js +169 -0
- package/dist/report/user-report/build/bundle.prebuilt.js +760 -0
- package/dist/report/user-report/data/collect.d.ts +4 -0
- package/dist/report/user-report/data/collect.js +80 -0
- package/dist/report/user-report/data/file-tree.d.ts +9 -0
- package/dist/report/user-report/data/file-tree.js +72 -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 +171 -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-helpers.d.ts +7 -0
- package/dist/report/user-report/data/graph-helpers.js +67 -0
- package/dist/report/user-report/data/graph-roles.d.ts +5 -0
- package/dist/report/user-report/data/graph-roles.js +71 -0
- package/dist/report/user-report/data/graph.d.ts +11 -0
- package/dist/report/user-report/data/graph.js +90 -0
- package/dist/report/user-report/data/invariants.d.ts +7 -0
- package/dist/report/user-report/data/invariants.js +62 -0
- package/dist/report/user-report/data/nodes.d.ts +11 -0
- package/dist/report/user-report/data/nodes.js +106 -0
- package/dist/report/user-report/data/role-examples.d.ts +16 -0
- package/dist/report/user-report/data/role-examples.js +94 -0
- package/dist/report/user-report/data/role-filters.d.ts +15 -0
- package/dist/report/user-report/data/role-filters.js +79 -0
- package/dist/report/user-report/data/role-marks.d.ts +5 -0
- package/dist/report/user-report/data/role-marks.js +79 -0
- package/dist/report/user-report/data/roles.d.ts +7 -0
- package/dist/report/user-report/data/roles.js +83 -0
- package/dist/report/user-report/data/scan.d.ts +8 -0
- package/dist/report/user-report/data/scan.js +59 -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 +48 -0
- package/dist/report/user-report/shared/describe.d.ts +7 -0
- package/dist/report/user-report/shared/describe.js +86 -0
- package/dist/scripts/audit-report.d.ts +2 -0
- package/dist/scripts/audit-report.js +147 -0
- package/dist/utils/accumulate.d.ts +6 -0
- package/dist/utils/accumulate.js +18 -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 +87 -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 +12 -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 +73 -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 +13 -0
- package/dist/utils/imports.d.ts +12 -0
- package/dist/utils/imports.js +121 -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/path-label.d.ts +6 -0
- package/dist/utils/path-label.js +35 -0
- package/dist/utils/pattern.d.ts +18 -0
- package/dist/utils/pattern.js +191 -0
- package/dist/utils/permission.d.ts +16 -0
- package/dist/utils/permission.js +16 -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 +16 -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 +8 -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 +13 -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 +61 -18
- package/report/errorTypes/vocabulary/ids.ts +12 -0
- package/report/errorTypes/vocabulary/phrases.ts +161 -0
- package/report/errorTypes/vocabulary/places.ts +46 -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,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.matchedRanges = void 0;
|
|
4
|
+
// The MARKS on a role example: which lines of the snippet the role'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("../../../utils/field");
|
|
8
|
+
const read_field_1 = require("../../../utils/read-field");
|
|
9
|
+
const speak_1 = require("../../../utils/speak");
|
|
10
|
+
const queries_1 = require("../../../entities/queries");
|
|
11
|
+
const role_filters_1 = require("./role-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.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 role'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, role_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, role_filters_1.listFiltersOf)((0, field_1.isList)(infer) ? infer : [infer], "", []);
|
|
70
|
+
for (const { path, sub } of (0, role_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,7 @@
|
|
|
1
|
+
import type { NodeSummary, RoleSummary } from "../../../entities/overview/summaries";
|
|
2
|
+
import type { OverviewInput } from "../../../entities/overview/input";
|
|
3
|
+
type RolesAsk = Pick<OverviewInput, "arch" | "files" | "repoRoot" | "repoFiles" | "project"> & {
|
|
4
|
+
nodes?: NodeSummary[];
|
|
5
|
+
};
|
|
6
|
+
declare const buildRoles: (ask: RolesAsk) => RoleSummary[];
|
|
7
|
+
export { buildRoles };
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildRoles = void 0;
|
|
4
|
+
// Code-role summaries: the role'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 role, where it may live, and the real examples from this repo.
|
|
7
|
+
const location_1 = require("../../../entities/location");
|
|
8
|
+
const keyed_1 = require("../../../utils/keyed");
|
|
9
|
+
const field_1 = require("../../../utils/field");
|
|
10
|
+
const read_field_1 = require("../../../utils/read-field");
|
|
11
|
+
const read_when_1 = require("../../../utils/read-when");
|
|
12
|
+
const role_examples_1 = require("./role-examples");
|
|
13
|
+
// The codeRoles section as written: a list of `{ slug, … }` or a map keyed by
|
|
14
|
+
// slug — the ONE keyed-section reader answers both.
|
|
15
|
+
const rawRoles = (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 role, 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 role may be declared — ONE row per node: a folder that
|
|
44
|
+
// declares the role 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.roleHomes[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({ slug: h.node ?? "", paths: node?.paths ?? [], label: h.template, labels: h.template ? [h.template] : [] });
|
|
59
|
+
}
|
|
60
|
+
return homes;
|
|
61
|
+
};
|
|
62
|
+
const roleSummary = (slug, def, ask) => {
|
|
63
|
+
const rawDef = ask.raw.get(slug) ?? {};
|
|
64
|
+
const bucket = ask.examples.get(slug) ?? { list: [], overflow: 0 };
|
|
65
|
+
return {
|
|
66
|
+
slug,
|
|
67
|
+
name: def.name ?? slug,
|
|
68
|
+
infer: (0, field_1.fieldOf)(rawDef, "infer") ?? def.infer ?? null,
|
|
69
|
+
report: reportOf(rawDef),
|
|
70
|
+
actions: actionsOf(def),
|
|
71
|
+
homes: homesOf(slug, ask.arch, ask.nodeBySlug),
|
|
72
|
+
examples: bucket.list,
|
|
73
|
+
exampleCount: bucket.list.length + bucket.overflow,
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
const buildRoles = (ask) => {
|
|
77
|
+
const { arch, nodes } = ask;
|
|
78
|
+
const raw = rawRoles(arch.raw?.codeRoles);
|
|
79
|
+
const examples = (0, role_examples_1.collectExamples)(ask);
|
|
80
|
+
const nodeBySlug = new Map((nodes ?? []).map((n) => [n.slug, n]));
|
|
81
|
+
return Object.entries(arch.codeRoles ?? {}).map(([slug, def]) => roleSummary(slug, def, { arch, raw, examples, nodeBySlug }));
|
|
82
|
+
};
|
|
83
|
+
exports.buildRoles = buildRoles;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Snippet } from "../../../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,59 @@
|
|
|
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 (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.lineCount = exports.snippet = exports.readText = void 0;
|
|
27
|
+
// Filesystem helpers for the overview report: cached file reads, code
|
|
28
|
+
// snippets around a declaration, and small path utilities. The overview
|
|
29
|
+
// re-reads sources (separately from the lint pass) so a single file is read
|
|
30
|
+
// once no matter how many roles/examples point at it.
|
|
31
|
+
const fs = __importStar(require("node:fs"));
|
|
32
|
+
const try_read_1 = require("../../../utils/try-read");
|
|
33
|
+
const textCache = new Map();
|
|
34
|
+
const cacheRead = (abs) => {
|
|
35
|
+
const text = fs.readFileSync(abs, "utf8");
|
|
36
|
+
textCache.set(abs, text);
|
|
37
|
+
return text;
|
|
38
|
+
};
|
|
39
|
+
const readText = (abs) => {
|
|
40
|
+
const cached = textCache.get(abs);
|
|
41
|
+
return cached !== undefined ? cached : cacheRead(abs);
|
|
42
|
+
};
|
|
43
|
+
exports.readText = readText;
|
|
44
|
+
// A code window starting at `line` (1-based). `max` caps the height so a huge
|
|
45
|
+
// function does not blow up the payload; `before` adds leading context.
|
|
46
|
+
const snippet = (abs, line, opts = {}) => {
|
|
47
|
+
const { before = 0, max = 14 } = opts;
|
|
48
|
+
return (0, try_read_1.readOrFallback)(abs, (file) => {
|
|
49
|
+
const lines = readText(file).split("\n");
|
|
50
|
+
const start = Math.max(0, (line ?? 1) - 1 - before);
|
|
51
|
+
const body = lines.slice(start, start + max).map((l) => l.replace(/\t/g, " "));
|
|
52
|
+
while (body.length && body[body.length - 1].trim() === "")
|
|
53
|
+
body.pop();
|
|
54
|
+
return { startLine: start + 1, lines: body, truncated: lines.length > start + max };
|
|
55
|
+
}, null);
|
|
56
|
+
};
|
|
57
|
+
exports.snippet = snippet;
|
|
58
|
+
const lineCount = (abs) => (0, try_read_1.readOrFallback)(abs, (file) => readText(file).split("\n").length, 0);
|
|
59
|
+
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("../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 "../../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,48 @@
|
|
|
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 (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.renderOverview = exports.writeOverview = exports.collectOverviewData = void 0;
|
|
27
|
+
// Public entry for the interactive overview (`--overview`).
|
|
28
|
+
//
|
|
29
|
+
// const { collectOverviewData, renderOverview } = require("./report/user-report");
|
|
30
|
+
// const html = renderOverview(collectOverviewData({ ... }));
|
|
31
|
+
//
|
|
32
|
+
// The payload is plain JSON; the presentation is the React app in ./src,
|
|
33
|
+
// compiled on demand by ./build/bundle.js and inlined by ./html/shell.js.
|
|
34
|
+
const fs = __importStar(require("node:fs"));
|
|
35
|
+
const path = __importStar(require("node:path"));
|
|
36
|
+
const collect_1 = require("./data/collect");
|
|
37
|
+
Object.defineProperty(exports, "collectOverviewData", { enumerable: true, get: function () { return collect_1.collectOverviewData; } });
|
|
38
|
+
const shell_1 = require("./html/shell");
|
|
39
|
+
const renderOverview = (data) => (0, shell_1.renderHtml)(data);
|
|
40
|
+
exports.renderOverview = renderOverview;
|
|
41
|
+
// Write the overview and return the path plus a one-line summary for the CLI.
|
|
42
|
+
const writeOverview = (data, outPath) => {
|
|
43
|
+
const abs = path.resolve(outPath);
|
|
44
|
+
fs.mkdirSync(path.dirname(abs), { recursive: true });
|
|
45
|
+
fs.writeFileSync(abs, renderOverview(data), "utf8");
|
|
46
|
+
return { path: abs, bytes: fs.statSync(abs).size };
|
|
47
|
+
};
|
|
48
|
+
exports.writeOverview = writeOverview;
|
|
@@ -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, invariant 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/invariants`) 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("../../../entities/operators");
|
|
17
|
+
const field_1 = require("../../../utils/field");
|
|
18
|
+
const dispatch_1 = require("../../../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;
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
+
if (mod && mod.__esModule) return mod;
|
|
21
|
+
var result = {};
|
|
22
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
+
__setModuleDefault(result, mod);
|
|
24
|
+
return result;
|
|
25
|
+
};
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
// AUDIT: does any finding describe the same thing differently in the text and in
|
|
28
|
+
// the picture?
|
|
29
|
+
//
|
|
30
|
+
// The report has ONE decision maker (`report/errorTypes/decision-maker.js`) and two
|
|
31
|
+
// representations (text, graph). This script checks the OUTPUT of both: every
|
|
32
|
+
// destination an option carries must be named in its text, every option that
|
|
33
|
+
// carries a destination must be drawn, and a relation's sentence must name the
|
|
34
|
+
// file its target card shows. Run it after a report build:
|
|
35
|
+
//
|
|
36
|
+
// node scripts/audit-report.js ../md-prettify/reports/architecture-overview.html
|
|
37
|
+
const fs = __importStar(require("fs"));
|
|
38
|
+
const file = process.argv[2];
|
|
39
|
+
if (!file) {
|
|
40
|
+
console.error("usage: audit-report.js <path to architecture-overview.html>");
|
|
41
|
+
process.exit(2);
|
|
42
|
+
}
|
|
43
|
+
const html = fs.readFileSync(file, "utf8");
|
|
44
|
+
const match = /<script type="application\/json" id="arch-data">([\s\S]*?)<\/script>/.exec(html);
|
|
45
|
+
if (!match) {
|
|
46
|
+
console.error("no arch-data payload in that file");
|
|
47
|
+
process.exit(2);
|
|
48
|
+
}
|
|
49
|
+
const data = JSON.parse(match[1]);
|
|
50
|
+
const pathsOf = (slug) => data.nodes.find((n) => n.slug === slug)?.paths ?? [];
|
|
51
|
+
const problems = [];
|
|
52
|
+
const add = (kind, f, detail) => problems.push({ kind, file: f.file, line: f.line, detail });
|
|
53
|
+
for (const f of data.findings) {
|
|
54
|
+
const story = f.story ?? {};
|
|
55
|
+
if (!story.type)
|
|
56
|
+
continue;
|
|
57
|
+
// 1. A destination an option CARRIES must be named in its text, and a
|
|
58
|
+
// destination its text names must be carried. Otherwise the arrow and the
|
|
59
|
+
// line describe different places.
|
|
60
|
+
// The PLACE is what the sentence names (`path`); the BOX is where the arrow
|
|
61
|
+
// lands. They are not required to be the same string — a feature box is
|
|
62
|
+
// spelled `apps/backend/{kebab-case}`, while the sentence names the file
|
|
63
|
+
// (`apps/backend/document/store.ts`) — but the sentence must name the place
|
|
64
|
+
// the repair carries.
|
|
65
|
+
for (const o of f.fixOptions ?? []) {
|
|
66
|
+
const text = String(o.text ?? "");
|
|
67
|
+
const carried = (o.to ?? []).flatMap(pathsOf);
|
|
68
|
+
if (o.path) {
|
|
69
|
+
if (!text.includes(o.path))
|
|
70
|
+
add("option carries a place its text does not name", f, `${o.code}: ${o.path}`);
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
if (!carried.length)
|
|
74
|
+
continue;
|
|
75
|
+
for (const path of carried) {
|
|
76
|
+
if (!text.includes(path))
|
|
77
|
+
add("option carries a destination its text does not name", f, `${o.code}: ${path}`);
|
|
78
|
+
}
|
|
79
|
+
const named = [...text.matchAll(/`([^`]+)`/g)].map((m) => m[1]);
|
|
80
|
+
if (!named.some((n) => carried.includes(n)))
|
|
81
|
+
add("option carries a destination its text does not name in full", f, o.code);
|
|
82
|
+
}
|
|
83
|
+
// 1b. THE OTHER DIRECTION — and it is the one that was missing. A sentence
|
|
84
|
+
// that says "Move … to `X`" names a place, so the repair must carry it:
|
|
85
|
+
// either as boxes (`to`) or as the place itself (`path`, for a home that
|
|
86
|
+
// is a template and has no box yet). This is the check that would have
|
|
87
|
+
// caught 43 findings whose text moved code and whose picture moved
|
|
88
|
+
// nothing — every one of them was a `fileContents` finding, and the
|
|
89
|
+
// audit used to skip that type entirely.
|
|
90
|
+
for (const o of f.fixOptions ?? []) {
|
|
91
|
+
const text = String(o.text ?? "");
|
|
92
|
+
const namedTo = /\b(?:to|into)\s+`([^`]+)`/.exec(text)?.[1] ?? null;
|
|
93
|
+
if (!namedTo)
|
|
94
|
+
continue;
|
|
95
|
+
const carried = (o.to ?? []).length > 0;
|
|
96
|
+
if (!carried && !o.path)
|
|
97
|
+
add("text names a destination the repair does not carry", f, `${o.code}: ${namedTo}`);
|
|
98
|
+
else if (o.path && o.path !== namedTo)
|
|
99
|
+
add("text and repair name different destinations", f, `${o.path} vs ${namedTo}`);
|
|
100
|
+
}
|
|
101
|
+
// 2. Every repair must be DRAWABLE: an arrow (`to`) or a mark (`from`).
|
|
102
|
+
// A sentence that says "Remove …" while the picture shows nothing is the
|
|
103
|
+
// divergence this file exists to catch.
|
|
104
|
+
for (const o of f.fixOptions ?? []) {
|
|
105
|
+
// Repairs with no geometry: the rule's own words (`rules`), "give this code
|
|
106
|
+
// a role" (`role`), "create what is missing" (`add`). They name no place,
|
|
107
|
+
// and the card says so — that is not a divergence.
|
|
108
|
+
if (o.code === "rules" || o.code === "role" || o.code === "add")
|
|
109
|
+
continue;
|
|
110
|
+
// A deletion has no geometry either — and it is NOT the same as "nothing":
|
|
111
|
+
// the card must say "removed", which `plan.remove` carries.
|
|
112
|
+
if (o.code === "remove") {
|
|
113
|
+
if (!f.plan?.remove)
|
|
114
|
+
add("removal is not drawn as a removal", f, o.text.slice(0, 60));
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
// `split` / `rewrite`: no place to move to BY DESIGN — the change is inside
|
|
118
|
+
// the file. The picture says so with the repair's own word in the box
|
|
119
|
+
// (`action`), so the counterpart exists and is checked here.
|
|
120
|
+
if (o.code === "split" || o.code === "rewrite" || o.code === "merge") {
|
|
121
|
+
if ((f.plan?.repair?.code ?? null) !== o.code)
|
|
122
|
+
add("repair word is not carried", f, o.code);
|
|
123
|
+
continue;
|
|
124
|
+
}
|
|
125
|
+
if (!(o.to ?? []).length && !o.from)
|
|
126
|
+
add("option with no visual counterpart", f, `${o.code}: ${o.text.slice(0, 60)}`);
|
|
127
|
+
}
|
|
128
|
+
// 3. A relation's sentence must name the file the target card shows.
|
|
129
|
+
if (story.type === "wrongAction" && story.target?.paths?.[0]) {
|
|
130
|
+
if (!String(f.message).includes(story.target.paths[0]))
|
|
131
|
+
add("message does not name the touched file", f, story.target.paths[0]);
|
|
132
|
+
}
|
|
133
|
+
// 3. Every destination the picture draws must come from the story, not from
|
|
134
|
+
// the representation's own idea of where things are.
|
|
135
|
+
if (story.type === "wrongPlacement" && !(story.to ?? []).length)
|
|
136
|
+
add("placement finding without a destination", f, f.file);
|
|
137
|
+
}
|
|
138
|
+
const byKind = {};
|
|
139
|
+
for (const p of problems)
|
|
140
|
+
byKind[p.kind] = (byKind[p.kind] ?? 0) + 1;
|
|
141
|
+
console.log(`findings: ${data.findings.length} | problems: ${problems.length}`);
|
|
142
|
+
if (problems.length) {
|
|
143
|
+
console.log(byKind);
|
|
144
|
+
for (const p of problems.slice(0, 30))
|
|
145
|
+
console.log(`- [${p.kind}] ${p.file}:${p.line} — ${p.detail}`);
|
|
146
|
+
process.exit(1);
|
|
147
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.accumulateByKey = void 0;
|
|
4
|
+
// A KEYED ACCUMULATION is one mechanism: items arrive with a key, and each is
|
|
5
|
+
// merged into the bucket that key names — a new bucket when the key is new,
|
|
6
|
+
// the existing one otherwise. The relation check groups refused edges by
|
|
7
|
+
// kind + target + what (`nodes/finally/relations`); any consumer that folds
|
|
8
|
+
// items into keyed buckets asks the same question. The walk is the same —
|
|
9
|
+
// read the bucket, merge, store — so it lives here once. What a bucket IS and
|
|
10
|
+
// how an item joins it is the caller's own.
|
|
11
|
+
const accumulateByKey = (items, buckets, join) => {
|
|
12
|
+
for (const { key, item, bucket } of items) {
|
|
13
|
+
const target = buckets.get(key) ?? bucket;
|
|
14
|
+
join(target, item);
|
|
15
|
+
buckets.set(key, target);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
exports.accumulateByKey = accumulateByKey;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.article = void 0;
|
|
4
|
+
// `a` / `an` for a word — the ONE place English grammar about the indefinite
|
|
5
|
+
// article lives, so no message has to repeat the rule.
|
|
6
|
+
const article = (word, capital = false) => {
|
|
7
|
+
const an = /^[aeiou]/i.test(String(word));
|
|
8
|
+
if (!capital)
|
|
9
|
+
return an ? "an" : "a";
|
|
10
|
+
return an ? "An" : "A";
|
|
11
|
+
};
|
|
12
|
+
exports.article = article;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { QueryFilter, QueryScope } from "../entities/architecture";
|
|
2
|
+
import type { FieldValue } from "../utils/field";
|
|
3
|
+
type Definition = {
|
|
4
|
+
name: string;
|
|
5
|
+
infer: QueryFilter;
|
|
6
|
+
};
|
|
7
|
+
declare const definitionsOf: (defs: Record<string, {
|
|
8
|
+
infer?: QueryFilter;
|
|
9
|
+
}> | null | undefined) => Definition[];
|
|
10
|
+
declare const firstMatch: (subject: FieldValue, defs: readonly Definition[], scope: QueryScope) => string | null;
|
|
11
|
+
export { definitionsOf, firstMatch };
|
|
12
|
+
export type { Definition };
|