diff --git a/public/app.js b/public/app.js index e372b0c..e5d212d 100644 --- a/public/app.js +++ b/public/app.js @@ -1851,14 +1851,13 @@ const DEV_TARGETS = { antigravity: { id: "antigravity", label: "🛸 Google Antigravity", - defaultModel: "gemini-3.1-pro", + defaultModel: "gemini-3.8-flash", models: [ - { id: "gemini-3.1-pro", label: "Gemini 3.1 Pro (Recommended — Full-Stack & Architecture)" }, - { id: "gemini-3.0-pro", label: "Gemini 3.0 Pro (Deep Reasoning & Complex Refactors)" }, - { id: "gemini-3.1-flash", label: "Gemini 3.1 Flash (Fast Iteration & UI Prototyping)" }, - { id: "gemini-3.1-flash-lite", label: "Gemini 3.1 Flash-Lite (Lightweight & Rapid Tasks)" }, - { id: "claude-sonnet-4.5", label: "Claude 4.5 Sonnet (via Antigravity Model Selector)" }, - { id: "claude-opus-4.5", label: "Claude 4.5 Opus (via Antigravity Model Selector)" } + { id: "gemini-4-argon", label: "Gemini 4 Argon (Medium)" }, + { id: "gemini-3.8-flash", label: "Gemini 3.8 Flash (Medium)" }, + { id: "claude-opus-5.5", label: "Claude Opus 5.5 (Medium)" }, + { id: "claude-sonnet-5.5", label: "Claude Sonnet 5.5 (Medium)" }, + { id: "gpt-oss-120b", label: "GPT-OSS 120B (Medium)" } ] }, codex: { @@ -1875,6 +1874,33 @@ const DEV_TARGETS = { } }; +async function copyTextToClipboard(text) { + if (!text) return false; + if (navigator.clipboard && window.isSecureContext) { + try { + await navigator.clipboard.writeText(text); + return true; + } catch { + // Fall through to fallback + } + } + try { + const textArea = document.createElement("textarea"); + textArea.value = text; + textArea.style.position = "fixed"; + textArea.style.left = "-999999px"; + textArea.style.top = "-999999px"; + document.body.appendChild(textArea); + textArea.focus(); + textArea.select(); + const successful = document.execCommand("copy"); + textArea.remove(); + return successful; + } catch { + return false; + } +} + let activeDevTarget = "antigravity"; function populateDevModelOptions(targetApp) { @@ -1940,6 +1966,14 @@ async function openDevHandoffModal(defaultTarget = "antigravity") { homelabCb.checked = state.activeIdea.category === "project" || !isCurrentProductTShirt(); } + const instructionNote = document.getElementById("dev-handoff-instruction-note"); + if (instructionNote) { + instructionNote.innerHTML = + activeDevTarget === "codex" + ? "🤖 Submitting opens OpenAI Codex with the prompt preloaded and saves the full spec to your workspace." + : "🛸 Submitting switches focus to Antigravity and copies the complete project specification to your clipboard. Simply press Ctrl+V in Antigravity's chat to start coding."; + } + document.getElementById("dev-handoff-result-box")?.classList.add("hidden"); modal.classList.remove("hidden"); await refreshDevSpecPreview(); @@ -2806,6 +2840,13 @@ function bindGlobalEvents() { ? "🚀 Submit & Open in OpenAI Codex" : "🚀 Submit & Launch in Antigravity"; } + const instructionNote = document.getElementById("dev-handoff-instruction-note"); + if (instructionNote) { + instructionNote.innerHTML = + activeDevTarget === "codex" + ? "🤖 Submitting opens OpenAI Codex with the prompt preloaded and saves the full spec to your workspace." + : "🛸 Submitting switches focus to Antigravity and copies the complete project specification to your clipboard. Simply press Ctrl+V in Antigravity's chat to start coding."; + } await refreshDevSpecPreview(); }); }); @@ -2816,8 +2857,8 @@ function bindGlobalEvents() { document.getElementById("btn-copy-dev-spec")?.addEventListener("click", async () => { const text = document.getElementById("dev-spec-preview-textarea")?.value || ""; if (!text) return; - await navigator.clipboard.writeText(text); - showToast("📋 Copied full development specification to clipboard!"); + const ok = await copyTextToClipboard(text); + showToast(ok ? "📋 Copied full development specification to clipboard!" : "⚠️ Unable to auto-copy; please copy text manually."); }); document.getElementById("btn-download-dev-spec")?.addEventListener("click", () => { @@ -2852,11 +2893,7 @@ function bindGlobalEvents() { try { // 1. Copy full specification to clipboard so it's immediately ready to paste (Ctrl+V) in Antigravity or Codex - try { - await navigator.clipboard.writeText(customPrompt); - } catch { - // Ignore clipboard permission errors if non-HTTPS context - } + await copyTextToClipboard(customPrompt); // 2. Persist handoff package & workspace on server const res = await apiFetch(`/api/ideas/${state.activeIdeaId}/dev-handoff`, { @@ -2876,30 +2913,69 @@ function bindGlobalEvents() { if (resultBox) { resultBox.classList.remove("hidden"); - resultBox.innerHTML = ` -
- ✅ Ready in ${escapeHtml(handoff.targetLabel)} (${escapeHtml(handoff.model)}) -
- - 🚀 Open ${activeDevTarget === "codex" ? "Codex App" : "Antigravity App"} - - - 📄 View SPEC.md - + const modelName = handoff.modelLabel || handoff.model; + + if (activeDevTarget === "antigravity") { + resultBox.innerHTML = ` +
+
+
+ 🛸 Switched to Google Antigravity! +
+
+ + + 🛸 Re-Focus Antigravity + + + 📄 View SPEC.md + +
+
+ +
+
+ 👉 Ready to develop with ${escapeHtml(modelName)}! +
+
+ The full specification for ${escapeHtml(state.activeIdea.title)} has been loaded onto your clipboard! Since Antigravity requires starting or selecting your conversation, simply click into Antigravity's chat bar and press Ctrl+V (or Cmd+V) to paste the prompt and begin. +
+
-
-

- Full specification has been copied to your clipboard (Ctrl+V) and saved to server workspace ${escapeHtml(handoff.slug)}. -

- ${ - handoff.codexExecution?.output - ? `
${escapeHtml(handoff.codexExecution.output)}
` - : "" - } - `; + `; + + document.getElementById("btn-copy-dev-spec-again")?.addEventListener("click", async () => { + const reCopied = await copyTextToClipboard(customPrompt); + showToast(reCopied ? "📋 Specification copied to clipboard! Press Ctrl+V in Antigravity." : "⚠️ Please copy manually from the preview below."); + }); + } else { + resultBox.innerHTML = ` +
+ ✅ Ready in ${escapeHtml(handoff.targetLabel)} (${escapeHtml(handoff.model)}) +
+ + 🚀 Open Codex App + + + 📄 View SPEC.md + +
+
+

+ Full specification has been copied to your clipboard (Ctrl+V) and saved to server workspace ${escapeHtml(handoff.slug)}. +

+ ${ + handoff.codexExecution?.output + ? `
${escapeHtml(handoff.codexExecution.output)}
` + : "" + } + `; + } } - showToast(`🚀 Copied full spec & launching ${handoff.targetLabel} (${handoff.model})!`); + showToast(`🛸 Copied spec & launching Antigravity! Paste with Ctrl+V.`); await loadIdeas(); renderDrawerContent(); diff --git a/public/index.html b/public/index.html index d1cb2dd..221b09e 100644 --- a/public/index.html +++ b/public/index.html @@ -936,6 +936,10 @@ +
+ 🛸 Submitting switches focus to Antigravity and copies the complete project specification to your clipboard. Simply press Ctrl+V in Antigravity's chat to start coding. +
+