feat(domain): add cluster entity, agent, cli, and web ui for kubernetes management#566
Open
arielshad wants to merge 26 commits into
Open
feat(domain): add cluster entity, agent, cli, and web ui for kubernetes management#566arielshad wants to merge 26 commits into
arielshad wants to merge 26 commits into
Conversation
Co-Authored-By: Shep Bot <shep-agent@users.noreply.github.com>
Co-Authored-By: Shep Bot <shep-agent@users.noreply.github.com>
…ster-agent Co-Authored-By: Shep Bot <shep-agent@users.noreply.github.com>
…r-agent Co-Authored-By: Shep Bot <shep-agent@users.noreply.github.com>
Co-Authored-By: Shep Bot <shep-agent@users.noreply.github.com>
Co-Authored-By: Shep Bot <shep-agent@users.noreply.github.com>
…ships Co-Authored-By: Shep Bot <shep-agent@users.noreply.github.com>
Co-Authored-By: Shep Bot <shep-agent@users.noreply.github.com>
Create four migrations for the cluster persistence layer: - 085: clusters table with unique partial slug index and status index - 086: cluster_repositories junction table with compound unique index - 087: cluster_applications junction table with compound unique index - 088: feature_flag_clusters column on settings table Co-Authored-By: Shep Bot <shep-agent@users.noreply.github.com>
Implement cluster.mapper.ts with ClusterRow interface, toDatabase and fromDatabase functions mapping all Cluster entity fields including boolean-to-integer and Date-to-unix-ms conversion. Unit tests cover all field mappings and round-trip preservation. Co-Authored-By: Shep Bot <shep-agent@users.noreply.github.com>
…entation Define IClusterRepository output port with CRUD, junction table management for cluster-repository and cluster-application many-to-many relationships. Implement SQLiteClusterRepository with parameterized queries, mapper integration, and soft-delete support. Integration tests validate all 12 methods against in-memory SQLite including idempotent migrations, slug uniqueness, status filtering, and junction table operations. Co-Authored-By: Shep Bot <shep-agent@users.noreply.github.com>
Add infrastructure port interfaces (IK3dService, IKubectlService, IArgoCDService, IDockerHealthService, IClusterAgentProcessService) and implement all 12 cluster use cases: CRUD (Create, Get, List, Update, Delete), junction management (LinkRepository, UnlinkRepository, LinkApplication, UnlinkApplication), and lifecycle operations (ProvisionCluster, DestroyCluster, GetClusterStatus). All 45 unit tests pass with mocked port dependencies. Co-Authored-By: Shep Bot <shep-agent@users.noreply.github.com>
Implement four CLI-wrapping infrastructure services and error classes for the cluster agent feature: - K3dService: wraps k3d CLI for cluster lifecycle (create, delete, start, stop, status, kubeconfig extraction) - KubectlService: wraps kubectl CLI for manifest apply, pod/service listing, namespace listing, and wait-for-ready with --kubeconfig isolation per NFR-2 - ArgoCDService: installs and manages ArgoCD via kubectl apply of official manifests (no separate argocd binary required) - DockerHealthService: checks Docker daemon availability via docker info - ClusterAgentProcessService: spawns detached worker processes for cluster provisioning following the feature-agent-worker pattern - Custom error classes (K3dError, KubectlError, DockerError) with typed error codes for programmatic error handling Co-Authored-By: Shep Bot <shep-agent@users.noreply.github.com>
Implement the cluster agent as a LangGraph StateGraph with typed state channels (ClusterAgentAnnotation), 7 node factories (prerequisite-check, provision, configure-kubectl, install-argocd, health-check, ready, handle-error), and a graph factory with conditional ArgoCD routing. Co-Authored-By: Shep Bot <shep-agent@users.noreply.github.com>
Implement cluster-agent-worker.ts as a detached Node.js entry point following the feature-agent-worker pattern. Parses --cluster-id, --run-id, --argocd-enabled, --argocd-namespace, --resume, --thread-id args. Initializes DI, resolves infrastructure services, creates the cluster agent graph with SQLite checkpointer, runs heartbeat, and handles SIGTERM/uncaughtException gracefully. Co-Authored-By: Shep Bot <shep-agent@users.noreply.github.com>
Add clusters boolean to TypeSpec FeatureFlags model and regenerate. Wire through settings mapper, sqlite repository, defaults factory, web feature-flags resolver, settings page toggle, and React context. Add translation strings in all 9 locales. Update FeatureFlags fixtures across stories, unit tests, and integration tests. Co-Authored-By: Shep Bot <shep-agent@users.noreply.github.com>
Create register-cluster.ts with repository, infrastructure services (k3d, kubectl, argocd, docker-health), agent process service, 12 use cases, and string-token aliases for web routes. Wire into container. Co-Authored-By: Shep Bot <shep-agent@users.noreply.github.com>
Add shep cluster command group with new, ls, show, del, link, unlink, and status subcommands. Each command resolves use cases from the DI container and uses i18n for all user-facing strings. Includes resolve-cluster helper for flexible ID/slug/prefix resolution and unit tests for new, ls, and del commands. Co-Authored-By: Shep Bot <shep-agent@users.noreply.github.com>
Add complete web UI layer for cluster management including: - ClusterStatusBadge with color/pulse for all 6 statuses - ClusterNode canvas component with handles and linked counts - ClusterCreateDrawer with name, description, and ArgoCD toggle - ClusterDetailDrawer with overview, repos, apps, and status tabs - 12 server actions for cluster CRUD operations - 6 API routes for cluster REST endpoints - useClusterEvents polling hook for live status updates - Canvas integration via deriveGraph and buildGraphNodes - Sidebar navigation item gated by featureFlags.clusters - Cluster i18n translation keys Co-Authored-By: Shep Bot <shep-agent@users.noreply.github.com>
Co-Authored-By: Shep Bot <shep-agent@users.noreply.github.com>
Co-Authored-By: Shep Bot <shep-agent@users.noreply.github.com>
Co-Authored-By: Shep Bot <shep-agent@users.noreply.github.com>
Co-Authored-By: Shep Bot <shep-agent@users.noreply.github.com>
Contributor
Co-Authored-By: Shep Bot <shep-agent@users.noreply.github.com>
Co-Authored-By: Shep Bot <shep-agent@users.noreply.github.com>
Contributor
Add a /clusters page that lists clusters, supports create-and-provision in one click, and exposes provision/destroy/delete actions plus a detail drawer. Surface docker, k3d, and kubectl as installable tools under a new clusters tab on the tools page so users can satisfy cluster prerequisites from the UI. Fill in cluster.* english translations so the create and detail drawers stop showing raw i18n keys. Co-Authored-By: Shep Bot <shep-agent@users.noreply.github.com>
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.
Summary
Introduces a new first-class Cluster domain entity alongside Repository, Application, and Feature. A Cluster represents a managed Kubernetes environment (k3s-in-Docker) that the Shep platform provisions and operates autonomously. This is an XL feature spanning all architecture layers — domain model through web UI.
What's included
Clusterentity (extending SoftDeletableEntity),ClusterStatusenum (6 lifecycle states),ClusterRepositoryandClusterApplicationjunction entities for many-to-many relationshipsSQLiteClusterRepositoryimplementationIK3dService,IKubectlService,IArgoCDService,IDockerHealthService)shep clustercommand group with 7 subcommands (new, ls, show, del, link, unlink, status)clustersflag wired through all layers (TypeSpec, migration, mapper, repository, settings defaults, web feature-flags, translations in all 9 locales)register-cluster.tsmodule registering all cluster components in the tsyringe containerKey design decisions
nodeCountfield reservedwork_item_relationspattern)Evidence
Test plan
pnpm typecheckpasses (zero errors)pnpm lintpasses (zero warnings)pnpm buildsucceedspnpm test:unit— 6735 tests pass across 524 filespnpm test:int— 793 tests pass across 59 filesshep cluster new test-cluster --argocdcreates cluster entity🐑 Built with Shep.bot