/* RFC-1065: Shared helpers for lagebild commands — resolve worker name from system-config, read lagebild state, and define secret name constants. Do not perform file IO — use passed-in SystemConfig/SystemState objects only. Do not make network calls. RFC-1065: initial lagebild helpers for connect, validate, and status commands. RFC-1097: step 6 — compass.migrate codemod run Mechanical v1 to v2 header migration across the workspace: 942 files rewritten — CHANGE_SUMMARY windows collapsed into history, forbidden v1 blocks stripped, KEY_DECISIONS seeded from @ai-invariant comments (5 files) or TODO placeholders (103 files), blocks reordered to canonical order. RFC-1097: sweep — werkstatt-engine clean Sweep batch 4: 73 Compass headers on headerless engine files (certification, component-runtime, isolation, evolution, testing), real KEY_DECISIONS on 75 files (kernel, cache, dht, swim, gitmesh, runtime), ~80 purpose expansions (CONTRACT-02/PURPOSE-02), non-goals on 13 CONTRACT-03 files, CS-07 history literal fix repo-wide (253 files). Policy: .template.ts/.template.astro excludedPaths. werkstatt-engine now 0 diagnostics. */ import type { SystemConfig, SystemState } from "@warpgogol/werkstatt-shared/ontology/operations"; export const LAGEBILD_SECRET_NAMES = [ "LAGEBILD_API_URL", "LAGEBILD_API_KEY", "LAGEBILD_TENANT_ID", "LAGEBILD_SOURCE_SYSTEM_ID", ] as const; export type LagebildSecretName = (typeof LAGEBILD_SECRET_NAMES)[number]; export type ChannelName = "dev" | "alt" | "main"; export function resolveWorkerName(config: SystemConfig, channel: string): string { if (!config.deployment) { throw new Error( `[lagebild] No deployment configuration in system-config.yaml. Cannot resolve worker name.`, ); } const ch = config.deployment.channels[channel as ChannelName]; if (!ch) { throw new Error( `[lagebild] Channel "${channel}" not found in system-config.yaml deployment.channels. Available: dev, alt, main.`, ); } return ch.workerName; } export function readLagebildState(state: SystemState): SystemState["lagebild"] { return state.lagebild; }