@guildai/cli 0.10.0 → 0.12.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 (203) hide show
  1. package/dist/auth-CRMO5O3N.js +29 -0
  2. package/dist/auth-CRMO5O3N.js.map +7 -0
  3. package/dist/chat-5VX2WJH2.js +303 -0
  4. package/dist/chat-5VX2WJH2.js.map +7 -0
  5. package/dist/chat-SIKDYZQK.js +31 -0
  6. package/dist/chat-SIKDYZQK.js.map +7 -0
  7. package/dist/chunk-56YCMGL3.js +522 -0
  8. package/dist/chunk-56YCMGL3.js.map +7 -0
  9. package/dist/chunk-6EX6E7WP.js +7042 -0
  10. package/dist/chunk-6EX6E7WP.js.map +7 -0
  11. package/dist/chunk-B7VAF5UG.js +532 -0
  12. package/dist/chunk-B7VAF5UG.js.map +7 -0
  13. package/dist/chunk-DOIYVBNY.js +3057 -0
  14. package/dist/chunk-DOIYVBNY.js.map +7 -0
  15. package/dist/chunk-ENKEEJ45.js +17 -0
  16. package/dist/chunk-ENKEEJ45.js.map +7 -0
  17. package/dist/chunk-IBRKVGMZ.js +97041 -0
  18. package/dist/chunk-IBRKVGMZ.js.map +7 -0
  19. package/dist/chunk-LFMQJOKC.js +19778 -0
  20. package/dist/chunk-LFMQJOKC.js.map +7 -0
  21. package/dist/chunk-M347HP6M.js +22896 -0
  22. package/dist/chunk-M347HP6M.js.map +7 -0
  23. package/dist/chunk-OYQ476FQ.js +44 -0
  24. package/dist/chunk-OYQ476FQ.js.map +7 -0
  25. package/dist/chunk-PNCUR4OB.js +257 -0
  26. package/dist/chunk-PNCUR4OB.js.map +7 -0
  27. package/dist/chunk-RIG2HZWM.js +317 -0
  28. package/dist/chunk-RIG2HZWM.js.map +7 -0
  29. package/dist/chunk-SPZPZXUN.js +826 -0
  30. package/dist/chunk-SPZPZXUN.js.map +7 -0
  31. package/dist/chunk-VVSOU6ON.js +53 -0
  32. package/dist/chunk-VVSOU6ON.js.map +7 -0
  33. package/dist/chunk-X3ADGWOF.js +3643 -0
  34. package/dist/chunk-X3ADGWOF.js.map +7 -0
  35. package/dist/commands/agent/logs.d.ts +3 -0
  36. package/dist/commands/setup.d.ts +16 -0
  37. package/dist/commands/skill/create.d.ts +3 -0
  38. package/dist/commands/skill/get.d.ts +3 -0
  39. package/dist/commands/skill/list.d.ts +3 -0
  40. package/dist/commands/skill/update.d.ts +3 -0
  41. package/dist/commands/skill/version/create.d.ts +3 -0
  42. package/dist/commands/skill/version/get.d.ts +3 -0
  43. package/dist/commands/skill/version/list.d.ts +3 -0
  44. package/dist/devtools-AO7YSDOD.js +67 -0
  45. package/dist/devtools-AO7YSDOD.js.map +7 -0
  46. package/dist/dist-4CBK6X5H.js +1566 -0
  47. package/dist/dist-4CBK6X5H.js.map +7 -0
  48. package/dist/esm-FRAVZP4J.js +13 -0
  49. package/dist/esm-FRAVZP4J.js.map +7 -0
  50. package/dist/execa-XQMWSABC.js +35 -0
  51. package/dist/execa-XQMWSABC.js.map +7 -0
  52. package/dist/index.js +8231 -253
  53. package/dist/index.js.map +7 -0
  54. package/dist/lib/api-types.d.ts +44 -0
  55. package/dist/lib/auth.d.ts +1 -1
  56. package/dist/lib/config.d.ts +9 -0
  57. package/dist/lib/errors.d.ts +1 -1
  58. package/dist/lib/output-mode.d.ts +9 -2
  59. package/dist/lib/output.d.ts +17 -1
  60. package/dist/lib/session-events.d.ts +14 -3
  61. package/dist/lib/session-polling.d.ts +24 -1
  62. package/dist/lib/session-resume.d.ts +15 -1
  63. package/dist/lib/stdin.d.ts +5 -1
  64. package/dist/lib/websocket-client.d.ts +46 -0
  65. package/dist/open-RF4X5MOP.js +13 -0
  66. package/dist/open-RF4X5MOP.js.map +7 -0
  67. package/dist/server-JYVH64FD.js +27659 -0
  68. package/dist/server-JYVH64FD.js.map +7 -0
  69. package/dist/test-SNIYRJ32.js +692 -0
  70. package/dist/test-SNIYRJ32.js.map +7 -0
  71. package/docs/skills/codex-agent-dev.md +2 -2
  72. package/package.json +8 -12
  73. package/dist/commands/agent/chat.js +0 -278
  74. package/dist/commands/agent/clone.js +0 -116
  75. package/dist/commands/agent/code.js +0 -87
  76. package/dist/commands/agent/fork.js +0 -218
  77. package/dist/commands/agent/get.js +0 -37
  78. package/dist/commands/agent/grep.js +0 -107
  79. package/dist/commands/agent/init.js +0 -390
  80. package/dist/commands/agent/list.js +0 -110
  81. package/dist/commands/agent/owners.js +0 -74
  82. package/dist/commands/agent/publish.js +0 -91
  83. package/dist/commands/agent/pull.js +0 -198
  84. package/dist/commands/agent/revalidate.js +0 -56
  85. package/dist/commands/agent/save.js +0 -346
  86. package/dist/commands/agent/search.js +0 -61
  87. package/dist/commands/agent/tags/add.js +0 -73
  88. package/dist/commands/agent/tags/list.js +0 -43
  89. package/dist/commands/agent/tags/remove.js +0 -84
  90. package/dist/commands/agent/tags/set.js +0 -71
  91. package/dist/commands/agent/test.js +0 -486
  92. package/dist/commands/agent/unpublish.js +0 -64
  93. package/dist/commands/agent/update.js +0 -110
  94. package/dist/commands/agent/versions.js +0 -55
  95. package/dist/commands/agent/workspaces.js +0 -54
  96. package/dist/commands/auth/login.js +0 -33
  97. package/dist/commands/auth/logout.js +0 -24
  98. package/dist/commands/auth/status.js +0 -38
  99. package/dist/commands/auth/token.js +0 -19
  100. package/dist/commands/chat.js +0 -1345
  101. package/dist/commands/config/get.js +0 -64
  102. package/dist/commands/config/list.js +0 -47
  103. package/dist/commands/config/path.js +0 -38
  104. package/dist/commands/config/set.js +0 -132
  105. package/dist/commands/credentials/endpoint-list.js +0 -88
  106. package/dist/commands/credentials/list.js +0 -50
  107. package/dist/commands/credentials/policy-create.js +0 -66
  108. package/dist/commands/credentials/policy-delete.js +0 -33
  109. package/dist/commands/credentials/policy-list.js +0 -45
  110. package/dist/commands/credentials/policy-update.js +0 -66
  111. package/dist/commands/doctor.js +0 -233
  112. package/dist/commands/integration/connect.js +0 -76
  113. package/dist/commands/integration/create.js +0 -298
  114. package/dist/commands/integration/get.js +0 -95
  115. package/dist/commands/integration/list.js +0 -62
  116. package/dist/commands/integration/operation/create.js +0 -164
  117. package/dist/commands/integration/operation/list.js +0 -92
  118. package/dist/commands/integration/update.js +0 -139
  119. package/dist/commands/integration/version/build.js +0 -86
  120. package/dist/commands/integration/version/create.js +0 -45
  121. package/dist/commands/integration/version/get.js +0 -72
  122. package/dist/commands/integration/version/list.js +0 -45
  123. package/dist/commands/integration/version/publish.js +0 -79
  124. package/dist/commands/integration/version/test.js +0 -104
  125. package/dist/commands/job/get-step.js +0 -40
  126. package/dist/commands/job/get.js +0 -44
  127. package/dist/commands/mcp.js +0 -34
  128. package/dist/commands/session/create.js +0 -59
  129. package/dist/commands/session/events.js +0 -56
  130. package/dist/commands/session/get.js +0 -33
  131. package/dist/commands/session/interrupt.js +0 -33
  132. package/dist/commands/session/list.js +0 -59
  133. package/dist/commands/session/send.js +0 -54
  134. package/dist/commands/session/tasks.js +0 -45
  135. package/dist/commands/setup.js +0 -230
  136. package/dist/commands/trigger/activate.js +0 -41
  137. package/dist/commands/trigger/create.js +0 -197
  138. package/dist/commands/trigger/deactivate.js +0 -41
  139. package/dist/commands/trigger/get.js +0 -33
  140. package/dist/commands/trigger/list.js +0 -57
  141. package/dist/commands/trigger/sessions.js +0 -48
  142. package/dist/commands/trigger/update.js +0 -128
  143. package/dist/commands/version.js +0 -24
  144. package/dist/commands/workspace/agent/add.js +0 -114
  145. package/dist/commands/workspace/agent/list.js +0 -78
  146. package/dist/commands/workspace/agent/remove.js +0 -78
  147. package/dist/commands/workspace/clear.js +0 -45
  148. package/dist/commands/workspace/context/edit.js +0 -107
  149. package/dist/commands/workspace/context/get.js +0 -47
  150. package/dist/commands/workspace/context/list.js +0 -51
  151. package/dist/commands/workspace/context/publish.js +0 -42
  152. package/dist/commands/workspace/create.js +0 -51
  153. package/dist/commands/workspace/current.js +0 -63
  154. package/dist/commands/workspace/get.js +0 -39
  155. package/dist/commands/workspace/list.js +0 -70
  156. package/dist/commands/workspace/select.js +0 -184
  157. package/dist/components/AgentInstallPrompt.js +0 -97
  158. package/dist/components/SplashAnimation.js +0 -321
  159. package/dist/components/TaskView.js +0 -268
  160. package/dist/lib/agent-helpers.js +0 -306
  161. package/dist/lib/alternate-screen.js +0 -59
  162. package/dist/lib/api-client.js +0 -154
  163. package/dist/lib/api-types.js +0 -10
  164. package/dist/lib/auth.js +0 -284
  165. package/dist/lib/braille-canvas.js +0 -321
  166. package/dist/lib/colors.js +0 -46
  167. package/dist/lib/config-cache.js +0 -45
  168. package/dist/lib/config.js +0 -153
  169. package/dist/lib/did-you-mean.js +0 -144
  170. package/dist/lib/errors.js +0 -375
  171. package/dist/lib/event-filter.js +0 -91
  172. package/dist/lib/generated-types.js +0 -56
  173. package/dist/lib/git.js +0 -176
  174. package/dist/lib/gk.js +0 -91
  175. package/dist/lib/guild-config.js +0 -178
  176. package/dist/lib/iap.js +0 -117
  177. package/dist/lib/integration-helpers.js +0 -38
  178. package/dist/lib/loading-messages.js +0 -72
  179. package/dist/lib/logo.js +0 -141
  180. package/dist/lib/lottie-serverside.js +0 -181
  181. package/dist/lib/markdown.js +0 -38
  182. package/dist/lib/npmrc.js +0 -59
  183. package/dist/lib/output-mode.js +0 -33
  184. package/dist/lib/output.js +0 -591
  185. package/dist/lib/owner-helpers.js +0 -112
  186. package/dist/lib/polling.js +0 -76
  187. package/dist/lib/progress.js +0 -324
  188. package/dist/lib/session-events-fetch.js +0 -25
  189. package/dist/lib/session-events.js +0 -112
  190. package/dist/lib/session-polling.js +0 -160
  191. package/dist/lib/session-resume.js +0 -96
  192. package/dist/lib/spinners.js +0 -770
  193. package/dist/lib/splash.js +0 -41
  194. package/dist/lib/stdin.js +0 -84
  195. package/dist/lib/svg-to-braille.js +0 -76
  196. package/dist/lib/table.js +0 -59
  197. package/dist/lib/update-check.js +0 -65
  198. package/dist/lib/validate-input-schema.js +0 -208
  199. package/dist/lib/version-helpers.js +0 -121
  200. package/dist/lib/workspace-helpers.js +0 -49
  201. package/dist/mcp/resources.js +0 -67
  202. package/dist/mcp/server.js +0 -64
  203. package/dist/mcp/tools.js +0 -753
