gitlab-mcp-test 6.62.1

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 (615) hide show
  1. package/LICENSE +202 -0
  2. package/LICENSE.MIT +21 -0
  3. package/README.md +122 -0
  4. package/README.md.in +122 -0
  5. package/dist/generated/prisma/client.d.ts +13 -0
  6. package/dist/generated/prisma/client.js +46 -0
  7. package/dist/generated/prisma/client.js.map +1 -0
  8. package/dist/generated/prisma/commonInputTypes.d.ts +245 -0
  9. package/dist/generated/prisma/commonInputTypes.js +3 -0
  10. package/dist/generated/prisma/commonInputTypes.js.map +1 -0
  11. package/dist/generated/prisma/enums.d.ts +1 -0
  12. package/dist/generated/prisma/enums.js +3 -0
  13. package/dist/generated/prisma/enums.js.map +1 -0
  14. package/dist/generated/prisma/internal/class.d.ts +47 -0
  15. package/dist/generated/prisma/internal/class.js +75 -0
  16. package/dist/generated/prisma/internal/class.js.map +1 -0
  17. package/dist/generated/prisma/internal/prismaNamespace.d.ts +714 -0
  18. package/dist/generated/prisma/internal/prismaNamespace.js +141 -0
  19. package/dist/generated/prisma/internal/prismaNamespace.js.map +1 -0
  20. package/dist/generated/prisma/models/AuthCodeFlowState.d.ts +513 -0
  21. package/dist/generated/prisma/models/AuthCodeFlowState.js +3 -0
  22. package/dist/generated/prisma/models/AuthCodeFlowState.js.map +1 -0
  23. package/dist/generated/prisma/models/AuthorizationCode.d.ts +641 -0
  24. package/dist/generated/prisma/models/AuthorizationCode.js +3 -0
  25. package/dist/generated/prisma/models/AuthorizationCode.js.map +1 -0
  26. package/dist/generated/prisma/models/DeviceFlowState.d.ts +603 -0
  27. package/dist/generated/prisma/models/DeviceFlowState.js +3 -0
  28. package/dist/generated/prisma/models/DeviceFlowState.js.map +1 -0
  29. package/dist/generated/prisma/models/McpSessionMapping.d.ts +438 -0
  30. package/dist/generated/prisma/models/McpSessionMapping.js +3 -0
  31. package/dist/generated/prisma/models/McpSessionMapping.js.map +1 -0
  32. package/dist/generated/prisma/models/OAuthSession.d.ts +1037 -0
  33. package/dist/generated/prisma/models/OAuthSession.js +3 -0
  34. package/dist/generated/prisma/models/OAuthSession.js.map +1 -0
  35. package/dist/generated/prisma/models.d.ts +6 -0
  36. package/dist/generated/prisma/models.js +3 -0
  37. package/dist/generated/prisma/models.js.map +1 -0
  38. package/dist/src/cli/docker/container-runtime.d.ts +4 -0
  39. package/dist/src/cli/docker/container-runtime.js +85 -0
  40. package/dist/src/cli/docker/container-runtime.js.map +1 -0
  41. package/dist/src/cli/docker/docker-command.d.ts +15 -0
  42. package/dist/src/cli/docker/docker-command.js +421 -0
  43. package/dist/src/cli/docker/docker-command.js.map +1 -0
  44. package/dist/src/cli/docker/docker-utils.d.ts +25 -0
  45. package/dist/src/cli/docker/docker-utils.js +386 -0
  46. package/dist/src/cli/docker/docker-utils.js.map +1 -0
  47. package/dist/src/cli/docker/index.d.ts +4 -0
  48. package/dist/src/cli/docker/index.js +24 -0
  49. package/dist/src/cli/docker/index.js.map +1 -0
  50. package/dist/src/cli/docker/types.d.ts +83 -0
  51. package/dist/src/cli/docker/types.js +21 -0
  52. package/dist/src/cli/docker/types.js.map +1 -0
  53. package/dist/src/cli/init/browser.d.ts +7 -0
  54. package/dist/src/cli/init/browser.js +27 -0
  55. package/dist/src/cli/init/browser.js.map +1 -0
  56. package/dist/src/cli/init/config-generator.d.ts +11 -0
  57. package/dist/src/cli/init/config-generator.js +87 -0
  58. package/dist/src/cli/init/config-generator.js.map +1 -0
  59. package/dist/src/cli/init/connection.d.ts +8 -0
  60. package/dist/src/cli/init/connection.js +118 -0
  61. package/dist/src/cli/init/connection.js.map +1 -0
  62. package/dist/src/cli/init/index.d.ts +4 -0
  63. package/dist/src/cli/init/index.js +32 -0
  64. package/dist/src/cli/init/index.js.map +1 -0
  65. package/dist/src/cli/init/types.d.ts +31 -0
  66. package/dist/src/cli/init/types.js +66 -0
  67. package/dist/src/cli/init/types.js.map +1 -0
  68. package/dist/src/cli/init/wizard.d.ts +1 -0
  69. package/dist/src/cli/init/wizard.js +283 -0
  70. package/dist/src/cli/init/wizard.js.map +1 -0
  71. package/dist/src/cli/inject-tool-refs.d.ts +35 -0
  72. package/dist/src/cli/inject-tool-refs.js +261 -0
  73. package/dist/src/cli/inject-tool-refs.js.map +1 -0
  74. package/dist/src/cli/install/backup.d.ts +4 -0
  75. package/dist/src/cli/install/backup.js +63 -0
  76. package/dist/src/cli/install/backup.js.map +1 -0
  77. package/dist/src/cli/install/detector.d.ts +10 -0
  78. package/dist/src/cli/install/detector.js +133 -0
  79. package/dist/src/cli/install/detector.js.map +1 -0
  80. package/dist/src/cli/install/index.d.ts +5 -0
  81. package/dist/src/cli/install/index.js +27 -0
  82. package/dist/src/cli/install/index.js.map +1 -0
  83. package/dist/src/cli/install/install-command.d.ts +19 -0
  84. package/dist/src/cli/install/install-command.js +300 -0
  85. package/dist/src/cli/install/install-command.js.map +1 -0
  86. package/dist/src/cli/install/installers.d.ts +12 -0
  87. package/dist/src/cli/install/installers.js +439 -0
  88. package/dist/src/cli/install/installers.js.map +1 -0
  89. package/dist/src/cli/install/types.d.ts +52 -0
  90. package/dist/src/cli/install/types.js +87 -0
  91. package/dist/src/cli/install/types.js.map +1 -0
  92. package/dist/src/cli/instances/index.d.ts +2 -0
  93. package/dist/src/cli/instances/index.js +7 -0
  94. package/dist/src/cli/instances/index.js.map +1 -0
  95. package/dist/src/cli/instances/instances-command.d.ts +6 -0
  96. package/dist/src/cli/instances/instances-command.js +351 -0
  97. package/dist/src/cli/instances/instances-command.js.map +1 -0
  98. package/dist/src/cli/list-tools.d.ts +2 -0
  99. package/dist/src/cli/list-tools.js +1431 -0
  100. package/dist/src/cli/list-tools.js.map +1 -0
  101. package/dist/src/cli/setup/discovery.d.ts +3 -0
  102. package/dist/src/cli/setup/discovery.js +71 -0
  103. package/dist/src/cli/setup/discovery.js.map +1 -0
  104. package/dist/src/cli/setup/flows/configure-existing.d.ts +2 -0
  105. package/dist/src/cli/setup/flows/configure-existing.js +211 -0
  106. package/dist/src/cli/setup/flows/configure-existing.js.map +1 -0
  107. package/dist/src/cli/setup/flows/local-setup.d.ts +2 -0
  108. package/dist/src/cli/setup/flows/local-setup.js +206 -0
  109. package/dist/src/cli/setup/flows/local-setup.js.map +1 -0
  110. package/dist/src/cli/setup/flows/server-setup.d.ts +2 -0
  111. package/dist/src/cli/setup/flows/server-setup.js +185 -0
  112. package/dist/src/cli/setup/flows/server-setup.js.map +1 -0
  113. package/dist/src/cli/setup/flows/tool-selection.d.ts +3 -0
  114. package/dist/src/cli/setup/flows/tool-selection.js +275 -0
  115. package/dist/src/cli/setup/flows/tool-selection.js.map +1 -0
  116. package/dist/src/cli/setup/index.d.ts +4 -0
  117. package/dist/src/cli/setup/index.js +29 -0
  118. package/dist/src/cli/setup/index.js.map +1 -0
  119. package/dist/src/cli/setup/presets.d.ts +7 -0
  120. package/dist/src/cli/setup/presets.js +261 -0
  121. package/dist/src/cli/setup/presets.js.map +1 -0
  122. package/dist/src/cli/setup/types.d.ts +68 -0
  123. package/dist/src/cli/setup/types.js +3 -0
  124. package/dist/src/cli/setup/types.js.map +1 -0
  125. package/dist/src/cli/setup/wizard.d.ts +4 -0
  126. package/dist/src/cli/setup/wizard.js +128 -0
  127. package/dist/src/cli/setup/wizard.js.map +1 -0
  128. package/dist/src/cli/utils/index.d.ts +1 -0
  129. package/dist/src/cli/utils/index.js +6 -0
  130. package/dist/src/cli/utils/index.js.map +1 -0
  131. package/dist/src/cli/utils/path-utils.d.ts +1 -0
  132. package/dist/src/cli/utils/path-utils.js +18 -0
  133. package/dist/src/cli/utils/path-utils.js.map +1 -0
  134. package/dist/src/cli-utils.d.ts +19 -0
  135. package/dist/src/cli-utils.js +183 -0
  136. package/dist/src/cli-utils.js.map +1 -0
  137. package/dist/src/config/index.d.ts +4 -0
  138. package/dist/src/config/index.js +19 -0
  139. package/dist/src/config/index.js.map +1 -0
  140. package/dist/src/config/instances-loader.d.ts +10 -0
  141. package/dist/src/config/instances-loader.js +294 -0
  142. package/dist/src/config/instances-loader.js.map +1 -0
  143. package/dist/src/config/instances-schema.d.ts +89 -0
  144. package/dist/src/config/instances-schema.js +196 -0
  145. package/dist/src/config/instances-schema.js.map +1 -0
  146. package/dist/src/config.d.ts +82 -0
  147. package/dist/src/config.js +379 -0
  148. package/dist/src/config.js.map +1 -0
  149. package/dist/src/dashboard/handler.d.ts +4 -0
  150. package/dist/src/dashboard/handler.js +37 -0
  151. package/dist/src/dashboard/handler.js.map +1 -0
  152. package/dist/src/dashboard/html-template.d.ts +2 -0
  153. package/dist/src/dashboard/html-template.js +443 -0
  154. package/dist/src/dashboard/html-template.js.map +1 -0
  155. package/dist/src/dashboard/index.d.ts +4 -0
  156. package/dist/src/dashboard/index.js +15 -0
  157. package/dist/src/dashboard/index.js.map +1 -0
  158. package/dist/src/dashboard/metrics.d.ts +79 -0
  159. package/dist/src/dashboard/metrics.js +194 -0
  160. package/dist/src/dashboard/metrics.js.map +1 -0
  161. package/dist/src/discovery/auto.d.ts +22 -0
  162. package/dist/src/discovery/auto.js +170 -0
  163. package/dist/src/discovery/auto.js.map +1 -0
  164. package/dist/src/discovery/git-remote.d.ts +19 -0
  165. package/dist/src/discovery/git-remote.js +197 -0
  166. package/dist/src/discovery/git-remote.js.map +1 -0
  167. package/dist/src/discovery/index.d.ts +3 -0
  168. package/dist/src/discovery/index.js +16 -0
  169. package/dist/src/discovery/index.js.map +1 -0
  170. package/dist/src/discovery/profile-matcher.d.ts +8 -0
  171. package/dist/src/discovery/profile-matcher.js +48 -0
  172. package/dist/src/discovery/profile-matcher.js.map +1 -0
  173. package/dist/src/entities/context/context-manager.d.ts +31 -0
  174. package/dist/src/entities/context/context-manager.js +352 -0
  175. package/dist/src/entities/context/context-manager.js.map +1 -0
  176. package/dist/src/entities/context/handlers.d.ts +11 -0
  177. package/dist/src/entities/context/handlers.js +67 -0
  178. package/dist/src/entities/context/handlers.js.map +1 -0
  179. package/dist/src/entities/context/index.d.ts +11 -0
  180. package/dist/src/entities/context/index.js +34 -0
  181. package/dist/src/entities/context/index.js.map +1 -0
  182. package/dist/src/entities/context/registry.d.ts +5 -0
  183. package/dist/src/entities/context/registry.js +66 -0
  184. package/dist/src/entities/context/registry.js.map +1 -0
  185. package/dist/src/entities/context/schema.d.ts +60 -0
  186. package/dist/src/entities/context/schema.js +61 -0
  187. package/dist/src/entities/context/schema.js.map +1 -0
  188. package/dist/src/entities/context/types.d.ts +112 -0
  189. package/dist/src/entities/context/types.js +3 -0
  190. package/dist/src/entities/context/types.js.map +1 -0
  191. package/dist/src/entities/context/whoami.d.ts +2 -0
  192. package/dist/src/entities/context/whoami.js +267 -0
  193. package/dist/src/entities/context/whoami.js.map +1 -0
  194. package/dist/src/entities/core/index.d.ts +7 -0
  195. package/dist/src/entities/core/index.js +31 -0
  196. package/dist/src/entities/core/index.js.map +1 -0
  197. package/dist/src/entities/core/registry.d.ts +5 -0
  198. package/dist/src/entities/core/registry.js +784 -0
  199. package/dist/src/entities/core/registry.js.map +1 -0
  200. package/dist/src/entities/core/schema-readonly.d.ts +268 -0
  201. package/dist/src/entities/core/schema-readonly.js +289 -0
  202. package/dist/src/entities/core/schema-readonly.js.map +1 -0
  203. package/dist/src/entities/core/schema.d.ts +116 -0
  204. package/dist/src/entities/core/schema.js +173 -0
  205. package/dist/src/entities/core/schema.js.map +1 -0
  206. package/dist/src/entities/files/index.d.ts +7 -0
  207. package/dist/src/entities/files/index.js +31 -0
  208. package/dist/src/entities/files/index.js.map +1 -0
  209. package/dist/src/entities/files/registry.d.ts +5 -0
  210. package/dist/src/entities/files/registry.js +267 -0
  211. package/dist/src/entities/files/registry.js.map +1 -0
  212. package/dist/src/entities/files/schema-readonly.d.ts +83 -0
  213. package/dist/src/entities/files/schema-readonly.js +64 -0
  214. package/dist/src/entities/files/schema-readonly.js.map +1 -0
  215. package/dist/src/entities/files/schema.d.ts +43 -0
  216. package/dist/src/entities/files/schema.js +54 -0
  217. package/dist/src/entities/files/schema.js.map +1 -0
  218. package/dist/src/entities/index.d.ts +17 -0
  219. package/dist/src/entities/index.js +34 -0
  220. package/dist/src/entities/index.js.map +1 -0
  221. package/dist/src/entities/integrations/index.d.ts +4 -0
  222. package/dist/src/entities/integrations/index.js +21 -0
  223. package/dist/src/entities/integrations/index.js.map +1 -0
  224. package/dist/src/entities/integrations/registry.d.ts +5 -0
  225. package/dist/src/entities/integrations/registry.js +127 -0
  226. package/dist/src/entities/integrations/registry.js.map +1 -0
  227. package/dist/src/entities/integrations/schema-readonly.d.ts +63 -0
  228. package/dist/src/entities/integrations/schema-readonly.js +22 -0
  229. package/dist/src/entities/integrations/schema-readonly.js.map +1 -0
  230. package/dist/src/entities/integrations/schema.d.ts +180 -0
  231. package/dist/src/entities/integrations/schema.js +106 -0
  232. package/dist/src/entities/integrations/schema.js.map +1 -0
  233. package/dist/src/entities/iterations/index.d.ts +2 -0
  234. package/dist/src/entities/iterations/index.js +19 -0
  235. package/dist/src/entities/iterations/index.js.map +1 -0
  236. package/dist/src/entities/iterations/registry.d.ts +5 -0
  237. package/dist/src/entities/iterations/registry.js +106 -0
  238. package/dist/src/entities/iterations/registry.js.map +1 -0
  239. package/dist/src/entities/iterations/schema-readonly.d.ts +21 -0
  240. package/dist/src/entities/iterations/schema-readonly.js +28 -0
  241. package/dist/src/entities/iterations/schema-readonly.js.map +1 -0
  242. package/dist/src/entities/labels/index.d.ts +7 -0
  243. package/dist/src/entities/labels/index.js +31 -0
  244. package/dist/src/entities/labels/index.js.map +1 -0
  245. package/dist/src/entities/labels/registry.d.ts +5 -0
  246. package/dist/src/entities/labels/registry.js +131 -0
  247. package/dist/src/entities/labels/registry.js.map +1 -0
  248. package/dist/src/entities/labels/schema-readonly.d.ts +16 -0
  249. package/dist/src/entities/labels/schema-readonly.js +28 -0
  250. package/dist/src/entities/labels/schema-readonly.js.map +1 -0
  251. package/dist/src/entities/labels/schema.d.ts +23 -0
  252. package/dist/src/entities/labels/schema.js +46 -0
  253. package/dist/src/entities/labels/schema.js.map +1 -0
  254. package/dist/src/entities/members/index.d.ts +3 -0
  255. package/dist/src/entities/members/index.js +25 -0
  256. package/dist/src/entities/members/index.js.map +1 -0
  257. package/dist/src/entities/members/registry.d.ts +5 -0
  258. package/dist/src/entities/members/registry.js +224 -0
  259. package/dist/src/entities/members/registry.js.map +1 -0
  260. package/dist/src/entities/members/schema-readonly.d.ts +53 -0
  261. package/dist/src/entities/members/schema-readonly.js +79 -0
  262. package/dist/src/entities/members/schema-readonly.js.map +1 -0
  263. package/dist/src/entities/members/schema.d.ts +40 -0
  264. package/dist/src/entities/members/schema.js +80 -0
  265. package/dist/src/entities/members/schema.js.map +1 -0
  266. package/dist/src/entities/milestones/index.d.ts +7 -0
  267. package/dist/src/entities/milestones/index.js +31 -0
  268. package/dist/src/entities/milestones/index.js.map +1 -0
  269. package/dist/src/entities/milestones/registry.d.ts +5 -0
  270. package/dist/src/entities/milestones/registry.js +150 -0
  271. package/dist/src/entities/milestones/registry.js.map +1 -0
  272. package/dist/src/entities/milestones/schema-readonly.d.ts +57 -0
  273. package/dist/src/entities/milestones/schema-readonly.js +81 -0
  274. package/dist/src/entities/milestones/schema-readonly.js.map +1 -0
  275. package/dist/src/entities/milestones/schema.d.ts +30 -0
  276. package/dist/src/entities/milestones/schema.js +47 -0
  277. package/dist/src/entities/milestones/schema.js.map +1 -0
  278. package/dist/src/entities/mrs/index.d.ts +7 -0
  279. package/dist/src/entities/mrs/index.js +31 -0
  280. package/dist/src/entities/mrs/index.js.map +1 -0
  281. package/dist/src/entities/mrs/registry.d.ts +22 -0
  282. package/dist/src/entities/mrs/registry.js +495 -0
  283. package/dist/src/entities/mrs/registry.js.map +1 -0
  284. package/dist/src/entities/mrs/schema-readonly.d.ts +135 -0
  285. package/dist/src/entities/mrs/schema-readonly.js +326 -0
  286. package/dist/src/entities/mrs/schema-readonly.js.map +1 -0
  287. package/dist/src/entities/mrs/schema.d.ts +339 -0
  288. package/dist/src/entities/mrs/schema.js +259 -0
  289. package/dist/src/entities/mrs/schema.js.map +1 -0
  290. package/dist/src/entities/pipelines/index.d.ts +7 -0
  291. package/dist/src/entities/pipelines/index.js +31 -0
  292. package/dist/src/entities/pipelines/index.js.map +1 -0
  293. package/dist/src/entities/pipelines/registry.d.ts +5 -0
  294. package/dist/src/entities/pipelines/registry.js +323 -0
  295. package/dist/src/entities/pipelines/registry.js.map +1 -0
  296. package/dist/src/entities/pipelines/schema-readonly.d.ts +239 -0
  297. package/dist/src/entities/pipelines/schema-readonly.js +278 -0
  298. package/dist/src/entities/pipelines/schema-readonly.js.map +1 -0
  299. package/dist/src/entities/pipelines/schema.d.ts +47 -0
  300. package/dist/src/entities/pipelines/schema.js +73 -0
  301. package/dist/src/entities/pipelines/schema.js.map +1 -0
  302. package/dist/src/entities/refs/index.d.ts +3 -0
  303. package/dist/src/entities/refs/index.js +25 -0
  304. package/dist/src/entities/refs/index.js.map +1 -0
  305. package/dist/src/entities/refs/registry.d.ts +5 -0
  306. package/dist/src/entities/refs/registry.js +233 -0
  307. package/dist/src/entities/refs/registry.js.map +1 -0
  308. package/dist/src/entities/refs/schema-readonly.d.ts +48 -0
  309. package/dist/src/entities/refs/schema-readonly.js +76 -0
  310. package/dist/src/entities/refs/schema-readonly.js.map +1 -0
  311. package/dist/src/entities/refs/schema.d.ts +85 -0
  312. package/dist/src/entities/refs/schema.js +149 -0
  313. package/dist/src/entities/refs/schema.js.map +1 -0
  314. package/dist/src/entities/releases/index.d.ts +3 -0
  315. package/dist/src/entities/releases/index.js +13 -0
  316. package/dist/src/entities/releases/index.js.map +1 -0
  317. package/dist/src/entities/releases/registry.d.ts +5 -0
  318. package/dist/src/entities/releases/registry.js +183 -0
  319. package/dist/src/entities/releases/registry.js.map +1 -0
  320. package/dist/src/entities/releases/schema-readonly.d.ts +28 -0
  321. package/dist/src/entities/releases/schema-readonly.js +56 -0
  322. package/dist/src/entities/releases/schema-readonly.js.map +1 -0
  323. package/dist/src/entities/releases/schema.d.ts +56 -0
  324. package/dist/src/entities/releases/schema.js +97 -0
  325. package/dist/src/entities/releases/schema.js.map +1 -0
  326. package/dist/src/entities/search/index.d.ts +2 -0
  327. package/dist/src/entities/search/index.js +24 -0
  328. package/dist/src/entities/search/index.js.map +1 -0
  329. package/dist/src/entities/search/registry.d.ts +5 -0
  330. package/dist/src/entities/search/registry.js +113 -0
  331. package/dist/src/entities/search/registry.js.map +1 -0
  332. package/dist/src/entities/search/schema-readonly.d.ts +228 -0
  333. package/dist/src/entities/search/schema-readonly.js +64 -0
  334. package/dist/src/entities/search/schema-readonly.js.map +1 -0
  335. package/dist/src/entities/shared.d.ts +291 -0
  336. package/dist/src/entities/shared.js +269 -0
  337. package/dist/src/entities/shared.js.map +1 -0
  338. package/dist/src/entities/snippets/index.d.ts +7 -0
  339. package/dist/src/entities/snippets/index.js +31 -0
  340. package/dist/src/entities/snippets/index.js.map +1 -0
  341. package/dist/src/entities/snippets/registry.d.ts +5 -0
  342. package/dist/src/entities/snippets/registry.js +200 -0
  343. package/dist/src/entities/snippets/registry.js.map +1 -0
  344. package/dist/src/entities/snippets/schema-readonly.d.ts +25 -0
  345. package/dist/src/entities/snippets/schema-readonly.js +45 -0
  346. package/dist/src/entities/snippets/schema-readonly.js.map +1 -0
  347. package/dist/src/entities/snippets/schema.d.ts +56 -0
  348. package/dist/src/entities/snippets/schema.js +89 -0
  349. package/dist/src/entities/snippets/schema.js.map +1 -0
  350. package/dist/src/entities/utils.d.ts +16 -0
  351. package/dist/src/entities/utils.js +57 -0
  352. package/dist/src/entities/utils.js.map +1 -0
  353. package/dist/src/entities/variables/index.d.ts +7 -0
  354. package/dist/src/entities/variables/index.js +31 -0
  355. package/dist/src/entities/variables/index.js.map +1 -0
  356. package/dist/src/entities/variables/registry.d.ts +5 -0
  357. package/dist/src/entities/variables/registry.js +140 -0
  358. package/dist/src/entities/variables/registry.js.map +1 -0
  359. package/dist/src/entities/variables/schema-readonly.d.ts +15 -0
  360. package/dist/src/entities/variables/schema-readonly.js +33 -0
  361. package/dist/src/entities/variables/schema-readonly.js.map +1 -0
  362. package/dist/src/entities/variables/schema.d.ts +41 -0
  363. package/dist/src/entities/variables/schema.js +92 -0
  364. package/dist/src/entities/variables/schema.js.map +1 -0
  365. package/dist/src/entities/webhooks/index.d.ts +4 -0
  366. package/dist/src/entities/webhooks/index.js +21 -0
  367. package/dist/src/entities/webhooks/index.js.map +1 -0
  368. package/dist/src/entities/webhooks/registry.d.ts +5 -0
  369. package/dist/src/entities/webhooks/registry.js +162 -0
  370. package/dist/src/entities/webhooks/registry.js.map +1 -0
  371. package/dist/src/entities/webhooks/schema-readonly.d.ts +22 -0
  372. package/dist/src/entities/webhooks/schema-readonly.js +25 -0
  373. package/dist/src/entities/webhooks/schema-readonly.js.map +1 -0
  374. package/dist/src/entities/webhooks/schema.d.ts +101 -0
  375. package/dist/src/entities/webhooks/schema.js +101 -0
  376. package/dist/src/entities/webhooks/schema.js.map +1 -0
  377. package/dist/src/entities/wiki/index.d.ts +7 -0
  378. package/dist/src/entities/wiki/index.js +31 -0
  379. package/dist/src/entities/wiki/index.js.map +1 -0
  380. package/dist/src/entities/wiki/registry.d.ts +5 -0
  381. package/dist/src/entities/wiki/registry.js +127 -0
  382. package/dist/src/entities/wiki/registry.js.map +1 -0
  383. package/dist/src/entities/wiki/schema-readonly.d.ts +22 -0
  384. package/dist/src/entities/wiki/schema-readonly.js +27 -0
  385. package/dist/src/entities/wiki/schema-readonly.js.map +1 -0
  386. package/dist/src/entities/wiki/schema.d.ts +30 -0
  387. package/dist/src/entities/wiki/schema.js +38 -0
  388. package/dist/src/entities/wiki/schema.js.map +1 -0
  389. package/dist/src/entities/workitems/index.d.ts +7 -0
  390. package/dist/src/entities/workitems/index.js +31 -0
  391. package/dist/src/entities/workitems/index.js.map +1 -0
  392. package/dist/src/entities/workitems/registry.d.ts +5 -0
  393. package/dist/src/entities/workitems/registry.js +725 -0
  394. package/dist/src/entities/workitems/registry.js.map +1 -0
  395. package/dist/src/entities/workitems/schema-readonly.d.ts +49 -0
  396. package/dist/src/entities/workitems/schema-readonly.js +87 -0
  397. package/dist/src/entities/workitems/schema-readonly.js.map +1 -0
  398. package/dist/src/entities/workitems/schema.d.ts +97 -0
  399. package/dist/src/entities/workitems/schema.js +187 -0
  400. package/dist/src/entities/workitems/schema.js.map +1 -0
  401. package/dist/src/graphql/DynamicWorkItemsQuery.d.ts +56 -0
  402. package/dist/src/graphql/DynamicWorkItemsQuery.js +190 -0
  403. package/dist/src/graphql/DynamicWorkItemsQuery.js.map +1 -0
  404. package/dist/src/graphql/client.d.ts +17 -0
  405. package/dist/src/graphql/client.js +56 -0
  406. package/dist/src/graphql/client.js.map +1 -0
  407. package/dist/src/graphql/index.d.ts +2 -0
  408. package/dist/src/graphql/index.js +21 -0
  409. package/dist/src/graphql/index.js.map +1 -0
  410. package/dist/src/graphql/workItems.d.ts +659 -0
  411. package/dist/src/graphql/workItems.js +1545 -0
  412. package/dist/src/graphql/workItems.js.map +1 -0
  413. package/dist/src/handlers.d.ts +2 -0
  414. package/dist/src/handlers.js +346 -0
  415. package/dist/src/handlers.js.map +1 -0
  416. package/dist/src/http-client.d.ts +1 -0
  417. package/dist/src/http-client.js +9 -0
  418. package/dist/src/http-client.js.map +1 -0
  419. package/dist/src/logger.d.ts +9 -0
  420. package/dist/src/logger.js +129 -0
  421. package/dist/src/logger.js.map +1 -0
  422. package/dist/src/logging/access-log.d.ts +15 -0
  423. package/dist/src/logging/access-log.js +157 -0
  424. package/dist/src/logging/access-log.js.map +1 -0
  425. package/dist/src/logging/connection-tracker.d.ts +21 -0
  426. package/dist/src/logging/connection-tracker.js +106 -0
  427. package/dist/src/logging/connection-tracker.js.map +1 -0
  428. package/dist/src/logging/index.d.ts +5 -0
  429. package/dist/src/logging/index.js +27 -0
  430. package/dist/src/logging/index.js.map +1 -0
  431. package/dist/src/logging/request-tracker.d.ts +39 -0
  432. package/dist/src/logging/request-tracker.js +208 -0
  433. package/dist/src/logging/request-tracker.js.map +1 -0
  434. package/dist/src/logging/types.d.ts +55 -0
  435. package/dist/src/logging/types.js +5 -0
  436. package/dist/src/logging/types.js.map +1 -0
  437. package/dist/src/main.d.ts +2 -0
  438. package/dist/src/main.js +219 -0
  439. package/dist/src/main.js.map +1 -0
  440. package/dist/src/middleware/index.d.ts +2 -0
  441. package/dist/src/middleware/index.js +12 -0
  442. package/dist/src/middleware/index.js.map +1 -0
  443. package/dist/src/middleware/oauth-auth.d.ts +4 -0
  444. package/dist/src/middleware/oauth-auth.js +137 -0
  445. package/dist/src/middleware/oauth-auth.js.map +1 -0
  446. package/dist/src/middleware/rate-limiter.d.ts +11 -0
  447. package/dist/src/middleware/rate-limiter.js +183 -0
  448. package/dist/src/middleware/rate-limiter.js.map +1 -0
  449. package/dist/src/oauth/config.d.ts +25 -0
  450. package/dist/src/oauth/config.js +109 -0
  451. package/dist/src/oauth/config.js.map +1 -0
  452. package/dist/src/oauth/endpoints/authorize.d.ts +3 -0
  453. package/dist/src/oauth/endpoints/authorize.js +454 -0
  454. package/dist/src/oauth/endpoints/authorize.js.map +1 -0
  455. package/dist/src/oauth/endpoints/callback.d.ts +2 -0
  456. package/dist/src/oauth/endpoints/callback.js +134 -0
  457. package/dist/src/oauth/endpoints/callback.js.map +1 -0
  458. package/dist/src/oauth/endpoints/index.d.ts +5 -0
  459. package/dist/src/oauth/endpoints/index.js +19 -0
  460. package/dist/src/oauth/endpoints/index.js.map +1 -0
  461. package/dist/src/oauth/endpoints/metadata.d.ts +5 -0
  462. package/dist/src/oauth/endpoints/metadata.js +42 -0
  463. package/dist/src/oauth/endpoints/metadata.js.map +1 -0
  464. package/dist/src/oauth/endpoints/register.d.ts +15 -0
  465. package/dist/src/oauth/endpoints/register.js +85 -0
  466. package/dist/src/oauth/endpoints/register.js.map +1 -0
  467. package/dist/src/oauth/endpoints/token.d.ts +2 -0
  468. package/dist/src/oauth/endpoints/token.js +167 -0
  469. package/dist/src/oauth/endpoints/token.js.map +1 -0
  470. package/dist/src/oauth/gitlab-device-flow.d.ts +10 -0
  471. package/dist/src/oauth/gitlab-device-flow.js +215 -0
  472. package/dist/src/oauth/gitlab-device-flow.js.map +1 -0
  473. package/dist/src/oauth/index.d.ts +10 -0
  474. package/dist/src/oauth/index.js +69 -0
  475. package/dist/src/oauth/index.js.map +1 -0
  476. package/dist/src/oauth/session-store.d.ts +54 -0
  477. package/dist/src/oauth/session-store.js +311 -0
  478. package/dist/src/oauth/session-store.js.map +1 -0
  479. package/dist/src/oauth/storage/factory.d.ts +4 -0
  480. package/dist/src/oauth/storage/factory.js +73 -0
  481. package/dist/src/oauth/storage/factory.js.map +1 -0
  482. package/dist/src/oauth/storage/file.d.ts +48 -0
  483. package/dist/src/oauth/storage/file.js +307 -0
  484. package/dist/src/oauth/storage/file.js.map +1 -0
  485. package/dist/src/oauth/storage/index.d.ts +5 -0
  486. package/dist/src/oauth/storage/index.js +22 -0
  487. package/dist/src/oauth/storage/index.js.map +1 -0
  488. package/dist/src/oauth/storage/memory.d.ts +76 -0
  489. package/dist/src/oauth/storage/memory.js +280 -0
  490. package/dist/src/oauth/storage/memory.js.map +1 -0
  491. package/dist/src/oauth/storage/postgresql.d.ts +41 -0
  492. package/dist/src/oauth/storage/postgresql.js +444 -0
  493. package/dist/src/oauth/storage/postgresql.js.map +1 -0
  494. package/dist/src/oauth/storage/types.d.ts +66 -0
  495. package/dist/src/oauth/storage/types.js +5 -0
  496. package/dist/src/oauth/storage/types.js.map +1 -0
  497. package/dist/src/oauth/token-context.d.ts +10 -0
  498. package/dist/src/oauth/token-context.js +50 -0
  499. package/dist/src/oauth/token-context.js.map +1 -0
  500. package/dist/src/oauth/token-utils.d.ts +14 -0
  501. package/dist/src/oauth/token-utils.js +148 -0
  502. package/dist/src/oauth/token-utils.js.map +1 -0
  503. package/dist/src/oauth/types.d.ts +117 -0
  504. package/dist/src/oauth/types.js +3 -0
  505. package/dist/src/oauth/types.js.map +1 -0
  506. package/dist/src/profiles/applicator.d.ts +19 -0
  507. package/dist/src/profiles/applicator.js +256 -0
  508. package/dist/src/profiles/applicator.js.map +1 -0
  509. package/dist/src/profiles/builtin/admin.yaml +30 -0
  510. package/dist/src/profiles/builtin/ci.yaml +35 -0
  511. package/dist/src/profiles/builtin/code-reviewer.yaml +41 -0
  512. package/dist/src/profiles/builtin/developer.yaml +40 -0
  513. package/dist/src/profiles/builtin/devops.yaml +33 -0
  514. package/dist/src/profiles/builtin/full-access.yaml +29 -0
  515. package/dist/src/profiles/builtin/gitlab-com.yaml +40 -0
  516. package/dist/src/profiles/builtin/junior-dev.yaml +35 -0
  517. package/dist/src/profiles/builtin/pm.yaml +36 -0
  518. package/dist/src/profiles/builtin/readonly.yaml +33 -0
  519. package/dist/src/profiles/builtin/senior-dev.yaml +41 -0
  520. package/dist/src/profiles/builtin/team-lead.yaml +42 -0
  521. package/dist/src/profiles/index.d.ts +5 -0
  522. package/dist/src/profiles/index.js +34 -0
  523. package/dist/src/profiles/index.js.map +1 -0
  524. package/dist/src/profiles/loader.d.ts +32 -0
  525. package/dist/src/profiles/loader.js +319 -0
  526. package/dist/src/profiles/loader.js.map +1 -0
  527. package/dist/src/profiles/project-loader.d.ts +12 -0
  528. package/dist/src/profiles/project-loader.js +214 -0
  529. package/dist/src/profiles/project-loader.js.map +1 -0
  530. package/dist/src/profiles/scope-enforcer.d.ts +28 -0
  531. package/dist/src/profiles/scope-enforcer.js +236 -0
  532. package/dist/src/profiles/scope-enforcer.js.map +1 -0
  533. package/dist/src/profiles/types.d.ts +261 -0
  534. package/dist/src/profiles/types.js +153 -0
  535. package/dist/src/profiles/types.js.map +1 -0
  536. package/dist/src/registry-manager.d.ts +37 -0
  537. package/dist/src/registry-manager.js +488 -0
  538. package/dist/src/registry-manager.js.map +1 -0
  539. package/dist/src/server.d.ts +2 -0
  540. package/dist/src/server.js +624 -0
  541. package/dist/src/server.js.map +1 -0
  542. package/dist/src/services/ConnectionManager.d.ts +41 -0
  543. package/dist/src/services/ConnectionManager.js +438 -0
  544. package/dist/src/services/ConnectionManager.js.map +1 -0
  545. package/dist/src/services/GitLabVersionDetector.d.ts +52 -0
  546. package/dist/src/services/GitLabVersionDetector.js +215 -0
  547. package/dist/src/services/GitLabVersionDetector.js.map +1 -0
  548. package/dist/src/services/InstanceConnectionPool.d.ts +54 -0
  549. package/dist/src/services/InstanceConnectionPool.js +180 -0
  550. package/dist/src/services/InstanceConnectionPool.js.map +1 -0
  551. package/dist/src/services/InstanceRateLimiter.d.ts +35 -0
  552. package/dist/src/services/InstanceRateLimiter.js +131 -0
  553. package/dist/src/services/InstanceRateLimiter.js.map +1 -0
  554. package/dist/src/services/InstanceRegistry.d.ts +61 -0
  555. package/dist/src/services/InstanceRegistry.js +250 -0
  556. package/dist/src/services/InstanceRegistry.js.map +1 -0
  557. package/dist/src/services/NamespaceTierDetector.d.ts +9 -0
  558. package/dist/src/services/NamespaceTierDetector.js +249 -0
  559. package/dist/src/services/NamespaceTierDetector.js.map +1 -0
  560. package/dist/src/services/SchemaIntrospector.d.ts +39 -0
  561. package/dist/src/services/SchemaIntrospector.js +190 -0
  562. package/dist/src/services/SchemaIntrospector.js.map +1 -0
  563. package/dist/src/services/TokenScopeDetector.d.ts +35 -0
  564. package/dist/src/services/TokenScopeDetector.js +232 -0
  565. package/dist/src/services/TokenScopeDetector.js.map +1 -0
  566. package/dist/src/services/ToolAvailability.d.ts +32 -0
  567. package/dist/src/services/ToolAvailability.js +410 -0
  568. package/dist/src/services/ToolAvailability.js.map +1 -0
  569. package/dist/src/services/WidgetAvailability.d.ts +23 -0
  570. package/dist/src/services/WidgetAvailability.js +158 -0
  571. package/dist/src/services/WidgetAvailability.js.map +1 -0
  572. package/dist/src/session-manager.d.ts +19 -0
  573. package/dist/src/session-manager.js +131 -0
  574. package/dist/src/session-manager.js.map +1 -0
  575. package/dist/src/types.d.ts +28 -0
  576. package/dist/src/types.js +11 -0
  577. package/dist/src/types.js.map +1 -0
  578. package/dist/src/utils/description-utils.d.ts +2 -0
  579. package/dist/src/utils/description-utils.js +25 -0
  580. package/dist/src/utils/description-utils.js.map +1 -0
  581. package/dist/src/utils/error-handler.d.ts +93 -0
  582. package/dist/src/utils/error-handler.js +597 -0
  583. package/dist/src/utils/error-handler.js.map +1 -0
  584. package/dist/src/utils/fetch.d.ts +13 -0
  585. package/dist/src/utils/fetch.js +539 -0
  586. package/dist/src/utils/fetch.js.map +1 -0
  587. package/dist/src/utils/gitlab-api.d.ts +24 -0
  588. package/dist/src/utils/gitlab-api.js +139 -0
  589. package/dist/src/utils/gitlab-api.js.map +1 -0
  590. package/dist/src/utils/idConversion.d.ts +81 -0
  591. package/dist/src/utils/idConversion.js +193 -0
  592. package/dist/src/utils/idConversion.js.map +1 -0
  593. package/dist/src/utils/namespace.d.ts +7 -0
  594. package/dist/src/utils/namespace.js +59 -0
  595. package/dist/src/utils/namespace.js.map +1 -0
  596. package/dist/src/utils/projectIdentifier.d.ts +9 -0
  597. package/dist/src/utils/projectIdentifier.js +59 -0
  598. package/dist/src/utils/projectIdentifier.js.map +1 -0
  599. package/dist/src/utils/request-logger.d.ts +24 -0
  600. package/dist/src/utils/request-logger.js +55 -0
  601. package/dist/src/utils/request-logger.js.map +1 -0
  602. package/dist/src/utils/schema-utils.d.ts +31 -0
  603. package/dist/src/utils/schema-utils.js +288 -0
  604. package/dist/src/utils/schema-utils.js.map +1 -0
  605. package/dist/src/utils/smart-user-search.d.ts +33 -0
  606. package/dist/src/utils/smart-user-search.js +142 -0
  607. package/dist/src/utils/smart-user-search.js.map +1 -0
  608. package/dist/src/utils/version.d.ts +1 -0
  609. package/dist/src/utils/version.js +14 -0
  610. package/dist/src/utils/version.js.map +1 -0
  611. package/dist/src/utils/workItemTypes.d.ts +6 -0
  612. package/dist/src/utils/workItemTypes.js +14 -0
  613. package/dist/src/utils/workItemTypes.js.map +1 -0
  614. package/dist/tsconfig.build.tsbuildinfo +1 -0
  615. package/package.json +511 -0
