Skip to content

refactor: extract core GraphQL into pkg/beangraph (Refs: beans-rvfe)#170

Merged
hmans merged 1 commit intomainfrom
beans/common-flamingo-494o
Mar 21, 2026
Merged

refactor: extract core GraphQL into pkg/beangraph (Refs: beans-rvfe)#170
hmans merged 1 commit intomainfrom
beans/common-flamingo-494o

Conversation

@hmans
Copy link
Copy Markdown
Owner

@hmans hmans commented Mar 21, 2026

Summary

  • New pkg/beangraph/ package with CoreResolver struct containing all core bean operations (CRUD, relationships, filtering, ETag validation) — depends only on pkg/beancore, no UI imports
  • Moved gqlgen model types from internal/graph/model/ to pkg/beangraph/model/ so they're part of the public API surface
  • internal/graph/Resolver now embeds *beangraph.CoreResolver and delegates core operations; UI-only resolvers (agents, worktrees, terminals, git diffs) stay in internal/graph/
  • CLI commands and TUI now use beangraph.CoreResolver directly, removing their dependency on internal/graph and its heavy UI imports

This prepares for a potential future split of Beans UI into a separate project — the core GraphQL API is now cleanly separated from the serve-specific GraphQL.

Test plan

  • All 16 Go test packages pass (go test ./...)
  • gqlgen codegen runs cleanly
  • Frontend codegen unaffected (reads schema.graphqls directly)
  • Manual: beans list, beans create, beans show, beans update, beans delete work as before
  • Manual: beans serve starts and the UI works normally
  • Manual: beans query '{ beans { id title } }' returns results

- Create pkg/beangraph/ package with CoreResolver struct for core bean
  CRUD operations (queries, mutations, bean field resolvers, filters,
  ETag/validation helpers)
- Move gqlgen model types from internal/graph/model/ to
  pkg/beangraph/model/
- internal/graph/Resolver now embeds *beangraph.CoreResolver and
  delegates core operations; UI-only resolvers stay in internal/graph/
- CLI commands (create, list, show, update, delete, roadmap) and TUI
  now use beangraph.CoreResolver directly, removing their dependency on
  internal/graph and its UI-specific imports (agents, worktrees,
  terminals)
- Only graphql.go and serve.go still import internal/graph (they need
  the full gqlgen executable schema)
@hmans hmans merged commit 7e59184 into main Mar 21, 2026
1 check passed
@hmans hmans deleted the beans/common-flamingo-494o branch March 21, 2026 09:11
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.

1 participant