@ffschrattenecker/tm1-mcp-server 6.0.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 (475) hide show
  1. package/CHANGELOG.md +1211 -0
  2. package/LICENSE +21 -0
  3. package/NOTICE +34 -0
  4. package/README.md +276 -0
  5. package/dist/config.d.ts +35 -0
  6. package/dist/config.js +238 -0
  7. package/dist/http-transport.d.ts +8 -0
  8. package/dist/http-transport.js +132 -0
  9. package/dist/index.d.ts +18 -0
  10. package/dist/index.js +164 -0
  11. package/dist/lib/callgraph/callGraph.d.ts +124 -0
  12. package/dist/lib/callgraph/callGraph.js +334 -0
  13. package/dist/lib/callgraph/choreGraph.d.ts +23 -0
  14. package/dist/lib/callgraph/choreGraph.js +102 -0
  15. package/dist/lib/callgraph/dataFlow.d.ts +74 -0
  16. package/dist/lib/callgraph/dataFlow.js +271 -0
  17. package/dist/lib/callgraph/datasourceMembership.d.ts +31 -0
  18. package/dist/lib/callgraph/datasourceMembership.js +142 -0
  19. package/dist/lib/callgraph/lintTypes.d.ts +28 -0
  20. package/dist/lib/callgraph/lintTypes.js +2 -0
  21. package/dist/lib/callgraph/mdxMembers.d.ts +29 -0
  22. package/dist/lib/callgraph/mdxMembers.js +97 -0
  23. package/dist/lib/callgraph/referenceIndex.d.ts +179 -0
  24. package/dist/lib/callgraph/referenceIndex.js +584 -0
  25. package/dist/lib/callgraph/rulesLinter.d.ts +55 -0
  26. package/dist/lib/callgraph/rulesLinter.js +776 -0
  27. package/dist/lib/callgraph/rulesParser.d.ts +26 -0
  28. package/dist/lib/callgraph/rulesParser.js +71 -0
  29. package/dist/lib/callgraph/subsetUsage.d.ts +16 -0
  30. package/dist/lib/callgraph/subsetUsage.js +134 -0
  31. package/dist/lib/callgraph/tiParser.d.ts +21 -0
  32. package/dist/lib/callgraph/tiParser.js +672 -0
  33. package/dist/lib/callgraph/tiSignatures.d.ts +32 -0
  34. package/dist/lib/callgraph/tiSignatures.js +6185 -0
  35. package/dist/lib/callgraph/tm1-adapter.d.ts +32 -0
  36. package/dist/lib/callgraph/tm1-adapter.js +159 -0
  37. package/dist/lib/callgraph/types.d.ts +53 -0
  38. package/dist/lib/callgraph/types.js +2 -0
  39. package/dist/lib/callgraph/variableEnv.d.ts +86 -0
  40. package/dist/lib/callgraph/variableEnv.js +214 -0
  41. package/dist/lib/cell-address.d.ts +12 -0
  42. package/dist/lib/cell-address.js +71 -0
  43. package/dist/lib/complexity/antipatterns.d.ts +22 -0
  44. package/dist/lib/complexity/antipatterns.js +302 -0
  45. package/dist/lib/complexity/comment-classifier.d.ts +24 -0
  46. package/dist/lib/complexity/comment-classifier.js +43 -0
  47. package/dist/lib/complexity/cross-process.d.ts +78 -0
  48. package/dist/lib/complexity/cross-process.js +114 -0
  49. package/dist/lib/complexity/process-metrics.d.ts +78 -0
  50. package/dist/lib/complexity/process-metrics.js +278 -0
  51. package/dist/lib/complexity/rules-metrics.d.ts +31 -0
  52. package/dist/lib/complexity/rules-metrics.js +99 -0
  53. package/dist/lib/concurrency.d.ts +11 -0
  54. package/dist/lib/concurrency.js +27 -0
  55. package/dist/lib/control-name.d.ts +10 -0
  56. package/dist/lib/control-name.js +10 -0
  57. package/dist/lib/coordinate-error.d.ts +3 -0
  58. package/dist/lib/coordinate-error.js +29 -0
  59. package/dist/lib/credential-format.d.ts +23 -0
  60. package/dist/lib/credential-format.js +25 -0
  61. package/dist/lib/cube-stats/fetcher.d.ts +106 -0
  62. package/dist/lib/cube-stats/fetcher.js +194 -0
  63. package/dist/lib/feeders/brackets.d.ts +47 -0
  64. package/dist/lib/feeders/brackets.js +195 -0
  65. package/dist/lib/feeders/element-type-cache.d.ts +42 -0
  66. package/dist/lib/feeders/element-type-cache.js +86 -0
  67. package/dist/lib/feeders/static-heuristics.d.ts +101 -0
  68. package/dist/lib/feeders/static-heuristics.js +202 -0
  69. package/dist/lib/git-process.d.ts +67 -0
  70. package/dist/lib/git-process.js +243 -0
  71. package/dist/lib/mask-secrets.d.ts +10 -0
  72. package/dist/lib/mask-secrets.js +99 -0
  73. package/dist/lib/mdx.d.ts +3 -0
  74. package/dist/lib/mdx.js +13 -0
  75. package/dist/lib/naming/odata-filter.d.ts +15 -0
  76. package/dist/lib/naming/odata-filter.js +81 -0
  77. package/dist/lib/naming/rules.d.ts +34 -0
  78. package/dist/lib/naming/rules.js +215 -0
  79. package/dist/lib/pro-parser.d.ts +19 -0
  80. package/dist/lib/pro-parser.js +260 -0
  81. package/dist/lib/pro-serializer.d.ts +19 -0
  82. package/dist/lib/pro-serializer.js +170 -0
  83. package/dist/lib/process-parts-schema.d.ts +45 -0
  84. package/dist/lib/process-parts-schema.js +46 -0
  85. package/dist/lib/process-refs.d.ts +88 -0
  86. package/dist/lib/process-refs.js +441 -0
  87. package/dist/lib/rules-outline.d.ts +29 -0
  88. package/dist/lib/rules-outline.js +68 -0
  89. package/dist/lib/rules-patch.d.ts +6 -0
  90. package/dist/lib/rules-patch.js +59 -0
  91. package/dist/lib/safe-regex.d.ts +15 -0
  92. package/dist/lib/safe-regex.js +37 -0
  93. package/dist/lib/sample-cells.d.ts +48 -0
  94. package/dist/lib/sample-cells.js +146 -0
  95. package/dist/lib/slim-json-schema.d.ts +20 -0
  96. package/dist/lib/slim-json-schema.js +68 -0
  97. package/dist/lib/strip-comments.d.ts +23 -0
  98. package/dist/lib/strip-comments.js +61 -0
  99. package/dist/lib/tm1-events.d.ts +16 -0
  100. package/dist/lib/tm1-events.js +29 -0
  101. package/dist/lib/v12-compat/deprecated-ti.d.ts +17 -0
  102. package/dist/lib/v12-compat/deprecated-ti.js +257 -0
  103. package/dist/lib/v12-compat/scanner.d.ts +10 -0
  104. package/dist/lib/v12-compat/scanner.js +43 -0
  105. package/dist/lib/variables-ui-data.d.ts +26 -0
  106. package/dist/lib/variables-ui-data.js +77 -0
  107. package/dist/load-env.d.ts +2 -0
  108. package/dist/load-env.js +29 -0
  109. package/dist/logger.d.ts +4 -0
  110. package/dist/logger.js +60 -0
  111. package/dist/prompts/index.d.ts +3 -0
  112. package/dist/prompts/index.js +141 -0
  113. package/dist/resources/index.d.ts +5 -0
  114. package/dist/resources/index.js +237 -0
  115. package/dist/resources/list-handler.d.ts +40 -0
  116. package/dist/resources/list-handler.js +86 -0
  117. package/dist/resources/subscriptions.d.ts +19 -0
  118. package/dist/resources/subscriptions.js +80 -0
  119. package/dist/schemas/cells.d.ts +17 -0
  120. package/dist/schemas/cells.js +13 -0
  121. package/dist/schemas/common.d.ts +16 -0
  122. package/dist/schemas/common.js +14 -0
  123. package/dist/schemas/index.d.ts +10 -0
  124. package/dist/schemas/index.js +23 -0
  125. package/dist/schemas/metadata.d.ts +70 -0
  126. package/dist/schemas/metadata.js +47 -0
  127. package/dist/schemas/monitoring.d.ts +95 -0
  128. package/dist/schemas/monitoring.js +69 -0
  129. package/dist/schemas/processes.d.ts +74 -0
  130. package/dist/schemas/processes.js +66 -0
  131. package/dist/schemas/scheduling.d.ts +13 -0
  132. package/dist/schemas/scheduling.js +13 -0
  133. package/dist/schemas/security.d.ts +19 -0
  134. package/dist/schemas/security.js +16 -0
  135. package/dist/schemas/subsets.d.ts +12 -0
  136. package/dist/schemas/subsets.js +12 -0
  137. package/dist/schemas/views.d.ts +9 -0
  138. package/dist/schemas/views.js +9 -0
  139. package/dist/session-manager.d.ts +79 -0
  140. package/dist/session-manager.js +281 -0
  141. package/dist/tm1-client/connection/profile.d.ts +13 -0
  142. package/dist/tm1-client/connection/profile.js +99 -0
  143. package/dist/tm1-client/dispatcher.d.ts +5 -0
  144. package/dist/tm1-client/dispatcher.js +31 -0
  145. package/dist/tm1-client/http.d.ts +81 -0
  146. package/dist/tm1-client/http.js +547 -0
  147. package/dist/tm1-client/services/batch-service.d.ts +123 -0
  148. package/dist/tm1-client/services/batch-service.js +455 -0
  149. package/dist/tm1-client/services/cell-service.d.ts +71 -0
  150. package/dist/tm1-client/services/cell-service.js +333 -0
  151. package/dist/tm1-client/services/cellset-transform.d.ts +26 -0
  152. package/dist/tm1-client/services/cellset-transform.js +80 -0
  153. package/dist/tm1-client/services/chore-service.d.ts +68 -0
  154. package/dist/tm1-client/services/chore-service.js +179 -0
  155. package/dist/tm1-client/services/chore-status.d.ts +11 -0
  156. package/dist/tm1-client/services/chore-status.js +127 -0
  157. package/dist/tm1-client/services/cube-service.d.ts +134 -0
  158. package/dist/tm1-client/services/cube-service.js +294 -0
  159. package/dist/tm1-client/services/dimension-service.d.ts +118 -0
  160. package/dist/tm1-client/services/dimension-service.js +249 -0
  161. package/dist/tm1-client/services/element-service.d.ts +245 -0
  162. package/dist/tm1-client/services/element-service.js +809 -0
  163. package/dist/tm1-client/services/fallback.d.ts +44 -0
  164. package/dist/tm1-client/services/fallback.js +72 -0
  165. package/dist/tm1-client/services/file-service.d.ts +53 -0
  166. package/dist/tm1-client/services/file-service.js +218 -0
  167. package/dist/tm1-client/services/hierarchy-service.d.ts +129 -0
  168. package/dist/tm1-client/services/hierarchy-service.js +332 -0
  169. package/dist/tm1-client/services/monitoring-service.d.ts +34 -0
  170. package/dist/tm1-client/services/monitoring-service.js +123 -0
  171. package/dist/tm1-client/services/odata-page.d.ts +71 -0
  172. package/dist/tm1-client/services/odata-page.js +87 -0
  173. package/dist/tm1-client/services/process-service.d.ts +278 -0
  174. package/dist/tm1-client/services/process-service.js +874 -0
  175. package/dist/tm1-client/services/process-status.d.ts +21 -0
  176. package/dist/tm1-client/services/process-status.js +89 -0
  177. package/dist/tm1-client/services/security-service.d.ts +50 -0
  178. package/dist/tm1-client/services/security-service.js +93 -0
  179. package/dist/tm1-client/services/server-service.d.ts +116 -0
  180. package/dist/tm1-client/services/server-service.js +504 -0
  181. package/dist/tm1-client/services/subset-service.d.ts +37 -0
  182. package/dist/tm1-client/services/subset-service.js +122 -0
  183. package/dist/tm1-client/services/view-service.d.ts +46 -0
  184. package/dist/tm1-client/services/view-service.js +287 -0
  185. package/dist/tm1-client.d.ts +56 -0
  186. package/dist/tm1-client.js +126 -0
  187. package/dist/tools/analysis/analyze-callgraph.d.ts +28 -0
  188. package/dist/tools/analysis/analyze-callgraph.js +350 -0
  189. package/dist/tools/analysis/analyze-chore-graph.d.ts +2 -0
  190. package/dist/tools/analysis/analyze-chore-graph.js +148 -0
  191. package/dist/tools/analysis/analyze-object-usage.d.ts +2 -0
  192. package/dist/tools/analysis/analyze-object-usage.js +143 -0
  193. package/dist/tools/analysis/audit-complexity.d.ts +2 -0
  194. package/dist/tools/analysis/audit-complexity.js +255 -0
  195. package/dist/tools/analysis/audit-feeders.d.ts +2 -0
  196. package/dist/tools/analysis/audit-feeders.js +417 -0
  197. package/dist/tools/analysis/audit-naming.d.ts +2 -0
  198. package/dist/tools/analysis/audit-naming.js +379 -0
  199. package/dist/tools/analysis/check-v12-readiness.d.ts +2 -0
  200. package/dist/tools/analysis/check-v12-readiness.js +136 -0
  201. package/dist/tools/analysis/find-orphan-dimensions.d.ts +2 -0
  202. package/dist/tools/analysis/find-orphan-dimensions.js +55 -0
  203. package/dist/tools/analysis/invalidate-callgraph-cache.d.ts +2 -0
  204. package/dist/tools/analysis/invalidate-callgraph-cache.js +40 -0
  205. package/dist/tools/analysis/trace-data-flow.d.ts +2 -0
  206. package/dist/tools/analysis/trace-data-flow.js +138 -0
  207. package/dist/tools/annotations.d.ts +12 -0
  208. package/dist/tools/annotations.js +61 -0
  209. package/dist/tools/celldata/check-feeders.d.ts +2 -0
  210. package/dist/tools/celldata/check-feeders.js +48 -0
  211. package/dist/tools/celldata/check-writable-coords.d.ts +2 -0
  212. package/dist/tools/celldata/check-writable-coords.js +126 -0
  213. package/dist/tools/celldata/execute-mdx.d.ts +17 -0
  214. package/dist/tools/celldata/execute-mdx.js +126 -0
  215. package/dist/tools/celldata/get-cell-value.d.ts +2 -0
  216. package/dist/tools/celldata/get-cell-value.js +30 -0
  217. package/dist/tools/celldata/get-view-definition.d.ts +2 -0
  218. package/dist/tools/celldata/get-view-definition.js +29 -0
  219. package/dist/tools/celldata/get-view.d.ts +2 -0
  220. package/dist/tools/celldata/get-view.js +55 -0
  221. package/dist/tools/celldata/sample-cells.d.ts +2 -0
  222. package/dist/tools/celldata/sample-cells.js +101 -0
  223. package/dist/tools/celldata/trace-cell-calculation.d.ts +2 -0
  224. package/dist/tools/celldata/trace-cell-calculation.js +53 -0
  225. package/dist/tools/celldata/trace-feeders.d.ts +2 -0
  226. package/dist/tools/celldata/trace-feeders.js +44 -0
  227. package/dist/tools/celldata/write-cells.d.ts +2 -0
  228. package/dist/tools/celldata/write-cells.js +65 -0
  229. package/dist/tools/confirm.d.ts +10 -0
  230. package/dist/tools/confirm.js +64 -0
  231. package/dist/tools/define-tool.d.ts +51 -0
  232. package/dist/tools/define-tool.js +49 -0
  233. package/dist/tools/dimension-management/bulk-upsert-elements.d.ts +2 -0
  234. package/dist/tools/dimension-management/bulk-upsert-elements.js +103 -0
  235. package/dist/tools/dimension-management/create-dimension.d.ts +2 -0
  236. package/dist/tools/dimension-management/create-dimension.js +22 -0
  237. package/dist/tools/dimension-management/create-element-attribute.d.ts +2 -0
  238. package/dist/tools/dimension-management/create-element-attribute.js +26 -0
  239. package/dist/tools/dimension-management/create-element.d.ts +2 -0
  240. package/dist/tools/dimension-management/create-element.js +31 -0
  241. package/dist/tools/dimension-management/create-hierarchy.d.ts +2 -0
  242. package/dist/tools/dimension-management/create-hierarchy.js +22 -0
  243. package/dist/tools/dimension-management/delete-dimension.d.ts +2 -0
  244. package/dist/tools/dimension-management/delete-dimension.js +25 -0
  245. package/dist/tools/dimension-management/delete-element.d.ts +2 -0
  246. package/dist/tools/dimension-management/delete-element.js +26 -0
  247. package/dist/tools/dimension-management/delete-elements.d.ts +2 -0
  248. package/dist/tools/dimension-management/delete-elements.js +44 -0
  249. package/dist/tools/dimension-management/delete-hierarchy.d.ts +2 -0
  250. package/dist/tools/dimension-management/delete-hierarchy.js +35 -0
  251. package/dist/tools/dimension-management/get-element-attribute-values.d.ts +2 -0
  252. package/dist/tools/dimension-management/get-element-attribute-values.js +77 -0
  253. package/dist/tools/dimension-management/list-element-attributes.d.ts +2 -0
  254. package/dist/tools/dimension-management/list-element-attributes.js +31 -0
  255. package/dist/tools/dimension-management/move-element.d.ts +2 -0
  256. package/dist/tools/dimension-management/move-element.js +28 -0
  257. package/dist/tools/dimension-management/update-element-attribute-value.d.ts +2 -0
  258. package/dist/tools/dimension-management/update-element-attribute-value.js +80 -0
  259. package/dist/tools/dimension-management/update-element.d.ts +2 -0
  260. package/dist/tools/dimension-management/update-element.js +35 -0
  261. package/dist/tools/error-format.d.ts +22 -0
  262. package/dist/tools/error-format.js +130 -0
  263. package/dist/tools/fileops/delete-file.d.ts +2 -0
  264. package/dist/tools/fileops/delete-file.js +32 -0
  265. package/dist/tools/fileops/get-file-content.d.ts +2 -0
  266. package/dist/tools/fileops/get-file-content.js +76 -0
  267. package/dist/tools/fileops/list-files.d.ts +2 -0
  268. package/dist/tools/fileops/list-files.js +43 -0
  269. package/dist/tools/fileops/search-files.d.ts +2 -0
  270. package/dist/tools/fileops/search-files.js +76 -0
  271. package/dist/tools/fileops/upload-file.d.ts +2 -0
  272. package/dist/tools/fileops/upload-file.js +69 -0
  273. package/dist/tools/format.d.ts +57 -0
  274. package/dist/tools/format.js +157 -0
  275. package/dist/tools/hierarchy.d.ts +6 -0
  276. package/dist/tools/hierarchy.js +27 -0
  277. package/dist/tools/index.d.ts +4 -0
  278. package/dist/tools/index.js +263 -0
  279. package/dist/tools/local-file.d.ts +16 -0
  280. package/dist/tools/local-file.js +88 -0
  281. package/dist/tools/metadata/get-ancestors.d.ts +2 -0
  282. package/dist/tools/metadata/get-ancestors.js +36 -0
  283. package/dist/tools/metadata/get-descendants.d.ts +2 -0
  284. package/dist/tools/metadata/get-descendants.js +64 -0
  285. package/dist/tools/metadata/get-hierarchy.d.ts +2 -0
  286. package/dist/tools/metadata/get-hierarchy.js +130 -0
  287. package/dist/tools/metadata/list-chores.d.ts +2 -0
  288. package/dist/tools/metadata/list-chores.js +62 -0
  289. package/dist/tools/metadata/list-cubes.d.ts +2 -0
  290. package/dist/tools/metadata/list-cubes.js +128 -0
  291. package/dist/tools/metadata/list-dimensions.d.ts +2 -0
  292. package/dist/tools/metadata/list-dimensions.js +131 -0
  293. package/dist/tools/metadata/list-processes-grouped.d.ts +2 -0
  294. package/dist/tools/metadata/list-processes-grouped.js +96 -0
  295. package/dist/tools/metadata/list-processes.d.ts +2 -0
  296. package/dist/tools/metadata/list-processes.js +108 -0
  297. package/dist/tools/metadata/resolve-default-members.d.ts +2 -0
  298. package/dist/tools/metadata/resolve-default-members.js +46 -0
  299. package/dist/tools/model-building/check-cube-rule.d.ts +2 -0
  300. package/dist/tools/model-building/check-cube-rule.js +51 -0
  301. package/dist/tools/model-building/clear-cube.d.ts +2 -0
  302. package/dist/tools/model-building/clear-cube.js +46 -0
  303. package/dist/tools/model-building/create-cube.d.ts +2 -0
  304. package/dist/tools/model-building/create-cube.js +34 -0
  305. package/dist/tools/model-building/delete-cube.d.ts +2 -0
  306. package/dist/tools/model-building/delete-cube.js +27 -0
  307. package/dist/tools/model-building/get-all-cube-rules.d.ts +2 -0
  308. package/dist/tools/model-building/get-all-cube-rules.js +149 -0
  309. package/dist/tools/model-building/get-cube-rules.d.ts +2 -0
  310. package/dist/tools/model-building/get-cube-rules.js +69 -0
  311. package/dist/tools/model-building/rules-source.d.ts +21 -0
  312. package/dist/tools/model-building/rules-source.js +49 -0
  313. package/dist/tools/model-building/search-rules.d.ts +2 -0
  314. package/dist/tools/model-building/search-rules.js +132 -0
  315. package/dist/tools/model-building/set-cube-rules.d.ts +2 -0
  316. package/dist/tools/model-building/set-cube-rules.js +81 -0
  317. package/dist/tools/model-building/unload-cube.d.ts +2 -0
  318. package/dist/tools/model-building/unload-cube.js +23 -0
  319. package/dist/tools/operations/diagnose-process-error.d.ts +2 -0
  320. package/dist/tools/operations/diagnose-process-error.js +178 -0
  321. package/dist/tools/operations/error-log-helpers.d.ts +25 -0
  322. package/dist/tools/operations/error-log-helpers.js +57 -0
  323. package/dist/tools/operations/get-audit-log.d.ts +2 -0
  324. package/dist/tools/operations/get-audit-log.js +70 -0
  325. package/dist/tools/operations/get-cube-stats.d.ts +2 -0
  326. package/dist/tools/operations/get-cube-stats.js +107 -0
  327. package/dist/tools/operations/get-error-log-content.d.ts +2 -0
  328. package/dist/tools/operations/get-error-log-content.js +164 -0
  329. package/dist/tools/operations/get-jobs.d.ts +3 -0
  330. package/dist/tools/operations/get-jobs.js +51 -0
  331. package/dist/tools/operations/get-message-log.d.ts +2 -0
  332. package/dist/tools/operations/get-message-log.js +63 -0
  333. package/dist/tools/operations/get-server-info.d.ts +2 -0
  334. package/dist/tools/operations/get-server-info.js +180 -0
  335. package/dist/tools/operations/get-server-state.d.ts +2 -0
  336. package/dist/tools/operations/get-server-state.js +129 -0
  337. package/dist/tools/operations/get-sessions.d.ts +2 -0
  338. package/dist/tools/operations/get-sessions.js +76 -0
  339. package/dist/tools/operations/get-threads.d.ts +3 -0
  340. package/dist/tools/operations/get-threads.js +50 -0
  341. package/dist/tools/operations/get-transaction-log.d.ts +2 -0
  342. package/dist/tools/operations/get-transaction-log.js +63 -0
  343. package/dist/tools/operations/list-error-logs.d.ts +8 -0
  344. package/dist/tools/operations/list-error-logs.js +157 -0
  345. package/dist/tools/operations/save-data.d.ts +2 -0
  346. package/dist/tools/operations/save-data.js +50 -0
  347. package/dist/tools/pagination.d.ts +32 -0
  348. package/dist/tools/pagination.js +116 -0
  349. package/dist/tools/scheduling/create-chore.d.ts +2 -0
  350. package/dist/tools/scheduling/create-chore.js +93 -0
  351. package/dist/tools/scheduling/delete-chore.d.ts +2 -0
  352. package/dist/tools/scheduling/delete-chore.js +22 -0
  353. package/dist/tools/scheduling/execute-chore.d.ts +2 -0
  354. package/dist/tools/scheduling/execute-chore.js +52 -0
  355. package/dist/tools/scheduling/toggle-chore.d.ts +2 -0
  356. package/dist/tools/scheduling/toggle-chore.js +22 -0
  357. package/dist/tools/scheduling/update-chore.d.ts +2 -0
  358. package/dist/tools/scheduling/update-chore.js +71 -0
  359. package/dist/tools/schemas/common.d.ts +10 -0
  360. package/dist/tools/schemas/common.js +23 -0
  361. package/dist/tools/schemas/items-analysis.d.ts +394 -0
  362. package/dist/tools/schemas/items-analysis.js +419 -0
  363. package/dist/tools/schemas/items-cells.d.ts +70 -0
  364. package/dist/tools/schemas/items-cells.js +65 -0
  365. package/dist/tools/schemas/items-common.d.ts +18 -0
  366. package/dist/tools/schemas/items-common.js +39 -0
  367. package/dist/tools/schemas/items-fileops.d.ts +11 -0
  368. package/dist/tools/schemas/items-fileops.js +13 -0
  369. package/dist/tools/schemas/items-metadata.d.ts +262 -0
  370. package/dist/tools/schemas/items-metadata.js +184 -0
  371. package/dist/tools/schemas/items-monitoring.d.ts +79 -0
  372. package/dist/tools/schemas/items-monitoring.js +78 -0
  373. package/dist/tools/schemas/items-processes.d.ts +279 -0
  374. package/dist/tools/schemas/items-processes.js +235 -0
  375. package/dist/tools/schemas/items-scheduling.d.ts +25 -0
  376. package/dist/tools/schemas/items-scheduling.js +26 -0
  377. package/dist/tools/schemas/items-security.d.ts +19 -0
  378. package/dist/tools/schemas/items-security.js +12 -0
  379. package/dist/tools/schemas/items-subsets.d.ts +2 -0
  380. package/dist/tools/schemas/items-subsets.js +4 -0
  381. package/dist/tools/schemas/items-views.d.ts +38 -0
  382. package/dist/tools/schemas/items-views.js +26 -0
  383. package/dist/tools/schemas/items.d.ts +12 -0
  384. package/dist/tools/schemas/items.js +23 -0
  385. package/dist/tools/schemas/markdown-capable.d.ts +21 -0
  386. package/dist/tools/schemas/markdown-capable.js +58 -0
  387. package/dist/tools/schemas/output-schema.d.ts +24 -0
  388. package/dist/tools/schemas/output-schema.js +25 -0
  389. package/dist/tools/security/assign-client-group.d.ts +2 -0
  390. package/dist/tools/security/assign-client-group.js +20 -0
  391. package/dist/tools/security/create-client.d.ts +2 -0
  392. package/dist/tools/security/create-client.js +28 -0
  393. package/dist/tools/security/delete-client.d.ts +2 -0
  394. package/dist/tools/security/delete-client.js +22 -0
  395. package/dist/tools/security/get-client.d.ts +2 -0
  396. package/dist/tools/security/get-client.js +20 -0
  397. package/dist/tools/security/list-clients.d.ts +2 -0
  398. package/dist/tools/security/list-clients.js +86 -0
  399. package/dist/tools/security/list-groups.d.ts +2 -0
  400. package/dist/tools/security/list-groups.js +43 -0
  401. package/dist/tools/security/remove-client-group.d.ts +2 -0
  402. package/dist/tools/security/remove-client-group.js +27 -0
  403. package/dist/tools/security/update-client.d.ts +2 -0
  404. package/dist/tools/security/update-client.js +22 -0
  405. package/dist/tools/subsets/create-subset.d.ts +2 -0
  406. package/dist/tools/subsets/create-subset.js +44 -0
  407. package/dist/tools/subsets/delete-subset.d.ts +2 -0
  408. package/dist/tools/subsets/delete-subset.js +26 -0
  409. package/dist/tools/subsets/get-subset.d.ts +2 -0
  410. package/dist/tools/subsets/get-subset.js +29 -0
  411. package/dist/tools/subsets/list-subsets.d.ts +2 -0
  412. package/dist/tools/subsets/list-subsets.js +36 -0
  413. package/dist/tools/subsets/update-subset.d.ts +2 -0
  414. package/dist/tools/subsets/update-subset.js +33 -0
  415. package/dist/tools/ti-development/check-process-code.d.ts +2 -0
  416. package/dist/tools/ti-development/check-process-code.js +96 -0
  417. package/dist/tools/ti-development/compile-process.d.ts +2 -0
  418. package/dist/tools/ti-development/compile-process.js +32 -0
  419. package/dist/tools/ti-development/copy-process.d.ts +2 -0
  420. package/dist/tools/ti-development/copy-process.js +32 -0
  421. package/dist/tools/ti-development/delete-process.d.ts +2 -0
  422. package/dist/tools/ti-development/delete-process.js +26 -0
  423. package/dist/tools/ti-development/diff-process-with-file.d.ts +2 -0
  424. package/dist/tools/ti-development/diff-process-with-file.js +208 -0
  425. package/dist/tools/ti-development/diff-processes.d.ts +2 -0
  426. package/dist/tools/ti-development/diff-processes.js +312 -0
  427. package/dist/tools/ti-development/execute-process.d.ts +8 -0
  428. package/dist/tools/ti-development/execute-process.js +109 -0
  429. package/dist/tools/ti-development/export-process-to-git.d.ts +2 -0
  430. package/dist/tools/ti-development/export-process-to-git.js +113 -0
  431. package/dist/tools/ti-development/export-process-to-pro.d.ts +2 -0
  432. package/dist/tools/ti-development/export-process-to-pro.js +117 -0
  433. package/dist/tools/ti-development/get-all-processes-code.d.ts +2 -0
  434. package/dist/tools/ti-development/get-all-processes-code.js +131 -0
  435. package/dist/tools/ti-development/get-process-code.d.ts +2 -0
  436. package/dist/tools/ti-development/get-process-code.js +100 -0
  437. package/dist/tools/ti-development/get-process-datasource.d.ts +2 -0
  438. package/dist/tools/ti-development/get-process-datasource.js +20 -0
  439. package/dist/tools/ti-development/get-process-parameters.d.ts +2 -0
  440. package/dist/tools/ti-development/get-process-parameters.js +25 -0
  441. package/dist/tools/ti-development/get-process-variables.d.ts +2 -0
  442. package/dist/tools/ti-development/get-process-variables.js +38 -0
  443. package/dist/tools/ti-development/get-process.d.ts +2 -0
  444. package/dist/tools/ti-development/get-process.js +163 -0
  445. package/dist/tools/ti-development/import-pro-file.d.ts +2 -0
  446. package/dist/tools/ti-development/import-pro-file.js +153 -0
  447. package/dist/tools/ti-development/import-process-from-git.d.ts +2 -0
  448. package/dist/tools/ti-development/import-process-from-git.js +198 -0
  449. package/dist/tools/ti-development/install-pro-bundle.d.ts +2 -0
  450. package/dist/tools/ti-development/install-pro-bundle.js +288 -0
  451. package/dist/tools/ti-development/preflight.d.ts +39 -0
  452. package/dist/tools/ti-development/preflight.js +56 -0
  453. package/dist/tools/ti-development/process-backup.d.ts +29 -0
  454. package/dist/tools/ti-development/process-backup.js +118 -0
  455. package/dist/tools/ti-development/search-code.d.ts +2 -0
  456. package/dist/tools/ti-development/search-code.js +208 -0
  457. package/dist/tools/ti-development/upsert-process.d.ts +2 -0
  458. package/dist/tools/ti-development/upsert-process.js +167 -0
  459. package/dist/tools/ti-development/validate-process-refs.d.ts +2 -0
  460. package/dist/tools/ti-development/validate-process-refs.js +73 -0
  461. package/dist/tools/views/create-mdx-view.d.ts +2 -0
  462. package/dist/tools/views/create-mdx-view.js +21 -0
  463. package/dist/tools/views/create-native-view.d.ts +2 -0
  464. package/dist/tools/views/create-native-view.js +81 -0
  465. package/dist/tools/views/delete-view.d.ts +2 -0
  466. package/dist/tools/views/delete-view.js +23 -0
  467. package/dist/tools/views/list-views.d.ts +2 -0
  468. package/dist/tools/views/list-views.js +32 -0
  469. package/dist/tools/with-annotations.d.ts +6 -0
  470. package/dist/tools/with-annotations.js +339 -0
  471. package/dist/types.d.ts +409 -0
  472. package/dist/types.js +91 -0
  473. package/dist/version.d.ts +4 -0
  474. package/dist/version.js +18 -0
  475. package/package.json +107 -0
