diff --git a/apps/arc-web/app/routes/start.tsx b/apps/arc-web/app/routes/start.tsx index a0b53d0a6..ea7f92e13 100644 --- a/apps/arc-web/app/routes/start.tsx +++ b/apps/arc-web/app/routes/start.tsx @@ -11,10 +11,13 @@ import { FolderIcon, } from "@heroicons/react/16/solid"; import { - MagnifyingGlassIcon, BoltIcon, + BugAntIcon, + CodeBracketIcon, + MagnifyingGlassIcon, PencilSquareIcon, ShieldCheckIcon, + XMarkIcon, } from "@heroicons/react/24/outline"; import { Link } from "react-router"; import type { Route } from "./+types/start"; @@ -113,6 +116,7 @@ export default function Start() { const [prompt, setPrompt] = useState(""); const [project, setProject] = useState(projects[0]); const [branch, setBranch] = useState(branches[0]); + const [openCategory, setOpenCategory] = useState(null); const textareaRef = useRef(null); useEffect(() => { @@ -197,31 +201,43 @@ export default function Start() { -
- {starters.map((starter) => ( - - ))} +
+
+ {categories.map((cat) => ( + + ))} +
+ + {openCategory && ( +
+ c.label === openCategory)!} + onClose={() => setOpenCategory(null)} + onSelect={(p) => { + setPrompt(p); + setOpenCategory(null); + textareaRef.current?.focus(); + setTimeout(() => { + const el = textareaRef.current; + if (!el) return; + el.style.height = "auto"; + el.style.height = Math.min(el.scrollHeight, 280) + "px"; + }, 0); + }} + /> +
+ )}
@@ -229,27 +245,82 @@ export default function Start() { ); } -const starters = [ +interface Category { + label: string; + icon: React.ComponentType<{ className?: string }>; + items: { title: string; prompt: string }[]; +} + +const categories: Category[] = [ { - title: "Code review", - description: "Analyze a PR for bugs, security issues, and style", - prompt: "Review the latest pull request for bugs, security vulnerabilities, and code style issues. Summarize findings and suggest fixes.", + label: "Build", + icon: CodeBracketIcon, + items: [ + { title: "Implement a new feature", prompt: "Implement a new feature that adds user authentication with OAuth2, including login, logout, and session management." }, + { title: "Create an API endpoint", prompt: "Create a new REST API endpoint with request validation, error handling, and proper HTTP status codes." }, + { title: "Set up a CI/CD pipeline", prompt: "Set up a CI/CD pipeline with build, test, lint, and deploy stages for the main branch." }, + { title: "Add database migrations", prompt: "Add database migrations to create the new tables and indexes needed for the upcoming feature." }, + ], + }, + { + label: "Review", icon: MagnifyingGlassIcon, + items: [ + { title: "Review a pull request", prompt: "Review the latest pull request for bugs, security vulnerabilities, and code style issues. Summarize findings and suggest fixes." }, + { title: "Audit dependencies", prompt: "Audit all project dependencies for known vulnerabilities, outdated versions, and unused packages." }, + { title: "Analyze test coverage", prompt: "Analyze the current test coverage, identify untested code paths, and recommend which areas need tests most." }, + { title: "Check for security issues", prompt: "Scan the codebase for common security vulnerabilities including injection, XSS, and authentication flaws." }, + ], }, { - title: "Generate tests", - description: "Scaffold unit and integration tests for a module", - prompt: "Generate comprehensive unit and integration tests for the core module, covering edge cases and error paths.", - icon: ShieldCheckIcon, - }, - { - title: "Refactor & optimize", - description: "Improve performance and clean up technical debt", - prompt: "Identify performance bottlenecks and technical debt, then refactor the code for clarity and speed.", - icon: BoltIcon, + label: "Fix", + icon: BugAntIcon, + items: [ + { title: "Debug a failing test", prompt: "Debug the failing test suite, identify the root cause of each failure, and apply fixes." }, + { title: "Fix a production bug", prompt: "Investigate and fix the reported production bug, including root cause analysis and a regression test." }, + { title: "Resolve merge conflicts", prompt: "Resolve the merge conflicts in the current branch, preserving the intended changes from both sides." }, + { title: "Fix type errors", prompt: "Fix all TypeScript type errors in the project, ensuring strict type safety without using any type assertions." }, + ], }, ]; +function CategoryPanel({ + category, + onClose, + onSelect, +}: { + category: Category; + onClose: () => void; + onSelect: (prompt: string) => void; +}) { + return ( +
+
+ + {category.label} + +
+
    + {category.items.map((item, i) => ( +
  • 0 ? "border-t border-white/[0.04]" : ""}> + +
  • + ))} +
+
+ ); +} + function Picker({ value, onChange,