How avitaltamir/cyphernetes works
Project type and purpose
• This is a multi‐package, full‐stack tool (“Cyphernetes”) providing:
• A Go-based CLI (cmd/cyphernetes)
• A core query engine library (pkg/core) and API-server provider (pkg/provider/apiserver)
• A React/TypeScript web UI (web/)
• A Kubernetes operator (operator/) for DynamicOperator CRDs
File structure
• Top-level packages:
• cmd/cyphernetes – CLI entrypoint with subcommands (web, shell, query, graph, macro, autocomplete)
• pkg/core – parser, lexer, query engine, graph operations, relationship resolution
• pkg/provider/apiserver – implements provider interface against Kubernetes API server
• web/ – React app built with Vite, serves UI for interactive queries
• operator/ – controller-runtime Go operator, CRD definitions, deploy manifests, Helm chart
• Configuration and CI: GitHub workflows, Makefile orchestrates build/test for CLI, operator, and web client
README insights
• Core functionality: Cypher-inspired DSL over Kubernetes object graph
• Multiple execution modes: CLI, shell, single query, web UI, in-cluster operator
• Operator uses DynamicOperator CRD to embed queries into Kubernetes workflows
Main components and interactions
A. CLI Binary (Go)
• Subcommands invoke core pkg/core and provider
• “cyphernetes web” spins up embedded HTTP server serving static web assets
B. Core Engine (pkg/core)
• Lexer → Parser → Query planner/engine → executes graph ops
C. Provider Layer (pkg/provider/apiserver)
• Fetches resource objects and watches via Kubernetes API (client-go)
D. Web UI (React/TS)
• Queries CLI HTTP API (REST or WebSocket)
• Displays query input, graph visualizations, results
E. Kubernetes Operator
• Controller-runtime manager
• Watches DynamicOperator CRDs
• Runs core engine in-cluster to apply graph operations
• Uses CRD YAML (operator/config/crd) and Helm chart for deployment
Architectural patterns and design principles
• Modular monorepo: clear separation of CLI, core library, provider, UI, operator
• Adapter pattern: provider interface abstracts backend (only apiserver implementation today)
• MVC-like on client side: React components (View), queryApi.ts (Controller), core engine (Model)
• Controller-Runtime operator follows Kubernetes Operator pattern (Reconcile loop)
Elements
• CLI → Core Engine → Provider → K8s API
• Web UI ↔ CLI HTTP endpoint
• Operator reconciler loops: CRD → Controller → Core Engine → API Server