diff options
Diffstat (limited to 'makima/frontend')
| -rw-r--r-- | makima/frontend/src/lib/api.ts | 23 | ||||
| -rw-r--r-- | makima/frontend/src/routes/contracts.tsx | 72 |
2 files changed, 84 insertions, 11 deletions
diff --git a/makima/frontend/src/lib/api.ts b/makima/frontend/src/lib/api.ts index d77c85c..d7ac8b6 100644 --- a/makima/frontend/src/lib/api.ts +++ b/makima/frontend/src/lib/api.ts @@ -1342,11 +1342,26 @@ export async function deleteAccount( // Contract Types for Workflow Management // ============================================================================= +/** Contract type determines the workflow and required documents */ +export type ContractType = "simple" | "specification"; export type ContractPhase = "research" | "specify" | "plan" | "execute" | "review"; export type ContractStatus = "active" | "completed" | "archived"; export type RepositorySourceType = "remote" | "local" | "managed"; export type RepositoryStatus = "ready" | "pending" | "creating" | "failed"; +/** Get valid phases for a contract type */ +export function getValidPhases(contractType: ContractType): ContractPhase[] { + if (contractType === "simple") { + return ["plan", "execute"]; + } + return ["research", "specify", "plan", "execute", "review"]; +} + +/** Get default initial phase for a contract type */ +export function getDefaultPhase(contractType: ContractType): ContractPhase { + return contractType === "simple" ? "plan" : "research"; +} + export interface ContractRepository { id: string; contractId: string; @@ -1364,6 +1379,8 @@ export interface ContractSummary { id: string; name: string; description: string | null; + /** Contract type: "simple" or "specification" */ + contractType: ContractType; phase: ContractPhase; status: ContractStatus; fileCount: number; @@ -1378,6 +1395,8 @@ export interface Contract { ownerId: string; name: string; description: string | null; + /** Contract type: "simple" or "specification" */ + contractType: ContractType; phase: ContractPhase; status: ContractStatus; /** Supervisor task ID for contract orchestration */ @@ -1411,7 +1430,9 @@ export interface ContractListResponse { export interface CreateContractRequest { name: string; description?: string; - /** Initial phase to start in (defaults to "research") */ + /** Contract type: "simple" (default) or "specification" */ + contractType?: ContractType; + /** Initial phase to start in (defaults based on contract type) */ initialPhase?: ContractPhase; } diff --git a/makima/frontend/src/routes/contracts.tsx b/makima/frontend/src/routes/contracts.tsx index 8c90804..f09ec5b 100644 --- a/makima/frontend/src/routes/contracts.tsx +++ b/makima/frontend/src/routes/contracts.tsx @@ -11,10 +11,12 @@ import type { ContractWithRelations, ContractPhase, ContractStatus, + ContractType, CreateContractRequest, RepositorySourceType, DaemonDirectory, } from "../lib/api"; +import { getValidPhases, getDefaultPhase } from "../lib/api"; export default function ContractsPage() { const { isAuthenticated, isAuthConfigured, isLoading: authLoading } = useAuth(); @@ -71,7 +73,8 @@ function ContractsPageContent() { const [isCreating, setIsCreating] = useState(false); const [newContractName, setNewContractName] = useState(""); const [newContractDescription, setNewContractDescription] = useState(""); - const [initialPhase, setInitialPhase] = useState<ContractPhase>("research"); + const [contractType, setContractType] = useState<ContractType>("simple"); + const [initialPhase, setInitialPhase] = useState<ContractPhase>("plan"); const [repoType, setRepoType] = useState<RepositorySourceType>("remote"); const [repoName, setRepoName] = useState(""); const [repoUrl, setRepoUrl] = useState(""); @@ -136,7 +139,8 @@ function ContractsPageContent() { const data: CreateContractRequest = { name: newContractName.trim(), description: newContractDescription.trim() || undefined, - initialPhase: initialPhase !== "research" ? initialPhase : undefined, + contractType: contractType, + initialPhase: initialPhase !== getDefaultPhase(contractType) ? initialPhase : undefined, }; try { @@ -171,7 +175,8 @@ function ContractsPageContent() { setIsCreating(false); setNewContractName(""); setNewContractDescription(""); - setInitialPhase("research"); + setContractType("simple"); + setInitialPhase("plan"); setRepoType("remote"); setRepoName(""); setRepoUrl(""); @@ -184,6 +189,8 @@ function ContractsPageContent() { }, [ newContractName, newContractDescription, + contractType, + initialPhase, repoType, repoName, repoUrl, @@ -200,7 +207,8 @@ function ContractsPageContent() { setIsCreating(false); setNewContractName(""); setNewContractDescription(""); - setInitialPhase("research"); + setContractType("simple"); + setInitialPhase("plan"); setRepoType("remote"); setRepoName(""); setRepoUrl(""); @@ -424,6 +432,48 @@ function ContractsPageContent() { /> </div> + {/* Contract Type */} + <div> + <label className="block font-mono text-xs text-[#8b949e] uppercase mb-1"> + Contract Type + </label> + <div className="flex gap-2"> + <button + type="button" + onClick={() => { + setContractType("simple"); + setInitialPhase("plan"); + }} + className={`flex-1 px-3 py-2 font-mono text-xs uppercase transition-colors ${ + contractType === "simple" + ? "bg-[#0f3c78] text-[#dbe7ff] border border-[#75aafc]" + : "bg-[#0d1b2d] text-[#8b949e] border border-[#3f6fb3] hover:border-[#75aafc]" + }`} + > + Simple + </button> + <button + type="button" + onClick={() => { + setContractType("specification"); + setInitialPhase("research"); + }} + className={`flex-1 px-3 py-2 font-mono text-xs uppercase transition-colors ${ + contractType === "specification" + ? "bg-[#0f3c78] text-[#dbe7ff] border border-[#75aafc]" + : "bg-[#0d1b2d] text-[#8b949e] border border-[#3f6fb3] hover:border-[#75aafc]" + }`} + > + Specification + </button> + </div> + <p className="mt-1 font-mono text-xs text-[#8b949e]"> + {contractType === "simple" + ? "Plan → Execute: Simple workflow with a plan document" + : "Research → Specify → Plan → Execute → Review: Full specification-driven development with TDD"} + </p> + </div> + {/* Starting Phase */} <div> <label className="block font-mono text-xs text-[#8b949e] uppercase mb-1"> @@ -434,14 +484,16 @@ function ContractsPageContent() { onChange={(e) => setInitialPhase(e.target.value as ContractPhase)} className="w-full px-3 py-2 bg-[#0d1b2d] border border-[#3f6fb3] text-[#dbe7ff] font-mono text-sm focus:outline-none focus:border-[#75aafc]" > - <option value="research">Research</option> - <option value="specify">Specify</option> - <option value="plan">Plan</option> - <option value="execute">Execute</option> - <option value="review">Review</option> + {getValidPhases(contractType).map((phase) => ( + <option key={phase} value={phase}> + {phase.charAt(0).toUpperCase() + phase.slice(1)} + </option> + ))} </select> <p className="mt-1 font-mono text-xs text-[#8b949e]"> - Skip earlier phases if you already have requirements defined + {contractType === "simple" + ? "Start in Plan to define what to build, or Execute if already planned" + : "Skip earlier phases if you already have requirements defined"} </p> </div> |
