project-compass 2.9.1 → 2.9.2

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/cli.js +25 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "project-compass",
3
- "version": "2.9.1",
3
+ "version": "2.9.2",
4
4
  "description": "Ink-based project explorer that detects local repos and lets you build/test/run them without memorizing commands.",
5
5
  "main": "src/cli.js",
6
6
  "type": "module",
package/src/cli.js CHANGED
@@ -39,13 +39,15 @@ function loadConfig() {
39
39
  return {
40
40
  customCommands: {},
41
41
  showArtBoard: true,
42
+ showHelpCards: false,
43
+ showStructureGuide: false,
42
44
  ...parsed,
43
45
  };
44
46
  }
45
47
  } catch (error) {
46
48
  console.error(`Ignoring corrupt config: ${error.message}`);
47
49
  }
48
- return {customCommands: {}, showArtBoard: true};
50
+ return {customCommands: {}, showArtBoard: true, showHelpCards: false, showStructureGuide: false};
49
51
  }
50
52
 
51
53
  function useScanner(rootPath) {
@@ -176,8 +178,6 @@ function Compass({rootPath, initialView = 'navigator'}) {
176
178
  const [renameCursor, setRenameCursor] = useState(0);
177
179
  const [quitConfirm, setQuitConfirm] = useState(false);
178
180
  const [config, setConfig] = useState(() => loadConfig());
179
- const [showHelpCards, setShowHelpCards] = useState(false);
180
- const [showStructureGuide, setShowStructureGuide] = useState(false);
181
181
  const [stdinBuffer, setStdinBuffer] = useState('');
182
182
  const [stdinCursor, setStdinCursor] = useState(0);
183
183
  const [showHelp, setShowHelp] = useState(false);
@@ -354,8 +354,22 @@ function Compass({rootPath, initialView = 'navigator'}) {
354
354
  const normalizedInput = input?.toLowerCase();
355
355
  const shiftCombo = (char) => key.shift && normalizedInput === char;
356
356
 
357
- if (shiftCombo('h')) { setShowHelpCards((prev) => !prev); return; }
358
- if (shiftCombo('s')) { setShowStructureGuide((prev) => !prev); return; }
357
+ if (shiftCombo('h')) {
358
+ setConfig(prev => {
359
+ const next = {...prev, showHelpCards: !prev.showHelpCards};
360
+ saveConfig(next);
361
+ return next;
362
+ });
363
+ return;
364
+ }
365
+ if (shiftCombo('s')) {
366
+ setConfig(prev => {
367
+ const next = {...prev, showStructureGuide: !prev.showStructureGuide};
368
+ saveConfig(next);
369
+ return next;
370
+ });
371
+ return;
372
+ }
359
373
  if (shiftCombo('a')) { setMainView((prev) => (prev === 'navigator' ? 'studio' : 'navigator')); return; }
360
374
  if (shiftCombo('x')) { setTasks(prev => prev.map(t => t.id === activeTaskId ? {...t, logs: []} : t)); setLogOffset(0); return; }
361
375
  if (shiftCombo('e')) { exportLogs(); return; }
@@ -561,10 +575,10 @@ function Compass({rootPath, initialView = 'navigator'}) {
561
575
  const helpCards = [
562
576
  {label: 'Navigation', color: 'magenta', body: ['↑ / ↓ move focus, Enter: details', 'Shift+↑ / ↓ scroll output', 'Shift+H toggle help cards', 'Shift+D detach from task']},
563
577
  {label: 'Commands', color: 'cyan', body: ['B / T / R build/test/run', '1-9 run detail commands', 'Shift+L rerun last command', 'Shift+X clear / Shift+E export']},
564
- {label: 'Orbit & Studio', color: 'yellow', body: ['Shift+T task manager', 'Shift+A studio / Shift+B art', 'Shift+C custom / Shift+Q quit']}
578
+ {label: 'Orbit & Studio', color: 'yellow', body: ['Shift+T task manager', 'Shift+A studio / Shift+B art board', 'Shift+S structure / Shift+Q quit']}
565
579
  ];
566
580
 
567
- const toggleHint = showHelpCards ? 'Shift+H hide help' : 'Shift+H show help';
581
+ const toggleHint = config.showHelpCards ? 'Shift+H hide help' : 'Shift+H show help';
568
582
  return create(Box, {flexDirection: 'column', padding: 1},
569
583
  create(Box, {justifyContent: 'space-between'},
570
584
  create(Box, {flexDirection: 'column'}, create(Text, {color: 'magenta', bold: true}, 'Project Compass'), create(Text, {dimColor: true}, `${projectCountLabel} detected in ${rootPath}`)),
@@ -581,8 +595,8 @@ function Compass({rootPath, initialView = 'navigator'}) {
581
595
  create(Box, {marginTop: 1, flexDirection: 'row', justifyContent: 'space-between'}, create(Text, {dimColor: true}, running ? 'Type to feed stdin; Enter: submit, Ctrl+C: abort.' : 'Run a command or press Shift+T to switch tasks.'), create(Text, {dimColor: true}, `${toggleHint}, Shift+S: Structure Guide`)),
582
596
  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})))
583
597
  ),
584
- showHelpCards && create(Box, {marginTop: 1, flexDirection: 'row', justifyContent: 'space-between', flexWrap: 'wrap'}, ...helpCards.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
- 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(', ')}`))),
598
+ config.showHelpCards && create(Box, {marginTop: 1, flexDirection: 'row', justifyContent: 'space-between', flexWrap: 'wrap'}, ...helpCards.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))))),
599
+ 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
600
  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.'))
587
601
  );
588
602
  }
@@ -621,6 +635,8 @@ async function main() {
621
635
  console.log(' Shift+T Open Orbit Task Manager (Manage background processes)');
622
636
  console.log(' Shift+D Detach from active task (Keep it running in background)');
623
637
  console.log(' Shift+B Toggle Art Board visibility');
638
+ console.log(' Shift+H Toggle Help Cards visibility');
639
+ console.log(' Shift+S Toggle Structure Guide visibility');
624
640
  console.log(' Shift+X Clear active task output log');
625
641
  console.log(' Shift+E Export current logs to a .txt file');
626
642
  console.log(' Shift+↑ / ↓ Scroll the output logs');