Repository navigation
Space graph format: exportSpaceGraph, spaceGraphFrom and structured-context/browser - #189
Merged
Merged
Conversation
ResolvedParentRef.source becomes kind, and the filter metadata _source becomes _kind. The edge `source` clashed with a node's source location and with the source/target endpoint convention of graph formats. Refs #138
Each resolvedParents entry becomes a SpaceEdge naming both ends, indexed by child and by parent, so consumers can look up edges by relationship in either direction without building their own index. Refs #138
SpaceGraphData carries a space's nodes and every hierarchy as plain JSON,
so a graph can cross a process or network boundary. Edges stay in each
node's resolvedParents, including edges to nodes outside an exported
subset; the receiver picks the hierarchy when it builds the SpaceGraph.
- exportSpaceGraph(nodes, metadata) and spaceGraphFrom(data, { hierarchy })
- structured-context/browser: browser-safe entry point for the graph
functions and node types; /api re-exports them
- sctx dump --graph prints SpaceGraphData
- JSON Schema generated to schemas/generated/space-graph/, frozen per
released formatVersion; a typecheck fails if schema and type drift
Closes #138
/browser exports spaceGraphFrom with the SpaceGraph and SpaceNode types; /api re-exports them from /browser and adds exportSpaceGraph. Other types are derived from these. Refs #138
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #138.
What changes
exportSpaceGraph(nodes, metadata)turns nodes and every hierarchy into plain JSON:{ formatVersion, hierarchies, mainHierarchy, nodes }.spaceGraphFrom(data, { hierarchy })builds aSpaceGraphfrom it, structured by the named hierarchy (default: the main hierarchy).structured-context/browser. A browser-safe entry point exportingspaceGraphFrom,SpaceGraphandSpaceNode./apire-exports all three and addsexportSpaceGraph. Other types are derived (for exampleParameters<typeof spaceGraphFrom>[0]).SpaceGraph. The newparentEdgesandchildEdgesmaps index eachresolvedParentsentry in both directions.sctx dump --graphprints the format.schemas/generated/space-graph/latest.json, with a frozen copy per releasedformatVersion. Generation fails if a released version's schema no longer matches.sourceis renamed tokindonResolvedParentRef, and_sourceto_kindin filter expressions.Design decisions (differ from the issue's proposal)
resolvedParents, the one source of truth.SpaceGraphstays a one-hierarchy view.exportSpaceGraph/spaceGraphFrommirror graphology'sexport()/Graph.from()and return objects, not strings.Testing
spaceGraphFrom(exportSpaceGraph(...))deep-equalsbuildSpaceGraph(...)for every hierarchy, on fixtures (including multi-hierarchy) and on a set of real local spaces./browserbundles for the browser without Node built-ins.dump --graph, and loads the output throughstructured-context/browser.