servicemap 0.1.16 → 0.1.18

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/bin/servicemap.mjs +17 -65
  2. package/package.json +1 -1
@@ -404,62 +404,6 @@ function runTargetSurvey() {
404
404
  });
405
405
  }
406
406
 
407
- function renderInstallMethodSurvey(cursor) {
408
- console.clear();
409
- const methods = [
410
- { id: 'symlink', label: 'Symlink', note: 'Recommended, one stable source for easy updates' },
411
- { id: 'copy', label: 'Copy', note: 'Standalone copies in each selected agent folder' },
412
- ];
413
-
414
- timelineStep(cyan('servicemap'));
415
- timelineStep(`Source: ${repositoryUrl}`);
416
- timelineStep(`Stable source: ${stableSourceRoot()}`);
417
- timelineStep('Agents selected');
418
- timelineActive('Installation method');
419
- methods.forEach((method, index) => {
420
- const pointer = index === cursor ? '>' : ' ';
421
- const selected = index === cursor ? '●' : '○';
422
- timelineLine(`${pointer} ${selected} ${method.label} ${dim(`(${method.note})`)}`);
423
- });
424
- timelineLine(dim('↑/↓ to navigate • Enter to confirm'));
425
- }
426
-
427
- function runInstallMethodSurvey() {
428
- if (!process.stdin.isTTY || !process.stdout.isTTY) {
429
- return Promise.resolve('copy');
430
- }
431
-
432
- const methods = ['symlink', 'copy'];
433
- let cursor = 0;
434
-
435
- return new Promise((resolvePromise) => {
436
- readline.emitKeypressEvents(process.stdin);
437
- process.stdin.setRawMode(true);
438
- renderInstallMethodSurvey(cursor);
439
-
440
- const onKeypress = (_str, key) => {
441
- if (key.name === 'up') cursor = Math.max(0, cursor - 1);
442
- if (key.name === 'down') cursor = Math.min(methods.length - 1, cursor + 1);
443
- if (key.name === 'return') {
444
- process.stdin.setRawMode(false);
445
- process.stdin.off('keypress', onKeypress);
446
- console.log('');
447
- resolvePromise(methods[cursor]);
448
- return;
449
- }
450
- if (key.ctrl && key.name === 'c') {
451
- process.stdin.setRawMode(false);
452
- process.stdin.off('keypress', onKeypress);
453
- process.exit(130);
454
- }
455
-
456
- renderInstallMethodSurvey(cursor);
457
- };
458
-
459
- process.stdin.on('keypress', onKeypress);
460
- });
461
- }
462
-
463
407
  function runSilent(command, args, options = {}) {
464
408
  return new Promise((resolvePromise, reject) => {
465
409
  const child = spawn(command, args, {
@@ -481,19 +425,28 @@ function wait(ms) {
481
425
  });
482
426
  }
483
427
 
484
- async function withSpinner(message, action, minimumMs = 900) {
485
- if (!process.stdout.isTTY) {
486
- return action();
487
- }
488
-
428
+ async function withSpinner(message, action, minimumMs = 1400) {
489
429
  const frames = ['◒', '◐', '◓', '◑'];
490
430
  let frame = 0;
491
431
  let dots = '';
492
432
  const startedAt = Date.now();
493
- const writeFrame = () => {
494
- process.stdout.write(`\r\x1b[J${frames[frame]} ${message}${dots}`);
433
+ const nextText = () => {
434
+ const text = `${dim('│')} ${frames[frame]} ${message}${dots}`;
495
435
  frame = (frame + 1) % frames.length;
496
436
  if (frame === 0) dots = dots.length >= 5 ? '' : `${dots}.`;
437
+ return text;
438
+ };
439
+
440
+ if (!process.stdout.isTTY) {
441
+ console.log(nextText());
442
+ const result = await action();
443
+ const remainingMs = minimumMs - (Date.now() - startedAt);
444
+ if (remainingMs > 0) await wait(remainingMs);
445
+ return result;
446
+ }
447
+
448
+ const writeFrame = () => {
449
+ process.stdout.write(`\r\x1b[J${nextText()}`);
497
450
  };
498
451
 
499
452
  process.stdout.write('\x1b[?25l');
@@ -566,8 +519,7 @@ async function installSkill(options) {
566
519
  ? [{ id: 'universal', label: 'Universal', root: universalRoot }, ...await runTargetSurvey()]
567
520
  : targetsForOptions(options);
568
521
  const roots = skillRootsForTargets(options, selectedTargets);
569
- const method = options.installMethod
570
- ?? (options.survey && !options.yes ? await runInstallMethodSurvey() : 'copy');
522
+ const method = options.installMethod ?? 'symlink';
571
523
 
572
524
  if (!existsSync(source)) {
573
525
  throw new Error(`Bundled skill folder not found: ${source}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "servicemap",
3
- "version": "0.1.16",
3
+ "version": "0.1.18",
4
4
  "description": "Generate an internal service map page or desktop app for a software project.",
5
5
  "type": "module",
6
6
  "bin": {