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: display JIRA sprint tickets in app expansion

Adam Eivye4c46c62ad9f
diff --git a/client/src/pages/Apps.jsx b/client/src/pages/Apps.jsx
index 7ee43524a4..dcfb7c4487 100644
--- a/client/src/pages/Apps.jsx
+++ b/client/src/pages/Apps.jsx
@@ -1,6 +1,6 @@
import { useState, useEffect, useCallback } from 'react';
import { Link } from 'react-router-dom';
-import { ExternalLink, Play, Square, RotateCcw, FolderOpen, Terminal, Code, RefreshCw, Wrench, Archive, ArchiveRestore } from 'lucide-react';
+import { ExternalLink, Play, Square, RotateCcw, FolderOpen, Terminal, Code, RefreshCw, Wrench, Archive, ArchiveRestore, ChevronDown, ChevronUp, Ticket } from 'lucide-react';
import toast from 'react-hot-toast';
import BrailleSpinner from '../components/BrailleSpinner';
import StatusBadge from '../components/StatusBadge';
@@ -19,6 +19,8 @@ export default function Apps() {
const [standardizing, setStandardizing] = useState({});
const [archiving, setArchiving] = useState({});
const [showArchived, setShowArchived] = useState(false);
+ const [jiraTickets, setJiraTickets] = useState({});
+ const [loadingTickets, setLoadingTickets] = useState({});
const fetchApps = useCallback(async () => {
const data = await api.getApps().catch(() => []);
@@ -102,8 +104,22 @@ export default function Apps() {
}
};
- const toggleExpand = (id) => {
- setExpandedId(prev => prev === id ? null : id);
+ const toggleExpand = async (id) => {
+ const newExpandedId = expandedId === id ? null : id;
+ setExpandedId(newExpandedId);
+
+ // Fetch JIRA tickets when expanding an app with JIRA enabled
+ if (newExpandedId) {
+ const app = apps.find(a => a.id === newExpandedId);
+ if (app?.jira?.enabled && app.jira.instanceId && app.jira.projectKey) {
+ if (!jiraTickets[id]) {
+ setLoadingTickets(prev => ({ ...prev, [id]: true }));
+ const tickets = await api.getMySprintTickets(app.jira.instanceId, app.jira.projectKey).catch(() => []);
+ setJiraTickets(prev => ({ ...prev, [id]: tickets }));
+ setLoadingTickets(prev => ({ ...prev, [id]: false }));
+ }
+ }
+ }
};
const handleArchive = async (app) => {
@@ -422,6 +438,87 @@ export default function Apps() {
</div>
)}
+ {/* JIRA Integration */}
+ {app.jira?.enabled && (
+ <div>
+ <div className="text-xs text-gray-500 uppercase tracking-wide mb-2">JIRA Integration</div>
+ <div className="flex flex-wrap items-center gap-3 px-3 py-2 bg-port-card border border-port-border rounded-lg">
+ <Ticket size={16} aria-hidden="true" className="text-blue-400 flex-shrink-0" />
+ <span className="text-sm text-white font-mono">{app.jira.projectKey || '—'}</span>
+ {app.jira.issueType && (
+ <span className="text-xs text-gray-400">{app.jira.issueType}</span>
+ )}
+ {app.jira.createPR !== false && (
+ <span className="text-xs text-green-400">+ PR</span>
+ )}
+ {app.jira.labels?.length > 0 && (
+ <span className="text-xs text-cyan-400">{app.jira.labels.join(', ')}</span>
+ )}
+ </div>
+
+ {/* My Sprint Tickets */}
+ {app.jira.instanceId && app.jira.projectKey && (
+ <div className="mt-3">
+ <div className="text-xs text-gray-500 uppercase tracking-wide mb-2">My Sprint Tickets</div>
+ {loadingTickets[app.id] ? (
+ <div className="flex items-center gap-2 px-3 py-2 text-sm text-gray-400">
+ <BrailleSpinner text="" />
+ <span>Loading tickets...</span>
+ </div>
+ ) : jiraTickets[app.id]?.length > 0 ? (
+ <div className="space-y-2">
+ {jiraTickets[app.id].map(ticket => (
+ <a
+ key={ticket.key}
+ href={ticket.url}
+ target="_blank"
+ rel="noopener noreferrer"
+ className="block px-3 py-2 bg-port-card border border-port-border rounded-lg hover:border-port-accent/50 transition-colors"
+ >
+ <div className="flex items-start justify-between gap-2">
+ <div className="flex-1 min-w-0">
+ <div className="flex items-center gap-2 mb-1">
+ <span className="text-sm font-mono text-port-accent">{ticket.key}</span>
+ <span className={`text-xs px-1.5 py-0.5 rounded ${
+ ticket.statusCategory === 'Done' ? 'bg-port-success/20 text-port-success' :
+ ticket.statusCategory === 'In Progress' ? 'bg-port-accent/20 text-port-accent' :
+ 'bg-gray-500/20 text-gray-400'
+ }`}>
+ {ticket.status}
+ </span>
+ {ticket.priority && (
+ <span className={`text-xs ${
+ ticket.priority === 'Highest' || ticket.priority === 'High' ? 'text-port-error' :
+ ticket.priority === 'Medium' ? 'text-port-warning' :
+ 'text-gray-500'
+ }`}>
+ {ticket.priority}
+ </span>
+ )}
+ {ticket.storyPoints && (
+ <span className="text-xs text-cyan-400">{ticket.storyPoints} pts</span>
+ )}
+ </div>
+ <div className="text-sm text-white line-clamp-2">{ticket.summary}</div>
+ <div className="text-xs text-gray-500 mt-1">
+ {ticket.issueType} • Updated {new Date(ticket.updated).toLocaleDateString()}
+ </div>
+ </div>
+ <ExternalLink size={14} className="text-gray-500 flex-shrink-0 mt-1" />
+ </div>
+ </a>
+ ))}
+ </div>
+ ) : (
+ <div className="px-3 py-2 text-sm text-gray-500 bg-port-card border border-port-border rounded-lg">
+ No tickets assigned to you in the current sprint
+ </div>
+ )}
+ </div>
+ )}
+ </div>
+ )}
+
{/* Quick Actions */}
<div className="flex flex-wrap gap-2 pt-2">
<button
@@ -484,10 +581,52 @@ function EditAppModal({ app, onClose, onSave }) {
apiPort: app.apiPort || '',
startCommands: (app.startCommands || []).join('\n'),
pm2ProcessNames: (app.pm2ProcessNames || []).join(', '),
- editorCommand: app.editorCommand || 'code .'
+ editorCommand: app.editorCommand || 'code .',
+ jiraEnabled: app.jira?.enabled || false,
+ jiraInstanceId: app.jira?.instanceId || '',
+ jiraProjectKey: app.jira?.projectKey || '',
+ jiraIssueType: app.jira?.issueType || 'Task',
+ jiraLabels: (app.jira?.labels || []).join(', '),
+ jiraAssignee: app.jira?.assignee || '',
+ jiraEpicKey: app.jira?.epicKey || '',
+ jiraCreatePR: app.jira?.createPR !== false
});
const [saving, setSaving] = useState(false);
const [error, setError] = useState(null);
+ const [jiraExpanded, setJiraExpanded] = useState(app.jira?.enabled || false);
+ const [jiraInstances, setJiraInstances] = useState([]);
+ const [jiraProjects, setJiraProjects] = useState([]);
+ const [loadingProjects, setLoadingProjects] = useState(false);
+ const [projectSearch, setProjectSearch] = useState('');
+ const [projectDropdownOpen, setProjectDropdownOpen] = useState(false);
+
+ // Fetch JIRA instances on mount
+ useEffect(() => {
+ api.getJiraInstances().then(data => {
+ const instances = data?.instances ? Object.values(data.instances) : [];
+ setJiraInstances(instances);
+ }).catch(() => setJiraInstances([]));
+ }, []);
+
+ // Fetch JIRA projects when instance changes + default assignee to instance user
+ useEffect(() => {
+ if (!formData.jiraInstanceId) {
+ setJiraProjects([]);
+ return;
+ }
+ setLoadingProjects(true);
+ api.getJiraProjects(formData.jiraInstanceId).then(projects => {
+ setJiraProjects(projects || []);
+ }).catch(() => setJiraProjects([])).finally(() => setLoadingProjects(false));
+
+ // Default assignee to the configured JIRA user if not already set
+ if (!formData.jiraAssignee) {
+ const inst = jiraInstances.find(i => i.id === formData.jiraInstanceId);
+ if (inst?.email) {
+ setFormData(prev => ({ ...prev, jiraAssignee: inst.email }));
+ }
+ }
+ }, [formData.jiraInstanceId]); // eslint-disable-line react-hooks/exhaustive-deps
const handleSubmit = async (e) => {
e.preventDefault();
@@ -504,7 +643,17 @@ function EditAppModal({ app, onClose, onSave }) {
pm2ProcessNames: formData.pm2ProcessNames
? formData.pm2ProcessNames.split(',').map(s => s.trim()).filter(Boolean)
: undefined,
- editorCommand: formData.editorCommand || undefined
+ editorCommand: formData.editorCommand || undefined,
+ jira: formData.jiraEnabled ? {
+ enabled: true,
+ instanceId: formData.jiraInstanceId || undefined,
+ projectKey: formData.jiraProjectKey || undefined,
+ issueType: formData.jiraIssueType || 'Task',
+ labels: formData.jiraLabels ? formData.jiraLabels.split(',').map(s => s.trim()).filter(Boolean) : [],
+ assignee: formData.jiraAssignee || undefined,
+ epicKey: formData.jiraEpicKey || undefined,
+ createPR: formData.jiraCreatePR
+ } : { enabled: false }
};
await api.updateApp(app.id, data).catch(err => {
@@ -615,6 +764,202 @@ function EditAppModal({ app, onClose, onSave }) {
/>
</div>
+ {/* JIRA Integration Section */}
+ <div className="border border-port-border rounded-lg overflow-hidden">
+ <button
+ type="button"
+ onClick={() => setJiraExpanded(prev => !prev)}
+ className="w-full flex items-center justify-between px-4 py-3 bg-port-bg hover:bg-port-border/50 transition-colors"
+ >
+ <span className="text-sm font-medium text-gray-300">JIRA Integration</span>
+ <div className="flex items-center gap-2">
+ {formData.jiraEnabled && (
+ <span className="text-xs px-2 py-0.5 bg-port-accent/20 text-port-accent rounded">Enabled</span>
+ )}
+ {jiraExpanded ? <ChevronUp size={16} className="text-gray-400" /> : <ChevronDown size={16} className="text-gray-400" />}
+ </div>
+ </button>
+
+ {jiraExpanded && (
+ <div className="p-4 space-y-3 border-t border-port-border">
+ <label className="flex items-center gap-2 cursor-pointer">
+ <input
+ type="checkbox"
+ checked={formData.jiraEnabled}
+ onChange={e => setFormData({ ...formData, jiraEnabled: e.target.checked })}
+ className="rounded border-port-border bg-port-bg text-port-accent focus:ring-port-accent"
+ />
+ <span className="text-sm text-white">Enable JIRA Integration</span>
+ </label>
+
+ {formData.jiraEnabled && (
+ <>
+ {jiraInstances.length === 0 ? (
+ <div className="p-3 bg-port-warning/10 border border-port-warning/30 rounded-lg text-sm text-port-warning">
+ No JIRA instances configured. <Link to="/jira" className="underline hover:text-white">Configure JIRA</Link> first.
+ </div>
+ ) : (
+ <>
+ <div>
+ <label className="block text-sm text-gray-400 mb-1">JIRA Instance</label>
+ <select
+ value={formData.jiraInstanceId}
+ onChange={e => setFormData({ ...formData, jiraInstanceId: e.target.value, jiraProjectKey: '' })}
+ className="w-full px-3 py-2 bg-port-bg border border-port-border rounded-lg text-white focus:border-port-accent focus:outline-none"
+ >
+ <option value="">Select instance...</option>
+ {jiraInstances.map(inst => (
+ <option key={inst.id} value={inst.id}>{inst.name} ({inst.baseUrl})</option>
+ ))}
+ </select>
+ </div>
+
+ <div className="relative">
+ <label className="block text-sm text-gray-400 mb-1">Project Key</label>
+ {loadingProjects ? (
+ <div className="text-xs text-gray-500">Loading projects...</div>
+ ) : jiraProjects.length > 0 ? (
+ <div>
+ <input
+ type="text"
+ value={projectDropdownOpen ? projectSearch : (
+ formData.jiraProjectKey
+ ? `${formData.jiraProjectKey} - ${jiraProjects.find(p => p.key === formData.jiraProjectKey)?.name || ''}`
+ : ''
+ )}
+ onChange={e => {
+ setProjectSearch(e.target.value);
+ if (!projectDropdownOpen) setProjectDropdownOpen(true);
+ }}
+ onFocus={() => {
+ setProjectDropdownOpen(true);
+ setProjectSearch('');
+ }}
+ onBlur={() => setTimeout(() => setProjectDropdownOpen(false), 150)}
+ className="w-full px-3 py-2 bg-port-bg border border-port-border rounded-lg text-white focus:border-port-accent focus:outline-none"
+ placeholder="Search projects..."
+ />
+ {formData.jiraProjectKey && !projectDropdownOpen && (
+ <button
+ type="button"
+ onClick={() => setFormData({ ...formData, jiraProjectKey: '' })}
+ className="absolute right-2 top-8 text-gray-500 hover:text-white text-sm"
+ >
+ ✕
+ </button>
+ )}
+ {projectDropdownOpen && (
+ <div className="absolute z-50 w-full mt-1 bg-port-bg border border-port-border rounded-lg max-h-48 overflow-auto shadow-lg">
+ {jiraProjects
+ .filter(proj => {
+ if (!projectSearch) return true;
+ const q = projectSearch.toLowerCase();
+ return proj.key.toLowerCase().includes(q) || proj.name.toLowerCase().includes(q);
+ })
+ .sort((a, b) => a.key.localeCompare(b.key))
+ .slice(0, 100)
+ .map(proj => (
+ <button
+ key={proj.key}
+ type="button"
+ onMouseDown={e => {
+ e.preventDefault();
+ setFormData({ ...formData, jiraProjectKey: proj.key });
+ setProjectDropdownOpen(false);
+ setProjectSearch('');
+ }}
+ className={`w-full text-left px-3 py-2 text-sm hover:bg-port-accent/20 ${
+ formData.jiraProjectKey === proj.key ? 'bg-port-accent/10 text-port-accent' : 'text-white'
+ }`}
+ >
+ <span className="font-mono">{proj.key}</span>
+ <span className="text-gray-400 ml-2">{proj.name}</span>
+ </button>
+ ))
+ }
+ {jiraProjects.filter(proj => {
+ if (!projectSearch) return true;
+ const q = projectSearch.toLowerCase();
+ return proj.key.toLowerCase().includes(q) || proj.name.toLowerCase().includes(q);
+ }).length === 0 && (
+ <div className="px-3 py-2 text-sm text-gray-500">No matching projects</div>
+ )}
+ </div>
+ )}
+ </div>
+ ) : (
+ <input
+ type="text"
+ value={formData.jiraProjectKey}
+ onChange={e => setFormData({ ...formData, jiraProjectKey: e.target.value })}
+ className="w-full px-3 py-2 bg-port-bg border border-port-border rounded-lg text-white focus:border-port-accent focus:outline-none"
+ placeholder="e.g. CONTECH"
+ />
+ )}
+ </div>
+
+ <div className="grid grid-cols-2 gap-3">
+ <div>
+ <label className="block text-sm text-gray-400 mb-1">Issue Type</label>
+ <input
+ type="text"
+ value={formData.jiraIssueType}
+ onChange={e => setFormData({ ...formData, jiraIssueType: e.target.value })}
+ className="w-full px-3 py-2 bg-port-bg border border-port-border rounded-lg text-white focus:border-port-accent focus:outline-none"
+ placeholder="Task"
+ />
+ </div>
+ <div>
+ <label className="block text-sm text-gray-400 mb-1">Assignee</label>
+ <input
+ type="text"
+ value={formData.jiraAssignee}
+ onChange={e => setFormData({ ...formData, jiraAssignee: e.target.value })}
+ className="w-full px-3 py-2 bg-port-bg border border-port-border rounded-lg text-white focus:border-port-accent focus:outline-none"
+ placeholder="Optional"
+ />
+ </div>
+ </div>
+
+ <div>
+ <label className="block text-sm text-gray-400 mb-1">Labels (comma-separated)</label>
+ <input
+ type="text"
+ value={formData.jiraLabels}
+ onChange={e => setFormData({ ...formData, jiraLabels: e.target.value })}
+ className="w-full px-3 py-2 bg-port-bg border border-port-border rounded-lg text-white focus:border-port-accent focus:outline-none"
+ placeholder="e.g. cos-auto, feature"
+ />
+ </div>
+
+ <div>
+ <label className="block text-sm text-gray-400 mb-1">Epic Key</label>
+ <input
+ type="text"
+ value={formData.jiraEpicKey}
+ onChange={e => setFormData({ ...formData, jiraEpicKey: e.target.value })}
+ className="w-full px-3 py-2 bg-port-bg border border-port-border rounded-lg text-white focus:border-port-accent focus:outline-none"
+ placeholder="e.g. CONTECH-100"
+ />
+ </div>
+
+ <label className="flex items-center gap-2 cursor-pointer">
+ <input
+ type="checkbox"
+ checked={formData.jiraCreatePR}
+ onChange={e => setFormData({ ...formData, jiraCreatePR: e.target.checked })}
+ className="rounded border-port-border bg-port-bg text-port-accent focus:ring-port-accent"
+ />
+ <span className="text-sm text-white">Create Pull Request on completion</span>
+ </label>
+ </>
+ )}
+ </>
+ )}
+ </div>
+ )}
+ </div>
+
<div className="flex justify-end gap-3 pt-4">
<button
type="button"
diff --git a/client/src/services/api.js b/client/src/services/api.js
index 5b12aa06ab..cb5e04444d 100644
--- a/client/src/services/api.js
+++ b/client/src/services/api.js
@@ -1157,6 +1157,11 @@ export const deleteEpigeneticIntervention = (id) => request(`/digital-twin/genom
method: 'DELETE'
});
+// JIRA
+export const getJiraInstances = () => request('/jira/instances');
+export const getJiraProjects = (instanceId) => request(`/jira/instances/${instanceId}/projects`);
+export const getMySprintTickets = (instanceId, projectKey) => request(`/jira/instances/${instanceId}/my-sprint-tickets/${projectKey}`);
+
// Browser - CDP browser management
export const getBrowserStatus = () => request('/browser');
export const getBrowserConfig = () => request('/browser/config');
diff --git a/server/routes/jira.js b/server/routes/jira.js
index 35e9154ff9..e7f6440263 100644
--- a/server/routes/jira.js
+++ b/server/routes/jira.js
@@ -202,4 +202,20 @@ router.post('/instances/:instanceId/tickets/:ticketId/transition', async (req, r
}
});
+/**
+ * GET /api/jira/instances/:instanceId/my-sprint-tickets/:projectKey
+ * Get tickets assigned to current user in active sprint for a project
+ */
+router.get('/instances/:instanceId/my-sprint-tickets/:projectKey', async (req, res, next) => {
+ try {
+ const tickets = await jiraService.getMyCurrentSprintTickets(
+ req.params.instanceId,
+ req.params.projectKey
+ );
+ res.json(tickets);
+ } catch (error) {
+ next(error);
+ }
+});
+
export default router;
diff --git a/server/services/jira.js b/server/services/jira.js
index 9f22eb0ec1..2c75b23a6b 100644
--- a/server/services/jira.js
+++ b/server/services/jira.js
@@ -264,6 +264,49 @@ export async function transitionTicket(instanceId, ticketId, transitionId) {
return { success: true };
}
+/**
+ * Get tickets assigned to user in current sprint for a project
+ */
+export async function getMyCurrentSprintTickets(instanceId, projectKey) {
+ const config = await getInstances();
+ const instance = config.instances[instanceId];
+
+ if (!instance) {
+ throw new Error(`JIRA instance ${instanceId} not found`);
+ }
+
+ const client = createJiraClient(instance);
+
+ // JQL to find tickets assigned to current user in active sprint for the project
+ const jql = `project = "${projectKey}" AND assignee = currentUser() AND sprint in openSprints() ORDER BY priority DESC, updated DESC`;
+
+ try {
+ const response = await client.get('/rest/api/2/search', {
+ params: {
+ jql,
+ fields: 'summary,status,priority,issuetype,assignee,updated,customfield_10106',
+ maxResults: 50
+ }
+ });
+
+ return response.data.issues.map(issue => ({
+ key: issue.key,
+ summary: issue.fields.summary,
+ status: issue.fields.status.name,
+ statusCategory: issue.fields.status.statusCategory?.name,
+ priority: issue.fields.priority?.name,
+ issueType: issue.fields.issuetype?.name,
+ storyPoints: issue.fields.customfield_10106,
+ updated: issue.fields.updated,
+ url: `${instance.baseUrl}/browse/${issue.key}`
+ }));
+ } catch (error) {
+ console.error(`❌ Failed to fetch JIRA tickets: ${error.message}`);
+ // Return empty array on error to avoid breaking the UI
+ return [];
+ }
+}
+
export default {
getInstances,
saveInstances,
@@ -274,5 +317,6 @@ export default {
createTicket,
updateTicket,
addComment,
- transitionTicket
+ transitionTicket,
+ getMyCurrentSprintTickets
};