runline 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (230) hide show
  1. package/.pi/extensions/runline-context/index.ts +135 -0
  2. package/.pi/extensions/runline-context/package.json +17 -0
  3. package/README.md +273 -0
  4. package/dist/commands/actions.d.ts +3 -0
  5. package/dist/commands/actions.js +43 -0
  6. package/dist/commands/connection.d.ts +11 -0
  7. package/dist/commands/connection.js +56 -0
  8. package/dist/commands/exec.d.ts +5 -0
  9. package/dist/commands/exec.js +46 -0
  10. package/dist/commands/init.d.ts +4 -0
  11. package/dist/commands/init.js +26 -0
  12. package/dist/commands/plugin.d.ts +10 -0
  13. package/dist/commands/plugin.js +57 -0
  14. package/dist/config/index.d.ts +3 -0
  15. package/dist/config/index.js +2 -0
  16. package/dist/config/loader.d.ts +11 -0
  17. package/dist/config/loader.js +82 -0
  18. package/dist/config/types.d.ts +9 -0
  19. package/dist/config/types.js +5 -0
  20. package/dist/core/engine.d.ts +21 -0
  21. package/dist/core/engine.js +280 -0
  22. package/dist/index.d.ts +16 -0
  23. package/dist/index.js +9 -0
  24. package/dist/main.d.ts +2 -0
  25. package/dist/main.js +127 -0
  26. package/dist/plugin/api.d.ts +32 -0
  27. package/dist/plugin/api.js +68 -0
  28. package/dist/plugin/installer.d.ts +27 -0
  29. package/dist/plugin/installer.js +181 -0
  30. package/dist/plugin/loader.d.ts +13 -0
  31. package/dist/plugin/loader.js +164 -0
  32. package/dist/plugin/registry.d.ts +18 -0
  33. package/dist/plugin/registry.js +43 -0
  34. package/dist/plugin/types.d.ts +40 -0
  35. package/dist/plugin/types.js +1 -0
  36. package/dist/plugins/actionNetwork/src/index.js +353 -0
  37. package/dist/plugins/activeCampaign/src/index.js +711 -0
  38. package/dist/plugins/adalo/src/index.js +131 -0
  39. package/dist/plugins/affinity/src/index.js +279 -0
  40. package/dist/plugins/agileCrm/src/index.js +415 -0
  41. package/dist/plugins/airtable/src/index.js +280 -0
  42. package/dist/plugins/airtop/src/index.js +527 -0
  43. package/dist/plugins/apiTemplateIo/src/index.js +86 -0
  44. package/dist/plugins/asana/src/index.js +413 -0
  45. package/dist/plugins/autopilot/src/index.js +203 -0
  46. package/dist/plugins/bambooHr/src/index.js +252 -0
  47. package/dist/plugins/bannerbear/src/index.js +100 -0
  48. package/dist/plugins/baserow/src/index.js +180 -0
  49. package/dist/plugins/beeminder/src/index.js +298 -0
  50. package/dist/plugins/bitly/src/index.js +107 -0
  51. package/dist/plugins/bitwarden/src/index.js +383 -0
  52. package/dist/plugins/box/src/index.js +300 -0
  53. package/dist/plugins/brandfetch/src/index.js +80 -0
  54. package/dist/plugins/brevo/src/index.js +305 -0
  55. package/dist/plugins/bubble/src/index.js +181 -0
  56. package/dist/plugins/chargebee/src/index.js +126 -0
  57. package/dist/plugins/circleci/src/index.js +111 -0
  58. package/dist/plugins/ciscoWebex/src/index.js +245 -0
  59. package/dist/plugins/clearbit/src/index.js +103 -0
  60. package/dist/plugins/clickup/src/index.js +1043 -0
  61. package/dist/plugins/clockify/src/index.js +443 -0
  62. package/dist/plugins/cloudflare/src/index.js +93 -0
  63. package/dist/plugins/cockpit/src/index.js +131 -0
  64. package/dist/plugins/coda/src/index.js +327 -0
  65. package/dist/plugins/coingecko/src/index.js +244 -0
  66. package/dist/plugins/contentful/src/index.js +146 -0
  67. package/dist/plugins/convertkit/src/index.js +270 -0
  68. package/dist/plugins/copper/src/index.js +140 -0
  69. package/dist/plugins/cortex/src/index.js +147 -0
  70. package/dist/plugins/currents/src/index.js +405 -0
  71. package/dist/plugins/customerIo/src/index.js +184 -0
  72. package/dist/plugins/databricks/src/index.js +342 -0
  73. package/dist/plugins/deepl/src/index.js +87 -0
  74. package/dist/plugins/demio/src/index.js +111 -0
  75. package/dist/plugins/dhl/src/index.js +40 -0
  76. package/dist/plugins/discord/src/index.js +275 -0
  77. package/dist/plugins/discourse/src/index.js +273 -0
  78. package/dist/plugins/disqus/src/index.js +145 -0
  79. package/dist/plugins/docker/src/index.js +76 -0
  80. package/dist/plugins/drift/src/index.js +89 -0
  81. package/dist/plugins/dropbox/src/index.js +159 -0
  82. package/dist/plugins/dropcontact/src/index.js +59 -0
  83. package/dist/plugins/egoi/src/index.js +151 -0
  84. package/dist/plugins/elasticsearch/src/index.js +157 -0
  85. package/dist/plugins/emelia/src/index.js +174 -0
  86. package/dist/plugins/erpnext/src/index.js +121 -0
  87. package/dist/plugins/facebookGraph/src/index.js +57 -0
  88. package/dist/plugins/freshdesk/src/index.js +320 -0
  89. package/dist/plugins/freshservice/src/index.js +146 -0
  90. package/dist/plugins/freshworksCrm/src/index.js +149 -0
  91. package/dist/plugins/getresponse/src/index.js +140 -0
  92. package/dist/plugins/ghost/src/index.js +192 -0
  93. package/dist/plugins/github/src/index.js +630 -0
  94. package/dist/plugins/gitlab/src/index.js +358 -0
  95. package/dist/plugins/gong/src/index.js +126 -0
  96. package/dist/plugins/gotify/src/index.js +77 -0
  97. package/dist/plugins/gotowebinar/src/index.js +316 -0
  98. package/dist/plugins/grafana/src/index.js +250 -0
  99. package/dist/plugins/graphql/src/index.js +78 -0
  100. package/dist/plugins/grist/src/index.js +106 -0
  101. package/dist/plugins/hackernews/src/index.js +89 -0
  102. package/dist/plugins/halopsa/src/index.js +79 -0
  103. package/dist/plugins/harvest/src/index.js +163 -0
  104. package/dist/plugins/helpscout/src/index.js +176 -0
  105. package/dist/plugins/highlevel/src/index.js +172 -0
  106. package/dist/plugins/homeAssistant/src/index.js +148 -0
  107. package/dist/plugins/hubspot/src/index.js +176 -0
  108. package/dist/plugins/humanticAi/src/index.js +60 -0
  109. package/dist/plugins/hunter/src/index.js +59 -0
  110. package/dist/plugins/intercom/src/index.js +156 -0
  111. package/dist/plugins/iterable/src/index.js +139 -0
  112. package/dist/plugins/jenkins/src/index.js +132 -0
  113. package/dist/plugins/jira/src/index.js +229 -0
  114. package/dist/plugins/keap/src/index.js +502 -0
  115. package/dist/plugins/kobotoolbox/src/index.js +281 -0
  116. package/dist/plugins/lemlist/src/index.js +231 -0
  117. package/dist/plugins/linear/src/index.js +133 -0
  118. package/dist/plugins/lingvanex/src/index.js +31 -0
  119. package/dist/plugins/linkedin/src/index.js +80 -0
  120. package/dist/plugins/lonescale/src/index.js +119 -0
  121. package/dist/plugins/magento/src/index.js +300 -0
  122. package/dist/plugins/mailcheck/src/index.js +27 -0
  123. package/dist/plugins/mailchimp/src/index.js +321 -0
  124. package/dist/plugins/mailerlite/src/index.js +123 -0
  125. package/dist/plugins/mailgun/src/index.js +48 -0
  126. package/dist/plugins/mailjet/src/index.js +155 -0
  127. package/dist/plugins/mandrill/src/index.js +145 -0
  128. package/dist/plugins/marketstack/src/index.js +97 -0
  129. package/dist/plugins/matrix/src/index.js +194 -0
  130. package/dist/plugins/mattermost/src/index.js +331 -0
  131. package/dist/plugins/mautic/src/index.js +311 -0
  132. package/dist/plugins/medium/src/index.js +77 -0
  133. package/dist/plugins/messagebird/src/index.js +57 -0
  134. package/dist/plugins/metabase/src/index.js +130 -0
  135. package/dist/plugins/misp/src/index.js +476 -0
  136. package/dist/plugins/mocean/src/index.js +67 -0
  137. package/dist/plugins/monday/src/index.js +231 -0
  138. package/dist/plugins/monicaCrm/src/index.js +52 -0
  139. package/dist/plugins/msg91/src/index.js +31 -0
  140. package/dist/plugins/nasa/src/index.js +146 -0
  141. package/dist/plugins/netlify/src/index.js +151 -0
  142. package/dist/plugins/netscalerAdc/src/index.js +131 -0
  143. package/dist/plugins/nextcloud/src/index.js +263 -0
  144. package/dist/plugins/nocodb/src/index.js +130 -0
  145. package/dist/plugins/notion/src/index.js +112 -0
  146. package/dist/plugins/npm/src/index.js +104 -0
  147. package/dist/plugins/odoo/src/index.js +157 -0
  148. package/dist/plugins/okta/src/index.js +141 -0
  149. package/dist/plugins/oneSimpleApi/src/index.js +155 -0
  150. package/dist/plugins/onfleet/src/index.js +254 -0
  151. package/dist/plugins/openThesaurus/src/index.js +32 -0
  152. package/dist/plugins/openweathermap/src/index.js +60 -0
  153. package/dist/plugins/oura/src/index.js +62 -0
  154. package/dist/plugins/paddle/src/index.js +247 -0
  155. package/dist/plugins/pagerduty/src/index.js +201 -0
  156. package/dist/plugins/paypal/src/index.js +106 -0
  157. package/dist/plugins/peekalink/src/index.js +35 -0
  158. package/dist/plugins/phantombuster/src/index.js +94 -0
  159. package/dist/plugins/philipsHue/src/index.js +98 -0
  160. package/dist/plugins/pipedrive/src/index.js +169 -0
  161. package/dist/plugins/plivo/src/index.js +66 -0
  162. package/dist/plugins/postbin/src/index.js +93 -0
  163. package/dist/plugins/posthog/src/index.js +113 -0
  164. package/dist/plugins/profitwell/src/index.js +50 -0
  165. package/dist/plugins/pushbullet/src/index.js +102 -0
  166. package/dist/plugins/pushcut/src/index.js +39 -0
  167. package/dist/plugins/pushover/src/index.js +65 -0
  168. package/dist/plugins/quickbase/src/index.js +153 -0
  169. package/dist/plugins/quickbooks/src/index.js +73 -0
  170. package/dist/plugins/quickchart/src/index.js +36 -0
  171. package/dist/plugins/raindrop/src/index.js +209 -0
  172. package/dist/plugins/reddit/src/index.js +185 -0
  173. package/dist/plugins/rocketchat/src/index.js +53 -0
  174. package/dist/plugins/rundeck/src/index.js +62 -0
  175. package/dist/plugins/salesforce/src/index.js +94 -0
  176. package/dist/plugins/salesmate/src/index.js +83 -0
  177. package/dist/plugins/securityScorecard/src/index.js +200 -0
  178. package/dist/plugins/segment/src/index.js +125 -0
  179. package/dist/plugins/sendgrid/src/index.js +187 -0
  180. package/dist/plugins/sendy/src/index.js +138 -0
  181. package/dist/plugins/sentry/src/index.js +233 -0
  182. package/dist/plugins/servicenow/src/index.js +108 -0
  183. package/dist/plugins/shopify/src/index.js +222 -0
  184. package/dist/plugins/signl4/src/index.js +61 -0
  185. package/dist/plugins/slack/src/index.js +236 -0
  186. package/dist/plugins/sms77/src/index.js +63 -0
  187. package/dist/plugins/splunk/src/index.js +207 -0
  188. package/dist/plugins/spotify/src/index.js +188 -0
  189. package/dist/plugins/stackby/src/index.js +82 -0
  190. package/dist/plugins/storyblok/src/index.js +141 -0
  191. package/dist/plugins/strapi/src/index.js +152 -0
  192. package/dist/plugins/strava/src/index.js +137 -0
  193. package/dist/plugins/stripe/src/index.js +222 -0
  194. package/dist/plugins/supabase/src/index.js +121 -0
  195. package/dist/plugins/syncromsp/src/index.js +255 -0
  196. package/dist/plugins/tapfiliate/src/index.js +125 -0
  197. package/dist/plugins/telegram/src/index.js +233 -0
  198. package/dist/plugins/thehive/src/index.js +142 -0
  199. package/dist/plugins/thehiveProject/src/index.js +194 -0
  200. package/dist/plugins/todoist/src/index.js +244 -0
  201. package/dist/plugins/travisci/src/index.js +71 -0
  202. package/dist/plugins/trello/src/index.js +341 -0
  203. package/dist/plugins/twake/src/index.js +40 -0
  204. package/dist/plugins/twilio/src/index.js +75 -0
  205. package/dist/plugins/twist/src/index.js +90 -0
  206. package/dist/plugins/twitter/src/index.js +123 -0
  207. package/dist/plugins/unleashedSoftware/src/index.js +84 -0
  208. package/dist/plugins/uplead/src/index.js +59 -0
  209. package/dist/plugins/uproc/src/index.js +34 -0
  210. package/dist/plugins/uptimerobot/src/index.js +264 -0
  211. package/dist/plugins/urlscanio/src/index.js +64 -0
  212. package/dist/plugins/vero/src/index.js +80 -0
  213. package/dist/plugins/vonage/src/index.js +42 -0
  214. package/dist/plugins/wekan/src/index.js +91 -0
  215. package/dist/plugins/woocommerce/src/index.js +92 -0
  216. package/dist/plugins/wordpress/src/index.js +121 -0
  217. package/dist/plugins/xero/src/index.js +136 -0
  218. package/dist/plugins/yourls/src/index.js +56 -0
  219. package/dist/plugins/zammad/src/index.js +91 -0
  220. package/dist/plugins/zendesk/src/index.js +137 -0
  221. package/dist/plugins/zoho/src/index.js +85 -0
  222. package/dist/plugins/zoom/src/index.js +122 -0
  223. package/dist/plugins/zulip/src/index.js +170 -0
  224. package/dist/sdk.d.ts +38 -0
  225. package/dist/sdk.js +105 -0
  226. package/dist/utils/cli.d.ts +13 -0
  227. package/dist/utils/cli.js +32 -0
  228. package/dist/utils/output.d.ts +4 -0
  229. package/dist/utils/output.js +13 -0
  230. package/package.json +57 -0