@@ -0,0 +1,131 @@
1
+ import { z } from "zod";
2
+ import { maskCode, resolveMaskSecrets } from "../../lib/mask-secrets.js";
3
+ import { commentStats } from "../../lib/strip-comments.js";
4
+ import { ProcessCodeBundleSchema } from "../schemas/items.js";
5
+ import { READ_ONLY } from "../annotations.js";
6
+ import { defineTool } from "../define-tool.js";
7
+ // Default cap for full-code responses. Whole-model code dumps flood the
8
+ // context window; 50 processes is plenty for a first look, and the response
9
+ // reports truncated=true so agents know to raise limit (or pass 0 for all).
10
+ const DEFAULT_LIMIT = 50;
11
+ // Summary mode: drop the four tab bodies, report line metrics instead so
12
+ // analysis agents can survey the process landscape without paying full token
13
+ // cost (mirrors tm1_get_all_cube_rules summary mode).
14
+ function summarize(p) {
15
+ const prolog = commentStats(p.prolog);
16
+ const metadata = commentStats(p.metadata);
17
+ const data = commentStats(p.data);
18
+ const epilog = commentStats(p.epilog);
19
+ return {
20
+ name: p.name,
21
+ hasSecurityAccess: p.hasSecurityAccess,
22
+ totalLines: prolog.totalLines +
23
+ metadata.totalLines +
24
+ data.totalLines +
25
+ epilog.totalLines,
26
+ prologLines: prolog.totalLines,
27
+ metadataLines: metadata.totalLines,
28
+ dataLines: data.totalLines,
29
+ epilogLines: epilog.totalLines,
30
+ commentLines: prolog.commentLines +
31
+ metadata.commentLines +
32
+ data.commentLines +
33
+ epilog.commentLines,
34
+ };
35
+ }
36
+ export const registerGetAllProcessesCode = defineTool({
37
+ name: "tm1_get_all_processes_code",
38
+ description: "Bulk-load source code (Prolog/Metadata/Data/Epilog) of every TI process in one call, plus each process's HasSecurityAccess elevation flag (hasSecurityAccess) for audit. Control objects (names starting with '}') excluded by default. Credential literals in the code are masked by default (maskSecrets). Full-code responses are capped at 50 processes by default (ordered by name; truncated=true when capped — raise limit or pass limit=0 for all). Set summary=true to drop the tab bodies and get per-process line metrics instead; summary mode surveys ALL processes by default. For keyword surveys prefer tm1_search_code — it avoids dumping every process body into context.",
39
+ annotations: READ_ONLY,
40
+ output: {
41
+ count: z
42
+ .number()
43
+ .int()
44
+ .describe("Total processes matched before limit (lower bound if countIsExact=false)"),
45
+ countIsExact: z
46
+ .boolean()
47
+ .describe("False when count is only a lower bound"),
48
+ returned: z
49
+ .number()
50
+ .int()
51
+ .describe("Processes in this response after limit"),
52
+ truncated: z.boolean().describe("True when limit dropped processes"),
53
+ processes: z
54
+ .array(ProcessCodeBundleSchema)
55
+ .describe("Per-process code bundles"),
56
+ },
57
+ input: {
58
+ includeControl: z
59
+ .boolean()
60
+ .optional()
61
+ .default(false)
62
+ .describe("Include TM1 control processes whose names start with '}' (default: false)"),
63
+ limit: z
64
+ .number()
65
+ .int()
66
+ .min(0)
67
+ .max(500)
68
+ .optional()
69
+ .describe("Max processes returned (default 50, max 500, 0 = all). Summary mode defaults to 0 (full survey)."),
70
+ maskSecrets: z
71
+ .boolean()
72
+ .optional()
73
+ .default(true)
74
+ .describe("Redact credential literals in every returned tab (ODBCOpen passwords, quoted values assigned to credential-named identifiers, conn-string PWD/UID pairs). " +
75
+ "Default: true. Set false only when explicitly auditing credentials."),
76
+ summary: z
77
+ .boolean()
78
+ .optional()
79
+ .default(false)
80
+ .describe("Drop the four code tabs, return per-process line metrics instead " +
81
+ "(totalLines, prologLines, metadataLines, dataLines, epilogLines, commentLines) (default: false)"),
82
+ },
83
+ handler: async ({ includeControl, limit, maskSecrets, summary }, tm1Client) => {
84
+ // Full-code mode default-caps at DEFAULT_LIMIT; summary mode defaults to
85
+ // the whole model (metrics are cheap and a partial survey would be
86
+ // misleading). Explicit limit wins in both modes; 0 = no cap.
87
+ const cap = limit ?? (summary ? 0 : DEFAULT_LIMIT);
88
+ // Server-side cap: $top=cap+1 sentinel detects truncation even if the
89
+ // server omits @odata.count; $orderby=Name keeps the cut stable.
90
+ const fetched = cap > 0
91
+ ? await tm1Client.processes.getAllCode(includeControl, cap + 1)
92
+ : {
93
+ items: await tm1Client.processes.getAllCode(includeControl),
94
+ total: undefined,
95
+ };
96
+ const truncated = cap > 0 && fetched.items.length > cap;
97
+ const kept = truncated ? fetched.items.slice(0, cap) : fetched.items;
98
+ // An uncapped fetch saw everything and @odata.count is authoritative,
99
+ // but a truncated capped fetch without @odata.count only proves "more
100
+ // than cap" — then count is a lower bound, flagged via countIsExact.
101
+ const countIsExact = !truncated || fetched.total !== undefined;
102
+ const count = fetched.total ?? fetched.items.length;
103
+ // summary mode returns no code, so masking is moot — skip the work.
104
+ const processes = summary
105
+ ? kept.map(summarize)
106
+ : resolveMaskSecrets(maskSecrets)
107
+ ? kept.map((p) => ({
108
+ ...p,
109
+ prolog: maskCode(p.prolog),
110
+ metadata: maskCode(p.metadata),
111
+ data: maskCode(p.data),
112
+ epilog: maskCode(p.epilog),
113
+ }))
114
+ : kept;
115
+ return {
116
+ content: [
117
+ {
118
+ type: "text",
119
+ text: JSON.stringify({
120
+ count,
121
+ countIsExact,
122
+ returned: processes.length,
123
+ truncated,
124
+ processes,
125
+ }),
126
+ },
127
+ ],
128
+ };
129
+ },
130
+ });
131
+ //# sourceMappingURL=get-all-processes-code.js.map
@@ -0,0 +1,2 @@
1
+ export declare const registerGetProcessCode: import("../define-tool.js").ToolRegistrar;
2
+ //# sourceMappingURL=get-process-code.d.ts.map
@@ -0,0 +1,100 @@
1
+ import { z } from "zod";
2
+ import { commentStats, stripCommentBlocks } from "../../lib/strip-comments.js";
3
+ import { maskCode, resolveMaskSecrets } from "../../lib/mask-secrets.js";
4
+ import { ProcessCodeSchema } from "../schemas/items.js";
5
+ import { READ_ONLY } from "../annotations.js";
6
+ import { defineTool } from "../define-tool.js";
7
+ // A tab counts as comment-heavy (worth flagging for stripComments) only when it
8
+ // is both long enough to matter and mostly comments.
9
+ const HEAVY_MIN_LINES = 20;
10
+ const HEAVY_RATIO = 0.4;
11
+ const TABS = ["prolog", "metadata", "data", "epilog"];
12
+ export const registerGetProcessCode = defineTool({
13
+ name: "tm1_get_process_code",
14
+ description: "Get the source code of all four tabs (Prolog, Metadata, Data, Epilog) of a TI process. " +
15
+ "Grown TM1 models often carry large blocks of commented-out dead code; set stripComments=true " +
16
+ "to collapse runs of 4+ comment lines into a `# [... N lines ...]` marker and save context.",
17
+ annotations: READ_ONLY,
18
+ output: ProcessCodeSchema,
19
+ input: {
20
+ processName: z.string().describe("Name of the TI process"),
21
+ stripComments: z
22
+ .boolean()
23
+ .optional()
24
+ .default(false)
25
+ .describe("If true, collapse blocks of 4+ consecutive comment lines into a single marker (dead-code reduction). " +
26
+ "Inline and short comments are kept. Default false (full verbatim source)."),
27
+ maskSecrets: z
28
+ .boolean()
29
+ .optional()
30
+ .default(true)
31
+ .describe("Redact credential literals in the returned code. Masks the password arg of ODBCOpen() and quoted values " +
32
+ "assigned to credential-named identifiers (pPwd, sToken, …). Default: true. Set false only when explicitly auditing credentials."),
33
+ includeSecurityAccess: z
34
+ .boolean()
35
+ .optional()
36
+ .default(false)
37
+ .describe("Also fetch process's HasSecurityAccess elevation flag (one extra GET). " +
38
+ "Default false — pure code reads stay single request."),
39
+ },
40
+ handler: async ({ processName, stripComments, maskSecrets, includeSecurityAccess }, tm1Client) => {
41
+ const code = await tm1Client.processes.getCode(processName);
42
+ let hint;
43
+ if (stripComments) {
44
+ let removedLines = 0;
45
+ let collapsedBlocks = 0;
46
+ for (const tab of TABS) {
47
+ const r = stripCommentBlocks(code[tab]);
48
+ code[tab] = r.code;
49
+ removedLines += r.removedLines;
50
+ collapsedBlocks += r.collapsedBlocks;
51
+ }
52
+ if (collapsedBlocks > 0) {
53
+ hint =
54
+ `stripComments collapsed ${collapsedBlocks} comment block(s) (${removedLines} lines) into markers. ` +
55
+ `Re-run without stripComments for the full source.`;
56
+ }
57
+ }
58
+ else {
59
+ let worst;
60
+ for (const tab of TABS) {
61
+ const s = commentStats(code[tab]);
62
+ if (s.totalLines < HEAVY_MIN_LINES)
63
+ continue;
64
+ const ratio = s.commentLines / s.totalLines;
65
+ if (ratio >= HEAVY_RATIO && (!worst || ratio > worst.ratio)) {
66
+ worst = {
67
+ tab,
68
+ total: s.totalLines,
69
+ comment: s.commentLines,
70
+ ratio,
71
+ };
72
+ }
73
+ }
74
+ if (worst) {
75
+ const pct = Math.round(worst.ratio * 100);
76
+ hint =
77
+ `${worst.tab} tab is ${pct}% comments (${worst.comment}/${worst.total} lines). ` +
78
+ `Set stripComments=true to collapse dead-code blocks and save context.`;
79
+ }
80
+ }
81
+ if (resolveMaskSecrets(maskSecrets)) {
82
+ for (const tab of TABS)
83
+ code[tab] = maskCode(code[tab]);
84
+ }
85
+ let hasSecurityAccess;
86
+ if (includeSecurityAccess) {
87
+ hasSecurityAccess = (await tm1Client.processes.getDeployMeta(processName))
88
+ .hasSecurityAccess;
89
+ }
90
+ const payload = {
91
+ ...code,
92
+ ...(hasSecurityAccess !== undefined ? { hasSecurityAccess } : {}),
93
+ ...(hint ? { hint } : {}),
94
+ };
95
+ return {
96
+ content: [{ type: "text", text: JSON.stringify(payload) }],
97
+ };
98
+ },
99
+ });
100
+ //# sourceMappingURL=get-process-code.js.map
@@ -0,0 +1,2 @@
1
+ export declare const registerGetProcessDatasource: import("../define-tool.js").ToolRegistrar;
2
+ //# sourceMappingURL=get-process-datasource.d.ts.map
@@ -0,0 +1,20 @@
1
+ import { z } from "zod";
2
+ import { FORMAT_SCHEMA, payloadResponse, renderKV } from "../format.js";
3
+ import { DataSourceSchema } from "../schemas/items.js";
4
+ import { READ_ONLY } from "../annotations.js";
5
+ import { defineTool } from "../define-tool.js";
6
+ export const registerGetProcessDatasource = defineTool({
7
+ name: "tm1_get_process_datasource",
8
+ description: "Get the data source configuration of a TurboIntegrator process. The password field is always redacted.",
9
+ annotations: READ_ONLY,
10
+ output: DataSourceSchema,
11
+ input: {
12
+ processName: z.string().describe("Name of the TI process"),
13
+ ...FORMAT_SCHEMA,
14
+ },
15
+ handler: async ({ processName, format }, tm1Client) => {
16
+ const ds = await tm1Client.processes.getDataSource(processName);
17
+ return payloadResponse(ds, format, (d) => renderKV(d, `Datasource of ${processName}`));
18
+ },
19
+ });
20
+ //# sourceMappingURL=get-process-datasource.js.map
@@ -0,0 +1,2 @@
1
+ export declare const registerGetProcessParameters: import("../define-tool.js").ToolRegistrar;
2
+ //# sourceMappingURL=get-process-parameters.d.ts.map
@@ -0,0 +1,25 @@
1
+ import { z } from "zod";
2
+ import { FORMAT_SCHEMA, payloadResponse, renderTable, columnsOf, } from "../format.js";
3
+ import { ProcessParameterSchema } from "../schemas/items.js";
4
+ import { READ_ONLY } from "../annotations.js";
5
+ import { defineTool } from "../define-tool.js";
6
+ export const registerGetProcessParameters = defineTool({
7
+ name: "tm1_get_process_parameters",
8
+ description: "Get the parameters of a TurboIntegrator process including names, types and defaults",
9
+ annotations: READ_ONLY,
10
+ output: {
11
+ processName: z.string(),
12
+ parameters: z.array(ProcessParameterSchema),
13
+ },
14
+ input: {
15
+ processName: z.string().describe("Name of the TI process"),
16
+ ...FORMAT_SCHEMA,
17
+ },
18
+ handler: async ({ processName, format }, tm1Client) => {
19
+ const params = await tm1Client.processes.getParameters(processName);
20
+ const payload = { processName, parameters: params };
21
+ const columns = columnsOf(["name", "type", "defaultValue", "prompt"]);
22
+ return payloadResponse(payload, format, (p) => `## Parameters of ${p.processName}\n\n${renderTable(p.parameters, columns)}`);
23
+ },
24
+ });
25
+ //# sourceMappingURL=get-process-parameters.js.map
@@ -0,0 +1,2 @@
1
+ export declare const registerGetProcessVariables: import("../define-tool.js").ToolRegistrar;
2
+ //# sourceMappingURL=get-process-variables.d.ts.map
@@ -0,0 +1,38 @@
1
+ import { z } from "zod";
2
+ import { FORMAT_SCHEMA, payloadResponse, renderTable, columnsOf, } from "../format.js";
3
+ import { IgnoredColumnSchema, ProcessVariableSchema, } from "../schemas/items.js";
4
+ import { READ_ONLY } from "../annotations.js";
5
+ import { defineTool } from "../define-tool.js";
6
+ export const registerGetProcessVariables = defineTool({
7
+ name: "tm1_get_process_variables",
8
+ description: "Get the variables (column-name mapping for ASCII/ODBC sources) of a TurboIntegrator process. " +
9
+ "Columns set to 'Ignore' carry no variable and are reported separately in ignoredColumns — " +
10
+ "they are the reason variable positions can have gaps.",
11
+ annotations: READ_ONLY,
12
+ output: {
13
+ processName: z.string(),
14
+ variables: z.array(ProcessVariableSchema),
15
+ ignoredColumns: z.array(IgnoredColumnSchema),
16
+ },
17
+ input: {
18
+ processName: z.string().describe("Name of the TI process"),
19
+ ...FORMAT_SCHEMA,
20
+ },
21
+ handler: async ({ processName, format }, tm1Client) => {
22
+ const { variables, ignoredColumns } = await tm1Client.processes.getVariableLayout(processName);
23
+ const payload = { processName, variables, ignoredColumns };
24
+ const columns = columnsOf([
25
+ "name",
26
+ "type",
27
+ "position",
28
+ "startByte",
29
+ "endByte",
30
+ ]);
31
+ const ignoredCols = columnsOf(["position", "name"]);
32
+ return payloadResponse(payload, format, (p) => `## Variables of ${p.processName}\n\n${renderTable(p.variables, columns)}` +
33
+ (p.ignoredColumns.length > 0
34
+ ? `\n\n### Ignored columns\n\n${renderTable(p.ignoredColumns, ignoredCols)}`
35
+ : ""));
36
+ },
37
+ });
38
+ //# sourceMappingURL=get-process-variables.js.map
@@ -0,0 +1,2 @@
1
+ export declare const registerGetProcess: import("../define-tool.js").ToolRegistrar;
2
+ //# sourceMappingURL=get-process.d.ts.map
@@ -0,0 +1,163 @@
1
+ import { z } from "zod";
2
+ import { commentStats, stripCommentBlocks } from "../../lib/strip-comments.js";
3
+ import { maskCode, resolveMaskSecrets, MASK } from "../../lib/mask-secrets.js";
4
+ import { GetProcessResultSchema } from "../schemas/items.js";
5
+ import { READ_ONLY } from "../annotations.js";
6
+ import { defineTool } from "../define-tool.js";
7
+ const TABS = ["prolog", "metadata", "data", "epilog"];
8
+ const HEAVY_MIN_LINES = 20;
9
+ const HEAVY_RATIO = 0.4;
10
+ export const registerGetProcess = defineTool({
11
+ name: "tm1_get_process",
12
+ description: "Native full read of a TI process — the read-twin of tm1_upsert_process. Returns the four code " +
13
+ "tabs, parameters, variables (plus any datasource columns set to Ignore, which carry no variable) " +
14
+ "and the HasSecurityAccess elevation flag in one call, " +
15
+ "using the same field names as upsert_process — the datasource shape is shared, so what this read " +
16
+ "returns can be fed straight back into upsert_process. Every part is behind an " +
17
+ "include-flag (all default true); set a flag false to skip that part's REST call. For git " +
18
+ "persistence use tm1_export_process_to_git instead.",
19
+ annotations: READ_ONLY,
20
+ output: GetProcessResultSchema,
21
+ input: {
22
+ processName: z.string().describe("Name of the TI process"),
23
+ includeCode: z
24
+ .boolean()
25
+ .optional()
26
+ .default(true)
27
+ .describe("Include the four code tabs (default true)."),
28
+ includeParameters: z
29
+ .boolean()
30
+ .optional()
31
+ .default(true)
32
+ .describe("Include parameters (default true)."),
33
+ includeVariables: z
34
+ .boolean()
35
+ .optional()
36
+ .default(true)
37
+ .describe("Include variables (default true)."),
38
+ includeDataSource: z
39
+ .boolean()
40
+ .optional()
41
+ .default(true)
42
+ .describe("Include the datasource config (default true)."),
43
+ includeSecurityAccess: z
44
+ .boolean()
45
+ .optional()
46
+ .default(true)
47
+ .describe("Include the HasSecurityAccess elevation flag (default true)."),
48
+ maskSecrets: z
49
+ .boolean()
50
+ .optional()
51
+ .default(true)
52
+ .describe("Redact credential literals in the code tabs (ODBCOpen passwords, credential-named vars) and credential pairs " +
53
+ "(PWD=, UID=) in the datasource's ODBC connection string. Default true; " +
54
+ "set false only when explicitly auditing credentials. Note: the datasource password field is always " +
55
+ "redacted at the service layer, so that field never reveals a real secret either way."),
56
+ stripComments: z
57
+ .boolean()
58
+ .optional()
59
+ .default(false)
60
+ .describe("Collapse runs of 4+ comment lines in the code tabs into a marker (dead-code reduction). Default false."),
61
+ },
62
+ handler: async ({ processName, includeCode = true, includeParameters = true, includeVariables = true, includeDataSource = true, includeSecurityAccess = true, maskSecrets: maskSecretsRequested = true, stripComments = false, }, tm1Client) => {
63
+ // A model-supplied `maskSecrets:false` only takes effect when the
64
+ // operator allowed it via TM1_ALLOW_UNMASKED_SECRETS.
65
+ const maskSecrets = resolveMaskSecrets(maskSecretsRequested);
66
+ const payload = { name: processName };
67
+ let hint;
68
+ // All enabled fetches run in parallel; disabled flags resolve to
69
+ // undefined so the destructuring below stays positional.
70
+ const [code, parameters, varLayout, dataSourceRaw, deployMeta] = await Promise.all([
71
+ includeCode ? tm1Client.processes.getCode(processName) : undefined,
72
+ includeParameters
73
+ ? tm1Client.processes.getParameters(processName)
74
+ : undefined,
75
+ includeVariables
76
+ ? tm1Client.processes.getVariableLayout(processName)
77
+ : undefined,
78
+ includeDataSource
79
+ ? tm1Client.processes.getDataSource(processName)
80
+ : undefined,
81
+ includeSecurityAccess
82
+ ? tm1Client.processes.getDeployMeta(processName)
83
+ : undefined,
84
+ ]);
85
+ if (code !== undefined) {
86
+ const tabs = {
87
+ prolog: code.prolog,
88
+ metadata: code.metadata,
89
+ data: code.data,
90
+ epilog: code.epilog,
91
+ };
92
+ if (stripComments) {
93
+ let removedLines = 0;
94
+ let collapsedBlocks = 0;
95
+ for (const tab of TABS) {
96
+ const r = stripCommentBlocks(tabs[tab]);
97
+ tabs[tab] = r.code;
98
+ removedLines += r.removedLines;
99
+ collapsedBlocks += r.collapsedBlocks;
100
+ }
101
+ if (collapsedBlocks > 0) {
102
+ hint =
103
+ `stripComments collapsed ${collapsedBlocks} comment block(s) (${removedLines} lines) into markers. ` +
104
+ `Re-run without stripComments for the full source.`;
105
+ }
106
+ }
107
+ else {
108
+ let worst;
109
+ for (const tab of TABS) {
110
+ const s = commentStats(tabs[tab]);
111
+ if (s.totalLines < HEAVY_MIN_LINES)
112
+ continue;
113
+ const ratio = s.commentLines / s.totalLines;
114
+ if (ratio >= HEAVY_RATIO && (!worst || ratio > worst.ratio)) {
115
+ worst = {
116
+ tab,
117
+ total: s.totalLines,
118
+ comment: s.commentLines,
119
+ ratio,
120
+ };
121
+ }
122
+ }
123
+ if (worst) {
124
+ const pct = Math.round(worst.ratio * 100);
125
+ hint =
126
+ `${worst.tab} tab is ${pct}% comments (${worst.comment}/${worst.total} lines). ` +
127
+ `Set stripComments=true to collapse dead-code blocks and save context.`;
128
+ }
129
+ }
130
+ if (maskSecrets) {
131
+ for (const tab of TABS)
132
+ tabs[tab] = maskCode(tabs[tab]);
133
+ }
134
+ Object.assign(payload, tabs);
135
+ }
136
+ if (parameters !== undefined)
137
+ payload.parameters = parameters;
138
+ if (varLayout !== undefined) {
139
+ payload.variables = varLayout.variables;
140
+ // Only reported when there are any: an ignored column is the reason the
141
+ // remaining positions have gaps, and staying silent invites the reader to
142
+ // treat the gap as a bug.
143
+ if (varLayout.ignoredColumns.length > 0)
144
+ payload.ignoredColumns = varLayout.ignoredColumns;
145
+ }
146
+ if (dataSourceRaw !== undefined) {
147
+ const ds = dataSourceRaw;
148
+ if (maskSecrets) {
149
+ if (ds.password !== undefined && ds.password !== "")
150
+ ds.password = MASK;
151
+ }
152
+ payload.dataSource = ds;
153
+ }
154
+ if (deployMeta !== undefined)
155
+ payload.hasSecurityAccess = deployMeta.hasSecurityAccess;
156
+ if (hint)
157
+ payload.hint = hint;
158
+ return {
159
+ content: [{ type: "text", text: JSON.stringify(payload) }],
160
+ };
161
+ },
162
+ });
163
+ //# sourceMappingURL=get-process.js.map
@@ -0,0 +1,2 @@
1
+ export declare const registerImportProFile: import("../define-tool.js").ToolRegistrar;
2
+ //# sourceMappingURL=import-pro-file.d.ts.map
@@ -0,0 +1,153 @@
1
+ import { promises as fs } from "node:fs";
2
+ import { resolveLocalPath } from "../local-file.js";
3
+ import { z } from "zod";
4
+ import { TM1Error, TM1ErrorCode } from "../../types.js";
5
+ import { parseProFile } from "../../lib/pro-parser.js";
6
+ import { withToolHint } from "../error-format.js";
7
+ import { IDEMPOTENT_DESTRUCTIVE, withVersion } from "../annotations.js";
8
+ import { ImportProFileResultSchema } from "../schemas/items.js";
9
+ import { defineTool } from "../define-tool.js";
10
+ import { OVERWRITE_CONFIRM_SCHEMA, requireOverwriteConfirm, } from "../confirm.js";
11
+ import { preflightResult, runPreflight } from "./preflight.js";
12
+ import { backupProcess } from "./process-backup.js";
13
+ export const registerImportProFile = defineTool({
14
+ name: "tm1_import_pro_file",
15
+ description: "Parse a TM1 .pro file (Tabs / Parameters / Variables / DataSource) and deploy the process in one call. Provide either filePath (absolute path on the MCP host) or content (the .pro file body as string). Modes: 'create' (fail if exists), 'update' (fail if missing), 'upsert' (default — create or update). A .pro carries an ODBC password only when it came from tm1_export_process_to_pro against a v12 database, which writes it in clear; TM1's own Datadir .pro encodes slot 565 in a form that cannot be replayed over REST, and v11 exports never contain a password at all. Pass dataSourcePassword in every other case.",
16
+ annotations: withVersion(IDEMPOTENT_DESTRUCTIVE, "v11"),
17
+ output: ImportProFileResultSchema,
18
+ input: {
19
+ filePath: z
20
+ .string()
21
+ .optional()
22
+ .describe("Absolute path to the .pro file on the MCP server host. Disabled unless TM1_LOCAL_FILE_ROOT is set; the path must resolve within that directory. Otherwise pass 'content' inline."),
23
+ content: z
24
+ .string()
25
+ .optional()
26
+ .describe("Raw .pro file content as string (alternative to filePath)"),
27
+ processName: z
28
+ .string()
29
+ .optional()
30
+ .describe("Override process name. Default: name parsed from .pro (602,'Name')."),
31
+ mode: z
32
+ .enum(["create", "update", "upsert"])
33
+ .optional()
34
+ .default("upsert")
35
+ .describe("Deployment mode (default: upsert)"),
36
+ preflight: z
37
+ .boolean()
38
+ .optional()
39
+ .default(true)
40
+ .describe("Run the syntax check (tm1_check_process_code) AND the reference check (tm1_validate_process_refs) on the exact payload before applying; abort on either. Default true. false skips both."),
41
+ ...OVERWRITE_CONFIRM_SCHEMA,
42
+ dataSourcePassword: z
43
+ .string()
44
+ .optional()
45
+ .describe("ODBC password to inject, in clear text; the target server encrypts it. Overrides whatever the file carries. This is the normal way to deploy an ODBC process: a .pro from TM1's own Datadir has its slot 565 ignored (that encoding cannot be replayed over REST), and a v11 export never carries a password. Ignored for non-ODBC datasources."),
46
+ },
47
+ handler: async ({ filePath, content, processName: nameOverride, mode, preflight, dataSourcePassword, confirm, }, tm1Client) => {
48
+ if (!filePath && !content) {
49
+ throw new TM1Error({
50
+ code: TM1ErrorCode.VALIDATION_ERROR,
51
+ message: "Provide filePath or content",
52
+ });
53
+ }
54
+ let body = content ?? "";
55
+ if (!body && filePath) {
56
+ body = await fs.readFile(resolveLocalPath(filePath), "utf8");
57
+ }
58
+ const parsed = parseProFile(body);
59
+ if (parsed.dataSource.type === "ODBC" && dataSourcePassword !== undefined)
60
+ parsed.dataSource.password = dataSourcePassword;
61
+ const processName = nameOverride ?? parsed.name;
62
+ if (!processName) {
63
+ throw new TM1Error({
64
+ code: TM1ErrorCode.VALIDATION_ERROR,
65
+ message: "Process name not found in .pro (602,'Name') and no name override provided",
66
+ });
67
+ }
68
+ if (preflight) {
69
+ const failure = await runPreflight(tm1Client, {
70
+ name: processName,
71
+ prolog: parsed.prolog,
72
+ metadata: parsed.metadata,
73
+ data: parsed.data,
74
+ epilog: parsed.epilog,
75
+ parameters: parsed.parameters,
76
+ variables: parsed.variables,
77
+ dataSource: parsed.dataSource,
78
+ });
79
+ if (failure)
80
+ return preflightResult(failure);
81
+ }
82
+ const allProcs = await tm1Client.processes.list();
83
+ const exists = allProcs.some((p) => p.name === processName);
84
+ if (mode === "create" && exists) {
85
+ throw new TM1Error({
86
+ code: TM1ErrorCode.CONFLICT,
87
+ message: `Process '${processName}' already exists; mode=create`,
88
+ });
89
+ }
90
+ if (mode === "update" && !exists) {
91
+ throw new TM1Error({
92
+ code: TM1ErrorCode.NOT_FOUND,
93
+ message: `Process '${processName}' does not exist; mode=update`,
94
+ });
95
+ }
96
+ // Replacing an installed process is not undoable through the API.
97
+ if (exists)
98
+ requireOverwriteConfirm(confirm, processName, "process");
99
+ // Last step before the first write: a failed backup throws, nothing is written.
100
+ const backup = exists ? await backupProcess(tm1Client, processName) : null;
101
+ const action = exists ? "updated" : "created";
102
+ if (!exists) {
103
+ await withToolHint(tm1Client.processes.create(processName), `Process create failed mid-import. Name '${processName}' may already exist (mode=create would have caught — likely race) or contain invalid characters. tm1_list_processes to verify state before retry.`);
104
+ }
105
+ await withToolHint(tm1Client.processes.updateCode(processName, {
106
+ prolog: parsed.prolog,
107
+ metadata: parsed.metadata,
108
+ data: parsed.data,
109
+ epilog: parsed.epilog,
110
+ }), `Code update failed after process '${processName}' was ${exists ? "located" : "created"}. PARTIAL APPLY: the process shell exists but tabs are stale/empty. Re-run tm1_import_pro_file with mode=update once root cause fixed, or tm1_delete_process to roll back.`);
111
+ // On an update the file replaces the whole definition, as the code tabs
112
+ // already do: an empty parameter list, variable layout or a None
113
+ // datasource is applied, not skipped. Skipping left the newer values in
114
+ // place, so importing an older version (a backup) did not restore it.
115
+ if (exists || parsed.parameters.length > 0) {
116
+ await withToolHint(tm1Client.processes.updateParameters(processName, parsed.parameters), `Parameter update failed for '${processName}'. Code applied but parameters missing. Inspect parsed parameters and re-run tm1_upsert_process with mode=update + parameters=[...] to recover.`);
117
+ }
118
+ // Ignored columns live only in the UI data, so a file can carry column
119
+ // layout with an empty variable list — patch on either.
120
+ if (exists ||
121
+ parsed.variables.length > 0 ||
122
+ parsed.variablesUIData.length > 0) {
123
+ await withToolHint(tm1Client.processes.updateVariables(processName, parsed.variables, parsed.variablesUIData.length > 0 || parsed.variables.length === 0
124
+ ? parsed.variablesUIData
125
+ : undefined), `Variable update failed for '${processName}'. Code+parameters applied but variables missing. tm1_upsert_process with mode=update + variables=[...] to recover.`);
126
+ }
127
+ if (exists || parsed.dataSource.type !== "None") {
128
+ await withToolHint(tm1Client.processes.updateDataSource(processName, parsed.dataSource), `Datasource update failed for '${processName}' (type=${parsed.dataSource.type}). Code+params+vars applied. Verify datasource credentials/path (ASCII file existence, ODBC DSN, view name) and re-run tm1_upsert_process with mode=update + dataSource={...} to recover.`);
129
+ }
130
+ return {
131
+ content: [
132
+ {
133
+ type: "text",
134
+ text: JSON.stringify({
135
+ action,
136
+ processName,
137
+ ...(backup ? { backup } : {}),
138
+ parsed: {
139
+ prologLines: parsed.prolog.split("\n").length,
140
+ metadataLines: parsed.metadata.split("\n").length,
141
+ dataLines: parsed.data.split("\n").length,
142
+ epilogLines: parsed.epilog.split("\n").length,
143
+ parameterCount: parsed.parameters.length,
144
+ variableCount: parsed.variables.length,
145
+ dataSourceType: parsed.dataSource.type,
146
+ },
147
+ }, null, 2),
148
+ },
149
+ ],
150
+ };
151
+ },
152
+ });
153
+ //# sourceMappingURL=import-pro-file.js.map
@@ -0,0 +1,2 @@
1
+ export declare const registerImportProcessFromGit: import("../define-tool.js").ToolRegistrar;
2
+ //# sourceMappingURL=import-process-from-git.d.ts.map