refactor: Align vocabulary — component → program / deployment

Canonical terms (see docs/registry.md glossary):
- program: any catalog entry (tool/daemon/frontend) — the software
- service / job: how a program is deployed (systemd .service / .timer)
- deployment: umbrella for the unified service+job+program view

Changes:
- core: ServiceSpec/JobSpec component: → program: (component accepted as
  back-compat validation_alias); DeployedComponent → Deployment.
- api: ComponentSummary/Detail → DeploymentSummary/Detail; GET /components
  → /deployments; GatewayRoute.component → program; GatewayInfo
  .component_count → deployment_count; ServiceActionResponse/action keys
  component → program.
- app: matching type renames, /components → /deployments hook, route
  /component/:name → /deployment/:name, GatewayRoute.program.
- docs: component-registry.md → registry.md (+ canonical glossary);
  CLAUDE.md endpoint list refreshed (drop removed /tools, add typed
  program/service/job + config routes).

Tests: core 92, cli 24, api 52 green; app build clean; ruff clean.
This commit is contained in:
2026-06-14 11:05:22 -07:00
parent 482524bfe5
commit 3f3b88f17b
44 changed files with 279 additions and 237 deletions

View File

@@ -1,12 +1,12 @@
import { useState } from "react"
import { ChevronDown, ChevronRight } from "lucide-react"
import type { ComponentDetail } from "@/types"
import type { DeploymentDetail } from "@/types"
import { ComponentFields } from "./ComponentFields"
import { BehaviorBadge } from "./BehaviorBadge"
import { StackBadge } from "./StackBadge"
interface ComponentEditorProps {
component: ComponentDetail
component: DeploymentDetail
onSave: (name: string, config: Record<string, unknown>) => Promise<void>
onDelete: (name: string) => Promise<void>
}

View File

@@ -73,7 +73,7 @@ export function GatewayPanel({ gateway, statuses }: GatewayPanelProps) {
</thead>
<tbody>
{gateway.routes.map((route) => {
const health = statusMap.get(route.component)
const health = statusMap.get(route.program)
return (
<tr
key={route.path}
@@ -84,10 +84,10 @@ export function GatewayPanel({ gateway, statuses }: GatewayPanelProps) {
</td>
<td className="px-4 py-2">
<Link
to={`/component/${route.component}`}
to={`/deployment/${route.program}`}
className="hover:text-[var(--primary)] transition-colors"
>
{route.component}
{route.program}
</Link>
</td>
<td className="px-4 py-2 font-mono text-[var(--muted)]">

View File

@@ -3,7 +3,7 @@ import { Link } from "react-router-dom"
import { ArrowLeft, Check, Loader2, Zap } from "lucide-react"
import { useQuery, useQueryClient } from "@tanstack/react-query"
import { apiClient } from "@/services/api/client"
import type { ComponentDetail } from "@/types"
import type { DeploymentDetail } from "@/types"
import { AddComponent } from "@/components/AddComponent"
import { ComponentEditor } from "@/components/ComponentEditor"
@@ -24,7 +24,7 @@ export function ConfigEditorPage() {
queryFn: async () => {
const list = await apiClient.get<{ id: string }[]>("/components")
const details = await Promise.all(
list.map((c) => apiClient.get<ComponentDetail>(`/components/${c.id}`))
list.map((c) => apiClient.get<DeploymentDetail>(`/components/${c.id}`))
)
return details
},

View File

@@ -77,7 +77,7 @@ export function NodeDetailPage() {
>
<td className="px-3 py-2.5">
<Link
to={`/component/${comp.id}`}
to={`/deployment/${comp.id}`}
className="font-medium hover:text-[var(--primary)] transition-colors"
>
{comp.id}

View File

@@ -24,7 +24,7 @@ export const router = createBrowserRouter([
element: <ProgramDetailPage />,
},
{
path: "/component/:name",
path: "/deployment/:name",
element: <ProgramRedirect />,
},
{

View File

@@ -2,7 +2,7 @@ import { useEffect } from "react"
import { useQuery, useQueryClient, useMutation } from "@tanstack/react-query"
import { apiClient } from "./client"
import type {
ComponentDetail,
DeploymentDetail,
ServiceSummary,
ServiceDetail,
JobSummary,
@@ -21,8 +21,8 @@ import type {
// Legacy compat hook — used by ConfigEditorPage and ProgramRedirect
export function useComponent(name: string) {
return useQuery({
queryKey: ["components", name],
queryFn: () => apiClient.get<ComponentDetail>(`/components/${name}`),
queryKey: ["deployments", name],
queryFn: () => apiClient.get<DeploymentDetail>(`/deployments/${name}`),
enabled: !!name,
})
}
@@ -125,7 +125,7 @@ export function useServiceAction() {
} catch (err) {
// Network error from self-restart killing the connection — expected
if (err instanceof TypeError) {
return { component: name, action, status: "accepted" } as ServiceActionResponse
return { program: name, action, status: "accepted" } as ServiceActionResponse
}
throw err
}
@@ -144,7 +144,7 @@ export function useProgramAction() {
const qc = useQueryClient()
return useMutation({
mutationFn: ({ name, action }: { name: string; action: string }) =>
apiClient.post<{ component: string; action: string; status: string; output: string }>(
apiClient.post<{ program: string; action: string; status: string; output: string }>(
`/programs/${name}/${action}`,
),
onSuccess: () => {

View File

@@ -64,7 +64,7 @@ export interface ProgramDetail extends ProgramSummary {
export type AnyDetail = ServiceDetail | JobDetail | ProgramDetail
// Legacy unified type — kept for NodeDetail.deployed and compat endpoint
export interface ComponentSummary {
export interface DeploymentSummary {
id: string
category: "program" | "service" | "job" | null
description: string | null
@@ -88,7 +88,7 @@ export interface ComponentSummary {
node: string | null
}
export interface ComponentDetail extends ComponentSummary {
export interface DeploymentDetail extends DeploymentSummary {
manifest: Record<string, unknown>
}
@@ -105,21 +105,21 @@ export interface StatusResponse {
export interface GatewayRoute {
path: string
target_port: number
component: string
program: string
node: string
}
export interface GatewayInfo {
port: number
hostname: string
component_count: number
deployment_count: number
service_count: number
managed_count: number
routes: GatewayRoute[]
}
export interface ServiceActionResponse {
component: string
program: string
action: string
status: string
}
@@ -131,7 +131,7 @@ export interface SSEHealthEvent {
export interface SSEServiceActionEvent {
action: string
component: string
program: string
status: string
}
@@ -147,7 +147,7 @@ export interface NodeSummary {
}
export interface NodeDetail extends NodeSummary {
deployed: ComponentSummary[]
deployed: DeploymentSummary[]
}
export interface MeshStatus {