@skillsmith/core 0.9.0 → 0.10.0

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 (313) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/.tsbuildinfo +1 -1
  3. package/dist/src/api/client.d.ts.map +1 -1
  4. package/dist/src/api/client.js +6 -0
  5. package/dist/src/api/client.js.map +1 -1
  6. package/dist/src/api/client.test.d.ts +9 -0
  7. package/dist/src/api/client.test.d.ts.map +1 -0
  8. package/dist/src/api/client.test.js +81 -0
  9. package/dist/src/api/client.test.js.map +1 -0
  10. package/dist/src/exports/services.d.ts +3 -1
  11. package/dist/src/exports/services.d.ts.map +1 -1
  12. package/dist/src/exports/services.js +7 -1
  13. package/dist/src/exports/services.js.map +1 -1
  14. package/dist/src/index.d.ts +3 -3
  15. package/dist/src/index.d.ts.map +1 -1
  16. package/dist/src/index.js +5 -2
  17. package/dist/src/index.js.map +1 -1
  18. package/dist/src/install/agent-config-merge.json-array.d.ts +29 -0
  19. package/dist/src/install/agent-config-merge.json-array.d.ts.map +1 -0
  20. package/dist/src/install/agent-config-merge.json-array.js +100 -0
  21. package/dist/src/install/agent-config-merge.json-array.js.map +1 -0
  22. package/dist/src/install/agent-config-merge.json.d.ts +37 -0
  23. package/dist/src/install/agent-config-merge.json.d.ts.map +1 -0
  24. package/dist/src/install/agent-config-merge.json.js +134 -0
  25. package/dist/src/install/agent-config-merge.json.js.map +1 -0
  26. package/dist/src/install/agent-config-merge.toml-block.d.ts +48 -0
  27. package/dist/src/install/agent-config-merge.toml-block.d.ts.map +1 -0
  28. package/dist/src/install/agent-config-merge.toml-block.js +107 -0
  29. package/dist/src/install/agent-config-merge.toml-block.js.map +1 -0
  30. package/dist/src/install/agent-config-merge.types.d.ts +87 -0
  31. package/dist/src/install/agent-config-merge.types.d.ts.map +1 -0
  32. package/dist/src/install/agent-config-merge.types.js +83 -0
  33. package/dist/src/install/agent-config-merge.types.js.map +1 -0
  34. package/dist/src/install/agent-config-merge.yaml.d.ts +46 -0
  35. package/dist/src/install/agent-config-merge.yaml.d.ts.map +1 -0
  36. package/dist/src/install/agent-config-merge.yaml.js +133 -0
  37. package/dist/src/install/agent-config-merge.yaml.js.map +1 -0
  38. package/dist/src/install/agent-config-merge.yaml.test.d.ts +2 -0
  39. package/dist/src/install/agent-config-merge.yaml.test.d.ts.map +1 -0
  40. package/dist/src/install/agent-config-merge.yaml.test.js +210 -0
  41. package/dist/src/install/agent-config-merge.yaml.test.js.map +1 -0
  42. package/dist/src/install/agent-harness-targets.d.ts +98 -0
  43. package/dist/src/install/agent-harness-targets.d.ts.map +1 -0
  44. package/dist/src/install/agent-harness-targets.js +154 -0
  45. package/dist/src/install/agent-harness-targets.js.map +1 -0
  46. package/dist/src/install/agent-home-relocate.d.ts +29 -0
  47. package/dist/src/install/agent-home-relocate.d.ts.map +1 -0
  48. package/dist/src/install/agent-home-relocate.js +38 -0
  49. package/dist/src/install/agent-home-relocate.js.map +1 -0
  50. package/dist/src/install/agent-manifest-path-guard.d.ts +55 -0
  51. package/dist/src/install/agent-manifest-path-guard.d.ts.map +1 -0
  52. package/dist/src/install/agent-manifest-path-guard.js +109 -0
  53. package/dist/src/install/agent-manifest-path-guard.js.map +1 -0
  54. package/dist/src/install/agent-manifest-path-guard.test.d.ts +2 -0
  55. package/dist/src/install/agent-manifest-path-guard.test.d.ts.map +1 -0
  56. package/dist/src/install/agent-manifest-path-guard.test.js +72 -0
  57. package/dist/src/install/agent-manifest-path-guard.test.js.map +1 -0
  58. package/dist/src/install/agent-manifest.d.ts +58 -0
  59. package/dist/src/install/agent-manifest.d.ts.map +1 -0
  60. package/dist/src/install/agent-manifest.js +103 -0
  61. package/dist/src/install/agent-manifest.js.map +1 -0
  62. package/dist/src/install/agent-pack-installer.d.ts +39 -0
  63. package/dist/src/install/agent-pack-installer.d.ts.map +1 -0
  64. package/dist/src/install/agent-pack-installer.entry.d.ts +55 -0
  65. package/dist/src/install/agent-pack-installer.entry.d.ts.map +1 -0
  66. package/dist/src/install/agent-pack-installer.entry.js +90 -0
  67. package/dist/src/install/agent-pack-installer.entry.js.map +1 -0
  68. package/dist/src/install/agent-pack-installer.fs-helpers.d.ts +33 -0
  69. package/dist/src/install/agent-pack-installer.fs-helpers.d.ts.map +1 -0
  70. package/dist/src/install/agent-pack-installer.fs-helpers.js +59 -0
  71. package/dist/src/install/agent-pack-installer.fs-helpers.js.map +1 -0
  72. package/dist/src/install/agent-pack-installer.harness.d.ts +66 -0
  73. package/dist/src/install/agent-pack-installer.harness.d.ts.map +1 -0
  74. package/dist/src/install/agent-pack-installer.harness.js +310 -0
  75. package/dist/src/install/agent-pack-installer.harness.js.map +1 -0
  76. package/dist/src/install/agent-pack-installer.js +221 -0
  77. package/dist/src/install/agent-pack-installer.js.map +1 -0
  78. package/dist/src/install/agent-pack-installer.preserve.test.d.ts +11 -0
  79. package/dist/src/install/agent-pack-installer.preserve.test.d.ts.map +1 -0
  80. package/dist/src/install/agent-pack-installer.preserve.test.js +72 -0
  81. package/dist/src/install/agent-pack-installer.preserve.test.js.map +1 -0
  82. package/dist/src/install/agent-pack-installer.test.d.ts +2 -0
  83. package/dist/src/install/agent-pack-installer.test.d.ts.map +1 -0
  84. package/dist/src/install/agent-pack-installer.test.js +350 -0
  85. package/dist/src/install/agent-pack-installer.test.js.map +1 -0
  86. package/dist/src/install/agent-pack-installer.types.d.ts +51 -0
  87. package/dist/src/install/agent-pack-installer.types.d.ts.map +1 -0
  88. package/dist/src/install/agent-pack-installer.types.js +16 -0
  89. package/dist/src/install/agent-pack-installer.types.js.map +1 -0
  90. package/dist/src/install/agent-pack-uninstaller.d.ts +43 -0
  91. package/dist/src/install/agent-pack-uninstaller.d.ts.map +1 -0
  92. package/dist/src/install/agent-pack-uninstaller.js +113 -0
  93. package/dist/src/install/agent-pack-uninstaller.js.map +1 -0
  94. package/dist/src/install/agent-pack-uninstaller.test.d.ts +2 -0
  95. package/dist/src/install/agent-pack-uninstaller.test.d.ts.map +1 -0
  96. package/dist/src/install/agent-pack-uninstaller.test.js +212 -0
  97. package/dist/src/install/agent-pack-uninstaller.test.js.map +1 -0
  98. package/dist/src/install/index.d.ts +7 -0
  99. package/dist/src/install/index.d.ts.map +1 -1
  100. package/dist/src/install/index.js +7 -0
  101. package/dist/src/install/index.js.map +1 -1
  102. package/dist/src/install/paths.d.ts +1 -1
  103. package/dist/src/install/paths.d.ts.map +1 -1
  104. package/dist/src/install/paths.js +4 -0
  105. package/dist/src/install/paths.js.map +1 -1
  106. package/dist/src/install/paths.test.js +15 -0
  107. package/dist/src/install/paths.test.js.map +1 -1
  108. package/dist/src/journal/hash.d.ts +13 -0
  109. package/dist/src/journal/hash.d.ts.map +1 -0
  110. package/dist/src/journal/hash.js +16 -0
  111. package/dist/src/journal/hash.js.map +1 -0
  112. package/dist/src/journal/index.d.ts +15 -0
  113. package/dist/src/journal/index.d.ts.map +1 -0
  114. package/dist/src/journal/index.js +15 -0
  115. package/dist/src/journal/index.js.map +1 -0
  116. package/dist/src/journal/journal.test.d.ts +16 -0
  117. package/dist/src/journal/journal.test.d.ts.map +1 -0
  118. package/dist/src/journal/journal.test.js +171 -0
  119. package/dist/src/journal/journal.test.js.map +1 -0
  120. package/dist/src/journal/path.d.ts +44 -0
  121. package/dist/src/journal/path.d.ts.map +1 -0
  122. package/dist/src/journal/path.js +61 -0
  123. package/dist/src/journal/path.js.map +1 -0
  124. package/dist/src/journal/reader.d.ts +38 -0
  125. package/dist/src/journal/reader.d.ts.map +1 -0
  126. package/dist/src/journal/reader.js +93 -0
  127. package/dist/src/journal/reader.js.map +1 -0
  128. package/dist/src/journal/types.d.ts +87 -0
  129. package/dist/src/journal/types.d.ts.map +1 -0
  130. package/dist/src/journal/types.js +21 -0
  131. package/dist/src/journal/types.js.map +1 -0
  132. package/dist/src/journal/writer.d.ts +52 -0
  133. package/dist/src/journal/writer.d.ts.map +1 -0
  134. package/dist/src/journal/writer.js +125 -0
  135. package/dist/src/journal/writer.js.map +1 -0
  136. package/dist/src/paywall-triggers/index.d.ts +13 -0
  137. package/dist/src/paywall-triggers/index.d.ts.map +1 -0
  138. package/dist/src/paywall-triggers/index.js +13 -0
  139. package/dist/src/paywall-triggers/index.js.map +1 -0
  140. package/dist/src/paywall-triggers/path.d.ts +47 -0
  141. package/dist/src/paywall-triggers/path.d.ts.map +1 -0
  142. package/dist/src/paywall-triggers/path.js +73 -0
  143. package/dist/src/paywall-triggers/path.js.map +1 -0
  144. package/dist/src/paywall-triggers/store.d.ts +75 -0
  145. package/dist/src/paywall-triggers/store.d.ts.map +1 -0
  146. package/dist/src/paywall-triggers/store.js +122 -0
  147. package/dist/src/paywall-triggers/store.js.map +1 -0
  148. package/dist/src/paywall-triggers/store.test.d.ts +2 -0
  149. package/dist/src/paywall-triggers/store.test.d.ts.map +1 -0
  150. package/dist/src/paywall-triggers/store.test.js +121 -0
  151. package/dist/src/paywall-triggers/store.test.js.map +1 -0
  152. package/dist/src/paywall-triggers/types.d.ts +24 -0
  153. package/dist/src/paywall-triggers/types.d.ts.map +1 -0
  154. package/dist/src/paywall-triggers/types.js +13 -0
  155. package/dist/src/paywall-triggers/types.js.map +1 -0
  156. package/dist/src/security/scanner/SecurityScanner.compound.d.ts +13 -0
  157. package/dist/src/security/scanner/SecurityScanner.compound.d.ts.map +1 -0
  158. package/dist/src/security/scanner/SecurityScanner.compound.js +127 -0
  159. package/dist/src/security/scanner/SecurityScanner.compound.js.map +1 -0
  160. package/dist/src/security/scanner/SecurityScanner.d.ts.map +1 -1
  161. package/dist/src/security/scanner/SecurityScanner.js +10 -1
  162. package/dist/src/security/scanner/SecurityScanner.js.map +1 -1
  163. package/dist/src/security/scanner/SecurityScanner.pii.d.ts +23 -0
  164. package/dist/src/security/scanner/SecurityScanner.pii.d.ts.map +1 -0
  165. package/dist/src/security/scanner/SecurityScanner.pii.js +152 -0
  166. package/dist/src/security/scanner/SecurityScanner.pii.js.map +1 -0
  167. package/dist/src/security/scanner/SecurityScanner.scanners.d.ts +5 -12
  168. package/dist/src/security/scanner/SecurityScanner.scanners.d.ts.map +1 -1
  169. package/dist/src/security/scanner/SecurityScanner.scanners.js +63 -137
  170. package/dist/src/security/scanner/SecurityScanner.scanners.js.map +1 -1
  171. package/dist/src/security/scanner/patterns.d.ts +2 -0
  172. package/dist/src/security/scanner/patterns.d.ts.map +1 -1
  173. package/dist/src/security/scanner/patterns.js +79 -11
  174. package/dist/src/security/scanner/patterns.js.map +1 -1
  175. package/dist/src/security/scanner/types.d.ts +2 -0
  176. package/dist/src/security/scanner/types.d.ts.map +1 -1
  177. package/dist/src/services/agent-pack/agent-pack.test.d.ts +18 -0
  178. package/dist/src/services/agent-pack/agent-pack.test.d.ts.map +1 -0
  179. package/dist/src/services/agent-pack/agent-pack.test.js +344 -0
  180. package/dist/src/services/agent-pack/agent-pack.test.js.map +1 -0
  181. package/dist/src/services/agent-pack/hooks.d.ts +29 -0
  182. package/dist/src/services/agent-pack/hooks.d.ts.map +1 -0
  183. package/dist/src/services/agent-pack/hooks.js +139 -0
  184. package/dist/src/services/agent-pack/hooks.js.map +1 -0
  185. package/dist/src/services/agent-pack/index.d.ts +26 -0
  186. package/dist/src/services/agent-pack/index.d.ts.map +1 -0
  187. package/dist/src/services/agent-pack/index.js +109 -0
  188. package/dist/src/services/agent-pack/index.js.map +1 -0
  189. package/dist/src/services/agent-pack/prompt-source.d.ts +47 -0
  190. package/dist/src/services/agent-pack/prompt-source.d.ts.map +1 -0
  191. package/dist/src/services/agent-pack/prompt-source.js +182 -0
  192. package/dist/src/services/agent-pack/prompt-source.js.map +1 -0
  193. package/dist/src/services/agent-pack/shims.d.ts +40 -0
  194. package/dist/src/services/agent-pack/shims.d.ts.map +1 -0
  195. package/dist/src/services/agent-pack/shims.js +96 -0
  196. package/dist/src/services/agent-pack/shims.js.map +1 -0
  197. package/dist/src/services/agent-pack/skill-md.d.ts +35 -0
  198. package/dist/src/services/agent-pack/skill-md.d.ts.map +1 -0
  199. package/dist/src/services/agent-pack/skill-md.js +89 -0
  200. package/dist/src/services/agent-pack/skill-md.js.map +1 -0
  201. package/dist/src/services/agent-pack/types.d.ts +118 -0
  202. package/dist/src/services/agent-pack/types.d.ts.map +1 -0
  203. package/dist/src/services/agent-pack/types.js +61 -0
  204. package/dist/src/services/agent-pack/types.js.map +1 -0
  205. package/dist/src/services/agent-tool-profile.d.ts +59 -0
  206. package/dist/src/services/agent-tool-profile.d.ts.map +1 -0
  207. package/dist/src/services/agent-tool-profile.js +76 -0
  208. package/dist/src/services/agent-tool-profile.js.map +1 -0
  209. package/dist/src/services/agent-tool-profile.test.d.ts +2 -0
  210. package/dist/src/services/agent-tool-profile.test.d.ts.map +1 -0
  211. package/dist/src/services/agent-tool-profile.test.js +28 -0
  212. package/dist/src/services/agent-tool-profile.test.js.map +1 -0
  213. package/dist/src/services/bundled-sibling-scan.d.ts +111 -0
  214. package/dist/src/services/bundled-sibling-scan.d.ts.map +1 -0
  215. package/dist/src/services/bundled-sibling-scan.js +170 -0
  216. package/dist/src/services/bundled-sibling-scan.js.map +1 -0
  217. package/dist/src/services/skill-installation.io.d.ts +16 -5
  218. package/dist/src/services/skill-installation.io.d.ts.map +1 -1
  219. package/dist/src/services/skill-installation.io.js +44 -20
  220. package/dist/src/services/skill-installation.io.js.map +1 -1
  221. package/dist/src/services/skill-installation.policy.d.ts +96 -0
  222. package/dist/src/services/skill-installation.policy.d.ts.map +1 -0
  223. package/dist/src/services/skill-installation.policy.js +144 -0
  224. package/dist/src/services/skill-installation.policy.js.map +1 -0
  225. package/dist/src/services/skill-installation.service.d.ts.map +1 -1
  226. package/dist/src/services/skill-installation.service.js +9 -3
  227. package/dist/src/services/skill-installation.service.js.map +1 -1
  228. package/dist/src/sources/index.d.ts +1 -0
  229. package/dist/src/sources/index.d.ts.map +1 -1
  230. package/dist/src/sources/index.js +4 -0
  231. package/dist/src/sources/index.js.map +1 -1
  232. package/dist/src/sync/index.d.ts +1 -1
  233. package/dist/src/sync/index.d.ts.map +1 -1
  234. package/dist/src/sync/index.js +1 -1
  235. package/dist/src/sync/index.js.map +1 -1
  236. package/dist/src/sync/inventory-client.d.ts +16 -0
  237. package/dist/src/sync/inventory-client.d.ts.map +1 -1
  238. package/dist/src/sync/inventory-client.js +54 -0
  239. package/dist/src/sync/inventory-client.js.map +1 -1
  240. package/dist/src/sync/inventory-client.test.js +67 -1
  241. package/dist/src/sync/inventory-client.test.js.map +1 -1
  242. package/dist/src/sync/inventory-collector.d.ts.map +1 -1
  243. package/dist/src/sync/inventory-collector.js +32 -5
  244. package/dist/src/sync/inventory-collector.js.map +1 -1
  245. package/dist/src/sync/inventory-collector.test.js +50 -1
  246. package/dist/src/sync/inventory-collector.test.js.map +1 -1
  247. package/dist/src/sync/inventory-types.d.ts +9 -0
  248. package/dist/src/sync/inventory-types.d.ts.map +1 -1
  249. package/dist/src/sync/inventory-types.js +3 -0
  250. package/dist/src/sync/inventory-types.js.map +1 -1
  251. package/dist/src/telemetry/agent-marker.d.ts +137 -0
  252. package/dist/src/telemetry/agent-marker.d.ts.map +1 -0
  253. package/dist/src/telemetry/agent-marker.js +242 -0
  254. package/dist/src/telemetry/agent-marker.js.map +1 -0
  255. package/dist/src/telemetry/agent-marker.test.d.ts +13 -0
  256. package/dist/src/telemetry/agent-marker.test.d.ts.map +1 -0
  257. package/dist/src/telemetry/agent-marker.test.js +202 -0
  258. package/dist/src/telemetry/agent-marker.test.js.map +1 -0
  259. package/dist/src/telemetry/index.d.ts +2 -1
  260. package/dist/src/telemetry/index.d.ts.map +1 -1
  261. package/dist/src/telemetry/index.js +6 -1
  262. package/dist/src/telemetry/index.js.map +1 -1
  263. package/dist/src/telemetry/posthog.d.ts +10 -0
  264. package/dist/src/telemetry/posthog.d.ts.map +1 -1
  265. package/dist/src/telemetry/posthog.js +5 -1
  266. package/dist/src/telemetry/posthog.js.map +1 -1
  267. package/dist/src/telemetry/wrap.d.ts +28 -7
  268. package/dist/src/telemetry/wrap.d.ts.map +1 -1
  269. package/dist/src/telemetry/wrap.gate.test.d.ts +22 -0
  270. package/dist/src/telemetry/wrap.gate.test.d.ts.map +1 -0
  271. package/dist/src/telemetry/wrap.gate.test.js +197 -0
  272. package/dist/src/telemetry/wrap.gate.test.js.map +1 -0
  273. package/dist/src/telemetry/wrap.js +111 -26
  274. package/dist/src/telemetry/wrap.js.map +1 -1
  275. package/dist/src/telemetry/wrap.marker.test.d.ts +16 -0
  276. package/dist/src/telemetry/wrap.marker.test.d.ts.map +1 -0
  277. package/dist/src/telemetry/wrap.marker.test.js +185 -0
  278. package/dist/src/telemetry/wrap.marker.test.js.map +1 -0
  279. package/dist/src/telemetry/wrap.test.js +4 -0
  280. package/dist/src/telemetry/wrap.test.js.map +1 -1
  281. package/dist/tests/SecurityScanner.exec.test.js +60 -0
  282. package/dist/tests/SecurityScanner.exec.test.js.map +1 -1
  283. package/dist/tests/security/ContinuousSecurity.test.js +10 -4
  284. package/dist/tests/security/ContinuousSecurity.test.js.map +1 -1
  285. package/dist/tests/security/SecurityScanner.chmod-evasion.test.d.ts +2 -0
  286. package/dist/tests/security/SecurityScanner.chmod-evasion.test.d.ts.map +1 -0
  287. package/dist/tests/security/SecurityScanner.chmod-evasion.test.js +126 -0
  288. package/dist/tests/security/SecurityScanner.chmod-evasion.test.js.map +1 -0
  289. package/dist/tests/security/chmod-compound.test.d.ts +2 -0
  290. package/dist/tests/security/chmod-compound.test.d.ts.map +1 -0
  291. package/dist/tests/security/chmod-compound.test.js +188 -0
  292. package/dist/tests/security/chmod-compound.test.js.map +1 -0
  293. package/dist/tests/security/pii-detection.test.js +24 -0
  294. package/dist/tests/security/pii-detection.test.js.map +1 -1
  295. package/dist/tests/security/scanner-regression-guard.test.d.ts +23 -7
  296. package/dist/tests/security/scanner-regression-guard.test.d.ts.map +1 -1
  297. package/dist/tests/security/scanner-regression-guard.test.js +27 -11
  298. package/dist/tests/security/scanner-regression-guard.test.js.map +1 -1
  299. package/dist/tests/security/sensitive-path-fp.test.d.ts +2 -0
  300. package/dist/tests/security/sensitive-path-fp.test.d.ts.map +1 -0
  301. package/dist/tests/security/sensitive-path-fp.test.js +142 -0
  302. package/dist/tests/security/sensitive-path-fp.test.js.map +1 -0
  303. package/dist/tests/services/bundled-sibling-scan.test.d.ts +2 -0
  304. package/dist/tests/services/bundled-sibling-scan.test.d.ts.map +1 -0
  305. package/dist/tests/services/bundled-sibling-scan.test.js +139 -0
  306. package/dist/tests/services/bundled-sibling-scan.test.js.map +1 -0
  307. package/dist/tests/unit/services/skill-installation.io.test.js +166 -0
  308. package/dist/tests/unit/services/skill-installation.io.test.js.map +1 -1
  309. package/dist/tests/unit/services/skill-installation.policy.test.d.ts +8 -0
  310. package/dist/tests/unit/services/skill-installation.policy.test.d.ts.map +1 -0
  311. package/dist/tests/unit/services/skill-installation.policy.test.js +151 -0
  312. package/dist/tests/unit/services/skill-installation.policy.test.js.map +1 -0
  313. package/package.json +23 -3
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Home-dir relocation test seam for `sklx agent install` (SMI-5456 Wave 1
3
+ * Step 5).
4
+ *
5
+ * `paths.ts`'s `CLIENT_NATIVE_PATHS` and `agent-harness-targets.ts`'s target
6
+ * tables are computed ONCE at module load via `os.homedir()` — the
7
+ * established pattern in this codebase (paths.ts has no `homeDir` override;
8
+ * `enumerateHarnessPresence()` takes none either). Rather than widen that
9
+ * shared contract (used across many consumers) or fight macOS's
10
+ * `os.homedir()` ignoring `process.env.HOME` mutations (the exact problem
11
+ * `journal/path.ts` and `telemetry/agent-marker.ts` solve with their own
12
+ * per-module env overrides), the installer re-roots any already-computed
13
+ * absolute path onto an alternate directory for tests: strip the real
14
+ * `os.homedir()` prefix and re-join under the test's temp `homeDir`. This
15
+ * keeps every existing static table intact and untouched while giving
16
+ * `installAgentPack({ homeDir })` a real, disk-backed temp-HOME test seam
17
+ * (P-5 "install to a temp HOME" requirement) without adding a second
18
+ * parallel path-computation system to maintain in sync with `paths.ts`.
19
+ *
20
+ * @module @skillsmith/core/install/agent-home-relocate
21
+ */
22
+ /**
23
+ * Re-root `absolutePath` (assumed computed under the REAL `os.homedir()`)
24
+ * onto `homeDir`. Returns `absolutePath` unchanged when `homeDir` is
25
+ * undefined, or when `absolutePath` is not actually under the real home
26
+ * directory (defensive — never silently misroute an unrelated path).
27
+ */
28
+ export declare function relocateUnderHome(absolutePath: string, homeDir?: string): string;
29
+ //# sourceMappingURL=agent-home-relocate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-home-relocate.d.ts","sourceRoot":"","sources":["../../../src/install/agent-home-relocate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAKH;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAKhF"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Home-dir relocation test seam for `sklx agent install` (SMI-5456 Wave 1
3
+ * Step 5).
4
+ *
5
+ * `paths.ts`'s `CLIENT_NATIVE_PATHS` and `agent-harness-targets.ts`'s target
6
+ * tables are computed ONCE at module load via `os.homedir()` — the
7
+ * established pattern in this codebase (paths.ts has no `homeDir` override;
8
+ * `enumerateHarnessPresence()` takes none either). Rather than widen that
9
+ * shared contract (used across many consumers) or fight macOS's
10
+ * `os.homedir()` ignoring `process.env.HOME` mutations (the exact problem
11
+ * `journal/path.ts` and `telemetry/agent-marker.ts` solve with their own
12
+ * per-module env overrides), the installer re-roots any already-computed
13
+ * absolute path onto an alternate directory for tests: strip the real
14
+ * `os.homedir()` prefix and re-join under the test's temp `homeDir`. This
15
+ * keeps every existing static table intact and untouched while giving
16
+ * `installAgentPack({ homeDir })` a real, disk-backed temp-HOME test seam
17
+ * (P-5 "install to a temp HOME" requirement) without adding a second
18
+ * parallel path-computation system to maintain in sync with `paths.ts`.
19
+ *
20
+ * @module @skillsmith/core/install/agent-home-relocate
21
+ */
22
+ import { homedir } from 'node:os';
23
+ import { isAbsolute, join, relative } from 'node:path';
24
+ /**
25
+ * Re-root `absolutePath` (assumed computed under the REAL `os.homedir()`)
26
+ * onto `homeDir`. Returns `absolutePath` unchanged when `homeDir` is
27
+ * undefined, or when `absolutePath` is not actually under the real home
28
+ * directory (defensive — never silently misroute an unrelated path).
29
+ */
30
+ export function relocateUnderHome(absolutePath, homeDir) {
31
+ if (!homeDir)
32
+ return absolutePath;
33
+ const rel = relative(homedir(), absolutePath);
34
+ if (rel.startsWith('..') || isAbsolute(rel))
35
+ return absolutePath;
36
+ return join(homeDir, rel);
37
+ }
38
+ //# sourceMappingURL=agent-home-relocate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-home-relocate.js","sourceRoot":"","sources":["../../../src/install/agent-home-relocate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAEtD;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,YAAoB,EAAE,OAAgB;IACtE,IAAI,CAAC,OAAO;QAAE,OAAO,YAAY,CAAA;IACjC,MAAM,GAAG,GAAG,QAAQ,CAAC,OAAO,EAAE,EAAE,YAAY,CAAC,CAAA;IAC7C,IAAI,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,YAAY,CAAA;IAChE,OAAO,IAAI,CAAC,OAAO,EAAE,GAAG,CAAC,CAAA;AAC3B,CAAC"}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Manifest-path validation for `uninstallAgentPack` (SMI-5456 governance
3
+ * follow-up, code review 2026-07-01).
4
+ *
5
+ * `uninstallAgentPack` reads `~/.skillsmith/agent-install/manifest.json` and,
6
+ * for every entry, either `unlinkSync`s `entry.path` or `writeFileSync`s
7
+ * content read from `entry.backupPath` INTO `entry.path` — with no
8
+ * validation that either path is one this installer could actually have
9
+ * produced. The manifest is an ordinary 0600 JSON file under the user's own
10
+ * HOME, not a signed or otherwise tamper-evident record; if it is ever
11
+ * corrupted, hand-edited, or overwritten by an unrelated bug elsewhere in
12
+ * the process (prototype pollution, a bad merge, a copy-paste from another
13
+ * user's manifest), `uninstallAgentPack` would happily `unlinkSync` or
14
+ * overwrite ANY path on disk the current user can write to — an
15
+ * arbitrary-file-delete/overwrite primitive completely disconnected from
16
+ * "what a real `sklx agent install` run actually wrote".
17
+ *
18
+ * This module closes that gap by checking every entry against the FIXED,
19
+ * finite set of relative-to-HOME suffixes the installer is capable of ever
20
+ * writing (every {@link CLIENT_NATIVE_PATHS} skill-pack path, every
21
+ * {@link AGENT_SHIM_TARGETS} shim, every {@link AGENT_HOOK_TARGETS} hook
22
+ * script + hook config file, every {@link AGENT_MCP_TARGETS} MCP config
23
+ * file) before any destructive fs call touches it. `backupPath` is checked
24
+ * separately: it must resolve under the current run's manifest/backups
25
+ * directory. An entry failing either check is never touched — the caller
26
+ * treats it as `rejected`, not `removed`/`restored`.
27
+ *
28
+ * Suffix (not full-path-prefix) matching is deliberate: `installAgentPack`
29
+ * supports a `homeDir` test-seam that relocates every target under an
30
+ * arbitrary temp directory (`agent-home-relocate.ts`), and
31
+ * `uninstallAgentPack` has no matching `homeDir` wiring (paths recorded in
32
+ * the manifest are already fully resolved at install time) — validating by
33
+ * suffix works identically in both the real-HOME production path and the
34
+ * relocated-HOME test path without needing to thread a redundant `homeDir`
35
+ * through uninstall. This still shrinks the achievable blast radius from
36
+ * "any file the process can write" down to "a file whose path happens to end
37
+ * with one of a dozen known per-harness relative locations" — a tampered
38
+ * manifest can no longer name `/etc/passwd` or `~/.ssh/id_rsa`.
39
+ *
40
+ * @module @skillsmith/core/install/agent-manifest-path-guard
41
+ */
42
+ /**
43
+ * True when `path` structurally matches one of the installer's known
44
+ * relative target locations (see module header). Normalizes via
45
+ * `path.resolve` first so a `..`-laden path can't dodge the suffix check by
46
+ * embedding traversal segments before the matched tail.
47
+ */
48
+ export declare function isAllowedManifestEntryPath(path: string): boolean;
49
+ /**
50
+ * True when `backupPath` resolves under this run's manifest backups
51
+ * directory ({@link getAgentInstallBackupsDir}). A `null` backupPath is not
52
+ * validated here — callers only invoke this when `backupPath` is non-null.
53
+ */
54
+ export declare function isAllowedManifestBackupPath(backupPath: string): boolean;
55
+ //# sourceMappingURL=agent-manifest-path-guard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-manifest-path-guard.d.ts","sourceRoot":"","sources":["../../../src/install/agent-manifest-path-guard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAsDH;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAMhE;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAIvE"}
@@ -0,0 +1,109 @@
1
+ /**
2
+ * Manifest-path validation for `uninstallAgentPack` (SMI-5456 governance
3
+ * follow-up, code review 2026-07-01).
4
+ *
5
+ * `uninstallAgentPack` reads `~/.skillsmith/agent-install/manifest.json` and,
6
+ * for every entry, either `unlinkSync`s `entry.path` or `writeFileSync`s
7
+ * content read from `entry.backupPath` INTO `entry.path` — with no
8
+ * validation that either path is one this installer could actually have
9
+ * produced. The manifest is an ordinary 0600 JSON file under the user's own
10
+ * HOME, not a signed or otherwise tamper-evident record; if it is ever
11
+ * corrupted, hand-edited, or overwritten by an unrelated bug elsewhere in
12
+ * the process (prototype pollution, a bad merge, a copy-paste from another
13
+ * user's manifest), `uninstallAgentPack` would happily `unlinkSync` or
14
+ * overwrite ANY path on disk the current user can write to — an
15
+ * arbitrary-file-delete/overwrite primitive completely disconnected from
16
+ * "what a real `sklx agent install` run actually wrote".
17
+ *
18
+ * This module closes that gap by checking every entry against the FIXED,
19
+ * finite set of relative-to-HOME suffixes the installer is capable of ever
20
+ * writing (every {@link CLIENT_NATIVE_PATHS} skill-pack path, every
21
+ * {@link AGENT_SHIM_TARGETS} shim, every {@link AGENT_HOOK_TARGETS} hook
22
+ * script + hook config file, every {@link AGENT_MCP_TARGETS} MCP config
23
+ * file) before any destructive fs call touches it. `backupPath` is checked
24
+ * separately: it must resolve under the current run's manifest/backups
25
+ * directory. An entry failing either check is never touched — the caller
26
+ * treats it as `rejected`, not `removed`/`restored`.
27
+ *
28
+ * Suffix (not full-path-prefix) matching is deliberate: `installAgentPack`
29
+ * supports a `homeDir` test-seam that relocates every target under an
30
+ * arbitrary temp directory (`agent-home-relocate.ts`), and
31
+ * `uninstallAgentPack` has no matching `homeDir` wiring (paths recorded in
32
+ * the manifest are already fully resolved at install time) — validating by
33
+ * suffix works identically in both the real-HOME production path and the
34
+ * relocated-HOME test path without needing to thread a redundant `homeDir`
35
+ * through uninstall. This still shrinks the achievable blast radius from
36
+ * "any file the process can write" down to "a file whose path happens to end
37
+ * with one of a dozen known per-harness relative locations" — a tampered
38
+ * manifest can no longer name `/etc/passwd` or `~/.ssh/id_rsa`.
39
+ *
40
+ * @module @skillsmith/core/install/agent-manifest-path-guard
41
+ */
42
+ import { homedir } from 'node:os';
43
+ import { join, relative, resolve, sep } from 'node:path';
44
+ import { AGENT_PACK_SKILL_NAME } from '../services/agent-pack/index.js';
45
+ import { AGENT_HOOK_TARGETS, AGENT_MCP_TARGETS, AGENT_SHIM_TARGETS, } from './agent-harness-targets.js';
46
+ import { getAgentInstallBackupsDir } from './agent-manifest.js';
47
+ import { CLIENT_NATIVE_PATHS } from './paths.js';
48
+ /** Relative-to-`os.homedir()` suffix for every path the installer can ever write. */
49
+ function computeAllowedPathSuffixes() {
50
+ const suffixes = new Set();
51
+ const home = homedir();
52
+ const addSuffix = (absPath) => {
53
+ const rel = relative(home, absPath);
54
+ // Skip anything that isn't actually under the real home dir (defensive —
55
+ // every constant table below is homedir()-rooted by construction, so
56
+ // this should never trigger; guards against a future table that isn't).
57
+ if (rel.startsWith('..') || rel === '')
58
+ return;
59
+ suffixes.add(rel);
60
+ };
61
+ for (const nativePath of Object.values(CLIENT_NATIVE_PATHS)) {
62
+ addSuffix(join(nativePath, AGENT_PACK_SKILL_NAME, 'SKILL.md'));
63
+ }
64
+ for (const target of Object.values(AGENT_SHIM_TARGETS)) {
65
+ if (target)
66
+ addSuffix(target.path);
67
+ }
68
+ for (const target of Object.values(AGENT_HOOK_TARGETS)) {
69
+ addSuffix(join(target.scriptDir, 'session-start.sh'));
70
+ addSuffix(join(target.scriptDir, 'session-end.sh'));
71
+ addSuffix(target.configPath);
72
+ }
73
+ for (const target of Object.values(AGENT_MCP_TARGETS)) {
74
+ addSuffix(target.path);
75
+ }
76
+ return suffixes;
77
+ }
78
+ let cachedSuffixes = null;
79
+ /** Lazily computed + cached — the target tables are static, module-load-time constants. */
80
+ function allowedPathSuffixes() {
81
+ if (!cachedSuffixes)
82
+ cachedSuffixes = computeAllowedPathSuffixes();
83
+ return cachedSuffixes;
84
+ }
85
+ /**
86
+ * True when `path` structurally matches one of the installer's known
87
+ * relative target locations (see module header). Normalizes via
88
+ * `path.resolve` first so a `..`-laden path can't dodge the suffix check by
89
+ * embedding traversal segments before the matched tail.
90
+ */
91
+ export function isAllowedManifestEntryPath(path) {
92
+ const normalized = resolve(path);
93
+ for (const suffix of allowedPathSuffixes()) {
94
+ if (normalized.endsWith(sep + suffix) || normalized === suffix)
95
+ return true;
96
+ }
97
+ return false;
98
+ }
99
+ /**
100
+ * True when `backupPath` resolves under this run's manifest backups
101
+ * directory ({@link getAgentInstallBackupsDir}). A `null` backupPath is not
102
+ * validated here — callers only invoke this when `backupPath` is non-null.
103
+ */
104
+ export function isAllowedManifestBackupPath(backupPath) {
105
+ const backupsDir = resolve(getAgentInstallBackupsDir());
106
+ const normalized = resolve(backupPath);
107
+ return normalized === backupsDir || normalized.startsWith(backupsDir + sep);
108
+ }
109
+ //# sourceMappingURL=agent-manifest-path-guard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-manifest-path-guard.js","sourceRoot":"","sources":["../../../src/install/agent-manifest-path-guard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AAExD,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAA;AACvE,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAA;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAEhD,qFAAqF;AACrF,SAAS,0BAA0B;IACjC,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAU,CAAA;IAClC,MAAM,IAAI,GAAG,OAAO,EAAE,CAAA;IAEtB,MAAM,SAAS,GAAG,CAAC,OAAe,EAAQ,EAAE;QAC1C,MAAM,GAAG,GAAG,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;QACnC,yEAAyE;QACzE,qEAAqE;QACrE,wEAAwE;QACxE,IAAI,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,GAAG,KAAK,EAAE;YAAE,OAAM;QAC9C,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IACnB,CAAC,CAAA;IAED,KAAK,MAAM,UAAU,IAAI,MAAM,CAAC,MAAM,CAAC,mBAAmB,CAAC,EAAE,CAAC;QAC5D,SAAS,CAAC,IAAI,CAAC,UAAU,EAAE,qBAAqB,EAAE,UAAU,CAAC,CAAC,CAAA;IAChE,CAAC;IACD,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC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;IACtC,OAAO,UAAU,KAAK,UAAU,IAAI,UAAU,CAAC,UAAU,CAAC,UAAU,GAAG,GAAG,CAAC,CAAA;AAC7E,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=agent-manifest-path-guard.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-manifest-path-guard.test.d.ts","sourceRoot":"","sources":["../../../src/install/agent-manifest-path-guard.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,72 @@
1
+ /**
2
+ * @fileoverview Unit tests for the manifest-path validation guard
3
+ * (SMI-5456 governance follow-up, code review 2026-07-01).
4
+ * @module @skillsmith/core/install/agent-manifest-path-guard.test
5
+ */
6
+ import { homedir } from 'node:os';
7
+ import { join } from 'node:path';
8
+ import { describe, expect, it } from 'vitest';
9
+ import { AGENT_INSTALL_DIR_ENV_VAR, getAgentInstallBackupsDir } from './agent-manifest.js';
10
+ import { isAllowedManifestBackupPath, isAllowedManifestEntryPath, } from './agent-manifest-path-guard.js';
11
+ describe('isAllowedManifestEntryPath', () => {
12
+ it('allows a real claude-code skill pack path', () => {
13
+ expect(isAllowedManifestEntryPath(join(homedir(), '.claude', 'skills', 'skillsmith-agent', 'SKILL.md'))).toBe(true);
14
+ });
15
+ it('allows a real claude-code settings.json (MCP config target)', () => {
16
+ expect(isAllowedManifestEntryPath(join(homedir(), '.claude', 'settings.json'))).toBe(true);
17
+ });
18
+ it('allows a real hermes YAML config path', () => {
19
+ expect(isAllowedManifestEntryPath(join(homedir(), '.hermes', 'config.yaml'))).toBe(true);
20
+ });
21
+ it('allows a real codex hook script path', () => {
22
+ expect(isAllowedManifestEntryPath(join(homedir(), '.codex', 'hooks', 'session-start.sh'))).toBe(true);
23
+ });
24
+ it('rejects an arbitrary sensitive path never written by the installer', () => {
25
+ expect(isAllowedManifestEntryPath('/etc/passwd')).toBe(false);
26
+ expect(isAllowedManifestEntryPath(join(homedir(), '.ssh', 'id_rsa'))).toBe(false);
27
+ });
28
+ it('rejects a path that merely CONTAINS a known suffix as a substring, not a true path segment', () => {
29
+ // "evilclaude/settings.json" is not the same path component as
30
+ // ".claude/settings.json" — must not match on naive substring search.
31
+ expect(isAllowedManifestEntryPath(join(homedir(), 'evil.claude', 'settings.json'))).toBe(false);
32
+ });
33
+ it('rejects a hand-edited traversal string that resolves outside every known harness dir', () => {
34
+ // A tampered manifest entry could embed literal ".." segments (not
35
+ // produced by `path.join`, which would normalize them away before this
36
+ // function ever sees them) — `resolve()` inside the guard must still
37
+ // collapse them and reject the resulting real path.
38
+ expect(isAllowedManifestEntryPath(`${homedir()}/../../../../etc/passwd`)).toBe(false);
39
+ });
40
+ it('rejects a bare directory that only partially matches (no filename)', () => {
41
+ expect(isAllowedManifestEntryPath(join(homedir(), '.claude', 'skills'))).toBe(false);
42
+ });
43
+ });
44
+ describe('isAllowedManifestBackupPath', () => {
45
+ it('allows a path under the current backups directory', () => {
46
+ const backupsDir = getAgentInstallBackupsDir();
47
+ expect(isAllowedManifestBackupPath(join(backupsDir, '2026-01-01-settings.json.bak'))).toBe(true);
48
+ });
49
+ it('rejects a path outside the backups directory', () => {
50
+ expect(isAllowedManifestBackupPath(join(homedir(), '.ssh', 'id_rsa'))).toBe(false);
51
+ });
52
+ it('rejects a path that only shares a string prefix with the backups dir, not a real path boundary', () => {
53
+ const backupsDir = getAgentInstallBackupsDir();
54
+ expect(isAllowedManifestBackupPath(`${backupsDir}-evil-sibling/file.bak`)).toBe(false);
55
+ });
56
+ it('respects the SKILLSMITH_AGENT_INSTALL_DIR test-isolation override', () => {
57
+ const prev = process.env[AGENT_INSTALL_DIR_ENV_VAR];
58
+ process.env[AGENT_INSTALL_DIR_ENV_VAR] = join(homedir(), '.skillsmith-test-override');
59
+ try {
60
+ const backupsDir = getAgentInstallBackupsDir();
61
+ expect(backupsDir).toContain('.skillsmith-test-override');
62
+ expect(isAllowedManifestBackupPath(join(backupsDir, 'x.bak'))).toBe(true);
63
+ }
64
+ finally {
65
+ if (prev !== undefined)
66
+ process.env[AGENT_INSTALL_DIR_ENV_VAR] = prev;
67
+ else
68
+ delete process.env[AGENT_INSTALL_DIR_ENV_VAR];
69
+ }
70
+ });
71
+ });
72
+ //# sourceMappingURL=agent-manifest-path-guard.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-manifest-path-guard.test.js","sourceRoot":"","sources":["../../../src/install/agent-manifest-path-guard.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAE7C,OAAO,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAA;AAC1F,OAAO,EACL,2BAA2B,EAC3B,0BAA0B,GAC3B,MAAM,gCAAgC,CAAA;AAEvC,QAAQ,CAAC,4BAA4B,EAAE,GAAG,EAAE;IAC1C,EAAE,CAAC,2CAA2C,EAAE,GAAG,EAAE;QACnD,MAAM,CACJ,0BAA0B,CACxB,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,kBAAkB,EAAE,UAAU,CAAC,CACrE,CACF,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACd,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,6DAA6D,EAAE,GAAG,EAAE;QACrE,MAAM,CAAC,0BAA0B,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAC5F,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,uCAAuC,EAAE,GAAG,EAAE;QAC/C,MAAM,CAAC,0BAA0B,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,I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I,IAAI,KAAK,SAAS;gBAAE,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,GAAG,IAAI,CAAA;;gBAChE,OAAO,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAA;QACpD,CAAC;IACH,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Install manifest for `sklx agent install` / `uninstall` (SMI-5456 Wave 1
3
+ * Step 5).
4
+ *
5
+ * `sklx agent uninstall` must reverse EXACTLY what install wrote — per-
6
+ * changeset file identity, not a re-derivation from the current pack
7
+ * generator (which could have changed between install and uninstall, e.g.
8
+ * across a version bump). The manifest is the durable record of every path
9
+ * the installer created or modified, plus a backup reference for anything it
10
+ * modified (so a foreign file's pre-existing content is restorable) or `null`
11
+ * for anything it created outright (so uninstall deletes rather than
12
+ * restores).
13
+ *
14
+ * Location: `~/.skillsmith/agent-install/manifest.json` — a sibling
15
+ * directory to `~/.skillsmith/journal` (Step 3) and `~/.skillsmith/agent-markers`
16
+ * (Step 1), following the same `getConfigDir()`-rooted, env-override-for-
17
+ * tests convention as both.
18
+ *
19
+ * @module @skillsmith/core/install/agent-manifest
20
+ */
21
+ /** Env var overriding the manifest directory (test isolation — mirrors SKILLSMITH_JOURNAL_DIR). */
22
+ export declare const AGENT_INSTALL_DIR_ENV_VAR = "SKILLSMITH_AGENT_INSTALL_DIR";
23
+ export declare const AGENT_MANIFEST_SCHEMA_VERSION = 1;
24
+ export type AgentManifestEntryKind = 'skill' | 'shim' | 'hook-script' | 'mcp-config' | 'hook-config';
25
+ /**
26
+ * One path the installer touched. `backupPath` is set only when a
27
+ * PRE-EXISTING file was modified (config-file merges); it is `null` for
28
+ * anything the installer created fresh (skill pack copies, shim files, hook
29
+ * scripts) since there is nothing meaningful to restore — uninstall deletes.
30
+ */
31
+ export interface AgentManifestEntry {
32
+ path: string;
33
+ kind: AgentManifestEntryKind;
34
+ /** Harness this entry belongs to, or null for the harness-neutral SKILL.md pack. */
35
+ harness: string | null;
36
+ backupPath: string | null;
37
+ /** True when the installer set the executable bit (hook scripts). */
38
+ executable: boolean;
39
+ }
40
+ export interface AgentInstallManifest {
41
+ schemaVersion: number;
42
+ installedAt: string;
43
+ /** `AGENT_PACK_SCHEMA_VERSION` at install time — informational, not enforced. */
44
+ packSchemaVersion: number;
45
+ entries: AgentManifestEntry[];
46
+ }
47
+ export declare function getAgentManifestPath(): string;
48
+ export declare function getAgentInstallBackupsDir(): string;
49
+ /** Load the manifest, or an empty (never-installed) manifest if none exists or it is corrupt. */
50
+ export declare function loadAgentManifest(): AgentInstallManifest;
51
+ /**
52
+ * Persist a manifest, replacing any prior one. Re-running install writes a
53
+ * fresh manifest reflecting the CURRENT full set of entries (deduped by
54
+ * `path` — later entries in `entries` win) so a double-install never
55
+ * accumulates duplicate entries (P-5 idempotency test).
56
+ */
57
+ export declare function saveAgentManifest(manifest: AgentInstallManifest): void;
58
+ //# sourceMappingURL=agent-manifest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-manifest.d.ts","sourceRoot":"","sources":["../../../src/install/agent-manifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAOH,mGAAmG;AACnG,eAAO,MAAM,yBAAyB,iCAAiC,CAAA;AAEvE,eAAO,MAAM,6BAA6B,IAAI,CAAA;AAE9C,MAAM,MAAM,sBAAsB,GAAG,OAAO,GAAG,MAAM,GAAG,aAAa,GAAG,YAAY,GAAG,aAAa,CAAA;AAEpG;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,sBAAsB,CAAA;IAC5B,oFAAoF;IACpF,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,qEAAqE;IACrE,UAAU,EAAE,OAAO,CAAA;CACpB;AAED,MAAM,WAAW,oBAAoB;IACnC,aAAa,EAAE,MAAM,CAAA;IACrB,WAAW,EAAE,MAAM,CAAA;IACnB,iFAAiF;IACjF,iBAAiB,EAAE,MAAM,CAAA;IACzB,OAAO,EAAE,kBAAkB,EAAE,CAAA;CAC9B;AAOD,wBAAgB,oBAAoB,IAAI,MAAM,CAE7C;AAED,wBAAgB,yBAAyB,IAAI,MAAM,CAElD;AAED,iGAAiG;AACjG,wBAAgB,iBAAiB,IAAI,oBAAoB,CAexD;AAWD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,oBAAoB,GAAG,IAAI,CAMtE"}
@@ -0,0 +1,103 @@
1
+ /**
2
+ * Install manifest for `sklx agent install` / `uninstall` (SMI-5456 Wave 1
3
+ * Step 5).
4
+ *
5
+ * `sklx agent uninstall` must reverse EXACTLY what install wrote — per-
6
+ * changeset file identity, not a re-derivation from the current pack
7
+ * generator (which could have changed between install and uninstall, e.g.
8
+ * across a version bump). The manifest is the durable record of every path
9
+ * the installer created or modified, plus a backup reference for anything it
10
+ * modified (so a foreign file's pre-existing content is restorable) or `null`
11
+ * for anything it created outright (so uninstall deletes rather than
12
+ * restores).
13
+ *
14
+ * Location: `~/.skillsmith/agent-install/manifest.json` — a sibling
15
+ * directory to `~/.skillsmith/journal` (Step 3) and `~/.skillsmith/agent-markers`
16
+ * (Step 1), following the same `getConfigDir()`-rooted, env-override-for-
17
+ * tests convention as both.
18
+ *
19
+ * @module @skillsmith/core/install/agent-manifest
20
+ */
21
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
22
+ import { join } from 'node:path';
23
+ import { getConfigDir } from '../config/index.js';
24
+ /** Env var overriding the manifest directory (test isolation — mirrors SKILLSMITH_JOURNAL_DIR). */
25
+ export const AGENT_INSTALL_DIR_ENV_VAR = 'SKILLSMITH_AGENT_INSTALL_DIR';
26
+ export const AGENT_MANIFEST_SCHEMA_VERSION = 1;
27
+ function getAgentInstallDir() {
28
+ const override = process.env[AGENT_INSTALL_DIR_ENV_VAR];
29
+ return override && override.length > 0 ? override : join(getConfigDir(), 'agent-install');
30
+ }
31
+ export function getAgentManifestPath() {
32
+ return join(getAgentInstallDir(), 'manifest.json');
33
+ }
34
+ export function getAgentInstallBackupsDir() {
35
+ return join(getAgentInstallDir(), 'backups');
36
+ }
37
+ /** Load the manifest, or an empty (never-installed) manifest if none exists or it is corrupt. */
38
+ export function loadAgentManifest() {
39
+ const path = getAgentManifestPath();
40
+ if (!existsSync(path))
41
+ return emptyManifest();
42
+ try {
43
+ const parsed = JSON.parse(readFileSync(path, 'utf-8'));
44
+ if (!parsed || !Array.isArray(parsed.entries))
45
+ return emptyManifest();
46
+ return {
47
+ schemaVersion: parsed.schemaVersion ?? AGENT_MANIFEST_SCHEMA_VERSION,
48
+ installedAt: parsed.installedAt ?? new Date(0).toISOString(),
49
+ packSchemaVersion: parsed.packSchemaVersion ?? 0,
50
+ entries: parsed.entries,
51
+ };
52
+ }
53
+ catch {
54
+ return emptyManifest();
55
+ }
56
+ }
57
+ function emptyManifest() {
58
+ return {
59
+ schemaVersion: AGENT_MANIFEST_SCHEMA_VERSION,
60
+ installedAt: new Date(0).toISOString(),
61
+ packSchemaVersion: 0,
62
+ entries: [],
63
+ };
64
+ }
65
+ /**
66
+ * Persist a manifest, replacing any prior one. Re-running install writes a
67
+ * fresh manifest reflecting the CURRENT full set of entries (deduped by
68
+ * `path` — later entries in `entries` win) so a double-install never
69
+ * accumulates duplicate entries (P-5 idempotency test).
70
+ */
71
+ export function saveAgentManifest(manifest) {
72
+ const dir = getAgentInstallDir();
73
+ mkdirSync(dir, { recursive: true, mode: 0o700 });
74
+ const deduped = dedupeEntriesByPath(manifest.entries);
75
+ const toWrite = { ...manifest, entries: deduped };
76
+ writeFileSync(getAgentManifestPath(), JSON.stringify(toWrite, null, 2) + '\n', { mode: 0o600 });
77
+ }
78
+ /**
79
+ * Dedupe by `path`, keeping the LAST entry's `kind`/`harness`/`executable`
80
+ * (the most recent write's classification) but preserving a non-null
81
+ * `backupPath` from ANY entry for that path.
82
+ *
83
+ * A single install run can merge into the same shared config file more than
84
+ * once (claude-code's SessionStart/SessionEnd hooks AND its MCP
85
+ * registration all touch `~/.claude/settings.json`) — only the FIRST merge
86
+ * into that file takes a real backup of the genuine pre-install content
87
+ * (`agent-config-merge.types.ts`'s `alreadyBackedUpPaths`); every
88
+ * subsequent merge into the same path this run correctly reports
89
+ * `backupPath: null` (nothing new to back up). A naive "last entry wins"
90
+ * dedupe would silently drop that first, load-bearing backup reference —
91
+ * `uninstallAgentPack` would then treat a modified pre-existing file as
92
+ * "created fresh" and delete it instead of restoring it.
93
+ */
94
+ function dedupeEntriesByPath(entries) {
95
+ const byPath = new Map();
96
+ for (const entry of entries) {
97
+ const prior = byPath.get(entry.path);
98
+ const backupPath = entry.backupPath ?? prior?.backupPath ?? null;
99
+ byPath.set(entry.path, { ...entry, backupPath });
100
+ }
101
+ return [...byPath.values()];
102
+ }
103
+ //# sourceMappingURL=agent-manifest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-manifest.js","sourceRoot":"","sources":["../../../src/install/agent-manifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAC5E,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEjD,mGAAmG;AACnG,MAAM,CAAC,MAAM,yBAAyB,GAAG,8BAA8B,CAAA;AAEvE,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,CAAA;AA4B9C,SAAS,kBAAkB;IACzB,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAA;IACvD,OAAO,QAAQ,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,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QAA8B;IAC9D,MAAM,GAAG,GAAG,kBAAkB,EAAE,CAAA;IAChC,SAAS,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAA;IAChD,MAAM,OAAO,GAAG,mBAAmB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;IACrD,MAAM,OAAO,GAAyB,EAAE,GAAG,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,CAAA;IACvE,aAAa,CAAC,oBAAoB,EAAE,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAA;AACjG,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,SAAS,mBAAmB,CAAC,OAAsC;IACjE,MAAM,MAAM,GAAG,IAAI,GAAG,EAA8B,CAAA;IACpD,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC5B,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QACpC,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,IAAI,KAAK,EAAE,UAAU,IAAI,IAAI,CAAA;QAChE,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,GAAG,KAAK,EAAE,UAAU,EAAE,CAAC,CAAA;IAClD,CAAC;IACD,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,CAAA;AAC7B,CAAC"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * `sklx agent install` core orchestration (SMI-5456 Wave 1 Step 5).
3
+ *
4
+ * Generates the pack via `generateAgentPack({ toolProfile: AGENT_TOOL_PROFILE_NAMES })`
5
+ * (QD-2: byte-identical to the committed `packages/mcp-server/src/assets/agent-pack/`
6
+ * tree by determinism, never read from the mcp-server package) and writes:
7
+ * - SKILL.md to the mandatory dual path (claude-code + agents) plus any
8
+ * detected Tier-2/3 harness with its own native skill directory
9
+ * (opencode, hermes, windsurf).
10
+ * - Named-agent shims for every detected harness with a shim target
11
+ * (claude-code always; copilot, opencode when detected; codex via its
12
+ * own TOML-merge "shim").
13
+ * - SessionStart/SessionEnd hooks (+x) for claude-code (always), cursor
14
+ * and codex when detected — hook CONFIG wiring ships for claude-code/
15
+ * cursor (JSON arrays) and codex (SessionStart ONLY, as a
16
+ * marker-delimited `[[hooks.SessionStart]]` TOML block; Codex has no
17
+ * SessionEnd event and its Stop event is per-turn — see
18
+ * `installCodexHooks` in `agent-pack-installer.harness.ts`).
19
+ * - The `skillsmith` MCP server registration (`SKILLSMITH_TOOL_PROFILE=agent`)
20
+ * for every detected MCP-capable harness (all 7), backup-first,
21
+ * idempotent, preserve-and-prompt on a foreign entry.
22
+ *
23
+ * Every write funnels through `writeOwnedArtifactFile` (owned files) or the
24
+ * `agent-config-merge.*` helpers (shared config files), both of which record
25
+ * a manifest entry — `uninstallAgentPack` (SMI-5456) reverses exactly what
26
+ * this function wrote by replaying that manifest, never by re-deriving
27
+ * "what the current generator would produce".
28
+ *
29
+ * @module @skillsmith/core/install/agent-pack-installer
30
+ */
31
+ import { loadAgentManifest } from './agent-manifest.js';
32
+ import { type AgentInstallOptions, type AgentInstallResult } from './agent-pack-installer.types.js';
33
+ /**
34
+ * Detect + install the portable Skillsmith Agent pack across every
35
+ * supported harness. See module header for the full per-harness matrix.
36
+ */
37
+ export declare function installAgentPack(opts?: AgentInstallOptions): AgentInstallResult;
38
+ export { loadAgentManifest };
39
+ //# sourceMappingURL=agent-pack-installer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-pack-installer.d.ts","sourceRoot":"","sources":["../../../src/install/agent-pack-installer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAWH,OAAO,EAGL,iBAAiB,EAGlB,MAAM,qBAAqB,CAAA;AAS5B,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EAExB,MAAM,iCAAiC,CAAA;AA4FxC;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,GAAE,mBAAwB,GAAG,kBAAkB,CA6HnF;AAGD,OAAO,EAAE,iBAAiB,EAAE,CAAA"}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Entry-value builders for `sklx agent install` (SMI-5456 Wave 1 Step 5).
3
+ *
4
+ * Pure functions producing the exact MCP-server registration value + the
5
+ * Codex TOML blocks the installer merges in. Separated from the
6
+ * orchestrator so the "what do we install" shape is independently testable
7
+ * from "where do we write it".
8
+ *
9
+ * @module @skillsmith/core/install/agent-pack-installer.entry
10
+ */
11
+ /**
12
+ * The `skillsmith` MCP server registration value for `mcpServers`-convention
13
+ * harnesses (claude-code, cursor, copilot, windsurf; hermes uses the same
14
+ * field names under YAML). OpenCode does NOT use this shape — see
15
+ * {@link buildOpenCodeMcpEntryValue}.
16
+ */
17
+ export declare function buildAgentMcpEntryValue(): Record<string, unknown>;
18
+ /**
19
+ * OpenCode's `mcp`-key entry value (Step-6 verified against
20
+ * opencode.ai/docs/mcp-servers/): entries are typed `local|remote`,
21
+ * `command` is an ARRAY (command + args combined), and the env-var field is
22
+ * named `environment`, not `env`. Writing the generic mcpServers shape here
23
+ * would produce an entry OpenCode's config schema rejects.
24
+ */
25
+ export declare function buildOpenCodeMcpEntryValue(): Record<string, unknown>;
26
+ /** Codex `[mcp_servers.skillsmith]` TOML block (text between our markers). */
27
+ export declare function buildCodexMcpTomlBlock(): string;
28
+ /** Regex matching a bare (non-marker-delimited) `[mcp_servers.skillsmith]` table header. */
29
+ export declare const CODEX_MCP_FOREIGN_HEADER: RegExp;
30
+ /** Regex matching a bare (non-marker-delimited) `[agents.skillsmith-agent]` table header. */
31
+ export declare const CODEX_AGENTS_FOREIGN_HEADER: RegExp;
32
+ /**
33
+ * Codex `[[hooks.SessionStart]]` TOML block (text between our markers) —
34
+ * shape verified by the Step-6 eval worker against
35
+ * developers.openai.com/codex/hooks: inline array-of-tables
36
+ * `[[hooks.SessionStart]]` with a nested `[[hooks.SessionStart.hooks]]`
37
+ * array carrying `{type, command, timeout, statusMessage}`. Only `type` +
38
+ * `command` are emitted (timeout/statusMessage stay at Codex defaults).
39
+ * `JSON.stringify` produces a valid TOML basic string for the absolute
40
+ * script path — same quoting convention as `renderCodexToml` (shims.ts).
41
+ */
42
+ export declare function buildCodexSessionStartHookBlock(sessionStartScriptPath: string): string;
43
+ /**
44
+ * Regex matching a SINGLE-bracket `[hooks.SessionStart]` table header — a
45
+ * user config that defined `hooks.SessionStart` as a plain TABLE. Appending
46
+ * our `[[hooks.SessionStart]]` array-of-tables entry to such a file would
47
+ * produce INVALID TOML (a key cannot be both a table and an array of
48
+ * tables), so that is the genuine-conflict case. A foreign DOUBLE-bracket
49
+ * `[[hooks.SessionStart]]` (the user's own hook) is deliberately NOT
50
+ * matched: TOML permits re-opening an array of tables anywhere in the
51
+ * document, so appending our own `[[hooks.SessionStart]]` entry alongside a
52
+ * user's is valid and non-destructive — both hooks run.
53
+ */
54
+ export declare const CODEX_HOOKS_TABLE_CONFLICT_HEADER: RegExp;
55
+ //# sourceMappingURL=agent-pack-installer.entry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-pack-installer.entry.d.ts","sourceRoot":"","sources":["../../../src/install/agent-pack-installer.entry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAOH;;;;;GAKG;AACH,wBAAgB,uBAAuB,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAQjE;AAED;;;;;;GAMG;AACH,wBAAgB,0BAA0B,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CASpE;AAED,8EAA8E;AAC9E,wBAAgB,sBAAsB,IAAI,MAAM,CAS/C;AAED,4FAA4F;AAC5F,eAAO,MAAM,wBAAwB,QAAoD,CAAA;AAEzF,6FAA6F;AAC7F,eAAO,MAAM,2BAA2B,QAAqD,CAAA;AAE7F;;;;;;;;;GASG;AACH,wBAAgB,+BAA+B,CAAC,sBAAsB,EAAE,MAAM,GAAG,MAAM,CAQtF;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,iCAAiC,QAA8B,CAAA"}