Skip to content

Add --generate-graphql-schema CLI option#30

Open
dahlia wants to merge 2 commits into
fedify-dev:mainfrom
dahlia:graphql-schema-generation
Open

Add --generate-graphql-schema CLI option#30
dahlia wants to merge 2 commits into
fedify-dev:mainfrom
dahlia:graphql-schema-generation

Conversation

@dahlia

@dahlia dahlia commented Jul 22, 2026

Copy link
Copy Markdown
Member

The branch has two commits beyond the base:

  • 7502023: “Add Optique agent skill”—from npx skills add dahlia/optique, nothing to review.
  • c738477: “Add --generate-graphql-schema CLI option to print the GraphQL schema”—the actual change. This is the only commit that needs review.

This adds a new mode to drfed-server that prints the compiled GraphQL schema (via graphql's printSchema) instead of starting a server. You can write it to a file with --output-file or print it to stdout (the default).

The parser in packages/drfed/src/parser.ts was refactored into separate serverParser and schemaGeneratorParser sub-parsers, merged through merge() and or() from Optique. The server startup logic moved into a dedicated runServer() function in packages/drfed/src/index.ts, and a new runSchemaGenerator() function calls printSchema() and handles the output. A mise.toml task generate:graphql-schema runs the command and accepts an --output-file flag. The graphql package was promoted to a catalog dependency in pnpm-workspace.yaml so both @drfed/drfed and @drfed/graphql share the same version.

dahlia added 2 commits July 22, 2026 16:36
This adds a new mode to the drfed-server CLI that generates and outputs
the GraphQL schema (via graphql's printSchema) instead of starting a
server.  The schema can be written to a file (--output-file) or printed
to stdout (the default).

Changes include:

- Refactored the parser into separate serverParser and
  schemaGeneratorParser sub-parsers, combined via merge() and or()
  from @optique/core.
- Extracted the server startup logic into a runServer() function.
- Added runSchemaGenerator() that calls printSchema() and either
  writes to a file or prints to stdout.
- Added a "generate:graphql-schema" mise task that runs the command
  and accepts an --output-file flag.
- Added a "drfed-server" mise task for invoking the server directly.
- Made graphql a catalog dependency in pnpm-workspace.yaml and
  referenced it from @drfed/drfed; updated @drfed/graphql to use
  the catalog reference as well.
@dahlia dahlia added this to the DrFed 0.1.0 milestone Jul 22, 2026
@dahlia
dahlia requested review from 2chanhaeng, dodok8 and sij411 July 22, 2026 08:26
@dahlia dahlia self-assigned this Jul 22, 2026
@dahlia dahlia added the enhancement New feature or request label Jul 22, 2026
@dahlia dahlia moved this to In progress in NLnet NGI0 Commons Fund (2026) Jul 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

1 participant