Skip to content

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

feat: add button to open shell terminal in app git tab

[._.]/ Adam Eivy598224177e43
diff --git a/client/src/components/apps/tabs/GitTab.jsx b/client/src/components/apps/tabs/GitTab.jsx
index 1dd82d458c..2547223cb4 100644
--- a/client/src/components/apps/tabs/GitTab.jsx
+++ b/client/src/components/apps/tabs/GitTab.jsx
@@ -1,5 +1,6 @@
import { useState, useEffect, useCallback } from 'react';
-import { GitBranch, Plus, Minus, FileText, RefreshCw, Download, Rocket, Upload, ArrowUpDown, Check, Trash2, GitMerge, Globe, RotateCcw } from 'lucide-react';
+import { useNavigate } from 'react-router';
+import { GitBranch, Plus, Minus, FileText, RefreshCw, Download, Rocket, Upload, ArrowUpDown, Check, Trash2, GitMerge, Globe, RotateCcw, Terminal } from 'lucide-react';
import toast from '../../ui/Toast';
import Modal from '../../ui/Modal';
import BrailleSpinner from '../../BrailleSpinner';
@@ -132,6 +133,7 @@ function ConfirmModal({ open, onClose, titleId, icon, title, tone = 'accent', co
}
export default function GitTab({ appId, appName, repoPath }) {
+ const navigate = useNavigate();
const [gitInfo, setGitInfo] = useState(null);
const [diff, setDiff] = useState('');
const [showDiff, setShowDiff] = useState(false);
@@ -258,6 +260,11 @@ export default function GitTab({ appId, appName, repoPath }) {
setSourceRefreshKey((key) => key + 1);
};
+ const handleOpenTerminal = () => {
+ if (!repoPath) return;
+ navigate(`/shell?cwd=${encodeURIComponent(repoPath)}`);
+ };
+
const handleReleasePR = async () => {
if (!branchComparison || branchComparison.ahead === 0) return;
setShowReleaseConfirm(false);
@@ -568,6 +575,15 @@ export default function GitTab({ appId, appName, repoPath }) {
<Download size={16} className={updating ? 'animate-bounce' : ''} />
{updating ? 'Fetching...' : 'Fetch branches'}
</button>
+ <button
+ onClick={handleOpenTerminal}
+ disabled={!repoPath}
+ title="Open shell terminal in this app directory"
+ className="flex items-center gap-1.5 px-3 py-2 bg-port-card border border-port-border rounded-lg text-sm text-gray-300 hover:text-white hover:border-port-accent disabled:opacity-50"
+ >
+ <Terminal size={16} />
+ Open terminal
+ </button>
<button
onClick={() => {
setResetConfirm(true);
diff --git a/client/src/components/apps/tabs/GitTab.test.jsx b/client/src/components/apps/tabs/GitTab.test.jsx
index 84f33f457f..9d63bf052c 100644
--- a/client/src/components/apps/tabs/GitTab.test.jsx
+++ b/client/src/components/apps/tabs/GitTab.test.jsx
@@ -1,6 +1,11 @@
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import { render, screen, fireEvent, cleanup, waitFor } from '@testing-library/react';
+const mockNavigate = vi.hoisted(() => vi.fn());
+vi.mock('react-router', () => ({
+ useNavigate: () => mockNavigate,
+}));
+
// Mock the API surface GitTab calls on mount + when opening the diff modal.
vi.mock('../../../services/api', () => ({
getGitInfo: vi.fn(),
@@ -314,3 +319,22 @@ describe('GitTab reset to origin', () => {
await waitFor(() => expect(api.getGitInfo.mock.calls.length).toBeGreaterThan(beforeConfirm));
});
});
+
+describe('GitTab shell terminal integration', () => {
+ it('renders an Open terminal button next to git action buttons', async () => {
+ render(<GitTab appId="app-example" appName="Example App" repoPath="/srv/example-app" />);
+
+ const button = await screen.findByRole('button', { name: /open terminal/i });
+ expect(button).toBeInTheDocument();
+ expect(button).toHaveAttribute('title', 'Open shell terminal in this app directory');
+ });
+
+ it('navigates to shell terminal with encoded repoPath when Open terminal is clicked', async () => {
+ render(<GitTab appId="app-example" appName="Example App" repoPath="/srv/example-app" />);
+
+ const button = await screen.findByRole('button', { name: /open terminal/i });
+ fireEvent.click(button);
+
+ expect(mockNavigate).toHaveBeenCalledWith('/shell?cwd=%2Fsrv%2Fexample-app');
+ });
+});