buddy-workbench 0.1.47 → 0.1.48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "buddy-workbench",
3
- "version": "0.1.47",
3
+ "version": "0.1.48",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "bin": {
@@ -4,6 +4,7 @@ import { Router } from 'express';
4
4
  import { readSettings } from '../repositories/settings.js';
5
5
  import { listTodos } from '../repositories/todos.js';
6
6
  import { listBranchSyncApps } from '../repositories/branch-sync.js';
7
+ import { getPresentations } from '../repositories/presentations.js';
7
8
  import { recordApiError } from '../lib/api-errors.js';
8
9
 
9
10
  const router = Router();
@@ -15,6 +16,16 @@ const httpClient = axios.create({
15
16
 
16
17
  const isSuccess = (response) => response.status >= 200 && response.status < 300;
17
18
  const apiMessage = (response, fallback) => response?.data?.errors?.[0]?.message || response?.data?.errorMessages?.[0] || response?.data?.message || response?.statusText || fallback;
19
+ const getPresentationInsights = () => getPresentations().plans
20
+ .slice()
21
+ .sort((a, b) => Number(b.updatedAt || b.createdAt || 0) - Number(a.updatedAt || a.createdAt || 0))
22
+ .map((plan) => ({
23
+ id: plan.id,
24
+ title: plan.title || plan.name || 'Untitled presentation',
25
+ summary: `${Array.isArray(plan.sections) ? plan.sections.length : 0} sections`,
26
+ updated: plan.updatedAt || plan.createdAt || null,
27
+ url: '#/presentation-plan'
28
+ }));
18
29
 
19
30
  function jiraHost(domain) {
20
31
  const clean = String(domain || '').replace(/^https?:\/\//i, '').replace(/\/+$/, '');
@@ -184,11 +195,11 @@ router.get('/', async (_req, res) => {
184
195
  const settings = readSettings();
185
196
  const missingTokens = ['jira', 'bitbucket', 'confluence'].filter((service) => !settings[`${service}AccessToken`]);
186
197
  if (missingTokens.length > 0) {
187
- return res.json({ configured: false, missingTokens, fetchedAt: new Date().toISOString(), categories: {} });
198
+ return res.json({ configured: false, missingTokens, fetchedAt: new Date().toISOString(), categories: { presentations: getPresentationInsights() } });
188
199
  }
189
200
  const jira = jiraHost(settings.domain);
190
201
  const bitbucket = bitbucketHost(settings.domain);
191
- if (!jira || !bitbucket) return res.json({ configured: false, missingTokens: ['domain'], fetchedAt: new Date().toISOString(), categories: {} });
202
+ if (!jira || !bitbucket) return res.json({ configured: false, missingTokens: ['domain'], fetchedAt: new Date().toISOString(), categories: { presentations: getPresentationInsights() } });
192
203
 
193
204
  const sections = await Promise.all([
194
205
  requestSection('Jira', () => loadJiraData(jira, settings.jiraAccessToken)),
@@ -210,7 +221,8 @@ router.get('/', async (_req, res) => {
210
221
  authoredPrs: authoredPrs.items || [],
211
222
  failedBuilds: failedBuilds.items || [],
212
223
  activity: jiraData.items?.activity || [],
213
- blockedIssues: jiraData.items?.blocked || []
224
+ blockedIssues: jiraData.items?.blocked || [],
225
+ presentations: getPresentationInsights()
214
226
  },
215
227
  errors
216
228
  });