project-compass 3.5.4 → 3.5.6
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 +49 -35
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -358,12 +358,19 @@ function Compass({rootPath, initialView = 'navigator'}) {
|
|
|
358
358
|
|
|
359
359
|
const normalizedInput = input?.toLowerCase();
|
|
360
360
|
const shiftCombo = (char) => key.shift && normalizedInput === char;
|
|
361
|
+
|
|
362
|
+
const clearAndSwitch = (view) => {
|
|
363
|
+
console.clear();
|
|
364
|
+
setMainView(view);
|
|
365
|
+
setViewMode('list');
|
|
366
|
+
setShowHelp(false);
|
|
367
|
+
};
|
|
361
368
|
|
|
362
369
|
if (shiftCombo('h')) { setConfig(prev => { const next = {...prev, showHelpCards: !prev.showHelpCards}; saveConfig(next); return next; }); return; }
|
|
363
370
|
if (shiftCombo('s')) { setConfig(prev => { const next = {...prev, showStructureGuide: !prev.showStructureGuide}; saveConfig(next); return next; }); return; }
|
|
364
|
-
if (shiftCombo('a')) {
|
|
365
|
-
if (shiftCombo('p')) {
|
|
366
|
-
if (shiftCombo('n')) {
|
|
371
|
+
if (shiftCombo('a')) { clearAndSwitch(mainView === 'navigator' ? 'studio' : 'navigator'); return; }
|
|
372
|
+
if (shiftCombo('p')) { clearAndSwitch(mainView === 'navigator' ? 'registry' : 'navigator'); return; }
|
|
373
|
+
if (shiftCombo('n')) { clearAndSwitch(mainView === 'navigator' ? 'architect' : 'navigator'); return; }
|
|
367
374
|
if (shiftCombo('x')) { setTasks(prev => prev.map(t => t.id === activeTaskId ? {...t, logs: []} : t)); setLogOffset(0); return; }
|
|
368
375
|
if (shiftCombo('e')) { exportLogs(); return; }
|
|
369
376
|
if (shiftCombo('d')) { setActiveTaskId(null); return; }
|
|
@@ -371,16 +378,19 @@ function Compass({rootPath, initialView = 'navigator'}) {
|
|
|
371
378
|
|
|
372
379
|
if (shiftCombo('t')) {
|
|
373
380
|
setMainView((prev) => {
|
|
381
|
+
console.clear();
|
|
374
382
|
if (prev === 'tasks') return 'navigator';
|
|
375
383
|
if (tasks.length > 0 && !activeTaskId) setActiveTaskId(tasks[0].id);
|
|
376
384
|
return 'tasks';
|
|
377
385
|
});
|
|
386
|
+
setViewMode('list');
|
|
387
|
+
setShowHelp(false);
|
|
378
388
|
return;
|
|
379
389
|
}
|
|
380
390
|
|
|
381
391
|
if (key.escape) {
|
|
382
392
|
if (mainView !== 'navigator') {
|
|
383
|
-
|
|
393
|
+
clearAndSwitch('navigator');
|
|
384
394
|
return;
|
|
385
395
|
}
|
|
386
396
|
}
|
|
@@ -441,6 +451,7 @@ function Compass({rootPath, initialView = 'navigator'}) {
|
|
|
441
451
|
if (key.downArrow && !key.shift && projects.length > 0) { setSelectedIndex((prev) => (prev + 1) % projects.length); return; }
|
|
442
452
|
if (key.return) {
|
|
443
453
|
if (!selectedProject) return;
|
|
454
|
+
console.clear();
|
|
444
455
|
setViewMode((prev) => (prev === 'detail' ? 'list' : 'detail'));
|
|
445
456
|
return;
|
|
446
457
|
}
|
|
@@ -554,37 +565,40 @@ function Compass({rootPath, initialView = 'navigator'}) {
|
|
|
554
565
|
case 'tasks': return create(TaskManager, {tasks, activeTaskId, renameMode, renameInput, renameCursor, CursorText});
|
|
555
566
|
case 'registry': return create(PackageRegistry, {selectedProject, projects, onRunCommand: runProjectCommand, CursorText, onSelectProject: (idx) => setSelectedIndex(idx)});
|
|
556
567
|
case 'architect': return create(ProjectArchitect, {rootPath, onRunCommand: runProjectCommand, CursorText, onReturn: () => setMainView('navigator')});
|
|
557
|
-
default:
|
|
558
|
-
|
|
559
|
-
create(Box, {
|
|
560
|
-
|
|
561
|
-
create(
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
create(Box, {
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
create(Box, {
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
create(Box, {
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
{
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
568
|
+
default: {
|
|
569
|
+
const navigatorBody = [
|
|
570
|
+
create(Box, {key: 'header', justifyContent: 'space-between'},
|
|
571
|
+
create(Box, {flexDirection: 'column'}, create(Text, {color: 'magenta', bold: true}, 'Project Compass'), create(Text, {dimColor: true}, `${projectCountLabel} detected in ${rootPath}`)),
|
|
572
|
+
create(Box, {flexDirection: 'column', alignItems: 'flex-end'},
|
|
573
|
+
create(Text, {color: running ? 'yellow' : 'green'}, statusHint),
|
|
574
|
+
create(Text, {dimColor: true}, `${toggleHint} · ${orbitHint} · ${artHint} · Shift+Q: Quit`)
|
|
575
|
+
)
|
|
576
|
+
),
|
|
577
|
+
config.showArtBoard && create(Box, {key: 'artboard', flexDirection: 'column', marginTop: 1, borderStyle: 'round', borderColor: 'gray', padding: 1},
|
|
578
|
+
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')),
|
|
579
|
+
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)))),
|
|
580
|
+
create(Box, {flexDirection: 'row', marginTop: 1}, ...artTileNodes)
|
|
581
|
+
),
|
|
582
|
+
create(Box, {key: 'projects-row', marginTop: 1, flexDirection: 'row', alignItems: 'stretch', width: '100%', flexWrap: 'wrap'},
|
|
583
|
+
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)),
|
|
584
|
+
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)
|
|
585
|
+
),
|
|
586
|
+
create(Box, {key: 'output-row', marginTop: 1, flexDirection: 'column'},
|
|
587
|
+
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')),
|
|
588
|
+
create(OutputPanel, {activeTask, logOffset}),
|
|
589
|
+
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`)),
|
|
590
|
+
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})))
|
|
591
|
+
),
|
|
592
|
+
config.showHelpCards && create(Box, {key: 'help-cards', marginTop: 1, flexDirection: 'row', justifyContent: 'space-between', flexWrap: 'wrap'}, [
|
|
593
|
+
{label: 'Navigation', color: 'magenta', body: ['↑ / ↓ move focus, Enter: details', 'Shift+↑ / ↓ scroll output', 'Shift+H toggle help cards', 'Shift+D detach from task']},
|
|
594
|
+
{label: 'Management', color: 'cyan', body: ['Shift+P Package Registry', 'Shift+N Project Architect', 'Shift+X clear / Shift+E export']},
|
|
595
|
+
{label: 'Orbit & Studio', color: 'yellow', body: ['Shift+T task manager', 'Shift+A studio / Shift+B art board', 'Shift+S structure / Shift+Q quit']}
|
|
596
|
+
].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))))),
|
|
597
|
+
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(', ')}`))),
|
|
598
|
+
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.'))
|
|
599
|
+
];
|
|
600
|
+
return create(Box, {flexDirection: 'column'}, ...navigatorBody);
|
|
601
|
+
}
|
|
588
602
|
}
|
|
589
603
|
};
|
|
590
604
|
|