@descryy/ir 0.1.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/LICENSE +21 -0
- package/dist/capabilities.d.ts +83 -0
- package/dist/capabilities.d.ts.map +1 -0
- package/dist/capabilities.js +91 -0
- package/dist/capabilities.js.map +1 -0
- package/dist/conformance/bind.d.ts +82 -0
- package/dist/conformance/bind.d.ts.map +1 -0
- package/dist/conformance/bind.js +157 -0
- package/dist/conformance/bind.js.map +1 -0
- package/dist/conformance/cli.d.ts +25 -0
- package/dist/conformance/cli.d.ts.map +1 -0
- package/dist/conformance/cli.js +137 -0
- package/dist/conformance/cli.js.map +1 -0
- package/dist/conformance/compare.d.ts +74 -0
- package/dist/conformance/compare.d.ts.map +1 -0
- package/dist/conformance/compare.js +140 -0
- package/dist/conformance/compare.js.map +1 -0
- package/dist/conformance/compose.d.ts +79 -0
- package/dist/conformance/compose.d.ts.map +1 -0
- package/dist/conformance/compose.js +167 -0
- package/dist/conformance/compose.js.map +1 -0
- package/dist/conformance/golden.d.ts +110 -0
- package/dist/conformance/golden.d.ts.map +1 -0
- package/dist/conformance/golden.js +252 -0
- package/dist/conformance/golden.js.map +1 -0
- package/dist/conformance/index.d.ts +26 -0
- package/dist/conformance/index.d.ts.map +1 -0
- package/dist/conformance/index.js +18 -0
- package/dist/conformance/index.js.map +1 -0
- package/dist/conformance/manifest-check.d.ts +78 -0
- package/dist/conformance/manifest-check.d.ts.map +1 -0
- package/dist/conformance/manifest-check.js +149 -0
- package/dist/conformance/manifest-check.js.map +1 -0
- package/dist/conformance/manifest.d.ts +83 -0
- package/dist/conformance/manifest.d.ts.map +1 -0
- package/dist/conformance/manifest.js +158 -0
- package/dist/conformance/manifest.js.map +1 -0
- package/dist/conformance/report.d.ts +14 -0
- package/dist/conformance/report.d.ts.map +1 -0
- package/dist/conformance/report.js +87 -0
- package/dist/conformance/report.js.map +1 -0
- package/dist/conformance/run.d.ts +172 -0
- package/dist/conformance/run.d.ts.map +1 -0
- package/dist/conformance/run.js +626 -0
- package/dist/conformance/run.js.map +1 -0
- package/dist/contracts.d.ts +198 -0
- package/dist/contracts.d.ts.map +1 -0
- package/dist/contracts.js +10 -0
- package/dist/contracts.js.map +1 -0
- package/dist/contradiction.d.ts +112 -0
- package/dist/contradiction.d.ts.map +1 -0
- package/dist/contradiction.js +97 -0
- package/dist/contradiction.js.map +1 -0
- package/dist/finding.d.ts +567 -0
- package/dist/finding.d.ts.map +1 -0
- package/dist/finding.js +491 -0
- package/dist/finding.js.map +1 -0
- package/dist/hypothesis.d.ts +130 -0
- package/dist/hypothesis.d.ts.map +1 -0
- package/dist/hypothesis.js +116 -0
- package/dist/hypothesis.js.map +1 -0
- package/dist/identity.d.ts +295 -0
- package/dist/identity.d.ts.map +1 -0
- package/dist/identity.js +404 -0
- package/dist/identity.js.map +1 -0
- package/dist/index.d.ts +34 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/ir.d.ts +360 -0
- package/dist/ir.d.ts.map +1 -0
- package/dist/ir.js +76 -0
- package/dist/ir.js.map +1 -0
- package/dist/model-tables.d.ts +111 -0
- package/dist/model-tables.d.ts.map +1 -0
- package/dist/model-tables.js +103 -0
- package/dist/model-tables.js.map +1 -0
- package/dist/normalise.d.ts +114 -0
- package/dist/normalise.d.ts.map +1 -0
- package/dist/normalise.js +603 -0
- package/dist/normalise.js.map +1 -0
- package/dist/reliability.d.ts +89 -0
- package/dist/reliability.d.ts.map +1 -0
- package/dist/reliability.js +181 -0
- package/dist/reliability.js.map +1 -0
- package/dist/tool-surface.d.ts +131 -0
- package/dist/tool-surface.d.ts.map +1 -0
- package/dist/tool-surface.js +133 -0
- package/dist/tool-surface.js.map +1 -0
- package/dist/vocabulary.d.ts +73 -0
- package/dist/vocabulary.d.ts.map +1 -0
- package/dist/vocabulary.js +150 -0
- package/dist/vocabulary.js.map +1 -0
- package/package.json +27 -0
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The canonical graph vocabulary: 15 node types, 15 edge types.
|
|
3
|
+
*
|
|
4
|
+
* FROZEN. See DEC-003. Adding a type multiplies traversal, ranking, storage and
|
|
5
|
+
* governance work — new capabilities are new *queries* over these edges, not new
|
|
6
|
+
* types. Extending either list requires a decision entry in DECISIONS.md, and the
|
|
7
|
+
* arity tests in test/vocabulary.test.ts will fail until the counts there are
|
|
8
|
+
* deliberately updated, which makes the change visible in review.
|
|
9
|
+
*
|
|
10
|
+
* Declared as `as const` arrays with derived unions rather than TS enums:
|
|
11
|
+
* enums are not erasable syntax and Node's type stripping cannot run them
|
|
12
|
+
* (tsconfig `erasableSyntaxOnly` enforces this).
|
|
13
|
+
*/
|
|
14
|
+
export const NODE_TYPES = [
|
|
15
|
+
"FILE",
|
|
16
|
+
"FUNCTION",
|
|
17
|
+
"CLASS",
|
|
18
|
+
"MODULE",
|
|
19
|
+
"API_ENDPOINT",
|
|
20
|
+
"API_ROUTE",
|
|
21
|
+
"DATABASE_TABLE",
|
|
22
|
+
"DATABASE_COLUMN",
|
|
23
|
+
"MODEL",
|
|
24
|
+
"DTO",
|
|
25
|
+
"COMPONENT",
|
|
26
|
+
"PAGE",
|
|
27
|
+
"TEST_CASE",
|
|
28
|
+
"INCIDENT",
|
|
29
|
+
"FIX_PATTERN",
|
|
30
|
+
];
|
|
31
|
+
export const EDGE_TYPES = [
|
|
32
|
+
"CALLS",
|
|
33
|
+
"IMPORTS",
|
|
34
|
+
"READS",
|
|
35
|
+
"WRITES",
|
|
36
|
+
"RETURNS",
|
|
37
|
+
"IMPLEMENTS",
|
|
38
|
+
"INHERITS",
|
|
39
|
+
"USES_API",
|
|
40
|
+
"SERVES_API",
|
|
41
|
+
/**
|
|
42
|
+
* A structural dependency on a type declaration — DEC-061.
|
|
43
|
+
*
|
|
44
|
+
* `A --USES_TYPE--> B` means A's *shape or signature* names B, so a change to
|
|
45
|
+
* B's shape may break A. It covers:
|
|
46
|
+
*
|
|
47
|
+
* interface -> interface a field's declared type
|
|
48
|
+
* interface -> type alias likewise
|
|
49
|
+
* class -> interface a member's declared type
|
|
50
|
+
* function -> type a parameter's type
|
|
51
|
+
* function -> type a return type
|
|
52
|
+
* any -> type a generic argument or constraint
|
|
53
|
+
*
|
|
54
|
+
* Spelled out because an edge whose meaning each adapter guesses at is worse
|
|
55
|
+
* than no edge: two adapters disagreeing here makes every threshold above them
|
|
56
|
+
* language-dependent.
|
|
57
|
+
*
|
|
58
|
+
* **It is not `READS`**, which is runtime consumption of a member — a type can
|
|
59
|
+
* be named in a signature without a single value ever being read. **It is not
|
|
60
|
+
* `PROPAGATES_TO`**, which is data lineage. **It is not `INHERITS`/
|
|
61
|
+
* `IMPLEMENTS`**, which are subtyping: a field of type `X` is not a subtype
|
|
62
|
+
* of `X`.
|
|
63
|
+
*
|
|
64
|
+
* It exists because none of the other 14 can express it at *symbol*
|
|
65
|
+
* granularity. `IMPORTS` is module-to-module and knows only that one file
|
|
66
|
+
* depends on another, which is file-level blast radius — the thing
|
|
67
|
+
* symbol-level analysis is supposed to beat.
|
|
68
|
+
*/
|
|
69
|
+
"USES_TYPE",
|
|
70
|
+
"PROPAGATES_TO",
|
|
71
|
+
"TESTS",
|
|
72
|
+
"FIXED_BY",
|
|
73
|
+
"CHANGES_WITH",
|
|
74
|
+
"INCIDENT_CORRELATED",
|
|
75
|
+
];
|
|
76
|
+
const NODE_TYPE_SET = new Set(NODE_TYPES);
|
|
77
|
+
const EDGE_TYPE_SET = new Set(EDGE_TYPES);
|
|
78
|
+
export function isNodeType(value) {
|
|
79
|
+
return NODE_TYPE_SET.has(value);
|
|
80
|
+
}
|
|
81
|
+
export function isEdgeType(value) {
|
|
82
|
+
return EDGE_TYPE_SET.has(value);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Node types that have no source file and no line range.
|
|
86
|
+
*
|
|
87
|
+
* `API_ENDPOINT` is the cross-language join node — it is written by two adapters
|
|
88
|
+
* that never share a line of code, so it belongs to neither file. `INCIDENT` and
|
|
89
|
+
* `FIX_PATTERN` come from git history rather than from source.
|
|
90
|
+
*
|
|
91
|
+
* See DEC-014: architecture §11A.4 typed `file` and `range` as required, which
|
|
92
|
+
* made the join node unrepresentable.
|
|
93
|
+
*/
|
|
94
|
+
export const FILELESS_NODE_TYPES = [
|
|
95
|
+
"API_ENDPOINT",
|
|
96
|
+
"INCIDENT",
|
|
97
|
+
"FIX_PATTERN",
|
|
98
|
+
];
|
|
99
|
+
const FILELESS_SET = new Set(FILELESS_NODE_TYPES);
|
|
100
|
+
export function isFilelessNodeType(type) {
|
|
101
|
+
return FILELESS_SET.has(type);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Node types that are a **declared type** — something a reference can name and a
|
|
105
|
+
* value can be an instance of.
|
|
106
|
+
*
|
|
107
|
+
* `MODEL` and `DTO` are not alternatives to `CLASS`; they are a `CLASS` that a
|
|
108
|
+
* framework extractor found extra evidence about. An ORM model is still a type:
|
|
109
|
+
* it is still imported, still named in annotations, still inherited from, still
|
|
110
|
+
* returned. The extra evidence is a persistence mapping or a transport boundary,
|
|
111
|
+
* and it changes what the node *means*, not what it *is*.
|
|
112
|
+
*
|
|
113
|
+
* This predicate exists because every adapter writes `type === "CLASS"` to ask
|
|
114
|
+
* "is this a type?", and there were twenty-one such sites across two adapters
|
|
115
|
+
* before the first framework extractor landed. Promoting one class to `MODEL`
|
|
116
|
+
* silently withdrew its `USES_TYPE`, `INHERITS` and `RETURNS` edges at every one
|
|
117
|
+
* of them — a recall collapse with no error, no rejection and no ledger row,
|
|
118
|
+
* which is the failure mode rule 7 exists to forbid.
|
|
119
|
+
*
|
|
120
|
+
* It is a query over the frozen vocabulary, not an extension of it. See DEC-093.
|
|
121
|
+
*/
|
|
122
|
+
export const TYPE_LIKE_NODE_TYPES = ["CLASS", "MODEL", "DTO"];
|
|
123
|
+
const TYPE_LIKE_SET = new Set(TYPE_LIKE_NODE_TYPES);
|
|
124
|
+
export function isTypeLikeNodeType(type) {
|
|
125
|
+
return TYPE_LIKE_SET.has(type);
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Node types that are a **callable declaration** — something a call site can
|
|
129
|
+
* reach and a call graph can traverse.
|
|
130
|
+
*
|
|
131
|
+
* The same relationship `TYPE_LIKE_NODE_TYPES` describes, one row down. A React
|
|
132
|
+
* component is a function that a framework calls; `<OrderPage />` is a call in
|
|
133
|
+
* every sense a call graph cares about, which is the argument this codebase
|
|
134
|
+
* already made when it decided `post = (…) => …` is a method. `PAGE` is a
|
|
135
|
+
* component with a route attached and is callable for the same reason.
|
|
136
|
+
*
|
|
137
|
+
* `TEST_CASE` is deliberately absent. It is callable, but every site that
|
|
138
|
+
* distinguishes it does so because a call *inside* a test is coverage rather
|
|
139
|
+
* than a call-graph edge — folding it in here would erase that distinction at
|
|
140
|
+
* exactly the sites that exist to make it.
|
|
141
|
+
*
|
|
142
|
+
* See DEC-093, and the note there about what promotion costs when a kind check
|
|
143
|
+
* is written as an equality.
|
|
144
|
+
*/
|
|
145
|
+
export const CALLABLE_NODE_TYPES = ["FUNCTION", "COMPONENT", "PAGE"];
|
|
146
|
+
const CALLABLE_SET = new Set(CALLABLE_NODE_TYPES);
|
|
147
|
+
export function isCallableNodeType(type) {
|
|
148
|
+
return CALLABLE_SET.has(type);
|
|
149
|
+
}
|
|
150
|
+
//# sourceMappingURL=vocabulary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vocabulary.js","sourceRoot":"","sources":["../src/vocabulary.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,MAAM;IACN,UAAU;IACV,OAAO;IACP,QAAQ;IACR,cAAc;IACd,WAAW;IACX,gBAAgB;IAChB,iBAAiB;IACjB,OAAO;IACP,KAAK;IACL,WAAW;IACX,MAAM;IACN,WAAW;IACX,UAAU;IACV,aAAa;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CAAC,UAAU,EAAE,WAAW,EAAE,MAAM,CAAwC,CAAC;AAE5G,MAAM,YAAY,GAAwB,IAAI,GAAG,CAAC,mBAAmB,CAAC,CAAC;AAEvE,MAAM,UAAU,kBAAkB,CAAC,IAAc;IAC/C,OAAO,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AAChC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@descryy/ir",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Canonical IR, graph vocabulary, node identity, Normaliser, adapter contracts, conformance harness. Zero runtime dependencies by design.",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": ">=22.5"
|
|
9
|
+
},
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"default": "./dist/index.js"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"registry": "https://registry.npmjs.org",
|
|
21
|
+
"access": "public"
|
|
22
|
+
},
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "tsc -b"
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {}
|
|
27
|
+
}
|