Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
feat(gsd): add one-click agent spawn and Open Claude Code to GSD setup guide
Adam Eivyc7dfd6bf654b
diff --git a/.changelog/v1.21.x.md b/.changelog/v1.21.x.mdnew file mode 100644index 0000000000..2ef0421bf9--- /dev/null+++ b/.changelog/v1.21.x.md@@ -0,0 +1,13 @@+# Release v1.21.x - Changelog++Released: YYYY-MM-DD++## Overview++GSD tab one-click agent spawning and Claude Code launcher.++## Features++- **GSD one-click agent spawn** — each setup step now has a "Run" button that creates a CoS agent task to execute the GSD command, eliminating the need to manually open a terminal+- **Open Claude Code button** — new button in the GSD setup guide header launches Claude Code directly in the app's directory for interactive use+- **`POST /api/apps/:id/open-claude` endpoint** — spawns Claude Code as a detached process in the app's repo pathdiff --git a/PLAN.md b/PLAN.mdindex 3720a37997..559bf68308 100644--- a/PLAN.md+++ b/PLAN.md@@ -82,6 +82,7 @@ pm2 logs### Planned- [x] **GSD Tab: Smart State Detection & Guided Setup** — Extend `GET /api/apps/:id/documents` to return GSD status fields and update GSD tab empty state with stepped setup guide+- [x] **GSD Tab: One-Click Agent Spawn & Open Claude Code** — Run buttons on setup steps create CoS tasks, Open Claude Code button launches CLI in app directory#### GSD Smart State Detectiondiff --git a/client/src/components/apps/AppDetailView.jsx b/client/src/components/apps/AppDetailView.jsxindex b42454b3c7..86083a0909 100644--- a/client/src/components/apps/AppDetailView.jsx+++ b/client/src/components/apps/AppDetailView.jsx@@ -93,7 +93,7 @@ export default function AppDetailView() {case 'documents':return <DocumentsTab appId={appId} repoPath={app.repoPath} />;case 'gsd':- return <GsdTab appId={appId} />;+ return <GsdTab appId={appId} repoPath={app.repoPath} />;default:return <OverviewTab app={app} onRefresh={fetchApp} />;}diff --git a/client/src/components/apps/tabs/GsdTab.jsx b/client/src/components/apps/tabs/GsdTab.jsxindex 2a28329a53..a42116bd4e 100644--- a/client/src/components/apps/tabs/GsdTab.jsx+++ b/client/src/components/apps/tabs/GsdTab.jsx@@ -1,11 +1,20 @@import { useState, useEffect } from 'react';-import { RefreshCw, Compass, CheckCircle, ArrowRight, FolderSearch, FileText, Map } from 'lucide-react';+import { RefreshCw, Compass, CheckCircle, ArrowRight, FolderSearch, FileText, Map, Play, Terminal } from 'lucide-react';+import toast from 'react-hot-toast';import BrailleSpinner from '../../BrailleSpinner';import PhaseTimeline from '../../gsd/PhaseTimeline';import GsdConcernsPanel from '../../cos/tabs/GsdConcernsPanel';import * as api from '../../../services/api';-function GsdSetupGuide({ gsd, onRefresh }) {+const STEP_DESCRIPTIONS = {+ map: 'Run the /gsd:map-codebase skill to analyze the codebase structure',+ project: 'Run the /gsd:new-project skill to initialize the project with deep context gathering',+ roadmap: 'Run the /gsd:plan-phase skill to create a roadmap with phase breakdown and execution plans',+};++function GsdSetupGuide({ gsd, appId, repoPath, onRefresh }) {+ const [runningStep, setRunningStep] = useState(null);+// Determine the current step based on what existsconst steps = [{@@ -37,6 +46,22 @@ function GsdSetupGuide({ gsd, onRefresh }) {const currentStepIdx = steps.findIndex(s => !s.done);const currentStep = currentStepIdx >= 0 ? steps[currentStepIdx] : null;+ const handleRunStep = async (step) => {+ setRunningStep(step.id);+ await api.addCosTask({+ description: STEP_DESCRIPTIONS[step.id],+ app: appId,+ priority: 'MEDIUM',+ }).catch(() => null);+ toast.success('Agent task created');+ setTimeout(() => setRunningStep(null), 2000);+ };++ const handleOpenClaude = async () => {+ toast('Opening Claude Code...');+ await api.openAppInClaude(appId).catch(() => null);+ };+return (<div className="max-w-5xl"><div className="bg-port-card border border-port-border rounded-lg p-6">@@ -48,12 +73,22 @@ function GsdSetupGuide({ gsd, onRefresh }) {<p className="text-sm text-gray-500">Follow the steps below to initialize GSD project tracking</p></div></div>- <button- onClick={onRefresh}- className="px-3 py-1.5 bg-port-border hover:bg-port-border/80 text-white rounded-lg text-xs flex items-center gap-1"- >- <RefreshCw size={14} /> Refresh- </button>+ <div className="flex items-center gap-2">+ {repoPath && (+ <button+ onClick={handleOpenClaude}+ className="px-3 py-1.5 bg-purple-600/20 hover:bg-purple-600/30 text-purple-400 rounded-lg text-xs flex items-center gap-1 border border-purple-600/30"+ >+ <Terminal size={14} /> Open Claude Code+ </button>+ )}+ <button+ onClick={onRefresh}+ className="px-3 py-1.5 bg-port-border hover:bg-port-border/80 text-white rounded-lg text-xs flex items-center gap-1"+ >+ <RefreshCw size={14} /> Refresh+ </button>+ </div></div>{/* Step indicators */}@@ -94,8 +129,14 @@ function GsdSetupGuide({ gsd, onRefresh }) {</div>{isCurrent && (<div className="flex items-center gap-2 flex-shrink-0">- <ArrowRight size={14} className="text-port-accent" /><code className="text-sm text-cyan-400 bg-port-bg px-2 py-1 rounded">{step.command}</code>+ <button+ onClick={() => handleRunStep(step)}+ disabled={runningStep === step.id}+ className="px-3 py-1.5 bg-port-accent/20 hover:bg-port-accent/30 text-port-accent rounded-lg text-xs flex items-center gap-1 border border-port-accent/30 disabled:opacity-50"+ >+ <Play size={14} /> {runningStep === step.id ? 'Created' : 'Run'}+ </button></div>)}{isFuture && !step.done && (@@ -108,7 +149,7 @@ function GsdSetupGuide({ gsd, onRefresh }) {{currentStep && (<p className="text-xs text-gray-500 mt-4">- Run <code className="text-cyan-400">{currentStep.command}</code> in Claude Code from the app's repo to continue.+ Click <strong className="text-gray-400">Run</strong> to create a CoS agent task, or run <code className="text-cyan-400">{currentStep.command}</code> in Claude Code manually.</p>)}</div>@@ -116,7 +157,7 @@ function GsdSetupGuide({ gsd, onRefresh }) {);}-export default function GsdTab({ appId }) {+export default function GsdTab({ appId, repoPath }) {const [project, setProject] = useState(null);const [gsdStatus, setGsdStatus] = useState(null);const [loading, setLoading] = useState(true);@@ -154,7 +195,7 @@ export default function GsdTab({ appId }) {// Show setup guide if project isn't fully initializedif (!project) {- return <GsdSetupGuide gsd={gsdStatus || {}} onRefresh={fetchData} />;+ return <GsdSetupGuide gsd={gsdStatus || {}} appId={appId} repoPath={repoPath} onRefresh={fetchData} />;}const phaseCount = project?.phases?.length || 0;diff --git a/client/src/services/api.js b/client/src/services/api.jsindex 20a1915e04..8707603f67 100644--- a/client/src/services/api.js+++ b/client/src/services/api.js@@ -111,6 +111,7 @@ export const restartApp = (id) => request(`/apps/${id}/restart`, { method: 'POSTexport const archiveApp = (id) => request(`/apps/${id}/archive`, { method: 'POST' });export const unarchiveApp = (id) => request(`/apps/${id}/unarchive`, { method: 'POST' });export const openAppInEditor = (id) => request(`/apps/${id}/open-editor`, { method: 'POST' });+export const openAppInClaude = (id) => request(`/apps/${id}/open-claude`, { method: 'POST' });export const openAppFolder = (id) => request(`/apps/${id}/open-folder`, { method: 'POST' });export const refreshAppConfig = (id) => request(`/apps/${id}/refresh-config`, { method: 'POST' });export const pullAndUpdateApp = (id) => request(`/apps/${id}/update`, { method: 'POST' });diff --git a/package-lock.json b/package-lock.jsonindex 118571f955..c3f2a7c9b3 100644--- a/package-lock.json+++ b/package-lock.json@@ -1,12 +1,12 @@{"name": "portos",- "version": "1.20.0",+ "version": "1.21.0","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "portos",- "version": "1.20.0",+ "version": "1.21.0","license": "MIT","dependencies": {"express": "^4.21.2",diff --git a/package.json b/package.jsonindex d76fafa64b..7fb83ea585 100644--- a/package.json+++ b/package.json@@ -1,6 +1,6 @@{"name": "portos",- "version": "1.20.0",+ "version": "1.21.0","private": true,"description": "Local dev machine App OS portal","author": "Adam Eivy (@antic|@atomantic)",diff --git a/server/routes/apps.js b/server/routes/apps.jsindex a953229fef..b04f8a3f47 100644--- a/server/routes/apps.js+++ b/server/routes/apps.js@@ -113,6 +113,17 @@ router.get('/:id', loadApp, asyncHandler(async (req, res) => {statuses[processName] = status;}+ // Compute overall status (same logic as list endpoint)+ const statusValues = Object.values(statuses);+ let overallStatus = 'unknown';+ if (statusValues.some(s => s.status === 'online')) {+ overallStatus = 'online';+ } else if (statusValues.some(s => s.status === 'stopped')) {+ overallStatus = 'stopped';+ } else if (statusValues.every(s => s.status === 'not_found')) {+ overallStatus = 'not_started';+ }+// Auto-derive uiPort/apiPort from processes when not explicitly setlet { uiPort, apiPort } = app;const processes = app.processes || [];@@ -125,7 +136,7 @@ router.get('/:id', loadApp, asyncHandler(async (req, res) => {if (apiProc) apiPort = apiProc.ports.api;}- res.json({ ...app, uiPort, apiPort, pm2Status: statuses });+ res.json({ ...app, uiPort, apiPort, overallStatus, pm2Status: statuses });}));// POST /api/apps - Create new app@@ -433,6 +444,27 @@ router.post('/:id/open-editor', loadApp, asyncHandler(async (req, res) => {res.json({ success: true, command: editorCommand, path: app.repoPath });}));+// POST /api/apps/:id/open-claude - Open Claude Code in app directory+router.post('/:id/open-claude', loadApp, asyncHandler(async (req, res) => {+ const app = req.loadedApp;++ if (!existsSync(app.repoPath)) {+ throw new ServerError('App path does not exist', { status: 400, code: 'PATH_NOT_FOUND' });+ }++ const child = spawn('claude', [], {+ cwd: app.repoPath,+ detached: true,+ stdio: 'ignore',+ shell: false,+ windowsHide: true+ });+ child.unref();++ console.log(`🤖 Opened Claude Code in ${app.name}`);+ res.json({ success: true, path: app.repoPath });+}));+// POST /api/apps/:id/open-folder - Open app folder in file managerrouter.post('/:id/open-folder', loadApp, asyncHandler(async (req, res) => {const app = req.loadedApp;