skillrepo 3.1.0 → 3.1.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 (45) hide show
  1. package/README.md +6 -2
  2. package/package.json +1 -1
  3. package/src/commands/init-session-sync.mjs +307 -0
  4. package/src/commands/init.mjs +111 -101
  5. package/src/commands/session-sync-actions.mjs +92 -0
  6. package/src/lib/artifact-registry.mjs +43 -3
  7. package/src/lib/binary-locator.mjs +99 -0
  8. package/src/lib/cli-config.mjs +16 -3
  9. package/src/lib/cli-version.mjs +56 -0
  10. package/src/lib/config.mjs +6 -3
  11. package/src/lib/file-write.mjs +8 -3
  12. package/src/lib/fs-utils.mjs +9 -10
  13. package/src/lib/global-install.mjs +387 -0
  14. package/src/lib/mcp-merge.mjs +16 -5
  15. package/src/lib/mergers/session-hook.mjs +125 -33
  16. package/src/lib/platform.mjs +124 -0
  17. package/src/lib/sync.mjs +26 -0
  18. package/src/lib/transient-runners.mjs +204 -0
  19. package/src/test/commands/add.test.mjs +10 -4
  20. package/src/test/commands/get.test.mjs +10 -4
  21. package/src/test/commands/init.test.mjs +889 -15
  22. package/src/test/commands/list.test.mjs +10 -4
  23. package/src/test/commands/remove.test.mjs +10 -4
  24. package/src/test/commands/search.test.mjs +10 -4
  25. package/src/test/commands/session-sync-actions.test.mjs +74 -0
  26. package/src/test/commands/session-sync.test.mjs +25 -23
  27. package/src/test/commands/uninstall.test.mjs +20 -14
  28. package/src/test/commands/update.test.mjs +10 -4
  29. package/src/test/helpers/mock-spawn.mjs +121 -0
  30. package/src/test/helpers/sandbox-home.mjs +161 -0
  31. package/src/test/helpers/skillrepo-shim.mjs +133 -0
  32. package/src/test/integration/file-write.integration.test.mjs +10 -4
  33. package/src/test/lib/cli-config.test.mjs +182 -4
  34. package/src/test/lib/cli-version.test.mjs +47 -0
  35. package/src/test/lib/config.test.mjs +10 -4
  36. package/src/test/lib/file-write.test.mjs +24 -10
  37. package/src/test/lib/global-install.test.mjs +424 -0
  38. package/src/test/lib/mcp-merge.test.mjs +13 -7
  39. package/src/test/lib/paths.test.mjs +10 -4
  40. package/src/test/lib/platform.test.mjs +135 -0
  41. package/src/test/lib/sync.test.mjs +20 -4
  42. package/src/test/lib/transient-runners.test.mjs +270 -0
  43. package/src/test/mergers/session-hook.test.mjs +722 -22
  44. package/src/test/mergers/uninstall-settings.test.mjs +12 -1
  45. package/src/test/mergers/uninstall-windsurf-mcp.test.mjs +10 -4
@@ -270,9 +270,20 @@ describe("removeSettingsSessionHook", () => {
270
270
  // refactor ever moves the fingerprint elsewhere or drops it,
271
271
  // this import breaks loudly and the architect tightening #3
272
272
  // (bidirectional registry/merger mapping) fails at import time.
273
+ //
274
+ // The fingerprint is deliberately platform-neutral — before
275
+ // v3.1.1 it contained `skillrepo`, but Windows `.cmd` shim
276
+ // paths broke the substring match. The current value is
277
+ // `update --session-hook` which appears in BOTH POSIX and
278
+ // Windows hook command shapes.
273
279
  assert.equal(typeof SESSION_HOOK_FINGERPRINT, "string");
274
280
  assert.ok(SESSION_HOOK_FINGERPRINT.length > 0);
275
- assert.match(SESSION_HOOK_FINGERPRINT, /skillrepo/);
281
+ assert.match(
282
+ SESSION_HOOK_FINGERPRINT,
283
+ /--session-hook/,
284
+ "fingerprint must contain the --session-hook flag — that's what makes " +
285
+ "it specific to SkillRepo's installed hook and not a random user hook",
286
+ );
276
287
  });
277
288
 
278
289
  it("returns a structured error on unparseable JSON", () => {
@@ -23,15 +23,21 @@ import { join } from "node:path";
23
23
  import { tmpdir } from "node:os";
24
24
 
25
25
  import { removeWindsurfMcp } from "../../lib/removers/windsurf-mcp.mjs";
26
+ import {
27
+ captureHome,
28
+ setSandboxHome,
29
+ restoreHome,
30
+ } from "../helpers/sandbox-home.mjs";
26
31
 
27
32
  let sandbox;
28
- let originalHome;
33
+ /** @type {import("../helpers/sandbox-home.mjs").HomeEnvSnapshot} */
34
+ let originalHomeEnv;
29
35
  let mcpConfigPath;
30
36
 
31
37
  function setup() {
32
38
  sandbox = mkdtempSync(join(tmpdir(), "cli-unrm-windsurf-"));
33
- originalHome = process.env.HOME;
34
- process.env.HOME = sandbox;
39
+ originalHomeEnv = captureHome();
40
+ setSandboxHome(sandbox);
35
41
  // Sanity guard: asserting the override worked BEFORE any remover
36
42
  // runs is cheap insurance against forgetting to restore HOME in a
37
43
  // previous test's teardown or a parallel test cross-contamination.
@@ -44,7 +50,7 @@ function setup() {
44
50
  }
45
51
 
46
52
  function teardown() {
47
- process.env.HOME = originalHome;
53
+ restoreHome(originalHomeEnv);
48
54
  if (sandbox) rmSync(sandbox, { recursive: true, force: true });
49
55
  }
50
56