project-compass 3.5.2 → 3.5.4

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": "project-compass",
3
- "version": "3.5.2",
3
+ "version": "3.5.4",
4
4
  "description": "Futuristic project navigator and runner for Node, Python, Rust, and Go",
5
5
  "main": "src/cli.js",
6
6
  "bin": {
Binary file
package/src/cli.js CHANGED
@@ -377,6 +377,13 @@ function Compass({rootPath, initialView = 'navigator'}) {
377
377
  });
378
378
  return;
379
379
  }
380
+
381
+ if (key.escape) {
382
+ if (mainView !== 'navigator') {
383
+ setMainView('navigator');
384
+ return;
385
+ }
386
+ }
380
387
 
381
388
  const scrollLogs = (delta) => {
382
389
  setLogOffset((prev) => {
@@ -541,42 +548,47 @@ function Compass({rootPath, initialView = 'navigator'}) {
541
548
  return create(Box, {flexDirection: 'column', borderStyle: 'round', borderColor: 'red', padding: 1}, create(Text, {bold: true, color: 'red'}, '⚠️ Confirm Exit'), create(Text, null, `There are ${tasks.filter(t=>t.status==='running').length} tasks still running in the background.`), create(Text, null, 'Are you sure you want to quit and stop all processes?'), create(Text, {marginTop: 1}, kleur.bold('Y') + ' to Quit, ' + kleur.bold('N') + ' to Cancel'));
542
549
  }
543
550
 
544
- if (mainView === 'studio') return create(Studio);
545
- if (mainView === 'tasks') return create(TaskManager, {tasks, activeTaskId, renameMode, renameInput, renameCursor, CursorText});
546
- if (mainView === 'registry') return create(PackageRegistry, {selectedProject, onRunCommand: runProjectCommand, CursorText});
547
- if (mainView === 'architect') return create(ProjectArchitect, {rootPath, onRunCommand: runProjectCommand, CursorText, onReturn: () => setMainView('navigator')});
548
-
549
- return create(Box, {flexDirection: 'column', padding: 1},
550
- create(Box, {justifyContent: 'space-between'},
551
- create(Box, {flexDirection: 'column'}, create(Text, {color: 'magenta', bold: true}, 'Project Compass'), create(Text, {dimColor: true}, `${projectCountLabel} detected in ${rootPath}`)),
552
- create(Box, {flexDirection: 'column', alignItems: 'flex-end'},
553
- create(Text, {color: running ? 'yellow' : 'green'}, statusHint),
554
- create(Text, {dimColor: true}, `${toggleHint} · ${orbitHint} · ${artHint} · Shift+Q: Quit`)
555
- )
556
- ),
557
- config.showArtBoard && create(Box, {flexDirection: 'column', marginTop: 1, borderStyle: 'round', borderColor: 'gray', padding: 1},
558
- create(Box, {flexDirection: 'row', justifyContent: 'space-between'}, create(Text, {color: 'magenta', bold: true}, 'Art-coded build atlas'), create(Text, {dimColor: true}, 'press ? for overlay help')),
559
- create(Box, {flexDirection: 'row', marginTop: 1}, ...ART_CHARS.map((char, i) => create(Text, {key: i, color: ART_COLORS[i % ART_COLORS.length]}, char.repeat(2)))),
560
- create(Box, {flexDirection: 'row', marginTop: 1}, ...artTileNodes)
561
- ),
562
- create(Box, {marginTop: 1, flexDirection: 'row', alignItems: 'stretch', width: '100%', flexWrap: 'wrap'},
563
- create(Box, {flexGrow: 1, flexBasis: 0, minWidth: PROJECTS_MIN_WIDTH, marginRight: 1, borderStyle: 'round', borderColor: 'magenta', padding: 1}, create(Text, {bold: true, color: 'magenta'}, 'Projects'), create(Box, {flexDirection: 'column', marginTop: 1}, ...projectRows)),
564
- create(Box, {flexGrow: 1.3, flexBasis: 0, minWidth: DETAILS_MIN_WIDTH, borderStyle: 'round', borderColor: 'cyan', padding: 1, flexDirection: 'column'}, create(Text, {bold: true, color: 'cyan'}, 'Details'), ...detailContent)
565
- ),
566
- create(Box, {marginTop: 1, flexDirection: 'column'},
567
- create(Box, {flexDirection: 'row', justifyContent: 'space-between'}, create(Text, {bold: true, color: 'yellow'}, `Output: ${activeTask?.name || 'None'}`), create(Text, {dimColor: true}, logOffset ? `Scrolled ${logOffset} lines` : 'Live log view')),
568
- create(OutputPanel, {activeTask, logOffset}),
569
- create(Box, {marginTop: 1, flexDirection: 'row', justifyContent: 'space-between'}, create(Text, {dimColor: true}, running ? 'Type to feed stdin; Enter: submit.' : 'Run a command or press Shift+T to switch tasks.'), create(Text, {dimColor: true}, `${toggleHint}, Shift+S: Structure Guide`)),
570
- create(Box, {marginTop: 1, flexDirection: 'row', borderStyle: 'round', borderColor: running ? 'green' : 'gray', paddingX: 1}, create(Text, {bold: true, color: running ? 'green' : 'white'}, running ? ' Stdin buffer ' : ' Input ready '), create(Box, {marginLeft: 1}, create(CursorText, {value: stdinBuffer || (running ? '' : 'Start a command to feed stdin'), cursorIndex: stdinCursor, active: running})))
571
- ),
572
- config.showHelpCards && create(Box, {marginTop: 1, flexDirection: 'row', justifyContent: 'space-between', flexWrap: 'wrap'}, [
573
- {label: 'Navigation', color: 'magenta', body: ['↑ / ↓ move focus, Enter: details', 'Shift+↑ / ↓ scroll output', 'Shift+H toggle help cards', 'Shift+D detach from task']},
574
- {label: 'Management', color: 'cyan', body: ['Shift+P Package Registry', 'Shift+N Project Architect', 'Shift+X clear / Shift+E export']},
575
- {label: 'Orbit & Studio', color: 'yellow', body: ['Shift+T task manager', 'Shift+A studio / Shift+B art board', 'Shift+S structure / Shift+Q quit']}
576
- ].map((card, idx) => create(Box, {key: card.label, flexGrow: 1, flexBasis: 0, minWidth: HELP_CARD_MIN_WIDTH, marginRight: idx < 2 ? 1 : 0, marginBottom: 1, borderStyle: 'round', borderColor: card.color, padding: 1, flexDirection: 'column'}, create(Text, {color: card.color, bold: true, marginBottom: 1}, card.label), ...card.body.map((line, lidx) => create(Text, {key: lidx, dimColor: card.color === 'yellow'}, line))))),
577
- config.showStructureGuide && create(Box, {flexDirection: 'column', borderStyle: 'round', borderColor: 'blue', marginTop: 1, padding: 1}, create(Text, {color: 'cyan', bold: true}, 'Structure guide · press Shift+S to hide'), ...SCHEMA_GUIDE.map(e => create(Text, {key: e.type, dimColor: true}, `• ${e.icon} ${e.label}: ${e.files.join(', ')}`))),
578
- showHelp && create(Box, {flexDirection: 'column', borderStyle: 'double', borderColor: 'cyan', marginTop: 1, padding: 1}, create(Text, {color: 'cyan', bold: true}, 'Help overlay'), create(Text, null, 'Shift+↑/↓ scrolls logs; Shift+X clears; Shift+E exports; Shift+A Studio; Shift+T Tasks; Shift+D Detach; Shift+B Toggle Art Board; Shift+P Packages; Shift+N Creator.'))
579
- );
551
+ const renderView = () => {
552
+ switch (mainView) {
553
+ case 'studio': return create(Studio);
554
+ case 'tasks': return create(TaskManager, {tasks, activeTaskId, renameMode, renameInput, renameCursor, CursorText});
555
+ case 'registry': return create(PackageRegistry, {selectedProject, projects, onRunCommand: runProjectCommand, CursorText, onSelectProject: (idx) => setSelectedIndex(idx)});
556
+ case 'architect': return create(ProjectArchitect, {rootPath, onRunCommand: runProjectCommand, CursorText, onReturn: () => setMainView('navigator')});
557
+ default: return create(Box, {flexDirection: 'column'},
558
+ create(Box, {justifyContent: 'space-between'},
559
+ create(Box, {flexDirection: 'column'}, create(Text, {color: 'magenta', bold: true}, 'Project Compass'), create(Text, {dimColor: true}, `${projectCountLabel} detected in ${rootPath}`)),
560
+ create(Box, {flexDirection: 'column', alignItems: 'flex-end'},
561
+ create(Text, {color: running ? 'yellow' : 'green'}, statusHint),
562
+ create(Text, {dimColor: true}, `${toggleHint} · ${orbitHint} · ${artHint} · Shift+Q: Quit`)
563
+ )
564
+ ),
565
+ config.showArtBoard && create(Box, {flexDirection: 'column', marginTop: 1, borderStyle: 'round', borderColor: 'gray', padding: 1},
566
+ create(Box, {flexDirection: 'row', justifyContent: 'space-between'}, create(Text, {color: 'magenta', bold: true}, 'Art-coded build atlas'), create(Text, {dimColor: true}, 'press ? for overlay help')),
567
+ create(Box, {flexDirection: 'row', marginTop: 1}, ...ART_CHARS.map((char, i) => create(Text, {key: i, color: ART_COLORS[i % ART_COLORS.length]}, char.repeat(2)))),
568
+ create(Box, {flexDirection: 'row', marginTop: 1}, ...artTileNodes)
569
+ ),
570
+ create(Box, {marginTop: 1, flexDirection: 'row', alignItems: 'stretch', width: '100%', flexWrap: 'wrap'},
571
+ create(Box, {flexGrow: 1, flexBasis: 0, minWidth: PROJECTS_MIN_WIDTH, marginRight: 1, borderStyle: 'round', borderColor: 'magenta', padding: 1}, create(Text, {bold: true, color: 'magenta'}, 'Projects'), create(Box, {flexDirection: 'column', marginTop: 1}, ...projectRows)),
572
+ create(Box, {flexGrow: 1.3, flexBasis: 0, minWidth: DETAILS_MIN_WIDTH, borderStyle: 'round', borderColor: 'cyan', padding: 1, flexDirection: 'column'}, create(Text, {bold: true, color: 'cyan'}, 'Details'), ...detailContent)
573
+ ),
574
+ create(Box, {marginTop: 1, flexDirection: 'column'},
575
+ create(Box, {flexDirection: 'row', justifyContent: 'space-between'}, create(Text, {bold: true, color: 'yellow'}, `Output: ${activeTask?.name || 'None'}`), create(Text, {dimColor: true}, logOffset ? `Scrolled ${logOffset} lines` : 'Live log view')),
576
+ create(OutputPanel, {activeTask, logOffset}),
577
+ create(Box, {marginTop: 1, flexDirection: 'row', justifyContent: 'space-between'}, create(Text, {dimColor: true}, running ? 'Type to feed stdin; Enter: submit.' : 'Run a command or press Shift+T to switch tasks.'), create(Text, {dimColor: true}, `${toggleHint}, Shift+S: Structure Guide`)),
578
+ create(Box, {marginTop: 1, flexDirection: 'row', borderStyle: 'round', borderColor: running ? 'green' : 'gray', paddingX: 1}, create(Text, {bold: true, color: running ? 'green' : 'white'}, running ? ' Stdin buffer ' : ' Input ready '), create(Box, {marginLeft: 1}, create(CursorText, {value: stdinBuffer || (running ? '' : 'Start a command to feed stdin'), cursorIndex: stdinCursor, active: running})))
579
+ ),
580
+ config.showHelpCards && create(Box, {marginTop: 1, flexDirection: 'row', justifyContent: 'space-between', flexWrap: 'wrap'}, [
581
+ {label: 'Navigation', color: 'magenta', body: [' / ↓ move focus, Enter: details', 'Shift+↑ / ↓ scroll output', 'Shift+H toggle help cards', 'Shift+D detach from task']},
582
+ {label: 'Management', color: 'cyan', body: ['Shift+P Package Registry', 'Shift+N Project Architect', 'Shift+X clear / Shift+E export']},
583
+ {label: 'Orbit & Studio', color: 'yellow', body: ['Shift+T task manager', 'Shift+A studio / Shift+B art board', 'Shift+S structure / Shift+Q quit']}
584
+ ].map((card, idx) => create(Box, {key: card.label, flexGrow: 1, flexBasis: 0, minWidth: HELP_CARD_MIN_WIDTH, marginRight: idx < 2 ? 1 : 0, marginBottom: 1, borderStyle: 'round', borderColor: card.color, padding: 1, flexDirection: 'column'}, create(Text, {color: card.color, bold: true, marginBottom: 1}, card.label), ...card.body.map((line, lidx) => create(Text, {key: lidx, dimColor: card.color === 'yellow'}, line))))),
585
+ config.showStructureGuide && create(Box, {flexDirection: 'column', borderStyle: 'round', borderColor: 'blue', marginTop: 1, padding: 1}, create(Text, {color: 'cyan', bold: true}, 'Structure guide · press Shift+S to hide'), ...SCHEMA_GUIDE.map(e => create(Text, {key: e.type, dimColor: true}, `• ${e.icon} ${e.label}: ${e.files.join(', ')}`))),
586
+ showHelp && create(Box, {flexDirection: 'column', borderStyle: 'double', borderColor: 'cyan', marginTop: 1, padding: 1}, create(Text, {color: 'cyan', bold: true}, 'Help overlay'), create(Text, null, 'Shift+↑/↓ scrolls logs; Shift+X clears; Shift+E exports; Shift+A Studio; Shift+T Tasks; Shift+D Detach; Shift+B Toggle Art Board; Shift+P Packages; Shift+N Creator.'))
587
+ );
588
+ }
589
+ };
590
+
591
+ return create(Box, {flexDirection: 'column', padding: 1, width: '100%'}, renderView());
580
592
  }
581
593
 
582
594
 
@@ -3,20 +3,34 @@ import {Box, Text, useInput} from 'ink';
3
3
 
4
4
  const create = React.createElement;
5
5
 
6
- const PackageRegistry = memo(({selectedProject, onRunCommand, CursorText}) => {
6
+ const PackageRegistry = memo(({selectedProject, projects = [], onRunCommand, CursorText, onSelectProject}) => {
7
+ const [view, setView] = useState(selectedProject ? 'manage' : 'select'); // select | manage
7
8
  const [mode, setMode] = useState('list'); // list | add | remove
8
9
  const [input, setInput] = useState('');
9
10
  const [cursor, setCursor] = useState(0);
11
+ const [selIdx, setSelIdx] = useState(0);
10
12
 
11
- const projectType = selectedProject?.type || 'Unknown';
12
- const deps = selectedProject?.metadata?.dependencies || [];
13
+ const activeProject = view === 'manage' ? selectedProject : projects[selIdx];
14
+ const projectType = activeProject?.type || 'Unknown';
15
+ const deps = activeProject?.metadata?.dependencies || [];
13
16
 
14
17
  useInput((inputStr, key) => {
18
+ if (view === 'select') {
19
+ if (key.upArrow) { setSelIdx(prev => (prev - 1 + projects.length) % projects.length); return; }
20
+ if (key.downArrow) { setSelIdx(prev => (prev + 1) % projects.length); return; }
21
+ if (key.return && projects[selIdx]) {
22
+ if (onSelectProject) onSelectProject(selIdx);
23
+ setView('manage');
24
+ return;
25
+ }
26
+ return;
27
+ }
28
+
15
29
  if (mode === 'add' || mode === 'remove') {
16
30
  if (key.return) {
17
31
  if (input.trim()) {
18
32
  const cmd = mode === 'add' ? getAddCmd(projectType, input.trim()) : getRemoveCmd(projectType, input.trim());
19
- if (cmd) onRunCommand({label: `${mode === 'add' ? 'Add' : 'Remove'} ${input}`, command: cmd});
33
+ if (cmd) onRunCommand({label: `${mode === 'add' ? 'Add' : 'Remove'} ${input}`, command: cmd}, activeProject);
20
34
  }
21
35
  setMode('list'); setInput(''); setCursor(0);
22
36
  return;
@@ -40,8 +54,9 @@ const PackageRegistry = memo(({selectedProject, onRunCommand, CursorText}) => {
40
54
 
41
55
  if (inputStr.toLowerCase() === 'a') { setMode('add'); setInput(''); setCursor(0); }
42
56
  if (inputStr.toLowerCase() === 'r') { setMode('remove'); setInput(''); setCursor(0); }
57
+ if (inputStr.toLowerCase() === 's') { setView('select'); }
43
58
  if (inputStr.toLowerCase() === 'v' && projectType === 'Python') {
44
- onRunCommand({label: 'Create venv', command: ['python3', '-m', 'venv', '.venv']});
59
+ onRunCommand({label: 'Create venv', command: ['python3', '-m', 'venv', '.venv']}, activeProject);
45
60
  }
46
61
  });
47
62
 
@@ -63,13 +78,24 @@ const PackageRegistry = memo(({selectedProject, onRunCommand, CursorText}) => {
63
78
  return null;
64
79
  };
65
80
 
81
+ if (view === 'select') {
82
+ return create(
83
+ Box,
84
+ {flexDirection: 'column', borderStyle: 'round', borderColor: 'cyan', padding: 1, width: '100%'},
85
+ create(Text, {bold: true, color: 'cyan'}, '📦 Package Registry | Select Project'),
86
+ create(Text, {dimColor: true, marginBottom: 1}, 'Choose a project to manage dependencies:'),
87
+ ...projects.map((p, i) => create(Text, {key: p.id, color: i === selIdx ? 'cyan' : 'white'}, `${i === selIdx ? '→' : ' '} ${p.icon} ${p.name} (${p.type})`)),
88
+ create(Text, {dimColor: true, marginTop: 1}, 'Arrows: Move, Enter: Select, Shift+P: Back')
89
+ );
90
+ }
91
+
66
92
  return create(
67
93
  Box,
68
- {flexDirection: 'column', borderStyle: 'round', borderColor: 'magenta', padding: 1},
94
+ {flexDirection: 'column', borderStyle: 'round', borderColor: 'magenta', padding: 1, width: '100%'},
69
95
  create(
70
96
  Box,
71
97
  {justifyContent: 'space-between'},
72
- create(Text, {bold: true, color: 'magenta'}, `📦 Package Registry | ${selectedProject?.name}`),
98
+ create(Text, {bold: true, color: 'magenta'}, `📦 Package Registry | ${activeProject?.name}`),
73
99
  create(Text, {dimColor: true}, projectType)
74
100
  ),
75
101
  create(Text, {dimColor: true, marginBottom: 1}, 'Manage dependencies and environments for this project.'),
@@ -87,8 +113,9 @@ const PackageRegistry = memo(({selectedProject, onRunCommand, CursorText}) => {
87
113
  Box,
88
114
  {marginTop: 1, flexDirection: 'column'},
89
115
  create(Text, {color: 'cyan'}, 'A: Add Package | R: Remove Package'),
116
+ create(Text, {color: 'blue'}, 'S: Switch Project'),
90
117
  projectType === 'Python' && create(Text, {color: 'yellow'}, 'V: Create .venv'),
91
- create(Text, {dimColor: true, marginTop: 1}, 'Press Shift+P to return to Navigator.')
118
+ create(Text, {dimColor: true, marginTop: 1}, 'Press Shift+P or Esc to return to Navigator.')
92
119
  )
93
120
  )
94
121
  : create(
Binary file
Binary file
Binary file