Skip to content

Conversation

cmwhited
Copy link
Collaborator

@cmwhited cmwhited commented Jul 31, 2025

Description

Reference #352

There is a lot more to come out of this work, but this felt like a logical starting point.
The goal is to take the current @graphprotocol/hypergraph-cli and package it with the @graphprotocol/hypergraph package that will be runnable if the user has the package installed as a dependency. And instead of using sqlite to create/manage multiple hypergraph schemas (apps), the cli tool will only deal with the hypergraph schema/mapping in the repo/directory the cli tool is ran in.
It uses logical placements of the schema/mapping files in the directory (will likely need to expand on this, maybe a config will become handy to point to the schema/mapping files??). If these files can be found, it parses the schema and mapping files to build a Schema instance and emit this value on a streaming endpoint.

The cli exposes a simple api that:

  • currently:
    • exposes an streaming endpoint: /api/v1/schema/events that emits a SSE stream of Schema built from
      • the current state of the Hypergraph schema/mappings
      • a watch on the schema/mappings where each change will emit an event of the updated Schema
  • upcoming:
    • a static file server for the UI

Notes

  • Currently, if a schema.ts can't be found, the streaming endpoint returns an empty Schema object. Other way to handle it would be to throw an error from the cli if it can't be found to let the user know. Anyone have thoughts?
    • if we stay with this approach, I would like to add a fix to keep the stream open and watch for the creation of the schema.ts file

Copy link
Collaborator

@nikgraf nikgraf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good 🙌

@cmwhited cmwhited merged commit c4dbab3 into main Aug 1, 2025
6 checks passed
@cmwhited cmwhited deleted the chris.whited/typesync.v2/cli branch August 1, 2025 05:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants