@driftsys/markspec 0.5.0 → 0.6.1
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/README.md +74 -20
- package/esm/ast/build.d.ts +11 -21
- package/esm/ast/build.d.ts.map +1 -1
- package/esm/ast/build.js +50 -139
- package/esm/ast/nodes.d.ts +11 -43
- package/esm/ast/nodes.d.ts.map +1 -1
- package/esm/ast/nodes.js +6 -1
- package/esm/ast/normalize.d.ts +8 -17
- package/esm/ast/normalize.d.ts.map +1 -1
- package/esm/ast/normalize.js +14 -72
- package/esm/compiler/constants.d.ts +16 -0
- package/esm/compiler/constants.d.ts.map +1 -0
- package/esm/compiler/constants.js +26 -0
- package/esm/compiler/discipline_classifier.d.ts +55 -0
- package/esm/compiler/discipline_classifier.d.ts.map +1 -0
- package/esm/compiler/discipline_classifier.js +191 -0
- package/esm/compiler/inverses.d.ts +7 -0
- package/esm/compiler/inverses.d.ts.map +1 -1
- package/esm/compiler/inverses.js +1 -18
- package/esm/compiler/mod.d.ts +30 -1
- package/esm/compiler/mod.d.ts.map +1 -1
- package/esm/compiler/mod.js +198 -65
- package/esm/compiler/schema.d.ts +15 -0
- package/esm/compiler/schema.d.ts.map +1 -1
- package/esm/compiler/schema.js +12 -0
- package/esm/config/markspec.d.ts +5 -0
- package/esm/config/markspec.d.ts.map +1 -1
- package/esm/config/markspec.js +17 -2
- package/esm/formatter/mod.d.ts +9 -3
- package/esm/formatter/mod.d.ts.map +1 -1
- package/esm/formatter/mod.js +97 -49
- package/esm/lexicons/loader.d.ts +35 -0
- package/esm/lexicons/loader.d.ts.map +1 -0
- package/esm/lexicons/loader.js +51 -0
- package/esm/lexicons/mod.d.ts +13 -0
- package/esm/lexicons/mod.d.ts.map +1 -0
- package/esm/lexicons/mod.js +12 -0
- package/esm/lint/glossary.d.ts +45 -0
- package/esm/lint/glossary.d.ts.map +1 -0
- package/esm/lint/glossary.js +85 -0
- package/esm/lint/mod.d.ts +4 -0
- package/esm/lint/mod.d.ts.map +1 -1
- package/esm/lint/mod.js +2 -0
- package/esm/lint/range_util.d.ts +25 -0
- package/esm/lint/range_util.d.ts.map +1 -0
- package/esm/lint/range_util.js +50 -0
- package/esm/lint/rules/ears.d.ts +39 -0
- package/esm/lint/rules/ears.d.ts.map +1 -0
- package/esm/lint/rules/ears.js +316 -0
- package/esm/lint/rules/incose_sentence.d.ts +46 -0
- package/esm/lint/rules/incose_sentence.d.ts.map +1 -0
- package/esm/lint/rules/incose_sentence.js +417 -0
- package/esm/lint/rules/modal_sentence.d.ts +46 -0
- package/esm/lint/rules/modal_sentence.d.ts.map +1 -0
- package/esm/lint/rules/modal_sentence.js +146 -0
- package/esm/lint/rules/passive.d.ts +64 -0
- package/esm/lint/rules/passive.d.ts.map +1 -0
- package/esm/lint/rules/passive.js +282 -0
- package/esm/lint/rules/suppression.d.ts +38 -3
- package/esm/lint/rules/suppression.d.ts.map +1 -1
- package/esm/lint/rules/suppression.js +58 -4
- package/esm/lint/rules/xref.d.ts +19 -0
- package/esm/lint/rules/xref.d.ts.map +1 -0
- package/esm/lint/rules/xref.js +248 -0
- package/esm/lint/runner.d.ts +31 -11
- package/esm/lint/runner.d.ts.map +1 -1
- package/esm/lint/runner.js +67 -26
- package/esm/lint/score.d.ts +64 -0
- package/esm/lint/score.d.ts.map +1 -0
- package/esm/lint/score.js +163 -0
- package/esm/lint/segmenter.d.ts +32 -0
- package/esm/lint/segmenter.d.ts.map +1 -0
- package/esm/lint/segmenter.js +79 -0
- package/esm/lint/types.d.ts +12 -0
- package/esm/lint/types.d.ts.map +1 -1
- package/esm/lock/canonical_edges.d.ts +31 -0
- package/esm/lock/canonical_edges.d.ts.map +1 -0
- package/esm/lock/canonical_edges.js +57 -0
- package/esm/lock/check.d.ts +24 -0
- package/esm/lock/check.d.ts.map +1 -0
- package/esm/lock/check.js +127 -0
- package/esm/lock/hash.d.ts +12 -0
- package/esm/lock/hash.d.ts.map +1 -0
- package/esm/lock/hash.js +32 -0
- package/esm/lock/mod.d.ts +19 -0
- package/esm/lock/mod.d.ts.map +1 -0
- package/esm/lock/mod.js +14 -0
- package/esm/lock/model.d.ts +81 -0
- package/esm/lock/model.d.ts.map +1 -0
- package/esm/lock/model.js +7 -0
- package/esm/lock/parser.d.ts +26 -0
- package/esm/lock/parser.d.ts.map +1 -0
- package/esm/lock/parser.js +195 -0
- package/esm/lock/resolve.d.ts +142 -0
- package/esm/lock/resolve.d.ts.map +1 -0
- package/esm/lock/resolve.js +389 -0
- package/esm/lock/serializer.d.ts +14 -0
- package/esm/lock/serializer.d.ts.map +1 -0
- package/esm/lock/serializer.js +104 -0
- package/esm/mod.d.ts +16 -9
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +12 -4
- package/esm/model/attributes.d.ts +6 -0
- package/esm/model/attributes.d.ts.map +1 -1
- package/esm/model/attributes.js +37 -0
- package/esm/model/discipline.d.ts +53 -0
- package/esm/model/discipline.d.ts.map +1 -0
- package/esm/model/discipline.js +50 -0
- package/esm/model/mod.d.ts +188 -30
- package/esm/model/mod.d.ts.map +1 -1
- package/esm/model/mod.js +42 -1
- package/esm/model/profile.d.ts +69 -0
- package/esm/model/profile.d.ts.map +1 -1
- package/esm/parser/attributes.d.ts.map +1 -1
- package/esm/parser/attributes.js +1 -10
- package/esm/parser/body_tokens.d.ts +35 -0
- package/esm/parser/body_tokens.d.ts.map +1 -0
- package/esm/parser/body_tokens.js +232 -0
- package/esm/parser/glossary.d.ts +8 -0
- package/esm/parser/glossary.d.ts.map +1 -1
- package/esm/parser/glossary.js +6 -4
- package/esm/parser/grammars.d.ts +5 -3
- package/esm/parser/grammars.d.ts.map +1 -1
- package/esm/parser/grammars.js +18 -4
- package/esm/parser/language_spec.d.ts +55 -0
- package/esm/parser/language_spec.d.ts.map +1 -0
- package/esm/parser/language_spec.js +419 -0
- package/esm/parser/line_map.d.ts +60 -0
- package/esm/parser/line_map.d.ts.map +1 -0
- package/esm/parser/line_map.js +41 -0
- package/esm/parser/markdown.d.ts +9 -0
- package/esm/parser/markdown.d.ts.map +1 -1
- package/esm/parser/markdown.js +97 -31
- package/esm/parser/mod.d.ts +4 -0
- package/esm/parser/mod.d.ts.map +1 -1
- package/esm/parser/mod.js +30 -8
- package/esm/parser/source.d.ts +39 -8
- package/esm/parser/source.d.ts.map +1 -1
- package/esm/parser/source.js +155 -65
- package/esm/parser/translate.d.ts +24 -0
- package/esm/parser/translate.d.ts.map +1 -0
- package/esm/parser/translate.js +99 -0
- package/esm/profile/chain.d.ts +8 -0
- package/esm/profile/chain.d.ts.map +1 -1
- package/esm/profile/chain.js +29 -1
- package/esm/profile/default_profile.d.ts +25 -0
- package/esm/profile/default_profile.d.ts.map +1 -0
- package/esm/profile/default_profile.js +43 -0
- package/esm/profile/discipline_mode.d.ts +64 -0
- package/esm/profile/discipline_mode.d.ts.map +1 -0
- package/esm/profile/discipline_mode.js +133 -0
- package/esm/profile/discipline_registry.d.ts +41 -0
- package/esm/profile/discipline_registry.d.ts.map +1 -0
- package/esm/profile/discipline_registry.js +67 -0
- package/esm/profile/load.d.ts +3 -1
- package/esm/profile/load.d.ts.map +1 -1
- package/esm/profile/load.js +24 -5
- package/esm/profile/manifest.d.ts.map +1 -1
- package/esm/profile/manifest.js +253 -20
- package/esm/profile/merge.d.ts.map +1 -1
- package/esm/profile/merge.js +112 -0
- package/esm/profile/mod.d.ts +2 -0
- package/esm/profile/mod.d.ts.map +1 -1
- package/esm/profile/mod.js +2 -0
- package/esm/sync/locked_attributes.d.ts +19 -0
- package/esm/sync/locked_attributes.d.ts.map +1 -0
- package/esm/sync/locked_attributes.js +27 -0
- package/esm/sync/log.d.ts +34 -0
- package/esm/sync/log.d.ts.map +1 -0
- package/esm/sync/log.js +48 -0
- package/esm/sync/mapping.d.ts +66 -0
- package/esm/sync/mapping.d.ts.map +1 -0
- package/esm/sync/mapping.js +165 -0
- package/esm/sync/mod.d.ts +16 -0
- package/esm/sync/mod.d.ts.map +1 -0
- package/esm/sync/mod.js +12 -0
- package/esm/sync/status.d.ts +23 -0
- package/esm/sync/status.d.ts.map +1 -0
- package/esm/sync/status.js +21 -0
- package/esm/typl/ast.d.ts +87 -0
- package/esm/typl/ast.d.ts.map +1 -0
- package/esm/typl/ast.js +21 -0
- package/esm/typl/bridge.d.ts +32 -0
- package/esm/typl/bridge.d.ts.map +1 -0
- package/esm/typl/bridge.js +27 -0
- package/esm/typl/bullet.d.ts +34 -0
- package/esm/typl/bullet.d.ts.map +1 -0
- package/esm/typl/bullet.js +44 -0
- package/esm/typl/diagnostics.d.ts +43 -0
- package/esm/typl/diagnostics.d.ts.map +1 -0
- package/esm/typl/diagnostics.js +61 -0
- package/esm/typl/fence.d.ts +31 -0
- package/esm/typl/fence.d.ts.map +1 -0
- package/esm/typl/fence.js +24 -0
- package/esm/typl/grammar.d.ts +20 -0
- package/esm/typl/grammar.d.ts.map +1 -0
- package/esm/typl/grammar.js +471 -0
- package/esm/typl/inline.d.ts +34 -0
- package/esm/typl/inline.d.ts.map +1 -0
- package/esm/typl/inline.js +48 -0
- package/esm/typl/lexer.d.ts +37 -0
- package/esm/typl/lexer.d.ts.map +1 -0
- package/esm/typl/lexer.js +234 -0
- package/esm/typl/mod.d.ts +23 -0
- package/esm/typl/mod.d.ts.map +1 -0
- package/esm/typl/mod.js +16 -0
- package/esm/typl/registry.d.ts +42 -0
- package/esm/typl/registry.d.ts.map +1 -0
- package/esm/typl/registry.js +26 -0
- package/esm/typl/validator.d.ts +29 -0
- package/esm/typl/validator.d.ts.map +1 -0
- package/esm/typl/validator.js +141 -0
- package/esm/util/line_endings.d.ts +33 -0
- package/esm/util/line_endings.d.ts.map +1 -0
- package/esm/util/line_endings.js +53 -0
- package/esm/util/modals.d.ts +29 -0
- package/esm/util/modals.d.ts.map +1 -0
- package/esm/util/modals.js +38 -0
- package/esm/validator/discipline.d.ts +35 -0
- package/esm/validator/discipline.d.ts.map +1 -0
- package/esm/validator/discipline.js +204 -0
- package/esm/validator/mod.d.ts +1 -1
- package/esm/validator/mod.d.ts.map +1 -1
- package/esm/validator/mod.js +23 -2
- package/esm/validator/modal_keywords.d.ts +15 -13
- package/esm/validator/modal_keywords.d.ts.map +1 -1
- package/esm/validator/modal_keywords.js +26 -109
- package/esm/validator/pattern.d.ts +15 -8
- package/esm/validator/pattern.d.ts.map +1 -1
- package/esm/validator/pattern.js +42 -19
- package/esm/validator/per_type_attrs.d.ts +2 -2
- package/esm/validator/per_type_attrs.d.ts.map +1 -1
- package/esm/validator/per_type_attrs.js +2 -2
- package/esm/validator/pipeline.d.ts +11 -0
- package/esm/validator/pipeline.d.ts.map +1 -1
- package/esm/validator/pipeline.js +37 -15
- package/esm/validator/type_resolution.d.ts +3 -3
- package/esm/validator/type_resolution.d.ts.map +1 -1
- package/esm/validator/type_resolution.js +31 -9
- package/package.json +2 -2
- package/script/ast/build.d.ts +11 -21
- package/script/ast/build.d.ts.map +1 -1
- package/script/ast/build.js +51 -140
- package/script/ast/nodes.d.ts +11 -43
- package/script/ast/nodes.d.ts.map +1 -1
- package/script/ast/nodes.js +6 -1
- package/script/ast/normalize.d.ts +8 -17
- package/script/ast/normalize.d.ts.map +1 -1
- package/script/ast/normalize.js +16 -74
- package/script/compiler/constants.d.ts +16 -0
- package/script/compiler/constants.d.ts.map +1 -0
- package/script/compiler/constants.js +29 -0
- package/script/compiler/discipline_classifier.d.ts +55 -0
- package/script/compiler/discipline_classifier.d.ts.map +1 -0
- package/script/compiler/discipline_classifier.js +196 -0
- package/script/compiler/inverses.d.ts +7 -0
- package/script/compiler/inverses.d.ts.map +1 -1
- package/script/compiler/inverses.js +2 -19
- package/script/compiler/mod.d.ts +30 -1
- package/script/compiler/mod.d.ts.map +1 -1
- package/script/compiler/mod.js +202 -69
- package/script/compiler/schema.d.ts +15 -0
- package/script/compiler/schema.d.ts.map +1 -1
- package/script/compiler/schema.js +12 -0
- package/script/config/markspec.d.ts +5 -0
- package/script/config/markspec.d.ts.map +1 -1
- package/script/config/markspec.js +17 -2
- package/script/formatter/mod.d.ts +9 -3
- package/script/formatter/mod.d.ts.map +1 -1
- package/script/formatter/mod.js +99 -51
- package/script/lexicons/loader.d.ts +35 -0
- package/script/lexicons/loader.d.ts.map +1 -0
- package/script/lexicons/loader.js +55 -0
- package/script/lexicons/mod.d.ts +13 -0
- package/script/lexicons/mod.d.ts.map +1 -0
- package/script/lexicons/mod.js +17 -0
- package/script/lint/glossary.d.ts +45 -0
- package/script/lint/glossary.d.ts.map +1 -0
- package/script/lint/glossary.js +88 -0
- package/script/lint/mod.d.ts +4 -0
- package/script/lint/mod.d.ts.map +1 -1
- package/script/lint/mod.js +6 -1
- package/script/lint/range_util.d.ts +25 -0
- package/script/lint/range_util.d.ts.map +1 -0
- package/script/lint/range_util.js +53 -0
- package/script/lint/rules/ears.d.ts +39 -0
- package/script/lint/rules/ears.d.ts.map +1 -0
- package/script/lint/rules/ears.js +320 -0
- package/script/lint/rules/incose_sentence.d.ts +46 -0
- package/script/lint/rules/incose_sentence.d.ts.map +1 -0
- package/script/lint/rules/incose_sentence.js +421 -0
- package/script/lint/rules/modal_sentence.d.ts +46 -0
- package/script/lint/rules/modal_sentence.d.ts.map +1 -0
- package/script/lint/rules/modal_sentence.js +150 -0
- package/script/lint/rules/passive.d.ts +64 -0
- package/script/lint/rules/passive.d.ts.map +1 -0
- package/script/lint/rules/passive.js +286 -0
- package/script/lint/rules/suppression.d.ts +38 -3
- package/script/lint/rules/suppression.d.ts.map +1 -1
- package/script/lint/rules/suppression.js +59 -3
- package/script/lint/rules/xref.d.ts +19 -0
- package/script/lint/rules/xref.d.ts.map +1 -0
- package/script/lint/rules/xref.js +251 -0
- package/script/lint/runner.d.ts +31 -11
- package/script/lint/runner.d.ts.map +1 -1
- package/script/lint/runner.js +67 -26
- package/script/lint/score.d.ts +64 -0
- package/script/lint/score.d.ts.map +1 -0
- package/script/lint/score.js +167 -0
- package/script/lint/segmenter.d.ts +32 -0
- package/script/lint/segmenter.d.ts.map +1 -0
- package/script/lint/segmenter.js +82 -0
- package/script/lint/types.d.ts +12 -0
- package/script/lint/types.d.ts.map +1 -1
- package/script/lock/canonical_edges.d.ts +31 -0
- package/script/lock/canonical_edges.d.ts.map +1 -0
- package/script/lock/canonical_edges.js +61 -0
- package/script/lock/check.d.ts +24 -0
- package/script/lock/check.d.ts.map +1 -0
- package/script/lock/check.js +130 -0
- package/script/lock/hash.d.ts +12 -0
- package/script/lock/hash.d.ts.map +1 -0
- package/script/lock/hash.js +36 -0
- package/script/lock/mod.d.ts +19 -0
- package/script/lock/mod.d.ts.map +1 -0
- package/script/lock/mod.js +31 -0
- package/script/lock/model.d.ts +81 -0
- package/script/lock/model.d.ts.map +1 -0
- package/script/lock/model.js +10 -0
- package/script/lock/parser.d.ts +26 -0
- package/script/lock/parser.d.ts.map +1 -0
- package/script/lock/parser.js +198 -0
- package/script/lock/resolve.d.ts +142 -0
- package/script/lock/resolve.d.ts.map +1 -0
- package/script/lock/resolve.js +397 -0
- package/script/lock/serializer.d.ts +14 -0
- package/script/lock/serializer.d.ts.map +1 -0
- package/script/lock/serializer.js +107 -0
- package/script/mod.d.ts +16 -9
- package/script/mod.d.ts.map +1 -1
- package/script/mod.js +111 -38
- package/script/model/attributes.d.ts +6 -0
- package/script/model/attributes.d.ts.map +1 -1
- package/script/model/attributes.js +38 -1
- package/script/model/discipline.d.ts +53 -0
- package/script/model/discipline.d.ts.map +1 -0
- package/script/model/discipline.js +53 -0
- package/script/model/mod.d.ts +188 -30
- package/script/model/mod.d.ts.map +1 -1
- package/script/model/mod.js +48 -1
- package/script/model/profile.d.ts +69 -0
- package/script/model/profile.d.ts.map +1 -1
- package/script/parser/attributes.d.ts.map +1 -1
- package/script/parser/attributes.js +1 -10
- package/script/parser/body_tokens.d.ts +35 -0
- package/script/parser/body_tokens.d.ts.map +1 -0
- package/script/parser/body_tokens.js +235 -0
- package/script/parser/glossary.d.ts +8 -0
- package/script/parser/glossary.d.ts.map +1 -1
- package/script/parser/glossary.js +7 -4
- package/script/parser/grammars.d.ts +5 -3
- package/script/parser/grammars.d.ts.map +1 -1
- package/script/parser/grammars.js +21 -8
- package/script/parser/language_spec.d.ts +55 -0
- package/script/parser/language_spec.d.ts.map +1 -0
- package/script/parser/language_spec.js +423 -0
- package/script/parser/line_map.d.ts +60 -0
- package/script/parser/line_map.d.ts.map +1 -0
- package/script/parser/line_map.js +44 -0
- package/script/parser/markdown.d.ts +9 -0
- package/script/parser/markdown.d.ts.map +1 -1
- package/script/parser/markdown.js +95 -29
- package/script/parser/mod.d.ts +4 -0
- package/script/parser/mod.d.ts.map +1 -1
- package/script/parser/mod.js +32 -7
- package/script/parser/source.d.ts +39 -8
- package/script/parser/source.d.ts.map +1 -1
- package/script/parser/source.js +156 -69
- package/script/parser/translate.d.ts +24 -0
- package/script/parser/translate.d.ts.map +1 -0
- package/script/parser/translate.js +102 -0
- package/script/profile/chain.d.ts +8 -0
- package/script/profile/chain.d.ts.map +1 -1
- package/script/profile/chain.js +29 -1
- package/script/profile/default_profile.d.ts +25 -0
- package/script/profile/default_profile.d.ts.map +1 -0
- package/script/profile/default_profile.js +46 -0
- package/script/profile/discipline_mode.d.ts +64 -0
- package/script/profile/discipline_mode.d.ts.map +1 -0
- package/script/profile/discipline_mode.js +138 -0
- package/script/profile/discipline_registry.d.ts +41 -0
- package/script/profile/discipline_registry.d.ts.map +1 -0
- package/script/profile/discipline_registry.js +70 -0
- package/script/profile/load.d.ts +3 -1
- package/script/profile/load.d.ts.map +1 -1
- package/script/profile/load.js +24 -5
- package/script/profile/manifest.d.ts.map +1 -1
- package/script/profile/manifest.js +252 -19
- package/script/profile/merge.d.ts.map +1 -1
- package/script/profile/merge.js +112 -0
- package/script/profile/mod.d.ts +2 -0
- package/script/profile/mod.d.ts.map +1 -1
- package/script/profile/mod.js +6 -1
- package/script/sync/locked_attributes.d.ts +19 -0
- package/script/sync/locked_attributes.d.ts.map +1 -0
- package/script/sync/locked_attributes.js +30 -0
- package/script/sync/log.d.ts +34 -0
- package/script/sync/log.d.ts.map +1 -0
- package/script/sync/log.js +52 -0
- package/script/sync/mapping.d.ts +66 -0
- package/script/sync/mapping.d.ts.map +1 -0
- package/script/sync/mapping.js +169 -0
- package/script/sync/mod.d.ts +16 -0
- package/script/sync/mod.d.ts.map +1 -0
- package/script/sync/mod.js +21 -0
- package/script/sync/status.d.ts +23 -0
- package/script/sync/status.d.ts.map +1 -0
- package/script/sync/status.js +24 -0
- package/script/typl/ast.d.ts +87 -0
- package/script/typl/ast.d.ts.map +1 -0
- package/script/typl/ast.js +24 -0
- package/script/typl/bridge.d.ts +32 -0
- package/script/typl/bridge.d.ts.map +1 -0
- package/script/typl/bridge.js +30 -0
- package/script/typl/bullet.d.ts +34 -0
- package/script/typl/bullet.d.ts.map +1 -0
- package/script/typl/bullet.js +47 -0
- package/script/typl/diagnostics.d.ts +43 -0
- package/script/typl/diagnostics.d.ts.map +1 -0
- package/script/typl/diagnostics.js +65 -0
- package/script/typl/fence.d.ts +31 -0
- package/script/typl/fence.d.ts.map +1 -0
- package/script/typl/fence.js +27 -0
- package/script/typl/grammar.d.ts +20 -0
- package/script/typl/grammar.d.ts.map +1 -0
- package/script/typl/grammar.js +474 -0
- package/script/typl/inline.d.ts +34 -0
- package/script/typl/inline.d.ts.map +1 -0
- package/script/typl/inline.js +51 -0
- package/script/typl/lexer.d.ts +37 -0
- package/script/typl/lexer.d.ts.map +1 -0
- package/script/typl/lexer.js +237 -0
- package/script/typl/mod.d.ts +23 -0
- package/script/typl/mod.d.ts.map +1 -0
- package/script/typl/mod.js +29 -0
- package/script/typl/registry.d.ts +42 -0
- package/script/typl/registry.d.ts.map +1 -0
- package/script/typl/registry.js +29 -0
- package/script/typl/validator.d.ts +29 -0
- package/script/typl/validator.d.ts.map +1 -0
- package/script/typl/validator.js +144 -0
- package/script/util/line_endings.d.ts +33 -0
- package/script/util/line_endings.d.ts.map +1 -0
- package/script/util/line_endings.js +58 -0
- package/script/util/modals.d.ts +29 -0
- package/script/util/modals.d.ts.map +1 -0
- package/script/util/modals.js +42 -0
- package/script/validator/discipline.d.ts +35 -0
- package/script/validator/discipline.d.ts.map +1 -0
- package/script/validator/discipline.js +207 -0
- package/script/validator/mod.d.ts +1 -1
- package/script/validator/mod.d.ts.map +1 -1
- package/script/validator/mod.js +23 -1
- package/script/validator/modal_keywords.d.ts +15 -13
- package/script/validator/modal_keywords.d.ts.map +1 -1
- package/script/validator/modal_keywords.js +26 -109
- package/script/validator/pattern.d.ts +15 -8
- package/script/validator/pattern.d.ts.map +1 -1
- package/script/validator/pattern.js +42 -19
- package/script/validator/per_type_attrs.d.ts +2 -2
- package/script/validator/per_type_attrs.d.ts.map +1 -1
- package/script/validator/per_type_attrs.js +2 -2
- package/script/validator/pipeline.d.ts +11 -0
- package/script/validator/pipeline.d.ts.map +1 -1
- package/script/validator/pipeline.js +40 -17
- package/script/validator/type_resolution.d.ts +3 -3
- package/script/validator/type_resolution.d.ts.map +1 -1
- package/script/validator/type_resolution.js +31 -9
- package/esm/parser/entity_refs.d.ts +0 -53
- package/esm/parser/entity_refs.d.ts.map +0 -1
- package/esm/parser/entity_refs.js +0 -151
- package/script/parser/entity_refs.d.ts +0 -53
- package/script/parser/entity_refs.d.ts.map +0 -1
- package/script/parser/entity_refs.js +0 -155
package/esm/profile/manifest.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* schema violations.
|
|
7
7
|
*/
|
|
8
8
|
import { parse as parseYaml } from "@std/yaml";
|
|
9
|
-
import { COLOR_NAME_RE, CORE_TYPES, LIST_VALUE_TYPES, PALETTE_HUES, VALUE_TYPES, } from "../model/mod.js";
|
|
9
|
+
import { COLOR_NAME_RE, CORE_KINDS, CORE_TYPES, LIST_VALUE_TYPES, MIXED_DISCIPLINE, PALETTE_HUES, VALUE_TYPES, } from "../model/mod.js";
|
|
10
10
|
const VALUE_TYPE_SET = new Set(VALUE_TYPES);
|
|
11
11
|
const ALLOWED_ROOT_KEYS = new Set([
|
|
12
12
|
"id",
|
|
@@ -24,6 +24,9 @@ const ALLOWED_PROFILE_KEYS = new Set([
|
|
|
24
24
|
"conventions",
|
|
25
25
|
"types",
|
|
26
26
|
"documents",
|
|
27
|
+
"kinds",
|
|
28
|
+
"prose",
|
|
29
|
+
"discipline-mode",
|
|
27
30
|
]);
|
|
28
31
|
const ALLOWED_TYPE_KEYS = new Set([
|
|
29
32
|
"extends",
|
|
@@ -34,6 +37,7 @@ const ALLOWED_TYPE_KEYS = new Set([
|
|
|
34
37
|
"attributes",
|
|
35
38
|
"traceability",
|
|
36
39
|
"color",
|
|
40
|
+
"discipline",
|
|
37
41
|
]);
|
|
38
42
|
const ALLOWED_DOC_TYPE_KEYS = new Set(["id", "contains", "description"]);
|
|
39
43
|
const ALLOWED_DOCUMENTS_KEYS = new Set(["types", "frontMatter"]);
|
|
@@ -171,6 +175,42 @@ function parseCardinality(raw, fallback, context, sourcePath, diagnostics) {
|
|
|
171
175
|
}
|
|
172
176
|
return { lower, upper };
|
|
173
177
|
}
|
|
178
|
+
/**
|
|
179
|
+
* Flatten a (possibly grouped) value list to its leaf value names. Accepts
|
|
180
|
+
* items that are bare strings, `{name, description?}` objects, or
|
|
181
|
+
* `{group, description?, values: [...]}` group objects (recursed). Group
|
|
182
|
+
* labels and descriptions are documentation-only and dropped — markspec
|
|
183
|
+
* validates against the value names. Returns `null` when any item matches
|
|
184
|
+
* none of these shapes.
|
|
185
|
+
*/
|
|
186
|
+
function flattenGroupedNames(raw) {
|
|
187
|
+
if (!Array.isArray(raw))
|
|
188
|
+
return null;
|
|
189
|
+
const out = [];
|
|
190
|
+
for (const item of raw) {
|
|
191
|
+
if (typeof item === "string") {
|
|
192
|
+
out.push(item);
|
|
193
|
+
continue;
|
|
194
|
+
}
|
|
195
|
+
if (item == null || typeof item !== "object" || Array.isArray(item)) {
|
|
196
|
+
return null;
|
|
197
|
+
}
|
|
198
|
+
const o = item;
|
|
199
|
+
if (typeof o.name === "string") {
|
|
200
|
+
out.push(o.name);
|
|
201
|
+
}
|
|
202
|
+
else if (Array.isArray(o.values)) {
|
|
203
|
+
const nested = flattenGroupedNames(o.values);
|
|
204
|
+
if (nested === null)
|
|
205
|
+
return null;
|
|
206
|
+
out.push(...nested);
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
return null;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
return out;
|
|
213
|
+
}
|
|
174
214
|
function parseAttrDecl(raw, context, sourcePath, diagnostics) {
|
|
175
215
|
if (raw == null || typeof raw !== "object" || Array.isArray(raw)) {
|
|
176
216
|
diagnostics.push({
|
|
@@ -218,19 +258,18 @@ function parseAttrDecl(raw, context, sourcePath, diagnostics) {
|
|
|
218
258
|
const cardinality = parseCardinality(r.cardinality, defaultCardinality(vtype), `${context}/${name}`, sourcePath, diagnostics);
|
|
219
259
|
let values;
|
|
220
260
|
if (vtype === "enum") {
|
|
221
|
-
const
|
|
222
|
-
if (
|
|
223
|
-
rawValues.some((v) => typeof v !== "string") ||
|
|
224
|
-
rawValues.length === 0) {
|
|
261
|
+
const flat = flattenGroupedNames(r.values);
|
|
262
|
+
if (flat === null || flat.length === 0) {
|
|
225
263
|
diagnostics.push({
|
|
226
264
|
code: "PROFILE-LOAD-003",
|
|
227
265
|
severity: "error",
|
|
228
|
-
message: `${context}: enum attribute '${name}' requires a non-empty 'values' list
|
|
266
|
+
message: `${context}: enum attribute '${name}' requires a non-empty 'values' list ` +
|
|
267
|
+
`(strings, {name, description?}, or {group, values: [...]})`,
|
|
229
268
|
location: { file: sourcePath, line: 1, column: 1 },
|
|
230
269
|
});
|
|
231
270
|
return undefined;
|
|
232
271
|
}
|
|
233
|
-
values =
|
|
272
|
+
values = flat;
|
|
234
273
|
}
|
|
235
274
|
let inverse;
|
|
236
275
|
if (r.inverse !== undefined) {
|
|
@@ -459,27 +498,157 @@ function parseColorsMap(raw, sourcePath, diagnostics) {
|
|
|
459
498
|
}
|
|
460
499
|
return out;
|
|
461
500
|
}
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
501
|
+
/**
|
|
502
|
+
* Parse the `profile.kinds:` block. Each key must match COLOR_NAME_RE
|
|
503
|
+
* (the same lexical rule used for color names — lowercase letters,
|
|
504
|
+
* digits, hyphens, starting with a letter). Values may be:
|
|
505
|
+
* - `null` / `undefined` — declare the kind with no description.
|
|
506
|
+
* - a bare string — treated as the description shorthand.
|
|
507
|
+
* - a mapping with optional `description:`.
|
|
508
|
+
*
|
|
509
|
+
* Validation:
|
|
510
|
+
* - PROFILE-DISCIPLINE-001 (error): name fails the regex.
|
|
511
|
+
* - PROFILE-DISCIPLINE-002 (error): name is the reserved sentinel
|
|
512
|
+
* `MIXED_DISCIPLINE` ("mixed").
|
|
513
|
+
* - PROFILE-DISCIPLINE-003 (warning): name shadows a core kind
|
|
514
|
+
* (`system`/`software`/`hardware`).
|
|
515
|
+
*/
|
|
516
|
+
function parseKindsMap(raw, sourcePath, diagnostics) {
|
|
517
|
+
const out = new Map();
|
|
465
518
|
if (raw === undefined)
|
|
466
|
-
return
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
519
|
+
return out;
|
|
520
|
+
if (raw === null || typeof raw !== "object" || Array.isArray(raw)) {
|
|
521
|
+
diagnostics.push({
|
|
522
|
+
code: "PROFILE-LOAD-003",
|
|
523
|
+
severity: "error",
|
|
524
|
+
message: "profile.kinds: must be a mapping",
|
|
525
|
+
location: { file: sourcePath, line: 1, column: 1 },
|
|
526
|
+
});
|
|
527
|
+
return out;
|
|
528
|
+
}
|
|
529
|
+
for (const [name, value] of Object.entries(raw)) {
|
|
530
|
+
if (name === MIXED_DISCIPLINE) {
|
|
531
|
+
diagnostics.push({
|
|
532
|
+
code: "PROFILE-DISCIPLINE-002",
|
|
533
|
+
severity: "error",
|
|
534
|
+
message: `profile.kinds: '${name}' is a reserved sentinel name; choose a different kind name`,
|
|
535
|
+
location: { file: sourcePath, line: 1, column: 1 },
|
|
536
|
+
});
|
|
537
|
+
continue;
|
|
538
|
+
}
|
|
539
|
+
if (!COLOR_NAME_RE.test(name)) {
|
|
540
|
+
diagnostics.push({
|
|
541
|
+
code: "PROFILE-DISCIPLINE-001",
|
|
542
|
+
severity: "error",
|
|
543
|
+
message: `profile.kinds: '${name}' is not a valid kind name (lowercase letters, digits, hyphens; must start with a letter)`,
|
|
544
|
+
location: { file: sourcePath, line: 1, column: 1 },
|
|
545
|
+
});
|
|
546
|
+
continue;
|
|
547
|
+
}
|
|
548
|
+
if (CORE_KINDS.has(name)) {
|
|
549
|
+
diagnostics.push({
|
|
550
|
+
code: "PROFILE-DISCIPLINE-003",
|
|
551
|
+
severity: "warning",
|
|
552
|
+
message: `profile.kinds: '${name}' redeclares a core kind (already shipped by markspec core); the declaration is idempotent and will be ignored`,
|
|
553
|
+
location: { file: sourcePath, line: 1, column: 1 },
|
|
554
|
+
});
|
|
555
|
+
continue;
|
|
556
|
+
}
|
|
557
|
+
let description;
|
|
558
|
+
if (value === null || value === undefined) {
|
|
559
|
+
// declaration only
|
|
560
|
+
}
|
|
561
|
+
else if (typeof value === "string") {
|
|
562
|
+
description = value;
|
|
563
|
+
}
|
|
564
|
+
else if (typeof value === "object" && !Array.isArray(value)) {
|
|
565
|
+
const r = value;
|
|
566
|
+
if (r.description !== undefined && typeof r.description !== "string") {
|
|
472
567
|
diagnostics.push({
|
|
473
568
|
code: "PROFILE-LOAD-003",
|
|
474
569
|
severity: "error",
|
|
475
|
-
message:
|
|
570
|
+
message: `profile.kinds.${name}: 'description' must be a string`,
|
|
476
571
|
location: { file: sourcePath, line: 1, column: 1 },
|
|
477
572
|
});
|
|
478
|
-
|
|
573
|
+
continue;
|
|
479
574
|
}
|
|
480
|
-
|
|
575
|
+
description = typeof r.description === "string"
|
|
576
|
+
? r.description
|
|
577
|
+
: undefined;
|
|
578
|
+
}
|
|
579
|
+
else {
|
|
580
|
+
diagnostics.push({
|
|
581
|
+
code: "PROFILE-LOAD-003",
|
|
582
|
+
severity: "error",
|
|
583
|
+
message: `profile.kinds.${name}: value must be null, a string, or a mapping with 'description'`,
|
|
584
|
+
location: { file: sourcePath, line: 1, column: 1 },
|
|
585
|
+
});
|
|
586
|
+
continue;
|
|
481
587
|
}
|
|
482
|
-
|
|
588
|
+
out.set(name, description !== undefined ? { description } : {});
|
|
589
|
+
}
|
|
590
|
+
return out;
|
|
591
|
+
}
|
|
592
|
+
/** Closed enum of valid discipline-mode values (ADR-017 Slice 5). */
|
|
593
|
+
const DISCIPLINE_MODE_VALUES = new Set([
|
|
594
|
+
"flat",
|
|
595
|
+
"tiered",
|
|
596
|
+
"none",
|
|
597
|
+
]);
|
|
598
|
+
/**
|
|
599
|
+
* Parse the `profile.discipline-mode:` field. Must be a scalar string in
|
|
600
|
+
* {flat, tiered, none}. Returns `undefined` when the field is absent.
|
|
601
|
+
*
|
|
602
|
+
* Validation:
|
|
603
|
+
* - PROFILE-DISCIPLINE-006 (error): value is a scalar string but not
|
|
604
|
+
* in the allowed enum.
|
|
605
|
+
* - PROFILE-DISCIPLINE-007 (error): value is not a scalar string
|
|
606
|
+
* (mapping, list, etc.).
|
|
607
|
+
*/
|
|
608
|
+
function parseDisciplineMode(raw, sourcePath, diagnostics) {
|
|
609
|
+
if (raw === undefined || raw === null)
|
|
610
|
+
return undefined;
|
|
611
|
+
if (typeof raw !== "string") {
|
|
612
|
+
diagnostics.push({
|
|
613
|
+
code: "PROFILE-DISCIPLINE-007",
|
|
614
|
+
severity: "error",
|
|
615
|
+
message: `profile.discipline-mode: must be a scalar string (one of flat / tiered / none)`,
|
|
616
|
+
location: { file: sourcePath, line: 1, column: 1 },
|
|
617
|
+
});
|
|
618
|
+
return undefined;
|
|
619
|
+
}
|
|
620
|
+
if (!DISCIPLINE_MODE_VALUES.has(raw)) {
|
|
621
|
+
diagnostics.push({
|
|
622
|
+
code: "PROFILE-DISCIPLINE-006",
|
|
623
|
+
severity: "error",
|
|
624
|
+
message: `profile.discipline-mode: '${raw}' is not a valid mode (must be one of: flat, tiered, none)`,
|
|
625
|
+
location: { file: sourcePath, line: 1, column: 1 },
|
|
626
|
+
});
|
|
627
|
+
return undefined;
|
|
628
|
+
}
|
|
629
|
+
return raw;
|
|
630
|
+
}
|
|
631
|
+
const KNOWN_CONVENTIONS = new Set(["modal-keywords"]);
|
|
632
|
+
const MODAL_KEYWORDS_CASING_VALUES = new Set(["rfc2119", "iso", "preserve"]);
|
|
633
|
+
function parseLabelConcerns(raw, sourcePath, diagnostics) {
|
|
634
|
+
if (raw === undefined)
|
|
635
|
+
return [];
|
|
636
|
+
// Form A: sequence of label names → each becomes a flag concern. Entries
|
|
637
|
+
// may be bare strings or grouped objects ({group, values: [{name}, ...]});
|
|
638
|
+
// groups and descriptions are documentation-only and flattened away.
|
|
639
|
+
if (Array.isArray(raw)) {
|
|
640
|
+
const names = flattenGroupedNames(raw);
|
|
641
|
+
if (names === null) {
|
|
642
|
+
diagnostics.push({
|
|
643
|
+
code: "PROFILE-LOAD-003",
|
|
644
|
+
severity: "error",
|
|
645
|
+
message: "profile.labels: list entries must be strings, {name, description?}, " +
|
|
646
|
+
"or {group, values: [...]}",
|
|
647
|
+
location: { file: sourcePath, line: 1, column: 1 },
|
|
648
|
+
});
|
|
649
|
+
return [];
|
|
650
|
+
}
|
|
651
|
+
return names.map((name) => ({ name, kind: "flag", values: [] }));
|
|
483
652
|
}
|
|
484
653
|
// Form B: mapping — each key is a concern name.
|
|
485
654
|
if (raw === null || typeof raw !== "object") {
|
|
@@ -650,6 +819,46 @@ function parseConventions(raw, sourcePath, diagnostics) {
|
|
|
650
819
|
}
|
|
651
820
|
return out;
|
|
652
821
|
}
|
|
822
|
+
/**
|
|
823
|
+
* Parse the `profile.prose:` section. Returns a normalized object with
|
|
824
|
+
* the two lexicon lists; absent lists default to `[]`.
|
|
825
|
+
*/
|
|
826
|
+
function parseProse(raw, sourcePath, diagnostics) {
|
|
827
|
+
const empty = {
|
|
828
|
+
lexicons: { "capitalized-allow": [], "sentence-abbrev": [] },
|
|
829
|
+
};
|
|
830
|
+
if (raw === undefined || raw === null)
|
|
831
|
+
return empty;
|
|
832
|
+
if (typeof raw !== "object" || Array.isArray(raw)) {
|
|
833
|
+
diagnostics.push({
|
|
834
|
+
code: "PROFILE-LOAD-003",
|
|
835
|
+
severity: "error",
|
|
836
|
+
message: "'profile.prose' must be a mapping",
|
|
837
|
+
location: { file: sourcePath, line: 1, column: 1 },
|
|
838
|
+
});
|
|
839
|
+
return empty;
|
|
840
|
+
}
|
|
841
|
+
const r = raw;
|
|
842
|
+
const lexRaw = r.lexicons;
|
|
843
|
+
if (lexRaw === undefined || lexRaw === null) {
|
|
844
|
+
return empty;
|
|
845
|
+
}
|
|
846
|
+
if (typeof lexRaw !== "object" || Array.isArray(lexRaw)) {
|
|
847
|
+
diagnostics.push({
|
|
848
|
+
code: "PROFILE-LOAD-003",
|
|
849
|
+
severity: "error",
|
|
850
|
+
message: "'profile.prose.lexicons' must be a mapping",
|
|
851
|
+
location: { file: sourcePath, line: 1, column: 1 },
|
|
852
|
+
});
|
|
853
|
+
return empty;
|
|
854
|
+
}
|
|
855
|
+
const lex = lexRaw;
|
|
856
|
+
const capAllow = parseStringList(lex["capitalized-allow"], "profile.prose.lexicons.capitalized-allow", sourcePath, diagnostics);
|
|
857
|
+
const sentAbbrev = parseStringList(lex["sentence-abbrev"], "profile.prose.lexicons.sentence-abbrev", sourcePath, diagnostics);
|
|
858
|
+
return {
|
|
859
|
+
lexicons: { "capitalized-allow": capAllow, "sentence-abbrev": sentAbbrev },
|
|
860
|
+
};
|
|
861
|
+
}
|
|
653
862
|
function parseTypeDef(name, raw, sourcePath, diagnostics) {
|
|
654
863
|
const ctx = `profile.types.${name}`;
|
|
655
864
|
if (raw == null || typeof raw !== "object" || Array.isArray(raw)) {
|
|
@@ -732,6 +941,20 @@ function parseTypeDef(name, raw, sourcePath, diagnostics) {
|
|
|
732
941
|
}
|
|
733
942
|
color = r.color;
|
|
734
943
|
}
|
|
944
|
+
// PROFILE-DISCIPLINE-005 (error): value is not a non-empty string.
|
|
945
|
+
let discipline;
|
|
946
|
+
if (r.discipline !== undefined) {
|
|
947
|
+
if (typeof r.discipline !== "string" || r.discipline.length === 0) {
|
|
948
|
+
diagnostics.push({
|
|
949
|
+
code: "PROFILE-DISCIPLINE-005",
|
|
950
|
+
severity: "error",
|
|
951
|
+
message: `${ctx}: 'discipline' must be a non-empty string`,
|
|
952
|
+
location: { file: sourcePath, line: 1, column: 1 },
|
|
953
|
+
});
|
|
954
|
+
return undefined;
|
|
955
|
+
}
|
|
956
|
+
discipline = r.discipline;
|
|
957
|
+
}
|
|
735
958
|
const description = typeof r.description === "string"
|
|
736
959
|
? r.description
|
|
737
960
|
: undefined;
|
|
@@ -748,6 +971,7 @@ function parseTypeDef(name, raw, sourcePath, diagnostics) {
|
|
|
748
971
|
traceability,
|
|
749
972
|
color,
|
|
750
973
|
description,
|
|
974
|
+
discipline,
|
|
751
975
|
};
|
|
752
976
|
}
|
|
753
977
|
function parseTypesMap(raw, sourcePath, diagnostics) {
|
|
@@ -949,6 +1173,8 @@ export function parseManifest(rawYaml, sourcePath = "<markspec.yaml>") {
|
|
|
949
1173
|
const universalAttributes = parseAttrList(profileSection.attributes, "profile.attributes", sourcePath, diagnostics);
|
|
950
1174
|
const labels = parseLabelConcerns(profileSection.labels, sourcePath, diagnostics);
|
|
951
1175
|
const colors = parseColorsMap(profileSection.colors, sourcePath, diagnostics);
|
|
1176
|
+
const kinds = parseKindsMap(profileSection.kinds, sourcePath, diagnostics);
|
|
1177
|
+
const disciplineMode = parseDisciplineMode(profileSection["discipline-mode"], sourcePath, diagnostics);
|
|
952
1178
|
const conventions = parseConventions(profileSection.conventions, sourcePath, diagnostics);
|
|
953
1179
|
if (diagnostics.some((d) => d.severity === "error")) {
|
|
954
1180
|
return { manifest: null, diagnostics };
|
|
@@ -961,6 +1187,10 @@ export function parseManifest(rawYaml, sourcePath = "<markspec.yaml>") {
|
|
|
961
1187
|
if (diagnostics.some((d) => d.severity === "error")) {
|
|
962
1188
|
return { manifest: null, diagnostics };
|
|
963
1189
|
}
|
|
1190
|
+
const prose = parseProse(profileSection.prose, sourcePath, diagnostics);
|
|
1191
|
+
if (diagnostics.some((d) => d.severity === "error")) {
|
|
1192
|
+
return { manifest: null, diagnostics };
|
|
1193
|
+
}
|
|
964
1194
|
// PROFILE-SCHEMA-002: emitted on the otherwise-complete manifest so it
|
|
965
1195
|
// doesn't add noise to error-case output.
|
|
966
1196
|
if (rawSchema === undefined) {
|
|
@@ -986,6 +1216,9 @@ export function parseManifest(rawYaml, sourcePath = "<markspec.yaml>") {
|
|
|
986
1216
|
colors,
|
|
987
1217
|
types: types,
|
|
988
1218
|
documents: documents,
|
|
1219
|
+
kinds,
|
|
1220
|
+
prose,
|
|
1221
|
+
disciplineMode,
|
|
989
1222
|
};
|
|
990
1223
|
return { manifest, diagnostics };
|
|
991
1224
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merge.d.ts","sourceRoot":"","sources":["../../src/profile/merge.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"merge.d.ts","sourceRoot":"","sources":["../../src/profile/merge.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAEV,UAAU,EAGV,gBAAgB,EAKhB,YAAY,EASb,MAAM,iBAAiB,CAAC;AAGzB,oDAAoD;AACpD,MAAM,WAAW,WAAW;IAC1B,4EAA4E;IAC5E,QAAQ,CAAC,SAAS,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAC5C,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;CAC7C;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,YAAY,GAAG,WAAW,CAiF3D"}
|
package/esm/profile/merge.js
CHANGED
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Merge happens once at load. Callers should not call `mergeChain` lazily.
|
|
9
9
|
*/
|
|
10
|
+
import { CORE_KINDS } from "../model/mod.js";
|
|
11
|
+
import { resolveDisciplineMode } from "./discipline_mode.js";
|
|
10
12
|
/**
|
|
11
13
|
* Merge all tiers of a chain into one EffectiveProfile. Tiers are processed
|
|
12
14
|
* in root → leaf order; later tiers can add to or tighten earlier tiers'
|
|
@@ -41,13 +43,39 @@ export function mergeChain(chain) {
|
|
|
41
43
|
// required is narrower than its shape-scope required, for example.
|
|
42
44
|
// Start from root, fold each subsequent tier.
|
|
43
45
|
let effective = seedFromTier(tiers[0]);
|
|
46
|
+
// ADR-017 Slice 5: LWW accumulator for declared discipline-mode across
|
|
47
|
+
// tiers. Initialized from the seed tier; updated on each subsequent tier
|
|
48
|
+
// that supplies a value. Resolved post-fold via resolveDisciplineMode().
|
|
49
|
+
let declaredMode;
|
|
50
|
+
const seedMode = tiers[0].manifest.disciplineMode;
|
|
51
|
+
if (seedMode !== undefined) {
|
|
52
|
+
declaredMode = {
|
|
53
|
+
value: seedMode,
|
|
54
|
+
origin: tiers[0].manifest.id,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
44
57
|
for (let i = 1; i < tiers.length; i++) {
|
|
45
58
|
effective = foldTier(effective, tiers[i], diagnostics);
|
|
59
|
+
const tierMode = tiers[i].manifest.disciplineMode;
|
|
60
|
+
if (tierMode !== undefined) {
|
|
61
|
+
declaredMode = {
|
|
62
|
+
value: tierMode,
|
|
63
|
+
origin: tiers[i].manifest.id,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
46
66
|
}
|
|
47
67
|
// Validate per-type color references against the FINAL merged colors map.
|
|
48
68
|
// Running this only after all tiers fold avoids false positives when a parent
|
|
49
69
|
// tier references a color that a child tier supplies in its colors: block.
|
|
50
70
|
validateTypeColors(effective, diagnostics, tiers[tiers.length - 1].sourcePath);
|
|
71
|
+
validateTypeDisciplines(effective, diagnostics, tiers[tiers.length - 1].sourcePath);
|
|
72
|
+
// ADR-017 Slice 5: resolve disciplineMode AFTER the full chain has folded
|
|
73
|
+
// so inference sees the final type graph. The accumulator `declaredMode`
|
|
74
|
+
// (set above) carries the LWW-declared value across tiers.
|
|
75
|
+
effective = {
|
|
76
|
+
...effective,
|
|
77
|
+
disciplineMode: resolveDisciplineMode(effective, declaredMode),
|
|
78
|
+
};
|
|
51
79
|
// If any merge error was recorded, drop the effective profile.
|
|
52
80
|
const hasError = diagnostics.some((d) => d.severity === "error");
|
|
53
81
|
return hasError
|
|
@@ -68,6 +96,8 @@ function foldTier(base, tier, diagnostics) {
|
|
|
68
96
|
const attributes = unionAttrMap(base.attributes, m.universalAttributes, origin, diagnostics);
|
|
69
97
|
// Colors map: last-write-wins per key, additive across tiers.
|
|
70
98
|
const colors = unionColorsMap(base.colors, m.colors, origin);
|
|
99
|
+
// Kinds map: additive across tiers, child wins on description.
|
|
100
|
+
const kinds = unionKindsMap(base.kinds, m.kinds, origin);
|
|
71
101
|
// Types — add new types, fold existing ones.
|
|
72
102
|
const types = new Map(base.types);
|
|
73
103
|
for (const [name, td] of m.types) {
|
|
@@ -89,6 +119,7 @@ function foldTier(base, tier, diagnostics) {
|
|
|
89
119
|
description: { value: td.description, origin },
|
|
90
120
|
attrDescriptions: mapFromAttrDescriptions(td.attributes, origin),
|
|
91
121
|
relationDescriptions: mapFromTraceDescriptions(td.traceability, origin),
|
|
122
|
+
discipline: { value: td.discipline, origin },
|
|
92
123
|
};
|
|
93
124
|
types.set(name, { value: eff, origin });
|
|
94
125
|
}
|
|
@@ -109,6 +140,9 @@ function foldTier(base, tier, diagnostics) {
|
|
|
109
140
|
// Overlap handling deferred.
|
|
110
141
|
}
|
|
111
142
|
const frontMatter = unionAttrMap(base.documents.frontMatter, m.documents.frontMatter, origin, diagnostics);
|
|
143
|
+
// Prose lexicons: list-additive across tiers (profile-schema §5.1).
|
|
144
|
+
const capAllow = unionList(base.prose.lexicons["capitalized-allow"], m.prose.lexicons["capitalized-allow"], origin);
|
|
145
|
+
const sentAbbrev = unionList(base.prose.lexicons["sentence-abbrev"], m.prose.lexicons["sentence-abbrev"], origin);
|
|
112
146
|
const result = {
|
|
113
147
|
attributes,
|
|
114
148
|
labels,
|
|
@@ -119,6 +153,14 @@ function foldTier(base, tier, diagnostics) {
|
|
|
119
153
|
types: docTypes,
|
|
120
154
|
frontMatter,
|
|
121
155
|
},
|
|
156
|
+
kinds,
|
|
157
|
+
prose: {
|
|
158
|
+
lexicons: {
|
|
159
|
+
"capitalized-allow": capAllow,
|
|
160
|
+
"sentence-abbrev": sentAbbrev,
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
disciplineMode: { value: "none", origin: "inferred" },
|
|
122
164
|
};
|
|
123
165
|
return result;
|
|
124
166
|
}
|
|
@@ -166,6 +208,30 @@ function validateTypeColors(effective, diagnostics, fallbackFile) {
|
|
|
166
208
|
}
|
|
167
209
|
}
|
|
168
210
|
}
|
|
211
|
+
/**
|
|
212
|
+
* After the full chain folds, verify each type's `discipline.value` (when
|
|
213
|
+
* set) names a kind that is in the merged `effective.kinds` map ∪
|
|
214
|
+
* CORE_KINDS. Emits PROFILE-DISCIPLINE-004 for each violation. Runs after
|
|
215
|
+
* the merge because a parent tier's kind must be visible to a child
|
|
216
|
+
* tier's type.
|
|
217
|
+
*/
|
|
218
|
+
function validateTypeDisciplines(effective, diagnostics, fallbackFile) {
|
|
219
|
+
for (const [typeName, entry] of effective.types) {
|
|
220
|
+
const value = entry.value.discipline.value;
|
|
221
|
+
if (value === undefined)
|
|
222
|
+
continue;
|
|
223
|
+
if (CORE_KINDS.has(value))
|
|
224
|
+
continue;
|
|
225
|
+
if (effective.kinds.has(value))
|
|
226
|
+
continue;
|
|
227
|
+
diagnostics.push({
|
|
228
|
+
code: "PROFILE-DISCIPLINE-004",
|
|
229
|
+
severity: "error",
|
|
230
|
+
message: `type '${typeName}' references unknown discipline kind '${value}' (declare it under profile.kinds: in this profile or a parent)`,
|
|
231
|
+
location: { file: fallbackFile, line: 1, column: 1 },
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
}
|
|
169
235
|
/**
|
|
170
236
|
* Union of two string lists; parent entries first, child entries appended,
|
|
171
237
|
* duplicates dropped. Origin = child tier if anything was added, else parent.
|
|
@@ -320,6 +386,10 @@ function tightenType(existing, child, childOrigin, diagnostics) {
|
|
|
320
386
|
const description = child.description !== undefined
|
|
321
387
|
? { value: child.description, origin: childOrigin }
|
|
322
388
|
: effExisting.description;
|
|
389
|
+
// Discipline: child wins when set; otherwise parent stays.
|
|
390
|
+
const discipline = child.discipline !== undefined
|
|
391
|
+
? { value: child.discipline, origin: childOrigin }
|
|
392
|
+
: effExisting.discipline;
|
|
323
393
|
const attrDescriptions = mergeDescriptionMap(effExisting.attrDescriptions, child.attributes.map((a) => ({ name: a.name, desc: a.description })), childOrigin);
|
|
324
394
|
const relationDescriptions = mergeDescriptionMap(effExisting.relationDescriptions, [...child.traceability.entries()].map(([name, r]) => ({
|
|
325
395
|
name,
|
|
@@ -337,6 +407,7 @@ function tightenType(existing, child, childOrigin, diagnostics) {
|
|
|
337
407
|
description,
|
|
338
408
|
attrDescriptions,
|
|
339
409
|
relationDescriptions,
|
|
410
|
+
discipline,
|
|
340
411
|
};
|
|
341
412
|
const overrides = [
|
|
342
413
|
...(existing.overrides ?? []),
|
|
@@ -458,6 +529,20 @@ function seedFromTier(tier) {
|
|
|
458
529
|
types: mapFromDocTypes(m.documents.types, origin),
|
|
459
530
|
frontMatter: mapFromAttrList(m.documents.frontMatter, origin),
|
|
460
531
|
},
|
|
532
|
+
kinds: mapFromKinds(m.kinds, origin),
|
|
533
|
+
prose: {
|
|
534
|
+
lexicons: {
|
|
535
|
+
"capitalized-allow": {
|
|
536
|
+
value: m.prose.lexicons["capitalized-allow"],
|
|
537
|
+
origin,
|
|
538
|
+
},
|
|
539
|
+
"sentence-abbrev": {
|
|
540
|
+
value: m.prose.lexicons["sentence-abbrev"],
|
|
541
|
+
origin,
|
|
542
|
+
},
|
|
543
|
+
},
|
|
544
|
+
},
|
|
545
|
+
disciplineMode: { value: "none", origin: "inferred" },
|
|
461
546
|
};
|
|
462
547
|
}
|
|
463
548
|
function mapFromColors(colors, origin) {
|
|
@@ -467,6 +552,32 @@ function mapFromColors(colors, origin) {
|
|
|
467
552
|
}
|
|
468
553
|
return out;
|
|
469
554
|
}
|
|
555
|
+
/**
|
|
556
|
+
* Union of `kinds:` maps across tiers. Additive: every tier's kinds are
|
|
557
|
+
* carried. When two tiers declare the same kind, the child wins on
|
|
558
|
+
* description and `overrides` records the displaced parent.
|
|
559
|
+
*/
|
|
560
|
+
function unionKindsMap(parent, childKinds, childOrigin) {
|
|
561
|
+
if (childKinds.size === 0)
|
|
562
|
+
return parent;
|
|
563
|
+
const out = new Map(parent);
|
|
564
|
+
for (const [name, kd] of childKinds) {
|
|
565
|
+
const prior = out.get(name);
|
|
566
|
+
out.set(name, {
|
|
567
|
+
value: kd,
|
|
568
|
+
origin: childOrigin,
|
|
569
|
+
overrides: prior ? [...(prior.overrides ?? []), prior.origin] : undefined,
|
|
570
|
+
});
|
|
571
|
+
}
|
|
572
|
+
return out;
|
|
573
|
+
}
|
|
574
|
+
function mapFromKinds(kinds, origin) {
|
|
575
|
+
const out = new Map();
|
|
576
|
+
for (const [name, kd] of kinds) {
|
|
577
|
+
out.set(name, { value: kd, origin });
|
|
578
|
+
}
|
|
579
|
+
return out;
|
|
580
|
+
}
|
|
470
581
|
function mapFromLabelConcerns(concerns, origin) {
|
|
471
582
|
const out = new Map();
|
|
472
583
|
for (const c of concerns) {
|
|
@@ -604,6 +715,7 @@ function mapFromTypes(types, origin) {
|
|
|
604
715
|
description: { value: td.description, origin },
|
|
605
716
|
attrDescriptions: mapFromAttrDescriptions(td.attributes, origin),
|
|
606
717
|
relationDescriptions: mapFromTraceDescriptions(td.traceability, origin),
|
|
718
|
+
discipline: { value: td.discipline, origin },
|
|
607
719
|
};
|
|
608
720
|
out.set(name, { value: eff, origin });
|
|
609
721
|
}
|
package/esm/profile/mod.d.ts
CHANGED
|
@@ -17,6 +17,8 @@ export type { LoadProfileForCommandResult } from "./load.js";
|
|
|
17
17
|
export { mergeChain } from "./merge.js";
|
|
18
18
|
export type { MergeResult } from "./merge.js";
|
|
19
19
|
export { resolveEntryColor } from "./colors.js";
|
|
20
|
+
export { buildEffectiveDisciplineRegistry } from "./discipline_registry.js";
|
|
21
|
+
export { inferDisciplineMode, resolveDisciplineMode, } from "./discipline_mode.js";
|
|
20
22
|
export { buildProfileIntrospection } from "./introspect.js";
|
|
21
23
|
export type { AttributeDetail, ConventionDetail, LabelConcernDetail, ProfileElementDetail, ProfileElementKind, ProfileElementRef, ProfileIntrospection, ProfileOverview, ProvenancedDescription, RelationDetail, TypeDetail, } from "./introspect.js";
|
|
22
24
|
//# sourceMappingURL=mod.d.ts.map
|
package/esm/profile/mod.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/profile/mod.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,YAAY,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEzD,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAC3E,YAAY,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAE9E,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,iBAAiB,EACjB,aAAa,EACb,qBAAqB,GACtB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,MAAM,EACN,YAAY,GACb,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAEpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAClD,YAAY,EAAE,2BAA2B,EAAE,MAAM,WAAW,CAAC;AAE7D,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAO9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAC5D,YAAY,EACV,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,eAAe,EACf,sBAAsB,EACtB,cAAc,EACd,UAAU,GACX,MAAM,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/profile/mod.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,YAAY,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEzD,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAC3E,YAAY,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAE9E,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,iBAAiB,EACjB,aAAa,EACb,qBAAqB,GACtB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,MAAM,EACN,YAAY,GACb,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAEpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAClD,YAAY,EAAE,2BAA2B,EAAE,MAAM,WAAW,CAAC;AAE7D,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAO9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,EAAE,gCAAgC,EAAE,MAAM,0BAA0B,CAAC;AAE5E,OAAO,EACL,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAC5D,YAAY,EACV,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,eAAe,EACf,sBAAsB,EACtB,cAAc,EACd,UAAU,GACX,MAAM,iBAAiB,CAAC"}
|
package/esm/profile/mod.js
CHANGED
|
@@ -15,4 +15,6 @@ export { mergeChain } from "./merge.js";
|
|
|
15
15
|
// are not part of the public profile API and are not re-exported from
|
|
16
16
|
// core/mod.ts. Consumers use loadChain / loadProfileForCommand instead.
|
|
17
17
|
export { resolveEntryColor } from "./colors.js";
|
|
18
|
+
export { buildEffectiveDisciplineRegistry } from "./discipline_registry.js";
|
|
19
|
+
export { inferDisciplineMode, resolveDisciplineMode, } from "./discipline_mode.js";
|
|
18
20
|
export { buildProfileIntrospection } from "./introspect.js";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module core/sync/locked_attributes
|
|
3
|
+
*
|
|
4
|
+
* Infers which MarkSpec attributes are upstream-owned (locally read-only)
|
|
5
|
+
* for a single mapping. Reads only per-attribute direction + locked
|
|
6
|
+
* fields — the top-level system direction has already been baked into
|
|
7
|
+
* every per-attribute direction at parse time (see `parseMapping`), so
|
|
8
|
+
* this function does not need to consult it.
|
|
9
|
+
*
|
|
10
|
+
* Locking rule:
|
|
11
|
+
* - Per-attribute direction `outbound` → never locked
|
|
12
|
+
* - Per-attribute `locked: true` → locked
|
|
13
|
+
* - Per-attribute direction `inbound` → locked
|
|
14
|
+
* - Per-attribute direction `bidirectional` without `locked: true` → not locked
|
|
15
|
+
*/
|
|
16
|
+
import type { Mapping } from "./mapping.js";
|
|
17
|
+
/** The set of MarkSpec attribute names locked for this mapping. */
|
|
18
|
+
export declare function inferLockedAttributes(mapping: Mapping): Set<string>;
|
|
19
|
+
//# sourceMappingURL=locked_attributes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locked_attributes.d.ts","sourceRoot":"","sources":["../../src/sync/locked_attributes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C,mEAAmE;AACnE,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,CASnE"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module core/sync/locked_attributes
|
|
3
|
+
*
|
|
4
|
+
* Infers which MarkSpec attributes are upstream-owned (locally read-only)
|
|
5
|
+
* for a single mapping. Reads only per-attribute direction + locked
|
|
6
|
+
* fields — the top-level system direction has already been baked into
|
|
7
|
+
* every per-attribute direction at parse time (see `parseMapping`), so
|
|
8
|
+
* this function does not need to consult it.
|
|
9
|
+
*
|
|
10
|
+
* Locking rule:
|
|
11
|
+
* - Per-attribute direction `outbound` → never locked
|
|
12
|
+
* - Per-attribute `locked: true` → locked
|
|
13
|
+
* - Per-attribute direction `inbound` → locked
|
|
14
|
+
* - Per-attribute direction `bidirectional` without `locked: true` → not locked
|
|
15
|
+
*/
|
|
16
|
+
/** The set of MarkSpec attribute names locked for this mapping. */
|
|
17
|
+
export function inferLockedAttributes(mapping) {
|
|
18
|
+
const locked = new Set();
|
|
19
|
+
for (const a of mapping.attributes) {
|
|
20
|
+
if (a.direction === "outbound")
|
|
21
|
+
continue;
|
|
22
|
+
if (a.locked || a.direction === "inbound") {
|
|
23
|
+
locked.add(a.markspec);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return locked;
|
|
27
|
+
}
|