From 160d655dc03f3a410f4fe79976614dee340373b3 Mon Sep 17 00:00:00 2001 From: Rahul Krishna Date: Tue, 14 Jul 2026 14:09:59 -0400 Subject: [PATCH 01/32] feat(neo4j): declare TS twin-label vocabulary, schema 1.1.0 (#65) --- schema.neo4j.json | 22 ++++++++++++++++++-- src/build/neo4j/index.ts | 2 +- src/build/neo4j/schema.ts | 35 ++++++++++++++++++++++++++++++- test/neo4j-twins.test.ts | 44 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 99 insertions(+), 4 deletions(-) create mode 100644 test/neo4j-twins.test.ts diff --git a/schema.neo4j.json b/schema.neo4j.json index fcc80bb..c10af05 100644 --- a/schema.neo4j.json +++ b/schema.neo4j.json @@ -1,5 +1,5 @@ { - "schema_version": "1.0.0", + "schema_version": "1.1.0", "generator": "codeanalyzer-typescript", "marker_labels": [ "Entrypoint" @@ -456,5 +456,23 @@ "CREATE INDEX callable_name IF NOT EXISTS FOR (c:Callable) ON (c.name)", "CREATE INDEX decorator_name IF NOT EXISTS FOR (d:Decorator) ON (d.name)", "CREATE FULLTEXT INDEX code_fts IF NOT EXISTS FOR (c:Callable) ON EACH [c.code, c.docstring]" - ] + ], + "label_twins": { + "Application": "TSApplication", + "Module": "TSModule", + "Class": "TSClass", + "Interface": "TSInterface", + "Enum": "TSEnum", + "TypeAlias": "TSTypeAlias", + "Namespace": "TSNamespace", + "Callable": "TSCallable", + "External": "TSExternal", + "AnonymousCallable": "TSAnonymousCallable", + "Package": "TSPackage", + "Decorator": "TSDecorator", + "CallSite": "TSCallSite", + "Attribute": "TSAttribute", + "Variable": "TSVariable", + "Entrypoint": "TSEntrypoint" + } } diff --git a/src/build/neo4j/index.ts b/src/build/neo4j/index.ts index 3fadc2f..be460ec 100644 --- a/src/build/neo4j/index.ts +++ b/src/build/neo4j/index.ts @@ -3,6 +3,6 @@ export { project } from "./project"; export { renderCypher } from "./cypher"; export { boltWriter, type BoltConfig } from "./bolt"; -export { SCHEMA_VERSION, buildSchemaDocument, NODE_LABELS, REL_TYPES, MARKER_LABELS } from "./schema"; +export { SCHEMA_VERSION, TS_PREFIX, twinOf, withTwins, buildSchemaDocument, NODE_LABELS, REL_TYPES, MARKER_LABELS } from "./schema"; export type { SchemaDocument } from "./schema"; export type { GraphRows, NodeRow, EdgeRow } from "./rows"; diff --git a/src/build/neo4j/schema.ts b/src/build/neo4j/schema.ts index 834a19f..b77e184 100644 --- a/src/build/neo4j/schema.ts +++ b/src/build/neo4j/schema.ts @@ -13,7 +13,7 @@ * the :Application node of every emitted graph so any consumer can detect a producer/consumer * mismatch at runtime. */ -export const SCHEMA_VERSION = "1.0.0"; +export const SCHEMA_VERSION = "1.1.0"; export type PropType = "string" | "integer" | "float" | "boolean" | "string[]" | "integer[]"; @@ -36,6 +36,28 @@ export interface RelType { /** Labels layered onto a node in addition to its primary/specific label. */ export const MARKER_LABELS = ["Entrypoint"] as const; +/** + * Language-namespace twins (schema 1.1.0, additive): every specific and marker label is also + * stamped as `TS