Browse Source

fix(install): exclude sync sentinels from summary

Alvin Unreal 1 month ago
parent
commit
e193c6cacc
2 changed files with 25 additions and 1 deletions
  1. 21 0
      src/cli/install.test.ts
  2. 4 1
      src/cli/install.ts

+ 21 - 0
src/cli/install.test.ts

@@ -220,6 +220,13 @@ describe('install skill synchronization error mapping', () => {
       msg?.includes('__lock__'),
     );
     expect(hasRawSentinel).toBe(false);
+
+    // Verify counter does not count __lock__ as a failed skill
+    const summaryMsg = calls.find((msg: string) =>
+      msg?.includes('Skill synchronization complete.'),
+    );
+    expect(summaryMsg).toBeDefined();
+    expect(summaryMsg).toContain('0 failed.');
   });
 
   test('maps __manifest__ to manifest write failure', async () => {
@@ -242,6 +249,13 @@ describe('install skill synchronization error mapping', () => {
       msg?.includes('__manifest__'),
     );
     expect(hasRawSentinel).toBe(false);
+
+    // Verify counter does not count __manifest__ as a failed skill
+    const summaryMsg = calls.find((msg: string) =>
+      msg?.includes('Skill synchronization complete.'),
+    );
+    expect(summaryMsg).toBeDefined();
+    expect(summaryMsg).toContain('0 failed.');
   });
 
   test('keeps normal skill names prefix as Failed: <name>', async () => {
@@ -259,5 +273,12 @@ describe('install skill synchronization error mapping', () => {
       msg?.includes('Failed: some-custom-skill'),
     );
     expect(hasSkillErr).toBe(true);
+
+    // Verify counter DOES count standard skill failures in the failed count
+    const summaryMsg = calls.find((msg: string) =>
+      msg?.includes('Skill synchronization complete.'),
+    );
+    expect(summaryMsg).toBeDefined();
+    expect(summaryMsg).toContain('1 failed.');
   });
 });

+ 4 - 1
src/cli/install.ts

@@ -445,12 +445,15 @@ async function runInstall(config: InstallConfig): Promise<number> {
           }
         }
 
+        const realFailed = result.failed.filter(
+          (skill) => skill !== '__lock__' && skill !== '__manifest__',
+        );
         const totalCustom = CUSTOM_SKILLS.length;
         printSuccess(
           `Skill synchronization complete. Processed ${totalCustom} skills: ` +
             `${result.installed.length} installed/updated, ` +
             `${result.skippedExisting.length} skipped/preserved, ` +
-            `${result.failed.length} failed.`,
+            `${realFailed.length} failed.`,
         );
       } catch (err) {
         printError(`Failed to synchronize custom skills: ${err}`);