@skillsmith/mcp-server 0.1.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 (306) hide show
  1. package/dist/.tsbuildinfo +1 -0
  2. package/dist/src/__tests__/get-skill.test.d.ts +6 -0
  3. package/dist/src/__tests__/get-skill.test.d.ts.map +1 -0
  4. package/dist/src/__tests__/get-skill.test.js +88 -0
  5. package/dist/src/__tests__/get-skill.test.js.map +1 -0
  6. package/dist/src/__tests__/middleware/errorFormatter.test.d.ts +7 -0
  7. package/dist/src/__tests__/middleware/errorFormatter.test.d.ts.map +1 -0
  8. package/dist/src/__tests__/middleware/errorFormatter.test.js +304 -0
  9. package/dist/src/__tests__/middleware/errorFormatter.test.js.map +1 -0
  10. package/dist/src/__tests__/middleware/license.test.d.ts +7 -0
  11. package/dist/src/__tests__/middleware/license.test.d.ts.map +1 -0
  12. package/dist/src/__tests__/middleware/license.test.js +500 -0
  13. package/dist/src/__tests__/middleware/license.test.js.map +1 -0
  14. package/dist/src/__tests__/search.test.d.ts +6 -0
  15. package/dist/src/__tests__/search.test.d.ts.map +1 -0
  16. package/dist/src/__tests__/search.test.js +86 -0
  17. package/dist/src/__tests__/search.test.js.map +1 -0
  18. package/dist/src/__tests__/test-utils.d.ts +19 -0
  19. package/dist/src/__tests__/test-utils.d.ts.map +1 -0
  20. package/dist/src/__tests__/test-utils.js +87 -0
  21. package/dist/src/__tests__/test-utils.js.map +1 -0
  22. package/dist/src/context/index.d.ts +19 -0
  23. package/dist/src/context/index.d.ts.map +1 -0
  24. package/dist/src/context/index.js +25 -0
  25. package/dist/src/context/index.js.map +1 -0
  26. package/dist/src/context/project-detector.d.ts +145 -0
  27. package/dist/src/context/project-detector.d.ts.map +1 -0
  28. package/dist/src/context/project-detector.js +321 -0
  29. package/dist/src/context/project-detector.js.map +1 -0
  30. package/dist/src/context.d.ts +100 -0
  31. package/dist/src/context.d.ts.map +1 -0
  32. package/dist/src/context.js +157 -0
  33. package/dist/src/context.js.map +1 -0
  34. package/dist/src/core-shim.d.ts +7 -0
  35. package/dist/src/core-shim.d.ts.map +1 -0
  36. package/dist/src/core-shim.js +9 -0
  37. package/dist/src/core-shim.js.map +1 -0
  38. package/dist/src/health/healthCheck.d.ts +88 -0
  39. package/dist/src/health/healthCheck.d.ts.map +1 -0
  40. package/dist/src/health/healthCheck.js +117 -0
  41. package/dist/src/health/healthCheck.js.map +1 -0
  42. package/dist/src/health/index.d.ts +21 -0
  43. package/dist/src/health/index.d.ts.map +1 -0
  44. package/dist/src/health/index.js +21 -0
  45. package/dist/src/health/index.js.map +1 -0
  46. package/dist/src/health/readinessCheck.d.ts +139 -0
  47. package/dist/src/health/readinessCheck.d.ts.map +1 -0
  48. package/dist/src/health/readinessCheck.js +266 -0
  49. package/dist/src/health/readinessCheck.js.map +1 -0
  50. package/dist/src/index.d.ts +8 -0
  51. package/dist/src/index.d.ts.map +1 -0
  52. package/dist/src/index.js +178 -0
  53. package/dist/src/index.js.map +1 -0
  54. package/dist/src/index.test.d.ts +2 -0
  55. package/dist/src/index.test.d.ts.map +1 -0
  56. package/dist/src/index.test.js +43 -0
  57. package/dist/src/index.test.js.map +1 -0
  58. package/dist/src/logger.d.ts +26 -0
  59. package/dist/src/logger.d.ts.map +1 -0
  60. package/dist/src/logger.js +179 -0
  61. package/dist/src/logger.js.map +1 -0
  62. package/dist/src/middleware/__tests__/csp.test.d.ts +2 -0
  63. package/dist/src/middleware/__tests__/csp.test.d.ts.map +1 -0
  64. package/dist/src/middleware/__tests__/csp.test.js +389 -0
  65. package/dist/src/middleware/__tests__/csp.test.js.map +1 -0
  66. package/dist/src/middleware/csp.d.ts +87 -0
  67. package/dist/src/middleware/csp.d.ts.map +1 -0
  68. package/dist/src/middleware/csp.js +273 -0
  69. package/dist/src/middleware/csp.js.map +1 -0
  70. package/dist/src/middleware/degradation.d.ts +99 -0
  71. package/dist/src/middleware/degradation.d.ts.map +1 -0
  72. package/dist/src/middleware/degradation.js +315 -0
  73. package/dist/src/middleware/degradation.js.map +1 -0
  74. package/dist/src/middleware/errorFormatter.d.ts +119 -0
  75. package/dist/src/middleware/errorFormatter.d.ts.map +1 -0
  76. package/dist/src/middleware/errorFormatter.js +294 -0
  77. package/dist/src/middleware/errorFormatter.js.map +1 -0
  78. package/dist/src/middleware/index.d.ts +10 -0
  79. package/dist/src/middleware/index.d.ts.map +1 -0
  80. package/dist/src/middleware/index.js +14 -0
  81. package/dist/src/middleware/index.js.map +1 -0
  82. package/dist/src/middleware/license.d.ts +161 -0
  83. package/dist/src/middleware/license.d.ts.map +1 -0
  84. package/dist/src/middleware/license.js +281 -0
  85. package/dist/src/middleware/license.js.map +1 -0
  86. package/dist/src/middleware/toolFeatureMapping.d.ts +36 -0
  87. package/dist/src/middleware/toolFeatureMapping.d.ts.map +1 -0
  88. package/dist/src/middleware/toolFeatureMapping.js +90 -0
  89. package/dist/src/middleware/toolFeatureMapping.js.map +1 -0
  90. package/dist/src/onboarding/first-run.d.ts +64 -0
  91. package/dist/src/onboarding/first-run.d.ts.map +1 -0
  92. package/dist/src/onboarding/first-run.js +77 -0
  93. package/dist/src/onboarding/first-run.js.map +1 -0
  94. package/dist/src/onboarding/index.d.ts +7 -0
  95. package/dist/src/onboarding/index.d.ts.map +1 -0
  96. package/dist/src/onboarding/index.js +7 -0
  97. package/dist/src/onboarding/index.js.map +1 -0
  98. package/dist/src/suggestions/index.d.ts +21 -0
  99. package/dist/src/suggestions/index.d.ts.map +1 -0
  100. package/dist/src/suggestions/index.js +20 -0
  101. package/dist/src/suggestions/index.js.map +1 -0
  102. package/dist/src/suggestions/suggestion-engine.d.ts +185 -0
  103. package/dist/src/suggestions/suggestion-engine.d.ts.map +1 -0
  104. package/dist/src/suggestions/suggestion-engine.js +352 -0
  105. package/dist/src/suggestions/suggestion-engine.js.map +1 -0
  106. package/dist/src/suggestions/types.d.ts +88 -0
  107. package/dist/src/suggestions/types.d.ts.map +1 -0
  108. package/dist/src/suggestions/types.js +21 -0
  109. package/dist/src/suggestions/types.js.map +1 -0
  110. package/dist/src/tools/analyze.d.ts +151 -0
  111. package/dist/src/tools/analyze.d.ts.map +1 -0
  112. package/dist/src/tools/analyze.js +205 -0
  113. package/dist/src/tools/analyze.js.map +1 -0
  114. package/dist/src/tools/compare.d.ts +149 -0
  115. package/dist/src/tools/compare.d.ts.map +1 -0
  116. package/dist/src/tools/compare.js +464 -0
  117. package/dist/src/tools/compare.js.map +1 -0
  118. package/dist/src/tools/get-skill.d.ts +116 -0
  119. package/dist/src/tools/get-skill.d.ts.map +1 -0
  120. package/dist/src/tools/get-skill.js +224 -0
  121. package/dist/src/tools/get-skill.js.map +1 -0
  122. package/dist/src/tools/index.d.ts +20 -0
  123. package/dist/src/tools/index.d.ts.map +1 -0
  124. package/dist/src/tools/index.js +20 -0
  125. package/dist/src/tools/index.js.map +1 -0
  126. package/dist/src/tools/install.d.ts +122 -0
  127. package/dist/src/tools/install.d.ts.map +1 -0
  128. package/dist/src/tools/install.js +314 -0
  129. package/dist/src/tools/install.js.map +1 -0
  130. package/dist/src/tools/recommend.d.ts +171 -0
  131. package/dist/src/tools/recommend.d.ts.map +1 -0
  132. package/dist/src/tools/recommend.js +325 -0
  133. package/dist/src/tools/recommend.js.map +1 -0
  134. package/dist/src/tools/search.d.ts +121 -0
  135. package/dist/src/tools/search.d.ts.map +1 -0
  136. package/dist/src/tools/search.js +249 -0
  137. package/dist/src/tools/search.js.map +1 -0
  138. package/dist/src/tools/suggest.d.ts +181 -0
  139. package/dist/src/tools/suggest.d.ts.map +1 -0
  140. package/dist/src/tools/suggest.js +342 -0
  141. package/dist/src/tools/suggest.js.map +1 -0
  142. package/dist/src/tools/uninstall.d.ts +123 -0
  143. package/dist/src/tools/uninstall.d.ts.map +1 -0
  144. package/dist/src/tools/uninstall.js +250 -0
  145. package/dist/src/tools/uninstall.js.map +1 -0
  146. package/dist/src/tools/validate.d.ts +122 -0
  147. package/dist/src/tools/validate.d.ts.map +1 -0
  148. package/dist/src/tools/validate.js +497 -0
  149. package/dist/src/tools/validate.js.map +1 -0
  150. package/dist/src/utils/installed-skills.d.ts +101 -0
  151. package/dist/src/utils/installed-skills.d.ts.map +1 -0
  152. package/dist/src/utils/installed-skills.js +220 -0
  153. package/dist/src/utils/installed-skills.js.map +1 -0
  154. package/dist/src/utils/validation.d.ts +76 -0
  155. package/dist/src/utils/validation.d.ts.map +1 -0
  156. package/dist/src/utils/validation.js +153 -0
  157. package/dist/src/utils/validation.js.map +1 -0
  158. package/dist/src/webhooks/index.d.ts +8 -0
  159. package/dist/src/webhooks/index.d.ts.map +1 -0
  160. package/dist/src/webhooks/index.js +9 -0
  161. package/dist/src/webhooks/index.js.map +1 -0
  162. package/dist/src/webhooks/webhook-endpoint.d.ts +149 -0
  163. package/dist/src/webhooks/webhook-endpoint.d.ts.map +1 -0
  164. package/dist/src/webhooks/webhook-endpoint.js +339 -0
  165. package/dist/src/webhooks/webhook-endpoint.js.map +1 -0
  166. package/dist/tests/compare.test.d.ts +6 -0
  167. package/dist/tests/compare.test.d.ts.map +1 -0
  168. package/dist/tests/compare.test.js +225 -0
  169. package/dist/tests/compare.test.js.map +1 -0
  170. package/dist/tests/context/project-detector.test.d.ts +6 -0
  171. package/dist/tests/context/project-detector.test.d.ts.map +1 -0
  172. package/dist/tests/context/project-detector.test.js +719 -0
  173. package/dist/tests/context/project-detector.test.js.map +1 -0
  174. package/dist/tests/e2e/compare.e2e.test.d.ts +10 -0
  175. package/dist/tests/e2e/compare.e2e.test.d.ts.map +1 -0
  176. package/dist/tests/e2e/compare.e2e.test.js +286 -0
  177. package/dist/tests/e2e/compare.e2e.test.js.map +1 -0
  178. package/dist/tests/e2e/install-flow.e2e.test.d.ts +10 -0
  179. package/dist/tests/e2e/install-flow.e2e.test.d.ts.map +1 -0
  180. package/dist/tests/e2e/install-flow.e2e.test.js +209 -0
  181. package/dist/tests/e2e/install-flow.e2e.test.js.map +1 -0
  182. package/dist/tests/e2e/recommend.e2e.test.d.ts +12 -0
  183. package/dist/tests/e2e/recommend.e2e.test.d.ts.map +1 -0
  184. package/dist/tests/e2e/recommend.e2e.test.js +347 -0
  185. package/dist/tests/e2e/recommend.e2e.test.js.map +1 -0
  186. package/dist/tests/e2e/skill-flow.e2e.test.d.ts +10 -0
  187. package/dist/tests/e2e/skill-flow.e2e.test.d.ts.map +1 -0
  188. package/dist/tests/e2e/skill-flow.e2e.test.js +280 -0
  189. package/dist/tests/e2e/skill-flow.e2e.test.js.map +1 -0
  190. package/dist/tests/e2e/suggest.e2e.test.d.ts +13 -0
  191. package/dist/tests/e2e/suggest.e2e.test.d.ts.map +1 -0
  192. package/dist/tests/e2e/suggest.e2e.test.js +347 -0
  193. package/dist/tests/e2e/suggest.e2e.test.js.map +1 -0
  194. package/dist/tests/e2e/utils/baseline-collector.d.ts +107 -0
  195. package/dist/tests/e2e/utils/baseline-collector.d.ts.map +1 -0
  196. package/dist/tests/e2e/utils/baseline-collector.js +211 -0
  197. package/dist/tests/e2e/utils/baseline-collector.js.map +1 -0
  198. package/dist/tests/e2e/utils/hardcoded-detector.d.ts +46 -0
  199. package/dist/tests/e2e/utils/hardcoded-detector.d.ts.map +1 -0
  200. package/dist/tests/e2e/utils/hardcoded-detector.js +255 -0
  201. package/dist/tests/e2e/utils/hardcoded-detector.js.map +1 -0
  202. package/dist/tests/e2e/utils/index.d.ts +7 -0
  203. package/dist/tests/e2e/utils/index.d.ts.map +1 -0
  204. package/dist/tests/e2e/utils/index.js +7 -0
  205. package/dist/tests/e2e/utils/index.js.map +1 -0
  206. package/dist/tests/e2e/utils/linear-reporter.d.ts +60 -0
  207. package/dist/tests/e2e/utils/linear-reporter.d.ts.map +1 -0
  208. package/dist/tests/e2e/utils/linear-reporter.js +232 -0
  209. package/dist/tests/e2e/utils/linear-reporter.js.map +1 -0
  210. package/dist/tests/health.test.d.ts +9 -0
  211. package/dist/tests/health.test.d.ts.map +1 -0
  212. package/dist/tests/health.test.js +308 -0
  213. package/dist/tests/health.test.js.map +1 -0
  214. package/dist/tests/integration/analyze.integration.test.d.ts +2 -0
  215. package/dist/tests/integration/analyze.integration.test.d.ts.map +1 -0
  216. package/dist/tests/integration/analyze.integration.test.js +244 -0
  217. package/dist/tests/integration/analyze.integration.test.js.map +1 -0
  218. package/dist/tests/integration/compare.integration.test.d.ts +2 -0
  219. package/dist/tests/integration/compare.integration.test.d.ts.map +1 -0
  220. package/dist/tests/integration/compare.integration.test.js +120 -0
  221. package/dist/tests/integration/compare.integration.test.js.map +1 -0
  222. package/dist/tests/integration/fixtures/test-skills.d.ts +62 -0
  223. package/dist/tests/integration/fixtures/test-skills.d.ts.map +1 -0
  224. package/dist/tests/integration/fixtures/test-skills.js +644 -0
  225. package/dist/tests/integration/fixtures/test-skills.js.map +1 -0
  226. package/dist/tests/integration/get-skill.integration.test.d.ts +6 -0
  227. package/dist/tests/integration/get-skill.integration.test.d.ts.map +1 -0
  228. package/dist/tests/integration/get-skill.integration.test.js +203 -0
  229. package/dist/tests/integration/get-skill.integration.test.js.map +1 -0
  230. package/dist/tests/integration/github-api.integration.test.d.ts +14 -0
  231. package/dist/tests/integration/github-api.integration.test.d.ts.map +1 -0
  232. package/dist/tests/integration/github-api.integration.test.js +190 -0
  233. package/dist/tests/integration/github-api.integration.test.js.map +1 -0
  234. package/dist/tests/integration/install.integration.test.d.ts +6 -0
  235. package/dist/tests/integration/install.integration.test.d.ts.map +1 -0
  236. package/dist/tests/integration/install.integration.test.js +282 -0
  237. package/dist/tests/integration/install.integration.test.js.map +1 -0
  238. package/dist/tests/integration/recommend.integration.test.d.ts +2 -0
  239. package/dist/tests/integration/recommend.integration.test.d.ts.map +1 -0
  240. package/dist/tests/integration/recommend.integration.test.js +215 -0
  241. package/dist/tests/integration/recommend.integration.test.js.map +1 -0
  242. package/dist/tests/integration/search.integration.test.d.ts +6 -0
  243. package/dist/tests/integration/search.integration.test.d.ts.map +1 -0
  244. package/dist/tests/integration/search.integration.test.js +229 -0
  245. package/dist/tests/integration/search.integration.test.js.map +1 -0
  246. package/dist/tests/integration/setup.d.ts +71 -0
  247. package/dist/tests/integration/setup.d.ts.map +1 -0
  248. package/dist/tests/integration/setup.js +124 -0
  249. package/dist/tests/integration/setup.js.map +1 -0
  250. package/dist/tests/integration/uninstall.integration.test.d.ts +6 -0
  251. package/dist/tests/integration/uninstall.integration.test.d.ts.map +1 -0
  252. package/dist/tests/integration/uninstall.integration.test.js +296 -0
  253. package/dist/tests/integration/uninstall.integration.test.js.map +1 -0
  254. package/dist/tests/integration/validate.integration.test.d.ts +2 -0
  255. package/dist/tests/integration/validate.integration.test.d.ts.map +1 -0
  256. package/dist/tests/integration/validate.integration.test.js +181 -0
  257. package/dist/tests/integration/validate.integration.test.js.map +1 -0
  258. package/dist/tests/onboarding/first-run.test.d.ts +7 -0
  259. package/dist/tests/onboarding/first-run.test.d.ts.map +1 -0
  260. package/dist/tests/onboarding/first-run.test.js +258 -0
  261. package/dist/tests/onboarding/first-run.test.js.map +1 -0
  262. package/dist/tests/performance/search-performance.test.d.ts +10 -0
  263. package/dist/tests/performance/search-performance.test.d.ts.map +1 -0
  264. package/dist/tests/performance/search-performance.test.js +218 -0
  265. package/dist/tests/performance/search-performance.test.js.map +1 -0
  266. package/dist/tests/recommend.test.d.ts +6 -0
  267. package/dist/tests/recommend.test.d.ts.map +1 -0
  268. package/dist/tests/recommend.test.js +208 -0
  269. package/dist/tests/recommend.test.js.map +1 -0
  270. package/dist/tests/suggestions/suggestion-engine.test.d.ts +6 -0
  271. package/dist/tests/suggestions/suggestion-engine.test.d.ts.map +1 -0
  272. package/dist/tests/suggestions/suggestion-engine.test.js +448 -0
  273. package/dist/tests/suggestions/suggestion-engine.test.js.map +1 -0
  274. package/dist/tests/test-utils.d.ts +74 -0
  275. package/dist/tests/test-utils.d.ts.map +1 -0
  276. package/dist/tests/test-utils.js +98 -0
  277. package/dist/tests/test-utils.js.map +1 -0
  278. package/dist/tests/tools.test.d.ts +5 -0
  279. package/dist/tests/tools.test.d.ts.map +1 -0
  280. package/dist/tests/tools.test.js +138 -0
  281. package/dist/tests/tools.test.js.map +1 -0
  282. package/dist/tests/unit/installed-skills.test.d.ts +6 -0
  283. package/dist/tests/unit/installed-skills.test.d.ts.map +1 -0
  284. package/dist/tests/unit/installed-skills.test.js +285 -0
  285. package/dist/tests/unit/installed-skills.test.js.map +1 -0
  286. package/dist/tests/unit/logger.test.d.ts +6 -0
  287. package/dist/tests/unit/logger.test.d.ts.map +1 -0
  288. package/dist/tests/unit/logger.test.js +281 -0
  289. package/dist/tests/unit/logger.test.js.map +1 -0
  290. package/dist/tests/validate.test.d.ts +5 -0
  291. package/dist/tests/validate.test.d.ts.map +1 -0
  292. package/dist/tests/validate.test.js +303 -0
  293. package/dist/tests/validate.test.js.map +1 -0
  294. package/dist/tests/webhooks/proxy-trust.security.test.d.ts +8 -0
  295. package/dist/tests/webhooks/proxy-trust.security.test.d.ts.map +1 -0
  296. package/dist/tests/webhooks/proxy-trust.security.test.js +145 -0
  297. package/dist/tests/webhooks/proxy-trust.security.test.js.map +1 -0
  298. package/dist/tests/webhooks/rate-limiter.security.test.d.ts +8 -0
  299. package/dist/tests/webhooks/rate-limiter.security.test.d.ts.map +1 -0
  300. package/dist/tests/webhooks/rate-limiter.security.test.js +122 -0
  301. package/dist/tests/webhooks/rate-limiter.security.test.js.map +1 -0
  302. package/dist/vitest.config.d.ts +6 -0
  303. package/dist/vitest.config.d.ts.map +1 -0
  304. package/dist/vitest.config.js +13 -0
  305. package/dist/vitest.config.js.map +1 -0
  306. package/package.json +63 -0
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Test utilities for MCP server tests
3
+ * @see SMI-792: Database initialization
4
+ */
5
+ import { type ToolContext } from '../context.js';
6
+ export type { ToolContext };
7
+ /**
8
+ * Create a test context with in-memory database
9
+ */
10
+ export declare function createTestContext(): ToolContext;
11
+ /**
12
+ * Seed test data into the context
13
+ */
14
+ export declare function seedTestData(context: ToolContext): void;
15
+ /**
16
+ * Create a seeded test context
17
+ */
18
+ export declare function createSeededTestContext(): ToolContext;
19
+ //# sourceMappingURL=test-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-utils.d.ts","sourceRoot":"","sources":["../../../src/__tests__/test-utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAqB,KAAK,WAAW,EAAE,MAAM,eAAe,CAAA;AAEnE,YAAY,EAAE,WAAW,EAAE,CAAA;AAE3B;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,WAAW,CAE/C;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,CAqEvD;AAED;;GAEG;AACH,wBAAgB,uBAAuB,IAAI,WAAW,CAIrD"}
@@ -0,0 +1,87 @@
1
+ /**
2
+ * Test utilities for MCP server tests
3
+ * @see SMI-792: Database initialization
4
+ */
5
+ import { createToolContext } from '../context.js';
6
+ /**
7
+ * Create a test context with in-memory database
8
+ */
9
+ export function createTestContext() {
10
+ return createToolContext({ dbPath: ':memory:' });
11
+ }
12
+ /**
13
+ * Seed test data into the context
14
+ */
15
+ export function seedTestData(context) {
16
+ const { skillRepository } = context;
17
+ // Add test skills
18
+ skillRepository.create({
19
+ id: 'anthropic/commit',
20
+ name: 'commit',
21
+ description: 'Generate semantic commit messages following conventional commits',
22
+ author: 'anthropic',
23
+ repoUrl: 'https://github.com/anthropics/claude-code-skills',
24
+ qualityScore: 0.95,
25
+ trustTier: 'verified',
26
+ tags: ['git', 'commit', 'conventional-commits', 'automation'],
27
+ });
28
+ skillRepository.create({
29
+ id: 'anthropic/review-pr',
30
+ name: 'review-pr',
31
+ description: 'Review pull requests with detailed code analysis',
32
+ author: 'anthropic',
33
+ repoUrl: 'https://github.com/anthropics/claude-code-skills-pr',
34
+ qualityScore: 0.93,
35
+ trustTier: 'verified',
36
+ tags: ['git', 'pull-request', 'code-review', 'quality'],
37
+ });
38
+ skillRepository.create({
39
+ id: 'community/jest-helper',
40
+ name: 'jest-helper',
41
+ description: 'Generate Jest test cases for React components',
42
+ author: 'community',
43
+ repoUrl: 'https://github.com/skillsmith-community/jest-helper',
44
+ qualityScore: 0.87,
45
+ trustTier: 'community',
46
+ tags: ['jest', 'testing', 'react', 'unit-tests'],
47
+ });
48
+ skillRepository.create({
49
+ id: 'community/vitest-helper',
50
+ name: 'vitest-helper',
51
+ description: 'Generate Vitest test cases with modern testing patterns',
52
+ author: 'community',
53
+ repoUrl: 'https://github.com/skillsmith-community/vitest-helper',
54
+ qualityScore: 0.85,
55
+ trustTier: 'community',
56
+ tags: ['vitest', 'testing', 'typescript', 'unit-tests'],
57
+ });
58
+ skillRepository.create({
59
+ id: 'community/docker-compose',
60
+ name: 'docker-compose',
61
+ description: 'Generate and manage Docker Compose configurations',
62
+ author: 'community',
63
+ repoUrl: 'https://github.com/skillsmith-community/docker-compose',
64
+ qualityScore: 0.84,
65
+ trustTier: 'community',
66
+ tags: ['docker', 'devops', 'containers', 'infrastructure'],
67
+ });
68
+ skillRepository.create({
69
+ id: 'community/api-docs',
70
+ name: 'api-docs',
71
+ description: 'Generate OpenAPI documentation from code',
72
+ author: 'community',
73
+ repoUrl: 'https://github.com/skillsmith-community/api-docs',
74
+ qualityScore: 0.78,
75
+ trustTier: 'experimental',
76
+ tags: ['documentation', 'openapi', 'api'],
77
+ });
78
+ }
79
+ /**
80
+ * Create a seeded test context
81
+ */
82
+ export function createSeededTestContext() {
83
+ const context = createTestContext();
84
+ seedTestData(context);
85
+ return context;
86
+ }
87
+ //# sourceMappingURL=test-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-utils.js","sourceRoot":"","sources":["../../../src/__tests__/test-utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAoB,MAAM,eAAe,CAAA;AAInE;;GAEG;AACH,MAAM,UAAU,iBAAiB;IAC/B,OAAO,iBAAiB,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAA;AAClD,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,IAAI,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,CAAC;KACxD,CAAC,CAAA;IAEF,eAAe,CAAC,MAAM,CAAC;QACrB,EAAE,EAAE,0BAA0B;QAC9B,IAAI,EAAE,gBAAgB;QACtB,WAAW,EAAE,mDAAmD;QAChE,MAAM,EAAE,WAAW;QACnB,OAAO,EAAE,wDAAwD;QACjE,YAAY,EAAE,IAAI;QAClB,SAAS,EAAE,WAAW;QACtB,IAAI,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,gBAAgB,CAAC;KAC3D,CAAC,CAAA;IAEF,eAAe,CAAC,MAAM,CAAC;QACrB,EAAE,EAAE,oBAAoB;QACxB,IAAI,EAAE,UAAU;QAChB,WAAW,EAAE,0CAA0C;QACvD,MAAM,EAAE,WAAW;QACnB,OAAO,EAAE,kDAAkD;QAC3D,YAAY,EAAE,IAAI;QAClB,SAAS,EAAE,cAAc;QACzB,IAAI,EAAE,CAAC,eAAe,EAAE,SAAS,EAAE,KAAK,CAAC;KAC1C,CAAC,CAAA;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,uBAAuB;IACrC,MAAM,OAAO,GAAG,iBAAiB,EAAE,CAAA;IACnC,YAAY,CAAC,OAAO,CAAC,CAAA;IACrB,OAAO,OAAO,CAAA;AAChB,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @fileoverview Context Detection Module Exports
3
+ * @module @skillsmith/mcp-server/context
4
+ * @see SMI-912: Project context detection for skill suggestions
5
+ *
6
+ * Re-exports all project context detection utilities for easy importing.
7
+ *
8
+ * @example
9
+ * import {
10
+ * detectProjectContext,
11
+ * getSuggestedSkills,
12
+ * ProjectContext
13
+ * } from './context';
14
+ *
15
+ * const context = detectProjectContext();
16
+ * const skills = getSuggestedSkills(context);
17
+ */
18
+ export { detectProjectContext, detectDocker, detectLinear, detectGitHub, detectTestFramework, detectApiFramework, detectNativeModules, detectLanguage, getSuggestedSkills, type ProjectContext, } from './project-detector.js';
19
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/context/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAEL,oBAAoB,EAEpB,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,cAAc,EAEd,kBAAkB,EAElB,KAAK,cAAc,GACpB,MAAM,uBAAuB,CAAA"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @fileoverview Context Detection Module Exports
3
+ * @module @skillsmith/mcp-server/context
4
+ * @see SMI-912: Project context detection for skill suggestions
5
+ *
6
+ * Re-exports all project context detection utilities for easy importing.
7
+ *
8
+ * @example
9
+ * import {
10
+ * detectProjectContext,
11
+ * getSuggestedSkills,
12
+ * ProjectContext
13
+ * } from './context';
14
+ *
15
+ * const context = detectProjectContext();
16
+ * const skills = getSuggestedSkills(context);
17
+ */
18
+ export {
19
+ // Main detection function
20
+ detectProjectContext,
21
+ // Individual detection functions
22
+ detectDocker, detectLinear, detectGitHub, detectTestFramework, detectApiFramework, detectNativeModules, detectLanguage,
23
+ // Skill suggestion helper
24
+ getSuggestedSkills, } from './project-detector.js';
25
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/context/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO;AACL,0BAA0B;AAC1B,oBAAoB;AACpB,iCAAiC;AACjC,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,cAAc;AACd,0BAA0B;AAC1B,kBAAkB,GAGnB,MAAM,uBAAuB,CAAA"}
@@ -0,0 +1,145 @@
1
+ /**
2
+ * @fileoverview Project Context Detection for Skill Suggestions
3
+ * @module @skillsmith/mcp-server/context/project-detector
4
+ * @see SMI-912: Project context detection for skill suggestions
5
+ *
6
+ * Analyzes the user's project to detect technologies, frameworks, and tools
7
+ * in use to provide contextual skill recommendations.
8
+ *
9
+ * @example
10
+ * // Detect project context for the current working directory
11
+ * const context = detectProjectContext();
12
+ *
13
+ * // Detect project context for a specific path
14
+ * const context = detectProjectContext('/path/to/project');
15
+ *
16
+ * // Use context for skill suggestions
17
+ * if (context.hasDocker) {
18
+ * suggestSkill('docker');
19
+ * }
20
+ */
21
+ /**
22
+ * Validates that a path does not escape the allowed base directory.
23
+ * Prevents path traversal attacks using sequences like '../'.
24
+ *
25
+ * @param inputPath - The path to validate (can be relative or absolute)
26
+ * @param baseDir - The allowed base directory
27
+ * @returns The resolved, sanitized absolute path
28
+ * @throws Error if the path attempts to escape the base directory
29
+ */
30
+ export declare function validatePath(inputPath: string, baseDir: string): string;
31
+ /**
32
+ * Detected project context for skill recommendations
33
+ */
34
+ export interface ProjectContext {
35
+ /** Whether project uses Docker (Dockerfile or docker-compose) */
36
+ hasDocker: boolean;
37
+ /** Whether project is connected to Linear (detected from git config) */
38
+ hasLinear: boolean;
39
+ /** Whether project is hosted on GitHub */
40
+ hasGitHub: boolean;
41
+ /** Detected test framework (jest, vitest, mocha) */
42
+ testFramework: 'jest' | 'vitest' | 'mocha' | null;
43
+ /** Detected API framework (express, fastapi, nextjs) */
44
+ apiFramework: 'express' | 'fastapi' | 'nextjs' | null;
45
+ /** Whether project uses native modules (better-sqlite3, sharp, etc.) */
46
+ hasNativeModules: boolean;
47
+ /** Detected primary language */
48
+ language: 'typescript' | 'javascript' | 'python' | null;
49
+ }
50
+ /**
51
+ * Detect complete project context from filesystem analysis
52
+ *
53
+ * @param projectPath - Path to the project directory (defaults to cwd)
54
+ * @param allowedBaseDir - Optional base directory to restrict path access (defaults to projectPath itself)
55
+ * @returns Detected project context
56
+ * @throws Error if projectPath attempts to escape the allowedBaseDir
57
+ *
58
+ * @example
59
+ * const context = detectProjectContext('/path/to/project');
60
+ * console.log(context.hasDocker); // true/false
61
+ */
62
+ export declare function detectProjectContext(projectPath?: string, allowedBaseDir?: string): ProjectContext;
63
+ /**
64
+ * Detect Docker usage in project
65
+ *
66
+ * Checks for:
67
+ * - Dockerfile
68
+ * - docker-compose.yml
69
+ * - docker-compose.yaml
70
+ *
71
+ * @param path - Project path to check
72
+ * @returns True if Docker is detected
73
+ */
74
+ export declare function detectDocker(path: string): boolean;
75
+ /**
76
+ * Detect Linear integration from git remote config
77
+ *
78
+ * Checks if any git remote references linear.app
79
+ *
80
+ * @param path - Project path to check
81
+ * @returns True if Linear integration is detected
82
+ */
83
+ export declare function detectLinear(path: string): boolean;
84
+ /**
85
+ * Detect GitHub hosting from git remote config
86
+ *
87
+ * Checks if any git remote references github.com
88
+ *
89
+ * @param path - Project path to check
90
+ * @returns True if GitHub hosting is detected
91
+ */
92
+ export declare function detectGitHub(path: string): boolean;
93
+ /**
94
+ * Detect test framework from package.json dependencies
95
+ *
96
+ * Checks for: vitest, jest, mocha (in priority order)
97
+ *
98
+ * @param path - Project path to check
99
+ * @returns Detected test framework or null
100
+ */
101
+ export declare function detectTestFramework(path: string): 'jest' | 'vitest' | 'mocha' | null;
102
+ /**
103
+ * Detect API framework from package.json or requirements.txt
104
+ *
105
+ * Checks for: next (Next.js), express (Express), fastapi (FastAPI)
106
+ *
107
+ * @param path - Project path to check
108
+ * @returns Detected API framework or null
109
+ */
110
+ export declare function detectApiFramework(path: string): 'express' | 'fastapi' | 'nextjs' | null;
111
+ /**
112
+ * Detect native module usage in package.json
113
+ *
114
+ * Checks for modules known to require native compilation:
115
+ * better-sqlite3, sharp, canvas, bcrypt, onnxruntime-node, etc.
116
+ *
117
+ * @param path - Project path to check
118
+ * @returns True if native modules are detected
119
+ */
120
+ export declare function detectNativeModules(path: string): boolean;
121
+ /**
122
+ * Detect primary programming language from project structure
123
+ *
124
+ * Detection order:
125
+ * 1. TypeScript (tsconfig.json)
126
+ * 2. JavaScript (package.json without tsconfig)
127
+ * 3. Python (requirements.txt or pyproject.toml)
128
+ *
129
+ * @param path - Project path to check
130
+ * @returns Detected language or null
131
+ */
132
+ export declare function detectLanguage(path: string): 'typescript' | 'javascript' | 'python' | null;
133
+ /**
134
+ * Get suggested skills based on project context
135
+ *
136
+ * @param context - Detected project context
137
+ * @returns Array of suggested skill IDs
138
+ *
139
+ * @example
140
+ * const context = detectProjectContext();
141
+ * const suggestions = getSuggestedSkills(context);
142
+ * // ['docker', 'github-actions', 'jest-helper']
143
+ */
144
+ export declare function getSuggestedSkills(context: ProjectContext): string[];
145
+ //# sourceMappingURL=project-detector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-detector.d.ts","sourceRoot":"","sources":["../../../src/context/project-detector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAKH;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAWvE;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,iEAAiE;IACjE,SAAS,EAAE,OAAO,CAAA;IAClB,wEAAwE;IACxE,SAAS,EAAE,OAAO,CAAA;IAClB,0CAA0C;IAC1C,SAAS,EAAE,OAAO,CAAA;IAClB,oDAAoD;IACpD,aAAa,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,IAAI,CAAA;IACjD,wDAAwD;IACxD,YAAY,EAAE,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,IAAI,CAAA;IACrD,wEAAwE;IACxE,gBAAgB,EAAE,OAAO,CAAA;IACzB,gCAAgC;IAChC,QAAQ,EAAE,YAAY,GAAG,YAAY,GAAG,QAAQ,GAAG,IAAI,CAAA;CACxD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAClC,WAAW,GAAE,MAAsB,EACnC,cAAc,CAAC,EAAE,MAAM,GACtB,cAAc,CAchB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAMlD;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAelD;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAelD;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,IAAI,CAsBpF;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,IAAI,CAmDxF;AAmBD;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAiBzD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,GAAG,YAAY,GAAG,QAAQ,GAAG,IAAI,CAa1F;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,cAAc,GAAG,MAAM,EAAE,CA2CpE"}
@@ -0,0 +1,321 @@
1
+ /**
2
+ * @fileoverview Project Context Detection for Skill Suggestions
3
+ * @module @skillsmith/mcp-server/context/project-detector
4
+ * @see SMI-912: Project context detection for skill suggestions
5
+ *
6
+ * Analyzes the user's project to detect technologies, frameworks, and tools
7
+ * in use to provide contextual skill recommendations.
8
+ *
9
+ * @example
10
+ * // Detect project context for the current working directory
11
+ * const context = detectProjectContext();
12
+ *
13
+ * // Detect project context for a specific path
14
+ * const context = detectProjectContext('/path/to/project');
15
+ *
16
+ * // Use context for skill suggestions
17
+ * if (context.hasDocker) {
18
+ * suggestSkill('docker');
19
+ * }
20
+ */
21
+ import { existsSync, readFileSync } from 'fs';
22
+ import { join, resolve, isAbsolute } from 'path';
23
+ /**
24
+ * Validates that a path does not escape the allowed base directory.
25
+ * Prevents path traversal attacks using sequences like '../'.
26
+ *
27
+ * @param inputPath - The path to validate (can be relative or absolute)
28
+ * @param baseDir - The allowed base directory
29
+ * @returns The resolved, sanitized absolute path
30
+ * @throws Error if the path attempts to escape the base directory
31
+ */
32
+ export function validatePath(inputPath, baseDir) {
33
+ const resolvedBase = resolve(baseDir);
34
+ const resolvedPath = isAbsolute(inputPath) ? resolve(inputPath) : resolve(baseDir, inputPath);
35
+ // Ensure the resolved path starts with the base directory
36
+ // Add path separator to prevent partial matches (e.g., /base vs /base-other)
37
+ if (!resolvedPath.startsWith(resolvedBase + '/') && resolvedPath !== resolvedBase) {
38
+ throw new Error(`Path traversal attempt detected: ${inputPath}`);
39
+ }
40
+ return resolvedPath;
41
+ }
42
+ /**
43
+ * Detect complete project context from filesystem analysis
44
+ *
45
+ * @param projectPath - Path to the project directory (defaults to cwd)
46
+ * @param allowedBaseDir - Optional base directory to restrict path access (defaults to projectPath itself)
47
+ * @returns Detected project context
48
+ * @throws Error if projectPath attempts to escape the allowedBaseDir
49
+ *
50
+ * @example
51
+ * const context = detectProjectContext('/path/to/project');
52
+ * console.log(context.hasDocker); // true/false
53
+ */
54
+ export function detectProjectContext(projectPath = process.cwd(), allowedBaseDir) {
55
+ // Validate path to prevent traversal attacks
56
+ const baseDir = allowedBaseDir ?? projectPath;
57
+ const validatedPath = validatePath(projectPath, baseDir);
58
+ return {
59
+ hasDocker: detectDocker(validatedPath),
60
+ hasLinear: detectLinear(validatedPath),
61
+ hasGitHub: detectGitHub(validatedPath),
62
+ testFramework: detectTestFramework(validatedPath),
63
+ apiFramework: detectApiFramework(validatedPath),
64
+ hasNativeModules: detectNativeModules(validatedPath),
65
+ language: detectLanguage(validatedPath),
66
+ };
67
+ }
68
+ /**
69
+ * Detect Docker usage in project
70
+ *
71
+ * Checks for:
72
+ * - Dockerfile
73
+ * - docker-compose.yml
74
+ * - docker-compose.yaml
75
+ *
76
+ * @param path - Project path to check
77
+ * @returns True if Docker is detected
78
+ */
79
+ export function detectDocker(path) {
80
+ return (existsSync(join(path, 'Dockerfile')) ||
81
+ existsSync(join(path, 'docker-compose.yml')) ||
82
+ existsSync(join(path, 'docker-compose.yaml')));
83
+ }
84
+ /**
85
+ * Detect Linear integration from git remote config
86
+ *
87
+ * Checks if any git remote references linear.app
88
+ *
89
+ * @param path - Project path to check
90
+ * @returns True if Linear integration is detected
91
+ */
92
+ export function detectLinear(path) {
93
+ const gitConfig = join(path, '.git', 'config');
94
+ if (!existsSync(gitConfig))
95
+ return false;
96
+ try {
97
+ const content = readFileSync(gitConfig, 'utf-8');
98
+ return content.includes('linear.app');
99
+ }
100
+ catch (error) {
101
+ console.warn('[project-detector] Failed to read git config for Linear detection:', gitConfig, error instanceof Error ? error.message : String(error));
102
+ return false;
103
+ }
104
+ }
105
+ /**
106
+ * Detect GitHub hosting from git remote config
107
+ *
108
+ * Checks if any git remote references github.com
109
+ *
110
+ * @param path - Project path to check
111
+ * @returns True if GitHub hosting is detected
112
+ */
113
+ export function detectGitHub(path) {
114
+ const gitConfig = join(path, '.git', 'config');
115
+ if (!existsSync(gitConfig))
116
+ return false;
117
+ try {
118
+ const content = readFileSync(gitConfig, 'utf-8');
119
+ return content.includes('github.com');
120
+ }
121
+ catch (error) {
122
+ console.warn('[project-detector] Failed to read git config for GitHub detection:', gitConfig, error instanceof Error ? error.message : String(error));
123
+ return false;
124
+ }
125
+ }
126
+ /**
127
+ * Detect test framework from package.json dependencies
128
+ *
129
+ * Checks for: vitest, jest, mocha (in priority order)
130
+ *
131
+ * @param path - Project path to check
132
+ * @returns Detected test framework or null
133
+ */
134
+ export function detectTestFramework(path) {
135
+ const pkgPath = join(path, 'package.json');
136
+ if (!existsSync(pkgPath))
137
+ return null;
138
+ try {
139
+ const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'));
140
+ const deps = { ...pkg.dependencies, ...pkg.devDependencies };
141
+ // Check in priority order (vitest is preferred over jest)
142
+ if (deps['vitest'])
143
+ return 'vitest';
144
+ if (deps['jest'])
145
+ return 'jest';
146
+ if (deps['mocha'])
147
+ return 'mocha';
148
+ }
149
+ catch (error) {
150
+ console.warn('[project-detector] Failed to parse package.json for test framework detection:', pkgPath, error instanceof Error ? error.message : String(error));
151
+ return null;
152
+ }
153
+ return null;
154
+ }
155
+ /**
156
+ * Detect API framework from package.json or requirements.txt
157
+ *
158
+ * Checks for: next (Next.js), express (Express), fastapi (FastAPI)
159
+ *
160
+ * @param path - Project path to check
161
+ * @returns Detected API framework or null
162
+ */
163
+ export function detectApiFramework(path) {
164
+ // Check Node.js frameworks first
165
+ const pkgPath = join(path, 'package.json');
166
+ if (existsSync(pkgPath)) {
167
+ try {
168
+ const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'));
169
+ const deps = { ...pkg.dependencies, ...pkg.devDependencies };
170
+ // Check in priority order (Next.js is a more specific framework)
171
+ if (deps['next'])
172
+ return 'nextjs';
173
+ if (deps['express'])
174
+ return 'express';
175
+ }
176
+ catch (error) {
177
+ console.warn('[project-detector] Failed to parse package.json for API framework detection:', pkgPath, error instanceof Error ? error.message : String(error));
178
+ }
179
+ }
180
+ // Check for FastAPI (Python)
181
+ const requirementsPath = join(path, 'requirements.txt');
182
+ if (existsSync(requirementsPath)) {
183
+ try {
184
+ const content = readFileSync(requirementsPath, 'utf-8');
185
+ if (content.toLowerCase().includes('fastapi'))
186
+ return 'fastapi';
187
+ }
188
+ catch (error) {
189
+ console.warn('[project-detector] Failed to read requirements.txt:', requirementsPath, error instanceof Error ? error.message : String(error));
190
+ }
191
+ }
192
+ // Also check pyproject.toml for modern Python projects
193
+ const pyprojectPath = join(path, 'pyproject.toml');
194
+ if (existsSync(pyprojectPath)) {
195
+ try {
196
+ const content = readFileSync(pyprojectPath, 'utf-8');
197
+ if (content.toLowerCase().includes('fastapi'))
198
+ return 'fastapi';
199
+ }
200
+ catch (error) {
201
+ console.warn('[project-detector] Failed to read pyproject.toml:', pyprojectPath, error instanceof Error ? error.message : String(error));
202
+ }
203
+ }
204
+ return null;
205
+ }
206
+ /**
207
+ * Known native Node.js modules that require compilation
208
+ */
209
+ const NATIVE_MODULES = [
210
+ 'better-sqlite3',
211
+ 'sharp',
212
+ 'canvas',
213
+ 'bcrypt',
214
+ 'onnxruntime-node',
215
+ 'node-gyp',
216
+ 'node-sass',
217
+ 'sqlite3',
218
+ 'fsevents',
219
+ 'bufferutil',
220
+ 'utf-8-validate',
221
+ ];
222
+ /**
223
+ * Detect native module usage in package.json
224
+ *
225
+ * Checks for modules known to require native compilation:
226
+ * better-sqlite3, sharp, canvas, bcrypt, onnxruntime-node, etc.
227
+ *
228
+ * @param path - Project path to check
229
+ * @returns True if native modules are detected
230
+ */
231
+ export function detectNativeModules(path) {
232
+ const pkgPath = join(path, 'package.json');
233
+ if (!existsSync(pkgPath))
234
+ return false;
235
+ try {
236
+ const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'));
237
+ const deps = { ...pkg.dependencies, ...pkg.devDependencies };
238
+ return NATIVE_MODULES.some((mod) => mod in deps);
239
+ }
240
+ catch (error) {
241
+ console.warn('[project-detector] Failed to parse package.json for native module detection:', pkgPath, error instanceof Error ? error.message : String(error));
242
+ return false;
243
+ }
244
+ }
245
+ /**
246
+ * Detect primary programming language from project structure
247
+ *
248
+ * Detection order:
249
+ * 1. TypeScript (tsconfig.json)
250
+ * 2. JavaScript (package.json without tsconfig)
251
+ * 3. Python (requirements.txt or pyproject.toml)
252
+ *
253
+ * @param path - Project path to check
254
+ * @returns Detected language or null
255
+ */
256
+ export function detectLanguage(path) {
257
+ // TypeScript takes priority
258
+ if (existsSync(join(path, 'tsconfig.json')))
259
+ return 'typescript';
260
+ // JavaScript (has package.json but no tsconfig)
261
+ if (existsSync(join(path, 'package.json')))
262
+ return 'javascript';
263
+ // Python
264
+ if (existsSync(join(path, 'requirements.txt')) || existsSync(join(path, 'pyproject.toml'))) {
265
+ return 'python';
266
+ }
267
+ return null;
268
+ }
269
+ /**
270
+ * Get suggested skills based on project context
271
+ *
272
+ * @param context - Detected project context
273
+ * @returns Array of suggested skill IDs
274
+ *
275
+ * @example
276
+ * const context = detectProjectContext();
277
+ * const suggestions = getSuggestedSkills(context);
278
+ * // ['docker', 'github-actions', 'jest-helper']
279
+ */
280
+ export function getSuggestedSkills(context) {
281
+ const suggestions = [];
282
+ if (context.hasDocker) {
283
+ suggestions.push('docker');
284
+ }
285
+ if (context.hasGitHub) {
286
+ suggestions.push('github-actions');
287
+ suggestions.push('github-pr');
288
+ }
289
+ if (context.hasLinear) {
290
+ suggestions.push('linear');
291
+ }
292
+ if (context.testFramework === 'jest') {
293
+ suggestions.push('jest-helper');
294
+ }
295
+ else if (context.testFramework === 'vitest') {
296
+ suggestions.push('vitest-helper');
297
+ }
298
+ else if (context.testFramework === 'mocha') {
299
+ suggestions.push('mocha-helper');
300
+ }
301
+ if (context.apiFramework === 'nextjs') {
302
+ suggestions.push('nextjs');
303
+ }
304
+ else if (context.apiFramework === 'express') {
305
+ suggestions.push('express');
306
+ }
307
+ else if (context.apiFramework === 'fastapi') {
308
+ suggestions.push('fastapi');
309
+ }
310
+ if (context.hasNativeModules) {
311
+ suggestions.push('native-modules');
312
+ }
313
+ if (context.language === 'typescript') {
314
+ suggestions.push('typescript');
315
+ }
316
+ else if (context.language === 'python') {
317
+ suggestions.push('python');
318
+ }
319
+ return suggestions;
320
+ }
321
+ //# sourceMappingURL=project-detector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-detector.js","sourceRoot":"","sources":["../../../src/context/project-detector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,IAAI,CAAA;AAC7C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAA;AAEhD;;;;;;;;GAQG;AACH,MAAM,UAAU,YAAY,CAAC,SAAiB,EAAE,O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