@@ -0,0 +1,358 @@
1
+ async function apiRequest(server, token, method, endpoint, body, qs) {
2
+ const url = new URL(`${server}/api/v4${endpoint}`);
3
+ if (qs) {
4
+ for (const [k, v] of Object.entries(qs)) {
5
+ if (v !== undefined && v !== null)
6
+ url.searchParams.set(k, String(v));
7
+ }
8
+ }
9
+ const opts = {
10
+ method,
11
+ headers: { "PRIVATE-TOKEN": token, "Content-Type": "application/json" },
12
+ };
13
+ if (body && Object.keys(body).length > 0 && method !== "GET" && method !== "DELETE") {
14
+ opts.body = JSON.stringify(body);
15
+ }
16
+ const res = await fetch(url.toString(), opts);
17
+ if (!res.ok)
18
+ throw new Error(`GitLab API error ${res.status}: ${await res.text()}`);
19
+ if (res.status === 204)
20
+ return { success: true };
21
+ return res.json();
22
+ }
23
+ function getConn(ctx) {
24
+ return {
25
+ server: (ctx.connection.config.server ?? "https://gitlab.com").replace(/\/$/, ""),
26
+ token: ctx.connection.config.token,
27
+ };
28
+ }
29
+ function gl(ctx, method, endpoint, body, qs) {
30
+ const { server, token } = getConn(ctx);
31
+ return apiRequest(server, token, method, endpoint, body, qs);
32
+ }
33
+ function projectPath(owner, repo) {
34
+ return `/projects/${encodeURIComponent(`${owner}/${repo}`)}`;
35
+ }
36
+ export default function gitlab(rl) {
37
+ rl.setName("gitlab");
38
+ rl.setVersion("0.1.0");
39
+ rl.setConnectionSchema({
40
+ server: { type: "string", required: false, description: "GitLab server URL (default: https://gitlab.com)", env: "GITLAB_SERVER", default: "https://gitlab.com" },
41
+ token: { type: "string", required: true, description: "GitLab personal access token", env: "GITLAB_TOKEN" },
42
+ });
43
+ // ── Issue ───────────────────────────────────────────
44
+ rl.registerAction("issue.create", {
45
+ description: "Create an issue",
46
+ inputSchema: {
47
+ owner: { type: "string", required: true, description: "Group/user namespace" },
48
+ repo: { type: "string", required: true, description: "Project name" },
49
+ title: { type: "string", required: true, description: "Issue title" },
50
+ description: { type: "string", required: false, description: "Issue description (markdown)" },
51
+ labels: { type: "string", required: false, description: "Comma-separated labels" },
52
+ assigneeIds: { type: "array", required: false, description: "Array of assignee user IDs" },
53
+ dueDate: { type: "string", required: false, description: "Due date (YYYY-MM-DD)" },
54
+ },
55
+ async execute(input, ctx) {
56
+ const { owner, repo, title, description: desc, labels, assigneeIds, dueDate } = input;
57
+ const body = { title };
58
+ if (desc)
59
+ body.description = desc;
60
+ if (labels)
61
+ body.labels = labels;
62
+ if (assigneeIds)
63
+ body.assignee_ids = assigneeIds;
64
+ if (dueDate)
65
+ body.due_date = dueDate;
66
+ return gl(ctx, "POST", `${projectPath(owner, repo)}/issues`, body);
67
+ },
68
+ });
69
+ rl.registerAction("issue.get", {
70
+ description: "Get an issue",
71
+ inputSchema: {
72
+ owner: { type: "string", required: true, description: "Namespace" },
73
+ repo: { type: "string", required: true, description: "Project" },
74
+ issueIid: { type: "number", required: true, description: "Issue IID" },
75
+ },
76
+ async execute(input, ctx) {
77
+ const { owner, repo, issueIid } = input;
78
+ return gl(ctx, "GET", `${projectPath(owner, repo)}/issues/${issueIid}`);
79
+ },
80
+ });
81
+ rl.registerAction("issue.update", {
82
+ description: "Update an issue",
83
+ inputSchema: {
84
+ owner: { type: "string", required: true, description: "Namespace" },
85
+ repo: { type: "string", required: true, description: "Project" },
86
+ issueIid: { type: "number", required: true, description: "Issue IID" },
87
+ title: { type: "string", required: false, description: "New title" },
88
+ description: { type: "string", required: false, description: "New description" },
89
+ labels: { type: "string", required: false, description: "Comma-separated labels" },
90
+ assigneeIds: { type: "array", required: false, description: "Assignee IDs" },
91
+ stateEvent: { type: "string", required: false, description: "close or reopen" },
92
+ dueDate: { type: "string", required: false, description: "Due date" },
93
+ },
94
+ async execute(input, ctx) {
95
+ const { owner, repo, issueIid, title, description: desc, labels, assigneeIds, stateEvent, dueDate } = input;
96
+ const body = {};
97
+ if (title)
98
+ body.title = title;
99
+ if (desc !== undefined)
100
+ body.description = desc;
101
+ if (labels !== undefined)
102
+ body.labels = labels;
103
+ if (assigneeIds)
104
+ body.assignee_ids = assigneeIds;
105
+ if (stateEvent)
106
+ body.state_event = stateEvent;
107
+ if (dueDate)
108
+ body.due_date = dueDate;
109
+ return gl(ctx, "PUT", `${projectPath(owner, repo)}/issues/${issueIid}`, body);
110
+ },
111
+ });
112
+ rl.registerAction("issue.createNote", {
113
+ description: "Create a comment (note) on an issue",
114
+ inputSchema: {
115
+ owner: { type: "string", required: true, description: "Namespace" },
116
+ repo: { type: "string", required: true, description: "Project" },
117
+ issueIid: { type: "number", required: true, description: "Issue IID" },
118
+ body: { type: "string", required: true, description: "Comment body (markdown)" },
119
+ },
120
+ async execute(input, ctx) {
121
+ const { owner, repo, issueIid, body: noteBody } = input;
122
+ return gl(ctx, "POST", `${projectPath(owner, repo)}/issues/${issueIid}/notes`, { body: noteBody });
123
+ },
124
+ });
125
+ rl.registerAction("issue.lock", {
126
+ description: "Lock an issue's discussion",
127
+ inputSchema: {
128
+ owner: { type: "string", required: true, description: "Namespace" },
129
+ repo: { type: "string", required: true, description: "Project" },
130
+ issueIid: { type: "number", required: true, description: "Issue IID" },
131
+ },
132
+ async execute(input, ctx) {
133
+ const { owner, repo, issueIid } = input;
134
+ return gl(ctx, "PUT", `${projectPath(owner, repo)}/issues/${issueIid}`, { discussion_locked: true });
135
+ },
136
+ });
137
+ // ── Release ─────────────────────────────────────────
138
+ rl.registerAction("release.create", {
139
+ description: "Create a release",
140
+ inputSchema: {
141
+ projectId: { type: "string", required: true, description: "Project ID or path" },
142
+ tagName: { type: "string", required: true, description: "Tag name" },
143
+ name: { type: "string", required: false, description: "Release name" },
144
+ description: { type: "string", required: false, description: "Release notes (markdown)" },
145
+ ref: { type: "string", required: false, description: "Commit SHA or branch for new tag" },
146
+ milestones: { type: "array", required: false, description: "Milestone titles" },
147
+ },
148
+ async execute(input, ctx) {
149
+ const { projectId, tagName, name, description: desc, ref, milestones } = input;
150
+ const body = { tag_name: tagName };
151
+ if (name)
152
+ body.name = name;
153
+ if (desc)
154
+ body.description = desc;
155
+ if (ref)
156
+ body.ref = ref;
157
+ if (milestones)
158
+ body.milestones = milestones;
159
+ return gl(ctx, "POST", `/projects/${encodeURIComponent(projectId)}/releases`, body);
160
+ },
161
+ });
162
+ rl.registerAction("release.get", {
163
+ description: "Get a release by tag",
164
+ inputSchema: {
165
+ projectId: { type: "string", required: true, description: "Project ID or path" },
166
+ tagName: { type: "string", required: true, description: "Tag name" },
167
+ },
168
+ async execute(input, ctx) {
169
+ const { projectId, tagName } = input;
170
+ return gl(ctx, "GET", `/projects/${encodeURIComponent(projectId)}/releases/${encodeURIComponent(tagName)}`);
171
+ },
172
+ });
173
+ rl.registerAction("release.list", {
174
+ description: "List releases",
175
+ inputSchema: {
176
+ projectId: { type: "string", required: true, description: "Project ID or path" },
177
+ limit: { type: "number", required: false, description: "Max results" },
178
+ orderBy: { type: "string", required: false, description: "released_at or created_at" },
179
+ sort: { type: "string", required: false, description: "asc or desc" },
180
+ },
181
+ async execute(input, ctx) {
182
+ const { projectId, limit, orderBy, sort } = (input ?? {});
183
+ const qs = {};
184
+ if (limit)
185
+ qs.per_page = limit;
186
+ if (orderBy)
187
+ qs.order_by = orderBy;
188
+ if (sort)
189
+ qs.sort = sort;
190
+ return gl(ctx, "GET", `/projects/${encodeURIComponent(projectId)}/releases`, undefined, qs);
191
+ },
192
+ });
193
+ rl.registerAction("release.update", {
194
+ description: "Update a release",
195
+ inputSchema: {
196
+ projectId: { type: "string", required: true, description: "Project ID or path" },
197
+ tagName: { type: "string", required: true, description: "Tag name" },
198
+ name: { type: "string", required: false, description: "New name" },
199
+ description: { type: "string", required: false, description: "New description" },
200
+ milestones: { type: "array", required: false, description: "Milestone titles" },
201
+ },
202
+ async execute(input, ctx) {
203
+ const { projectId, tagName, name, description: desc, milestones } = input;
204
+ const body = {};
205
+ if (name)
206
+ body.name = name;
207
+ if (desc !== undefined)
208
+ body.description = desc;
209
+ if (milestones)
210
+ body.milestones = milestones;
211
+ return gl(ctx, "PUT", `/projects/${encodeURIComponent(projectId)}/releases/${encodeURIComponent(tagName)}`, body);
212
+ },
213
+ });
214
+ rl.registerAction("release.delete", {
215
+ description: "Delete a release",
216
+ inputSchema: {
217
+ projectId: { type: "string", required: true, description: "Project ID or path" },
218
+ tagName: { type: "string", required: true, description: "Tag name" },
219
+ },
220
+ async execute(input, ctx) {
221
+ const { projectId, tagName } = input;
222
+ await gl(ctx, "DELETE", `/projects/${encodeURIComponent(projectId)}/releases/${encodeURIComponent(tagName)}`);
223
+ return { success: true };
224
+ },
225
+ });
226
+ // ── Repository ──────────────────────────────────────
227
+ rl.registerAction("repository.get", {
228
+ description: "Get project details",
229
+ inputSchema: {
230
+ owner: { type: "string", required: true, description: "Namespace" },
231
+ repo: { type: "string", required: true, description: "Project" },
232
+ },
233
+ async execute(input, ctx) {
234
+ const { owner, repo } = input;
235
+ return gl(ctx, "GET", projectPath(owner, repo));
236
+ },
237
+ });
238
+ rl.registerAction("repository.listIssues", {
239
+ description: "List issues for a project",
240
+ inputSchema: {
241
+ owner: { type: "string", required: true, description: "Namespace" },
242
+ repo: { type: "string", required: true, description: "Project" },
243
+ state: { type: "string", required: false, description: "opened, closed, all" },
244
+ labels: { type: "string", required: false, description: "Comma-separated labels" },
245
+ limit: { type: "number", required: false, description: "Max results" },
246
+ },
247
+ async execute(input, ctx) {
248
+ const { owner, repo, state, labels, limit } = (input ?? {});
249
+ const qs = {};
250
+ if (state)
251
+ qs.state = state;
252
+ if (labels)
253
+ qs.labels = labels;
254
+ if (limit)
255
+ qs.per_page = limit;
256
+ return gl(ctx, "GET", `${projectPath(owner, repo)}/issues`, undefined, qs);
257
+ },
258
+ });
259
+ // ── User ────────────────────────────────────────────
260
+ rl.registerAction("user.listProjects", {
261
+ description: "List projects for a user",
262
+ inputSchema: {
263
+ username: { type: "string", required: true, description: "Username" },
264
+ limit: { type: "number", required: false, description: "Max results" },
265
+ },
266
+ async execute(input, ctx) {
267
+ const { username, limit } = (input ?? {});
268
+ const qs = {};
269
+ if (limit)
270
+ qs.per_page = limit;
271
+ return gl(ctx, "GET", `/users/${username}/projects`, undefined, qs);
272
+ },
273
+ });
274
+ // ── File ────────────────────────────────────────────
275
+ rl.registerAction("file.get", {
276
+ description: "Get a file from repository",
277
+ inputSchema: {
278
+ owner: { type: "string", required: true, description: "Namespace" },
279
+ repo: { type: "string", required: true, description: "Project" },
280
+ filePath: { type: "string", required: true, description: "File path" },
281
+ ref: { type: "string", required: false, description: "Branch/tag/SHA (default: default branch)" },
282
+ },
283
+ async execute(input, ctx) {
284
+ const { owner, repo, filePath, ref = "main" } = input;
285
+ return gl(ctx, "GET", `${projectPath(owner, repo)}/repository/files/${encodeURIComponent(filePath)}`, undefined, { ref });
286
+ },
287
+ });
288
+ rl.registerAction("file.createOrUpdate", {
289
+ description: "Create or update a file in repository",
290
+ inputSchema: {
291
+ owner: { type: "string", required: true, description: "Namespace" },
292
+ repo: { type: "string", required: true, description: "Project" },
293
+ filePath: { type: "string", required: true, description: "File path" },
294
+ content: { type: "string", required: true, description: "File content" },
295
+ branch: { type: "string", required: true, description: "Target branch" },
296
+ commitMessage: { type: "string", required: true, description: "Commit message" },
297
+ startBranch: { type: "string", required: false, description: "Base branch for new branch" },
298
+ encoding: { type: "string", required: false, description: "text (default) or base64" },
299
+ authorName: { type: "string", required: false, description: "Commit author name" },
300
+ authorEmail: { type: "string", required: false, description: "Commit author email" },
301
+ isUpdate: { type: "boolean", required: false, description: "true=PUT (update), false=POST (create, default)" },
302
+ },
303
+ async execute(input, ctx) {
304
+ const { owner, repo, filePath, content, branch, commitMessage, startBranch, encoding, authorName, authorEmail, isUpdate } = input;
305
+ const body = { branch, commit_message: commitMessage, content };
306
+ if (startBranch)
307
+ body.start_branch = startBranch;
308
+ if (encoding)
309
+ body.encoding = encoding;
310
+ if (authorName)
311
+ body.author_name = authorName;
312
+ if (authorEmail)
313
+ body.author_email = authorEmail;
314
+ const method = isUpdate ? "PUT" : "POST";
315
+ return gl(ctx, method, `${projectPath(owner, repo)}/repository/files/${encodeURIComponent(filePath)}`, body);
316
+ },
317
+ });
318
+ rl.registerAction("file.delete", {
319
+ description: "Delete a file from repository",
320
+ inputSchema: {
321
+ owner: { type: "string", required: true, description: "Namespace" },
322
+ repo: { type: "string", required: true, description: "Project" },
323
+ filePath: { type: "string", required: true, description: "File path" },
324
+ branch: { type: "string", required: true, description: "Branch" },
325
+ commitMessage: { type: "string", required: true, description: "Commit message" },
326
+ },
327
+ async execute(input, ctx) {
328
+ const { owner, repo, filePath, branch, commitMessage } = input;
329
+ return gl(ctx, "DELETE", `${projectPath(owner, repo)}/repository/files/${encodeURIComponent(filePath)}`, {
330
+ branch, commit_message: commitMessage,
331
+ });
332
+ },
333
+ });
334
+ rl.registerAction("file.list", {
335
+ description: "List repository tree (directory contents)",
336
+ inputSchema: {
337
+ owner: { type: "string", required: true, description: "Namespace" },
338
+ repo: { type: "string", required: true, description: "Project" },
339
+ path: { type: "string", required: false, description: "Directory path" },
340
+ ref: { type: "string", required: false, description: "Branch/tag/SHA" },
341
+ recursive: { type: "boolean", required: false, description: "List recursively" },
342
+ limit: { type: "number", required: false, description: "Max results" },
343
+ },
344
+ async execute(input, ctx) {
345
+ const { owner, repo, path, ref, recursive, limit } = (input ?? {});
346
+ const qs = {};
347
+ if (path)
348
+ qs.path = path;
349
+ if (ref)
350
+ qs.ref = ref;
351
+ if (recursive)
352
+ qs.recursive = true;
353
+ if (limit)
354
+ qs.per_page = limit;
355
+ return gl(ctx, "GET", `${projectPath(owner, repo)}/repository/tree`, undefined, qs);
356
+ },
357
+ });
358
+ }
@@ -0,0 +1,126 @@
1
+ async function apiRequest(baseUrl, accessKey, accessKeySecret, method, endpoint, body) {
2
+ const opts = {
3
+ method,
4
+ headers: {
5
+ Authorization: `Basic ${btoa(`${accessKey}:${accessKeySecret}`)}`,
6
+ "Content-Type": "application/json",
7
+ },
8
+ };
9
+ if (body && Object.keys(body).length > 0) {
10
+ opts.body = JSON.stringify(body);
11
+ }
12
+ const res = await fetch(`${baseUrl}${endpoint}`, opts);
13
+ if (!res.ok)
14
+ throw new Error(`Gong API error ${res.status}: ${await res.text()}`);
15
+ return res.json();
16
+ }
17
+ async function paginate(baseUrl, accessKey, accessKeySecret, endpoint, body, resultKey, limit) {
18
+ const results = [];
19
+ let cursor;
20
+ do {
21
+ const reqBody = { ...body };
22
+ if (cursor)
23
+ reqBody.cursor = cursor;
24
+ const data = (await apiRequest(baseUrl, accessKey, accessKeySecret, "POST", endpoint, reqBody));
25
+ const items = data[resultKey] ?? [];
26
+ results.push(...items);
27
+ cursor = data.records?.cursor;
28
+ if (limit && results.length >= limit)
29
+ break;
30
+ } while (cursor);
31
+ return limit ? results.slice(0, limit) : results;
32
+ }
33
+ function getConn(ctx) {
34
+ return {
35
+ baseUrl: (ctx.connection.config.baseUrl ?? "https://api.gong.io").replace(/\/$/, ""),
36
+ accessKey: ctx.connection.config.accessKey,
37
+ accessKeySecret: ctx.connection.config.accessKeySecret,
38
+ };
39
+ }
40
+ export default function gong(rl) {
41
+ rl.setName("gong");
42
+ rl.setVersion("0.1.0");
43
+ rl.setConnectionSchema({
44
+ baseUrl: { type: "string", required: false, description: "Gong API base URL (default: https://api.gong.io)", env: "GONG_BASE_URL", default: "https://api.gong.io" },
45
+ accessKey: { type: "string", required: true, description: "Gong API access key", env: "GONG_ACCESS_KEY" },
46
+ accessKeySecret: { type: "string", required: true, description: "Gong API access key secret", env: "GONG_ACCESS_KEY_SECRET" },
47
+ });
48
+ rl.registerAction("call.get", {
49
+ description: "Get detailed call data",
50
+ inputSchema: {
51
+ callId: { type: "string", required: true, description: "Call ID" },
52
+ contentSelector: { type: "object", required: false, description: "Content selector for what data to include (exposedFields object)" },
53
+ },
54
+ async execute(input, ctx) {
55
+ const { callId, contentSelector } = input;
56
+ const { baseUrl, accessKey, accessKeySecret } = getConn(ctx);
57
+ const body = { filter: { callIds: [callId] } };
58
+ if (contentSelector)
59
+ body.contentSelector = contentSelector;
60
+ const data = (await apiRequest(baseUrl, accessKey, accessKeySecret, "POST", "/v2/calls/extensive", body));
61
+ const calls = data.calls;
62
+ return calls?.[0];
63
+ },
64
+ });
65
+ rl.registerAction("call.list", {
66
+ description: "List calls",
67
+ inputSchema: {
68
+ limit: { type: "number", required: false, description: "Max results" },
69
+ fromDateTime: { type: "string", required: false, description: "Calls started after (ISO 8601)" },
70
+ toDateTime: { type: "string", required: false, description: "Calls started before (ISO 8601)" },
71
+ workspaceId: { type: "string", required: false, description: "Filter by workspace" },
72
+ callIds: { type: "array", required: false, description: "Specific call IDs" },
73
+ primaryUserIds: { type: "array", required: false, description: "Filter by organizer user IDs" },
74
+ },
75
+ async execute(input, ctx) {
76
+ const { limit, fromDateTime, toDateTime, workspaceId, callIds, primaryUserIds } = (input ?? {});
77
+ const { baseUrl, accessKey, accessKeySecret } = getConn(ctx);
78
+ const filter = {};
79
+ if (fromDateTime)
80
+ filter.fromDateTime = fromDateTime;
81
+ if (toDateTime)
82
+ filter.toDateTime = toDateTime;
83
+ if (workspaceId)
84
+ filter.workspaceId = workspaceId;
85
+ if (callIds)
86
+ filter.callIds = callIds;
87
+ if (primaryUserIds)
88
+ filter.primaryUserIds = primaryUserIds;
89
+ return paginate(baseUrl, accessKey, accessKeySecret, "/v2/calls/extensive", { filter }, "calls", limit);
90
+ },
91
+ });
92
+ rl.registerAction("user.get", {
93
+ description: "Get a user",
94
+ inputSchema: { userId: { type: "string", required: true, description: "User ID" } },
95
+ async execute(input, ctx) {
96
+ const { userId } = input;
97
+ const { baseUrl, accessKey, accessKeySecret } = getConn(ctx);
98
+ const data = (await apiRequest(baseUrl, accessKey, accessKeySecret, "POST", "/v2/users/extensive", {
99
+ filter: { userIds: [userId] },
100
+ }));
101
+ const users = data.users;
102
+ return users?.[0];
103
+ },
104
+ });
105
+ rl.registerAction("user.list", {
106
+ description: "List users",
107
+ inputSchema: {
108
+ limit: { type: "number", required: false, description: "Max results" },
109
+ createdFromDateTime: { type: "string", required: false, description: "Users created after (ISO 8601)" },
110
+ createdToDateTime: { type: "string", required: false, description: "Users created before (ISO 8601)" },
111
+ userIds: { type: "array", required: false, description: "Specific user IDs" },
112
+ },
113
+ async execute(input, ctx) {
114
+ const { limit, createdFromDateTime, createdToDateTime, userIds } = (input ?? {});
115
+ const { baseUrl, accessKey, accessKeySecret } = getConn(ctx);
116
+ const filter = {};
117
+ if (createdFromDateTime)
118
+ filter.createdFromDateTime = createdFromDateTime;
119
+ if (createdToDateTime)
120
+ filter.createdToDateTime = createdToDateTime;
121
+ if (userIds)
122
+ filter.userIds = userIds;
123
+ return paginate(baseUrl, accessKey, accessKeySecret, "/v2/users/extensive", { filter }, "users", limit);
124
+ },
125
+ });
126
+ }
@@ -0,0 +1,77 @@
1
+ async function apiRequest(url, token, method, endpoint, body, qs) {
2
+ const fullUrl = new URL(`${url}${endpoint}`);
3
+ if (qs) {
4
+ for (const [k, v] of Object.entries(qs)) {
5
+ if (v !== undefined && v !== null)
6
+ fullUrl.searchParams.set(k, String(v));
7
+ }
8
+ }
9
+ const opts = {
10
+ method,
11
+ headers: { "X-Gotify-Key": token, Accept: "application/json", "Content-Type": "application/json" },
12
+ };
13
+ if (body && Object.keys(body).length > 0 && method !== "GET" && method !== "DELETE") {
14
+ opts.body = JSON.stringify(body);
15
+ }
16
+ const res = await fetch(fullUrl.toString(), opts);
17
+ if (!res.ok)
18
+ throw new Error(`Gotify API error ${res.status}: ${await res.text()}`);
19
+ if (res.status === 204)
20
+ return { success: true };
21
+ return res.json();
22
+ }
23
+ export default function gotify(rl) {
24
+ rl.setName("gotify");
25
+ rl.setVersion("0.1.0");
26
+ rl.setConnectionSchema({
27
+ url: { type: "string", required: true, description: "Gotify server URL (e.g. https://gotify.example.com)", env: "GOTIFY_URL" },
28
+ appApiToken: { type: "string", required: true, description: "Application token (for sending messages)", env: "GOTIFY_APP_TOKEN" },
29
+ clientApiToken: { type: "string", required: true, description: "Client token (for reading/deleting)", env: "GOTIFY_CLIENT_TOKEN" },
30
+ });
31
+ rl.registerAction("message.create", {
32
+ description: "Send a push message",
33
+ inputSchema: {
34
+ message: { type: "string", required: true, description: "Message text" },
35
+ title: { type: "string", required: false, description: "Message title" },
36
+ priority: { type: "number", required: false, description: "Priority (default: 1)" },
37
+ contentType: { type: "string", required: false, description: "text/plain (default) or text/markdown" },
38
+ },
39
+ async execute(input, ctx) {
40
+ const { message, title, priority, contentType } = input;
41
+ const url = ctx.connection.config.url.replace(/\/$/, "");
42
+ const token = ctx.connection.config.appApiToken;
43
+ const body = { message };
44
+ if (title)
45
+ body.title = title;
46
+ if (priority !== undefined)
47
+ body.priority = priority;
48
+ if (contentType)
49
+ body.extras = { "client::display": { contentType } };
50
+ return apiRequest(url, token, "POST", "/message", body);
51
+ },
52
+ });
53
+ rl.registerAction("message.delete", {
54
+ description: "Delete a message",
55
+ inputSchema: { messageId: { type: "string", required: true, description: "Message ID" } },
56
+ async execute(input, ctx) {
57
+ const url = ctx.connection.config.url.replace(/\/$/, "");
58
+ const token = ctx.connection.config.clientApiToken;
59
+ await apiRequest(url, token, "DELETE", `/message/${input.messageId}`);
60
+ return { success: true };
61
+ },
62
+ });
63
+ rl.registerAction("message.list", {
64
+ description: "List messages",
65
+ inputSchema: { limit: { type: "number", required: false, description: "Max results" } },
66
+ async execute(input, ctx) {
67
+ const { limit } = (input ?? {});
68
+ const url = ctx.connection.config.url.replace(/\/$/, "");
69
+ const token = ctx.connection.config.clientApiToken;
70
+ const qs = {};
71
+ if (limit)
72
+ qs.limit = limit;
73
+ const data = (await apiRequest(url, token, "GET", "/message", undefined, qs));
74
+ return data.messages;
75
+ },
76
+ });
77
+ }