feat: Add description field and auto-spawn discuss agent on initiative creation

This commit is contained in:
Lukas May
2026-03-03 13:40:37 +01:00
parent 9edc93a268
commit 86a1912959
4 changed files with 58 additions and 6 deletions

View File

@@ -1,4 +1,5 @@
import { useEffect, useState } from "react";
import { useNavigate } from "@tanstack/react-router";
import {
Dialog,
DialogContent,
@@ -10,6 +11,7 @@ import {
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import { Textarea } from "@/components/ui/textarea";
import {
Select,
SelectContent,
@@ -31,11 +33,13 @@ export function CreateInitiativeDialog({
onOpenChange,
}: CreateInitiativeDialogProps) {
const [name, setName] = useState("");
const [description, setDescription] = useState("");
const [branch, setBranch] = useState("");
const [projectIds, setProjectIds] = useState<string[]>([]);
const [executionMode, setExecutionMode] = useState<"yolo" | "review_per_phase">("review_per_phase");
const [error, setError] = useState<string | null>(null);
const navigate = useNavigate();
const utils = trpc.useUtils();
const createMutation = trpc.createInitiative.useMutation({
@@ -55,9 +59,10 @@ export function CreateInitiativeDialog({
utils.listInitiatives.setData(undefined, (old = []) => [tempInitiative, ...old]);
return { previousInitiatives };
},
onSuccess: () => {
onSuccess: (data) => {
onOpenChange(false);
toast.success("Initiative created");
navigate({ to: "/initiatives/$id", params: { id: data.id } });
},
onError: (err, _variables, context) => {
if (context?.previousInitiatives) {
@@ -72,6 +77,7 @@ export function CreateInitiativeDialog({
useEffect(() => {
if (open) {
setName("");
setDescription("");
setBranch("");
setProjectIds([]);
setExecutionMode("review_per_phase");
@@ -84,6 +90,7 @@ export function CreateInitiativeDialog({
setError(null);
createMutation.mutate({
name: name.trim(),
description: description.trim() || undefined,
branch: branch.trim() || null,
projectIds: projectIds.length > 0 ? projectIds : undefined,
executionMode,
@@ -112,6 +119,21 @@ export function CreateInitiativeDialog({
autoFocus
/>
</div>
<div className="space-y-2">
<Label htmlFor="initiative-description">
Description{" "}
<span className="text-muted-foreground font-normal">
(optional spawns a discuss agent)
</span>
</Label>
<Textarea
id="initiative-description"
placeholder="Describe what needs to be done..."
value={description}
onChange={(e) => setDescription(e.target.value)}
rows={3}
/>
</div>
<div className="space-y-2">
<Label htmlFor="initiative-branch">
Branch{" "}