@driftsys/markspec 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -8
- package/esm/compiler/inverses.d.ts +22 -0
- package/esm/compiler/inverses.d.ts.map +1 -0
- package/esm/compiler/inverses.js +147 -0
- package/esm/compiler/link_target.d.ts +19 -0
- package/esm/compiler/link_target.d.ts.map +1 -0
- package/esm/compiler/link_target.js +66 -0
- package/esm/compiler/mod.d.ts +7 -1
- package/esm/compiler/mod.d.ts.map +1 -1
- package/esm/compiler/mod.js +61 -14
- package/esm/compiler/schema.d.ts.map +1 -1
- package/esm/compiler/schema.js +20 -1
- package/esm/config/markspec.d.ts +51 -0
- package/esm/config/markspec.d.ts.map +1 -0
- package/esm/config/markspec.js +216 -0
- package/esm/config/mod.d.ts +4 -0
- package/esm/config/mod.d.ts.map +1 -1
- package/esm/config/mod.js +27 -16
- package/esm/formatter/mod.d.ts +12 -2
- package/esm/formatter/mod.d.ts.map +1 -1
- package/esm/formatter/mod.js +130 -22
- package/esm/mod.d.ts +10 -6
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +5 -2
- package/esm/model/attributes.d.ts +47 -0
- package/esm/model/attributes.d.ts.map +1 -0
- package/esm/model/attributes.js +97 -0
- package/esm/model/mod.d.ts +255 -26
- package/esm/model/mod.d.ts.map +1 -1
- package/esm/model/mod.js +27 -1
- package/esm/model/profile.d.ts +189 -0
- package/esm/model/profile.d.ts.map +1 -0
- package/esm/model/profile.js +31 -0
- package/esm/parser/attributes.d.ts +13 -1
- package/esm/parser/attributes.d.ts.map +1 -1
- package/esm/parser/attributes.js +47 -0
- package/esm/parser/frontmatter.d.ts +53 -0
- package/esm/parser/frontmatter.d.ts.map +1 -0
- package/esm/parser/frontmatter.js +185 -0
- package/esm/parser/grammars.js +11 -2
- package/esm/parser/markdown.d.ts +11 -4
- package/esm/parser/markdown.d.ts.map +1 -1
- package/esm/parser/markdown.js +85 -38
- package/esm/parser/mod.d.ts +26 -10
- package/esm/parser/mod.d.ts.map +1 -1
- package/esm/parser/mod.js +39 -9
- package/esm/parser/source.d.ts +12 -8
- package/esm/parser/source.d.ts.map +1 -1
- package/esm/parser/source.js +20 -13
- package/esm/profile/cache.d.ts +29 -0
- package/esm/profile/cache.d.ts.map +1 -0
- package/esm/profile/cache.js +45 -0
- package/esm/profile/chain.d.ts +42 -0
- package/esm/profile/chain.d.ts.map +1 -0
- package/esm/profile/chain.js +193 -0
- package/esm/profile/git-cache.d.ts +73 -0
- package/esm/profile/git-cache.d.ts.map +1 -0
- package/esm/profile/git-cache.js +96 -0
- package/esm/profile/load.d.ts +28 -0
- package/esm/profile/load.d.ts.map +1 -0
- package/esm/profile/load.js +50 -0
- package/esm/profile/manifest.d.ts +21 -0
- package/esm/profile/manifest.d.ts.map +1 -0
- package/esm/profile/manifest.js +830 -0
- package/esm/profile/merge.d.ts +26 -0
- package/esm/profile/merge.d.ts.map +1 -0
- package/esm/profile/merge.js +518 -0
- package/esm/profile/mod.d.ts +23 -0
- package/esm/profile/mod.d.ts.map +1 -0
- package/esm/profile/mod.js +14 -0
- package/esm/profile/npm.d.ts +51 -0
- package/esm/profile/npm.d.ts.map +1 -0
- package/esm/profile/npm.js +186 -0
- package/esm/profile/resolver.d.ts +60 -0
- package/esm/profile/resolver.d.ts.map +1 -0
- package/esm/profile/resolver.js +132 -0
- package/esm/reporter/mod.js +14 -27
- package/esm/validator/attributes.d.ts +43 -0
- package/esm/validator/attributes.d.ts.map +1 -0
- package/esm/validator/attributes.js +169 -0
- package/esm/validator/mod.d.ts +27 -6
- package/esm/validator/mod.d.ts.map +1 -1
- package/esm/validator/mod.js +132 -124
- package/esm/validator/normalize.d.ts +21 -0
- package/esm/validator/normalize.d.ts.map +1 -0
- package/esm/validator/normalize.js +58 -0
- package/esm/validator/pattern.d.ts +23 -0
- package/esm/validator/pattern.d.ts.map +1 -0
- package/esm/validator/pattern.js +44 -0
- package/esm/validator/pipeline.d.ts +30 -0
- package/esm/validator/pipeline.d.ts.map +1 -0
- package/esm/validator/pipeline.js +115 -0
- package/esm/validator/traceability.d.ts +48 -0
- package/esm/validator/traceability.d.ts.map +1 -0
- package/esm/validator/traceability.js +141 -0
- package/esm/validator/types.d.ts +48 -0
- package/esm/validator/types.d.ts.map +1 -0
- package/esm/validator/types.js +140 -0
- package/esm/validator/value_types.d.ts +20 -0
- package/esm/validator/value_types.d.ts.map +1 -0
- package/esm/validator/value_types.js +126 -0
- package/package.json +1 -1
- package/script/compiler/inverses.d.ts +22 -0
- package/script/compiler/inverses.d.ts.map +1 -0
- package/script/compiler/inverses.js +150 -0
- package/script/compiler/link_target.d.ts +19 -0
- package/script/compiler/link_target.d.ts.map +1 -0
- package/script/compiler/link_target.js +69 -0
- package/script/compiler/mod.d.ts +7 -1
- package/script/compiler/mod.d.ts.map +1 -1
- package/script/compiler/mod.js +62 -14
- package/script/compiler/schema.d.ts.map +1 -1
- package/script/compiler/schema.js +20 -1
- package/script/config/markspec.d.ts +51 -0
- package/script/config/markspec.d.ts.map +1 -0
- package/script/config/markspec.js +222 -0
- package/script/config/mod.d.ts +4 -0
- package/script/config/mod.d.ts.map +1 -1
- package/script/config/mod.js +28 -16
- package/script/formatter/mod.d.ts +12 -2
- package/script/formatter/mod.d.ts.map +1 -1
- package/script/formatter/mod.js +131 -22
- package/script/mod.d.ts +10 -6
- package/script/mod.d.ts.map +1 -1
- package/script/mod.js +48 -19
- package/script/model/attributes.d.ts +47 -0
- package/script/model/attributes.d.ts.map +1 -0
- package/script/model/attributes.js +101 -0
- package/script/model/mod.d.ts +255 -26
- package/script/model/mod.d.ts.map +1 -1
- package/script/model/mod.js +34 -2
- package/script/model/profile.d.ts +189 -0
- package/script/model/profile.d.ts.map +1 -0
- package/script/model/profile.js +34 -0
- package/script/parser/attributes.d.ts +13 -1
- package/script/parser/attributes.d.ts.map +1 -1
- package/script/parser/attributes.js +48 -0
- package/script/parser/frontmatter.d.ts +53 -0
- package/script/parser/frontmatter.d.ts.map +1 -0
- package/script/parser/frontmatter.js +188 -0
- package/script/parser/grammars.js +11 -2
- package/script/parser/markdown.d.ts +11 -4
- package/script/parser/markdown.d.ts.map +1 -1
- package/script/parser/markdown.js +84 -37
- package/script/parser/mod.d.ts +26 -10
- package/script/parser/mod.d.ts.map +1 -1
- package/script/parser/mod.js +41 -10
- package/script/parser/source.d.ts +12 -8
- package/script/parser/source.d.ts.map +1 -1
- package/script/parser/source.js +20 -13
- package/script/profile/cache.d.ts +29 -0
- package/script/profile/cache.d.ts.map +1 -0
- package/script/profile/cache.js +48 -0
- package/script/profile/chain.d.ts +42 -0
- package/script/profile/chain.d.ts.map +1 -0
- package/script/profile/chain.js +229 -0
- package/script/profile/git-cache.d.ts +73 -0
- package/script/profile/git-cache.d.ts.map +1 -0
- package/script/profile/git-cache.js +104 -0
- package/script/profile/load.d.ts +28 -0
- package/script/profile/load.d.ts.map +1 -0
- package/script/profile/load.js +53 -0
- package/script/profile/manifest.d.ts +21 -0
- package/script/profile/manifest.d.ts.map +1 -0
- package/script/profile/manifest.js +833 -0
- package/script/profile/merge.d.ts +26 -0
- package/script/profile/merge.d.ts.map +1 -0
- package/script/profile/merge.js +521 -0
- package/script/profile/mod.d.ts +23 -0
- package/script/profile/mod.d.ts.map +1 -0
- package/script/profile/mod.js +31 -0
- package/script/profile/npm.d.ts +51 -0
- package/script/profile/npm.d.ts.map +1 -0
- package/script/profile/npm.js +191 -0
- package/script/profile/resolver.d.ts +60 -0
- package/script/profile/resolver.d.ts.map +1 -0
- package/script/profile/resolver.js +136 -0
- package/script/reporter/mod.js +14 -27
- package/script/validator/attributes.d.ts +43 -0
- package/script/validator/attributes.d.ts.map +1 -0
- package/script/validator/attributes.js +173 -0
- package/script/validator/mod.d.ts +27 -6
- package/script/validator/mod.d.ts.map +1 -1
- package/script/validator/mod.js +145 -123
- package/script/validator/normalize.d.ts +21 -0
- package/script/validator/normalize.d.ts.map +1 -0
- package/script/validator/normalize.js +61 -0
- package/script/validator/pattern.d.ts +23 -0
- package/script/validator/pattern.d.ts.map +1 -0
- package/script/validator/pattern.js +47 -0
- package/script/validator/pipeline.d.ts +30 -0
- package/script/validator/pipeline.d.ts.map +1 -0
- package/script/validator/pipeline.js +118 -0
- package/script/validator/traceability.d.ts +48 -0
- package/script/validator/traceability.d.ts.map +1 -0
- package/script/validator/traceability.js +146 -0
- package/script/validator/types.d.ts +48 -0
- package/script/validator/types.d.ts.map +1 -0
- package/script/validator/types.js +144 -0
- package/script/validator/value_types.d.ts +20 -0
- package/script/validator/value_types.d.ts.map +1 -0
- package/script/validator/value_types.js +129 -0
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module model/attributes
|
|
3
|
+
*
|
|
4
|
+
* Built-in attribute catalog per the language spec (Part 2.1).
|
|
5
|
+
*
|
|
6
|
+
* The core defines one reserved identity slot (`Id:`) plus a small
|
|
7
|
+
* universal attribute set. Profile-declared attributes extend this
|
|
8
|
+
* catalog at runtime. Type-specific attributes (`Derived-from`,
|
|
9
|
+
* `Verifies`, `Allocated-to`, `Element-kind`, `Test-level`, …) are not
|
|
10
|
+
* built-ins — they are declared by the active profile.
|
|
11
|
+
*/
|
|
12
|
+
// ---------------------------------------------------------------------------
|
|
13
|
+
// Universal attribute catalog
|
|
14
|
+
// ---------------------------------------------------------------------------
|
|
15
|
+
/** Both shapes. */
|
|
16
|
+
const BOTH_SHAPES = ["identified", "referenced"];
|
|
17
|
+
/**
|
|
18
|
+
* Shapes that carry `References:` — identified entries only. A referenced
|
|
19
|
+
* entry does not itself cite other referenced entries via `References:`
|
|
20
|
+
* (the replacement relation is expressed via universal `Supersedes:`).
|
|
21
|
+
*/
|
|
22
|
+
const CITING_SHAPES = ["identified"];
|
|
23
|
+
/**
|
|
24
|
+
* Full catalog of core built-in attributes.
|
|
25
|
+
*
|
|
26
|
+
* Order within the array has no semantic meaning; consumers look up by key
|
|
27
|
+
* via {@linkcode attributeSpec}.
|
|
28
|
+
*
|
|
29
|
+
* Profile-declared attributes (`type:`, `Derived-from:`, `Verifies:`,
|
|
30
|
+
* `Allocated-to:`, `Element-kind:`, `Test-level:`, compliance attributes,
|
|
31
|
+
* …) are not listed here; they appear at runtime via the active profile's
|
|
32
|
+
* manifest.
|
|
33
|
+
*/
|
|
34
|
+
export const ATTRIBUTE_CATALOG = [
|
|
35
|
+
// Identity — required on every entry, shape-discriminated by value format
|
|
36
|
+
{
|
|
37
|
+
key: "Id",
|
|
38
|
+
type: "id",
|
|
39
|
+
origin: "assigned",
|
|
40
|
+
shapes: BOTH_SHAPES,
|
|
41
|
+
required: true,
|
|
42
|
+
},
|
|
43
|
+
// Universal — apply to every entry
|
|
44
|
+
{
|
|
45
|
+
key: "Labels",
|
|
46
|
+
type: "tag-list",
|
|
47
|
+
origin: "authored",
|
|
48
|
+
shapes: BOTH_SHAPES,
|
|
49
|
+
required: false,
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
key: "References",
|
|
53
|
+
type: "citation",
|
|
54
|
+
origin: "authored",
|
|
55
|
+
shapes: CITING_SHAPES,
|
|
56
|
+
required: false,
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
key: "External-id",
|
|
60
|
+
type: "external-id",
|
|
61
|
+
origin: "authored",
|
|
62
|
+
shapes: BOTH_SHAPES,
|
|
63
|
+
required: false,
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
key: "Supersedes",
|
|
67
|
+
type: "id",
|
|
68
|
+
origin: "authored",
|
|
69
|
+
shapes: BOTH_SHAPES,
|
|
70
|
+
required: false,
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
key: "Superseded-by",
|
|
74
|
+
type: "id",
|
|
75
|
+
origin: "generated",
|
|
76
|
+
shapes: BOTH_SHAPES,
|
|
77
|
+
required: false,
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
key: "Deprecated",
|
|
81
|
+
type: "text",
|
|
82
|
+
origin: "authored",
|
|
83
|
+
shapes: BOTH_SHAPES,
|
|
84
|
+
required: false,
|
|
85
|
+
},
|
|
86
|
+
];
|
|
87
|
+
/** Canonical Title-Case attribute keys the core recognizes. */
|
|
88
|
+
export const UNIVERSAL_ATTRIBUTE_KEYS = ATTRIBUTE_CATALOG
|
|
89
|
+
.map((spec) => spec.key);
|
|
90
|
+
// ---------------------------------------------------------------------------
|
|
91
|
+
// Lookup helpers
|
|
92
|
+
// ---------------------------------------------------------------------------
|
|
93
|
+
const SPEC_BY_KEY = new Map(ATTRIBUTE_CATALOG.map((spec) => [spec.key, spec]));
|
|
94
|
+
/** Look up an attribute specification by its canonical key. */
|
|
95
|
+
export function attributeSpec(key) {
|
|
96
|
+
return SPEC_BY_KEY.get(key);
|
|
97
|
+
}
|
package/esm/model/mod.d.ts
CHANGED
|
@@ -3,24 +3,25 @@
|
|
|
3
3
|
*
|
|
4
4
|
* MarkSpec document model — AST types, ID types, and project configuration.
|
|
5
5
|
*/
|
|
6
|
-
|
|
7
|
-
export type
|
|
6
|
+
export { ATTRIBUTE_CATALOG, attributeSpec, UNIVERSAL_ATTRIBUTE_KEYS, } from "./attributes.js";
|
|
7
|
+
export type { AttributeSpec } from "./attributes.js";
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Human-readable entry identifier.
|
|
9
|
+
* Human-readable entry identifier from the `[...]` bracket marker.
|
|
10
|
+
*
|
|
11
|
+
* The core accepts any non-empty, project-unique string. Profiles may
|
|
12
|
+
* tighten by declaring per-type `display-id-pattern:` templates, used for
|
|
13
|
+
* both ID minting and type inference.
|
|
16
14
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
15
|
+
* For referenced entries the display ID is a slug (pandoc/BibTeX cite-key
|
|
16
|
+
* convention, e.g., `ISO-26262-6`, `serde`, `smith2021`). The leading `@`
|
|
17
|
+
* in `[@slug]` is accepted as Pandoc sugar and stripped during parsing.
|
|
19
18
|
*/
|
|
20
19
|
export type DisplayId = string;
|
|
21
20
|
/**
|
|
22
|
-
* Universally unique
|
|
23
|
-
*
|
|
21
|
+
* Universally unique identifier, bare 26-character Crockford base32.
|
|
22
|
+
*
|
|
23
|
+
* Used as the `Id:` attribute value for identified entries. Assigned by
|
|
24
|
+
* tooling, never hand-authored, immutable once assigned.
|
|
24
25
|
*/
|
|
25
26
|
export type Ulid = string;
|
|
26
27
|
/** Points to a span within a source file. */
|
|
@@ -39,14 +40,137 @@ export interface Attribute {
|
|
|
39
40
|
/** Raw attribute value string. */
|
|
40
41
|
readonly value: string;
|
|
41
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Collated attributes keyed by Title-Case attribute name.
|
|
45
|
+
*
|
|
46
|
+
* Repeatable types (`id-list`, `tag-list`, `external-id`) carry one entry
|
|
47
|
+
* per value after CSV-splitting and multi-line merging; `citation` carries
|
|
48
|
+
* one entry per occurrence (no CSV-splitting, locators may contain `,`).
|
|
49
|
+
* Single-valued types carry a one-element array; if the author wrote the
|
|
50
|
+
* attribute twice, the later value wins but both appear in
|
|
51
|
+
* {@linkcode Entry.rawAttributes} for round-trip fidelity.
|
|
52
|
+
*
|
|
53
|
+
* This is the representation the validator, formatter, and compiler consult
|
|
54
|
+
* for typed processing; {@linkcode Entry.rawAttributes} is the source of truth
|
|
55
|
+
* for exact round-trip through `markspec format`.
|
|
56
|
+
*/
|
|
57
|
+
export type TypedAttributes = ReadonlyMap<string, readonly string[]>;
|
|
42
58
|
/** The origin format of the entry. */
|
|
43
59
|
export type EntrySource = "markdown" | "doc-comment";
|
|
60
|
+
/**
|
|
61
|
+
* Entry shape — one of two semantics-free categories the core recognizes.
|
|
62
|
+
*
|
|
63
|
+
* - `identified` — content unit the project authors and owns; `Id:` value
|
|
64
|
+
* is a bare ULID.
|
|
65
|
+
* - `referenced` — citation pointing to an external artifact; `Id:` value
|
|
66
|
+
* is a scheme-qualified URI (RFC 3986): `urn:`, `doi:`, `pkg:`,
|
|
67
|
+
* `https:`, `isbn:`, …
|
|
68
|
+
*
|
|
69
|
+
* Shape is determined by the `Id:` attribute's value format, not by the
|
|
70
|
+
* display-ID format or the document context. Concrete types
|
|
71
|
+
* (`requirement`, `test`, `unit`, `standard`, `dependency`, …) are declared
|
|
72
|
+
* by the active profile, not by the core.
|
|
73
|
+
*/
|
|
74
|
+
export type EntryShape = "identified" | "referenced";
|
|
75
|
+
/** Core-reserved identity attribute name. */
|
|
76
|
+
export declare const IDENTITY_KEY: "Id";
|
|
77
|
+
/** Regex matching a bare ULID (identified-entry `Id:` value). */
|
|
78
|
+
export declare const ULID_RE: RegExp;
|
|
79
|
+
/**
|
|
80
|
+
* Regex matching a scheme-qualified URI (RFC 3986 §3.1 scheme).
|
|
81
|
+
*
|
|
82
|
+
* A scheme starts with a letter, followed by letters/digits/`+`/`-`/`.`,
|
|
83
|
+
* terminated by `:`. This is the gate that distinguishes a URI value from
|
|
84
|
+
* a bare slug in an `Id:` attribute.
|
|
85
|
+
*/
|
|
86
|
+
export declare const URI_SCHEME_RE: RegExp;
|
|
87
|
+
/**
|
|
88
|
+
* Decide the shape of an entry from its `Id:` value.
|
|
89
|
+
*
|
|
90
|
+
* Returns `undefined` for inputs that are neither a bare ULID nor a
|
|
91
|
+
* scheme-qualified URI — the caller emits a validation error.
|
|
92
|
+
*/
|
|
93
|
+
export declare function shapeFromIdValue(value: string): EntryShape | undefined;
|
|
94
|
+
/**
|
|
95
|
+
* Origin of an attribute value.
|
|
96
|
+
*
|
|
97
|
+
* - `authored` — written by the author in the source file.
|
|
98
|
+
* - `inferred` — pre-filled by `markspec format` from a heuristic,
|
|
99
|
+
* committed to source, author-overridable.
|
|
100
|
+
* - `assigned` — generated fresh by `markspec format` at creation time
|
|
101
|
+
* (the ULID inside an identified-entry `Id:`). Never derived, never
|
|
102
|
+
* changes after assignment.
|
|
103
|
+
* - `generated` — computed at build time from inverse relations.
|
|
104
|
+
* Never committed to source.
|
|
105
|
+
*/
|
|
106
|
+
export type AttributeOrigin = "authored" | "inferred" | "assigned" | "generated";
|
|
107
|
+
/**
|
|
108
|
+
* Attribute value type (14 types).
|
|
109
|
+
*
|
|
110
|
+
* Cardinality is encoded in the type:
|
|
111
|
+
* - Repeatable: `id-list`, `tag-list`, `citation`, `external-id`.
|
|
112
|
+
* - Single-valued: everything else.
|
|
113
|
+
*
|
|
114
|
+
* Repeatable types accept multi-line and (except `citation`) CSV on input;
|
|
115
|
+
* the formatter always emits multi-line form.
|
|
116
|
+
*/
|
|
117
|
+
export type AttributeValueType = "id" | "id-list" | "uri" | "url" | "path" | "path-or-id" | "enum" | "tag-list" | "text" | "citation" | "external-id" | "integer" | "date" | "boolean";
|
|
118
|
+
/**
|
|
119
|
+
* Observed properties of an entry.
|
|
120
|
+
*
|
|
121
|
+
* Properties are model-level observations — never authored in source, never
|
|
122
|
+
* round-trip through `markspec format`, not in git diffs. Each category is
|
|
123
|
+
* optional; absence means "not observed (yet)".
|
|
124
|
+
*/
|
|
125
|
+
export interface EntryProperties {
|
|
126
|
+
/** Repository location. */
|
|
127
|
+
readonly file?: {
|
|
128
|
+
readonly path: string;
|
|
129
|
+
readonly line?: number;
|
|
130
|
+
readonly column?: number;
|
|
131
|
+
};
|
|
132
|
+
/** Version-control observations. */
|
|
133
|
+
readonly git?: {
|
|
134
|
+
readonly createdAt?: string;
|
|
135
|
+
readonly modifiedAt?: string;
|
|
136
|
+
readonly contributors?: readonly string[];
|
|
137
|
+
readonly revision?: string;
|
|
138
|
+
};
|
|
139
|
+
/** External connector state. */
|
|
140
|
+
readonly sync?: {
|
|
141
|
+
readonly lastSyncedAt?: string;
|
|
142
|
+
readonly remoteState?: string;
|
|
143
|
+
readonly externalSource?: string;
|
|
144
|
+
};
|
|
145
|
+
/** Compilation-time provenance. */
|
|
146
|
+
readonly build?: {
|
|
147
|
+
readonly resolutionSource?: string;
|
|
148
|
+
readonly registryOrigin?: string;
|
|
149
|
+
};
|
|
150
|
+
/**
|
|
151
|
+
* Entry-source provenance — set when an entry is produced by an adapter
|
|
152
|
+
* other than the Markdown parser (doc-comment extractor, SBOM ingester,
|
|
153
|
+
* ECAD/PLM connector).
|
|
154
|
+
*/
|
|
155
|
+
readonly source?: {
|
|
156
|
+
readonly type: string;
|
|
157
|
+
readonly adapter?: string;
|
|
158
|
+
readonly language?: string;
|
|
159
|
+
readonly rule?: string;
|
|
160
|
+
readonly extractedAt?: string;
|
|
161
|
+
};
|
|
162
|
+
}
|
|
44
163
|
/**
|
|
45
164
|
* A parsed MarkSpec entry — the core AST node.
|
|
46
165
|
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
* `
|
|
166
|
+
* The `shape` field discriminates the two core categories:
|
|
167
|
+
* - `identified` entries carry a bare ULID in `id` (populated).
|
|
168
|
+
* - `referenced` entries carry a URI in `id` (populated).
|
|
169
|
+
*
|
|
170
|
+
* The `type` field holds the active profile's classification for the entry
|
|
171
|
+
* (inferred from the display-ID pattern or authored explicitly via a
|
|
172
|
+
* `type:` attribute). It is `undefined` when no profile rule classifies
|
|
173
|
+
* the entry.
|
|
50
174
|
*/
|
|
51
175
|
export interface Entry {
|
|
52
176
|
/** Human-readable display ID from the `[...]` marker. */
|
|
@@ -55,16 +179,46 @@ export interface Entry {
|
|
|
55
179
|
readonly title: string;
|
|
56
180
|
/** Body content (paragraphs, alerts, code blocks) between title and attributes. */
|
|
57
181
|
readonly body: string;
|
|
58
|
-
/**
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
182
|
+
/**
|
|
183
|
+
* Source-order raw attribute array. Used by the formatter for round-trip
|
|
184
|
+
* fidelity (preserving key casing, line order, and trailing backslashes).
|
|
185
|
+
* For lookup-oriented access, use `typedAttributes` — the collated,
|
|
186
|
+
* CSV-split Map view of the same data.
|
|
187
|
+
*/
|
|
188
|
+
readonly rawAttributes: readonly Attribute[];
|
|
189
|
+
/**
|
|
190
|
+
* Collated, typed view of {@linkcode Entry.rawAttributes}.
|
|
191
|
+
*
|
|
192
|
+
* Populated by the parser alongside `rawAttributes`. Downstream layers
|
|
193
|
+
* (validator, compiler) consult this map for typed processing; the
|
|
194
|
+
* formatter still reads `rawAttributes` for exact round-trip.
|
|
195
|
+
*/
|
|
196
|
+
readonly typedAttributes: TypedAttributes;
|
|
197
|
+
/**
|
|
198
|
+
* Value of the `Id:` attribute — a ULID for identified entries, a URI for
|
|
199
|
+
* referenced entries. Absent when `Id:` was missing or malformed.
|
|
200
|
+
*/
|
|
201
|
+
readonly id?: string;
|
|
202
|
+
/**
|
|
203
|
+
* Profile-declared type for this entry, when classified.
|
|
204
|
+
*
|
|
205
|
+
* Normally inferred by the active profile from the display-ID prefix
|
|
206
|
+
* matching a declared `display-id-pattern:`. An explicit `type:`
|
|
207
|
+
* attribute in source overrides inference. Absent when no profile rule
|
|
208
|
+
* matches (e.g., free-form display ID with no `type:` attribute).
|
|
209
|
+
*/
|
|
210
|
+
readonly type?: string;
|
|
211
|
+
/** Entry shape — `identified` or `referenced`. */
|
|
212
|
+
readonly shape: EntryShape;
|
|
64
213
|
/** Where the entry was found. */
|
|
65
214
|
readonly location: SourceLocation;
|
|
66
215
|
/** Whether this came from a Markdown file or a doc comment. */
|
|
67
216
|
readonly source: EntrySource;
|
|
217
|
+
/**
|
|
218
|
+
* Observed properties (file path, git history, sync state, build origin,
|
|
219
|
+
* source-adapter provenance).
|
|
220
|
+
*/
|
|
221
|
+
readonly properties?: EntryProperties;
|
|
68
222
|
}
|
|
69
223
|
/** Severity level for diagnostics. */
|
|
70
224
|
export type Severity = "error" | "warning" | "info";
|
|
@@ -85,8 +239,6 @@ export declare const REFHUB_URL = "https://driftsys.github.io/refhub";
|
|
|
85
239
|
export interface ProjectConfig {
|
|
86
240
|
/** Project name (e.g., `io.driftsys.markspec`). */
|
|
87
241
|
readonly name: string;
|
|
88
|
-
/** 2-6 letter project/domain abbreviation used in display IDs (e.g., `BRK`). */
|
|
89
|
-
readonly domain: string;
|
|
90
242
|
/** Project version string. */
|
|
91
243
|
readonly version: string;
|
|
92
244
|
/** Allowed label vocabulary (e.g., `["ASIL-A", "ASIL-B"]`). Empty = no constraint. */
|
|
@@ -140,8 +292,16 @@ export interface InlineRef {
|
|
|
140
292
|
readonly refId: string;
|
|
141
293
|
readonly location: SourceLocation;
|
|
142
294
|
}
|
|
143
|
-
/**
|
|
144
|
-
|
|
295
|
+
/**
|
|
296
|
+
* Kind of directional link between entries — relation name lifted from the
|
|
297
|
+
* source attribute.
|
|
298
|
+
*
|
|
299
|
+
* The core bakes in only `supersedes` (universal retirement). All other
|
|
300
|
+
* relation names listed here are conventions recognized by shipped profile
|
|
301
|
+
* packages; in a profile-aware pipeline, link kinds come from the active
|
|
302
|
+
* profile's `traceability:` declarations rather than this closed union.
|
|
303
|
+
*/
|
|
304
|
+
export type LinkKind = "satisfies" | "derived-from" | "references" | "allocated-to" | "realizes" | "verifies" | "tests" | "depends-on" | "part-of" | "generated-from" | "supersedes";
|
|
145
305
|
/** A directional link between two entries in the traceability graph. */
|
|
146
306
|
export interface Link {
|
|
147
307
|
readonly from: DisplayId;
|
|
@@ -149,4 +309,73 @@ export interface Link {
|
|
|
149
309
|
readonly kind: LinkKind;
|
|
150
310
|
readonly location: SourceLocation;
|
|
151
311
|
}
|
|
312
|
+
/**
|
|
313
|
+
* Document-level attributes authored in YAML front matter.
|
|
314
|
+
*
|
|
315
|
+
* Keys use kebab-case (YAML-ecosystem convention). Core keys below; profiles
|
|
316
|
+
* declare additional keys; `.markspec.yaml` → `frontMatter.allowedKeys`
|
|
317
|
+
* allowlists ecosystem keys (Hugo, Jekyll, Docusaurus). Keys forbidden by
|
|
318
|
+
* the language spec (`title`, `description`, `date`, `authors`, …) are
|
|
319
|
+
* rejected by MSL-D001 and never reach this map.
|
|
320
|
+
*/
|
|
321
|
+
export interface DocumentAttributes {
|
|
322
|
+
/**
|
|
323
|
+
* Document identity — ULID (identified) or URI (referenced), same
|
|
324
|
+
* discrimination rule as entry `Id:`. Conventionally a ULID for
|
|
325
|
+
* project-authored documents.
|
|
326
|
+
*/
|
|
327
|
+
readonly "document-id"?: string;
|
|
328
|
+
/** Overrides filename/directive-based type detection. */
|
|
329
|
+
readonly "document-type"?: string;
|
|
330
|
+
/** Classification tags (`tag-list`). */
|
|
331
|
+
readonly labels?: readonly string[];
|
|
332
|
+
/** Retirement reason (free-text). Presence marks the document as retired. */
|
|
333
|
+
readonly deprecated?: string;
|
|
334
|
+
/** Cross-system identifier(s) (`external-id`). */
|
|
335
|
+
readonly "external-id"?: readonly string[];
|
|
336
|
+
/** `document-id` of a document this one replaces. */
|
|
337
|
+
readonly supersedes?: string;
|
|
338
|
+
/** External reference citations with optional locator (`citation`). */
|
|
339
|
+
readonly references?: readonly string[];
|
|
340
|
+
/** Org free-form metadata, never validated. */
|
|
341
|
+
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
342
|
+
/** Allowlisted ecosystem keys (preserved verbatim, not validated). */
|
|
343
|
+
readonly extra?: Readonly<Record<string, unknown>>;
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Observed document properties — derived, never authored.
|
|
347
|
+
*
|
|
348
|
+
* The H1, first paragraph, git history, and filesystem are the
|
|
349
|
+
* authoritative sources. These fields are populated progressively as
|
|
350
|
+
* observation support lands.
|
|
351
|
+
*/
|
|
352
|
+
export interface DocumentProperties {
|
|
353
|
+
/** H1 heading, or filename stem fallback. */
|
|
354
|
+
readonly title?: string;
|
|
355
|
+
/** Merge-to-main count (starts at `0`). */
|
|
356
|
+
readonly revision?: number;
|
|
357
|
+
/** Contributors from `project.yaml` or git history. */
|
|
358
|
+
readonly authors?: readonly string[];
|
|
359
|
+
/** First commit timestamp, or filesystem ctime fallback. */
|
|
360
|
+
readonly createdAt?: string;
|
|
361
|
+
/** Last merge-commit timestamp, or filesystem mtime fallback. */
|
|
362
|
+
readonly modifiedAt?: string;
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* A parsed MarkSpec document.
|
|
366
|
+
*
|
|
367
|
+
* A Markdown (or source) file containing entries, optionally preceded by
|
|
368
|
+
* YAML front matter. Document metadata is split into authored `attributes`
|
|
369
|
+
* (front matter) and observed `properties` (H1, git, filesystem).
|
|
370
|
+
*/
|
|
371
|
+
export interface Document {
|
|
372
|
+
/** File path (absolute or project-relative). */
|
|
373
|
+
readonly file: string;
|
|
374
|
+
/** Document-level attributes from front matter. */
|
|
375
|
+
readonly attributes: DocumentAttributes;
|
|
376
|
+
/** Observed document properties. */
|
|
377
|
+
readonly properties: DocumentProperties;
|
|
378
|
+
}
|
|
379
|
+
export type { AttrDecl, Cardinality, DocTypeDef, EffectiveProfile, EffectiveShapeScope, EffectiveTypeDef, EnforcementMode, InverseDecl, LoadedProfile, ProfileChain, ProfileId, ProfileManifest, ProfileSpecifier, ProvenancedMap, ProvenancedMapEntry, ProvenancedValue, TargetMatcher, TraceRule, TypeDef, ValueType, } from "./profile.js";
|
|
380
|
+
export { LIST_VALUE_TYPES, VALUE_TYPES } from "./profile.js";
|
|
152
381
|
//# sourceMappingURL=mod.d.ts.map
|
package/esm/model/mod.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/model/mod.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/model/mod.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,wBAAwB,GACzB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAMrD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC;AAM/B;;;;;GAKG;AACH,MAAM,MAAM,IAAI,GAAG,MAAM,CAAC;AAM1B,6CAA6C;AAC7C,MAAM,WAAW,cAAc;IAC7B,8CAA8C;I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AO,CAAC,CAAC,CAAC;CACpD;AAED;;;;;;GAMG;AACH,MAAM,WAAW,kBAAkB;IACjC,6CAA6C;IAC7C,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,2CAA2C;IAC3C,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,uDAAuD;IACvD,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,4DAA4D;IAC5D,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,iEAAiE;IACjE,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED;;;;;;GAMG;AACH,MAAM,WAAW,QAAQ;IACvB,gDAAgD;IAChD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,mDAAmD;IACnD,QAAQ,CAAC,UAAU,EAAE,kBAAkB,CAAC;IACxC,oCAAoC;IACpC,QAAQ,CAAC,UAAU,EAAE,kBAAkB,CAAC;CACzC;AAMD,YAAY,EACV,QAAQ,EACR,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,aAAa,EACb,YAAY,EACZ,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,aAAa,EACb,SAAS,EACT,OAAO,EACP,SAAS,GACV,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC"}
|
package/esm/model/mod.js
CHANGED
|
@@ -3,6 +3,32 @@
|
|
|
3
3
|
*
|
|
4
4
|
* MarkSpec document model — AST types, ID types, and project configuration.
|
|
5
5
|
*/
|
|
6
|
+
export { ATTRIBUTE_CATALOG, attributeSpec, UNIVERSAL_ATTRIBUTE_KEYS, } from "./attributes.js";
|
|
7
|
+
/** Core-reserved identity attribute name. */
|
|
8
|
+
export const IDENTITY_KEY = "Id";
|
|
9
|
+
/** Regex matching a bare ULID (identified-entry `Id:` value). */
|
|
10
|
+
export const ULID_RE = /^[0-9A-HJKMNP-TV-Z]{26}$/;
|
|
11
|
+
/**
|
|
12
|
+
* Regex matching a scheme-qualified URI (RFC 3986 §3.1 scheme).
|
|
13
|
+
*
|
|
14
|
+
* A scheme starts with a letter, followed by letters/digits/`+`/`-`/`.`,
|
|
15
|
+
* terminated by `:`. This is the gate that distinguishes a URI value from
|
|
16
|
+
* a bare slug in an `Id:` attribute.
|
|
17
|
+
*/
|
|
18
|
+
export const URI_SCHEME_RE = /^[A-Za-z][A-Za-z0-9+\-.]*:/;
|
|
19
|
+
/**
|
|
20
|
+
* Decide the shape of an entry from its `Id:` value.
|
|
21
|
+
*
|
|
22
|
+
* Returns `undefined` for inputs that are neither a bare ULID nor a
|
|
23
|
+
* scheme-qualified URI — the caller emits a validation error.
|
|
24
|
+
*/
|
|
25
|
+
export function shapeFromIdValue(value) {
|
|
26
|
+
if (ULID_RE.test(value))
|
|
27
|
+
return "identified";
|
|
28
|
+
if (URI_SCHEME_RE.test(value))
|
|
29
|
+
return "referenced";
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
6
32
|
// ---------------------------------------------------------------------------
|
|
7
33
|
// Project configuration
|
|
8
34
|
// ---------------------------------------------------------------------------
|
|
@@ -11,7 +37,6 @@ export const REFHUB_URL = "https://driftsys.github.io/refhub";
|
|
|
11
37
|
/** Default configuration used when no `project.yaml` is found. */
|
|
12
38
|
export const DEFAULT_PROJECT_CONFIG = {
|
|
13
39
|
name: "",
|
|
14
|
-
domain: "",
|
|
15
40
|
version: "0.0.0",
|
|
16
41
|
labels: [],
|
|
17
42
|
parents: [],
|
|
@@ -45,3 +70,4 @@ export class ConfigError extends Error {
|
|
|
45
70
|
this.fieldErrors = fieldErrors;
|
|
46
71
|
}
|
|
47
72
|
}
|
|
73
|
+
export { LIST_VALUE_TYPES, VALUE_TYPES } from "./profile.js";
|