@@ -1,95 +0,0 @@
1
- // Copyright 2026 Guild.ai
2
- // SPDX-License-Identifier: Apache-2.0
3
- import { Command } from 'commander';
4
- import chalk from 'chalk';
5
- import { GuildAPIClient } from '../../lib/api-client.js';
6
- import { getAuthToken } from '../../lib/auth.js';
7
- import { handleAxiosError } from '../../lib/errors.js';
8
- import { getOutputMode } from '../../lib/output-mode.js';
9
- import { createOutputWriter } from '../../lib/output.js';
10
- function formatDate(dateStr) {
11
- return new Date(dateStr).toLocaleString('en-US', {
12
- month: 'short',
13
- day: 'numeric',
14
- year: 'numeric',
15
- hour: 'numeric',
16
- minute: '2-digit',
17
- });
18
- }
19
- function formatIntegrationDetails(integration) {
20
- console.log(chalk.bold(integration.name));
21
- console.log();
22
- console.log(` ${'Description'.padEnd(15)}${integration.description || chalk.dim('—')}`);
23
- console.log(` ${'Visibility'.padEnd(15)}${integration.is_public ? 'public' : 'internal'}`);
24
- console.log(` ${'Owner'.padEnd(15)}${integration.owner?.name || chalk.dim('—')}`);
25
- console.log(` ${'Created'.padEnd(15)}${formatDate(integration.created_at)}`);
26
- console.log(` ${'Last Updated'.padEnd(15)}${formatDate(integration.updated_at)}`);
27
- console.log();
28
- console.log(chalk.bold('Protocol'));
29
- console.log(` ${'Type'.padEnd(15)}${integration.protocol_config.protocol}`);
30
- console.log(` ${'Base URL'.padEnd(15)}${integration.protocol_config.base_url}`);
31
- console.log();
32
- console.log(chalk.bold('Authentication'));
33
- const scheme = integration.auth_config.auth_scheme === 'API_KEY' ? 'API Key' : 'OAuth 2.0';
34
- console.log(` ${'Scheme'.padEnd(15)}${scheme}`);
35
- if (integration.auth_config.token_header_template) {
36
- console.log(` ${'Header'.padEnd(15)}${integration.auth_config.token_header_template}`);
37
- }
38
- if (integration.auth_config.install_url) {
39
- console.log(` ${'Install URL'.padEnd(15)}${integration.auth_config.install_url}`);
40
- }
41
- if (integration.auth_config.token_url) {
42
- console.log(` ${'Token URL'.padEnd(15)}${integration.auth_config.token_url}`);
43
- }
44
- console.log();
45
- if (integration.webhook_config) {
46
- console.log(`${'Webhooks'.padEnd(17)}${integration.webhook_config.enabled ? 'Enabled' : 'Disabled'}`);
47
- if (integration.webhook_config.events?.length) {
48
- console.log(` ${'Events'.padEnd(15)}${integration.webhook_config.events.join(', ')}`);
49
- }
50
- }
51
- else {
52
- console.log(`${'Webhooks'.padEnd(17)}${chalk.dim('Not configured')}`);
53
- }
54
- console.log();
55
- console.log(chalk.bold('Latest Published Version'));
56
- if (integration.latest_published_version) {
57
- const v = integration.latest_published_version;
58
- console.log(` ${'Version'.padEnd(15)}${v.version_number}`);
59
- console.log(` ${'Published'.padEnd(15)}${formatDate(v.published_at)}`);
60
- }
61
- else {
62
- console.log(` ${chalk.dim('None')}`);
63
- }
64
- }
65
- export function createIntegrationGetCommand() {
66
- const cmd = new Command('get');
67
- cmd
68
- .description('Get integration details')
69
- .argument('<id_or_name>', 'Integration ID or name (e.g., owner~name)')
70
- .action(async (identifier) => {
71
- const output = createOutputWriter();
72
- try {
73
- const token = await getAuthToken();
74
- if (!token) {
75
- output.error('Not authenticated. Please log in first.', 'Run: guild auth login');
76
- process.exit(1);
77
- }
78
- const client = new GuildAPIClient();
79
- const response = await client.get(`/integrations/${identifier}`);
80
- if (getOutputMode() === 'json') {
81
- output.data(response);
82
- }
83
- else {
84
- formatIntegrationDetails(response);
85
- }
86
- }
87
- catch (error) {
88
- const formattedError = handleAxiosError(error);
89
- output.error(`Failed to get integration: ${formattedError.details}`);
90
- process.exit(1);
91
- }
92
- });
93
- return cmd;
94
- }
95
- //# sourceMappingURL=get.js.map
@@ -1,62 +0,0 @@
1
- // Copyright 2026 Guild.ai
2
- // SPDX-License-Identifier: Apache-2.0
3
- import { Command } from 'commander';
4
- import { GuildAPIClient } from '../../lib/api-client.js';
5
- import { getAuthToken } from '../../lib/auth.js';
6
- import { handleAxiosError } from '../../lib/errors.js';
7
- import { getOutputMode } from '../../lib/output-mode.js';
8
- import { createOutputWriter, formatIntegrationTable } from '../../lib/output.js';
9
- import { DEFAULT_PAGE_LIMIT } from '../../lib/api-types.js';
10
- const SORT_MAP = {
11
- updated: 'updated_at',
12
- newest: 'created_at',
13
- name: 'name',
14
- };
15
- export function createIntegrationListCommand() {
16
- const cmd = new Command('list');
17
- cmd
18
- .description('List integrations')
19
- .option('--search <query>', 'Search integrations by name or description')
20
- .option('--sort <field>', 'Sort by: updated, newest, name (default: updated)', 'updated')
21
- .option('--published', 'Only show integrations with at least one published version')
22
- .option('--limit <number>', `Number of results to return (default: ${DEFAULT_PAGE_LIMIT})`, String(DEFAULT_PAGE_LIMIT))
23
- .option('--offset <number>', 'Offset for pagination (default: 0)', '0')
24
- .action(async (options) => {
25
- const output = createOutputWriter();
26
- try {
27
- const token = await getAuthToken();
28
- if (!token) {
29
- output.error('Not authenticated. Please log in first.', 'Run: guild auth login');
30
- process.exit(1);
31
- }
32
- const client = new GuildAPIClient();
33
- const params = new URLSearchParams();
34
- params.append('limit', options.limit);
35
- params.append('offset', options.offset);
36
- if (options.search) {
37
- params.append('search', options.search);
38
- }
39
- if (options.published) {
40
- params.append('published_only', 'true');
41
- }
42
- const sortField = SORT_MAP[options.sort];
43
- if (sortField) {
44
- params.append('sort_by', sortField);
45
- }
46
- const response = await client.get(`/integrations?${params.toString()}`);
47
- if (getOutputMode() === 'json') {
48
- output.data(response);
49
- }
50
- else {
51
- formatIntegrationTable(response.items, response.pagination);
52
- }
53
- }
54
- catch (error) {
55
- const formattedError = handleAxiosError(error);
56
- output.error(`Failed to list integrations: ${formattedError.details}`);
57
- process.exit(1);
58
- }
59
- });
60
- return cmd;
61
- }
62
- //# sourceMappingURL=list.js.map
@@ -1,164 +0,0 @@
1
- // Copyright 2026 Guild.ai
2
- // SPDX-License-Identifier: Apache-2.0
3
- import { Command } from 'commander';
4
- import chalk from 'chalk';
5
- import { readFileSync, existsSync } from 'fs';
6
- import { GuildAPIClient } from '../../../lib/api-client.js';
7
- import { getAuthToken } from '../../../lib/auth.js';
8
- import { handleAxiosError } from '../../../lib/errors.js';
9
- import { getOutputMode } from '../../../lib/output-mode.js';
10
- import { createOutputWriter } from '../../../lib/output.js';
11
- import { resolveVersionId } from '../../../lib/integration-helpers.js';
12
- import { isInteractive } from '../../../lib/stdin.js';
13
- const VALID_METHODS = ['GET', 'POST', 'PUT', 'PATCH', 'DELETE'];
14
- export function createIntegrationOperationCreateCommand() {
15
- const cmd = new Command('create');
16
- cmd
17
- .description('Create operation(s) for an integration version')
18
- .argument('<id_or_name>', 'Integration ID or name (owner~name)')
19
- .option('--version-number <semver>', 'Specific version, e.g. 1.0.0')
20
- .option('--operation <name>', 'Operation identifier, e.g. list_users')
21
- .option('--method <method>', 'HTTP method: GET, POST, PUT, PATCH, DELETE')
22
- .option('--path <path>', 'REST path, e.g. /{owner}/{repo}/issues')
23
- .option('--summary <text>', 'Short description of the operation')
24
- .option('--tags <tags>', 'Comma-separated tags, e.g. users,admin')
25
- .option('--input-body-schema <file>', 'Path to JSON file for request body schema')
26
- .option('--output-body-schema <file>', 'Path to JSON file for response body schema')
27
- .option('--openapi <file>', 'Path to OpenAPI spec file (YAML or JSON)')
28
- .action(async (identifier, options) => {
29
- const output = createOutputWriter();
30
- try {
31
- const token = await getAuthToken();
32
- if (!token) {
33
- output.error('Not authenticated. Please log in first.', 'Run: guild auth login');
34
- process.exit(1);
35
- }
36
- const client = new GuildAPIClient();
37
- const versionId = await resolveVersionId(client, identifier, options.versionNumber);
38
- if (options.openapi) {
39
- // OpenAPI mode
40
- if (!existsSync(options.openapi)) {
41
- output.error(`Error: File not found: ${options.openapi}`);
42
- process.exit(1);
43
- }
44
- const content = readFileSync(options.openapi, 'utf-8');
45
- const response = await client.post(`/integration_versions/${versionId}/endpoint_generators`, { type: 'openapi', content });
46
- if (getOutputMode() === 'json') {
47
- output.data(response);
48
- }
49
- else {
50
- console.log(chalk.green('OpenAPI operation generation triggered'));
51
- console.log();
52
- console.log("Operations will be generated asynchronously. Use 'guild integration operation list' to check results.");
53
- }
54
- }
55
- else {
56
- // Individual operation mode — prompt for missing fields in TTY
57
- let operation = options.operation;
58
- let method = options.method;
59
- let operationPath = options.path;
60
- if (isInteractive()) {
61
- const { default: inquirer } = await import('inquirer');
62
- if (!operation) {
63
- const a = await inquirer.prompt([
64
- {
65
- type: 'input',
66
- name: 'val',
67
- message: 'Operation name (e.g. list_users):',
68
- },
69
- ]);
70
- operation = a.val;
71
- }
72
- if (!method) {
73
- const a = await inquirer.prompt([
74
- {
75
- type: 'list',
76
- name: 'val',
77
- message: 'HTTP method:',
78
- choices: VALID_METHODS,
79
- },
80
- ]);
81
- method = a.val;
82
- }
83
- if (!operationPath) {
84
- const a = await inquirer.prompt([
85
- { type: 'input', name: 'val', message: 'REST path (e.g. /users):' },
86
- ]);
87
- operationPath = a.val;
88
- }
89
- }
90
- const missing = [];
91
- if (!operation)
92
- missing.push('--operation');
93
- if (!method)
94
- missing.push('--method');
95
- if (!operationPath)
96
- missing.push('--path');
97
- if (missing.length > 0) {
98
- output.error(`Error: ${missing.join(', ')} are required when not using --openapi`);
99
- process.exit(1);
100
- }
101
- method = method.toUpperCase();
102
- if (!VALID_METHODS.includes(method)) {
103
- output.error(`Error: Invalid HTTP method '${method}'`, `Valid methods: ${VALID_METHODS.join(', ')}`);
104
- process.exit(1);
105
- }
106
- const body = {
107
- operation,
108
- method,
109
- path: operationPath,
110
- };
111
- let summary = options.summary;
112
- if (!summary && isInteractive()) {
113
- const { default: inquirer } = await import('inquirer');
114
- const a = await inquirer.prompt([
115
- { type: 'input', name: 'val', message: 'Summary (optional):' },
116
- ]);
117
- if (a.val)
118
- summary = a.val;
119
- }
120
- if (summary) {
121
- body.summary = summary;
122
- }
123
- if (options.tags) {
124
- body.tags = options.tags.split(',').map((t) => t.trim());
125
- }
126
- if (options.inputBodySchema) {
127
- if (!existsSync(options.inputBodySchema)) {
128
- output.error(`Error: File not found: ${options.inputBodySchema}`);
129
- process.exit(1);
130
- }
131
- body.input_body_type = JSON.parse(readFileSync(options.inputBodySchema, 'utf-8'));
132
- }
133
- if (options.outputBodySchema) {
134
- if (!existsSync(options.outputBodySchema)) {
135
- output.error(`Error: File not found: ${options.outputBodySchema}`);
136
- process.exit(1);
137
- }
138
- body.output_body_type = JSON.parse(readFileSync(options.outputBodySchema, 'utf-8'));
139
- }
140
- const response = await client.post(`/integration_versions/${versionId}/endpoints`, body);
141
- if (getOutputMode() === 'json') {
142
- output.data(response);
143
- }
144
- else {
145
- console.log(chalk.green('Operation created successfully'));
146
- console.log();
147
- console.log(` ${'Operation'.padEnd(12)}${response.operation}`);
148
- console.log(` ${'Method'.padEnd(12)}${response.method}`);
149
- console.log(` ${'Path'.padEnd(12)}${response.path}`);
150
- if (response.summary) {
151
- console.log(` ${'Summary'.padEnd(12)}${response.summary}`);
152
- }
153
- }
154
- }
155
- }
156
- catch (error) {
157
- const formattedError = handleAxiosError(error);
158
- output.error(`Failed to create operation: ${formattedError.details}`);
159
- process.exit(1);
160
- }
161
- });
162
- return cmd;
163
- }
164
- //# sourceMappingURL=create.js.map
@@ -1,92 +0,0 @@
1
- // Copyright 2026 Guild.ai
2
- // SPDX-License-Identifier: Apache-2.0
3
- import { Command } from 'commander';
4
- import chalk from 'chalk';
5
- import { GuildAPIClient } from '../../../lib/api-client.js';
6
- import { getAuthToken } from '../../../lib/auth.js';
7
- import { handleAxiosError } from '../../../lib/errors.js';
8
- import { getOutputMode } from '../../../lib/output-mode.js';
9
- import { createOutputWriter } from '../../../lib/output.js';
10
- import { resolveVersionId } from '../../../lib/integration-helpers.js';
11
- import { Table } from '../../../lib/table.js';
12
- import { DEFAULT_PAGE_LIMIT_LARGE } from '../../../lib/api-types.js';
13
- export function createIntegrationOperationListCommand() {
14
- const cmd = new Command('list');
15
- cmd
16
- .description('List operations for an integration version')
17
- .argument('<id_or_name>', 'Integration ID or name (owner~name)')
18
- .option('--version-number <semver>', 'Specific version, e.g. 1.0.0')
19
- .option('--limit <number>', `Number of results to return (default: ${DEFAULT_PAGE_LIMIT_LARGE})`, String(DEFAULT_PAGE_LIMIT_LARGE))
20
- .option('--offset <number>', 'Offset for pagination (default: 0)', '0')
21
- .action(async (identifier, options) => {
22
- const output = createOutputWriter();
23
- try {
24
- const token = await getAuthToken();
25
- if (!token) {
26
- output.error('Not authenticated. Please log in first.', 'Run: guild auth login');
27
- process.exit(1);
28
- }
29
- const client = new GuildAPIClient();
30
- const versionId = await resolveVersionId(client, identifier, options.versionNumber);
31
- const params = new URLSearchParams();
32
- params.append('limit', options.limit);
33
- params.append('offset', options.offset);
34
- const response = await client.get(`/integration_versions/${versionId}/endpoints?${params.toString()}`);
35
- if (getOutputMode() === 'json') {
36
- output.data(response);
37
- }
38
- else {
39
- if (response.items.length === 0) {
40
- console.log(chalk.dim('No operations found'));
41
- return;
42
- }
43
- console.log(chalk.bold('Operations'));
44
- console.log();
45
- const isMcp = response.items.some((ep) => !ep.method);
46
- const table = new Table({
47
- columns: isMcp
48
- ? [
49
- { name: 'operation', title: 'OPERATION', alignment: 'left' },
50
- { name: 'description', title: 'DESCRIPTION', alignment: 'left' },
51
- ]
52
- : [
53
- { name: 'operation', title: 'OPERATION', alignment: 'left' },
54
- {
55
- name: 'method',
56
- title: 'METHOD',
57
- alignment: 'left',
58
- color: 'cyan',
59
- },
60
- { name: 'path', title: 'PATH', alignment: 'left' },
61
- ],
62
- });
63
- response.items.forEach((ep) => {
64
- table.addRow(isMcp
65
- ? { operation: ep.operation, description: ep.description ?? '' }
66
- : {
67
- operation: ep.operation,
68
- method: ep.method ?? '',
69
- path: ep.path ?? '',
70
- });
71
- });
72
- table.printTable();
73
- const showing = Math.min(response.pagination.limit, response.items.length);
74
- if (response.pagination.has_more) {
75
- const nextOffset = response.pagination.offset + response.pagination.limit;
76
- console.log(`\nShowing ${showing} of ${response.pagination.total_count} operations. ` +
77
- chalk.dim(`Use --offset ${nextOffset} to see more.`));
78
- }
79
- else if (response.pagination.total_count > showing) {
80
- console.log(chalk.dim(`\nShowing ${showing} of ${response.pagination.total_count} operations`));
81
- }
82
- }
83
- }
84
- catch (error) {
85
- const formattedError = handleAxiosError(error);
86
- output.error(`Failed to list operations: ${formattedError.details}`);
87
- process.exit(1);
88
- }
89
- });
90
- return cmd;
91
- }
92
- //# sourceMappingURL=list.js.map
@@ -1,139 +0,0 @@
1
- // Copyright 2026 Guild.ai
2
- // SPDX-License-Identifier: Apache-2.0
3
- import { Command } from 'commander';
4
- import chalk from 'chalk';
5
- import { GuildAPIClient } from '../../lib/api-client.js';
6
- import { getAuthToken } from '../../lib/auth.js';
7
- import { handleAxiosError } from '../../lib/errors.js';
8
- import { getOutputMode } from '../../lib/output-mode.js';
9
- import { createOutputWriter } from '../../lib/output.js';
10
- function formatUpdatedIntegration(integration) {
11
- console.log(chalk.green('Integration updated successfully'));
12
- console.log();
13
- console.log(` ${'Name'.padEnd(15)}${integration.name}`);
14
- console.log(` ${'Description'.padEnd(15)}${integration.description || chalk.dim('—')}`);
15
- console.log(` ${'Visibility'.padEnd(15)}${integration.is_public ? 'public' : 'internal'}`);
16
- console.log(` ${'Owner'.padEnd(15)}${integration.owner?.name || chalk.dim('—')}`);
17
- console.log(` ${'Base URL'.padEnd(15)}${integration.protocol_config.base_url}`);
18
- const scheme = integration.auth_config.auth_scheme === 'API_KEY' ? 'API Key' : 'OAuth 2.0';
19
- console.log(` ${'Auth Scheme'.padEnd(15)}${scheme}`);
20
- if (integration.auth_config.token_header_template) {
21
- console.log(` ${'Header'.padEnd(15)}${integration.auth_config.token_header_template}`);
22
- }
23
- if (integration.webhook_config) {
24
- console.log(` ${'Webhooks'.padEnd(15)}Enabled`);
25
- }
26
- else {
27
- console.log(` ${'Webhooks'.padEnd(15)}${chalk.dim('Not configured')}`);
28
- }
29
- }
30
- export function createIntegrationUpdateCommand() {
31
- const cmd = new Command('update');
32
- cmd
33
- .description('Update an integration')
34
- .argument('<id_or_name>', 'Integration ID or name')
35
- .option('--description <text>', 'Update description')
36
- .option('--base-url <url>', 'Update REST base URL')
37
- .option('--public', 'Make integration public')
38
- .option('--no-public', 'Make integration private')
39
- .option('--header-template <template>', 'Update API Key header template')
40
- .option('--install-url <url>', 'Update OAuth authorization URL')
41
- .option('--token-url <url>', 'Update OAuth token URL')
42
- .option('--token-content-type <type>', 'Update OAuth token request content type')
43
- .option('--client-secret <secret>', 'Update OAuth client secret')
44
- .option('--webhook-events <events>', 'Update webhook events as JSON')
45
- .action(async (identifier, options) => {
46
- const output = createOutputWriter();
47
- try {
48
- const token = await getAuthToken();
49
- if (!token) {
50
- output.error('Not authenticated. Please log in first.', 'Run: guild auth login');
51
- process.exit(1);
52
- }
53
- const client = new GuildAPIClient();
54
- // Build partial update body
55
- const body = {};
56
- let hasUpdates = false;
57
- if (options.description !== undefined) {
58
- body.description = options.description;
59
- hasUpdates = true;
60
- }
61
- if (options.public !== undefined) {
62
- body.is_public = options.public;
63
- hasUpdates = true;
64
- }
65
- if (options.baseUrl !== undefined) {
66
- body.protocol_config = { protocol: 'REST', base_url: options.baseUrl };
67
- hasUpdates = true;
68
- }
69
- // Auth config updates need the discriminator
70
- const hasAuthUpdate = options.headerTemplate !== undefined ||
71
- options.installUrl !== undefined ||
72
- options.tokenUrl !== undefined ||
73
- options.tokenContentType !== undefined ||
74
- options.clientSecret !== undefined;
75
- if (hasAuthUpdate) {
76
- // Fetch integration to determine current auth scheme
77
- const current = await client.get(`/integrations/${identifier}`);
78
- const scheme = current.auth_config.auth_scheme;
79
- if (scheme === 'API_KEY') {
80
- const authConfig = {
81
- auth_scheme: 'API_KEY',
82
- };
83
- if (options.headerTemplate !== undefined) {
84
- authConfig.token_header_template = options.headerTemplate;
85
- }
86
- body.auth_config = authConfig;
87
- }
88
- else {
89
- const authConfig = {
90
- auth_scheme: 'OAUTH',
91
- };
92
- if (options.installUrl !== undefined) {
93
- authConfig.install_url = options.installUrl;
94
- }
95
- if (options.tokenUrl !== undefined) {
96
- authConfig.token_url = options.tokenUrl;
97
- }
98
- if (options.tokenContentType !== undefined) {
99
- authConfig.token_url_content_type = options.tokenContentType;
100
- }
101
- if (options.clientSecret !== undefined) {
102
- authConfig.client_secret = options.clientSecret;
103
- }
104
- body.auth_config = authConfig;
105
- }
106
- hasUpdates = true;
107
- }
108
- if (options.webhookEvents !== undefined) {
109
- try {
110
- const events = JSON.parse(options.webhookEvents);
111
- body.webhook_config = { events };
112
- }
113
- catch {
114
- output.error(`Error: Invalid JSON for --webhook-events: ${options.webhookEvents}`);
115
- process.exit(1);
116
- }
117
- hasUpdates = true;
118
- }
119
- if (!hasUpdates) {
120
- output.error('Error: No update options provided. Use --help to see available options.');
121
- process.exit(1);
122
- }
123
- const response = await client.patch(`/integrations/${identifier}`, body);
124
- if (getOutputMode() === 'json') {
125
- output.data(response);
126
- }
127
- else {
128
- formatUpdatedIntegration(response);
129
- }
130
- }
131
- catch (error) {
132
- const formattedError = handleAxiosError(error);
133
- output.error(`Failed to update integration: ${formattedError.details}`);
134
- process.exit(1);
135
- }
136
- });
137
- return cmd;
138
- }
139
- //# sourceMappingURL=update.js.map
@@ -1,86 +0,0 @@
1
- // Copyright 2026 Guild.ai
2
- // SPDX-License-Identifier: Apache-2.0
3
- import { Command } from 'commander';
4
- import chalk from 'chalk';
5
- import { GuildAPIClient } from '../../../lib/api-client.js';
6
- import { getAuthToken } from '../../../lib/auth.js';
7
- import { handleAxiosError } from '../../../lib/errors.js';
8
- import { getOutputMode } from '../../../lib/output-mode.js';
9
- import { createOutputWriter } from '../../../lib/output.js';
10
- import { createSpinner } from '../../../lib/progress.js';
11
- import { resolveLatestDraftId } from '../../../lib/integration-helpers.js';
12
- const UUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
13
- export function createIntegrationVersionBuildCommand() {
14
- const cmd = new Command('build');
15
- cmd
16
- .description('Build (validate) a draft version')
17
- .argument('<id_or_name>', 'Integration name (owner~name, defaults to latest draft) or version UUID')
18
- .requiredOption('--version-number <semver>', 'Semantic version number to assign, e.g. 1.0.0')
19
- .action(async (identifier, options) => {
20
- const output = createOutputWriter();
21
- try {
22
- const token = await getAuthToken();
23
- if (!token) {
24
- output.error('Not authenticated. Please log in first.', 'Run: guild auth login');
25
- process.exit(1);
26
- }
27
- const client = new GuildAPIClient();
28
- // Resolve version ID: UUID directly, or owner~name → latest draft
29
- let versionId;
30
- if (UUID_REGEX.test(identifier)) {
31
- versionId = identifier;
32
- }
33
- else {
34
- versionId = await resolveLatestDraftId(client, identifier);
35
- }
36
- const buildResponse = await client.post(`/integration_versions/${versionId}/build`, {
37
- version_number: options.versionNumber,
38
- });
39
- if (getOutputMode() === 'json') {
40
- output.data(buildResponse);
41
- return;
42
- }
43
- // Poll until build completes
44
- const spinner = createSpinner(`Building version ${options.versionNumber}...`);
45
- spinner.start();
46
- const maxAttempts = 60;
47
- let attempt = 0;
48
- let finalVersion = null;
49
- while (attempt < maxAttempts) {
50
- await new Promise((r) => setTimeout(r, 3000));
51
- attempt++;
52
- const version = await client.get(`/integration_versions/${versionId}`);
53
- if (version.validation_status === 'PASSED' ||
54
- version.validation_status === 'FAILED') {
55
- finalVersion = version;
56
- break;
57
- }
58
- spinner.text = `Building version ${options.versionNumber}... (${attempt}/${maxAttempts})`;
59
- }
60
- if (!finalVersion) {
61
- spinner.fail('Build timed out');
62
- process.exit(1);
63
- }
64
- if (finalVersion.validation_status === 'PASSED') {
65
- spinner.succeed('Build passed');
66
- }
67
- else {
68
- spinner.fail('Build failed');
69
- }
70
- console.log();
71
- console.log(` ${'Version ID'.padEnd(17)}${finalVersion.id}`);
72
- console.log(` ${'Version Number'.padEnd(17)}${finalVersion.version_number || chalk.dim('—')}`);
73
- console.log(` ${'Status'.padEnd(17)}${finalVersion.validation_status === 'PASSED' ? 'Valid' : 'Failed'}`);
74
- if (finalVersion.validation_status === 'FAILED') {
75
- process.exit(1);
76
- }
77
- }
78
- catch (error) {
79
- const formattedError = handleAxiosError(error);
80
- output.error(`Failed to build version: ${formattedError.details}`);
81
- process.exit(1);
82
- }
83
- });
84
- return cmd;
85
- }
86
- //# sourceMappingURL=build.js.map