summaryrefslogtreecommitdiff
path: root/makima/frontend/src/lib
diff options
context:
space:
mode:
authorsoryu <soryu@soryu.co>2026-01-25 02:49:47 +0000
committersoryu <soryu@soryu.co>2026-01-25 03:52:56 +0000
commit34bc1296a53d264216c12cbaa74ca9d68dfe8f22 (patch)
treeef7cee659e2dbe76a491376a8694409c96bb8697 /makima/frontend/src/lib
parent579c983d3efb8f1414ffb45b9e031f741cce5f76 (diff)
downloadsoryu-34bc1296a53d264216c12cbaa74ca9d68dfe8f22.tar.gz
soryu-34bc1296a53d264216c12cbaa74ca9d68dfe8f22.zip
feat: Add contract type templates API endpoint
Add a new API endpoint to provide contract type templates (workflow definitions) separate from file templates. This enables the create contract page to dynamically show available contract types. Changes: - Add ContractTypeTemplate struct in templates.rs with id, name, description, phases, default_phase, and is_builtin fields - Add built-in contract types: 'simple' (plan/execute) and 'specification' (research/specify/plan/execute/review) - Add GET /api/v1/contract-types endpoint returning all contract types - Add frontend ContractTypeTemplate interface and listContractTypes() API function Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat (limited to 'makima/frontend/src/lib')
-rw-r--r--makima/frontend/src/lib/api.ts36
1 files changed, 36 insertions, 0 deletions
diff --git a/makima/frontend/src/lib/api.ts b/makima/frontend/src/lib/api.ts
index 76ee4d4..1ae4103 100644
--- a/makima/frontend/src/lib/api.ts
+++ b/makima/frontend/src/lib/api.ts
@@ -2008,6 +2008,42 @@ export async function getTemplate(id: string): Promise<FileTemplate> {
}
// =============================================================================
+// Contract Type Templates (Workflow Definitions)
+// =============================================================================
+
+/** A contract type template defining a workflow */
+export interface ContractTypeTemplate {
+ /** Unique identifier (e.g., 'simple', 'specification', 'feature-development') */
+ id: string;
+ /** Display name */
+ name: string;
+ /** What this contract type is for */
+ description: string;
+ /** Ordered list of phases in the workflow */
+ phases: string[];
+ /** Starting phase */
+ defaultPhase: string;
+ /** True for built-in types ('simple', 'specification') */
+ isBuiltin: boolean;
+}
+
+export interface ListContractTypesResponse {
+ contractTypes: ContractTypeTemplate[];
+}
+
+/**
+ * List all available contract type templates.
+ * Returns built-in types (simple, specification) and any custom types.
+ */
+export async function listContractTypes(): Promise<ListContractTypesResponse> {
+ const res = await authFetch(`${API_BASE}/api/v1/contract-types`);
+ if (!res.ok) {
+ throw new Error(`Failed to list contract types: ${res.statusText}`);
+ }
+ return res.json();
+}
+
+// =============================================================================
// Supervisor Question Types and Functions
// =============================================================================