@driftsys/markspec 0.4.0 → 0.6.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/README.md +74 -20
- package/esm/ast/build.d.ts +60 -0
- package/esm/ast/build.d.ts.map +1 -0
- package/esm/ast/build.js +516 -0
- package/esm/ast/equivalence.d.ts +18 -0
- package/esm/ast/equivalence.d.ts.map +1 -0
- package/esm/ast/equivalence.js +56 -0
- package/esm/ast/nodes.d.ts +189 -0
- package/esm/ast/nodes.d.ts.map +1 -0
- package/esm/ast/nodes.js +17 -0
- package/esm/ast/normalize.d.ts +58 -0
- package/esm/ast/normalize.d.ts.map +1 -0
- package/esm/ast/normalize.js +197 -0
- package/esm/ast/render.d.ts +34 -0
- package/esm/ast/render.d.ts.map +1 -0
- package/esm/ast/render.js +215 -0
- 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 +2 -1
- package/esm/compiler/inverses.d.ts.map +1 -1
- package/esm/compiler/inverses.js +33 -14
- package/esm/compiler/manifest.d.ts +59 -0
- package/esm/compiler/manifest.d.ts.map +1 -0
- package/esm/compiler/manifest.js +48 -0
- package/esm/compiler/mod.d.ts +38 -1
- package/esm/compiler/mod.d.ts.map +1 -1
- package/esm/compiler/mod.js +202 -50
- package/esm/compiler/ndjson_writer.d.ts +50 -0
- package/esm/compiler/ndjson_writer.d.ts.map +1 -0
- package/esm/compiler/ndjson_writer.js +73 -0
- package/esm/compiler/schema.d.ts +33 -1
- package/esm/compiler/schema.d.ts.map +1 -1
- package/esm/compiler/schema.js +30 -9
- 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/config/mod.d.ts.map +1 -1
- package/esm/config/mod.js +54 -0
- package/esm/formatter/mod.d.ts +55 -4
- package/esm/formatter/mod.d.ts.map +1 -1
- package/esm/formatter/mod.js +423 -46
- package/esm/formatter/synth_ulid.d.ts +21 -0
- package/esm/formatter/synth_ulid.d.ts.map +1 -0
- package/esm/formatter/synth_ulid.js +64 -0
- 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 +14 -0
- package/esm/lint/mod.d.ts.map +1 -0
- package/esm/lint/mod.js +9 -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/lexicon.d.ts +24 -0
- package/esm/lint/rules/lexicon.d.ts.map +1 -0
- package/esm/lint/rules/lexicon.js +236 -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/struct.d.ts +17 -0
- package/esm/lint/rules/struct.d.ts.map +1 -0
- package/esm/lint/rules/struct.js +55 -0
- package/esm/lint/rules/suppression.d.ts +54 -0
- package/esm/lint/rules/suppression.d.ts.map +1 -0
- package/esm/lint/rules/suppression.js +129 -0
- 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 +59 -0
- package/esm/lint/runner.d.ts.map +1 -0
- package/esm/lint/runner.js +153 -0
- 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 +31 -0
- package/esm/lint/types.d.ts.map +1 -0
- package/esm/lint/types.js +9 -0
- 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 +28 -8
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +23 -4
- package/esm/model/attributes.d.ts +6 -0
- package/esm/model/attributes.d.ts.map +1 -1
- package/esm/model/attributes.js +200 -2
- 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/discriminating_attr.d.ts +33 -0
- package/esm/model/discriminating_attr.d.ts.map +1 -0
- package/esm/model/discriminating_attr.js +74 -0
- package/esm/model/mod.d.ts +267 -14
- package/esm/model/mod.d.ts.map +1 -1
- package/esm/model/mod.js +99 -3
- package/esm/model/profile.d.ts +102 -27
- package/esm/model/profile.d.ts.map +1 -1
- package/esm/model/source_introspection.d.ts +26 -0
- package/esm/model/source_introspection.d.ts.map +1 -0
- package/esm/model/source_introspection.js +77 -0
- package/esm/model/type_hierarchy.d.ts +51 -0
- package/esm/model/type_hierarchy.d.ts.map +1 -0
- package/esm/model/type_hierarchy.js +126 -0
- package/esm/model/uri_scheme_map.d.ts +21 -0
- package/esm/model/uri_scheme_map.d.ts.map +1 -0
- package/esm/model/uri_scheme_map.js +66 -0
- package/esm/parser/attributes.d.ts.map +1 -1
- package/esm/parser/attributes.js +10 -16
- 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 +51 -0
- package/esm/parser/glossary.d.ts.map +1 -0
- package/esm/parser/glossary.js +219 -0
- package/esm/parser/grammars.d.ts +5 -3
- package/esm/parser/grammars.d.ts.map +1 -1
- package/esm/parser/grammars.js +12 -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 +317 -25
- package/esm/parser/mod.d.ts +5 -0
- package/esm/parser/mod.d.ts.map +1 -1
- package/esm/parser/mod.js +31 -8
- package/esm/parser/source.d.ts +53 -2
- package/esm/parser/source.d.ts.map +1 -1
- package/esm/parser/source.js +158 -68
- 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 +32 -14
- package/esm/profile/colors.js +1 -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/introspect.d.ts +135 -0
- package/esm/profile/introspect.d.ts.map +1 -0
- package/esm/profile/introspect.js +378 -0
- package/esm/profile/load.d.ts +3 -1
- package/esm/profile/load.d.ts.map +1 -1
- package/esm/profile/load.js +91 -5
- package/esm/profile/manifest.d.ts.map +1 -1
- package/esm/profile/manifest.js +512 -90
- package/esm/profile/merge.d.ts.map +1 -1
- package/esm/profile/merge.js +251 -39
- package/esm/profile/mod.d.ts +4 -4
- package/esm/profile/mod.d.ts.map +1 -1
- package/esm/profile/mod.js +7 -2
- package/esm/reporter/mod.js +4 -4
- 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/fence.d.ts +30 -0
- package/esm/util/fence.d.ts.map +1 -0
- package/esm/util/fence.js +40 -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/attributes.d.ts +3 -3
- package/esm/validator/attributes.d.ts.map +1 -1
- package/esm/validator/attributes.js +1 -18
- package/esm/validator/body_blocks.d.ts +38 -0
- package/esm/validator/body_blocks.d.ts.map +1 -0
- package/esm/validator/body_blocks.js +218 -0
- package/esm/validator/caption_convention.d.ts +29 -0
- package/esm/validator/caption_convention.d.ts.map +1 -0
- package/esm/validator/caption_convention.js +58 -0
- package/esm/validator/captions.d.ts +22 -0
- package/esm/validator/captions.d.ts.map +1 -0
- package/esm/validator/captions.js +137 -0
- package/esm/validator/component_schemes.d.ts +73 -0
- package/esm/validator/component_schemes.d.ts.map +1 -0
- package/esm/validator/component_schemes.js +375 -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/feature_ac.d.ts +28 -0
- package/esm/validator/feature_ac.d.ts.map +1 -0
- package/esm/validator/feature_ac.js +102 -0
- package/esm/validator/listing.d.ts +42 -0
- package/esm/validator/listing.d.ts.map +1 -0
- package/esm/validator/listing.js +295 -0
- package/esm/validator/mod.d.ts +3 -1
- package/esm/validator/mod.d.ts.map +1 -1
- package/esm/validator/mod.js +275 -13
- package/esm/validator/modal_keywords.d.ts +25 -0
- package/esm/validator/modal_keywords.d.ts.map +1 -0
- package/esm/validator/modal_keywords.js +54 -0
- 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 +29 -0
- package/esm/validator/per_type_attrs.d.ts.map +1 -0
- package/esm/validator/per_type_attrs.js +75 -0
- package/esm/validator/pipeline.d.ts +18 -2
- package/esm/validator/pipeline.d.ts.map +1 -1
- package/esm/validator/pipeline.js +76 -21
- package/esm/validator/trace_types.d.ts +26 -0
- package/esm/validator/trace_types.d.ts.map +1 -0
- package/esm/validator/trace_types.js +232 -0
- package/esm/validator/traceability.d.ts +3 -4
- package/esm/validator/traceability.d.ts.map +1 -1
- package/esm/validator/traceability.js +5 -10
- package/esm/validator/type_resolution.d.ts +67 -0
- package/esm/validator/type_resolution.d.ts.map +1 -0
- package/esm/validator/type_resolution.js +162 -0
- package/esm/validator/types.d.ts +45 -0
- package/esm/validator/types.d.ts.map +1 -1
- package/esm/validator/types.js +128 -16
- package/esm/validator/value_types.d.ts +8 -0
- package/esm/validator/value_types.d.ts.map +1 -1
- package/esm/validator/value_types.js +8 -1
- package/package.json +2 -2
- package/script/ast/build.d.ts +60 -0
- package/script/ast/build.d.ts.map +1 -0
- package/script/ast/build.js +521 -0
- package/script/ast/equivalence.d.ts +18 -0
- package/script/ast/equivalence.d.ts.map +1 -0
- package/script/ast/equivalence.js +59 -0
- package/script/ast/nodes.d.ts +189 -0
- package/script/ast/nodes.d.ts.map +1 -0
- package/script/ast/nodes.js +18 -0
- package/script/ast/normalize.d.ts +58 -0
- package/script/ast/normalize.d.ts.map +1 -0
- package/script/ast/normalize.js +200 -0
- package/script/ast/render.d.ts +34 -0
- package/script/ast/render.d.ts.map +1 -0
- package/script/ast/render.js +218 -0
- 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 +2 -1
- package/script/compiler/inverses.d.ts.map +1 -1
- package/script/compiler/inverses.js +33 -14
- package/script/compiler/manifest.d.ts +59 -0
- package/script/compiler/manifest.d.ts.map +1 -0
- package/script/compiler/manifest.js +51 -0
- package/script/compiler/mod.d.ts +38 -1
- package/script/compiler/mod.d.ts.map +1 -1
- package/script/compiler/mod.js +206 -54
- package/script/compiler/ndjson_writer.d.ts +50 -0
- package/script/compiler/ndjson_writer.d.ts.map +1 -0
- package/script/compiler/ndjson_writer.js +78 -0
- package/script/compiler/schema.d.ts +33 -1
- package/script/compiler/schema.d.ts.map +1 -1
- package/script/compiler/schema.js +30 -8
- 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/config/mod.d.ts.map +1 -1
- package/script/config/mod.js +54 -0
- package/script/formatter/mod.d.ts +55 -4
- package/script/formatter/mod.d.ts.map +1 -1
- package/script/formatter/mod.js +426 -46
- package/script/formatter/synth_ulid.d.ts +21 -0
- package/script/formatter/synth_ulid.d.ts.map +1 -0
- package/script/formatter/synth_ulid.js +67 -0
- 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 +14 -0
- package/script/lint/mod.d.ts.map +1 -0
- package/script/lint/mod.js +17 -0
- 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/lexicon.d.ts +24 -0
- package/script/lint/rules/lexicon.d.ts.map +1 -0
- package/script/lint/rules/lexicon.js +240 -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/struct.d.ts +17 -0
- package/script/lint/rules/struct.d.ts.map +1 -0
- package/script/lint/rules/struct.js +59 -0
- package/script/lint/rules/suppression.d.ts +54 -0
- package/script/lint/rules/suppression.d.ts.map +1 -0
- package/script/lint/rules/suppression.js +136 -0
- 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 +59 -0
- package/script/lint/runner.d.ts.map +1 -0
- package/script/lint/runner.js +157 -0
- 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 +31 -0
- package/script/lint/types.d.ts.map +1 -0
- package/script/lint/types.js +10 -0
- 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 +28 -8
- package/script/mod.d.ts.map +1 -1
- package/script/mod.js +129 -32
- package/script/model/attributes.d.ts +6 -0
- package/script/model/attributes.d.ts.map +1 -1
- package/script/model/attributes.js +201 -3
- 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/discriminating_attr.d.ts +33 -0
- package/script/model/discriminating_attr.d.ts.map +1 -0
- package/script/model/discriminating_attr.js +77 -0
- package/script/model/mod.d.ts +267 -14
- package/script/model/mod.d.ts.map +1 -1
- package/script/model/mod.js +111 -3
- package/script/model/profile.d.ts +102 -27
- package/script/model/profile.d.ts.map +1 -1
- package/script/model/source_introspection.d.ts +26 -0
- package/script/model/source_introspection.d.ts.map +1 -0
- package/script/model/source_introspection.js +80 -0
- package/script/model/type_hierarchy.d.ts +51 -0
- package/script/model/type_hierarchy.d.ts.map +1 -0
- package/script/model/type_hierarchy.js +130 -0
- package/script/model/uri_scheme_map.d.ts +21 -0
- package/script/model/uri_scheme_map.d.ts.map +1 -0
- package/script/model/uri_scheme_map.js +69 -0
- package/script/parser/attributes.d.ts.map +1 -1
- package/script/parser/attributes.js +10 -16
- 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 +51 -0
- package/script/parser/glossary.d.ts.map +1 -0
- package/script/parser/glossary.js +224 -0
- package/script/parser/grammars.d.ts +5 -3
- package/script/parser/grammars.d.ts.map +1 -1
- package/script/parser/grammars.js +15 -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 +315 -23
- package/script/parser/mod.d.ts +5 -0
- package/script/parser/mod.d.ts.map +1 -1
- package/script/parser/mod.js +36 -7
- package/script/parser/source.d.ts +53 -2
- package/script/parser/source.d.ts.map +1 -1
- package/script/parser/source.js +159 -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 +32 -14
- package/script/profile/colors.js +1 -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/introspect.d.ts +135 -0
- package/script/profile/introspect.d.ts.map +1 -0
- package/script/profile/introspect.js +381 -0
- package/script/profile/load.d.ts +3 -1
- package/script/profile/load.d.ts.map +1 -1
- package/script/profile/load.js +91 -5
- package/script/profile/manifest.d.ts.map +1 -1
- package/script/profile/manifest.js +511 -89
- package/script/profile/merge.d.ts.map +1 -1
- package/script/profile/merge.js +251 -39
- package/script/profile/mod.d.ts +4 -4
- package/script/profile/mod.d.ts.map +1 -1
- package/script/profile/mod.js +12 -6
- package/script/reporter/mod.js +4 -4
- 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/fence.d.ts +30 -0
- package/script/util/fence.d.ts.map +1 -0
- package/script/util/fence.js +44 -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/attributes.d.ts +3 -3
- package/script/validator/attributes.d.ts.map +1 -1
- package/script/validator/attributes.js +1 -18
- package/script/validator/body_blocks.d.ts +38 -0
- package/script/validator/body_blocks.d.ts.map +1 -0
- package/script/validator/body_blocks.js +221 -0
- package/script/validator/caption_convention.d.ts +29 -0
- package/script/validator/caption_convention.d.ts.map +1 -0
- package/script/validator/caption_convention.js +61 -0
- package/script/validator/captions.d.ts +22 -0
- package/script/validator/captions.d.ts.map +1 -0
- package/script/validator/captions.js +140 -0
- package/script/validator/component_schemes.d.ts +73 -0
- package/script/validator/component_schemes.d.ts.map +1 -0
- package/script/validator/component_schemes.js +384 -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/feature_ac.d.ts +28 -0
- package/script/validator/feature_ac.d.ts.map +1 -0
- package/script/validator/feature_ac.js +105 -0
- package/script/validator/listing.d.ts +42 -0
- package/script/validator/listing.d.ts.map +1 -0
- package/script/validator/listing.js +298 -0
- package/script/validator/mod.d.ts +3 -1
- package/script/validator/mod.d.ts.map +1 -1
- package/script/validator/mod.js +278 -14
- package/script/validator/modal_keywords.d.ts +25 -0
- package/script/validator/modal_keywords.d.ts.map +1 -0
- package/script/validator/modal_keywords.js +57 -0
- 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 +29 -0
- package/script/validator/per_type_attrs.d.ts.map +1 -0
- package/script/validator/per_type_attrs.js +78 -0
- package/script/validator/pipeline.d.ts +18 -2
- package/script/validator/pipeline.d.ts.map +1 -1
- package/script/validator/pipeline.js +78 -22
- package/script/validator/trace_types.d.ts +26 -0
- package/script/validator/trace_types.d.ts.map +1 -0
- package/script/validator/trace_types.js +235 -0
- package/script/validator/traceability.d.ts +3 -4
- package/script/validator/traceability.d.ts.map +1 -1
- package/script/validator/traceability.js +5 -10
- package/script/validator/type_resolution.d.ts +67 -0
- package/script/validator/type_resolution.d.ts.map +1 -0
- package/script/validator/type_resolution.js +168 -0
- package/script/validator/types.d.ts +45 -0
- package/script/validator/types.d.ts.map +1 -1
- package/script/validator/types.js +131 -16
- package/script/validator/value_types.d.ts +8 -0
- package/script/validator/value_types.d.ts.map +1 -1
- package/script/validator/value_types.js +10 -2
package/esm/validator/mod.d.ts
CHANGED
|
@@ -30,8 +30,10 @@ export interface ValidateResult {
|
|
|
30
30
|
export declare function validate(entries: readonly Entry[]): ValidateResult;
|
|
31
31
|
export declare function indexByDisplayId(entries: readonly Entry[]): ReadonlyMap<string, Entry>;
|
|
32
32
|
export declare function findAttr(attrs: readonly Attribute[], key: string): Attribute | undefined;
|
|
33
|
-
export { runPipeline } from "./pipeline.js";
|
|
33
|
+
export { runPipeline, suppressDeclaredAttrR010 } from "./pipeline.js";
|
|
34
34
|
export type { PipelineResult } from "./pipeline.js";
|
|
35
|
+
export { validateListingDocuments } from "./listing.js";
|
|
36
|
+
export type { ListingFileContext, ListingKind } from "./listing.js";
|
|
35
37
|
export { classifyEntriesStage, classifyEntry } from "./types.js";
|
|
36
38
|
export type { ClassifyResult, ClassifyStageResult } from "./types.js";
|
|
37
39
|
export { compileDisplayIdPattern } from "./pattern.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/validator/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/validator/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAqCpE,mCAAmC;AACnC,MAAM,WAAW,cAAc;IAC7B,2CAA2C;IAC3C,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;IAC5C,gDAAgD;IAChD,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,SAAS,KAAK,EAAE,GAAG,cAAc,CAclE;AA2aD,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,SAAS,KAAK,EAAE,GACxB,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,CAM5B;AAGD,wBAAgB,QAAQ,CACtB,KAAK,EAAE,SAAS,SAAS,EAAE,EAC3B,GAAG,EAAE,MAAM,GACV,SAAS,GAAG,SAAS,CAEvB;AAED,OAAO,EAAE,WAAW,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AACtE,YAAY,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEpD,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AACxD,YAAY,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEpE,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AACjE,YAAY,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAEvD,OAAO,EAAE,cAAc,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAC7E,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE1D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAErD,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,4BAA4B,GAC7B,MAAM,mBAAmB,CAAC"}
|
package/esm/validator/mod.js
CHANGED
|
@@ -13,9 +13,30 @@
|
|
|
13
13
|
* constraints, enum vocabularies) are profile-declared and evaluated by
|
|
14
14
|
* a profile-aware validator layer (not in the core).
|
|
15
15
|
*/
|
|
16
|
-
import { IDENTITY_KEY, ULID_RE, UNIVERSAL_ATTRIBUTE_KEYS, URI_SCHEME_RE, } from "../model/mod.js";
|
|
16
|
+
import { attributeSpec, CORE_TYPE_SCOPED_ATTRS, CSV_SPLITTABLE_TYPES, IDENTITY_KEY, ULID_RE, UNIVERSAL_ATTRIBUTE_KEYS, URI_SCHEME_RE, } from "../model/mod.js";
|
|
17
|
+
import { HTTP_URL_RE } from "./value_types.js";
|
|
18
|
+
import { validateTypl } from "../typl/mod.js";
|
|
17
19
|
/** Universal attribute keys the core recognizes. */
|
|
18
20
|
const UNIVERSAL_KEYS = new Set(UNIVERSAL_ATTRIBUTE_KEYS);
|
|
21
|
+
/**
|
|
22
|
+
* Value-type set that's repeatable per spec §1.8 — these attributes
|
|
23
|
+
* accept multiple lines for distinct values, so multiple trailers with
|
|
24
|
+
* the same key are legal. Single-cardinality attributes are anything
|
|
25
|
+
* not in this set.
|
|
26
|
+
*/
|
|
27
|
+
const REPEATABLE_VALUE_TYPES = new Set([
|
|
28
|
+
"id-list",
|
|
29
|
+
"tag-list",
|
|
30
|
+
"citation",
|
|
31
|
+
"external-id",
|
|
32
|
+
]);
|
|
33
|
+
/**
|
|
34
|
+
* Slug pattern for Reference-shape display IDs (spec §1.7, ADR-002 §Part 3).
|
|
35
|
+
* Pandoc/BibTeX cite-key convention, restricted to a portable character
|
|
36
|
+
* set: starts with a letter, body alphanumeric + `.` / `/` / `-` / `_`,
|
|
37
|
+
* ends with an alphanumeric.
|
|
38
|
+
*/
|
|
39
|
+
const REFERENCE_SLUG_RE = /^[A-Za-z]([A-Za-z0-9._/-]*[A-Za-z0-9])?$/;
|
|
19
40
|
/**
|
|
20
41
|
* Validate a set of parsed entries for structural correctness and
|
|
21
42
|
* cross-reference integrity.
|
|
@@ -26,6 +47,11 @@ export function validate(entries) {
|
|
|
26
47
|
const diagnostics = [];
|
|
27
48
|
checkStructural(entries, diagnostics);
|
|
28
49
|
checkReferences(entries, diagnostics);
|
|
50
|
+
// Typl cross-entry collisions (TYPL-002/003) and undefined-typedef-refs
|
|
51
|
+
// (TYPL-005). Per-block diagnostics (TYPL-001/004/006/007/008) already
|
|
52
|
+
// fired during parse via the bridge.
|
|
53
|
+
const typlResult = validateTypl(entries);
|
|
54
|
+
diagnostics.push(...typlResult.diagnostics);
|
|
29
55
|
const valid = !diagnostics.some((d) => d.severity === "error");
|
|
30
56
|
return { diagnostics, valid };
|
|
31
57
|
}
|
|
@@ -35,6 +61,8 @@ function checkStructural(entries, diagnostics) {
|
|
|
35
61
|
const ids = new Map();
|
|
36
62
|
for (const entry of entries) {
|
|
37
63
|
// MSL-R003: exactly one `Id:` attribute per entry.
|
|
64
|
+
// Dual-emit: MSL-I002 (Reference missing Id), MSL-I003 (Authored missing
|
|
65
|
+
// Id), MSL-I004 (multiple Id) — nextgen §4.2 codes alongside legacy.
|
|
38
66
|
const idAttrs = entry.rawAttributes.filter((a) => a.key === IDENTITY_KEY);
|
|
39
67
|
if (idAttrs.length === 0) {
|
|
40
68
|
diagnostics.push({
|
|
@@ -43,6 +71,25 @@ function checkStructural(entries, diagnostics) {
|
|
|
43
71
|
message: `${entry.displayId}: missing Id: attribute`,
|
|
44
72
|
location: entry.location,
|
|
45
73
|
});
|
|
74
|
+
// Dual-emit: shape-specific nextgen code
|
|
75
|
+
if (entry.shape === "Reference") {
|
|
76
|
+
diagnostics.push({
|
|
77
|
+
code: "MSL-I002",
|
|
78
|
+
severity: "error",
|
|
79
|
+
message: `${entry.displayId}: Reference-shape entry without Id: ` +
|
|
80
|
+
`fmt cannot mint URIs (spec section 4.2)`,
|
|
81
|
+
location: entry.location,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
diagnostics.push({
|
|
86
|
+
code: "MSL-I003",
|
|
87
|
+
severity: "error",
|
|
88
|
+
message: `${entry.displayId}: Authored-shape entry without Id: ` +
|
|
89
|
+
`run fmt to mint a ULID (spec section 4.2)`,
|
|
90
|
+
location: entry.location,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
46
93
|
}
|
|
47
94
|
else if (idAttrs.length > 1) {
|
|
48
95
|
diagnostics.push({
|
|
@@ -51,8 +98,17 @@ function checkStructural(entries, diagnostics) {
|
|
|
51
98
|
message: `${entry.displayId}: multiple Id: attributes (${idAttrs.length}) — exactly one is required`,
|
|
52
99
|
location: entry.location,
|
|
53
100
|
});
|
|
101
|
+
// Dual-emit: MSL-I004
|
|
102
|
+
diagnostics.push({
|
|
103
|
+
code: "MSL-I004",
|
|
104
|
+
severity: "error",
|
|
105
|
+
message: `${entry.displayId}: multiple Id: trailers ` +
|
|
106
|
+
`(${idAttrs.length}) on the same entry (spec section 4.2)`,
|
|
107
|
+
location: entry.location,
|
|
108
|
+
});
|
|
54
109
|
}
|
|
55
110
|
// MSL-R004: `Id:` value must be a ULID or a scheme-qualified URI.
|
|
111
|
+
// Dual-emit: MSL-I001 — nextgen §4.2 code alongside legacy.
|
|
56
112
|
if (idAttrs.length > 0) {
|
|
57
113
|
const value = idAttrs[0].value;
|
|
58
114
|
const isUlid = ULID_RE.test(value);
|
|
@@ -64,9 +120,16 @@ function checkStructural(entries, diagnostics) {
|
|
|
64
120
|
message: `${entry.displayId}: Id: value '${value}' is neither a bare ULID nor a scheme-qualified URI`,
|
|
65
121
|
location: entry.location,
|
|
66
122
|
});
|
|
123
|
+
diagnostics.push({
|
|
124
|
+
code: "MSL-I001",
|
|
125
|
+
severity: "error",
|
|
126
|
+
message: `${entry.displayId}: Id: value '${value}' is neither a ULID ` +
|
|
127
|
+
`(^[0-9A-HJKMNP-TV-Z]{26}$) nor an RFC 3986 URI (spec section 4.2)`,
|
|
128
|
+
location: entry.location,
|
|
129
|
+
});
|
|
67
130
|
}
|
|
68
131
|
// Shape consistency: ULID ↔ identified, URI ↔ referenced.
|
|
69
|
-
if (isUlid && entry.shape !== "
|
|
132
|
+
if (isUlid && entry.shape !== "Authored") {
|
|
70
133
|
diagnostics.push({
|
|
71
134
|
code: "MSL-R004",
|
|
72
135
|
severity: "error",
|
|
@@ -74,7 +137,7 @@ function checkStructural(entries, diagnostics) {
|
|
|
74
137
|
location: entry.location,
|
|
75
138
|
});
|
|
76
139
|
}
|
|
77
|
-
else if (isUri && entry.shape !== "
|
|
140
|
+
else if (isUri && entry.shape !== "Reference") {
|
|
78
141
|
diagnostics.push({
|
|
79
142
|
code: "MSL-R004",
|
|
80
143
|
severity: "error",
|
|
@@ -83,7 +146,21 @@ function checkStructural(entries, diagnostics) {
|
|
|
83
146
|
});
|
|
84
147
|
}
|
|
85
148
|
}
|
|
149
|
+
// MSL-I006: Reference-shape display ID must match the slug pattern
|
|
150
|
+
// (spec §1.7, ADR-002 §Part 3). Authored entries have a free-form
|
|
151
|
+
// display ID at core level (tightened by profile patterns).
|
|
152
|
+
if (entry.shape === "Reference" && !REFERENCE_SLUG_RE.test(entry.displayId)) {
|
|
153
|
+
diagnostics.push({
|
|
154
|
+
code: "MSL-I006",
|
|
155
|
+
severity: "error",
|
|
156
|
+
message: `${entry.displayId}: Reference-shape display ID does not ` +
|
|
157
|
+
`match the slug pattern (spec §1.7); expected ` +
|
|
158
|
+
`^[A-Za-z]([A-Za-z0-9._/-]*[A-Za-z0-9])?$`,
|
|
159
|
+
location: entry.location,
|
|
160
|
+
});
|
|
161
|
+
}
|
|
86
162
|
// MSL-R006: Display ID unique across all entries.
|
|
163
|
+
// Dual-emit: MSL-I008 (warning) — nextgen §4.2.
|
|
87
164
|
const existingDisplay = displayIds.get(entry.displayId);
|
|
88
165
|
if (existingDisplay) {
|
|
89
166
|
diagnostics.push({
|
|
@@ -92,11 +169,21 @@ function checkStructural(entries, diagnostics) {
|
|
|
92
169
|
message: `duplicate display ID '${entry.displayId}' (also at ${existingDisplay.location.file}:${existingDisplay.location.line})`,
|
|
93
170
|
location: entry.location,
|
|
94
171
|
});
|
|
172
|
+
diagnostics.push({
|
|
173
|
+
code: "MSL-I008",
|
|
174
|
+
severity: "warning",
|
|
175
|
+
message: `duplicate display ID '${entry.displayId}' within the same ` +
|
|
176
|
+
`shape (also at ${existingDisplay.location.file}:` +
|
|
177
|
+
`${existingDisplay.location.line}) -- cross-references resolve ` +
|
|
178
|
+
`by Id:, so this is style-only (spec section 4.2)`,
|
|
179
|
+
location: entry.location,
|
|
180
|
+
});
|
|
95
181
|
}
|
|
96
182
|
else {
|
|
97
183
|
displayIds.set(entry.displayId, entry);
|
|
98
184
|
}
|
|
99
185
|
// MSL-R005: identity value unique across all entries.
|
|
186
|
+
// Dual-emit: MSL-I007 — nextgen §4.2.
|
|
100
187
|
if (entry.id) {
|
|
101
188
|
const existingId = ids.get(entry.id);
|
|
102
189
|
if (existingId) {
|
|
@@ -106,17 +193,174 @@ function checkStructural(entries, diagnostics) {
|
|
|
106
193
|
message: `duplicate Id '${entry.id}' (also at ${existingId.location.file}:${existingId.location.line})`,
|
|
107
194
|
location: entry.location,
|
|
108
195
|
});
|
|
196
|
+
diagnostics.push({
|
|
197
|
+
code: "MSL-I007",
|
|
198
|
+
severity: "error",
|
|
199
|
+
message: `duplicate Id: value '${entry.id}' across the project (also ` +
|
|
200
|
+
`at ${existingId.location.file}:${existingId.location.line}) ` +
|
|
201
|
+
`(spec section 4.2)`,
|
|
202
|
+
location: entry.location,
|
|
203
|
+
});
|
|
109
204
|
}
|
|
110
205
|
else {
|
|
111
206
|
ids.set(entry.id, entry);
|
|
112
207
|
}
|
|
113
208
|
}
|
|
114
|
-
// MSL-
|
|
115
|
-
//
|
|
116
|
-
//
|
|
117
|
-
//
|
|
209
|
+
// MSL-P010 — entry title is empty after trimming. The parser
|
|
210
|
+
// accepts an empty title for shape stability (`[REQ-001]` with
|
|
211
|
+
// nothing after) but the canonical form per spec §4.2 requires a
|
|
212
|
+
// non-empty human-readable title. Fires regardless of shape.
|
|
213
|
+
if (entry.title.trim().length === 0) {
|
|
214
|
+
diagnostics.push({
|
|
215
|
+
code: "MSL-P010",
|
|
216
|
+
severity: "error",
|
|
217
|
+
message: `${entry.displayId}: title is empty after trimming ` +
|
|
218
|
+
`(spec §4.2); add a non-empty human-readable title after ']'`,
|
|
219
|
+
location: entry.location,
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
// MSL-A011 — `citation`-typed attribute (References:) used CSV
|
|
223
|
+
// form. The canonical form is multi-line per spec §2.3.2: locators
|
|
224
|
+
// may contain commas (e.g. `[@iso26262, p. 42]`), so the parser
|
|
225
|
+
// never CSV-splits citation values. Detection scans for a `,` at
|
|
226
|
+
// bracket-depth zero — commas inside `[…]` are locators and OK.
|
|
227
|
+
for (const attr of entry.rawAttributes) {
|
|
228
|
+
const spec = attributeSpec(attr.key);
|
|
229
|
+
if (spec?.type !== "citation")
|
|
230
|
+
continue;
|
|
231
|
+
let depth = 0;
|
|
232
|
+
let sawTopLevelComma = false;
|
|
233
|
+
for (const ch of attr.value) {
|
|
234
|
+
if (ch === "[")
|
|
235
|
+
depth++;
|
|
236
|
+
else if (ch === "]" && depth > 0)
|
|
237
|
+
depth--;
|
|
238
|
+
else if (ch === "," && depth === 0) {
|
|
239
|
+
sawTopLevelComma = true;
|
|
240
|
+
break;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
if (sawTopLevelComma) {
|
|
244
|
+
diagnostics.push({
|
|
245
|
+
code: "MSL-A011",
|
|
246
|
+
severity: "error",
|
|
247
|
+
message: `${entry.displayId}: '${attr.key}' is citation-typed and ` +
|
|
248
|
+
`must use multi-line form (spec §2.3.2); CSV is rejected because ` +
|
|
249
|
+
`Pandoc locators may contain commas`,
|
|
250
|
+
location: entry.location,
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
// MSL-A012 — repeatable attribute value list is empty (spec §1.8).
|
|
255
|
+
// Fires when an authored repeatable attribute (id-list, tag-list,
|
|
256
|
+
// citation, external-id) carries no non-empty values after trimming
|
|
257
|
+
// and CSV splitting. `citation` is not CSV-splittable, so its check
|
|
258
|
+
// is a plain trim-and-empty test.
|
|
118
259
|
for (const attr of entry.rawAttributes) {
|
|
119
|
-
|
|
260
|
+
const spec = attributeSpec(attr.key);
|
|
261
|
+
if (!spec)
|
|
262
|
+
continue;
|
|
263
|
+
if (!REPEATABLE_VALUE_TYPES.has(spec.type))
|
|
264
|
+
continue;
|
|
265
|
+
const raw = attr.value;
|
|
266
|
+
const isCitation = spec.type === "citation";
|
|
267
|
+
const values = isCitation
|
|
268
|
+
? [raw.trim()].filter((s) => s.length > 0)
|
|
269
|
+
: raw.split(",").map((s) => s.trim()).filter((s) => s.length > 0);
|
|
270
|
+
if (values.length === 0) {
|
|
271
|
+
diagnostics.push({
|
|
272
|
+
code: "MSL-A012",
|
|
273
|
+
severity: "error",
|
|
274
|
+
message: `${entry.displayId}: '${attr.key}' is a repeatable ` +
|
|
275
|
+
`attribute but the value list is empty (spec §1.8)`,
|
|
276
|
+
location: entry.location,
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
// MSL-A013 — single-cardinality core attribute used more than once.
|
|
281
|
+
// `Id:` is excluded because MSL-R003 (above) reports its duplicates
|
|
282
|
+
// with a more specific message. Profile-declared attribute
|
|
283
|
+
// cardinality is enforced by the profile-aware Stage 3 (MSL-A002).
|
|
284
|
+
const seenSingleKeys = new Set();
|
|
285
|
+
const reportedA013 = new Set();
|
|
286
|
+
for (const attr of entry.rawAttributes) {
|
|
287
|
+
if (attr.key === IDENTITY_KEY)
|
|
288
|
+
continue;
|
|
289
|
+
const spec = attributeSpec(attr.key);
|
|
290
|
+
if (!spec)
|
|
291
|
+
continue;
|
|
292
|
+
if (REPEATABLE_VALUE_TYPES.has(spec.type))
|
|
293
|
+
continue;
|
|
294
|
+
if (seenSingleKeys.has(attr.key)) {
|
|
295
|
+
if (!reportedA013.has(attr.key)) {
|
|
296
|
+
diagnostics.push({
|
|
297
|
+
code: "MSL-A013",
|
|
298
|
+
severity: "error",
|
|
299
|
+
message: `${entry.displayId}: '${attr.key}' is single-cardinality ` +
|
|
300
|
+
`but appears more than once (spec §1.8)`,
|
|
301
|
+
location: entry.location,
|
|
302
|
+
});
|
|
303
|
+
reportedA013.add(attr.key);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
else {
|
|
307
|
+
seenSingleKeys.add(attr.key);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
// MSL-A030 / MSL-A050 / MSL-R010 checks per attribute
|
|
311
|
+
// (§4.4 / §4.8 / spec §1.5).
|
|
312
|
+
for (const attr of entry.rawAttributes) {
|
|
313
|
+
// MSL-A030: generated-origin attributes must not appear in source.
|
|
314
|
+
const spec = attributeSpec(attr.key);
|
|
315
|
+
if (spec?.origin === "generated") {
|
|
316
|
+
diagnostics.push({
|
|
317
|
+
code: "MSL-A030",
|
|
318
|
+
severity: "error",
|
|
319
|
+
message: `${entry.displayId}: '${attr.key}' has generated origin and must not appear in source (computed at build time per ADR-003 §Part 3)`,
|
|
320
|
+
location: entry.location,
|
|
321
|
+
});
|
|
322
|
+
continue;
|
|
323
|
+
}
|
|
324
|
+
// MSL-A050: value does not parse against the declared value type
|
|
325
|
+
// (§4.4). The core knows the value type for the promoted Reference
|
|
326
|
+
// attributes (spec §1.5) and the universal enum attributes;
|
|
327
|
+
// profile-declared attribute types are validated by the
|
|
328
|
+
// profile-aware Stage 3 instead.
|
|
329
|
+
if (attr.key === "Reference-url") {
|
|
330
|
+
if (!HTTP_URL_RE.test(attr.value.trim())) {
|
|
331
|
+
diagnostics.push({
|
|
332
|
+
code: "MSL-A050",
|
|
333
|
+
severity: "error",
|
|
334
|
+
message: `${entry.displayId}: Reference-url value ` +
|
|
335
|
+
`'${attr.value.trim()}' is not an http(s) URL (spec §1.5)`,
|
|
336
|
+
location: entry.location,
|
|
337
|
+
});
|
|
338
|
+
continue;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
if (spec?.type === "enum" && spec.enumValues) {
|
|
342
|
+
const trimmed = attr.value.trim();
|
|
343
|
+
if (trimmed.length > 0 && !spec.enumValues.includes(trimmed)) {
|
|
344
|
+
diagnostics.push({
|
|
345
|
+
code: "MSL-A050",
|
|
346
|
+
severity: "error",
|
|
347
|
+
message: `${entry.displayId}: ${attr.key} value '${trimmed}' ` +
|
|
348
|
+
`is not in the allowed set ` +
|
|
349
|
+
`{${spec.enumValues.join(", ")}} (spec §1.8 enum)`,
|
|
350
|
+
location: entry.location,
|
|
351
|
+
});
|
|
352
|
+
continue;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
// MSL-R010: Unknown attributes are warnings in the core. A
|
|
356
|
+
// profile-aware validator widens this check to include profile-declared
|
|
357
|
+
// attributes; until then, anything outside the universal set is
|
|
358
|
+
// unrecognized. Core-typed attributes (per ADR-003 §Part 2) are
|
|
359
|
+
// suppressed here — the per-type validator emits a more specific
|
|
360
|
+
// MSL-T022 when they appear on the "wrong" type.
|
|
361
|
+
if (!UNIVERSAL_KEYS.has(attr.key) &&
|
|
362
|
+
attr.key !== "Type" &&
|
|
363
|
+
!CORE_TYPE_SCOPED_ATTRS.has(attr.key)) {
|
|
120
364
|
diagnostics.push({
|
|
121
365
|
code: "MSL-R010",
|
|
122
366
|
severity: "warning",
|
|
@@ -124,6 +368,21 @@ function checkStructural(entries, diagnostics) {
|
|
|
124
368
|
location: entry.location,
|
|
125
369
|
});
|
|
126
370
|
}
|
|
371
|
+
// MSL-A006: empty element in CSV attribute value (e.g. "A,,B").
|
|
372
|
+
const csvSpec = attributeSpec(attr.key);
|
|
373
|
+
if (csvSpec && CSV_SPLITTABLE_TYPES.has(csvSpec.type) &&
|
|
374
|
+
attr.value.includes(",")) {
|
|
375
|
+
const parts = attr.value.split(",").map((s) => s.trim());
|
|
376
|
+
const emptyCount = parts.filter((s) => s.length === 0).length;
|
|
377
|
+
if (emptyCount > 0) {
|
|
378
|
+
diagnostics.push({
|
|
379
|
+
code: "MSL-A006",
|
|
380
|
+
severity: "warning",
|
|
381
|
+
message: `${entry.displayId}: attribute '${attr.key}' contains ${emptyCount} empty element(s) in CSV value "${attr.value}"`,
|
|
382
|
+
location: entry.location,
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
}
|
|
127
386
|
}
|
|
128
387
|
}
|
|
129
388
|
}
|
|
@@ -180,11 +439,13 @@ function checkReferences(entries, diagnostics) {
|
|
|
180
439
|
});
|
|
181
440
|
continue;
|
|
182
441
|
}
|
|
183
|
-
if (resolved.shape !== "
|
|
442
|
+
if (resolved.shape !== "Reference") {
|
|
184
443
|
diagnostics.push({
|
|
185
|
-
code: "MSL-
|
|
186
|
-
severity: "
|
|
187
|
-
message: `${entry.displayId}: References: target '${slug}'
|
|
444
|
+
code: "MSL-R085",
|
|
445
|
+
severity: "warning",
|
|
446
|
+
message: `${entry.displayId}: References: target '${slug}' resolves to a ` +
|
|
447
|
+
`'${resolved.shape}' entry but References must cite a ` +
|
|
448
|
+
`Reference-shape entry (spec §4.8)`,
|
|
188
449
|
location: entry.location,
|
|
189
450
|
});
|
|
190
451
|
}
|
|
@@ -205,7 +466,8 @@ export function indexByDisplayId(entries) {
|
|
|
205
466
|
export function findAttr(attrs, key) {
|
|
206
467
|
return attrs.find((a) => a.key === key);
|
|
207
468
|
}
|
|
208
|
-
export { runPipeline } from "./pipeline.js";
|
|
469
|
+
export { runPipeline, suppressDeclaredAttrR010 } from "./pipeline.js";
|
|
470
|
+
export { validateListingDocuments } from "./listing.js";
|
|
209
471
|
export { classifyEntriesStage, classifyEntry } from "./types.js";
|
|
210
472
|
export { compileDisplayIdPattern } from "./pattern.js";
|
|
211
473
|
export { effectiveScope, validateAttributesForEntry } from "./attributes.js";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module core/validator/modal_keywords
|
|
3
|
+
*
|
|
4
|
+
* MSL-M060 validator — uppercase RFC 2119 modal keyword (`SHALL`,
|
|
5
|
+
* `SHOULD`, `MAY`, `MUST`, `WILL`) in entry-body prose. The formatter
|
|
6
|
+
* normalises these to lowercase per spec §3.4.1; this validator
|
|
7
|
+
* surfaces the deviation in a lint-only flow. Profiles may promote the
|
|
8
|
+
* severity.
|
|
9
|
+
*
|
|
10
|
+
* Reads `Entry.bodyTokens` (ADR-016) and filters for `kind === "modal"`
|
|
11
|
+
* AND `case === "upper"`. Code, feature, and math blocks are
|
|
12
|
+
* automatically excluded because the parser's `extractBodyTokens` does
|
|
13
|
+
* not emit tokens inside verbatim regions.
|
|
14
|
+
*/
|
|
15
|
+
import type { Diagnostic, Entry } from "../model/mod.js";
|
|
16
|
+
/**
|
|
17
|
+
* MSL-M060: report every uppercase RFC 2119 modal keyword in entry-body
|
|
18
|
+
* prose. Emits one diagnostic per uppercase occurrence with the exact
|
|
19
|
+
* source text in the message.
|
|
20
|
+
*
|
|
21
|
+
* MSL-M061: report when a Requirement-type entry contains no modal
|
|
22
|
+
* keyword at all (info severity; style hint to add an obligation verb).
|
|
23
|
+
*/
|
|
24
|
+
export declare function validateModalKeywords(entry: Entry): readonly Diagnostic[];
|
|
25
|
+
//# sourceMappingURL=modal_keywords.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modal_keywords.d.ts","sourceRoot":"","sources":["../../src/validator/modal_keywords.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAa,UAAU,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAKpE;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,KAAK,GAAG,SAAS,UAAU,EAAE,CAoCzE"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module core/validator/modal_keywords
|
|
3
|
+
*
|
|
4
|
+
* MSL-M060 validator — uppercase RFC 2119 modal keyword (`SHALL`,
|
|
5
|
+
* `SHOULD`, `MAY`, `MUST`, `WILL`) in entry-body prose. The formatter
|
|
6
|
+
* normalises these to lowercase per spec §3.4.1; this validator
|
|
7
|
+
* surfaces the deviation in a lint-only flow. Profiles may promote the
|
|
8
|
+
* severity.
|
|
9
|
+
*
|
|
10
|
+
* Reads `Entry.bodyTokens` (ADR-016) and filters for `kind === "modal"`
|
|
11
|
+
* AND `case === "upper"`. Code, feature, and math blocks are
|
|
12
|
+
* automatically excluded because the parser's `extractBodyTokens` does
|
|
13
|
+
* not emit tokens inside verbatim regions.
|
|
14
|
+
*/
|
|
15
|
+
import { resolvedCoreType } from "./type_resolution.js";
|
|
16
|
+
/**
|
|
17
|
+
* MSL-M060: report every uppercase RFC 2119 modal keyword in entry-body
|
|
18
|
+
* prose. Emits one diagnostic per uppercase occurrence with the exact
|
|
19
|
+
* source text in the message.
|
|
20
|
+
*
|
|
21
|
+
* MSL-M061: report when a Requirement-type entry contains no modal
|
|
22
|
+
* keyword at all (info severity; style hint to add an obligation verb).
|
|
23
|
+
*/
|
|
24
|
+
export function validateModalKeywords(entry) {
|
|
25
|
+
const diagnostics = [];
|
|
26
|
+
const modalTokens = entry.bodyTokens.filter((t) => t.kind === "modal");
|
|
27
|
+
const anyModalSeen = modalTokens.length > 0;
|
|
28
|
+
for (const t of modalTokens) {
|
|
29
|
+
if (t.case !== "upper")
|
|
30
|
+
continue;
|
|
31
|
+
diagnostics.push({
|
|
32
|
+
code: "MSL-M060",
|
|
33
|
+
severity: "warning",
|
|
34
|
+
message: `modal keyword '${t.text}' should be lowercase`,
|
|
35
|
+
location: t.location,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
// MSL-M061 — Requirement-type entry contains no modal keyword
|
|
39
|
+
// (info; style hint). Gated on the resolved core type being
|
|
40
|
+
// `Requirement` so non-requirement entries (Tests, Contracts, etc.)
|
|
41
|
+
// are not flagged. The hint stays at info severity so it doesn't
|
|
42
|
+
// affect exit codes; profiles may promote.
|
|
43
|
+
if (!anyModalSeen && resolvedCoreType(entry) === "Requirement") {
|
|
44
|
+
diagnostics.push({
|
|
45
|
+
code: "MSL-M061",
|
|
46
|
+
severity: "info",
|
|
47
|
+
message: `${entry.displayId}: Requirement entry contains no modal ` +
|
|
48
|
+
`keyword (shall / should / may / must) — consider declaring one ` +
|
|
49
|
+
`to make the obligation explicit (spec §3.4.1 "Modal keywords")`,
|
|
50
|
+
location: entry.location,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
return diagnostics;
|
|
54
|
+
}
|
|
@@ -4,20 +4,27 @@
|
|
|
4
4
|
* Display-ID pattern template → anchored RegExp.
|
|
5
5
|
*
|
|
6
6
|
* Grammar (per ADR-009 §5):
|
|
7
|
-
* pattern
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* pattern := segment+ (exactly one counter)
|
|
8
|
+
* segment := literal | counter | named
|
|
9
|
+
* counter := "{n}" | "{n:" PADDING "d}"
|
|
10
|
+
* named := "{" identifier "}" (e.g. {scope}, {feature})
|
|
11
|
+
* PADDING := "0" digits
|
|
12
|
+
*
|
|
13
|
+
* The counter `{n}` is the numeric running index (exactly one required). A
|
|
14
|
+
* named placeholder such as `{scope}` matches a free alphanumeric segment —
|
|
15
|
+
* it validates the *shape* `PREFIX_<scope>_<NNNN>` without pinning the scope
|
|
16
|
+
* to a fixed value, so one profile pattern serves every feature scope.
|
|
10
17
|
*
|
|
11
18
|
* Examples:
|
|
12
|
-
* REQ-{n}
|
|
13
|
-
* REQ-{n:04d}
|
|
14
|
-
*
|
|
19
|
+
* REQ-{n} → ^REQ-(\d+)$
|
|
20
|
+
* REQ-{n:04d} → ^REQ-(\d{4})$
|
|
21
|
+
* XREQ_{scope}_{n:04d} → ^XREQ_(?<scope>[A-Za-z0-9]+)_(\d{4})$
|
|
15
22
|
*/
|
|
16
23
|
/**
|
|
17
24
|
* Compile a display-ID pattern template into an anchored RegExp.
|
|
18
25
|
*
|
|
19
|
-
* Throws if the template is missing the `{n}`
|
|
20
|
-
* padding specifier.
|
|
26
|
+
* Throws if the template is missing the `{n}` counter, has more than one, or
|
|
27
|
+
* has an invalid padding specifier.
|
|
21
28
|
*/
|
|
22
29
|
export declare function compileDisplayIdPattern(template: string): RegExp;
|
|
23
30
|
//# sourceMappingURL=pattern.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pattern.d.ts","sourceRoot":"","sources":["../../src/validator/pattern.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"pattern.d.ts","sourceRoot":"","sources":["../../src/validator/pattern.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAKH;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAuChE"}
|
package/esm/validator/pattern.js
CHANGED
|
@@ -4,39 +4,62 @@
|
|
|
4
4
|
* Display-ID pattern template → anchored RegExp.
|
|
5
5
|
*
|
|
6
6
|
* Grammar (per ADR-009 §5):
|
|
7
|
-
* pattern
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* pattern := segment+ (exactly one counter)
|
|
8
|
+
* segment := literal | counter | named
|
|
9
|
+
* counter := "{n}" | "{n:" PADDING "d}"
|
|
10
|
+
* named := "{" identifier "}" (e.g. {scope}, {feature})
|
|
11
|
+
* PADDING := "0" digits
|
|
12
|
+
*
|
|
13
|
+
* The counter `{n}` is the numeric running index (exactly one required). A
|
|
14
|
+
* named placeholder such as `{scope}` matches a free alphanumeric segment —
|
|
15
|
+
* it validates the *shape* `PREFIX_<scope>_<NNNN>` without pinning the scope
|
|
16
|
+
* to a fixed value, so one profile pattern serves every feature scope.
|
|
10
17
|
*
|
|
11
18
|
* Examples:
|
|
12
|
-
* REQ-{n}
|
|
13
|
-
* REQ-{n:04d}
|
|
14
|
-
*
|
|
19
|
+
* REQ-{n} → ^REQ-(\d+)$
|
|
20
|
+
* REQ-{n:04d} → ^REQ-(\d{4})$
|
|
21
|
+
* XREQ_{scope}_{n:04d} → ^XREQ_(?<scope>[A-Za-z0-9]+)_(\d{4})$
|
|
15
22
|
*/
|
|
16
|
-
|
|
23
|
+
// One token: the {n} counter (optionally padded) OR a {named} segment.
|
|
24
|
+
const TOKEN_RE = /\{n(?::(0\d+)d)?\}|\{([A-Za-z][A-Za-z0-9_]*)\}/g;
|
|
17
25
|
/**
|
|
18
26
|
* Compile a display-ID pattern template into an anchored RegExp.
|
|
19
27
|
*
|
|
20
|
-
* Throws if the template is missing the `{n}`
|
|
21
|
-
* padding specifier.
|
|
28
|
+
* Throws if the template is missing the `{n}` counter, has more than one, or
|
|
29
|
+
* has an invalid padding specifier.
|
|
22
30
|
*/
|
|
23
31
|
export function compileDisplayIdPattern(template) {
|
|
24
|
-
|
|
25
|
-
|
|
32
|
+
let regexSource = "^";
|
|
33
|
+
let lastIndex = 0;
|
|
34
|
+
let counters = 0;
|
|
35
|
+
const re = new RegExp(TOKEN_RE);
|
|
36
|
+
let match;
|
|
37
|
+
while ((match = re.exec(template)) !== null) {
|
|
38
|
+
regexSource += escapeRegex(template.slice(lastIndex, match.index));
|
|
39
|
+
const named = match[2];
|
|
40
|
+
if (named === undefined) {
|
|
41
|
+
// {n} / {n:0Nd} counter
|
|
42
|
+
const padding = match[1];
|
|
43
|
+
regexSource += "(" + (padding ? `\\d{${Number(padding)}}` : `\\d+`) + ")";
|
|
44
|
+
counters++;
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
// {scope}-style named segment → free alphanumeric capture
|
|
48
|
+
regexSource += `(?<${named}>[A-Za-z0-9]+)`;
|
|
49
|
+
}
|
|
50
|
+
lastIndex = match.index + match[0].length;
|
|
51
|
+
}
|
|
52
|
+
regexSource += escapeRegex(template.slice(lastIndex)) + "$";
|
|
53
|
+
if (counters === 0) {
|
|
26
54
|
if (/\{n:[^}]*\}/.test(template)) {
|
|
27
55
|
throw new Error(`display-id-pattern '${template}': invalid padding specifier ` +
|
|
28
56
|
`(expected {n} or {n:NNd})`);
|
|
29
57
|
}
|
|
30
58
|
throw new Error(`display-id-pattern '${template}': missing {n} placeholder`);
|
|
31
59
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const prefix = template.slice(0, placeholderStart);
|
|
36
|
-
const suffix = template.slice(placeholderEnd);
|
|
37
|
-
const digitGroup = padding ? `\\d{${Number(padding)}}` : `\\d+`;
|
|
38
|
-
const regexSource = "^" + escapeRegex(prefix) + "(" + digitGroup + ")" +
|
|
39
|
-
escapeRegex(suffix) + "$";
|
|
60
|
+
if (counters > 1) {
|
|
61
|
+
throw new Error(`display-id-pattern '${template}': multiple {n} counters (expected one)`);
|
|
62
|
+
}
|
|
40
63
|
return new RegExp(regexSource);
|
|
41
64
|
}
|
|
42
65
|
function escapeRegex(s) {
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module core/validator/per_type_attrs
|
|
3
|
+
*
|
|
4
|
+
* Per-type attribute compatibility check (spec §4.3 — MSL-T022). When
|
|
5
|
+
* an entry's effective type resolves to a core type — via explicit
|
|
6
|
+
* `Type:`, profile classification, or URI-scheme inference for
|
|
7
|
+
* Reference-shape entries — any attribute that's known to the core
|
|
8
|
+
* hierarchy but not allowed on that type fires MSL-T022 as a warning.
|
|
9
|
+
* Unknown attributes (neither universal nor core-typed) fall through
|
|
10
|
+
* to the existing MSL-R010 unknown-attribute warning in
|
|
11
|
+
* `validator/mod.ts`.
|
|
12
|
+
*/
|
|
13
|
+
import type { Diagnostic, EffectiveProfile, Entry } from "../model/mod.js";
|
|
14
|
+
/**
|
|
15
|
+
* Emit per-type attribute diagnostics:
|
|
16
|
+
*
|
|
17
|
+
* - **MSL-T022** (warning) — an attribute is core-known but not
|
|
18
|
+
* valid on the entry's *resolved* type.
|
|
19
|
+
* - **MSL-T024** (warning) — the entry's core type could not be
|
|
20
|
+
* resolved (no explicit `Type:`, no profile classification, no
|
|
21
|
+
* inferable signal — display-ID prefix / URI scheme /
|
|
22
|
+
* discriminating attribute) yet it carries a core-type-scoped
|
|
23
|
+
* attribute, so that attribute cannot be validated. Without this,
|
|
24
|
+
* such attributes slipped through silently (e.g. `Manufacturer:`
|
|
25
|
+
* on a `jira:`-scheme reference). Universal and entirely unknown
|
|
26
|
+
* attributes are exempt — those go through MSL-R010.
|
|
27
|
+
*/
|
|
28
|
+
export declare function validatePerTypeAttributes(entry: Entry, profile?: EffectiveProfile): readonly Diagnostic[];
|
|
29
|
+
//# sourceMappingURL=per_type_attrs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"per_type_attrs.d.ts","sourceRoot":"","sources":["../../src/validator/per_type_attrs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAmB3E;;;;;;;;;;;;;GAaG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,KAAK,EACZ,OAAO,CAAC,EAAE,gBAAgB,GACzB,SAAS,UAAU,EAAE,CAsCvB"}
|