servicemap 0.1.10 → 0.1.12

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 +36 -4
  2. package/package.json +1 -1
@@ -289,21 +289,53 @@ function skillRootsForTargets(options, targets) {
289
289
  return [...new Set(targets.map((target) => target.root()))];
290
290
  }
291
291
 
292
+ const visibleUniversalLimit = 12;
293
+ const additionalAgentWindowSize = 8;
294
+
292
295
  function renderSurvey(selected, cursor) {
293
296
  console.clear();
294
297
  console.log('Which agents do you want to install Servicemap to?\n');
295
298
  console.log('— Universal (.agents/skills) — always included —');
296
- for (const agent of universalAgents) {
299
+ for (const agent of universalAgents.slice(0, visibleUniversalLimit)) {
297
300
  console.log(` • ${agent}`);
298
301
  }
302
+ const hiddenUniversalCount = universalAgents.length - visibleUniversalLimit;
303
+ if (hiddenUniversalCount > 0) {
304
+ console.log(` ...and ${hiddenUniversalCount} more`);
305
+ }
299
306
  console.log('\n— Additional agents —');
300
307
  console.log('Use ↑/↓, Space to select, Enter to install.\n');
301
308
 
302
- targetCatalog.forEach((target, index) => {
309
+ const halfWindow = Math.floor(additionalAgentWindowSize / 2);
310
+ let start = Math.max(0, cursor - halfWindow);
311
+ start = Math.min(start, Math.max(0, targetCatalog.length - additionalAgentWindowSize));
312
+ const end = Math.min(targetCatalog.length, start + additionalAgentWindowSize);
313
+ const beforeCount = start;
314
+ const afterCount = targetCatalog.length - end;
315
+
316
+ if (beforeCount > 0) {
317
+ console.log(` ↑ ${beforeCount} more`);
318
+ }
319
+
320
+ targetCatalog.slice(start, end).forEach((target, offset) => {
321
+ const index = start + offset;
303
322
  const pointer = index === cursor ? '>' : ' ';
304
323
  const checked = selected.has(target.id) ? 'x' : ' ';
305
324
  console.log(`${pointer} [${checked}] ${target.label}`);
306
325
  });
326
+
327
+ if (afterCount > 0) {
328
+ console.log(` ↓ ${afterCount} more`);
329
+ }
330
+
331
+ if (selected.size > 0) {
332
+ const selectedLabels = targetCatalog
333
+ .filter((target) => selected.has(target.id))
334
+ .map((target) => target.label);
335
+ const preview = selectedLabels.slice(0, 3).join(', ');
336
+ const remainder = selectedLabels.length > 3 ? ` +${selectedLabels.length - 3} more` : '';
337
+ console.log(`\nSelected: ${preview}${remainder}`);
338
+ }
307
339
  }
308
340
 
309
341
  function runTargetSurvey() {
@@ -320,8 +352,8 @@ function runTargetSurvey() {
320
352
  renderSurvey(selected, cursor);
321
353
 
322
354
  const onKeypress = (_str, key) => {
323
- if (key.name === 'up') cursor = (cursor - 1 + targetCatalog.length) % targetCatalog.length;
324
- if (key.name === 'down') cursor = (cursor + 1) % targetCatalog.length;
355
+ if (key.name === 'up') cursor = Math.max(0, cursor - 1);
356
+ if (key.name === 'down') cursor = Math.min(targetCatalog.length - 1, cursor + 1);
325
357
  if (key.name === 'space') {
326
358
  const id = targetCatalog[cursor].id;
327
359
  if (selected.has(id)) selected.delete(id);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "servicemap",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
4
4
  "description": "Generate an internal service map page or desktop app for a software project.",
5
5
  "type": "module",
6
6
  "bin": {