@skillsmith/core 0.12.1 → 0.12.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 (280) hide show
  1. package/CHANGELOG.md +155 -0
  2. package/README.md +2 -2
  3. package/dist/.tsbuildinfo +1 -1
  4. package/dist/src/api/client.d.ts +5 -3
  5. package/dist/src/api/client.d.ts.map +1 -1
  6. package/dist/src/api/client.js +23 -33
  7. package/dist/src/api/client.js.map +1 -1
  8. package/dist/src/api/client.registry-sync.d.ts +28 -0
  9. package/dist/src/api/client.registry-sync.d.ts.map +1 -0
  10. package/dist/src/api/client.registry-sync.js +36 -0
  11. package/dist/src/api/client.registry-sync.js.map +1 -0
  12. package/dist/src/api/client.test.js +185 -0
  13. package/dist/src/api/client.test.js.map +1 -1
  14. package/dist/src/api/client.toSkill.d.ts +16 -0
  15. package/dist/src/api/client.toSkill.d.ts.map +1 -0
  16. package/dist/src/api/client.toSkill.js +46 -0
  17. package/dist/src/api/client.toSkill.js.map +1 -0
  18. package/dist/src/api/client.types.d.ts +22 -0
  19. package/dist/src/api/client.types.d.ts.map +1 -1
  20. package/dist/src/api/index.d.ts +1 -1
  21. package/dist/src/api/index.d.ts.map +1 -1
  22. package/dist/src/api/index.js.map +1 -1
  23. package/dist/src/api/schemas.d.ts +28 -0
  24. package/dist/src/api/schemas.d.ts.map +1 -1
  25. package/dist/src/api/schemas.js +13 -0
  26. package/dist/src/api/schemas.js.map +1 -1
  27. package/dist/src/audit/remote-audit.d.ts +85 -0
  28. package/dist/src/audit/remote-audit.d.ts.map +1 -1
  29. package/dist/src/audit/remote-audit.js +126 -3
  30. package/dist/src/audit/remote-audit.js.map +1 -1
  31. package/dist/src/audit/remote-audit.test.js +217 -1
  32. package/dist/src/audit/remote-audit.test.js.map +1 -1
  33. package/dist/src/config/index.d.ts +1 -0
  34. package/dist/src/config/index.d.ts.map +1 -1
  35. package/dist/src/config/index.js.map +1 -1
  36. package/dist/src/db/migration-runner.d.ts.map +1 -1
  37. package/dist/src/db/migration-runner.js +6 -0
  38. package/dist/src/db/migration-runner.js.map +1 -1
  39. package/dist/src/db/migrations/v18-skill-versions-real-content-hash.d.ts +36 -0
  40. package/dist/src/db/migrations/v18-skill-versions-real-content-hash.d.ts.map +1 -0
  41. package/dist/src/db/migrations/v18-skill-versions-real-content-hash.js +38 -0
  42. package/dist/src/db/migrations/v18-skill-versions-real-content-hash.js.map +1 -0
  43. package/dist/src/db/schema.d.ts +1 -1
  44. package/dist/src/db/schema.d.ts.map +1 -1
  45. package/dist/src/db/schema.js +3 -1
  46. package/dist/src/db/schema.js.map +1 -1
  47. package/dist/src/exports/services.d.ts +3 -7
  48. package/dist/src/exports/services.d.ts.map +1 -1
  49. package/dist/src/exports/services.install.d.ts +18 -0
  50. package/dist/src/exports/services.install.d.ts.map +1 -0
  51. package/dist/src/exports/services.install.js +62 -0
  52. package/dist/src/exports/services.install.js.map +1 -0
  53. package/dist/src/exports/services.js +12 -32
  54. package/dist/src/exports/services.js.map +1 -1
  55. package/dist/src/exports/types.d.ts +1 -1
  56. package/dist/src/exports/types.d.ts.map +1 -1
  57. package/dist/src/index.d.ts +5 -5
  58. package/dist/src/index.d.ts.map +1 -1
  59. package/dist/src/index.js +7 -4
  60. package/dist/src/index.js.map +1 -1
  61. package/dist/src/install/agent-config-merge.json.d.ts +5 -4
  62. package/dist/src/install/agent-config-merge.json.d.ts.map +1 -1
  63. package/dist/src/install/agent-config-merge.json.js +10 -9
  64. package/dist/src/install/agent-config-merge.json.js.map +1 -1
  65. package/dist/src/install/agent-config-merge.types.d.ts +11 -1
  66. package/dist/src/install/agent-config-merge.types.d.ts.map +1 -1
  67. package/dist/src/install/agent-config-merge.types.js.map +1 -1
  68. package/dist/src/install/agent-harness-targets.d.ts +30 -2
  69. package/dist/src/install/agent-harness-targets.d.ts.map +1 -1
  70. package/dist/src/install/agent-harness-targets.js +17 -0
  71. package/dist/src/install/agent-harness-targets.js.map +1 -1
  72. package/dist/src/install/agent-manifest-path-guard.d.ts +28 -3
  73. package/dist/src/install/agent-manifest-path-guard.d.ts.map +1 -1
  74. package/dist/src/install/agent-manifest-path-guard.js +59 -3
  75. package/dist/src/install/agent-manifest-path-guard.js.map +1 -1
  76. package/dist/src/install/agent-manifest-path-guard.test.js +27 -1
  77. package/dist/src/install/agent-manifest-path-guard.test.js.map +1 -1
  78. package/dist/src/install/agent-pack-installer.antigravity-mcp.d.ts +74 -0
  79. package/dist/src/install/agent-pack-installer.antigravity-mcp.d.ts.map +1 -0
  80. package/dist/src/install/agent-pack-installer.antigravity-mcp.js +106 -0
  81. package/dist/src/install/agent-pack-installer.antigravity-mcp.js.map +1 -0
  82. package/dist/src/install/agent-pack-installer.antigravity-mcp.test.d.ts +2 -0
  83. package/dist/src/install/agent-pack-installer.antigravity-mcp.test.d.ts.map +1 -0
  84. package/dist/src/install/agent-pack-installer.antigravity-mcp.test.js +157 -0
  85. package/dist/src/install/agent-pack-installer.antigravity-mcp.test.js.map +1 -0
  86. package/dist/src/install/agent-pack-installer.cursor-mcp.d.ts +53 -0
  87. package/dist/src/install/agent-pack-installer.cursor-mcp.d.ts.map +1 -0
  88. package/dist/src/install/agent-pack-installer.cursor-mcp.js +207 -0
  89. package/dist/src/install/agent-pack-installer.cursor-mcp.js.map +1 -0
  90. package/dist/src/install/agent-pack-installer.cursor-mcp.test.d.ts +2 -0
  91. package/dist/src/install/agent-pack-installer.cursor-mcp.test.d.ts.map +1 -0
  92. package/dist/src/install/agent-pack-installer.cursor-mcp.test.js +285 -0
  93. package/dist/src/install/agent-pack-installer.cursor-mcp.test.js.map +1 -0
  94. package/dist/src/install/agent-pack-installer.d.ts +8 -0
  95. package/dist/src/install/agent-pack-installer.d.ts.map +1 -1
  96. package/dist/src/install/agent-pack-installer.entry.d.ts +120 -3
  97. package/dist/src/install/agent-pack-installer.entry.d.ts.map +1 -1
  98. package/dist/src/install/agent-pack-installer.entry.js +166 -3
  99. package/dist/src/install/agent-pack-installer.entry.js.map +1 -1
  100. package/dist/src/install/agent-pack-installer.js +97 -3
  101. package/dist/src/install/agent-pack-installer.js.map +1 -1
  102. package/dist/src/install/agent-pack-installer.types.d.ts +27 -0
  103. package/dist/src/install/agent-pack-installer.types.d.ts.map +1 -1
  104. package/dist/src/install/agent-pack-installer.types.js +6 -0
  105. package/dist/src/install/agent-pack-installer.types.js.map +1 -1
  106. package/dist/src/install/agent-pack-installer.workspace-scope.test.d.ts +2 -0
  107. package/dist/src/install/agent-pack-installer.workspace-scope.test.d.ts.map +1 -0
  108. package/dist/src/install/agent-pack-installer.workspace-scope.test.js +148 -0
  109. package/dist/src/install/agent-pack-installer.workspace-scope.test.js.map +1 -0
  110. package/dist/src/install/agent-pack-uninstaller.d.ts +18 -7
  111. package/dist/src/install/agent-pack-uninstaller.d.ts.map +1 -1
  112. package/dist/src/install/agent-pack-uninstaller.js +59 -9
  113. package/dist/src/install/agent-pack-uninstaller.js.map +1 -1
  114. package/dist/src/install/agent-pack-uninstaller.test.js +74 -1
  115. package/dist/src/install/agent-pack-uninstaller.test.js.map +1 -1
  116. package/dist/src/install/fan-out.d.ts.map +1 -1
  117. package/dist/src/install/fan-out.js +6 -0
  118. package/dist/src/install/fan-out.js.map +1 -1
  119. package/dist/src/install/index.d.ts +2 -0
  120. package/dist/src/install/index.d.ts.map +1 -1
  121. package/dist/src/install/index.js +2 -0
  122. package/dist/src/install/index.js.map +1 -1
  123. package/dist/src/install/workspace-scope.d.ts +207 -0
  124. package/dist/src/install/workspace-scope.d.ts.map +1 -0
  125. package/dist/src/install/workspace-scope.js +275 -0
  126. package/dist/src/install/workspace-scope.js.map +1 -0
  127. package/dist/src/install/workspace-scope.test.d.ts +2 -0
  128. package/dist/src/install/workspace-scope.test.d.ts.map +1 -0
  129. package/dist/src/install/workspace-scope.test.js +378 -0
  130. package/dist/src/install/workspace-scope.test.js.map +1 -0
  131. package/dist/src/security/__tests__/pathValidation.test.js +30 -1
  132. package/dist/src/security/__tests__/pathValidation.test.js.map +1 -1
  133. package/dist/src/services/SubagentGenerator.client-profiles.d.ts +258 -0
  134. package/dist/src/services/SubagentGenerator.client-profiles.d.ts.map +1 -0
  135. package/dist/src/services/SubagentGenerator.client-profiles.js +260 -0
  136. package/dist/src/services/SubagentGenerator.client-profiles.js.map +1 -0
  137. package/dist/src/services/SubagentGenerator.d.ts +19 -41
  138. package/dist/src/services/SubagentGenerator.d.ts.map +1 -1
  139. package/dist/src/services/SubagentGenerator.helpers.d.ts +64 -0
  140. package/dist/src/services/SubagentGenerator.helpers.d.ts.map +1 -0
  141. package/dist/src/services/SubagentGenerator.helpers.js +228 -0
  142. package/dist/src/services/SubagentGenerator.helpers.js.map +1 -0
  143. package/dist/src/services/SubagentGenerator.js +66 -208
  144. package/dist/src/services/SubagentGenerator.js.map +1 -1
  145. package/dist/src/services/SubagentGenerator.types.d.ts +45 -0
  146. package/dist/src/services/SubagentGenerator.types.d.ts.map +1 -0
  147. package/dist/src/services/SubagentGenerator.types.js +14 -0
  148. package/dist/src/services/SubagentGenerator.types.js.map +1 -0
  149. package/dist/src/services/TransformationService.d.ts +18 -61
  150. package/dist/src/services/TransformationService.d.ts.map +1 -1
  151. package/dist/src/services/TransformationService.js +29 -17
  152. package/dist/src/services/TransformationService.js.map +1 -1
  153. package/dist/src/services/TransformationService.types.d.ts +74 -0
  154. package/dist/src/services/TransformationService.types.d.ts.map +1 -0
  155. package/dist/src/services/TransformationService.types.js +8 -0
  156. package/dist/src/services/TransformationService.types.js.map +1 -0
  157. package/dist/src/services/__tests__/SubagentGenerator.client-profiles.test.d.ts +5 -0
  158. package/dist/src/services/__tests__/SubagentGenerator.client-profiles.test.d.ts.map +1 -0
  159. package/dist/src/services/__tests__/SubagentGenerator.client-profiles.test.js +72 -0
  160. package/dist/src/services/__tests__/SubagentGenerator.client-profiles.test.js.map +1 -0
  161. package/dist/src/services/__tests__/SubagentGenerator.helpers.test.d.ts +2 -0
  162. package/dist/src/services/__tests__/SubagentGenerator.helpers.test.d.ts.map +1 -0
  163. package/dist/src/services/__tests__/SubagentGenerator.helpers.test.js +61 -0
  164. package/dist/src/services/__tests__/SubagentGenerator.helpers.test.js.map +1 -0
  165. package/dist/src/services/__tests__/SubagentGenerator.test.js +155 -0
  166. package/dist/src/services/__tests__/SubagentGenerator.test.js.map +1 -1
  167. package/dist/src/services/__tests__/TransformationService.test.js +48 -0
  168. package/dist/src/services/__tests__/TransformationService.test.js.map +1 -1
  169. package/dist/src/services/agent-pack/agent-pack.test.js +1 -0
  170. package/dist/src/services/agent-pack/agent-pack.test.js.map +1 -1
  171. package/dist/src/services/agent-pack/prompt-source.d.ts +1 -1
  172. package/dist/src/services/agent-pack/prompt-source.d.ts.map +1 -1
  173. package/dist/src/services/agent-pack/prompt-source.js +10 -3
  174. package/dist/src/services/agent-pack/prompt-source.js.map +1 -1
  175. package/dist/src/services/agent-pack/types.d.ts +26 -2
  176. package/dist/src/services/agent-pack/types.d.ts.map +1 -1
  177. package/dist/src/services/agent-pack/types.js +13 -0
  178. package/dist/src/services/agent-pack/types.js.map +1 -1
  179. package/dist/src/services/agent-tool-profile.d.ts.map +1 -1
  180. package/dist/src/services/agent-tool-profile.js +7 -0
  181. package/dist/src/services/agent-tool-profile.js.map +1 -1
  182. package/dist/src/services/agent-tool-profile.test.js +2 -2
  183. package/dist/src/services/skill-content-comparison.d.ts +71 -0
  184. package/dist/src/services/skill-content-comparison.d.ts.map +1 -0
  185. package/dist/src/services/skill-content-comparison.js +90 -0
  186. package/dist/src/services/skill-content-comparison.js.map +1 -0
  187. package/dist/src/services/skill-content-comparison.test.d.ts +6 -0
  188. package/dist/src/services/skill-content-comparison.test.d.ts.map +1 -0
  189. package/dist/src/services/skill-content-comparison.test.js +83 -0
  190. package/dist/src/services/skill-content-comparison.test.js.map +1 -0
  191. package/dist/src/services/skill-identity-classification.d.ts +202 -0
  192. package/dist/src/services/skill-identity-classification.d.ts.map +1 -0
  193. package/dist/src/services/skill-identity-classification.js +295 -0
  194. package/dist/src/services/skill-identity-classification.js.map +1 -0
  195. package/dist/src/services/skill-identity-classification.test.d.ts +6 -0
  196. package/dist/src/services/skill-identity-classification.test.d.ts.map +1 -0
  197. package/dist/src/services/skill-identity-classification.test.js +314 -0
  198. package/dist/src/services/skill-identity-classification.test.js.map +1 -0
  199. package/dist/src/services/skill-installation.content.d.ts.map +1 -1
  200. package/dist/src/services/skill-installation.content.js +6 -1
  201. package/dist/src/services/skill-installation.content.js.map +1 -1
  202. package/dist/src/services/skill-installation.helpers.d.ts +8 -15
  203. package/dist/src/services/skill-installation.helpers.d.ts.map +1 -1
  204. package/dist/src/services/skill-installation.helpers.js +11 -105
  205. package/dist/src/services/skill-installation.helpers.js.map +1 -1
  206. package/dist/src/services/skill-installation.helpers.test.js +106 -1
  207. package/dist/src/services/skill-installation.helpers.test.js.map +1 -1
  208. package/dist/src/services/skill-installation.service.js +1 -1
  209. package/dist/src/services/skill-installation.service.js.map +1 -1
  210. package/dist/src/services/skill-installation.types.d.ts +33 -0
  211. package/dist/src/services/skill-installation.types.d.ts.map +1 -1
  212. package/dist/src/services/skill-installation.types.js.map +1 -1
  213. package/dist/src/services/skill-installation.uninstall.d.ts +84 -0
  214. package/dist/src/services/skill-installation.uninstall.d.ts.map +1 -0
  215. package/dist/src/services/skill-installation.uninstall.js +252 -0
  216. package/dist/src/services/skill-installation.uninstall.js.map +1 -0
  217. package/dist/src/services/skill-manifest.d.ts +41 -0
  218. package/dist/src/services/skill-manifest.d.ts.map +1 -1
  219. package/dist/src/services/skill-manifest.js +93 -0
  220. package/dist/src/services/skill-manifest.js.map +1 -1
  221. package/dist/src/services/skill-manifest.test.js +27 -0
  222. package/dist/src/services/skill-manifest.test.js.map +1 -1
  223. package/dist/src/sync/SyncEngine.d.ts.map +1 -1
  224. package/dist/src/sync/SyncEngine.js +69 -77
  225. package/dist/src/sync/SyncEngine.js.map +1 -1
  226. package/dist/src/telemetry/agent-marker.d.ts +8 -0
  227. package/dist/src/telemetry/agent-marker.d.ts.map +1 -1
  228. package/dist/src/telemetry/agent-marker.js +7 -0
  229. package/dist/src/telemetry/agent-marker.js.map +1 -1
  230. package/dist/src/telemetry/agent-marker.test.js +7 -1
  231. package/dist/src/telemetry/agent-marker.test.js.map +1 -1
  232. package/dist/src/telemetry/index.d.ts +1 -1
  233. package/dist/src/telemetry/index.d.ts.map +1 -1
  234. package/dist/src/telemetry/index.js +1 -1
  235. package/dist/src/telemetry/index.js.map +1 -1
  236. package/dist/src/telemetry/wrap.d.ts +6 -0
  237. package/dist/src/telemetry/wrap.d.ts.map +1 -1
  238. package/dist/src/telemetry/wrap.js +65 -10
  239. package/dist/src/telemetry/wrap.js.map +1 -1
  240. package/dist/src/telemetry/wrap.test.js +81 -1
  241. package/dist/src/telemetry/wrap.test.js.map +1 -1
  242. package/dist/src/telemetry/wrap.tool-call-sink.test.d.ts +26 -0
  243. package/dist/src/telemetry/wrap.tool-call-sink.test.d.ts.map +1 -0
  244. package/dist/src/telemetry/wrap.tool-call-sink.test.js +162 -0
  245. package/dist/src/telemetry/wrap.tool-call-sink.test.js.map +1 -0
  246. package/dist/src/types/skill.d.ts +9 -1
  247. package/dist/src/types/skill.d.ts.map +1 -1
  248. package/dist/src/utils/index.d.ts +1 -1
  249. package/dist/src/utils/index.d.ts.map +1 -1
  250. package/dist/src/utils/index.js +1 -1
  251. package/dist/src/utils/index.js.map +1 -1
  252. package/dist/src/utils/version-check.d.ts +61 -0
  253. package/dist/src/utils/version-check.d.ts.map +1 -1
  254. package/dist/src/utils/version-check.js +78 -1
  255. package/dist/src/utils/version-check.js.map +1 -1
  256. package/dist/src/utils/version-check.test.js +130 -1
  257. package/dist/src/utils/version-check.test.js.map +1 -1
  258. package/dist/tests/db/migration-runner-race.test.js +19 -9
  259. package/dist/tests/db/migration-runner-race.test.js.map +1 -1
  260. package/dist/tests/install/fan-out.test.js +27 -0
  261. package/dist/tests/install/fan-out.test.js.map +1 -1
  262. package/dist/tests/sync/SyncEngine.abort.test.js +15 -11
  263. package/dist/tests/sync/SyncEngine.abort.test.js.map +1 -1
  264. package/dist/tests/sync/SyncEngine.status.test.js +1 -1
  265. package/dist/tests/sync/SyncEngine.status.test.js.map +1 -1
  266. package/dist/tests/sync/SyncEngine.test.d.ts +11 -2
  267. package/dist/tests/sync/SyncEngine.test.d.ts.map +1 -1
  268. package/dist/tests/sync/SyncEngine.test.js +164 -13
  269. package/dist/tests/sync/SyncEngine.test.js.map +1 -1
  270. package/dist/tests/unit/migrations/migration-v18.test.d.ts +16 -0
  271. package/dist/tests/unit/migrations/migration-v18.test.d.ts.map +1 -0
  272. package/dist/tests/unit/migrations/migration-v18.test.js +192 -0
  273. package/dist/tests/unit/migrations/migration-v18.test.js.map +1 -0
  274. package/dist/tests/unit/services/skill-installation.content.test.js +65 -1
  275. package/dist/tests/unit/services/skill-installation.content.test.js.map +1 -1
  276. package/dist/tests/unit/services/skill-installation.service.test.js +9 -8
  277. package/dist/tests/unit/services/skill-installation.service.test.js.map +1 -1
  278. package/dist/tests/unit/sync-engine.source-aware.test.js +5 -5
  279. package/dist/tests/unit/sync-engine.source-aware.test.js.map +1 -1
  280. package/package.json +2 -2
