servicemap 0.1.18 → 0.1.21
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/bin/servicemap.mjs +20 -11
- package/package.json +1 -1
package/bin/servicemap.mjs
CHANGED
|
@@ -298,6 +298,8 @@ const additionalAgentWindowSize = 8;
|
|
|
298
298
|
const dim = (value) => `\x1b[2m${value}\x1b[22m`;
|
|
299
299
|
const green = (value) => `\x1b[32m${value}\x1b[39m`;
|
|
300
300
|
const cyan = (value) => `\x1b[36m${value}\x1b[39m`;
|
|
301
|
+
const gold = (value) => `\x1b[33m${value}\x1b[39m`;
|
|
302
|
+
let stableSourceStatus = '';
|
|
301
303
|
|
|
302
304
|
function timelineStep(text) {
|
|
303
305
|
console.log(`${green('◇')} ${text}`);
|
|
@@ -318,10 +320,13 @@ function renderSurvey(selected, cursor) {
|
|
|
318
320
|
timelineStep(cyan('servicemap'));
|
|
319
321
|
timelineStep(`Source: ${repositoryUrl}`);
|
|
320
322
|
timelineStep(`Stable source: ${stableSourceRoot()}`);
|
|
323
|
+
if (stableSourceStatus) {
|
|
324
|
+
timelineStep(stableSourceStatus);
|
|
325
|
+
}
|
|
321
326
|
timelineActive('Which agents do you want to install Servicemap to?');
|
|
322
327
|
timelineLine('Universal (.agents/skills) — always included');
|
|
323
328
|
for (const agent of universalAgents.slice(0, visibleUniversalLimit)) {
|
|
324
|
-
timelineLine(
|
|
329
|
+
timelineLine(`${green('•')} ${agent}`);
|
|
325
330
|
}
|
|
326
331
|
const hiddenUniversalCount = universalAgents.length - visibleUniversalLimit;
|
|
327
332
|
if (hiddenUniversalCount > 0) {
|
|
@@ -431,7 +436,7 @@ async function withSpinner(message, action, minimumMs = 1400) {
|
|
|
431
436
|
let dots = '';
|
|
432
437
|
const startedAt = Date.now();
|
|
433
438
|
const nextText = () => {
|
|
434
|
-
const text = `${dim('│')} ${frames[frame]} ${message}${dots}`;
|
|
439
|
+
const text = `${dim('│')} ${gold(frames[frame])} ${message}${dots}`;
|
|
435
440
|
frame = (frame + 1) % frames.length;
|
|
436
441
|
if (frame === 0) dots = dots.length >= 5 ? '' : `${dots}.`;
|
|
437
442
|
return text;
|
|
@@ -477,15 +482,18 @@ async function prepareStableSource(options) {
|
|
|
477
482
|
try {
|
|
478
483
|
if (existsSync(join(sourceRoot, '.git'))) {
|
|
479
484
|
await withSpinner('Updating repository…', () => runSilent('git', ['pull', '--ff-only'], { cwd: sourceRoot }));
|
|
485
|
+
stableSourceStatus = 'Repository updated';
|
|
480
486
|
timelineStep('Repository updated');
|
|
481
487
|
} else {
|
|
482
488
|
await rm(sourceRoot, { recursive: true, force: true });
|
|
483
489
|
await withSpinner('Cloning repository…', () => runSilent('git', ['clone', '--depth', '1', repositoryUrl, sourceRoot]));
|
|
490
|
+
stableSourceStatus = 'Repository cloned';
|
|
484
491
|
timelineStep('Repository cloned');
|
|
485
492
|
}
|
|
486
493
|
} catch (_error) {
|
|
487
494
|
await rm(sourceRoot, { recursive: true, force: true });
|
|
488
495
|
await cp(packageRoot, sourceRoot, { recursive: true });
|
|
496
|
+
stableSourceStatus = 'Repository unavailable; copied packaged source';
|
|
489
497
|
timelineStep('Repository unavailable; copied packaged source');
|
|
490
498
|
}
|
|
491
499
|
|
|
@@ -515,21 +523,12 @@ async function installIntoRoot(root, source, method, options) {
|
|
|
515
523
|
|
|
516
524
|
async function installSkill(options) {
|
|
517
525
|
let source = resolve(packageRoot, 'servicemap');
|
|
518
|
-
const selectedTargets = options.survey && !options.yes
|
|
519
|
-
? [{ id: 'universal', label: 'Universal', root: universalRoot }, ...await runTargetSurvey()]
|
|
520
|
-
: targetsForOptions(options);
|
|
521
|
-
const roots = skillRootsForTargets(options, selectedTargets);
|
|
522
526
|
const method = options.installMethod ?? 'symlink';
|
|
523
527
|
|
|
524
528
|
if (!existsSync(source)) {
|
|
525
529
|
throw new Error(`Bundled skill folder not found: ${source}`);
|
|
526
530
|
}
|
|
527
531
|
|
|
528
|
-
if (roots.length === 0) {
|
|
529
|
-
console.log('No targets selected. Nothing was installed.');
|
|
530
|
-
return;
|
|
531
|
-
}
|
|
532
|
-
|
|
533
532
|
if (!['copy', 'symlink'].includes(method)) {
|
|
534
533
|
throw new Error(`Unknown install method "${method}". Use copy or symlink.`);
|
|
535
534
|
}
|
|
@@ -541,6 +540,16 @@ async function installSkill(options) {
|
|
|
541
540
|
}
|
|
542
541
|
}
|
|
543
542
|
|
|
543
|
+
const selectedTargets = options.survey && !options.yes
|
|
544
|
+
? [{ id: 'universal', label: 'Universal', root: universalRoot }, ...await runTargetSurvey()]
|
|
545
|
+
: targetsForOptions(options);
|
|
546
|
+
const roots = skillRootsForTargets(options, selectedTargets);
|
|
547
|
+
|
|
548
|
+
if (roots.length === 0) {
|
|
549
|
+
console.log('No targets selected. Nothing was installed.');
|
|
550
|
+
return;
|
|
551
|
+
}
|
|
552
|
+
|
|
544
553
|
for (const root of roots) {
|
|
545
554
|
await installIntoRoot(root, source, method, options);
|
|
546
555
|
}
|