project-compass 3.5.3 → 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.3",
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": {
package/src/cli.js CHANGED
@@ -548,42 +548,47 @@ function Compass({rootPath, initialView = 'navigator'}) {
548
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'));
549
549
  }
550
550
 
551
- if (mainView === 'studio') return create(Box, {flexDirection: 'column', width: '100%'}, create(Studio));
552
- if (mainView === 'tasks') return create(Box, {flexDirection: 'column', width: '100%'}, create(TaskManager, {tasks, activeTaskId, renameMode, renameInput, renameCursor, CursorText}));
553
- if (mainView === 'registry') return create(Box, {flexDirection: 'column', width: '100%'}, create(PackageRegistry, {selectedProject, onRunCommand: runProjectCommand, CursorText}));
554
- if (mainView === 'architect') return create(Box, {flexDirection: 'column', width: '100%'}, create(ProjectArchitect, {rootPath, onRunCommand: runProjectCommand, CursorText, onReturn: () => setMainView('navigator')}));
555
-
556
- return create(Box, {flexDirection: 'column', padding: 1},
557
- create(Box, {justifyContent: 'space-between'},
558
- create(Box, {flexDirection: 'column'}, create(Text, {color: 'magenta', bold: true}, 'Project Compass'), create(Text, {dimColor: true}, `${projectCountLabel} detected in ${rootPath}`)),
559
- create(Box, {flexDirection: 'column', alignItems: 'flex-end'},
560
- create(Text, {color: running ? 'yellow' : 'green'}, statusHint),
561
- create(Text, {dimColor: true}, `${toggleHint} · ${orbitHint} · ${artHint} · Shift+Q: Quit`)
562
- )
563
- ),
564
- config.showArtBoard && create(Box, {flexDirection: 'column', marginTop: 1, borderStyle: 'round', borderColor: 'gray', padding: 1},
565
- 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')),
566
- 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)))),
567
- create(Box, {flexDirection: 'row', marginTop: 1}, ...artTileNodes)
568
- ),
569
- create(Box, {marginTop: 1, flexDirection: 'row', alignItems: 'stretch', width: '100%', flexWrap: 'wrap'},
570
- 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)),
571
- 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)
572
- ),
573
- create(Box, {marginTop: 1, flexDirection: 'column'},
574
- 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')),
575
- create(OutputPanel, {activeTask, logOffset}),
576
- 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`)),
577
- 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})))
578
- ),
579
- config.showHelpCards && create(Box, {marginTop: 1, flexDirection: 'row', justifyContent: 'space-between', flexWrap: 'wrap'}, [
580
- {label: 'Navigation', color: 'magenta', body: ['↑ / ↓ move focus, Enter: details', 'Shift+↑ / ↓ scroll output', 'Shift+H toggle help cards', 'Shift+D detach from task']},
581
- {label: 'Management', color: 'cyan', body: ['Shift+P Package Registry', 'Shift+N Project Architect', 'Shift+X clear / Shift+E export']},
582
- {label: 'Orbit & Studio', color: 'yellow', body: ['Shift+T task manager', 'Shift+A studio / Shift+B art board', 'Shift+S structure / Shift+Q quit']}
583
- ].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))))),
584
- 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(', ')}`))),
585
- 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.'))
586
- );
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());
587
592
  }
588
593
 
589
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,14 @@ const PackageRegistry = memo(({selectedProject, onRunCommand, CursorText}) => {
63
78
  return null;
64
79
  };
65
80
 
66
- if (!selectedProject) {
81
+ if (view === 'select') {
67
82
  return create(
68
83
  Box,
69
- {flexDirection: 'column', borderStyle: 'round', borderColor: 'red', padding: 1, width: '100%'},
70
- create(Text, {bold: true, color: 'red'}, '📦 Package Registry | No Project Selected'),
71
- create(Text, {marginTop: 1}, 'Please select a project in the Navigator first before opening the Registry.'),
72
- create(Text, {dimColor: true, marginTop: 1}, 'Press Shift+P to return to Navigator.')
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')
73
89
  );
74
90
  }
75
91
 
@@ -79,7 +95,7 @@ const PackageRegistry = memo(({selectedProject, onRunCommand, CursorText}) => {
79
95
  create(
80
96
  Box,
81
97
  {justifyContent: 'space-between'},
82
- create(Text, {bold: true, color: 'magenta'}, `📦 Package Registry | ${selectedProject?.name}`),
98
+ create(Text, {bold: true, color: 'magenta'}, `📦 Package Registry | ${activeProject?.name}`),
83
99
  create(Text, {dimColor: true}, projectType)
84
100
  ),
85
101
  create(Text, {dimColor: true, marginBottom: 1}, 'Manage dependencies and environments for this project.'),
@@ -97,8 +113,9 @@ const PackageRegistry = memo(({selectedProject, onRunCommand, CursorText}) => {
97
113
  Box,
98
114
  {marginTop: 1, flexDirection: 'column'},
99
115
  create(Text, {color: 'cyan'}, 'A: Add Package | R: Remove Package'),
116
+ create(Text, {color: 'blue'}, 'S: Switch Project'),
100
117
  projectType === 'Python' && create(Text, {color: 'yellow'}, 'V: Create .venv'),
101
- 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.')
102
119
  )
103
120
  )
104
121
  : create(