@@ -0,0 +1,295 @@
1
+ /**
2
+ * @fileoverview Shared skill-identity contradiction-signal classification
3
+ * @module @skillsmith/core/services/skill-identity-classification
4
+ * @see SMI-6343 Wave 3 — tamper-check classification (AC#3)
5
+ *
6
+ * Three deterministic-or-best-effort "does this manifest entry's recorded
7
+ * identity contradict what's actually installed" signals, plus a
8
+ * "has this on-disk content been locally edited since install" check —
9
+ * consumed by BOTH `packages/mcp-server/src/tools/outdated.ts` (via
10
+ * `outdated.identity.ts`) and `packages/cli/src/commands/manage.update.ts`,
11
+ * so the two packages cannot drift into two independently-maintained
12
+ * implementations of the same contradiction logic (exactly the "sibling
13
+ * implementation" bug class both Wave 1 and Wave 2 of SMI-6343 already hit).
14
+ *
15
+ * Deliberately decoupled from either caller's own `RegistrySkillInfo` shape
16
+ * (mcp-server's `install.types.ts` and core's own `skill-installation.types.ts`
17
+ * both have independently-evolved versions) — callers adapt their own
18
+ * registry-lookup result into the minimal {@link RegistryLookupOutcome} shape
19
+ * this module needs.
20
+ *
21
+ * Every function here is synchronous and filesystem-free by design: signal 3
22
+ * (path containment) is a pure string check against an already-resolved
23
+ * expected root directory, not a `fs.realpath` call — the callers of this
24
+ * module (`outdated.ts`, `manage.update.ts`) only ever reach the "outdated"
25
+ * classification branch after already having successfully read the
26
+ * installed skill's SKILL.md this same iteration, so "does installPath
27
+ * exist" is already established by the time these signals run.
28
+ */
29
+ import { relative, isAbsolute, sep } from 'node:path';
30
+ import { SkillParser } from '../indexer/SkillParser.js';
31
+ import { firstNonBlankHash } from './skill-content-comparison.js';
32
+ // ============================================================================
33
+ // Signal 1 — owner mismatch
34
+ // ============================================================================
35
+ /**
36
+ * Parse a clean `owner/name` pair (exactly one slash, no URL scheme) into
37
+ * its owner segment. Returns `null` for anything that isn't that exact
38
+ * shape — critically, a raw URL (`https://github.com/owner/repo`, a
39
+ * direct-URL install's `id`/`source`) is NOT an `owner/name` pair and must
40
+ * return `null` here rather than a garbage "owner" parsed from before the
41
+ * URL's first slash (e.g. `'https:'`). Mirrors the same 2-segment
42
+ * distinction `install.helpers.ts`'s `parseSkillId()` already draws between
43
+ * a registry id and a direct GitHub reference.
44
+ */
45
+ function parseOwnerFromOwnerNamePair(value) {
46
+ if (value.includes('://'))
47
+ return null;
48
+ const parts = value.split('/');
49
+ if (parts.length !== 2)
50
+ return null;
51
+ const [owner, name] = parts;
52
+ return owner.length > 0 && name.length > 0 ? owner : null;
53
+ }
54
+ /**
55
+ * Parse the owner segment out of a manifest `source` string. Real installs
56
+ * write `source` as `'github:' + owner + '/' + repo` (`skill-installation.
57
+ * service.ts`) — the `'github:'` prefix is optional here so a bare
58
+ * `owner/repo` (or a future non-GitHub source shape) still parses. Returns
59
+ * `null` for the `'unknown'` distrust sentinel, a raw URL, or anything else
60
+ * with no parseable `owner/name` shape.
61
+ */
62
+ export function parseOwnerFromSource(source) {
63
+ if (!source || source === 'unknown')
64
+ return null;
65
+ const withoutPrefix = source.startsWith('github:') ? source.slice('github:'.length) : source;
66
+ return parseOwnerFromOwnerNamePair(withoutPrefix);
67
+ }
68
+ /**
69
+ * Parse the owner segment out of a manifest entry's `id`. Returns `null`
70
+ * for anything that isn't a clean `owner/name` pair — most importantly a
71
+ * raw GitHub URL, which a direct-URL install records as `id` verbatim (see
72
+ * {@link parseOwnerFromOwnerNamePair}).
73
+ */
74
+ export function parseOwnerFromId(id) {
75
+ if (!id)
76
+ return null;
77
+ return parseOwnerFromOwnerNamePair(id);
78
+ }
79
+ /**
80
+ * Signal 1: `id` parses as `owner/name` and `source` names a DIFFERENT
81
+ * owner. Deterministic, offline, zero network dependency. Catches the real
82
+ * `linear` skill corruption (`source: "github:lobehub/lobehub"` vs
83
+ * `id: "wrsmith108/linear"`).
84
+ */
85
+ export function detectOwnerMismatch(entry) {
86
+ const idOwner = parseOwnerFromId(entry.id);
87
+ const sourceOwner = parseOwnerFromSource(entry.source);
88
+ if (!idOwner || !sourceOwner)
89
+ return false;
90
+ return idOwner.toLowerCase() !== sourceOwner.toLowerCase();
91
+ }
92
+ // ============================================================================
93
+ // Signal 3 — path unresolved
94
+ // ============================================================================
95
+ /**
96
+ * Signal 3: `installPath` is absent, or resolves OUTSIDE `expectedRootDir`
97
+ * (the claimed client's native install root, or a workspace-scoped
98
+ * equivalent the caller resolves — see each caller's own scope handling).
99
+ *
100
+ * Deliberately a pure string containment check (`path.relative`), not a
101
+ * filesystem call: both callers of this module only reach this signal after
102
+ * already having successfully read the entry's SKILL.md this same
103
+ * iteration, so filesystem existence is already established. This also
104
+ * catches the exact shape of the SMI-6343 Wave 1 test-fixture leak (an
105
+ * OS-temp-dir `installPath` written into the real manifest) via simple
106
+ * string comparison, with no need to resolve symlinks.
107
+ *
108
+ * NOT a symlink-escape check (Wave 3 adversarial review, considered and
109
+ * scoped out): a real `installPath` inside `expectedRootDir` that is
110
+ * ITSELF a symlink pointing elsewhere is a local-filesystem-tampering
111
+ * threat distinct from this signal's actual purpose (catching a manifest
112
+ * entry whose *recorded* path doesn't match a legitimate install
113
+ * location — a software-bug/registry-tamper shape, not local attacker
114
+ * capability); an attacker with write access to plant such a symlink
115
+ * inside the client root already has equivalent-or-greater capability to
116
+ * edit SKILL.md content directly, making a `fs.realpath` upgrade here
117
+ * (which would also force this whole synchronous, filesystem-free module
118
+ * to become async) address a threat this signal was never meant to cover.
119
+ *
120
+ * The parent-segment check below (`rel === '..' || rel.startsWith('..' +
121
+ * sep)`) is deliberately NOT a bare `rel.startsWith('..')`: a literal
122
+ * directory name that happens to start with two dots (e.g. `..cache`) is a
123
+ * legitimate contained child — `path.relative('/r', '/r/..cache')` returns
124
+ * `'..cache'`, which a bare `startsWith('..')` would misclassify as an
125
+ * escape (Wave 3 adversarial review finding).
126
+ */
127
+ export function detectPathUnresolved(installPath, expectedRootDir) {
128
+ if (!installPath)
129
+ return true;
130
+ const rel = relative(expectedRootDir, installPath);
131
+ if (rel === '')
132
+ return false;
133
+ return rel === '..' || rel.startsWith('..' + sep) || isAbsolute(rel);
134
+ }
135
+ function normalize(value) {
136
+ if (typeof value !== 'string')
137
+ return null;
138
+ const trimmed = value.trim();
139
+ return trimmed.length > 0 ? trimmed : null;
140
+ }
141
+ /**
142
+ * Signal 2: on-disk front-matter `author`/`name` contradicts the registry's
143
+ * record for the claimed `id`. Catches the real `commit` skill corruption
144
+ * (internally-consistent id/source, but content that belongs to an
145
+ * unrelated skill) — signal 1 alone does not catch this shape.
146
+ *
147
+ * H2 (fail-closed): when the registry lookup could not complete (offline,
148
+ * network error, quota-exhausted) OR completed but found no record for the
149
+ * claimed id, this returns `inconclusive: true` — NEVER "no contradiction."
150
+ * An inconclusive signal 2 still forces the overall classification to
151
+ * `unknown`, not `local-drift`/`current` — see {@link classifyDivergentEntry}.
152
+ *
153
+ * Exception, not a weakening of H2: when `id` itself doesn't parse as a
154
+ * well-formed `owner/name` registry key (a raw GitHub URL from a direct-URL
155
+ * install, an unresolved UUID) there is structurally no registry record to
156
+ * look up in the first place — a caller cannot "fail to check" something
157
+ * that was never a registry-backed identity to begin with. This is a clean
158
+ * non-fire, not an inconclusive one, exactly mirroring how an unparseable
159
+ * on-disk front-matter is treated below.
160
+ */
161
+ function evaluateFrontmatterContradiction(entryId, localContent, registryLookup) {
162
+ if (parseOwnerFromId(entryId) === null) {
163
+ return { fired: false, inconclusive: false, inconclusiveReason: null };
164
+ }
165
+ if (!registryLookup.attempted) {
166
+ return {
167
+ fired: false,
168
+ inconclusive: true,
169
+ inconclusiveReason: registryLookup.failureReason ?? 'network-error',
170
+ };
171
+ }
172
+ if (registryLookup.failureReason) {
173
+ return { fired: false, inconclusive: true, inconclusiveReason: registryLookup.failureReason };
174
+ }
175
+ if (!registryLookup.record) {
176
+ return { fired: false, inconclusive: true, inconclusiveReason: 'no-registry-record' };
177
+ }
178
+ const parsed = localContent !== null ? new SkillParser().parse(localContent) : null;
179
+ if (!parsed) {
180
+ // Nothing to contradict with — a local parse failure is a data-quality
181
+ // fact, not a network-dependent uncertainty, so this is a clean
182
+ // non-fire, not `inconclusive` (see this module's fileoverview).
183
+ return { fired: false, inconclusive: false, inconclusiveReason: null };
184
+ }
185
+ const localAuthor = normalize(parsed.author);
186
+ const localName = normalize(parsed.name);
187
+ const registryAuthor = normalize(registryLookup.record.author);
188
+ const registryName = normalize(registryLookup.record.name);
189
+ const authorContradiction = localAuthor !== null &&
190
+ registryAuthor !== null &&
191
+ localAuthor.toLowerCase() !== registryAuthor.toLowerCase();
192
+ const nameContradiction = localName !== null &&
193
+ registryName !== null &&
194
+ localName.toLowerCase() !== registryName.toLowerCase();
195
+ return {
196
+ fired: authorContradiction || nameContradiction,
197
+ inconclusive: false,
198
+ inconclusiveReason: null,
199
+ };
200
+ }
201
+ // ============================================================================
202
+ // Combined signal classification
203
+ // ============================================================================
204
+ /**
205
+ * Run all three contradiction signals against a manifest entry. Any one
206
+ * conclusively firing means `signal` is non-null — order (1, 3, 2) checks
207
+ * the two deterministic/offline signals first, only falling to the
208
+ * network-dependent signal 2 when neither of those already answered the
209
+ * question.
210
+ */
211
+ export function classifyManifestEntryIdentity(params) {
212
+ const { entry, localContent, expectedRootDir, registryLookup } = params;
213
+ if (detectOwnerMismatch(entry)) {
214
+ return { signal: 'owner-mismatch', inconclusive: false, inconclusiveReason: null };
215
+ }
216
+ if (detectPathUnresolved(entry.installPath, expectedRootDir)) {
217
+ return { signal: 'path-unresolved', inconclusive: false, inconclusiveReason: null };
218
+ }
219
+ const signal2 = evaluateFrontmatterContradiction(entry.id, localContent, registryLookup);
220
+ if (signal2.inconclusive) {
221
+ return { signal: null, inconclusive: true, inconclusiveReason: signal2.inconclusiveReason };
222
+ }
223
+ if (signal2.fired) {
224
+ return { signal: 'frontmatter-contradiction', inconclusive: false, inconclusiveReason: null };
225
+ }
226
+ return { signal: null, inconclusive: false, inconclusiveReason: null };
227
+ }
228
+ // ============================================================================
229
+ // Local-edit detection (local-drift vs outdated)
230
+ // ============================================================================
231
+ /**
232
+ * Has the on-disk content changed since the manifest's own recorded
233
+ * install/update-time hash? This is what distinguishes a benign local edit
234
+ * (`local-drift`) from a genuine registry version bump (`outdated`) once
235
+ * no identity signal has fired.
236
+ *
237
+ * When the manifest never recorded a comparable hash at all (a legacy or
238
+ * adopted entry, `contentHash`/`originalContentHash` both absent), this
239
+ * deliberately defaults to `false` (no edit evidence) rather than `true`
240
+ * (conservative) — absence of a recorded hash is a data-quality gap, not
241
+ * positive evidence of tampering, and defaulting to `true` here would
242
+ * misclassify the large population of legacy/adopted entries that never had
243
+ * a hash recorded as `local-drift` even when they are genuinely just
244
+ * outdated (SMI-6343 Wave 3 review finding).
245
+ */
246
+ export function hasRecordedLocalEdit(entry, localHash) {
247
+ const recordedHash = firstNonBlankHash(entry.contentHash, entry.originalContentHash);
248
+ if (recordedHash === null || localHash === null)
249
+ return false;
250
+ return recordedHash !== localHash;
251
+ }
252
+ // ============================================================================
253
+ // Full divergent-entry classification
254
+ // ============================================================================
255
+ /**
256
+ * Classify an entry the caller has ALREADY determined is divergent from the
257
+ * registry (mcp-server: `compareSkillContentHashes(...).outcome ===
258
+ * 'outdated'`; CLI: `getSkillDiff()` found a version/content difference).
259
+ * Never returns `'current'` — callers own that trivial case themselves,
260
+ * since it never needs signal evaluation at all.
261
+ */
262
+ export function classifyDivergentEntry(params) {
263
+ const identity = classifyManifestEntryIdentity(params);
264
+ if (identity.signal) {
265
+ return { state: 'identity-mismatch', signal: identity.signal, inconclusiveReason: null };
266
+ }
267
+ if (identity.inconclusive) {
268
+ return { state: 'unknown', signal: null, inconclusiveReason: identity.inconclusiveReason };
269
+ }
270
+ const hasLocalEdit = hasRecordedLocalEdit(params.entry, params.localHash);
271
+ return hasLocalEdit
272
+ ? { state: 'local-drift', signal: null, inconclusiveReason: null }
273
+ : { state: 'outdated', signal: null, inconclusiveReason: null };
274
+ }
275
+ /**
276
+ * Full 5-state classification given an already-computed content-comparison
277
+ * outcome (from `compareSkillContentHashes`) plus the caller-derived reason
278
+ * a plain `'unknown'` comparison outcome couldn't be resolved (offline,
279
+ * quota-exhausted, network-error, or no-history — the caller already tracks
280
+ * which applies; see `outdated.ts`'s `deriveUnknownReason`).
281
+ */
282
+ export function classifyOutdatedState(params) {
283
+ if (params.comparisonOutcome === 'current') {
284
+ return { state: 'current', signal: null, inconclusiveReason: null };
285
+ }
286
+ if (params.comparisonOutcome === 'unknown') {
287
+ return {
288
+ state: 'unknown',
289
+ signal: null,
290
+ inconclusiveReason: params.unknownReasonWhenComparisonUnknown,
291
+ };
292
+ }
293
+ return classifyDivergentEntry(params);
294
+ }
295
+ //# sourceMappingURL=skill-identity-classification.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skill-identity-classification.js","sourceRoot":"","sources":["../../../src/services/skill-identity-classification.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,GA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AAM,EAAE,IAAI,EAAE,kBAAkB,EAAE,IAAI,EAAE,CAAA;AACnE,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAQrC;IAKC,IAAI,MAAM,CAAC,iBAAiB,KAAK,SAAS,EAAE,CAAC;QAC3C,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAkB,EAAE,IAAI,EAAE,CAAA;IACrE,CAAC;IACD,IAAI,MAAM,CAAC,iBAAiB,KAAK,SAAS,EAAE,CAAC;QAC3C,OAAO;YACL,KAAK,EAAE,SAAS;YAChB,MAAM,EAAE,IAAI;YACZ,kBAAkB,EAAE,MAAM,CAAC,kCAAkC;SAC9D,CAAA;IACH,CAAC;IACD,OAAO,sBAAsB,CAAC,MAAM,CAAC,CAAA;AACvC,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @fileoverview Unit tests for the shared skill-identity classification module
3
+ * @see SMI-6343 Wave 3 — tamper-check classification (AC#3)
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=skill-identity-classification.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skill-identity-classification.test.d.ts","sourceRoot":"","sources":["../../../src/services/skill-identity-classification.test.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
@@ -0,0 +1,314 @@
1
+ /**
2
+ * @fileoverview Unit tests for the shared skill-identity classification module
3
+ * @see SMI-6343 Wave 3 — tamper-check classification (AC#3)
4
+ */
5
+ import { describe, it, expect } from 'vitest';
6
+ import { parseOwnerFromSource, parseOwnerFromId, detectOwnerMismatch, detectPathUnresolved, hasRecordedLocalEdit, classifyManifestEntryIdentity, classifyDivergentEntry, classifyOutdatedState, } from './skill-identity-classification.js';
7
+ function entry(overrides = {}) {
8
+ return {
9
+ id: 'wrsmith108/linear',
10
+ source: 'github:wrsmith108/linear',
11
+ installPath: '/home/user/.claude/skills/linear',
12
+ ...overrides,
13
+ };
14
+ }
15
+ const notAttempted = { attempted: false, record: null, failureReason: null };
16
+ describe('parseOwnerFromSource', () => {
17
+ it('parses the owner out of a github: prefixed source', () => {
18
+ expect(parseOwnerFromSource('github:lobehub/lobehub')).toBe('lobehub');
19
+ });
20
+ it('parses a bare owner/repo without the prefix', () => {
21
+ expect(parseOwnerFromSource('acme/widget')).toBe('acme');
22
+ });
23
+ it('returns null for the "unknown" distrust sentinel', () => {
24
+ expect(parseOwnerFromSource('unknown')).toBeNull();
25
+ });
26
+ it('returns null for a source with no parseable owner segment', () => {
27
+ expect(parseOwnerFromSource('registry')).toBeNull();
28
+ expect(parseOwnerFromSource('')).toBeNull();
29
+ expect(parseOwnerFromSource(null)).toBeNull();
30
+ expect(parseOwnerFromSource(undefined)).toBeNull();
31
+ });
32
+ it('returns null for a raw URL source with no github: prefix', () => {
33
+ expect(parseOwnerFromSource('https://github.com/owner/repo')).toBeNull();
34
+ });
35
+ });
36
+ describe('parseOwnerFromId', () => {
37
+ it('parses the owner out of an owner/name id', () => {
38
+ expect(parseOwnerFromId('wrsmith108/linear')).toBe('wrsmith108');
39
+ });
40
+ it('returns null for a bare name with no slash', () => {
41
+ expect(parseOwnerFromId('linear')).toBeNull();
42
+ });
43
+ it('returns null for null/undefined', () => {
44
+ expect(parseOwnerFromId(null)).toBeNull();
45
+ expect(parseOwnerFromId(undefined)).toBeNull();
46
+ });
47
+ it('returns null for a raw GitHub URL id (direct-URL install) — regression: must not parse "https:" as the owner', () => {
48
+ expect(parseOwnerFromId('https://github.com/owner-b/test-repo')).toBeNull();
49
+ });
50
+ it('returns null for a 3+-segment owner/repo/path shape', () => {
51
+ expect(parseOwnerFromId('owner/repo/path')).toBeNull();
52
+ });
53
+ });
54
+ describe('detectOwnerMismatch (signal 1)', () => {
55
+ it('fires when id and source name different owners — the real `linear` incident shape', () => {
56
+ expect(detectOwnerMismatch({ id: 'wrsmith108/linear', source: 'github:lobehub/lobehub' })).toBe(true);
57
+ });
58
+ it('does not fire when owners agree', () => {
59
+ expect(detectOwnerMismatch({ id: 'wrsmith108/linear', source: 'github:wrsmith108/linear' })).toBe(false);
60
+ });
61
+ it('does not fire (case-insensitive) when owners agree only up to case', () => {
62
+ expect(detectOwnerMismatch({ id: 'WrSmith108/linear', source: 'github:wrsmith108/linear' })).toBe(false);
63
+ });
64
+ it('does not fire when source is the "unknown" sentinel', () => {
65
+ expect(detectOwnerMismatch({ id: 'wrsmith108/linear', source: 'unknown' })).toBe(false);
66
+ });
67
+ it('does not fire when id has no owner segment', () => {
68
+ expect(detectOwnerMismatch({ id: 'linear', source: 'github:lobehub/lobehub' })).toBe(false);
69
+ });
70
+ it('does not fire for a direct-URL install (id is the raw URL itself) — regression found against a real CLI multi-client fixture', () => {
71
+ expect(detectOwnerMismatch({
72
+ id: 'https://github.com/owner-b/test-repo',
73
+ source: 'github:owner-b/test-repo',
74
+ })).toBe(false);
75
+ });
76
+ });
77
+ describe('detectPathUnresolved (signal 3)', () => {
78
+ const root = '/home/user/.claude/skills';
79
+ it('does not fire for a path inside the expected root', () => {
80
+ expect(detectPathUnresolved(`${root}/astro`, root)).toBe(false);
81
+ });
82
+ it('fires for a path outside the expected root — the fixture-leak shape', () => {
83
+ expect(detectPathUnresolved('/tmp/skillsmith-test-abc123/fixture', root)).toBe(true);
84
+ });
85
+ it('fires for a missing installPath', () => {
86
+ expect(detectPathUnresolved(undefined, root)).toBe(true);
87
+ expect(detectPathUnresolved('', root)).toBe(true);
88
+ });
89
+ it('does not fire when installPath equals the root itself', () => {
90
+ expect(detectPathUnresolved(root, root)).toBe(false);
91
+ });
92
+ it('does NOT fire for a contained child whose name merely starts with two dots (adversarial-review regression)', () => {
93
+ // path.relative('/root', '/root/..cache') === '..cache' — a literal,
94
+ // legitimate directory name, not a parent-directory escape. A bare
95
+ // `rel.startsWith('..')` check would misclassify this as outside.
96
+ expect(detectPathUnresolved(`${root}/..cache`, root)).toBe(false);
97
+ });
98
+ it('fires for an actual parent-directory escape one level up', () => {
99
+ expect(detectPathUnresolved('/home/user/.claude/other', root)).toBe(true);
100
+ });
101
+ });
102
+ describe('hasRecordedLocalEdit', () => {
103
+ it('returns true when the on-disk hash differs from the recorded hash', () => {
104
+ expect(hasRecordedLocalEdit({ contentHash: 'aaa' }, 'bbb')).toBe(true);
105
+ });
106
+ it('returns false when the on-disk hash matches the recorded hash', () => {
107
+ expect(hasRecordedLocalEdit({ contentHash: 'aaa' }, 'aaa')).toBe(false);
108
+ });
109
+ it('falls back to originalContentHash when contentHash is absent', () => {
110
+ expect(hasRecordedLocalEdit({ originalContentHash: 'aaa' }, 'bbb')).toBe(true);
111
+ });
112
+ it('defaults to false (no evidence of edit) when neither hash was ever recorded', () => {
113
+ expect(hasRecordedLocalEdit({}, 'bbb')).toBe(false);
114
+ });
115
+ it('defaults to false when the local hash itself is unavailable', () => {
116
+ expect(hasRecordedLocalEdit({ contentHash: 'aaa' }, null)).toBe(false);
117
+ });
118
+ });
119
+ describe('classifyManifestEntryIdentity — signal 2 (frontmatter contradiction)', () => {
120
+ const frontmatterContent = [
121
+ '---',
122
+ 'name: commit',
123
+ 'author: some-unrelated-author',
124
+ '---',
125
+ '# Commit skill',
126
+ 'Sentry commit-message conventions.',
127
+ ].join('\n');
128
+ it('fires when on-disk author contradicts the registry record for the claimed id', () => {
129
+ const result = classifyManifestEntryIdentity({
130
+ entry: entry({ id: 'acme/commit', source: 'github:acme/commit' }),
131
+ localContent: frontmatterContent,
132
+ expectedRootDir: '/home/user/.claude/skills',
133
+ registryLookup: { attempted: true, record: { author: 'acme', name: 'commit' } },
134
+ });
135
+ expect(result.signal).toBe('frontmatter-contradiction');
136
+ expect(result.inconclusive).toBe(false);
137
+ });
138
+ it('does not fire when on-disk author agrees with the registry record', () => {
139
+ const result = classifyManifestEntryIdentity({
140
+ entry: entry({
141
+ id: 'some-unrelated-author/commit',
142
+ source: 'github:some-unrelated-author/commit',
143
+ }),
144
+ localContent: frontmatterContent,
145
+ expectedRootDir: '/home/user/.claude/skills',
146
+ registryLookup: {
147
+ attempted: true,
148
+ record: { author: 'some-unrelated-author', name: 'commit' },
149
+ },
150
+ });
151
+ expect(result.signal).toBeNull();
152
+ expect(result.inconclusive).toBe(false);
153
+ });
154
+ it('is inconclusive (never "no contradiction") when the lookup was not attempted — offline', () => {
155
+ const result = classifyManifestEntryIdentity({
156
+ entry: entry(),
157
+ localContent: frontmatterContent,
158
+ expectedRootDir: '/home/user/.claude/skills',
159
+ registryLookup: { attempted: false, record: null, failureReason: 'offline' },
160
+ });
161
+ expect(result.signal).toBeNull();
162
+ expect(result.inconclusive).toBe(true);
163
+ expect(result.inconclusiveReason).toBe('offline');
164
+ });
165
+ it('is inconclusive when quota-exhausted', () => {
166
+ const result = classifyManifestEntryIdentity({
167
+ entry: entry(),
168
+ localContent: frontmatterContent,
169
+ expectedRootDir: '/home/user/.claude/skills',
170
+ registryLookup: { attempted: false, record: null, failureReason: 'quota-exhausted' },
171
+ });
172
+ expect(result.inconclusive).toBe(true);
173
+ expect(result.inconclusiveReason).toBe('quota-exhausted');
174
+ });
175
+ it('is inconclusive when the lookup was attempted but failed (network error)', () => {
176
+ const result = classifyManifestEntryIdentity({
177
+ entry: entry(),
178
+ localContent: frontmatterContent,
179
+ expectedRootDir: '/home/user/.claude/skills',
180
+ registryLookup: { attempted: true, record: null, failureReason: 'network-error' },
181
+ });
182
+ expect(result.inconclusive).toBe(true);
183
+ expect(result.inconclusiveReason).toBe('network-error');
184
+ });
185
+ it('is inconclusive when the lookup completed but found no registry record', () => {
186
+ const result = classifyManifestEntryIdentity({
187
+ entry: entry(),
188
+ localContent: frontmatterContent,
189
+ expectedRootDir: '/home/user/.claude/skills',
190
+ registryLookup: { attempted: true, record: null },
191
+ });
192
+ expect(result.inconclusive).toBe(true);
193
+ expect(result.inconclusiveReason).toBe('no-registry-record');
194
+ });
195
+ it('does not fire (and is not inconclusive) when local content has no parseable frontmatter', () => {
196
+ const result = classifyManifestEntryIdentity({
197
+ entry: entry(),
198
+ localContent: 'plain content with no frontmatter',
199
+ expectedRootDir: '/home/user/.claude/skills',
200
+ registryLookup: { attempted: true, record: { author: 'wrsmith108', name: 'linear' } },
201
+ });
202
+ expect(result.signal).toBeNull();
203
+ expect(result.inconclusive).toBe(false);
204
+ });
205
+ it('is a clean non-fire (not inconclusive) when id does not parse as owner/name — a raw-URL direct install has no registry key to check', () => {
206
+ const result = classifyManifestEntryIdentity({
207
+ entry: entry({
208
+ id: 'https://github.com/owner-b/test-repo',
209
+ source: 'github:owner-b/test-repo',
210
+ }),
211
+ localContent: frontmatterContent,
212
+ expectedRootDir: '/home/user/.claude/skills',
213
+ registryLookup: notAttempted,
214
+ });
215
+ expect(result.signal).toBeNull();
216
+ expect(result.inconclusive).toBe(false);
217
+ });
218
+ it('signal 1 takes precedence over an inconclusive signal 2', () => {
219
+ const result = classifyManifestEntryIdentity({
220
+ entry: entry({ id: 'wrsmith108/linear', source: 'github:lobehub/lobehub' }),
221
+ localContent: frontmatterContent,
222
+ expectedRootDir: '/home/user/.claude/skills',
223
+ registryLookup: notAttempted,
224
+ });
225
+ expect(result.signal).toBe('owner-mismatch');
226
+ expect(result.inconclusive).toBe(false);
227
+ });
228
+ });
229
+ describe('classifyDivergentEntry', () => {
230
+ it('classifies as identity-mismatch when a signal fires', () => {
231
+ const result = classifyDivergentEntry({
232
+ entry: entry({ id: 'wrsmith108/linear', source: 'github:lobehub/lobehub' }),
233
+ localHash: 'abc',
234
+ localContent: 'content',
235
+ expectedRootDir: '/home/user/.claude/skills',
236
+ registryLookup: notAttempted,
237
+ });
238
+ expect(result.state).toBe('identity-mismatch');
239
+ expect(result.signal).toBe('owner-mismatch');
240
+ });
241
+ it('classifies as unknown when signal 2 is inconclusive', () => {
242
+ const result = classifyDivergentEntry({
243
+ entry: entry(),
244
+ localHash: 'abc',
245
+ localContent: 'content',
246
+ expectedRootDir: '/home/user/.claude/skills',
247
+ registryLookup: { attempted: false, record: null, failureReason: 'offline' },
248
+ });
249
+ expect(result.state).toBe('unknown');
250
+ expect(result.inconclusiveReason).toBe('offline');
251
+ });
252
+ it('classifies as local-drift when no signal fires but on-disk content diverges from the recorded hash', () => {
253
+ const result = classifyDivergentEntry({
254
+ entry: entry({ contentHash: 'recorded-hash' }),
255
+ localHash: 'edited-hash',
256
+ localContent: 'content',
257
+ expectedRootDir: '/home/user/.claude/skills',
258
+ registryLookup: { attempted: true, record: { author: 'wrsmith108', name: 'linear' } },
259
+ });
260
+ expect(result.state).toBe('local-drift');
261
+ expect(result.signal).toBeNull();
262
+ });
263
+ it('classifies as outdated when no signal fires and no local edit is evidenced', () => {
264
+ const result = classifyDivergentEntry({
265
+ entry: entry(),
266
+ localHash: 'installed-hash',
267
+ localContent: 'content',
268
+ expectedRootDir: '/home/user/.claude/skills',
269
+ registryLookup: { attempted: true, record: { author: 'wrsmith108', name: 'linear' } },
270
+ });
271
+ expect(result.state).toBe('outdated');
272
+ });
273
+ });
274
+ describe('classifyOutdatedState', () => {
275
+ it('returns current without evaluating signals', () => {
276
+ const result = classifyOutdatedState({
277
+ comparisonOutcome: 'current',
278
+ unknownReasonWhenComparisonUnknown: 'no-history',
279
+ entry: entry({ id: 'wrsmith108/linear', source: 'github:lobehub/lobehub' }), // would fire if evaluated
280
+ localHash: 'x',
281
+ localContent: 'content',
282
+ expectedRootDir: '/home/user/.claude/skills',
283
+ registryLookup: notAttempted,
284
+ });
285
+ expect(result.state).toBe('current');
286
+ expect(result.signal).toBeNull();
287
+ });
288
+ it('returns unknown with the caller-supplied reason when the comparison itself is unknown', () => {
289
+ const result = classifyOutdatedState({
290
+ comparisonOutcome: 'unknown',
291
+ unknownReasonWhenComparisonUnknown: 'no-history',
292
+ entry: entry(),
293
+ localHash: null,
294
+ localContent: null,
295
+ expectedRootDir: '/home/user/.claude/skills',
296
+ registryLookup: notAttempted,
297
+ });
298
+ expect(result.state).toBe('unknown');
299
+ expect(result.inconclusiveReason).toBe('no-history');
300
+ });
301
+ it('delegates to classifyDivergentEntry for an outdated comparison outcome', () => {
302
+ const result = classifyOutdatedState({
303
+ comparisonOutcome: 'outdated',
304
+ unknownReasonWhenComparisonUnknown: 'no-history',
305
+ entry: entry(),
306
+ localHash: 'installed-hash',
307
+ localContent: 'content',
308
+ expectedRootDir: '/home/user/.claude/skills',
309
+ registryLookup: { attempted: true, record: { author: 'wrsmith108', name: 'linear' } },
310
+ });
311
+ expect(result.state).toBe('outdated');
312
+ });
313
+ });
314
+ //# sourceMappingURL=skill-identity-classification.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skill-identity-classification.test.js","sourceRoot":"","sources":["../../../src/services/skill-identity-classification.test.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC7C,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAChB,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,6BAA6B,EAC7B,sBAAsB,EACtB,qBAAqB,GAGtB,MAAM,oCAAoC,CAAA;AAE3C,SAAS,KAAK,CAAC,YAA+C,EAAE;IAC9D,OAAO;QACL,EAAE,EAAE,mBAAmB;QACvB,MAAM,EAAE,0BAA0B;QAClC,WAAW,EAAE,kCAAkC;QAC/C,GAAG,SAAS;KACb,CAAA;AACH,CAAC;AAED,MAAM,YAAY,GAA0B,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,CAAA;AAEnG,QAAQ,CAAC,sBAAsB,EAAE,GAAG,EAAE;IACpC,EAAE,CAAC,mDAAmD,EAAE,GAAG,EAAE;QAC3D,MAAM,CAAC,oBAAoB,CAAC,wBAAwB,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;IACxE,CAAC,CAAC,CAAA;IACF,EAAE,CAAC,6CAA6C,EAAE,GAAG,EAAE;QACrD,MAAM,CAAC,oBAAoB,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC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