@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
package/dist/plugin.d.ts
ADDED
package/dist/plugin.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { StatedRepair } from "../entities/repair";
|
|
2
|
+
import type { ReportObject } from "../entities/architecture";
|
|
3
|
+
declare const q: (text: string) => string;
|
|
4
|
+
declare const names: (list: readonly string[]) => string;
|
|
5
|
+
declare const repair: (spec: {
|
|
6
|
+
code?: string | null;
|
|
7
|
+
ask?: string | null;
|
|
8
|
+
fix?: string | null;
|
|
9
|
+
}, place?: {
|
|
10
|
+
to?: string[];
|
|
11
|
+
from?: string | null;
|
|
12
|
+
path?: string | null;
|
|
13
|
+
}) => StatedRepair | null;
|
|
14
|
+
type MoveAsk = {
|
|
15
|
+
what: string;
|
|
16
|
+
to?: string | null;
|
|
17
|
+
why?: string | null;
|
|
18
|
+
plural?: boolean;
|
|
19
|
+
name?: string | null;
|
|
20
|
+
node?: string | null;
|
|
21
|
+
path?: string | null;
|
|
22
|
+
};
|
|
23
|
+
type MoveDemand = Required<Pick<ReportObject, "ask" | "message" | "fix" | "to" | "path">>;
|
|
24
|
+
declare const __exported_asks: {
|
|
25
|
+
move: (args: MoveAsk) => MoveDemand;
|
|
26
|
+
remove: (args: {
|
|
27
|
+
what: string;
|
|
28
|
+
what_is?: string | null;
|
|
29
|
+
why?: string | null;
|
|
30
|
+
}) => {
|
|
31
|
+
ask: string;
|
|
32
|
+
to: string[];
|
|
33
|
+
message: string;
|
|
34
|
+
fix: string;
|
|
35
|
+
};
|
|
36
|
+
role: (args: {
|
|
37
|
+
what: string;
|
|
38
|
+
why: string;
|
|
39
|
+
}) => {
|
|
40
|
+
ask: string;
|
|
41
|
+
to: string[];
|
|
42
|
+
message: string;
|
|
43
|
+
fix: string;
|
|
44
|
+
};
|
|
45
|
+
add: (args: {
|
|
46
|
+
what: string;
|
|
47
|
+
why: string;
|
|
48
|
+
}) => {
|
|
49
|
+
ask: string;
|
|
50
|
+
to: string[];
|
|
51
|
+
message: string;
|
|
52
|
+
fix: string;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
export { __exported_asks as asks, repair, names, q };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.q = exports.names = exports.repair = exports.asks = void 0;
|
|
4
|
+
const q = (text) => `\`${text}\``;
|
|
5
|
+
exports.q = q;
|
|
6
|
+
// A list of names as one subject: `a`, `b`, `c`.
|
|
7
|
+
const names = (list) => list.map(q).join(", ");
|
|
8
|
+
exports.names = names;
|
|
9
|
+
// The repair — the ONE shape a finding offers (`entities/repair`). A sentence
|
|
10
|
+
// alone is not a repair: it cannot be drawn. Every producer builds ONE of these,
|
|
11
|
+
// and the text is the last field of it — never the other way round.
|
|
12
|
+
const repair = (spec, place = {}) => spec.fix ? { code: spec.code ?? spec.ask ?? "rules", to: place.to ?? [], from: place.from ?? null, path: place.path ?? null, text: spec.fix } : null;
|
|
13
|
+
exports.repair = repair;
|
|
14
|
+
const moveMessage = (what, to, why, plural) => {
|
|
15
|
+
const belongs = plural ? "belong" : "belongs";
|
|
16
|
+
const where = to ? `in ${to}` : "somewhere else";
|
|
17
|
+
return `${what} ${belongs} ${where}.${why ? ` ${why}` : ""}`;
|
|
18
|
+
};
|
|
19
|
+
const moveFix = (what, to, name) => to ? `Move ${name ?? what} to ${to}.` : `Delete ${name ?? what}: this architecture holds no place for that kind of code, so there is nowhere to move it to.`;
|
|
20
|
+
const moveBoxes = (to, node) => (to && node ? [node] : []);
|
|
21
|
+
const move = (args) => {
|
|
22
|
+
const { what, to = null, why = null, plural = false, name = null, node = null, path: place = null } = args;
|
|
23
|
+
return {
|
|
24
|
+
ask: to ? "move" : "remove",
|
|
25
|
+
message: moveMessage(what, to, why, plural),
|
|
26
|
+
fix: moveFix(what, to, name),
|
|
27
|
+
to: moveBoxes(to, node),
|
|
28
|
+
path: place ?? to,
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
const remove = (args) => ({
|
|
32
|
+
ask: "remove",
|
|
33
|
+
to: [],
|
|
34
|
+
message: `${args.what}${args.what_is ? ` ${args.what_is}` : ""}, but ${args.why}.`,
|
|
35
|
+
fix: `Delete it.`,
|
|
36
|
+
});
|
|
37
|
+
const role = (args) => ({
|
|
38
|
+
ask: "role",
|
|
39
|
+
to: [],
|
|
40
|
+
message: `${args.what} has no role: ${args.why}`,
|
|
41
|
+
fix: `Delete ${args.what}, or move it to a place whose code the architecture describes.`,
|
|
42
|
+
});
|
|
43
|
+
const add = (args) => ({
|
|
44
|
+
ask: "add",
|
|
45
|
+
to: [],
|
|
46
|
+
message: `${args.what} is missing: ${args.why}`,
|
|
47
|
+
fix: `Create ${args.what}.`,
|
|
48
|
+
});
|
|
49
|
+
const __exported_asks = { move, remove, role, add };
|
|
50
|
+
exports.asks = __exported_asks;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.renderCrashError = exports.renderConfigError = exports.renderNotices = exports.renderReport = exports.findingFrom = void 0;
|
|
4
|
+
// The terminal / --out report. The finding builder lives in ./finding-from; the
|
|
5
|
+
// text renderer in ./render-report. This module is the public surface the CLI
|
|
6
|
+
// and the pipeline import — one place, two re-exports, no second copy.
|
|
7
|
+
var finding_from_1 = require("./finding-from");
|
|
8
|
+
Object.defineProperty(exports, "findingFrom", { enumerable: true, get: function () { return finding_from_1.findingFrom; } });
|
|
9
|
+
var render_report_1 = require("./render-report");
|
|
10
|
+
Object.defineProperty(exports, "renderReport", { enumerable: true, get: function () { return render_report_1.renderReport; } });
|
|
11
|
+
Object.defineProperty(exports, "renderNotices", { enumerable: true, get: function () { return render_report_1.renderNotices; } });
|
|
12
|
+
Object.defineProperty(exports, "renderConfigError", { enumerable: true, get: function () { return render_report_1.renderConfigError; } });
|
|
13
|
+
Object.defineProperty(exports, "renderCrashError", { enumerable: true, get: function () { return render_report_1.renderCrashError; } });
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import type { FieldValue } from "../utils/field";
|
|
2
|
+
type ConfigError = Error & {
|
|
3
|
+
isConfigError: boolean;
|
|
4
|
+
};
|
|
5
|
+
declare const unreadable: ({ code }: {
|
|
6
|
+
code?: string;
|
|
7
|
+
}) => ConfigError;
|
|
8
|
+
declare const unparseable: ({ reason }: {
|
|
9
|
+
reason: string;
|
|
10
|
+
}) => ConfigError;
|
|
11
|
+
declare const notAnObject: () => ConfigError;
|
|
12
|
+
declare const withoutNodes: () => ConfigError;
|
|
13
|
+
declare const duplicateInvariantIds: (ids: readonly string[]) => ConfigError;
|
|
14
|
+
declare const nodeRoleUnknown: (role: string) => ConfigError;
|
|
15
|
+
declare const roleNotAnObject: () => ConfigError;
|
|
16
|
+
declare const roleWithoutSlug: () => ConfigError;
|
|
17
|
+
declare const roleInfersUnknown: ({ role, entry }: {
|
|
18
|
+
role: FieldValue;
|
|
19
|
+
entry: string;
|
|
20
|
+
}) => ConfigError;
|
|
21
|
+
declare const roleInfersItself: ({ role }: {
|
|
22
|
+
role: FieldValue;
|
|
23
|
+
}) => ConfigError;
|
|
24
|
+
declare const unknownRoleKey: ({ role, key, allowed }: {
|
|
25
|
+
role: FieldValue;
|
|
26
|
+
key: string;
|
|
27
|
+
allowed: readonly string[];
|
|
28
|
+
}) => ConfigError;
|
|
29
|
+
declare const roleWhereNotAllowed: ({ role }: {
|
|
30
|
+
role: FieldValue;
|
|
31
|
+
}) => ConfigError;
|
|
32
|
+
declare const actionNotAnObject: ({ role, action }: {
|
|
33
|
+
role: FieldValue;
|
|
34
|
+
action: string;
|
|
35
|
+
}) => ConfigError;
|
|
36
|
+
declare const actionWithoutWhere: ({ role, action }: {
|
|
37
|
+
role: FieldValue;
|
|
38
|
+
action: string;
|
|
39
|
+
}) => ConfigError;
|
|
40
|
+
declare const unknownActionKey: ({ name, key, allowed }: {
|
|
41
|
+
name: string;
|
|
42
|
+
key: string;
|
|
43
|
+
allowed: readonly string[];
|
|
44
|
+
}) => ConfigError;
|
|
45
|
+
declare const unknownActionFact: ({ value, known }: {
|
|
46
|
+
value: FieldValue;
|
|
47
|
+
known: readonly string[];
|
|
48
|
+
}) => ConfigError;
|
|
49
|
+
declare const scopeNotOneOf: ({ got, allowed }: {
|
|
50
|
+
got: FieldValue;
|
|
51
|
+
allowed: readonly string[];
|
|
52
|
+
}) => ConfigError;
|
|
53
|
+
declare const emptyAccessorSegments: ({ scope }: {
|
|
54
|
+
scope: string;
|
|
55
|
+
}) => ConfigError;
|
|
56
|
+
declare const unknownNodeKey: ({ node, key, allowed }: {
|
|
57
|
+
node: string;
|
|
58
|
+
key: string;
|
|
59
|
+
allowed: readonly string[];
|
|
60
|
+
}) => ConfigError;
|
|
61
|
+
declare const unknownNodeParent: ({ node, parent }: {
|
|
62
|
+
node: string;
|
|
63
|
+
parent: string;
|
|
64
|
+
}) => ConfigError;
|
|
65
|
+
declare const unknownNodeChild: ({ node, child }: {
|
|
66
|
+
node: string;
|
|
67
|
+
child: string;
|
|
68
|
+
}) => ConfigError;
|
|
69
|
+
declare const invariantNotAnObject: () => ConfigError;
|
|
70
|
+
declare const invariantWithoutId: () => ConfigError;
|
|
71
|
+
declare const unknownInvariantKey: ({ id, key, allowed }: {
|
|
72
|
+
id: FieldValue;
|
|
73
|
+
key: string;
|
|
74
|
+
allowed: readonly string[];
|
|
75
|
+
}) => ConfigError;
|
|
76
|
+
declare const dedupeByNotAPlace: ({ value }: {
|
|
77
|
+
value: string;
|
|
78
|
+
}) => ConfigError;
|
|
79
|
+
declare const relationWithoutProducer: ({ relation }: {
|
|
80
|
+
relation: string;
|
|
81
|
+
}) => ConfigError;
|
|
82
|
+
declare const undeclaredRelation: ({ relation }: {
|
|
83
|
+
relation: string;
|
|
84
|
+
}) => ConfigError;
|
|
85
|
+
declare const styleLanguageIncomplete: () => ConfigError;
|
|
86
|
+
declare const unknownOperator: ({ op }: {
|
|
87
|
+
op: string;
|
|
88
|
+
}) => ConfigError;
|
|
89
|
+
declare const unknownListOperator: ({ op }: {
|
|
90
|
+
op: string;
|
|
91
|
+
}) => ConfigError;
|
|
92
|
+
declare const atWithoutIndex: () => ConfigError;
|
|
93
|
+
declare const invalidPattern: ({ where, pattern, reason }: {
|
|
94
|
+
where: string;
|
|
95
|
+
pattern: string;
|
|
96
|
+
reason: string;
|
|
97
|
+
}) => ConfigError;
|
|
98
|
+
export { unreadable, unparseable, notAnObject, withoutNodes, duplicateInvariantIds, nodeRoleUnknown, roleNotAnObject, roleWithoutSlug, roleInfersUnknown, roleInfersItself, unknownRoleKey, roleWhereNotAllowed, actionNotAnObject, actionWithoutWhere, unknownActionKey, unknownActionFact, scopeNotOneOf, emptyAccessorSegments, unknownNodeKey, unknownNodeParent, unknownNodeChild, invariantNotAnObject, invariantWithoutId, unknownInvariantKey, dedupeByNotAPlace, relationWithoutProducer, undeclaredRelation, styleLanguageIncomplete, unknownOperator, unknownListOperator, atWithoutIndex, invalidPattern };
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.invalidPattern = exports.atWithoutIndex = exports.unknownListOperator = exports.unknownOperator = exports.styleLanguageIncomplete = exports.undeclaredRelation = exports.relationWithoutProducer = exports.dedupeByNotAPlace = exports.unknownInvariantKey = exports.invariantWithoutId = exports.invariantNotAnObject = exports.unknownNodeChild = exports.unknownNodeParent = exports.unknownNodeKey = exports.emptyAccessorSegments = exports.scopeNotOneOf = exports.unknownActionFact = exports.unknownActionKey = exports.actionWithoutWhere = exports.actionNotAnObject = exports.roleWhereNotAllowed = exports.unknownRoleKey = exports.roleInfersItself = exports.roleInfersUnknown = exports.roleWithoutSlug = exports.roleNotAnObject = exports.nodeRoleUnknown = exports.duplicateInvariantIds = exports.withoutNodes = exports.notAnObject = exports.unparseable = exports.unreadable = void 0;
|
|
4
|
+
const fail = (message) => Object.assign(new Error(message), { isConfigError: true });
|
|
5
|
+
const list = (xs) => [...xs].map((x) => `\`${x}\``).join(", ");
|
|
6
|
+
const fenced = (xs) => [...xs].join(" | ");
|
|
7
|
+
// ── the architecture file itself ──────────────────────────────────────────
|
|
8
|
+
const unreadable = ({ code }) => fail(`architecture: cannot read the file${code ? ` (${code})` : ""}`);
|
|
9
|
+
exports.unreadable = unreadable;
|
|
10
|
+
const unparseable = ({ reason }) => fail(`architecture: not YAML or JSON — ${reason}`);
|
|
11
|
+
exports.unparseable = unparseable;
|
|
12
|
+
const notAnObject = () => fail("architecture: expected an object — the file must be a map of `aliases`, `codeRoles`, `nodes`, `invariants`");
|
|
13
|
+
exports.notAnObject = notAnObject;
|
|
14
|
+
const withoutNodes = () => fail("architecture.nodes: must be a non-empty array or object — a tree with no nodes describes no place");
|
|
15
|
+
exports.withoutNodes = withoutNodes;
|
|
16
|
+
const duplicateInvariantIds = (ids) => fail(`architecture.invariants: ids must be unique — repeated: ${list([...new Set(ids.filter((id, i) => ids.indexOf(id) !== i))])}`);
|
|
17
|
+
exports.duplicateInvariantIds = duplicateInvariantIds;
|
|
18
|
+
const nodeRoleUnknown = (role) => fail(`nodes: \`role: ${role}\` names no codeRole — the node gives a home to code the config never describes`);
|
|
19
|
+
exports.nodeRoleUnknown = nodeRoleUnknown;
|
|
20
|
+
// ── codeRoles ─────────────────────────────────────────────────────────────
|
|
21
|
+
const roleNotAnObject = () => fail("codeRoles: each entry must be an object with a `slug`");
|
|
22
|
+
exports.roleNotAnObject = roleNotAnObject;
|
|
23
|
+
const roleWithoutSlug = () => fail("codeRoles: each entry needs a `slug`");
|
|
24
|
+
exports.roleWithoutSlug = roleWithoutSlug;
|
|
25
|
+
const roleInfersUnknown = ({ role, entry }) => fail(`codeRoles: \`${role}\` infers by unknown role \`${entry}\``);
|
|
26
|
+
exports.roleInfersUnknown = roleInfersUnknown;
|
|
27
|
+
const roleInfersItself = ({ role }) => fail(`codeRoles: \`${role}\` infers by itself`);
|
|
28
|
+
exports.roleInfersItself = roleInfersItself;
|
|
29
|
+
const unknownRoleKey = ({ role, key, allowed }) => fail(`codeRoles: \`${role}.${key}\` is not a role key — a role is ${list(allowed)}; actions belong under \`actions\``);
|
|
30
|
+
exports.unknownRoleKey = unknownRoleKey;
|
|
31
|
+
const roleWhereNotAllowed = ({ role }) => fail(`codeRoles: \`${role}.where\` — a role says WHAT code is, a node says WHERE it lives: move it to a child of the node that holds it — \`- { name: <file>, role: ${role} }\` for one file, \`- { name: <folder>, role: ${role} }\` for a whole folder`);
|
|
32
|
+
exports.roleWhereNotAllowed = roleWhereNotAllowed;
|
|
33
|
+
const actionNotAnObject = ({ role, action }) => fail(`codeRoles: \`${role}.actions.${action}\` must be an object with \`where\``);
|
|
34
|
+
exports.actionNotAnObject = actionNotAnObject;
|
|
35
|
+
const actionWithoutWhere = ({ role, action }) => fail(`codeRoles: \`${role}.actions.${action}\` has no \`where\` — a permission that names nobody allows nobody`);
|
|
36
|
+
exports.actionWithoutWhere = actionWithoutWhere;
|
|
37
|
+
const unknownActionKey = ({ name, key, allowed }) => fail(`codeRoles: \`${name}.${key}\` is not an action key — use ${list(allowed)}`);
|
|
38
|
+
exports.unknownActionKey = unknownActionKey;
|
|
39
|
+
const unknownActionFact = ({ value, known }) => fail(`codeRoles: action says \`of: ${value}\` — the fact layer produces ${fenced(known)}`);
|
|
40
|
+
exports.unknownActionFact = unknownActionFact;
|
|
41
|
+
const scopeNotOneOf = ({ got, allowed }) => fail(`codeRoles: scopeAccess \`scope\` must be one of ${fenced(allowed)}, got ${JSON.stringify(got)}`);
|
|
42
|
+
exports.scopeNotOneOf = scopeNotOneOf;
|
|
43
|
+
const emptyAccessorSegments = ({ scope }) => fail(`codeRoles: scopeAccess entry for scope \`${scope}\` needs a non-empty \`segments\` list`);
|
|
44
|
+
exports.emptyAccessorSegments = emptyAccessorSegments;
|
|
45
|
+
// ── nodes ─────────────────────────────────────────────────────────────────
|
|
46
|
+
const unknownNodeKey = ({ node, key, allowed }) => fail(`nodes: \`${node}.${key}\` is not a node key — a node is structure only (${list(allowed)}); roles, actions and \`where\` belong to the codeRole`);
|
|
47
|
+
exports.unknownNodeKey = unknownNodeKey;
|
|
48
|
+
const unknownNodeParent = ({ node, parent }) => fail(`nodes: \`${node}\` names unknown parent \`${parent}\``);
|
|
49
|
+
exports.unknownNodeParent = unknownNodeParent;
|
|
50
|
+
const unknownNodeChild = ({ node, child }) => fail(`nodes: \`${node}\` names unknown child \`${child}\``);
|
|
51
|
+
exports.unknownNodeChild = unknownNodeChild;
|
|
52
|
+
// ── invariants ────────────────────────────────────────────────────────────
|
|
53
|
+
const invariantNotAnObject = () => fail("invariants: each entry must be an object with an `id`");
|
|
54
|
+
exports.invariantNotAnObject = invariantNotAnObject;
|
|
55
|
+
const invariantWithoutId = () => fail("invariants: each entry needs an `id`");
|
|
56
|
+
exports.invariantWithoutId = invariantWithoutId;
|
|
57
|
+
const unknownInvariantKey = ({ id, key, allowed }) => fail(`invariants: \`${id}.${key}\` is not a key — an invariant is ${list(allowed)}`);
|
|
58
|
+
exports.unknownInvariantKey = unknownInvariantKey;
|
|
59
|
+
const dedupeByNotAPlace = ({ value }) => fail(`invariants: \`dedupeBy: ${value}\` is not a place — use a \`where\` entry (\`{ node: <slug> }\`, a glob, or a filter)`);
|
|
60
|
+
exports.dedupeByNotAPlace = dedupeByNotAPlace;
|
|
61
|
+
// ── the engine's own tables (a broken build, not a user mistake) ───────────
|
|
62
|
+
const relationWithoutProducer = ({ relation }) => fail(`kinds: relation \`${relation}\` is declared but has no producer`);
|
|
63
|
+
exports.relationWithoutProducer = relationWithoutProducer;
|
|
64
|
+
const undeclaredRelation = ({ relation }) => fail(`kinds: \`${relation}\` has a producer but is not declared`);
|
|
65
|
+
exports.undeclaredRelation = undeclaredRelation;
|
|
66
|
+
const styleLanguageIncomplete = () => fail("css/syntax: a style language needs an `id` and `facts(text)`");
|
|
67
|
+
exports.styleLanguageIncomplete = styleLanguageIncomplete;
|
|
68
|
+
const unknownOperator = ({ op }) => fail(`queries: unknown operator \`${op}\``);
|
|
69
|
+
exports.unknownOperator = unknownOperator;
|
|
70
|
+
const unknownListOperator = ({ op }) => fail(`queries: unknown list operator \`${op}\``);
|
|
71
|
+
exports.unknownListOperator = unknownListOperator;
|
|
72
|
+
const atWithoutIndex = () => fail("queries: `at` needs a numeric `index`");
|
|
73
|
+
exports.atWithoutIndex = atWithoutIndex;
|
|
74
|
+
const invalidPattern = ({ where, pattern, reason }) => fail(`${where}: invalid pattern \`${pattern}\` — ${reason}`);
|
|
75
|
+
exports.invalidPattern = invalidPattern;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { StructureFacts } from "../../../entities/structure-facts";
|
|
2
|
+
type StructureCode = {
|
|
3
|
+
ask: string;
|
|
4
|
+
message: (f: StructureFacts) => string;
|
|
5
|
+
fix: (f: StructureFacts) => string;
|
|
6
|
+
};
|
|
7
|
+
declare const CODES: Record<string, StructureCode>;
|
|
8
|
+
declare const choose: (facts: StructureFacts) => string;
|
|
9
|
+
declare const render: (id: string, facts: StructureFacts) => {
|
|
10
|
+
code: string;
|
|
11
|
+
ask: string;
|
|
12
|
+
message: string;
|
|
13
|
+
fix: string;
|
|
14
|
+
};
|
|
15
|
+
export { choose, render, CODES };
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CODES = exports.render = exports.choose = void 0;
|
|
4
|
+
// structure.* codes: this entry does not belong in this folder. Each code is a
|
|
5
|
+
// pair of sentence templates (message + fix) over the SAME facts the tree check
|
|
6
|
+
// states; `choose` picks the code by the facts, `render` fills the templates.
|
|
7
|
+
const location_1 = require("../../../entities/location");
|
|
8
|
+
const held = (f) => f.held?.[0] ?? f.named ?? "";
|
|
9
|
+
const CODES = {
|
|
10
|
+
// The fallback: the entry is not declared, and no destination is certain.
|
|
11
|
+
"structure.entry": {
|
|
12
|
+
ask: "role",
|
|
13
|
+
message: (f) => `\`{basename}\` is not an entry this folder declares.${f.seen ?? ""}`,
|
|
14
|
+
// A file the tree does not name has no home and no kind: the fix is to
|
|
15
|
+
// declare it (the folder's own list is right there) or to move it where it
|
|
16
|
+
// is declared. `null` here printed a card with nothing to do.
|
|
17
|
+
fix: (f) => `Move what \`{basename}\` holds into ${f.named ? `\`${f.named}\`` : "the files this folder declares"}, or delete it: this folder has no place for it.`,
|
|
18
|
+
},
|
|
19
|
+
// A DIRECTORY: its contents have a home, the directory itself does not.
|
|
20
|
+
"structure.directory": {
|
|
21
|
+
ask: "move",
|
|
22
|
+
message: (f) => `\`{basename}\` is not an entry this folder declares.${f.seen ?? ""}${f.held?.length ? ` What it holds is \`${f.held[0]}\` code.` : ""}`,
|
|
23
|
+
fix: (f) => `Move what \`{basename}/\` holds ${f.dest ? `into \`${f.dest}\`` : `into the files this folder declares (${f.named})`}, then delete the directory.`,
|
|
24
|
+
},
|
|
25
|
+
// One certain destination: the entry belongs there, whole.
|
|
26
|
+
"structure.belongs-in": {
|
|
27
|
+
ask: "move",
|
|
28
|
+
message: (f) => `\`{basename}\` belongs in \`${f.dest}\`.${f.seen ?? ""} It holds a \`${held(f)}\`.`,
|
|
29
|
+
fix: (f) => `Move \`{basename}\` to \`${f.dest}\`.`,
|
|
30
|
+
},
|
|
31
|
+
// A second copy of a file that already lives here.
|
|
32
|
+
"structure.duplicate": {
|
|
33
|
+
ask: "remove",
|
|
34
|
+
message: (f) => `\`{basename}\` is not an entry this folder declares.${f.seen ?? ""} It duplicates \`${(0, location_1.leafOf)(f.duplicate).segments.at(-1)}\` — one file per folder, and this is a second copy.`,
|
|
35
|
+
fix: (f) => `Merge \`{basename}\` into \`${f.duplicate}\` and delete \`{basename}\`.`,
|
|
36
|
+
},
|
|
37
|
+
// The folder is right and the NAME is not.
|
|
38
|
+
"structure.rename": {
|
|
39
|
+
ask: "move",
|
|
40
|
+
message: (f) => `\`{basename}\` is not an entry this folder declares.${f.seen ?? ""} The folder is right, the name is not: this folder may hold \`${f.named}\`.`,
|
|
41
|
+
fix: (f) => `Rename \`{basename}\` to \`${f.named}\`.`,
|
|
42
|
+
},
|
|
43
|
+
"structure.role-no-home": {
|
|
44
|
+
ask: "role",
|
|
45
|
+
message: (f) => `\`{basename}\` is not an entry this folder declares.${f.seen ?? ""} It holds a \`${f.roles?.[0]}\`, and that role has no declared home — the architecture names no destination for this file.`,
|
|
46
|
+
fix: () => `Delete it: the code in here belongs to no place the tree has, so there is nothing to move it into.`,
|
|
47
|
+
},
|
|
48
|
+
"structure.contents": {
|
|
49
|
+
ask: "move",
|
|
50
|
+
message: (f) => `\`{basename}\` is not an entry this folder declares.${f.seen ?? ""} Nothing in it belongs to a role this folder holds.`,
|
|
51
|
+
fix: (f) => `Move what \`{basename}\` holds into the files this folder declares (${f.named}), then delete \`{basename}\`.`,
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
exports.CODES = CODES;
|
|
55
|
+
// The code the facts earn, first claim wins: a directory, a certain destination,
|
|
56
|
+
// a duplicate, a rename, a homeless role, else the folder's contents.
|
|
57
|
+
const choose = (facts) => {
|
|
58
|
+
if (facts.asDir)
|
|
59
|
+
return "structure.directory";
|
|
60
|
+
if (facts.dest)
|
|
61
|
+
return "structure.belongs-in";
|
|
62
|
+
if (facts.duplicate)
|
|
63
|
+
return "structure.duplicate";
|
|
64
|
+
if (facts.homeHere?.length)
|
|
65
|
+
return "structure.rename";
|
|
66
|
+
if (facts.roles?.length)
|
|
67
|
+
return "structure.role-no-home";
|
|
68
|
+
return "structure.contents";
|
|
69
|
+
};
|
|
70
|
+
exports.choose = choose;
|
|
71
|
+
const codeOf = (id) => CODES[id] ?? CODES["structure.entry"];
|
|
72
|
+
const render = (id, facts) => {
|
|
73
|
+
const code = codeOf(id);
|
|
74
|
+
return { code: id, ask: code.ask, message: code.message(facts), fix: code.fix(facts) };
|
|
75
|
+
};
|
|
76
|
+
exports.render = render;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { decide, resolveWeights, resolveThresholds, DEFAULT_WEIGHTS, DEFAULT_THRESHOLDS } from "./destinations";
|
|
2
|
+
import { normalizeRepairs, type StatedRepair } from "../../entities/repair";
|
|
3
|
+
import type { DecisionCtx } from "../../entities/overview/decision";
|
|
4
|
+
import type { Arch } from "../../entities/architecture";
|
|
5
|
+
import type { Described } from "../../entities/story";
|
|
6
|
+
import type { FindingType } from "./finding-type";
|
|
7
|
+
declare const TYPES: FindingType[];
|
|
8
|
+
declare const normalize: (list: readonly (string | StatedRepair | null | undefined)[] | null | undefined) => ReturnType<typeof normalizeRepairs>;
|
|
9
|
+
/**
|
|
10
|
+
* ctx = { finding, file, key, violation, ownerNode, plan, nodes, arch, invariant }
|
|
11
|
+
*
|
|
12
|
+
* → { type, label, story, message, options }
|
|
13
|
+
*
|
|
14
|
+
* story what the finding is about (nodes + script of the picture), plus
|
|
15
|
+
* `destinations` — the decision above, already made
|
|
16
|
+
* message the sentence the reader sees
|
|
17
|
+
* options [{ code, text, to }] — code is the repair kind, `to` are the
|
|
18
|
+
* boxes it lands in, `text` is the line printed for it
|
|
19
|
+
*/
|
|
20
|
+
declare const describe: (ctx: Omit<DecisionCtx, "places"> & {
|
|
21
|
+
arch: Arch;
|
|
22
|
+
}) => Described;
|
|
23
|
+
export { describe, TYPES, normalize, decide, resolveWeights, resolveThresholds, DEFAULT_WEIGHTS, DEFAULT_THRESHOLDS };
|
|
@@ -0,0 +1,99 @@
|
|
|
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.DEFAULT_THRESHOLDS = exports.DEFAULT_WEIGHTS = exports.resolveThresholds = exports.resolveWeights = exports.decide = exports.normalize = exports.TYPES = exports.describe = void 0;
|
|
27
|
+
// THE decision maker — one file, three jobs, in this order:
|
|
28
|
+
//
|
|
29
|
+
// 1. WHICH KIND of finding this is (`TYPES`, first claim wins);
|
|
30
|
+
// 2. WHAT the reader is told (`message`) and WHAT THEY CAN DO
|
|
31
|
+
// (`options`, one shape for all of them);
|
|
32
|
+
// 3. WHERE the code belongs (`decide`, in ./destinations).
|
|
33
|
+
//
|
|
34
|
+
// Both representations read only its output:
|
|
35
|
+
//
|
|
36
|
+
// report/cli-report.ts text ← view.message + view.options[].text
|
|
37
|
+
// user-report/src/graph/ graph ← view.story + view.options[].to
|
|
38
|
+
//
|
|
39
|
+
// Nothing downstream re-decides anything, so the sentence and the picture cannot
|
|
40
|
+
// disagree: an option with three destinations IS three arrows and three lines.
|
|
41
|
+
const places_1 = require("./vocabulary/places");
|
|
42
|
+
const ids = __importStar(require("./vocabulary/ids"));
|
|
43
|
+
const destinations_1 = require("./destinations");
|
|
44
|
+
Object.defineProperty(exports, "decide", { enumerable: true, get: function () { return destinations_1.decide; } });
|
|
45
|
+
Object.defineProperty(exports, "resolveWeights", { enumerable: true, get: function () { return destinations_1.resolveWeights; } });
|
|
46
|
+
Object.defineProperty(exports, "resolveThresholds", { enumerable: true, get: function () { return destinations_1.resolveThresholds; } });
|
|
47
|
+
Object.defineProperty(exports, "DEFAULT_WEIGHTS", { enumerable: true, get: function () { return destinations_1.DEFAULT_WEIGHTS; } });
|
|
48
|
+
Object.defineProperty(exports, "DEFAULT_THRESHOLDS", { enumerable: true, get: function () { return destinations_1.DEFAULT_THRESHOLDS; } });
|
|
49
|
+
const repair_1 = require("../../entities/repair");
|
|
50
|
+
const wrongAction = __importStar(require("./types/wrongAction"));
|
|
51
|
+
const wrongPlacement = __importStar(require("./types/wrongPlacement"));
|
|
52
|
+
const unknownRole = __importStar(require("./types/unknownRole"));
|
|
53
|
+
const fileContents = __importStar(require("./types/fileContents"));
|
|
54
|
+
// Order is the decision: the first type that claims the finding wins, and
|
|
55
|
+
// fileContents claims everything, so it stays last.
|
|
56
|
+
const TYPES = [wrongAction, wrongPlacement, unknownRole, fileContents];
|
|
57
|
+
exports.TYPES = TYPES;
|
|
58
|
+
// One shape for every option, whatever produced it: an old string-returning type
|
|
59
|
+
// cannot reintroduce a second format. The walk lives in `entities/repair`.
|
|
60
|
+
const normalize = (list) => (0, repair_1.normalizeRepairs)(list);
|
|
61
|
+
exports.normalize = normalize;
|
|
62
|
+
/**
|
|
63
|
+
* ctx = { finding, file, key, violation, ownerNode, plan, nodes, arch, invariant }
|
|
64
|
+
*
|
|
65
|
+
* → { type, label, story, message, options }
|
|
66
|
+
*
|
|
67
|
+
* story what the finding is about (nodes + script of the picture), plus
|
|
68
|
+
* `destinations` — the decision above, already made
|
|
69
|
+
* message the sentence the reader sees
|
|
70
|
+
* options [{ code, text, to }] — code is the repair kind, `to` are the
|
|
71
|
+
* boxes it lands in, `text` is the line printed for it
|
|
72
|
+
*/
|
|
73
|
+
const describe = (ctx) => {
|
|
74
|
+
const places = (0, places_1.make)({ nodes: ctx.nodes ?? [], arch: ctx.arch });
|
|
75
|
+
const full = { ...ctx, places };
|
|
76
|
+
for (const type of TYPES) {
|
|
77
|
+
const story = type.classify(full, places);
|
|
78
|
+
if (!story)
|
|
79
|
+
continue;
|
|
80
|
+
// WHERE the code belongs is decided HERE, once, for every type: the type
|
|
81
|
+
// module renders a destination, it never picks one.
|
|
82
|
+
const withDestinations = { ...story, destinations: (0, destinations_1.decide)({ story, ctx: full }) };
|
|
83
|
+
return {
|
|
84
|
+
type: type.id,
|
|
85
|
+
label: type.label,
|
|
86
|
+
story: withDestinations,
|
|
87
|
+
message: type.message(withDestinations, full) ?? null,
|
|
88
|
+
options: normalize(type.fixes(withDestinations, full)),
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
return {
|
|
92
|
+
type: ids.FILE_CONTENTS,
|
|
93
|
+
label: fileContents.label,
|
|
94
|
+
story: { type: ids.FILE_CONTENTS, from: null, to: [] },
|
|
95
|
+
message: null,
|
|
96
|
+
options: [],
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
exports.describe = describe;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { DecisionCtx } from "../../entities/overview/decision";
|
|
2
|
+
import type { Story, Destination } from "../../entities/story";
|
|
3
|
+
declare const DEFAULT_WEIGHTS: {
|
|
4
|
+
declared: number;
|
|
5
|
+
inferred: number;
|
|
6
|
+
named: number;
|
|
7
|
+
hostable: number;
|
|
8
|
+
branch: number;
|
|
9
|
+
};
|
|
10
|
+
declare const DEFAULT_THRESHOLDS: {
|
|
11
|
+
move: number;
|
|
12
|
+
};
|
|
13
|
+
declare const KEYS: readonly ["declared", "inferred", "named", "hostable", "branch"];
|
|
14
|
+
type SignalKey = (typeof KEYS)[number];
|
|
15
|
+
type Weights = Record<SignalKey, number>;
|
|
16
|
+
type Thresholds = {
|
|
17
|
+
move: number;
|
|
18
|
+
};
|
|
19
|
+
declare const resolveWeights: (override: Partial<Weights> | null | undefined) => Weights;
|
|
20
|
+
declare const resolveThresholds: (override: Partial<Thresholds> | null | undefined) => Thresholds;
|
|
21
|
+
/**
|
|
22
|
+
* → [{ role, node, path, confidence, tier, reason, signals, contributions,
|
|
23
|
+
* evidence, thresholds, weights }] best first, max 3.
|
|
24
|
+
*
|
|
25
|
+
* Empty when there is no tree to ask, when the code already sits where its role
|
|
26
|
+
* lives, when the code's own role is unknown, or when the relation stays
|
|
27
|
+
* forbidden at the candidate's place.
|
|
28
|
+
*/
|
|
29
|
+
type Tuning = {
|
|
30
|
+
weights?: Partial<Weights>;
|
|
31
|
+
thresholds?: Partial<Thresholds>;
|
|
32
|
+
};
|
|
33
|
+
declare const decide: (args: {
|
|
34
|
+
story: Story;
|
|
35
|
+
ctx: DecisionCtx;
|
|
36
|
+
tuning?: Tuning;
|
|
37
|
+
}) => Destination[];
|
|
38
|
+
export { decide, resolveWeights, resolveThresholds, DEFAULT_WEIGHTS, DEFAULT_THRESHOLDS };
|