@yemi33/minions 0.1.1899 → 0.1.1900

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.
@@ -4,6 +4,64 @@ function _prdItemDeleteKey(source, itemId) {
4
4
  return 'prd-item:' + (source || '') + ':' + (itemId || '');
5
5
  }
6
6
 
7
+ let _prdDescRawCache = '';
8
+
9
+ function _togglePrdDescEdit() {
10
+ const view = document.getElementById('prd-desc-view');
11
+ const editor = document.getElementById('prd-edit-desc');
12
+ if (!view || !editor) return;
13
+ view.style.display = 'none';
14
+ editor.style.display = '';
15
+ document.getElementById('prd-desc-edit-btn').style.display = 'none';
16
+ document.getElementById('prd-desc-save-btn').style.display = '';
17
+ document.getElementById('prd-desc-cancel-btn').style.display = '';
18
+ editor.focus();
19
+ }
20
+
21
+ function _cancelPrdDescEdit() {
22
+ const view = document.getElementById('prd-desc-view');
23
+ const editor = document.getElementById('prd-edit-desc');
24
+ if (!view || !editor) return;
25
+ editor.value = _prdDescRawCache || '';
26
+ view.style.display = '';
27
+ editor.style.display = 'none';
28
+ document.getElementById('prd-desc-edit-btn').style.display = '';
29
+ document.getElementById('prd-desc-save-btn').style.display = 'none';
30
+ document.getElementById('prd-desc-cancel-btn').style.display = 'none';
31
+ }
32
+
33
+ async function _savePrdDesc(source, itemId) {
34
+ const editor = document.getElementById('prd-edit-desc');
35
+ const view = document.getElementById('prd-desc-view');
36
+ const saveBtn = document.getElementById('prd-desc-save-btn');
37
+ if (!editor || !view) return;
38
+ const newDesc = editor.value;
39
+ if (saveBtn) { saveBtn.disabled = true; saveBtn.textContent = 'Saving...'; }
40
+ try {
41
+ const res = await fetch('/api/prd-items/update', {
42
+ method: 'POST', headers: { 'Content-Type': 'application/json' },
43
+ body: JSON.stringify({ source, itemId, description: newDesc })
44
+ });
45
+ if (res.ok) {
46
+ _prdDescRawCache = newDesc;
47
+ view.innerHTML = newDesc ? renderMd(newDesc) : '<span style="color:var(--muted);font-size:11px">No description</span>';
48
+ view.style.display = '';
49
+ editor.style.display = 'none';
50
+ document.getElementById('prd-desc-edit-btn').style.display = '';
51
+ document.getElementById('prd-desc-save-btn').style.display = 'none';
52
+ document.getElementById('prd-desc-cancel-btn').style.display = 'none';
53
+ showToast('cmd-toast', 'Description saved', true);
54
+ if (typeof refresh === 'function') refresh();
55
+ } else {
56
+ const d = await res.json().catch(() => ({}));
57
+ showToast('cmd-toast', 'Save failed: ' + (d.error || 'unknown'), false);
58
+ }
59
+ } catch (e) {
60
+ showToast('cmd-toast', 'Error: ' + e.message, false);
61
+ }
62
+ if (saveBtn) { saveBtn.disabled = false; saveBtn.textContent = 'Save'; }
63
+ }
64
+
7
65
  function renderPrd(prd, prog) {
8
66
  const section = document.getElementById('prd-content');
9
67
  const badge = document.getElementById('prd-badge');
@@ -684,6 +742,8 @@ async function prdItemEdit(source, itemId) {
684
742
  }
685
743
  if (!item) return;
686
744
 
745
+ _prdDescRawCache = item.description || '';
746
+
687
747
  // Look up work item and dispatch completion info
688
748
  const wi = (window._lastWorkItems || []).find(w => w.id === itemId && w.sourcePlan === source);
689
749
  const dispatch = window._lastStatus?.dispatch || {};
@@ -724,8 +784,16 @@ async function prdItemEdit(source, itemId) {
724
784
  completionHtml +
725
785
  '<label style="font-size:11px;color:var(--muted);display:block;margin-bottom:4px">Name</label>' +
726
786
  '<input id="prd-edit-name" value="' + escHtml(item.name || '') + '" style="width:100%;padding:6px 10px;background:var(--surface);border:1px solid var(--border);border-radius:4px;color:var(--text);font-size:13px;margin-bottom:10px">' +
727
- '<label style="font-size:11px;color:var(--muted);display:block;margin-bottom:4px">Description</label>' +
728
- '<textarea id="prd-edit-desc" rows="4" style="width:100%;padding:6px 10px;background:var(--surface);border:1px solid var(--border);border-radius:4px;color:var(--text);font-size:12px;resize:vertical;margin-bottom:10px">' + escHtml(item.description || '') + '</textarea>' +
787
+ '<div style="display:flex;align-items:center;justify-content:space-between;margin-bottom:4px">' +
788
+ '<label style="font-size:11px;color:var(--muted)">Description</label>' +
789
+ '<div style="display:flex;gap:6px">' +
790
+ '<button id="prd-desc-edit-btn" type="button" class="pr-pager-btn" aria-label="Edit description" style="font-size:10px;padding:2px 10px" onclick="_togglePrdDescEdit()">Edit</button>' +
791
+ '<button id="prd-desc-save-btn" type="button" class="pr-pager-btn" aria-label="Save description" style="font-size:10px;padding:2px 10px;color:var(--green);border-color:var(--green);display:none" onclick="_savePrdDesc(\'' + escHtml(source) + '\',\'' + escHtml(itemId) + '\')">Save</button>' +
792
+ '<button id="prd-desc-cancel-btn" type="button" class="pr-pager-btn" aria-label="Cancel description edit" style="font-size:10px;padding:2px 10px;display:none" onclick="_cancelPrdDescEdit()">Cancel</button>' +
793
+ '</div>' +
794
+ '</div>' +
795
+ '<div id="prd-desc-view" style="margin-bottom:10px;padding:8px 10px;background:var(--surface);border:1px solid var(--border);border-radius:4px;min-height:32px">' + (item.description ? renderMd(item.description) : '<span style="color:var(--muted);font-size:11px">No description</span>') + '</div>' +
796
+ '<textarea id="prd-edit-desc" rows="4" style="display:none;width:100%;padding:6px 10px;background:var(--surface);border:1px solid var(--border);border-radius:4px;color:var(--text);font-size:12px;resize:vertical;margin-bottom:10px">' + escHtml(item.description || '') + '</textarea>' +
729
797
  '<div style="display:flex;gap:12px;margin-bottom:12px">' +
730
798
  '<div><label style="font-size:11px;color:var(--muted);display:block;margin-bottom:4px">Priority</label>' +
731
799
  '<select id="prd-edit-priority" style="padding:4px 8px;background:var(--surface);border:1px solid var(--border);border-radius:4px;color:var(--text)">' +
@@ -941,4 +1009,4 @@ function openArchive(i) {
941
1009
  document.getElementById('modal').classList.add('open');
942
1010
  }
943
1011
 
944
- window.MinionsPrd = { renderPrd, renderPrdProgress, openArchivedPrdModal, showArchivedPrdDetail, prdItemEdit, prdItemSave, prdItemRemove, prdItemRequeue, prdItemReopen, prdRegenerate, openArchive };
1012
+ window.MinionsPrd = { renderPrd, renderPrdProgress, openArchivedPrdModal, showArchivedPrdDetail, prdItemEdit, prdItemSave, prdItemRemove, prdItemRequeue, prdItemReopen, prdRegenerate, openArchive, _togglePrdDescEdit, _cancelPrdDescEdit, _savePrdDesc };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yemi33/minions",
3
- "version": "0.1.1899",
3
+ "version": "0.1.1900",
4
4
  "description": "Multi-agent AI dev team that runs from ~/.minions/ — five autonomous agents share a single engine, dashboard, and knowledge base",
5
5
  "bin": {
6
6
  "minions": "bin/minions.js"