summaryrefslogtreecommitdiff
path: root/makima/frontend/src/lib
diff options
context:
space:
mode:
authorsoryu <soryu@soryu.co>2026-01-26 19:15:03 +0000
committersoryu <soryu@soryu.co>2026-01-26 19:15:03 +0000
commit2ee09745c12f0762ab99fadb00cdc0c363cb027b (patch)
tree7a634661956989c1b10e2ad50969a8d9d9a828b2 /makima/frontend/src/lib
parentcb4f2fc40dbabb40de948512eee74c7e46264665 (diff)
downloadsoryu-makima/task-task-6dc740fd-6dc740fd.tar.gz
soryu-makima/task-task-6dc740fd-6dc740fd.zip
[WIP] Heartbeat checkpoint - 2026-01-26 19:15:03 UTCmakima/task-task-6dc740fd-6dc740fd
Diffstat (limited to 'makima/frontend/src/lib')
-rw-r--r--makima/frontend/src/lib/api.ts142
1 files changed, 106 insertions, 36 deletions
diff --git a/makima/frontend/src/lib/api.ts b/makima/frontend/src/lib/api.ts
index 64ce591..4a7486f 100644
--- a/makima/frontend/src/lib/api.ts
+++ b/makima/frontend/src/lib/api.ts
@@ -811,6 +811,112 @@ export async function retryCompletionAction(
return res.json();
}
+// =============================================================================
+// Git Actions for Tasks (Manual)
+// =============================================================================
+
+/** Response from export patch */
+export interface ExportPatchResponse {
+ success: boolean;
+ taskId: string;
+ fileName: string;
+ filePath?: string;
+ patchSize?: number;
+ message: string;
+}
+
+/**
+ * Export a task's changes as a patch file.
+ * The patch will be saved to the contract's patch directory.
+ */
+export async function exportTaskPatch(
+ taskId: string,
+ fileName?: string
+): Promise<ExportPatchResponse> {
+ const body: Record<string, unknown> = {};
+ if (fileName) {
+ body.fileName = fileName;
+ }
+ const res = await authFetch(`${API_BASE}/api/v1/mesh/tasks/${taskId}/export-patch`, {
+ method: "POST",
+ body: JSON.stringify(body),
+ });
+ if (!res.ok) {
+ const errorText = await res.text();
+ throw new Error(`Failed to export patch: ${errorText || res.statusText}`);
+ }
+ return res.json();
+}
+
+/** Response from push branch */
+export interface PushBranchResponse {
+ success: boolean;
+ taskId: string;
+ branchName: string;
+ remote?: string;
+ message: string;
+}
+
+/**
+ * Push a task's changes to a remote branch.
+ * Creates a branch if it doesn't exist and pushes the commits.
+ */
+export async function pushTaskBranch(
+ taskId: string,
+ branchName?: string
+): Promise<PushBranchResponse> {
+ const body: Record<string, unknown> = {};
+ if (branchName) {
+ body.branchName = branchName;
+ }
+ const res = await authFetch(`${API_BASE}/api/v1/mesh/tasks/${taskId}/push-branch`, {
+ method: "POST",
+ body: JSON.stringify(body),
+ });
+ if (!res.ok) {
+ const errorText = await res.text();
+ throw new Error(`Failed to push branch: ${errorText || res.statusText}`);
+ }
+ return res.json();
+}
+
+/** Response from create PR */
+export interface CreatePRResponse {
+ success: boolean;
+ taskId: string;
+ prUrl?: string;
+ prNumber?: number;
+ branchName?: string;
+ message: string;
+}
+
+/**
+ * Create a pull request for a task's changes.
+ * First pushes the branch if needed, then creates the PR.
+ */
+export async function createTaskPR(
+ taskId: string,
+ title?: string,
+ body?: string
+): Promise<CreatePRResponse> {
+ const reqBody: Record<string, unknown> = {};
+ if (title) {
+ reqBody.title = title;
+ }
+ if (body) {
+ reqBody.body = body;
+ }
+ const res = await authFetch(`${API_BASE}/api/v1/mesh/tasks/${taskId}/create-pr`, {
+ method: "POST",
+ body: JSON.stringify(reqBody),
+ });
+ if (!res.ok) {
+ const errorText = await res.text();
+ throw new Error(`Failed to create PR: ${errorText || res.statusText}`);
+ }
+ return res.json();
+}
+
/** A suggested directory from a connected daemon */
export interface DaemonDirectory {
/** Path to the directory */
@@ -2045,42 +2151,6 @@ 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
// =============================================================================