@phren/cli 0.1.38 → 0.1.39

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.
@@ -2683,20 +2683,41 @@ export function renderGraphHostScript() {
2683
2683
  deleteNode(currentNode);
2684
2684
  }
2685
2685
 
2686
- // Open the dossier in edit mode for a finding/task chosen in the contents pane.
2687
- function editNodeFromPane(node) {
2686
+ // Persist edits made directly inside the project pane. The pane owns the
2687
+ // editor; the host only performs the mutation and updates the rendered node.
2688
+ function saveInlineFromPane(node) {
2688
2689
  if (!node || (node.kind !== 'finding' && node.kind !== 'task')) return;
2689
- var api = graphApi();
2690
- if (api && api.selectNode) api.selectNode(node.id);
2691
- setTimeout(function() {
2692
- if (currentNode && currentNode.id === node.id) {
2693
- editMode = currentNode.kind === 'task' ? 'task' : 'finding';
2694
- var point = currentPopoverPoint();
2695
- renderPopover(currentNode, point.x, point.y);
2696
- var editor = document.getElementById('graph-node-editor');
2697
- if (editor) editor.focus();
2698
- }
2699
- }, 220);
2690
+ var nextText = (node.editedText || '').trim();
2691
+ if (!nextText) return;
2692
+ if (node.kind === 'finding') {
2693
+ graphRequest('/api/findings/' + encodeURIComponent(node.projectName), 'PUT', {
2694
+ old_text: node.tooltipLabel || node.fullLabel || '',
2695
+ new_text: nextText,
2696
+ score_key: node.scoreKey || ''
2697
+ }).then(function(result) {
2698
+ if (!result || !result.ok) throw new Error(result && result.error ? result.error : 'Save failed');
2699
+ var api = graphApi();
2700
+ if (api && api.updateNode) api.updateNode(node.id, { text: nextText });
2701
+ graphToast('Finding updated', 'ok');
2702
+ }).catch(function(err) { graphToast('Update failed: ' + err.message, 'err'); });
2703
+ return;
2704
+ }
2705
+ graphRequest('/api/tasks/update', 'POST', {
2706
+ project: node.projectName,
2707
+ item: node.stableId || node.id || node.tooltipLabel || node.fullLabel || node.displayLabel || '',
2708
+ text: nextText,
2709
+ section: node.editedSection || node.section || 'Queue',
2710
+ priority: typeof node.editedPriority === 'string' ? node.editedPriority : (node.priority || '')
2711
+ }).then(function(result) {
2712
+ if (!result || !result.ok) throw new Error(result && result.error ? result.error : 'Save failed');
2713
+ var api = graphApi();
2714
+ if (api && api.updateNode) api.updateNode(node.id, {
2715
+ text: nextText,
2716
+ section: node.editedSection || node.section || 'Queue',
2717
+ priority: typeof node.editedPriority === 'string' ? node.editedPriority : (node.priority || '')
2718
+ });
2719
+ graphToast('Task updated', 'ok');
2720
+ }).catch(function(err) { graphToast('Update failed: ' + err.message, 'err'); });
2700
2721
  }
2701
2722
 
2702
2723
  function completeCurrentTask() {
@@ -2818,7 +2839,7 @@ export function renderGraphHostScript() {
2818
2839
  api.onItemAction(function(payload, action) {
2819
2840
  if (action === 'delete') deleteNode(payload);
2820
2841
  else if (action === 'delete-batch') deleteNodes(payload);
2821
- else if (action === 'edit') editNodeFromPane(payload);
2842
+ else if (action === 'save-inline') saveInlineFromPane(payload);
2822
2843
  else if (action === 'merge') mergeNodes(payload);
2823
2844
  });
2824
2845
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phren/cli",
3
- "version": "0.1.38",
3
+ "version": "0.1.39",
4
4
  "description": "Knowledge layer for AI agents — CLI, MCP server, and data layer",
5
5
  "type": "module",
6
6
  "bin": {