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: AI-powered personal JIRA weekly status reports
Adam Eivya3295eb95f07
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdnew file mode 100644index 0000000000..c1bbe5153f--- /dev/null+++ b/.changelog/NEXT.md@@ -0,0 +1,12 @@+# Unreleased Changes++## Added+- AI-powered narrative summaries for JIRA weekly status reports (tries each API provider until one succeeds)++## Changed+- JIRA reports now filter to current user's tickets only via `currentUser()` JQL+- Status report UI simplified to personal weekly status format with copy-to-clipboard+- Ticket keys rendered as clickable JIRA links anywhere in report text++## Fixed+- JIRA report provider discovery now tries all available API providers instead of failing on first unreachable onediff --git a/client/src/pages/JiraReports.jsx b/client/src/pages/JiraReports.jsxindex 162b533a90..71d5653fb8 100644--- a/client/src/pages/JiraReports.jsx+++ b/client/src/pages/JiraReports.jsx@@ -1,4 +1,4 @@-import { useState, useEffect } from 'react';+import { useState, useEffect, useMemo } from 'react';import { useSearchParams } from 'react-router-dom';import toast from 'react-hot-toast';import {@@ -33,29 +33,24 @@ function ReportCard({ report, onClick, isSelected }) {);}-function buildStatusText(report) {- const lines = [];- const { tickets } = report;- if (tickets.recentlyCompleted?.length > 0) {- lines.push('**Completed (last 7 days):**');- for (const t of tickets.recentlyCompleted) lines.push(`- ${t.key}: ${t.summary}`);- }- if (tickets.inProgress?.length > 0) {- lines.push('', '**In Progress:**');- for (const t of tickets.inProgress) lines.push(`- ${t.key}: ${t.summary}`);- }- if (tickets.todo?.length > 0) {- lines.push('', '**Up Next:**');- const shown = tickets.todo.slice(0, 10);- for (const t of shown) lines.push(`- ${t.key}: ${t.summary}`);- if (tickets.todo.length > 10) lines.push(`- ...and ${tickets.todo.length - 10} more`);- }- return lines.join('\n');-}+const TICKET_KEY_RE = /^[A-Z]+-\d+$/;+const TICKET_KEY_SPLIT_RE = /([A-Z]+-\d+)/g;function ReportDetail({ report }) {const [copied, setCopied] = useState(false);+ const ticketUrls = useMemo(() => {+ const urls = {};+ if (report?.tickets) {+ for (const group of Object.values(report.tickets)) {+ for (const t of group || []) {+ if (t.key && t.url) urls[t.key] = t.url;+ }+ }+ }+ return urls;+ }, [report]);+if (!report) {return (<div className="flex items-center justify-center h-64 text-gray-500">@@ -64,17 +59,7 @@ function ReportDetail({ report }) {);}- const statusText = report.statusSummary || buildStatusText(report);-- // Build ticket key → URL lookup from report data- const ticketUrls = {};- if (report.tickets) {- for (const group of Object.values(report.tickets)) {- for (const t of group || []) {- if (t.key && t.url) ticketUrls[t.key] = t.url;- }- }- }+ const statusText = report.statusSummary || '';const handleCopy = async () => {const plain = statusText.replace(/\*\*/g, '');@@ -104,25 +89,26 @@ function ReportDetail({ report }) {{statusText.trim() ? (<div className="text-sm text-gray-300 leading-relaxed">{statusText.split('\n').map((line, i) => {- if (line.startsWith('**') && line.endsWith('**')) {+ if (line.startsWith('**') && line.includes('**')) {return <div key={i} className="text-white font-semibold mt-4 first:mt-0 mb-1">{line.replace(/\*\*/g, '')}</div>;}if (line.startsWith('- ')) {- const ticketMatch = line.match(/^- ([A-Z]+-\d+): (.+)/);- if (ticketMatch) {- const url = ticketUrls[ticketMatch[1]];- return (- <div key={i} className="pl-3 py-0.5">- {url ? (- <a href={url} target="_blank" rel="noopener noreferrer" className="text-port-accent hover:underline font-mono text-xs">{ticketMatch[1]}</a>- ) : (- <span className="text-port-accent font-mono text-xs">{ticketMatch[1]}</span>- )}- <span className="text-gray-300 ml-1.5">{ticketMatch[2]}</span>- </div>- );- }- return <div key={i} className="pl-3 py-0.5 text-gray-400">{line.slice(2)}</div>;+ const parts = line.slice(2).split(TICKET_KEY_SPLIT_RE);+ return (+ <div key={i} className="pl-3 py-0.5 text-gray-300">+ {parts.map((part, j) => {+ if (TICKET_KEY_RE.test(part)) {+ const url = ticketUrls[part];+ return url ? (+ <a key={j} href={url} target="_blank" rel="noopener noreferrer" className="text-port-accent hover:underline font-mono text-xs">{part}</a>+ ) : (+ <span key={j} className="text-port-accent font-mono text-xs">{part}</span>+ );+ }+ return <span key={j}>{part}</span>;+ })}+ </div>+ );}return line ? <div key={i}>{line}</div> : <div key={i} className="h-2" />;})}diff --git a/server/services/jiraReports.js b/server/services/jiraReports.jsindex 89c9693943..fae8e56940 100644--- a/server/services/jiraReports.js+++ b/server/services/jiraReports.js@@ -8,6 +8,8 @@ import { join } from 'path';import { ensureDir, PATHS, readJSONFile } from '../lib/fileUtils.js';import { getInstances, createJiraClient } from './jira.js';import { getActiveApps } from './apps.js';+import { callProviderAISimple } from '../lib/aiProvider.js';+import { getActiveProvider, getAllProviders } from './providers.js';const REPORTS_DIR = join(PATHS.data, 'jira-reports');@@ -72,6 +74,100 @@ function ticketSummary(ticket, extraFields = []) {return obj;}+/**+ * Generate a narrative status summary using AI.+ * Produces a human-readable summary suitable for status calls/emails,+ * with ticket keys inline so the UI can link them.+ * Falls back to a plain bullet list if AI is unavailable.+ */+async function generateNarrativeSummary(appName, completed, inProgress, blocked, todo) {+ const sections = [];+ if (completed.length > 0) {+ sections.push(`COMPLETED (last 7 days):\n${completed.map(t => `- ${t.key}: ${t.summary}`).join('\n')}`);+ }+ if (inProgress.length > 0) {+ sections.push(`IN PROGRESS:\n${inProgress.map(t => `- ${t.key}: ${t.summary}`).join('\n')}`);+ }+ if (blocked.length > 0) {+ sections.push(`BLOCKED:\n${blocked.map(t => `- ${t.key}: ${t.summary} [${t.status}]`).join('\n')}`);+ }+ if (todo.length > 0) {+ sections.push(`UP NEXT:\n${todo.slice(0, 10).map(t => `- ${t.key}: ${t.summary}`).join('\n')}`);+ }++ if (sections.length === 0) return '';++ const ticketData = sections.join('\n\n');++ // Collect candidate API providers (active first, then all others)+ const candidates = [];+ const [active, providersResult] = await Promise.all([+ getActiveProvider().catch(() => null),+ getAllProviders().catch(() => ({ providers: [] }))+ ]);+ if (active?.type === 'api') candidates.push(active);+ const allProviders = Array.isArray(providersResult) ? providersResult : (providersResult?.providers || []);+ for (const p of allProviders) {+ if (p.type === 'api' && !candidates.some(c => c.id === p.id)) candidates.push(p);+ }++ if (candidates.length === 0) {+ console.log('📊 No API provider available, using plain ticket list');+ return buildPlainSummary(completed, inProgress, blocked, todo);+ }++ const prompt = `You are writing a personal weekly status update for a status call or email about the ${appName} project. Given the JIRA tickets below, write a concise narrative summary organized into sections.++Rules:+- Use these exact section headers with markdown bold: **Completed:**, **In Progress:**, **Blocked:**, **Up Next:**+- Only include sections that have tickets+- Write each item as a bullet point (- ) that describes what was actually done or is being worked on in plain language+- Include the JIRA ticket key (e.g., PROJ-1234) at the end of each bullet in parentheses so it can be linked+- Combine related tickets into single bullets when they're clearly part of the same effort+- Be concise — this is for a quick status update, not a detailed report+- Write in first person plural ("we") or passive voice, not "I"+- Don't add commentary, intros, or sign-offs — just the bulleted sections++Tickets:+${ticketData}`;++ // Try each provider until one succeeds+ for (const provider of candidates) {+ const aiResult = await callProviderAISimple(provider, provider.lightModel || provider.defaultModel, prompt, {+ temperature: 0.3,+ max_tokens: 1500+ }).catch(err => ({ error: err.message }));++ if (!aiResult.error) return aiResult.text.trim();+ console.log(`📊 Provider ${provider.id} failed: ${aiResult.error}`);+ }++ console.log('📊 All API providers failed, using plain ticket list');+ return buildPlainSummary(completed, inProgress, blocked, todo);+}++function buildPlainSummary(completed, inProgress, blocked, todo) {+ const lines = [];+ if (completed.length > 0) {+ lines.push('**Completed:**');+ for (const t of completed) lines.push(`- ${t.summary} (${t.key})`);+ }+ if (inProgress.length > 0) {+ lines.push('', '**In Progress:**');+ for (const t of inProgress) lines.push(`- ${t.summary} (${t.key})`);+ }+ if (blocked.length > 0) {+ lines.push('', '**Blocked:**');+ for (const t of blocked) lines.push(`- ${t.summary} [${t.status}] (${t.key})`);+ }+ if (todo.length > 0) {+ lines.push('', '**Up Next:**');+ for (const t of todo.slice(0, 10)) lines.push(`- ${t.summary} (${t.key})`);+ if (todo.length > 10) lines.push(`- ...and ${todo.length - 10} more`);+ }+ return lines.join('\n');+}+/*** Generate a status report for a single app*/@@ -101,38 +197,12 @@ export async function generateReport(appId, app) {const completedPoints = done.reduce((sum, t) => sum + (t.storyPoints || 0), 0);const inProgressPoints = inProgress.reduce((sum, t) => sum + (t.storyPoints || 0), 0);- // Build plain-text status summary for status calls/emails- const statusLines = [];- if (recentlyCompleted.length > 0) {- statusLines.push('**Completed (last 7 days):**');- for (const t of recentlyCompleted) {- statusLines.push(`- ${t.key}: ${t.summary}`);- }- }- if (inProgress.length > 0) {- statusLines.push('', '**In Progress:**');- for (const t of inProgress) {- statusLines.push(`- ${t.key}: ${t.summary}`);- }- }+ // Generate AI-powered narrative status summaryconst blocked = sprintTickets.filter(t =>t.status?.toLowerCase().includes('block') ||(t.priority === 'Highest' && t.statusCategory === 'To Do'));- if (blocked.length > 0) {- statusLines.push('', '**Blocked / Needs Attention:**');- for (const t of blocked) {- statusLines.push(`- ${t.key}: ${t.summary} [${t.status}]`);- }- }- if (todo.length > 0) {- statusLines.push('', '**Up Next:**');- for (const t of todo.slice(0, 10)) {- statusLines.push(`- ${t.key}: ${t.summary}`);- }- if (todo.length > 10) statusLines.push(`- ...and ${todo.length - 10} more`);- }- const statusSummary = statusLines.join('\n');+ const statusSummary = await generateNarrativeSummary(app.name, recentlyCompleted, inProgress, blocked, todo);const report = {appId,