From 151e9d87e117b7980e6aad522ac8f3633eeca87a Mon Sep 17 00:00:00 2001 From: soryu Date: Mon, 2 Feb 2026 02:34:50 +0000 Subject: Make makima more opinionated and structured --- makima/frontend/src/components/NavStrip.tsx | 1 - .../src/components/contracts/ContractList.tsx | 5 - .../src/components/templates/TemplateEditor.tsx | 257 -------------- makima/frontend/src/lib/api.ts | 110 +----- makima/frontend/src/main.tsx | 9 - makima/frontend/src/routes/contracts.tsx | 58 --- makima/frontend/src/routes/templates.tsx | 388 --------------------- makima/frontend/src/types/templates.ts | 90 ----- 8 files changed, 2 insertions(+), 916 deletions(-) delete mode 100644 makima/frontend/src/components/templates/TemplateEditor.tsx delete mode 100644 makima/frontend/src/routes/templates.tsx delete mode 100644 makima/frontend/src/types/templates.ts (limited to 'makima/frontend/src') diff --git a/makima/frontend/src/components/NavStrip.tsx b/makima/frontend/src/components/NavStrip.tsx index f44799b..fb95c7f 100644 --- a/makima/frontend/src/components/NavStrip.tsx +++ b/makima/frontend/src/components/NavStrip.tsx @@ -14,7 +14,6 @@ const NAV_LINKS: NavLink[] = [ { label: "Board", href: "/workflow", requiresAuth: true }, { label: "Mesh", href: "/mesh", requiresAuth: true }, { label: "History", href: "/history", requiresAuth: true }, - { label: "Templates", href: "/templates", requiresAuth: true }, ]; export function NavStrip() { diff --git a/makima/frontend/src/components/contracts/ContractList.tsx b/makima/frontend/src/components/contracts/ContractList.tsx index 532ab87..98f8ff6 100644 --- a/makima/frontend/src/components/contracts/ContractList.tsx +++ b/makima/frontend/src/components/contracts/ContractList.tsx @@ -136,11 +136,6 @@ export function ContractList({ Local )} - {contract.redTeamEnabled && ( - - 🔍 Red Team - - )} void; - onCancel: () => void; - readOnly?: boolean; -} - -export function TemplateEditor({ template, onSave, onCancel, readOnly = false }: Props) { - const [editedTemplate, setEditedTemplate] = useState({ - ...template, - phases: template.phases.map((p) => ({ - ...p, - deliverables: [...p.deliverables], - })), - }); - const [newDeliverableName, setNewDeliverableName] = useState<{ - [phaseId: string]: string; - }>({}); - - const handlePhaseNameChange = (phaseId: string, newName: string) => { - setEditedTemplate((prev) => ({ - ...prev, - phases: prev.phases.map((p) => - p.id === phaseId ? { ...p, name: newName } : p - ), - })); - }; - - const handleDeliverableNameChange = ( - phaseId: string, - deliverableId: string, - newName: string - ) => { - setEditedTemplate((prev) => ({ - ...prev, - phases: prev.phases.map((p) => - p.id === phaseId - ? { - ...p, - deliverables: p.deliverables.map((d) => - d.id === deliverableId ? { ...d, name: newName } : d - ), - } - : p - ), - })); - }; - - const handleAddDeliverable = (phaseId: string) => { - const name = newDeliverableName[phaseId]?.trim(); - if (!name) return; - - const newDeliverable: Deliverable = { - id: `deliverable-${Date.now()}`, - name, - }; - - setEditedTemplate((prev) => ({ - ...prev, - phases: prev.phases.map((p) => - p.id === phaseId - ? { ...p, deliverables: [...p.deliverables, newDeliverable] } - : p - ), - })); - setNewDeliverableName((prev) => ({ ...prev, [phaseId]: "" })); - }; - - const handleRemoveDeliverable = (phaseId: string, deliverableId: string) => { - setEditedTemplate((prev) => ({ - ...prev, - phases: prev.phases.map((p) => - p.id === phaseId - ? { - ...p, - deliverables: p.deliverables.filter((d) => d.id !== deliverableId), - } - : p - ), - })); - }; - - const handleAddPhase = () => { - const newPhase: Phase = { - id: `phase-${Date.now()}`, - name: "New Phase", - deliverables: [], - }; - setEditedTemplate((prev) => ({ - ...prev, - phases: [...prev.phases, newPhase], - })); - }; - - const handleRemovePhase = (phaseId: string) => { - setEditedTemplate((prev) => ({ - ...prev, - phases: prev.phases.filter((p) => p.id !== phaseId), - })); - }; - - return ( -
- {/* Header */} -
-

- {readOnly ? "View" : "Edit"} Template: {template.name} -

-

- {template.description} -

- {readOnly && ( -

- Built-in templates are read-only -

- )} -
- - {/* Phases */} -
- {editedTemplate.phases.map((phase, phaseIndex) => ( -
- {/* Phase Header */} -
- - {phaseIndex + 1} - - handlePhaseNameChange(phase.id, e.target.value)} - placeholder="Phase name" - disabled={readOnly} - /> - {!template.isBuiltIn && ( - - )} -
- - {/* Deliverables */} -
- {phase.deliverables.length === 0 ? ( -
- No deliverables -
- ) : ( - phase.deliverables.map((deliverable) => ( -
- - - - handleDeliverableNameChange( - phase.id, - deliverable.id, - e.target.value - ) - } - /> - -
- )) - )} - - {/* Add Deliverable */} -
- - setNewDeliverableName((prev) => ({ - ...prev, - [phase.id]: e.target.value, - })) - } - onKeyPress={(e) => { - if (e.key === "Enter") { - handleAddDeliverable(phase.id); - } - }} - /> - -
-
-
- ))} -
- - {/* Add Phase (only for custom templates) */} - {!template.isBuiltIn && ( - - )} - - {/* Footer Actions */} -
- - {!readOnly && ( - - )} -
-
- ); -} diff --git a/makima/frontend/src/lib/api.ts b/makima/frontend/src/lib/api.ts index e8b3d8a..f148d76 100644 --- a/makima/frontend/src/lib/api.ts +++ b/makima/frontend/src/lib/api.ts @@ -1659,45 +1659,9 @@ export interface DeliverableDefinition { priority: "required" | "recommended" | "optional"; } -/** Request to create a custom contract type template */ -export interface CreateTemplateRequest { - name: string; - description?: string; - phases: PhaseDefinition[]; - defaultPhase: string; - deliverables?: Record; -} - -/** Request to update a custom contract type template */ -export interface UpdateTemplateRequest { - name?: string; - description?: string; - phases?: PhaseDefinition[]; - defaultPhase?: string; - deliverables?: Record; - version?: number; -} - -/** Custom template record from the API */ -export interface ContractTypeTemplateRecord { - id: string; - name: string; - description: string | null; - phases: PhaseDefinition[]; - defaultPhase: string; - isBuiltin: boolean; - version: number; - createdAt: string; -} - -/** Response for single template operations */ -export interface TemplateResponse { - template: ContractTypeTemplateRecord; -} - /** - * List available contract types/templates. - * Returns built-in types (simple, specification) and any custom types. + * List available contract types. + * Returns built-in types only (simple, specification, execute). */ export async function listContractTypes(): Promise { const res = await authFetch(`${API_BASE}/api/v1/contract-types`); @@ -1707,66 +1671,6 @@ export async function listContractTypes(): Promise { return res.json(); } -/** - * Create a new custom contract type template. - */ -export async function createContractTemplate( - req: CreateTemplateRequest -): Promise { - const res = await authFetch(`${API_BASE}/api/v1/contract-types`, { - method: "POST", - headers: { "Content-Type": "application/json" }, - body: JSON.stringify(req), - }); - if (!res.ok) { - const err = await res.json().catch(() => ({ message: res.statusText })); - throw new Error(err.message || `Failed to create template: ${res.statusText}`); - } - return res.json(); -} - -/** - * Get a custom contract type template by ID. - */ -export async function getContractTemplate(id: string): Promise { - const res = await authFetch(`${API_BASE}/api/v1/contract-types/${id}`); - if (!res.ok) { - throw new Error(`Failed to get template: ${res.statusText}`); - } - return res.json(); -} - -/** - * Update a custom contract type template. - */ -export async function updateContractTemplate( - id: string, - req: UpdateTemplateRequest -): Promise { - const res = await authFetch(`${API_BASE}/api/v1/contract-types/${id}`, { - method: "PUT", - headers: { "Content-Type": "application/json" }, - body: JSON.stringify(req), - }); - if (!res.ok) { - const err = await res.json().catch(() => ({ message: res.statusText })); - throw new Error(err.message || `Failed to update template: ${res.statusText}`); - } - return res.json(); -} - -/** - * Delete a custom contract type template. - */ -export async function deleteContractTemplate(id: string): Promise { - const res = await authFetch(`${API_BASE}/api/v1/contract-types/${id}`, { - method: "DELETE", - }); - if (!res.ok) { - throw new Error(`Failed to delete template: ${res.statusText}`); - } -} - export interface ContractRepository { id: string; contractId: string; @@ -1792,8 +1696,6 @@ export interface ContractSummary { supervisorTaskId: string | null; /** When true, tasks won't auto-push or create PRs - use patch files instead */ localOnly: boolean; - /** When true, a red team task monitors work output for quality */ - redTeamEnabled: boolean; fileCount: number; taskCount: number; repositoryCount: number; @@ -1818,10 +1720,6 @@ export interface Contract { phaseGuard: boolean; /** When true, tasks won't auto-push or create PRs - use patch files instead */ localOnly: boolean; - /** When true, a red team task monitors work output for quality */ - redTeamEnabled: boolean; - /** Custom criteria for the red team to evaluate */ - redTeamPrompt: string | null; version: number; createdAt: string; updatedAt: string; @@ -1859,10 +1757,6 @@ export interface CreateContractRequest { initialPhase?: ContractPhase | string; /** When true, tasks won't auto-push or create PRs - use patch files instead */ localOnly?: boolean; - /** When true, spawn a red team task to monitor work output */ - redTeamEnabled?: boolean; - /** Custom criteria for the red team to evaluate */ - redTeamPrompt?: string; } export interface UpdateContractRequest { diff --git a/makima/frontend/src/main.tsx b/makima/frontend/src/main.tsx index ef1ba5c..50fffe4 100644 --- a/makima/frontend/src/main.tsx +++ b/makima/frontend/src/main.tsx @@ -18,7 +18,6 @@ import HistoryPage from "./routes/history"; import LoginPage from "./routes/login"; import SettingsPage from "./routes/settings"; import ContractFilePage from "./routes/contract-file"; -import TemplatesPage from "./routes/templates"; import SpeakPage from "./routes/speak"; createRoot(document.getElementById("root")!).render( @@ -128,14 +127,6 @@ createRoot(document.getElementById("root")!).render( } /> - - - - } - /> ([]); const [contractTypesLoading, setContractTypesLoading] = useState(false); const [localOnly, setLocalOnly] = useState(false); - const [redTeamEnabled, setRedTeamEnabled] = useState(false); - const [redTeamPrompt, setRedTeamPrompt] = useState(""); // Fetch contract types when modal opens - API returns both built-in and custom templates useEffect(() => { @@ -238,8 +236,6 @@ function ContractsPageContent() { templateId: isCustomTemplate ? contractType : undefined, initialPhase: initialPhase !== defaultPhaseForType ? initialPhase : undefined, localOnly: localOnly || undefined, - redTeamEnabled: redTeamEnabled || undefined, - redTeamPrompt: redTeamEnabled && redTeamPrompt.trim() ? redTeamPrompt.trim() : undefined, }; try { @@ -315,8 +311,6 @@ function ContractsPageContent() { setRepoUrl(""); setRepoPath(""); setLocalOnly(false); - setRedTeamEnabled(false); - setRedTeamPrompt(""); setCreateError(null); }, []); @@ -689,58 +683,6 @@ function ContractsPageContent() { {/* Red Team Monitoring */} -
-
- - -
-

- Spawns a parallel task to monitor work output for quality and compliance. -

- {redTeamEnabled && ( -
- -