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:
@@ -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: () => {
|
||||
|
||||
Reference in New Issue
Block a user