@weftlet/toolkit 0.6.0 → 0.7.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 +168 -1
- package/THIRD_PARTY_NOTICES.md +1 -1
- package/dist/application/application.d.ts +10 -0
- package/dist/application/application.js +20 -0
- package/dist/application/document-code-bindings.d.ts +11 -0
- package/dist/application/document-code-bindings.js +25 -0
- package/dist/application/document-obligations.d.ts +8 -0
- package/dist/application/document-obligations.js +11 -0
- package/dist/application/draft-facts.d.ts +3 -0
- package/dist/application/draft-facts.js +37 -0
- package/dist/application/extraction-identity.d.ts +2 -2
- package/dist/application/extraction-identity.js +7 -1
- package/dist/application/extractor-results.d.ts +6 -0
- package/dist/application/extractor-results.js +6 -0
- package/dist/application/hydrator.js +20 -3
- package/dist/application/mapping-proposals.d.ts +108 -0
- package/dist/application/mapping-proposals.js +142 -0
- package/dist/application/mapping-service.d.ts +2 -0
- package/dist/application/mapping-service.js +5 -0
- package/dist/application/overlay.js +36 -22
- package/dist/application/saved-code-coverage.d.ts +40 -0
- package/dist/application/saved-code-coverage.js +20 -0
- package/dist/application/saved-compatibility.d.ts +38 -0
- package/dist/application/saved-compatibility.js +20 -0
- package/dist/application/saved-evidence.d.ts +17 -11
- package/dist/application/saved-evidence.js +44 -40
- package/dist/application/saved-exploration.d.ts +57 -0
- package/dist/application/saved-exploration.js +21 -0
- package/dist/application/saved-paths.d.ts +58 -0
- package/dist/application/saved-paths.js +20 -0
- package/dist/extraction/call-syntax.d.ts +18 -0
- package/dist/extraction/call-syntax.js +61 -0
- package/dist/extraction/canonical-document-links.d.ts +5 -1
- package/dist/extraction/canonical-document-links.js +4 -4
- package/dist/extraction/code-inventory.d.ts +6 -0
- package/dist/extraction/code-inventory.js +26 -0
- package/dist/extraction/document-code-bindings.d.ts +14 -0
- package/dist/extraction/document-code-bindings.js +121 -0
- package/dist/extraction/document-obligations.d.ts +12 -0
- package/dist/extraction/document-obligations.js +112 -0
- package/dist/extraction/mapping-candidates.d.ts +13 -0
- package/dist/extraction/mapping-candidates.js +46 -0
- package/dist/extraction/mapping-output.d.ts +75 -0
- package/dist/extraction/mapping-output.js +53 -0
- package/dist/extraction/mapping-plan.d.ts +7 -0
- package/dist/extraction/mapping-plan.js +117 -0
- package/dist/extraction/mapping-prompt.d.ts +2 -0
- package/dist/extraction/mapping-prompt.js +17 -0
- package/dist/extraction/mapping-provider.d.ts +15 -0
- package/dist/extraction/mapping-provider.js +60 -0
- package/dist/extraction/mapping-request.d.ts +3 -0
- package/dist/extraction/mapping-request.js +32 -0
- package/dist/extraction/ontology.js +2 -2
- package/dist/extraction/routing.js +5 -20
- package/dist/extraction/scip-occurrences.d.ts +3 -0
- package/dist/extraction/scip-occurrences.js +102 -0
- package/dist/extraction/scip-ranges.d.ts +6 -0
- package/dist/extraction/scip-ranges.js +31 -0
- package/dist/extraction/scip-runtime.d.ts +39 -0
- package/dist/extraction/scip-runtime.js +8 -0
- package/dist/extraction/scip-symbols.d.ts +21 -0
- package/dist/extraction/scip-symbols.js +91 -0
- package/dist/extraction/semantic.d.ts +1 -1
- package/dist/extraction/semantic.js +5 -17
- package/dist/extraction/static-calls.d.ts +10 -0
- package/dist/extraction/static-calls.js +133 -0
- package/dist/extraction/static.d.ts +3 -20
- package/dist/extraction/static.js +33 -104
- package/dist/extraction/symbol-resolution.d.ts +12 -0
- package/dist/extraction/symbol-resolution.js +51 -0
- package/dist/extraction/symbol-selectors.d.ts +11 -0
- package/dist/extraction/symbol-selectors.js +51 -0
- package/dist/graph/binding-rdf.d.ts +7 -0
- package/dist/graph/binding-rdf.js +109 -0
- package/dist/graph/call-rdf.d.ts +4 -0
- package/dist/graph/call-rdf.js +94 -0
- package/dist/graph/call-shapes.d.ts +2 -0
- package/dist/graph/call-shapes.js +28 -0
- package/dist/graph/code-coverage-projection.d.ts +9 -0
- package/dist/graph/code-coverage-projection.js +117 -0
- package/dist/graph/code-coverage-renderer.d.ts +2 -0
- package/dist/graph/code-coverage-renderer.js +15 -0
- package/dist/graph/code-coverage-request.d.ts +6 -0
- package/dist/graph/code-coverage-request.js +19 -0
- package/dist/graph/code-coverage.d.ts +6 -0
- package/dist/graph/code-coverage.js +54 -0
- package/dist/graph/code-description.d.ts +4 -0
- package/dist/graph/code-description.js +24 -0
- package/dist/graph/code-rdf.d.ts +5 -0
- package/dist/graph/code-rdf.js +72 -0
- package/dist/graph/compatibility-context.d.ts +2 -0
- package/dist/graph/compatibility-context.js +18 -0
- package/dist/graph/compatibility-renderer.d.ts +2 -0
- package/dist/graph/compatibility-renderer.js +45 -0
- package/dist/graph/compatibility-request.d.ts +3 -0
- package/dist/graph/compatibility-request.js +18 -0
- package/dist/graph/compatibility.d.ts +7 -0
- package/dist/graph/compatibility.js +67 -0
- package/dist/graph/constraint-comparison.d.ts +7 -0
- package/dist/graph/constraint-comparison.js +49 -0
- package/dist/graph/coverage.d.ts +2 -2
- package/dist/graph/coverage.js +8 -3
- package/dist/graph/diagnostics.d.ts +1 -1
- package/dist/graph/diagnostics.js +10 -6
- package/dist/graph/evidence-description.d.ts +3 -0
- package/dist/graph/evidence-description.js +13 -0
- package/dist/graph/identity-preflight.js +1 -1
- package/dist/graph/neighborhood-renderer.d.ts +2 -0
- package/dist/graph/neighborhood-renderer.js +38 -0
- package/dist/graph/neighborhood-request.d.ts +9 -0
- package/dist/graph/neighborhood-request.js +37 -0
- package/dist/graph/neighborhood.d.ts +8 -0
- package/dist/graph/neighborhood.js +100 -0
- package/dist/graph/obligation-rdf.d.ts +5 -0
- package/dist/graph/obligation-rdf.js +67 -0
- package/dist/graph/obligation-shapes.d.ts +2 -0
- package/dist/graph/obligation-shapes.js +32 -0
- package/dist/graph/path-request.d.ts +11 -0
- package/dist/graph/path-request.js +24 -0
- package/dist/graph/path-search.d.ts +45 -0
- package/dist/graph/path-search.js +101 -0
- package/dist/graph/paths-renderer.d.ts +2 -0
- package/dist/graph/paths-renderer.js +36 -0
- package/dist/graph/paths.d.ts +7 -0
- package/dist/graph/paths.js +74 -0
- package/dist/graph/query.js +23 -6
- package/dist/graph/rdf.js +26 -0
- package/dist/graph/shacl-shapes.js +70 -0
- package/dist/graph/snapshot-context.d.ts +3 -0
- package/dist/graph/snapshot-context.js +8 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +22 -0
- package/dist/infrastructure/artifact-paths.d.ts +4 -0
- package/dist/infrastructure/artifact-paths.js +14 -0
- package/dist/infrastructure/json-digest.d.ts +2 -0
- package/dist/infrastructure/json-digest.js +3 -0
- package/dist/infrastructure/unique-json.d.ts +2 -0
- package/dist/infrastructure/unique-json.js +20 -0
- package/dist/interfaces/cli.js +33 -1
- package/dist/interfaces/code-coverage.d.ts +46 -0
- package/dist/interfaces/code-coverage.js +18 -0
- package/dist/interfaces/graph-compatibility.d.ts +35 -0
- package/dist/interfaces/graph-compatibility.js +21 -0
- package/dist/interfaces/graph-exploration.d.ts +59 -0
- package/dist/interfaces/graph-exploration.js +27 -0
- package/dist/interfaces/graph-paths.d.ts +77 -0
- package/dist/interfaces/graph-paths.js +31 -0
- package/dist/interfaces/graph-query-args.d.ts +2 -0
- package/dist/interfaces/graph-query-args.js +25 -0
- package/dist/interfaces/mapping-proposals.d.ts +204 -0
- package/dist/interfaces/mapping-proposals.js +74 -0
- package/dist/interfaces/mcp.js +31 -3
- package/dist/storage/mapping-proposals.d.ts +9 -0
- package/dist/storage/mapping-proposals.js +42 -0
- package/dist/storage/storage.js +41 -13
- package/dist/visualization/evidence-sources.d.ts +6 -0
- package/dist/visualization/evidence-sources.js +19 -0
- package/dist/visualization/viewer-interaction.d.ts +5 -8
- package/dist/visualization/viewer-interaction.js +46 -44
- package/dist/visualization/visualization.js +14 -5
- package/docs/1.0-WORK-QUEUE.md +38 -0
- package/docs/ADR-028-bounded-artifact-paths.md +58 -0
- package/docs/ADR-029-exact-graph-neighborhoods.md +70 -0
- package/docs/ADR-030-bounded-evidence-paths.md +97 -0
- package/docs/ADR-031-code-extractor-selection.md +91 -0
- package/docs/ADR-032-scip-code-evidence.md +73 -0
- package/docs/ADR-033-document-symbol-bindings.md +83 -0
- package/docs/ADR-034-mapping-gaps.md +80 -0
- package/docs/ADR-035-static-call-evidence.md +78 -0
- package/docs/ADR-036-contract-obligation-declarations.md +124 -0
- package/docs/ADR-037-selected-contract-compatibility.md +93 -0
- package/docs/ADR-038-monorepo-code-coverage.md +105 -0
- package/docs/ADR-039-mapping-proposals.md +119 -0
- package/docs/CONSUMER-TRIAL.md +6 -4
- package/docs/GRAPHIFY-EVALUATION.md +87 -0
- package/docs/PRE-1.0-BASELINE.md +141 -0
- package/docs/RELEASE-1.0-PLAN.md +37 -15
- package/docs/RELEASING.md +3 -3
- package/docs/ROADMAP.md +39 -11
- package/docs/VALIDATION.md +501 -0
- package/docs/assessments/pre-1.0-2026-10-28.json +200 -0
- package/docs/extraction-manifest.json +258 -23
- package/package.json +8 -4
- package/templates/context-graph-development/SKILL.md +30 -1
package/dist/graph/rdf.js
CHANGED
|
@@ -6,6 +6,10 @@ import { stableJson } from "../infrastructure/util.js";
|
|
|
6
6
|
import { createRequire } from 'node:module';
|
|
7
7
|
import { CG, RDF, XSD, evidenceShapes } from './shacl-shapes.js';
|
|
8
8
|
import { measureValidationPhase } from './validation-progress.js';
|
|
9
|
+
import { addBindingEvidence, bindingEvidenceIssues } from './binding-rdf.js';
|
|
10
|
+
import { addCallEvidence, callEvidenceIssues } from './call-rdf.js';
|
|
11
|
+
import { addObligationEvidence, obligationEvidenceIssues } from './obligation-rdf.js';
|
|
12
|
+
import { addCodeEvidence, codeEvidenceIssues, invalidCodeRange } from './code-rdf.js';
|
|
9
13
|
const { namedNode: iri, literal } = DataFactory;
|
|
10
14
|
export { CG } from './shacl-shapes.js';
|
|
11
15
|
export const nodeIri = (id) => `urn:context-graph:node:${encodeURIComponent(id)}`;
|
|
@@ -53,6 +57,10 @@ export class RdfEvidenceGraph {
|
|
|
53
57
|
this.dataset.addQuad(record, iri(CG + p), literal(String(value), iri(XSD + 'integer')));
|
|
54
58
|
}
|
|
55
59
|
this.dataset.addQuad(record, iri(CG + 'confidence'), literal(String(fact.confidence), iri(XSD + 'decimal')));
|
|
60
|
+
addCodeEvidence(this.dataset, record, fact, nodeIri);
|
|
61
|
+
addBindingEvidence(this.dataset, record, fact, factIri);
|
|
62
|
+
addCallEvidence(this.dataset, record, fact, factIri);
|
|
63
|
+
addObligationEvidence(this.dataset, record, fact);
|
|
56
64
|
for (const node of [fact.subject, fact.object]) {
|
|
57
65
|
const term = iri(nodeIri(node.id));
|
|
58
66
|
this.dataset.addQuad(term, iri(RDF + 'type'), iri(CG + 'Node'));
|
|
@@ -92,7 +100,25 @@ export class RdfEvidenceGraph {
|
|
|
92
100
|
path: result.path?.value,
|
|
93
101
|
message: result.message.map((message) => message.value).join('; '),
|
|
94
102
|
}));
|
|
103
|
+
const byId = new Map(this.snapshot.facts.map(fact => [fact.id, fact]));
|
|
95
104
|
for (const fact of this.snapshot.facts) {
|
|
105
|
+
for (const message of obligationEvidenceIssues(fact, this.snapshot.manifest.repositoryId))
|
|
106
|
+
issues.push({ category: 'extraction-gap',
|
|
107
|
+
focus: factIri(fact.id), path: CG + 'obligationRole', message });
|
|
108
|
+
for (const message of callEvidenceIssues(fact, byId))
|
|
109
|
+
issues.push({ category: 'extraction-gap',
|
|
110
|
+
focus: factIri(fact.id), path: CG + 'callTarget', message });
|
|
111
|
+
for (const message of bindingEvidenceIssues(fact, byId))
|
|
112
|
+
issues.push({ category: 'extraction-gap',
|
|
113
|
+
focus: factIri(fact.id), path: CG + 'bindingDefinition', message });
|
|
114
|
+
for (const message of codeEvidenceIssues(fact))
|
|
115
|
+
issues.push({ category: 'extraction-gap',
|
|
116
|
+
focus: factIri(fact.id), path: CG + 'codeRole', message });
|
|
117
|
+
if (invalidCodeRange(fact.provenance) ||
|
|
118
|
+
(fact.codeOccurrence?.declarationRange && invalidCodeRange(fact.codeOccurrence.declarationRange))) {
|
|
119
|
+
issues.push({ category: 'extraction-gap', focus: factIri(fact.id), path: CG + 'startColumn',
|
|
120
|
+
message: 'Invalid UTF-16 source range' });
|
|
121
|
+
}
|
|
96
122
|
if (fact.provenance.endLine < fact.provenance.startLine) {
|
|
97
123
|
issues.push({ category: 'extraction-gap', focus: factIri(fact.id), path: CG + 'endLine',
|
|
98
124
|
message: 'Citation ends before it starts' });
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { Parser } from 'n3';
|
|
2
|
+
import { callShapes } from './call-shapes.js';
|
|
3
|
+
import { obligationShapes } from './obligation-shapes.js';
|
|
2
4
|
export const CG = 'https://context-graph.dev/record#';
|
|
3
5
|
export const RDF = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#';
|
|
4
6
|
export const XSD = 'http://www.w3.org/2001/XMLSchema#';
|
|
@@ -8,6 +10,8 @@ export const evidenceShapes = new Parser().parse(`
|
|
|
8
10
|
@prefix rdf: <${RDF}>.
|
|
9
11
|
@prefix sh: <http://www.w3.org/ns/shacl#>.
|
|
10
12
|
@prefix xsd: <${XSD}>.
|
|
13
|
+
${callShapes}
|
|
14
|
+
${obligationShapes}
|
|
11
15
|
cg:FactShape a sh:NodeShape; sh:targetClass rdf:Statement;
|
|
12
16
|
sh:property [ sh:path cg:record; sh:minCount 1; sh:maxCount 1; sh:datatype xsd:string ];
|
|
13
17
|
sh:property [ sh:path rdf:subject; sh:minCount 1; sh:maxCount 1; sh:nodeKind sh:IRI ];
|
|
@@ -25,6 +29,72 @@ cg:FactShape a sh:NodeShape; sh:targetClass rdf:Statement;
|
|
|
25
29
|
cg:NodeShape a sh:NodeShape; sh:targetClass cg:Node;
|
|
26
30
|
sh:property [ sh:path cg:kind; sh:minCount 1; sh:maxCount 1 ].
|
|
27
31
|
|
|
32
|
+
cg:ColumnsShape a sh:NodeShape;
|
|
33
|
+
sh:targetSubjectsOf cg:startColumn, cg:endColumn, cg:columnEncoding;
|
|
34
|
+
sh:property [ sh:path cg:startColumn; sh:minCount 1; sh:maxCount 1; sh:datatype xsd:integer; sh:minInclusive 1 ];
|
|
35
|
+
sh:property [ sh:path cg:endColumn; sh:minCount 1; sh:maxCount 1; sh:datatype xsd:integer; sh:minInclusive 1 ];
|
|
36
|
+
sh:property [ sh:path cg:columnEncoding; sh:minCount 1; sh:maxCount 1; sh:in ("utf-16") ].
|
|
37
|
+
cg:CodeRangeShape a sh:NodeShape; sh:targetClass cg:CodeRange;
|
|
38
|
+
sh:property [ sh:path cg:startLine; sh:minCount 1; sh:maxCount 1; sh:datatype xsd:integer; sh:minInclusive 1 ];
|
|
39
|
+
sh:property [ sh:path cg:endLine; sh:minCount 1; sh:maxCount 1; sh:datatype xsd:integer; sh:minInclusive 1 ];
|
|
40
|
+
sh:property [ sh:path cg:columnEncoding; sh:minCount 1; sh:hasValue "utf-16" ].
|
|
41
|
+
cg:CodeOccurrenceShape a sh:NodeShape; sh:targetClass cg:CodeOccurrence; sh:targetSubjectsOf cg:codeRole;
|
|
42
|
+
sh:property [ sh:path cg:codeVersion; sh:minCount 1; sh:maxCount 1; sh:hasValue 1 ];
|
|
43
|
+
sh:property [ sh:path cg:codeRole; sh:minCount 1; sh:maxCount 1; sh:in ("definition" "reference") ];
|
|
44
|
+
sh:property [ sh:path cg:codeLocationKind; sh:minCount 1; sh:maxCount 1; sh:in ("name" "zero-width-anchor") ];
|
|
45
|
+
sh:property [ sh:path cg:codeNativeRoles; sh:minCount 1; sh:maxCount 1; sh:datatype xsd:integer; sh:minInclusive 0 ];
|
|
46
|
+
sh:property [ sh:path cg:columnEncoding; sh:minCount 1; sh:hasValue "utf-16" ];
|
|
47
|
+
sh:property [ sh:path cg:codeEnclosure; sh:minCount 1; sh:maxCount 1; sh:in ("native-range" "file" "ambiguous") ];
|
|
48
|
+
sh:property [ sh:path cg:enclosingSymbol; sh:maxCount 1; sh:class cg:CodeSymbol ];
|
|
49
|
+
sh:property [ sh:path cg:declarationRange; sh:maxCount 1; sh:class cg:CodeRange ];
|
|
50
|
+
sh:or (
|
|
51
|
+
[ sh:property [ sh:path cg:codeEnclosure; sh:hasValue "native-range" ]; sh:property [ sh:path cg:enclosingSymbol; sh:minCount 1 ] ]
|
|
52
|
+
[ sh:property [ sh:path cg:codeEnclosure; sh:in ("file" "ambiguous") ]; sh:property [ sh:path cg:enclosingSymbol; sh:maxCount 0 ] ]
|
|
53
|
+
);
|
|
54
|
+
sh:or (
|
|
55
|
+
[ sh:property [ sh:path cg:codeRole; sh:hasValue "definition" ]; sh:property [ sh:path rdf:subject; sh:class cg:CodeSymbol ]; sh:property [ sh:path rdf:predicate; sh:hasValue cg:definedBy ] ]
|
|
56
|
+
[ sh:property [ sh:path cg:codeRole; sh:hasValue "reference" ]; sh:property [ sh:path rdf:object; sh:class cg:CodeSymbol ]; sh:property [ sh:path rdf:predicate; sh:hasValue cg:references ] ]
|
|
57
|
+
).
|
|
58
|
+
cg:CodeSymbolShape a sh:NodeShape; sh:targetClass cg:CodeSymbol;
|
|
59
|
+
sh:property [ sh:path cg:kind; sh:hasValue "CodeSymbol" ];
|
|
60
|
+
sh:property [ sh:path cg:codeVersion; sh:minCount 1; sh:maxCount 1; sh:hasValue 1 ];
|
|
61
|
+
sh:property [ sh:path cg:codeProvider; sh:minCount 1; sh:maxCount 1; sh:datatype xsd:string; sh:minLength 1 ];
|
|
62
|
+
sh:property [ sh:path cg:codeRepository; sh:minCount 1; sh:maxCount 1; sh:datatype xsd:string; sh:minLength 1 ];
|
|
63
|
+
sh:property [ sh:path cg:nativeSymbol; sh:minCount 1; sh:maxCount 1; sh:datatype xsd:string; sh:minLength 1 ];
|
|
64
|
+
sh:property [ sh:path cg:codeResolution; sh:minCount 1; sh:maxCount 1; sh:in ("indexed-definition" "declaration-only" "no-indexed-definition") ];
|
|
65
|
+
sh:property [ sh:path cg:codeIdentityScope; sh:minCount 1; sh:maxCount 1; sh:in ("repository" "index-document") ];
|
|
66
|
+
sh:or (
|
|
67
|
+
[ sh:property [ sh:path cg:codeIdentityScope; sh:hasValue "repository" ]; sh:property [ sh:path cg:codeDocument; sh:maxCount 0 ]; sh:property [ sh:path cg:codeIndex; sh:maxCount 0 ] ]
|
|
68
|
+
[ sh:property [ sh:path cg:codeIdentityScope; sh:hasValue "index-document" ];
|
|
69
|
+
sh:property [ sh:path cg:codeDocument; sh:minCount 1; sh:maxCount 1; sh:datatype xsd:string; sh:minLength 1 ];
|
|
70
|
+
sh:property [ sh:path cg:codeIndex; sh:minCount 1; sh:maxCount 1; sh:datatype xsd:string; sh:minLength 1 ] ]
|
|
71
|
+
).
|
|
72
|
+
|
|
73
|
+
cg:DocumentCodeBindingShape a sh:NodeShape; sh:targetClass cg:DocumentCodeBinding;
|
|
74
|
+
sh:property [ sh:path cg:bindingVersion; sh:minCount 1; sh:maxCount 1; sh:hasValue 1 ];
|
|
75
|
+
sh:property [ sh:path cg:bindingMethod; sh:minCount 1; sh:maxCount 1; sh:hasValue "explicit-markdown" ];
|
|
76
|
+
sh:property [ sh:path <${CG}bindingSelector/path>; sh:minCount 1; sh:maxCount 1; sh:datatype xsd:string; sh:minLength 1 ];
|
|
77
|
+
sh:property [ sh:path <${CG}bindingSelector/symbol>; sh:minCount 1; sh:maxCount 1; sh:datatype xsd:string; sh:minLength 1 ];
|
|
78
|
+
sh:property [ sh:path cg:bindingDocument; sh:minCount 1; sh:class cg:BindingCitation ];
|
|
79
|
+
sh:property [ sh:path cg:bindingSelection; sh:minCount 1; sh:class cg:BindingCitation ];
|
|
80
|
+
sh:property [ sh:path cg:bindingDefinition; sh:minCount 1; sh:class cg:BindingCitation ];
|
|
81
|
+
sh:property [ sh:path cg:bindingSubject; sh:class cg:BindingCitation ];
|
|
82
|
+
sh:property [ sh:path rdf:object; sh:class cg:CodeSymbol ];
|
|
83
|
+
sh:property [ sh:path rdf:predicate; sh:in (cg:references cg:implementedBy cg:verifiedBy) ];
|
|
84
|
+
sh:property [ sh:path cg:authority; sh:in ("inferred" "draft") ];
|
|
85
|
+
sh:property [ sh:path cg:extractionReview; sh:minCount 1; sh:in ("deterministic" "unreviewed") ].
|
|
86
|
+
cg:BindingCitationShape a sh:NodeShape; sh:targetClass cg:BindingCitation;
|
|
87
|
+
sh:property [ sh:path cg:path; sh:minCount 1; sh:maxCount 1; sh:datatype xsd:string; sh:minLength 1 ];
|
|
88
|
+
sh:property [ sh:path cg:digest; sh:minCount 1; sh:maxCount 1; sh:datatype xsd:string; sh:minLength 1 ];
|
|
89
|
+
sh:property [ sh:path cg:commitSha; sh:minCount 1; sh:maxCount 1; sh:datatype xsd:string; sh:minLength 1 ];
|
|
90
|
+
sh:property [ sh:path cg:startLine; sh:minCount 1; sh:maxCount 1; sh:datatype xsd:integer; sh:minInclusive 1 ];
|
|
91
|
+
sh:property [ sh:path cg:endLine; sh:minCount 1; sh:maxCount 1; sh:datatype xsd:integer; sh:minInclusive 1 ];
|
|
92
|
+
sh:property [ sh:path cg:bindingFact; sh:maxCount 1; sh:class rdf:Statement ].
|
|
93
|
+
cg:BindingSelectorPositionShape a sh:NodeShape;
|
|
94
|
+
sh:targetSubjectsOf <${CG}bindingSelector/line>, <${CG}bindingSelector/column>;
|
|
95
|
+
sh:property [ sh:path <${CG}bindingSelector/line>; sh:minCount 1; sh:maxCount 1; sh:datatype xsd:integer; sh:minInclusive 1 ];
|
|
96
|
+
sh:property [ sh:path <${CG}bindingSelector/column>; sh:minCount 1; sh:maxCount 1; sh:datatype xsd:integer; sh:minInclusive 1 ].
|
|
97
|
+
|
|
28
98
|
# Optional source metadata targets only assertions that carry those predicates.
|
|
29
99
|
# Legacy facts do not acquire additional property or ownership consistency checks.
|
|
30
100
|
cg:SourceRoleShape a sh:NodeShape; sh:targetSubjectsOf cg:sourceRole;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** The saved identity/scope carried by exact graph queries; never resolve a new head. */
|
|
2
|
+
export function snapshotContext(manifest) {
|
|
3
|
+
return { snapshotId: manifest.snapshotId, commitSha: manifest.commitSha, contentDigest: manifest.contentDigest,
|
|
4
|
+
configurationDigest: manifest.configurationDigest, scope: manifest.scope, baseSha: manifest.baseSha,
|
|
5
|
+
overlayDigest: manifest.overlayDigest, overlayCapture: manifest.overlayCapture,
|
|
6
|
+
extractorVersions: manifest.extractorVersions,
|
|
7
|
+
...(manifest.documentSelection ? { documentSelection: manifest.documentSelection } : {}) };
|
|
8
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -20,3 +20,26 @@ export * from './extraction/document-traversal.js';
|
|
|
20
20
|
export * from './extraction/document-classification.js';
|
|
21
21
|
export * from './extraction/document-evidence.js';
|
|
22
22
|
export type { DocumentTraversalConfig } from './configuration/document-traversal.js';
|
|
23
|
+
export * from './graph/neighborhood.js';
|
|
24
|
+
export * from './graph/neighborhood-request.js';
|
|
25
|
+
export * from './graph/neighborhood-renderer.js';
|
|
26
|
+
export * from './graph/paths.js';
|
|
27
|
+
export * from './graph/path-request.js';
|
|
28
|
+
export * from './graph/paths-renderer.js';
|
|
29
|
+
export * from './extraction/document-code-bindings.js';
|
|
30
|
+
export * from './extraction/document-obligations.js';
|
|
31
|
+
export * from './graph/compatibility.js';
|
|
32
|
+
export * from './graph/compatibility-request.js';
|
|
33
|
+
export * from './graph/compatibility-renderer.js';
|
|
34
|
+
export * from './graph/code-coverage.js';
|
|
35
|
+
export * from './graph/code-coverage-projection.js';
|
|
36
|
+
export * from './graph/code-coverage-request.js';
|
|
37
|
+
export * from './graph/code-coverage-renderer.js';
|
|
38
|
+
export { MappingProposalService } from './application/mapping-proposals.js';
|
|
39
|
+
export { createMappingProposalService } from './application/mapping-service.js';
|
|
40
|
+
export type { MappingOperationOptions } from './application/mapping-proposals.js';
|
|
41
|
+
export { prepareMappingProposal } from './extraction/mapping-plan.js';
|
|
42
|
+
export { createMappingProvider, mappingProviderIdentity } from './extraction/mapping-provider.js';
|
|
43
|
+
export { parseMappingRequest } from './extraction/mapping-request.js';
|
|
44
|
+
export { validateMappingOutput } from './extraction/mapping-output.js';
|
|
45
|
+
export { FileMappingProposalStore } from './storage/mapping-proposals.js';
|
package/dist/index.js
CHANGED
|
@@ -20,3 +20,25 @@ export * from './application/document-coverage.js';
|
|
|
20
20
|
export * from './extraction/document-traversal.js';
|
|
21
21
|
export * from './extraction/document-classification.js';
|
|
22
22
|
export * from './extraction/document-evidence.js';
|
|
23
|
+
export * from './graph/neighborhood.js';
|
|
24
|
+
export * from './graph/neighborhood-request.js';
|
|
25
|
+
export * from './graph/neighborhood-renderer.js';
|
|
26
|
+
export * from './graph/paths.js';
|
|
27
|
+
export * from './graph/path-request.js';
|
|
28
|
+
export * from './graph/paths-renderer.js';
|
|
29
|
+
export * from './extraction/document-code-bindings.js';
|
|
30
|
+
export * from './extraction/document-obligations.js';
|
|
31
|
+
export * from './graph/compatibility.js';
|
|
32
|
+
export * from './graph/compatibility-request.js';
|
|
33
|
+
export * from './graph/compatibility-renderer.js';
|
|
34
|
+
export * from './graph/code-coverage.js';
|
|
35
|
+
export * from './graph/code-coverage-projection.js';
|
|
36
|
+
export * from './graph/code-coverage-request.js';
|
|
37
|
+
export * from './graph/code-coverage-renderer.js';
|
|
38
|
+
export { MappingProposalService } from './application/mapping-proposals.js';
|
|
39
|
+
export { createMappingProposalService } from './application/mapping-service.js';
|
|
40
|
+
export { prepareMappingProposal } from './extraction/mapping-plan.js';
|
|
41
|
+
export { createMappingProvider, mappingProviderIdentity } from './extraction/mapping-provider.js';
|
|
42
|
+
export { parseMappingRequest } from './extraction/mapping-request.js';
|
|
43
|
+
export { validateMappingOutput } from './extraction/mapping-output.js';
|
|
44
|
+
export { FileMappingProposalStore } from './storage/mapping-proposals.js';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Physical names only. Logical identities and evidence must retain the original value. */
|
|
2
|
+
export declare function physicalArtifactKey(identity: string): string;
|
|
3
|
+
/** Same-directory staging preserves atomic rename/link without repeating a long basename. */
|
|
4
|
+
export declare function temporaryArtifactPath(destination: string): string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createHash, randomUUID } from 'node:crypto';
|
|
2
|
+
import { dirname, join } from 'node:path';
|
|
3
|
+
/** Physical names only. Logical identities and evidence must retain the original value. */
|
|
4
|
+
export function physicalArtifactKey(identity) {
|
|
5
|
+
if (/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/.test(identity) &&
|
|
6
|
+
!/^(con|prn|aux|nul|com[1-9]|lpt[1-9])(?:\.|$)/i.test(identity))
|
|
7
|
+
return identity;
|
|
8
|
+
// '~' is excluded from literal logical storage keys, so a digest cannot alias one.
|
|
9
|
+
return `~${createHash('sha256').update(identity).digest('hex')}`;
|
|
10
|
+
}
|
|
11
|
+
/** Same-directory staging preserves atomic rename/link without repeating a long basename. */
|
|
12
|
+
export function temporaryArtifactPath(destination) {
|
|
13
|
+
return join(dirname(destination), `.${randomUUID()}.tmp`);
|
|
14
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** JSON.parse silently accepts duplicate keys, including differently escaped spellings. */
|
|
2
|
+
export function parseUniqueJson(content) {
|
|
3
|
+
const parsed = JSON.parse(content);
|
|
4
|
+
const objects = [];
|
|
5
|
+
for (const token of content.matchAll(/"(?:\\.|[^"\\])*"|[{}\[\]]/g)) {
|
|
6
|
+
const value = token[0];
|
|
7
|
+
if (value === '{' || value === '[')
|
|
8
|
+
objects.push(value === '{' ? new Set() : undefined);
|
|
9
|
+
else if (value === '}' || value === ']')
|
|
10
|
+
objects.pop();
|
|
11
|
+
else if (/^\s*:/.test(content.slice(token.index + value.length))) {
|
|
12
|
+
const keys = objects.at(-1);
|
|
13
|
+
const key = JSON.parse(value);
|
|
14
|
+
if (keys.has(key))
|
|
15
|
+
throw new Error('Duplicate JSON key');
|
|
16
|
+
keys.add(key);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return parsed;
|
|
20
|
+
}
|
package/dist/interfaces/cli.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// Modified for standalone extraction; see docs/extraction-manifest.json.
|
|
3
3
|
import "../../runtime-check.mjs";
|
|
4
|
+
import { runMappingsCommand } from './mapping-proposals.js';
|
|
4
5
|
import { resolve } from 'node:path';
|
|
5
6
|
import process from 'node:process';
|
|
6
7
|
import { createContextGraphApplication } from "../application/application.js";
|
|
@@ -20,6 +21,10 @@ import { adoptSemanticCache } from '../application/cache-adoption.js';
|
|
|
20
21
|
import { SemanticHydrationError } from '../application/hydration-failure.js';
|
|
21
22
|
import { GraphIdentityConflictError } from '../graph/identity-preflight.js';
|
|
22
23
|
import { runDocumentCoverage } from './document-coverage.js';
|
|
24
|
+
import { graphNeighborsRequestFromArgs } from './graph-exploration.js';
|
|
25
|
+
import { graphPathsRequestFromArgs } from './graph-paths.js';
|
|
26
|
+
import { graphCompatibilityRequestFromArgs } from './graph-compatibility.js';
|
|
27
|
+
import { codeCoverageRequestFromArgs } from './code-coverage.js';
|
|
23
28
|
function valueAfter(args, name) {
|
|
24
29
|
const index = args.indexOf(name);
|
|
25
30
|
return index >= 0 ? args[index + 1] : undefined;
|
|
@@ -98,7 +103,7 @@ function formatHydrationPlan(plan) {
|
|
|
98
103
|
async function main() {
|
|
99
104
|
const args = process.argv.slice(2);
|
|
100
105
|
if (args.includes('--help') || !args.length) {
|
|
101
|
-
process.stdout.write('weftlet documents plan|init|config show|config validate|doctor|hydrate|cache adopt|overlay|impact scan|sparql|validate|govern|visualize|diagnostics show|invariant check|clean-compare|ontology compile\nUse --config <file>; queries accept --snapshot <id>. impact scan accepts --changed-file, --capability, --max-facts, --max-depth, --continuation.\ndocuments plan --entry <document> [--entry <document>] [--root <path>] [--document-policy <json-file>] [--ref <commit>] [--json] previews prospective committed link coverage; it does not change hydration inputs or estimate model/cache work. Source classification/ownership completeness is separate from traversal readiness. The preview policy is an operation input. Set documentTraversal in configuration to activate traversal hydration; hydrate --plan describes its execution inputs. Safety limits: --max-read-documents, --max-read-bytes, --max-document-bytes.\nhydrate --plan [--json] [--ref <commit>] [--force-semantic] previews scope, cache and budgets without model calls or graph writes. Traversal coverage and role ambiguity block new model work; direct-source selection retains its existing behavior.\nhydrate --json --quiet emits structured semantic failures on stderr with no progress lines; failure stdout stays empty. hydrate --plan maps opaque source IDs to local document paths.\nhydrate|overlay --validation-details explicitly includes local node/fact identities, extractor names and source citations in identity-conflict errors; default reports use opaque references. This flag writes no diagnostic file. Use --json --quiet for structured identity-conflict stderr and empty failure stdout. Validation timings report phase boundaries, not a live heartbeat or percentage.\ncache adopt --from-config <previous.json> [--config <current.json>] [--ref <commit>] [--dry-run] returns JSON and copies only validated compatible artifacts, without model calls or snapshot writes. --dry-run performs no cache writes. Agent configurations accept the same --owner-doc, --task and --capability selection as hydrate.\ninit [--yes] [--directory <project>] [--config <file>] [--repository-id <id>] [--code-root <path>] [--semantic-source <path>] [--evidence-root <path>] [--model <name>] [--no-gitignore]\nSource flags may be repeated. init never overwrites an existing config. See README.md for examples.\n');
|
|
106
|
+
process.stdout.write('weftlet mappings plan|mappings propose|mappings read|documents plan|init|config show|config validate|doctor|hydrate|cache adopt|overlay|impact scan|graph neighbors|graph paths|graph compatibility|graph coverage|sparql|validate|govern|visualize|diagnostics show|invariant check|clean-compare|ontology compile\nmappings plan|propose --request <json-file> [--allow-model for propose] previews or runs one opt-in proposal; mappings read --snapshot <id> --key <key> reads saved unreviewed results.\nUse --config <file>; queries accept --snapshot <id>. impact scan accepts --changed-file, --capability, --max-facts, --max-depth, --continuation.\ngraph neighbors --snapshot <id> --node <exact-id> [--direction incoming|outgoing|both] [--predicate <relation>] [--max-facts <1..200>] [--continuation <token>] [--json] reads one-hop saved evidence; repeat --predicate to select multiple relations.\ngraph paths --snapshot <id> --from <exact-id> --to <exact-id> [--direction incoming|outgoing|both] [--predicate <relation>] [--max-depth <1..32>] [--max-paths <1..20>] [--max-steps <1..10000>] [--continuation <token>] [--json] explores cited simple paths; incomplete searches report frontier and limits.\ngraph coverage --snapshot <id> [--project <exact-package-root>] [--max-items <1..200>] [--continuation <token>] [--json] pages saved package/file coverage; absence or zero references is not proof of no impact.\ngraph compatibility --snapshot <id> --producer-fact <assertion-id> --consumer-fact <assertion-id> [--json] compares two documented numeric obligations; advisory only, with explicit unknowns and no implementation or CI verdict.\ndocuments plan --entry <document> [--entry <document>] [--root <path>] [--document-policy <json-file>] [--ref <commit>] [--json] previews prospective committed link coverage; it does not change hydration inputs or estimate model/cache work. Source classification/ownership completeness is separate from traversal readiness. The preview policy is an operation input. Set documentTraversal in configuration to activate traversal hydration; hydrate --plan describes its execution inputs. Safety limits: --max-read-documents, --max-read-bytes, --max-document-bytes.\nhydrate --plan [--json] [--ref <commit>] [--force-semantic] previews scope, cache and budgets without model calls or graph writes. Traversal coverage and role ambiguity block new model work; direct-source selection retains its existing behavior.\nhydrate --json --quiet emits structured semantic failures on stderr with no progress lines; failure stdout stays empty. hydrate --plan maps opaque source IDs to local document paths.\nhydrate|overlay --validation-details explicitly includes local node/fact identities, extractor names and source citations in identity-conflict errors; default reports use opaque references. This flag writes no diagnostic file. Use --json --quiet for structured identity-conflict stderr and empty failure stdout. Validation timings report phase boundaries, not a live heartbeat or percentage.\ncache adopt --from-config <previous.json> [--config <current.json>] [--ref <commit>] [--dry-run] returns JSON and copies only validated compatible artifacts, without model calls or snapshot writes. --dry-run performs no cache writes. Agent configurations accept the same --owner-doc, --task and --capability selection as hydrate.\ninit [--yes] [--directory <project>] [--config <file>] [--repository-id <id>] [--code-root <path>] [--semantic-source <path>] [--evidence-root <path>] [--model <name>] [--no-gitignore]\nSource flags may be repeated. init never overwrites an existing config. See README.md for examples.\n');
|
|
102
107
|
return;
|
|
103
108
|
}
|
|
104
109
|
if (await runDocumentCoverage(args, defaultConfigPath))
|
|
@@ -164,6 +169,13 @@ async function main() {
|
|
|
164
169
|
}
|
|
165
170
|
const application = await createContextGraphApplication(configPath);
|
|
166
171
|
const [command, subcommand] = args;
|
|
172
|
+
if (command === 'mappings') {
|
|
173
|
+
const report = await runMappingsCommand(application.mappingProposalService, args.slice(1));
|
|
174
|
+
process.stdout.write(`${JSON.stringify(report, null, 2)}\n`);
|
|
175
|
+
if ('ready' in report && !report.ready)
|
|
176
|
+
process.exitCode = 1;
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
167
179
|
if (command === 'sparql' || command === 'validate') {
|
|
168
180
|
const id = valueAfter(args, '--snapshot');
|
|
169
181
|
const snapshot = id ? await application.snapshotStore.read(id) :
|
|
@@ -235,6 +247,26 @@ async function main() {
|
|
|
235
247
|
process.stdout.write(args.includes('--json') ? `${JSON.stringify(pack, null, 2)}\n` : `${pack.markdown}\n`);
|
|
236
248
|
return;
|
|
237
249
|
}
|
|
250
|
+
if (command === 'graph' && subcommand === 'compatibility') {
|
|
251
|
+
const result = await application.compatibilityService.assess(graphCompatibilityRequestFromArgs(args.slice(2)));
|
|
252
|
+
process.stdout.write(`${args.includes('--json') ? JSON.stringify(result, null, 2) : result.markdown}\n`);
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
if (command === 'graph' && subcommand === 'coverage') {
|
|
256
|
+
const result = await application.codeCoverageService.coverage(codeCoverageRequestFromArgs(args.slice(2)));
|
|
257
|
+
process.stdout.write(`${args.includes('--json') ? JSON.stringify(result, null, 2) : result.markdown}\n`);
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
if (command === 'graph' && subcommand === 'paths') {
|
|
261
|
+
const result = await application.pathService.paths(graphPathsRequestFromArgs(args.slice(2)));
|
|
262
|
+
process.stdout.write(`${args.includes('--json') ? JSON.stringify(result, null, 2) : result.markdown}\n`);
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
if (command === 'graph' && subcommand === 'neighbors') {
|
|
266
|
+
const result = await application.explorationService.neighbors(graphNeighborsRequestFromArgs(args.slice(2)));
|
|
267
|
+
process.stdout.write(`${args.includes('--json') ? JSON.stringify(result, null, 2) : result.markdown}\n`);
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
238
270
|
if (command === 'visualize') {
|
|
239
271
|
const outputPath = valueAfter(args, '--output');
|
|
240
272
|
if (!outputPath)
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { CodeCoverageService } from '@weftlet/core';
|
|
2
|
+
export declare const graphCoverageTool: {
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: "object";
|
|
7
|
+
additionalProperties: boolean;
|
|
8
|
+
required: string[];
|
|
9
|
+
properties: {
|
|
10
|
+
snapshotId: {
|
|
11
|
+
type: string;
|
|
12
|
+
minLength: number;
|
|
13
|
+
maxLength: number;
|
|
14
|
+
};
|
|
15
|
+
projectRoot: {
|
|
16
|
+
type: string;
|
|
17
|
+
minLength: number;
|
|
18
|
+
maxLength: number;
|
|
19
|
+
};
|
|
20
|
+
maxItems: {
|
|
21
|
+
type: string;
|
|
22
|
+
minimum: number;
|
|
23
|
+
maximum: number;
|
|
24
|
+
default: number;
|
|
25
|
+
};
|
|
26
|
+
continuation: {
|
|
27
|
+
type: string;
|
|
28
|
+
minLength: number;
|
|
29
|
+
maxLength: number;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
annotations: {
|
|
34
|
+
readOnlyHint: boolean;
|
|
35
|
+
destructiveHint: boolean;
|
|
36
|
+
idempotentHint: boolean;
|
|
37
|
+
openWorldHint: boolean;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
export declare function handleCodeCoverage(service: CodeCoverageService, value: unknown): Promise<import("@weftlet/core").CodeCoverageReport>;
|
|
41
|
+
export declare function codeCoverageRequestFromArgs(args: readonly string[]): {
|
|
42
|
+
continuation?: string | undefined;
|
|
43
|
+
projectRoot?: string | undefined;
|
|
44
|
+
snapshotId: string;
|
|
45
|
+
maxItems: number;
|
|
46
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { parseCodeCoverageRequest } from '../graph/code-coverage-request.js';
|
|
2
|
+
import { parseGraphQueryArgs } from './graph-query-args.js';
|
|
3
|
+
export const graphCoverageTool = {
|
|
4
|
+
name: 'graph.coverage',
|
|
5
|
+
description: 'Inspect saved TypeScript-family source coverage. Page package boundaries, then select an exact projectRoot to page files. Distinguishes code-root selection, requested index entries, observed SCIP documents, cross-package references and unresolved evidence. Missing or zero observations never prove no impact. Does not rebuild evidence.',
|
|
6
|
+
inputSchema: { type: 'object', additionalProperties: false, required: ['snapshotId'], properties: {
|
|
7
|
+
snapshotId: { type: 'string', minLength: 1, maxLength: 256 }, projectRoot: { type: 'string', minLength: 1, maxLength: 8192 },
|
|
8
|
+
maxItems: { type: 'integer', minimum: 1, maximum: 200, default: 50 }, continuation: { type: 'string', minLength: 1, maxLength: 2048 },
|
|
9
|
+
} }, annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
10
|
+
};
|
|
11
|
+
export function handleCodeCoverage(service, value) {
|
|
12
|
+
return service.coverage(parseCodeCoverageRequest(value));
|
|
13
|
+
}
|
|
14
|
+
export function codeCoverageRequestFromArgs(args) {
|
|
15
|
+
return parseCodeCoverageRequest(parseGraphQueryArgs(args, 'coverage', {
|
|
16
|
+
'--snapshot': 'snapshotId', '--project': 'projectRoot', '--max-items': 'maxItems', '--continuation': 'continuation',
|
|
17
|
+
}));
|
|
18
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { ContractCompatibilityService } from '@weftlet/core';
|
|
2
|
+
export declare const graphCompatibilityTool: {
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: "object";
|
|
7
|
+
additionalProperties: boolean;
|
|
8
|
+
required: string[];
|
|
9
|
+
properties: {
|
|
10
|
+
snapshotId: {
|
|
11
|
+
type: string;
|
|
12
|
+
minLength: number;
|
|
13
|
+
maxLength: number;
|
|
14
|
+
};
|
|
15
|
+
producerFactId: {
|
|
16
|
+
type: string;
|
|
17
|
+
minLength: number;
|
|
18
|
+
maxLength: number;
|
|
19
|
+
};
|
|
20
|
+
consumerFactId: {
|
|
21
|
+
type: string;
|
|
22
|
+
minLength: number;
|
|
23
|
+
maxLength: number;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
annotations: {
|
|
28
|
+
readOnlyHint: boolean;
|
|
29
|
+
destructiveHint: boolean;
|
|
30
|
+
idempotentHint: boolean;
|
|
31
|
+
openWorldHint: boolean;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
export declare function handleGraphCompatibility(service: ContractCompatibilityService, value: unknown): Promise<import("@weftlet/core").ContractCompatibilityReport>;
|
|
35
|
+
export declare function graphCompatibilityRequestFromArgs(args: readonly string[]): import("@weftlet/core").ContractCompatibilityRequest;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { parseContractCompatibilityRequest } from '../graph/compatibility-request.js';
|
|
2
|
+
import { parseGraphQueryArgs } from './graph-query-args.js';
|
|
3
|
+
export const graphCompatibilityTool = {
|
|
4
|
+
name: 'graph.compatibility',
|
|
5
|
+
description: 'Compare two exact cited producer/consumer numeric obligations from a saved snapshot. Reports subset, insufficient guarantee, disjoint constraints, required revalidation or unknown. Advisory only: never proves implementation, current-diff validity or a CI policy violation. Discover assertion IDs with graph.neighbors.',
|
|
6
|
+
inputSchema: { type: 'object', additionalProperties: false,
|
|
7
|
+
required: ['snapshotId', 'producerFactId', 'consumerFactId'], properties: {
|
|
8
|
+
snapshotId: { type: 'string', minLength: 1, maxLength: 256 },
|
|
9
|
+
producerFactId: { type: 'string', minLength: 1, maxLength: 8192 },
|
|
10
|
+
consumerFactId: { type: 'string', minLength: 1, maxLength: 8192 },
|
|
11
|
+
} },
|
|
12
|
+
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
13
|
+
};
|
|
14
|
+
export function handleGraphCompatibility(service, value) {
|
|
15
|
+
return service.assess(parseContractCompatibilityRequest(value));
|
|
16
|
+
}
|
|
17
|
+
export function graphCompatibilityRequestFromArgs(args) {
|
|
18
|
+
return parseContractCompatibilityRequest(parseGraphQueryArgs(args, 'compatibility', {
|
|
19
|
+
'--snapshot': 'snapshotId', '--producer-fact': 'producerFactId', '--consumer-fact': 'consumerFactId',
|
|
20
|
+
}));
|
|
21
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { type GraphExplorationService } from '@weftlet/core';
|
|
2
|
+
export declare const graphNeighborsTool: {
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: "object";
|
|
7
|
+
additionalProperties: boolean;
|
|
8
|
+
required: string[];
|
|
9
|
+
properties: {
|
|
10
|
+
snapshotId: {
|
|
11
|
+
type: string;
|
|
12
|
+
minLength: number;
|
|
13
|
+
maxLength: number;
|
|
14
|
+
};
|
|
15
|
+
nodeId: {
|
|
16
|
+
type: string;
|
|
17
|
+
minLength: number;
|
|
18
|
+
maxLength: number;
|
|
19
|
+
};
|
|
20
|
+
direction: {
|
|
21
|
+
type: string;
|
|
22
|
+
enum: string[];
|
|
23
|
+
};
|
|
24
|
+
predicates: {
|
|
25
|
+
type: string;
|
|
26
|
+
maxItems: 16;
|
|
27
|
+
items: {
|
|
28
|
+
type: string;
|
|
29
|
+
enum: ("references" | "realizes" | "implementedBy" | "consumes" | "emits" | "persistsTo" | "governedBy" | "definedBy" | "verifiedBy" | "operationallyOwnedBy" | "decisionAuthority" | "routesThrough" | "authorizedBy" | "sourcedFrom" | "contains" | "calls")[];
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
maxFacts: {
|
|
33
|
+
type: string;
|
|
34
|
+
minimum: number;
|
|
35
|
+
maximum: number;
|
|
36
|
+
};
|
|
37
|
+
continuation: {
|
|
38
|
+
type: string;
|
|
39
|
+
minLength: number;
|
|
40
|
+
maxLength: number;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
annotations: {
|
|
45
|
+
readOnlyHint: boolean;
|
|
46
|
+
destructiveHint: boolean;
|
|
47
|
+
idempotentHint: boolean;
|
|
48
|
+
openWorldHint: boolean;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
export declare function handleGraphNeighbors(service: GraphExplorationService, value: unknown): Promise<import("@weftlet/core").GraphNeighborhood>;
|
|
52
|
+
export declare function graphNeighborsRequestFromArgs(args: readonly string[]): {
|
|
53
|
+
continuation?: string | undefined;
|
|
54
|
+
snapshotId: string;
|
|
55
|
+
nodeId: string;
|
|
56
|
+
direction: "incoming" | "outgoing" | "both";
|
|
57
|
+
predicates: ("references" | "realizes" | "implementedBy" | "consumes" | "emits" | "persistsTo" | "governedBy" | "definedBy" | "verifiedBy" | "operationallyOwnedBy" | "decisionAuthority" | "routesThrough" | "authorizedBy" | "sourcedFrom" | "contains" | "calls")[];
|
|
58
|
+
maxFacts: number;
|
|
59
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { parseGraphQueryArgs } from './graph-query-args.js';
|
|
2
|
+
import { graphPredicates } from '@weftlet/core';
|
|
3
|
+
import { parseGraphNeighborsRequest } from '../graph/neighborhood-request.js';
|
|
4
|
+
export const graphNeighborsTool = {
|
|
5
|
+
name: 'graph.neighbors',
|
|
6
|
+
description: 'Look up an exact node ID in an explicit saved snapshot and page through its cited one-hop relationships. Follow returned neighbor IDs to explore further; no hydration or model calls.',
|
|
7
|
+
inputSchema: {
|
|
8
|
+
type: 'object', additionalProperties: false, required: ['snapshotId', 'nodeId'],
|
|
9
|
+
properties: {
|
|
10
|
+
snapshotId: { type: 'string', minLength: 1, maxLength: 256 },
|
|
11
|
+
nodeId: { type: 'string', minLength: 1, maxLength: 8192 },
|
|
12
|
+
direction: { type: 'string', enum: ['incoming', 'outgoing', 'both'] },
|
|
13
|
+
predicates: { type: 'array', maxItems: graphPredicates.length, items: { type: 'string', enum: [...graphPredicates] } },
|
|
14
|
+
maxFacts: { type: 'integer', minimum: 1, maximum: 200 },
|
|
15
|
+
continuation: { type: 'string', minLength: 1, maxLength: 2048 },
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
19
|
+
};
|
|
20
|
+
export function handleGraphNeighbors(service, value) {
|
|
21
|
+
return service.neighbors(parseGraphNeighborsRequest(value));
|
|
22
|
+
}
|
|
23
|
+
export function graphNeighborsRequestFromArgs(args) {
|
|
24
|
+
const flags = { '--snapshot': 'snapshotId', '--node': 'nodeId',
|
|
25
|
+
'--direction': 'direction', '--predicate': 'predicates', '--max-facts': 'maxFacts', '--continuation': 'continuation' };
|
|
26
|
+
return parseGraphNeighborsRequest(parseGraphQueryArgs(args, 'neighbors', flags));
|
|
27
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { type GraphPathQueryService } from '@weftlet/core';
|
|
2
|
+
export declare const graphPathsTool: {
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: "object";
|
|
7
|
+
additionalProperties: boolean;
|
|
8
|
+
required: string[];
|
|
9
|
+
properties: {
|
|
10
|
+
snapshotId: {
|
|
11
|
+
type: string;
|
|
12
|
+
minLength: number;
|
|
13
|
+
maxLength: number;
|
|
14
|
+
};
|
|
15
|
+
fromNodeId: {
|
|
16
|
+
type: string;
|
|
17
|
+
minLength: number;
|
|
18
|
+
maxLength: number;
|
|
19
|
+
};
|
|
20
|
+
toNodeId: {
|
|
21
|
+
type: string;
|
|
22
|
+
minLength: number;
|
|
23
|
+
maxLength: number;
|
|
24
|
+
};
|
|
25
|
+
direction: {
|
|
26
|
+
type: string;
|
|
27
|
+
enum: string[];
|
|
28
|
+
};
|
|
29
|
+
predicates: {
|
|
30
|
+
type: string;
|
|
31
|
+
maxItems: 16;
|
|
32
|
+
items: {
|
|
33
|
+
type: string;
|
|
34
|
+
enum: ("references" | "realizes" | "implementedBy" | "consumes" | "emits" | "persistsTo" | "governedBy" | "definedBy" | "verifiedBy" | "operationallyOwnedBy" | "decisionAuthority" | "routesThrough" | "authorizedBy" | "sourcedFrom" | "contains" | "calls")[];
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
maxDepth: {
|
|
38
|
+
type: string;
|
|
39
|
+
minimum: number;
|
|
40
|
+
maximum: number;
|
|
41
|
+
};
|
|
42
|
+
maxPaths: {
|
|
43
|
+
type: string;
|
|
44
|
+
minimum: number;
|
|
45
|
+
maximum: number;
|
|
46
|
+
};
|
|
47
|
+
maxSteps: {
|
|
48
|
+
type: string;
|
|
49
|
+
minimum: number;
|
|
50
|
+
maximum: number;
|
|
51
|
+
};
|
|
52
|
+
continuation: {
|
|
53
|
+
type: string;
|
|
54
|
+
minLength: number;
|
|
55
|
+
maxLength: number;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
annotations: {
|
|
60
|
+
readOnlyHint: boolean;
|
|
61
|
+
destructiveHint: boolean;
|
|
62
|
+
idempotentHint: boolean;
|
|
63
|
+
openWorldHint: boolean;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
export declare function handleGraphPaths(service: GraphPathQueryService, value: unknown): Promise<import("@weftlet/core").GraphPaths>;
|
|
67
|
+
export declare function graphPathsRequestFromArgs(args: readonly string[]): {
|
|
68
|
+
continuation?: string | undefined;
|
|
69
|
+
snapshotId: string;
|
|
70
|
+
fromNodeId: string;
|
|
71
|
+
toNodeId: string;
|
|
72
|
+
direction: "incoming" | "outgoing" | "both";
|
|
73
|
+
predicates: ("references" | "realizes" | "implementedBy" | "consumes" | "emits" | "persistsTo" | "governedBy" | "definedBy" | "verifiedBy" | "operationallyOwnedBy" | "decisionAuthority" | "routesThrough" | "authorizedBy" | "sourcedFrom" | "contains" | "calls")[];
|
|
74
|
+
maxDepth: number;
|
|
75
|
+
maxPaths: number;
|
|
76
|
+
maxSteps: number;
|
|
77
|
+
};
|