project-compass 3.5.3 → 3.5.5
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 +1 -1
- package/src/cli.js +51 -39
- package/src/components/PackageRegistry.js +29 -12
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -361,9 +361,9 @@ function Compass({rootPath, initialView = 'navigator'}) {
|
|
|
361
361
|
|
|
362
362
|
if (shiftCombo('h')) { setConfig(prev => { const next = {...prev, showHelpCards: !prev.showHelpCards}; saveConfig(next); return next; }); return; }
|
|
363
363
|
if (shiftCombo('s')) { setConfig(prev => { const next = {...prev, showStructureGuide: !prev.showStructureGuide}; saveConfig(next); return next; }); return; }
|
|
364
|
-
if (shiftCombo('a')) { setMainView((prev) => (prev === 'navigator' ? 'studio' : 'navigator')); return; }
|
|
365
|
-
if (shiftCombo('p')) { setMainView((prev) => (prev === 'navigator' ? 'registry' : 'navigator')); return; }
|
|
366
|
-
if (shiftCombo('n')) { setMainView((prev) => (prev === 'navigator' ? 'architect' : 'navigator')); return; }
|
|
364
|
+
if (shiftCombo('a')) { setMainView((prev) => (prev === 'navigator' ? 'studio' : 'navigator')); setViewMode('list'); setShowHelp(false); return; }
|
|
365
|
+
if (shiftCombo('p')) { setMainView((prev) => (prev === 'navigator' ? 'registry' : 'navigator')); setViewMode('list'); setShowHelp(false); return; }
|
|
366
|
+
if (shiftCombo('n')) { setMainView((prev) => (prev === 'navigator' ? 'architect' : 'navigator')); setViewMode('list'); setShowHelp(false); return; }
|
|
367
367
|
if (shiftCombo('x')) { setTasks(prev => prev.map(t => t.id === activeTaskId ? {...t, logs: []} : t)); setLogOffset(0); return; }
|
|
368
368
|
if (shiftCombo('e')) { exportLogs(); return; }
|
|
369
369
|
if (shiftCombo('d')) { setActiveTaskId(null); return; }
|
|
@@ -375,12 +375,16 @@ function Compass({rootPath, initialView = 'navigator'}) {
|
|
|
375
375
|
if (tasks.length > 0 && !activeTaskId) setActiveTaskId(tasks[0].id);
|
|
376
376
|
return 'tasks';
|
|
377
377
|
});
|
|
378
|
+
setViewMode('list');
|
|
379
|
+
setShowHelp(false);
|
|
378
380
|
return;
|
|
379
381
|
}
|
|
380
382
|
|
|
381
383
|
if (key.escape) {
|
|
382
384
|
if (mainView !== 'navigator') {
|
|
383
385
|
setMainView('navigator');
|
|
386
|
+
setViewMode('list');
|
|
387
|
+
setShowHelp(false);
|
|
384
388
|
return;
|
|
385
389
|
}
|
|
386
390
|
}
|
|
@@ -548,42 +552,50 @@ function Compass({rootPath, initialView = 'navigator'}) {
|
|
|
548
552
|
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
553
|
}
|
|
550
554
|
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
555
|
+
const renderView = () => {
|
|
556
|
+
switch (mainView) {
|
|
557
|
+
case 'studio': return create(Studio);
|
|
558
|
+
case 'tasks': return create(TaskManager, {tasks, activeTaskId, renameMode, renameInput, renameCursor, CursorText});
|
|
559
|
+
case 'registry': return create(PackageRegistry, {selectedProject, projects, onRunCommand: runProjectCommand, CursorText, onSelectProject: (idx) => setSelectedIndex(idx)});
|
|
560
|
+
case 'architect': return create(ProjectArchitect, {rootPath, onRunCommand: runProjectCommand, CursorText, onReturn: () => setMainView('navigator')});
|
|
561
|
+
default: {
|
|
562
|
+
const navigatorBody = [
|
|
563
|
+
create(Box, {key: 'header', justifyContent: 'space-between'},
|
|
564
|
+
create(Box, {flexDirection: 'column'}, create(Text, {color: 'magenta', bold: true}, 'Project Compass'), create(Text, {dimColor: true}, `${projectCountLabel} detected in ${rootPath}`)),
|
|
565
|
+
create(Box, {flexDirection: 'column', alignItems: 'flex-end'},
|
|
566
|
+
create(Text, {color: running ? 'yellow' : 'green'}, statusHint),
|
|
567
|
+
create(Text, {dimColor: true}, `${toggleHint} · ${orbitHint} · ${artHint} · Shift+Q: Quit`)
|
|
568
|
+
)
|
|
569
|
+
),
|
|
570
|
+
config.showArtBoard && create(Box, {key: 'artboard', flexDirection: 'column', marginTop: 1, borderStyle: 'round', borderColor: 'gray', padding: 1},
|
|
571
|
+
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')),
|
|
572
|
+
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)))),
|
|
573
|
+
create(Box, {flexDirection: 'row', marginTop: 1}, ...artTileNodes)
|
|
574
|
+
),
|
|
575
|
+
create(Box, {key: 'projects-row', marginTop: 1, flexDirection: 'row', alignItems: 'stretch', width: '100%', flexWrap: 'wrap'},
|
|
576
|
+
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)),
|
|
577
|
+
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)
|
|
578
|
+
),
|
|
579
|
+
create(Box, {key: 'output-row', marginTop: 1, flexDirection: 'column'},
|
|
580
|
+
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')),
|
|
581
|
+
create(OutputPanel, {activeTask, logOffset}),
|
|
582
|
+
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`)),
|
|
583
|
+
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})))
|
|
584
|
+
),
|
|
585
|
+
config.showHelpCards && create(Box, {key: 'help-cards', marginTop: 1, flexDirection: 'row', justifyContent: 'space-between', flexWrap: 'wrap'}, [
|
|
586
|
+
{label: 'Navigation', color: 'magenta', body: ['↑ / ↓ move focus, Enter: details', 'Shift+↑ / ↓ scroll output', 'Shift+H toggle help cards', 'Shift+D detach from task']},
|
|
587
|
+
{label: 'Management', color: 'cyan', body: ['Shift+P Package Registry', 'Shift+N Project Architect', 'Shift+X clear / Shift+E export']},
|
|
588
|
+
{label: 'Orbit & Studio', color: 'yellow', body: ['Shift+T task manager', 'Shift+A studio / Shift+B art board', 'Shift+S structure / Shift+Q quit']}
|
|
589
|
+
].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))))),
|
|
590
|
+
config.showStructureGuide && create(Box, {key: 'structure', 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(', ')}`))),
|
|
591
|
+
showHelp && create(Box, {key: 'overlay', 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.'))
|
|
592
|
+
];
|
|
593
|
+
return create(Box, {flexDirection: 'column'}, ...navigatorBody);
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
};
|
|
597
|
+
|
|
598
|
+
return create(Box, {flexDirection: 'column', padding: 1, width: '100%'}, renderView());
|
|
587
599
|
}
|
|
588
600
|
|
|
589
601
|
|
|
@@ -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
|
|
12
|
-
const
|
|
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 (
|
|
81
|
+
if (view === 'select') {
|
|
67
82
|
return create(
|
|
68
83
|
Box,
|
|
69
|
-
{flexDirection: 'column', borderStyle: 'round', borderColor: '
|
|
70
|
-
create(Text, {bold: true, color: '
|
|
71
|
-
create(Text, {
|
|
72
|
-
create(Text, {
|
|
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 | ${
|
|
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(
|