@@ -0,0 +1,319 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.ProfileLoader = void 0;
37
+ exports.loadProfile = loadProfile;
38
+ exports.loadPreset = loadPreset;
39
+ exports.getProfileNameFromEnv = getProfileNameFromEnv;
40
+ const fs = __importStar(require("fs"));
41
+ const path = __importStar(require("path"));
42
+ const os = __importStar(require("os"));
43
+ const yaml = __importStar(require("yaml"));
44
+ const types_1 = require("./types");
45
+ const logger_1 = require("../logger");
46
+ const USER_CONFIG_DIR = path.join(os.homedir(), ".config", "gitlab-mcp");
47
+ const USER_PROFILES_PATH = path.join(USER_CONFIG_DIR, "profiles.yaml");
48
+ function getBuiltinDir() {
49
+ const candidates = [
50
+ path.join(__dirname, "builtin"),
51
+ path.join(process.cwd(), "dist", "src", "profiles", "builtin"),
52
+ path.join(process.cwd(), "src", "profiles", "builtin"),
53
+ ];
54
+ for (const dir of candidates) {
55
+ if (fs.existsSync(dir)) {
56
+ return dir;
57
+ }
58
+ }
59
+ return candidates[0];
60
+ }
61
+ class ProfileLoader {
62
+ userConfigPath;
63
+ builtinDir;
64
+ profileCache = new Map();
65
+ presetCache = new Map();
66
+ configCache = null;
67
+ constructor(userConfigPath = USER_PROFILES_PATH, builtinDir) {
68
+ this.userConfigPath = userConfigPath;
69
+ this.builtinDir = builtinDir ?? getBuiltinDir();
70
+ }
71
+ async loadProfile(name) {
72
+ const cached = this.profileCache.get(name);
73
+ if (cached) {
74
+ return cached;
75
+ }
76
+ const userProfile = await this.loadUserProfile(name);
77
+ if (userProfile) {
78
+ this.profileCache.set(name, userProfile);
79
+ return userProfile;
80
+ }
81
+ throw new Error(`Profile '${name}' not found. Full profiles must be defined in user config. ` +
82
+ `For built-in presets (settings only), use loadPreset('${name}').`);
83
+ }
84
+ async loadPreset(name) {
85
+ const cached = this.presetCache.get(name);
86
+ if (cached) {
87
+ return cached;
88
+ }
89
+ const preset = await this.loadBuiltinPreset(name);
90
+ if (preset) {
91
+ this.presetCache.set(name, preset);
92
+ return preset;
93
+ }
94
+ throw new Error(`Preset '${name}' not found in built-in presets`);
95
+ }
96
+ async loadAny(name) {
97
+ try {
98
+ const profile = await this.loadProfile(name);
99
+ return { type: "profile", data: profile };
100
+ }
101
+ catch {
102
+ }
103
+ const preset = await this.loadBuiltinPreset(name);
104
+ if (preset) {
105
+ return { type: "preset", data: preset };
106
+ }
107
+ throw new Error(`'${name}' not found as user profile or built-in preset. ` +
108
+ `Use 'yarn list-tools --profiles' to see available options.`);
109
+ }
110
+ async getDefaultProfileName() {
111
+ const config = await this.loadUserConfig();
112
+ return config?.default_profile;
113
+ }
114
+ async loadUserConfig() {
115
+ if (this.configCache !== null) {
116
+ return this.configCache;
117
+ }
118
+ if (!fs.existsSync(this.userConfigPath)) {
119
+ (0, logger_1.logDebug)("User profiles config not found", { path: this.userConfigPath });
120
+ return null;
121
+ }
122
+ try {
123
+ const content = fs.readFileSync(this.userConfigPath, "utf8");
124
+ const parsed = yaml.parse(content);
125
+ const validated = types_1.ProfilesConfigSchema.parse(parsed);
126
+ this.configCache = validated;
127
+ (0, logger_1.logDebug)("Loaded user profiles config", {
128
+ path: this.userConfigPath,
129
+ profiles: Object.keys(validated.profiles),
130
+ });
131
+ return validated;
132
+ }
133
+ catch (error) {
134
+ const message = error instanceof Error ? error.message : String(error);
135
+ (0, logger_1.logError)("Failed to parse user profiles", { error: message, path: this.userConfigPath });
136
+ throw new Error(`Invalid profiles config: ${message}`, { cause: error });
137
+ }
138
+ }
139
+ async loadUserProfile(name) {
140
+ const config = await this.loadUserConfig();
141
+ return config?.profiles[name] ?? null;
142
+ }
143
+ async loadBuiltinPreset(name) {
144
+ const presetPath = path.join(this.builtinDir, `${name}.yaml`);
145
+ if (!fs.existsSync(presetPath)) {
146
+ (0, logger_1.logDebug)("Built-in preset not found", { name, path: presetPath });
147
+ return null;
148
+ }
149
+ try {
150
+ const content = fs.readFileSync(presetPath, "utf8");
151
+ const parsed = yaml.parse(content);
152
+ const validated = types_1.PresetSchema.parse(parsed);
153
+ (0, logger_1.logDebug)("Loaded built-in preset", { name });
154
+ return validated;
155
+ }
156
+ catch (error) {
157
+ const message = error instanceof Error ? error.message : String(error);
158
+ (0, logger_1.logError)("Failed to parse built-in preset", { error: message, name });
159
+ throw new Error(`Invalid built-in preset '${name}': ${message}`, { cause: error });
160
+ }
161
+ }
162
+ async listProfiles() {
163
+ const profiles = [];
164
+ const userConfig = await this.loadUserConfig();
165
+ if (userConfig) {
166
+ for (const [name, profile] of Object.entries(userConfig.profiles)) {
167
+ profiles.push({
168
+ name,
169
+ host: profile.host,
170
+ authType: profile.auth.type,
171
+ readOnly: profile.read_only ?? false,
172
+ isBuiltIn: false,
173
+ isPreset: false,
174
+ });
175
+ }
176
+ }
177
+ if (fs.existsSync(this.builtinDir)) {
178
+ const files = fs.readdirSync(this.builtinDir).filter(f => f.endsWith(".yaml"));
179
+ for (const file of files) {
180
+ const name = path.basename(file, ".yaml");
181
+ try {
182
+ const preset = await this.loadBuiltinPreset(name);
183
+ if (preset) {
184
+ profiles.push({
185
+ name,
186
+ readOnly: preset.read_only ?? false,
187
+ isBuiltIn: true,
188
+ isPreset: true,
189
+ description: preset.description,
190
+ });
191
+ }
192
+ }
193
+ catch {
194
+ (0, logger_1.logWarn)("Skipping invalid built-in preset", { name });
195
+ }
196
+ }
197
+ }
198
+ return profiles.sort((a, b) => {
199
+ if (a.isPreset !== b.isPreset) {
200
+ return a.isPreset ? 1 : -1;
201
+ }
202
+ return a.name.localeCompare(b.name);
203
+ });
204
+ }
205
+ validateDeniedActions(deniedActions, errors, warnings) {
206
+ if (!deniedActions)
207
+ return;
208
+ for (const action of deniedActions) {
209
+ const colonIndex = action.indexOf(":");
210
+ if (colonIndex === -1) {
211
+ errors.push(`Invalid denied_action format '${action}', expected 'tool:action'`);
212
+ }
213
+ else {
214
+ const tool = action.slice(0, colonIndex).trim();
215
+ const act = action.slice(colonIndex + 1).trim();
216
+ if (!tool || !act) {
217
+ errors.push(`Invalid denied_action format '${action}', expected 'tool:action'`);
218
+ }
219
+ else if (action !== `${tool}:${act}`) {
220
+ warnings.push(`denied_action '${action}' has extra whitespace, normalized to '${tool}:${act}'`);
221
+ }
222
+ }
223
+ }
224
+ }
225
+ async validateProfile(profile) {
226
+ const errors = [];
227
+ const warnings = [];
228
+ if (profile.auth.type === "pat" && profile.auth.token_env) {
229
+ if (!process.env[profile.auth.token_env]) {
230
+ warnings.push(`Environment variable '${profile.auth.token_env}' is not set`);
231
+ }
232
+ }
233
+ if (profile.auth.type === "oauth" && profile.auth.client_id_env) {
234
+ if (!process.env[profile.auth.client_id_env]) {
235
+ warnings.push(`Environment variable '${profile.auth.client_id_env}' is not set`);
236
+ }
237
+ }
238
+ if (profile.auth.type === "oauth" && profile.auth.client_secret_env) {
239
+ if (!process.env[profile.auth.client_secret_env]) {
240
+ warnings.push(`Environment variable '${profile.auth.client_secret_env}' is not set`);
241
+ }
242
+ }
243
+ if (profile.auth.type === "cookie" &&
244
+ "cookie_path" in profile.auth &&
245
+ profile.auth.cookie_path) {
246
+ if (!fs.existsSync(profile.auth.cookie_path)) {
247
+ errors.push(`Cookie file not found: ${profile.auth.cookie_path}`);
248
+ }
249
+ }
250
+ if (profile.ssl_cert_path && !fs.existsSync(profile.ssl_cert_path)) {
251
+ errors.push(`SSL certificate not found: ${profile.ssl_cert_path}`);
252
+ }
253
+ if (profile.ssl_key_path && !fs.existsSync(profile.ssl_key_path)) {
254
+ errors.push(`SSL key not found: ${profile.ssl_key_path}`);
255
+ }
256
+ if (profile.ca_cert_path && !fs.existsSync(profile.ca_cert_path)) {
257
+ errors.push(`CA certificate not found: ${profile.ca_cert_path}`);
258
+ }
259
+ if (profile.denied_tools_regex) {
260
+ try {
261
+ new RegExp(profile.denied_tools_regex);
262
+ }
263
+ catch {
264
+ errors.push(`Invalid regex in denied_tools_regex: ${profile.denied_tools_regex}`);
265
+ }
266
+ }
267
+ this.validateDeniedActions(profile.denied_actions, errors, warnings);
268
+ return {
269
+ valid: errors.length === 0,
270
+ errors,
271
+ warnings,
272
+ };
273
+ }
274
+ async validatePreset(preset) {
275
+ const errors = [];
276
+ const warnings = [];
277
+ if (preset.denied_tools_regex) {
278
+ try {
279
+ new RegExp(preset.denied_tools_regex);
280
+ }
281
+ catch {
282
+ errors.push(`Invalid regex in denied_tools_regex: ${preset.denied_tools_regex}`);
283
+ }
284
+ }
285
+ this.validateDeniedActions(preset.denied_actions, errors, warnings);
286
+ return {
287
+ valid: errors.length === 0,
288
+ errors,
289
+ warnings,
290
+ };
291
+ }
292
+ static ensureConfigDir() {
293
+ if (!fs.existsSync(USER_CONFIG_DIR)) {
294
+ fs.mkdirSync(USER_CONFIG_DIR, { recursive: true });
295
+ (0, logger_1.logInfo)("Created config directory", { path: USER_CONFIG_DIR });
296
+ }
297
+ }
298
+ static getUserConfigPath() {
299
+ return USER_PROFILES_PATH;
300
+ }
301
+ clearCache() {
302
+ this.profileCache.clear();
303
+ this.presetCache.clear();
304
+ this.configCache = null;
305
+ }
306
+ }
307
+ exports.ProfileLoader = ProfileLoader;
308
+ async function loadProfile(name) {
309
+ const loader = new ProfileLoader();
310
+ return loader.loadProfile(name);
311
+ }
312
+ async function loadPreset(name) {
313
+ const loader = new ProfileLoader();
314
+ return loader.loadPreset(name);
315
+ }
316
+ function getProfileNameFromEnv() {
317
+ return process.env.GITLAB_PROFILE;
318
+ }
319
+ //# sourceMappingURL=loader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loader.js","sourceRoot":"","sources":["../../../src/profiles/loader.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmbA,kCAGC;AAKD,gCAGC;AAKD,sDAEC;AAtbD,uCAAyB;AACzB,2CAA6B;AAC7B,uCAAyB;AACzB,2CAA6B;AAC7B,mCAQiB;AACjB,sCAAiE;AAMjE,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC;AACzE,MAAM,kBAAkB,GAAG,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,eAAe,CAAC,CAAC;AAYvE,SAAS,aAAa;IACpB,MAAM,UAAU,GAAG;QAEjB,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC;QAE/B,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,CAAC;QAE9D,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,CAAC;KACvD,CAAC;IAEF,KAAK,MAAM,GAAG,IAAI,UAAU,EAAE,CAA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ProjectConfig, ProjectPreset, ProjectProfile, ProfileValidationResult } from "./types";
2
+ export declare const PROJECT_CONFIG_DIR = ".gitlab-mcp";
3
+ export declare const PROJECT_PRESET_FILE = "preset.yaml";
4
+ export declare const PROJECT_PROFILE_FILE = "profile.yaml";
5
+ export declare function loadProjectConfig(repoPath: string): Promise<ProjectConfig | null>;
6
+ export declare function findProjectConfig(startPath: string): Promise<ProjectConfig | null>;
7
+ export declare function validateProjectPreset(preset: ProjectPreset): ProfileValidationResult;
8
+ export declare function validateProjectProfile(profile: ProjectProfile, availablePresets: string[]): ProfileValidationResult;
9
+ export declare function getProjectConfigSummary(config: ProjectConfig): {
10
+ presetSummary: string | null;
11
+ profileSummary: string | null;
12
+ };
@@ -0,0 +1,214 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.PROJECT_PROFILE_FILE = exports.PROJECT_PRESET_FILE = exports.PROJECT_CONFIG_DIR = void 0;
37
+ exports.loadProjectConfig = loadProjectConfig;
38
+ exports.findProjectConfig = findProjectConfig;
39
+ exports.validateProjectPreset = validateProjectPreset;
40
+ exports.validateProjectProfile = validateProjectProfile;
41
+ exports.getProjectConfigSummary = getProjectConfigSummary;
42
+ const fs = __importStar(require("fs/promises"));
43
+ const path = __importStar(require("path"));
44
+ const yaml = __importStar(require("yaml"));
45
+ const types_1 = require("./types");
46
+ const logger_1 = require("../logger");
47
+ exports.PROJECT_CONFIG_DIR = ".gitlab-mcp";
48
+ exports.PROJECT_PRESET_FILE = "preset.yaml";
49
+ exports.PROJECT_PROFILE_FILE = "profile.yaml";
50
+ async function loadProjectConfig(repoPath) {
51
+ const configDir = path.join(repoPath, exports.PROJECT_CONFIG_DIR);
52
+ try {
53
+ const stat = await fs.stat(configDir);
54
+ if (!stat.isDirectory()) {
55
+ (0, logger_1.logWarn)("Project config path exists but is not a directory", { path: configDir });
56
+ return null;
57
+ }
58
+ }
59
+ catch {
60
+ (0, logger_1.logDebug)("No project config directory found", { path: configDir });
61
+ return null;
62
+ }
63
+ const config = {
64
+ configPath: configDir,
65
+ };
66
+ const presetPath = path.join(configDir, exports.PROJECT_PRESET_FILE);
67
+ try {
68
+ const content = await fs.readFile(presetPath, "utf8");
69
+ const parsed = yaml.parse(content);
70
+ config.preset = types_1.ProjectPresetSchema.parse(parsed);
71
+ (0, logger_1.logDebug)("Loaded project preset", { path: presetPath });
72
+ }
73
+ catch (error) {
74
+ if (error.code !== "ENOENT") {
75
+ const message = error instanceof Error ? error.message : String(error);
76
+ (0, logger_1.logError)("Failed to parse project preset", { error: message, path: presetPath });
77
+ throw new Error(`Invalid project preset at ${presetPath}: ${message}`, { cause: error });
78
+ }
79
+ }
80
+ const profilePath = path.join(configDir, exports.PROJECT_PROFILE_FILE);
81
+ try {
82
+ const content = await fs.readFile(profilePath, "utf8");
83
+ const parsed = yaml.parse(content);
84
+ config.profile = types_1.ProjectProfileSchema.parse(parsed);
85
+ (0, logger_1.logDebug)("Loaded project profile", { path: profilePath });
86
+ }
87
+ catch (error) {
88
+ if (error.code !== "ENOENT") {
89
+ const message = error instanceof Error ? error.message : String(error);
90
+ (0, logger_1.logError)("Failed to parse project profile", { error: message, path: profilePath });
91
+ throw new Error(`Invalid project profile at ${profilePath}: ${message}`, { cause: error });
92
+ }
93
+ }
94
+ if (!config.preset && !config.profile) {
95
+ (0, logger_1.logDebug)("Project config directory exists but contains no config files", { path: configDir });
96
+ return null;
97
+ }
98
+ (0, logger_1.logInfo)("Loaded project configuration", {
99
+ path: configDir,
100
+ hasPreset: !!config.preset,
101
+ hasProfile: !!config.profile,
102
+ });
103
+ return config;
104
+ }
105
+ async function findProjectConfig(startPath) {
106
+ let currentPath = path.resolve(startPath);
107
+ const root = path.parse(currentPath).root;
108
+ while (currentPath !== root) {
109
+ const configDir = path.join(currentPath, exports.PROJECT_CONFIG_DIR);
110
+ try {
111
+ await fs.access(configDir);
112
+ return loadProjectConfig(currentPath);
113
+ }
114
+ catch {
115
+ }
116
+ const gitDir = path.join(currentPath, ".git");
117
+ try {
118
+ await fs.access(gitDir);
119
+ (0, logger_1.logDebug)("Found .git without .gitlab-mcp, stopping search", { path: currentPath });
120
+ return null;
121
+ }
122
+ catch {
123
+ }
124
+ currentPath = path.dirname(currentPath);
125
+ }
126
+ return null;
127
+ }
128
+ function validateProjectPreset(preset) {
129
+ const errors = [];
130
+ const warnings = [];
131
+ if (preset.scope) {
132
+ const { project, namespace, projects } = preset.scope;
133
+ if (namespace && !project && !projects?.length) {
134
+ warnings.push(`Scope restricts to namespace '${namespace}' - all projects in this group are allowed`);
135
+ }
136
+ }
137
+ if (preset.denied_actions) {
138
+ for (const action of preset.denied_actions) {
139
+ const colonIndex = action.indexOf(":");
140
+ if (colonIndex === -1) {
141
+ errors.push(`Invalid denied_action format '${action}', expected 'tool:action'`);
142
+ }
143
+ }
144
+ }
145
+ return {
146
+ valid: errors.length === 0,
147
+ errors,
148
+ warnings,
149
+ };
150
+ }
151
+ function validateProjectProfile(profile, availablePresets) {
152
+ const errors = [];
153
+ const warnings = [];
154
+ if (profile.extends) {
155
+ if (!availablePresets.includes(profile.extends)) {
156
+ errors.push(`Unknown preset '${profile.extends}' in extends field`);
157
+ }
158
+ }
159
+ if (profile.additional_tools && profile.denied_tools) {
160
+ const overlap = profile.additional_tools.filter(t => profile.denied_tools?.includes(t));
161
+ if (overlap.length > 0) {
162
+ warnings.push(`Tools appear in both additional_tools and denied_tools: ${overlap.join(", ")}`);
163
+ }
164
+ }
165
+ return {
166
+ valid: errors.length === 0,
167
+ errors,
168
+ warnings,
169
+ };
170
+ }
171
+ function getProjectConfigSummary(config) {
172
+ let presetSummary = null;
173
+ let profileSummary = null;
174
+ if (config.preset) {
175
+ const parts = [];
176
+ if (config.preset.description) {
177
+ parts.push(config.preset.description);
178
+ }
179
+ if (config.preset.scope?.project) {
180
+ parts.push(`scope: ${config.preset.scope.project}`);
181
+ }
182
+ else if (config.preset.scope?.namespace) {
183
+ parts.push(`scope: ${config.preset.scope.namespace}/*`);
184
+ }
185
+ else if (config.preset.scope?.projects) {
186
+ parts.push(`scope: ${config.preset.scope.projects.length} projects`);
187
+ }
188
+ if (config.preset.read_only) {
189
+ parts.push("read-only");
190
+ }
191
+ if (config.preset.denied_actions?.length) {
192
+ parts.push(`${config.preset.denied_actions.length} denied actions`);
193
+ }
194
+ presetSummary = parts.join(", ") || "custom restrictions";
195
+ }
196
+ if (config.profile) {
197
+ const parts = [];
198
+ if (config.profile.description) {
199
+ parts.push(config.profile.description);
200
+ }
201
+ if (config.profile.extends) {
202
+ parts.push(`extends: ${config.profile.extends}`);
203
+ }
204
+ if (config.profile.additional_tools?.length) {
205
+ parts.push(`+${config.profile.additional_tools.length} tools`);
206
+ }
207
+ if (config.profile.denied_tools?.length) {
208
+ parts.push(`-${config.profile.denied_tools.length} tools`);
209
+ }
210
+ profileSummary = parts.join(", ") || "custom tool selection";
211
+ }
212
+ return { presetSummary, profileSummary };
213
+ }
214
+ //# sourceMappingURL=project-loader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-loader.js","sourceRoot":"","sources":["../../../src/profiles/project-loader.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmDA,8CAgEC;AAWD,8CA6BC;AAKD,sDAgCC;AAKD,wDA6BC;AAKD,0DA8CC;AAtQD,gDAAkC;AAClC,2CAA6B;AAC7B,2CAA6B;AAC7B,mCAOiB;AACjB,sCAAiE;AAOpD,QAAA,kBAAkB,GAAG,aAAa,CAAC;AAGnC,QAAA,mBAAmB,GAAG,aAAa,CAAC;AAGpC,QAAA,oBAAoB,GAAG,cAAc,CAAC;AAY5C,KAAK,UAAU,iBAAiB,CAAC,QAAgB;IACtD,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,0BAAkB,CAAC,CAAC;IAG1D,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACtC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;YACxB,IAAA,gBAAO,EAAC,mDAAmD,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC;YAClF,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,IAAA,iBAAQ,EAAC,mCAAmC,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC;QACnE,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,MAAM,GAAkB;QAC5B,UAAU,EAAE,SAAS;KACtB,CAAC;IAGF,MAAM,UAAU,GAAG,IAAI,CAAC,I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AAC,OAAO,CAAC,OAAO,EAAE,CAAC;YAC3B,KAAK,CAAC,IAAI,CAAC,YAAY,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;QACnD,CAAC;QACD,IAAI,MAAM,CAAC,OAAO,CAAC,gBAAgB,EAAE,MAAM,EAAE,CAAC;YAC5C,KAAK,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,gBAAgB,CAAC,MAAM,QAAQ,CAAC,CAAC;QACjE,CAAC;QACD,IAAI,MAAM,CAAC,OAAO,CAAC,YAAY,EAAE,MAAM,EAAE,CAAC;YACxC,KAAK,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,MAAM,QAAQ,CAAC,CAAC;QAC7D,CAAC;QACD,cAAc,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,uBAAuB,CAAC;IAC/D,CAAC;IAED,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,CAAC;AAC3C,CAAC"}
@@ -0,0 +1,28 @@
1
+ import { ProjectPreset, ScopeConfig } from "./types";
2
+ export type { ScopeConfig } from "./types";
3
+ export declare class ScopeViolationError extends Error {
4
+ readonly attemptedTarget: string;
5
+ readonly allowedScope: ScopeConfig;
6
+ constructor(attemptedTarget: string, allowedScope: ScopeConfig);
7
+ }
8
+ export declare function isInNamespace(projectPath: string, namespace: string): boolean;
9
+ export declare class ScopeEnforcer {
10
+ private readonly scope;
11
+ private readonly allowedProjectsSet;
12
+ private readonly allowedGroupsSet;
13
+ private readonly includeSubgroups;
14
+ constructor(scope: ScopeConfig);
15
+ static fromPreset(preset: ProjectPreset): ScopeEnforcer | null;
16
+ isAllowed(projectPath: string): boolean;
17
+ isGroupAllowed(groupPath: string): boolean;
18
+ enforce(projectPath: string): void;
19
+ enforceGroup(groupPath: string): void;
20
+ getScope(): ScopeConfig;
21
+ getScopeDescription(): string;
22
+ hasProjectRestrictions(): boolean;
23
+ hasGroupRestrictions(): boolean;
24
+ hasRestrictions(): boolean;
25
+ }
26
+ export declare function extractProjectsFromArgs(args: Record<string, unknown>): string[];
27
+ export declare function extractGroupsFromArgs(args: Record<string, unknown>): string[];
28
+ export declare function enforceArgsScope(enforcer: ScopeEnforcer, args: Record<string, unknown>): void;