@guildai/cli 0.6.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/README.md +17 -0
  2. package/dist/commands/agent/chat.js +31 -31
  3. package/dist/commands/agent/fork.js +1 -1
  4. package/dist/commands/agent/init.js +1 -1
  5. package/dist/commands/agent/pull.js +36 -21
  6. package/dist/commands/agent/save.js +2 -2
  7. package/dist/commands/agent/test.js +8 -12
  8. package/dist/commands/auth/login.js +3 -3
  9. package/dist/commands/chat.js +64 -102
  10. package/dist/commands/credentials/endpoint-list.js +1 -1
  11. package/dist/commands/integration/connect.d.ts +3 -0
  12. package/dist/commands/integration/connect.js +76 -0
  13. package/dist/commands/integration/create.d.ts +3 -0
  14. package/dist/commands/integration/create.js +298 -0
  15. package/dist/commands/integration/get.d.ts +3 -0
  16. package/dist/commands/integration/get.js +95 -0
  17. package/dist/commands/integration/list.d.ts +3 -0
  18. package/dist/commands/integration/list.js +61 -0
  19. package/dist/commands/integration/operation/create.d.ts +3 -0
  20. package/dist/commands/integration/operation/create.js +163 -0
  21. package/dist/commands/integration/operation/list.d.ts +3 -0
  22. package/dist/commands/integration/operation/list.js +83 -0
  23. package/dist/commands/integration/update.d.ts +3 -0
  24. package/dist/commands/integration/update.js +139 -0
  25. package/dist/commands/integration/version/build.d.ts +3 -0
  26. package/dist/commands/integration/version/build.js +86 -0
  27. package/dist/commands/integration/version/create.d.ts +3 -0
  28. package/dist/commands/integration/version/create.js +45 -0
  29. package/dist/commands/integration/version/get.d.ts +3 -0
  30. package/dist/commands/integration/version/get.js +72 -0
  31. package/dist/commands/integration/version/list.d.ts +3 -0
  32. package/dist/commands/integration/version/list.js +44 -0
  33. package/dist/commands/integration/version/publish.d.ts +3 -0
  34. package/dist/commands/integration/version/publish.js +79 -0
  35. package/dist/commands/integration/version/test.d.ts +3 -0
  36. package/dist/commands/integration/version/test.js +104 -0
  37. package/dist/commands/workspace/create.js +10 -4
  38. package/dist/index.js +38 -0
  39. package/dist/lib/api-types.d.ts +69 -12
  40. package/dist/lib/auth.d.ts +1 -1
  41. package/dist/lib/auth.js +3 -2
  42. package/dist/lib/integration-helpers.d.ts +15 -0
  43. package/dist/lib/integration-helpers.js +38 -0
  44. package/dist/lib/output.d.ts +11 -1
  45. package/dist/lib/output.js +94 -0
  46. package/dist/lib/session-events-fetch.d.ts +27 -0
  47. package/dist/lib/session-events-fetch.js +25 -0
  48. package/dist/lib/session-polling.d.ts +7 -2
  49. package/dist/lib/session-polling.js +18 -11
  50. package/dist/lib/session-resume.js +2 -5
  51. package/dist/lib/table.d.ts +0 -1
  52. package/dist/lib/table.js +0 -1
  53. package/dist/mcp/tools.js +5 -11
  54. package/docs/CLI_WORKFLOW.md +15 -0
  55. package/docs/skills/agent-dev.md +15 -0
  56. package/package.json +4 -3
@@ -0,0 +1,163 @@
1
+ // Copyright 2026 Guild.ai
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { Command } from 'commander';
4
+ import chalk from 'chalk';
5
+ import inquirer from 'inquirer';
6
+ import { readFileSync, existsSync } from 'fs';
7
+ import { GuildAPIClient } from '../../../lib/api-client.js';
8
+ import { getAuthToken } from '../../../lib/auth.js';
9
+ import { handleAxiosError } from '../../../lib/errors.js';
10
+ import { getOutputMode } from '../../../lib/output-mode.js';
11
+ import { createOutputWriter } from '../../../lib/output.js';
12
+ import { resolveVersionId } from '../../../lib/integration-helpers.js';
13
+ import { isInteractive } from '../../../lib/stdin.js';
14
+ const VALID_METHODS = ['GET', 'POST', 'PUT', 'PATCH', 'DELETE'];
15
+ export function createIntegrationOperationCreateCommand() {
16
+ const cmd = new Command('create');
17
+ cmd
18
+ .description('Create operation(s) for an integration version')
19
+ .argument('<id_or_name>', 'Integration ID or name (owner~name)')
20
+ .option('--version <semver>', 'Specific version, e.g. 1.0.0')
21
+ .option('--operation <name>', 'Operation identifier, e.g. list_users')
22
+ .option('--method <method>', 'HTTP method: GET, POST, PUT, PATCH, DELETE')
23
+ .option('--path <path>', 'REST path, e.g. /{owner}/{repo}/issues')
24
+ .option('--summary <text>', 'Short description of the operation')
25
+ .option('--tags <tags>', 'Comma-separated tags, e.g. users,admin')
26
+ .option('--input-body-schema <file>', 'Path to JSON file for request body schema')
27
+ .option('--output-body-schema <file>', 'Path to JSON file for response body schema')
28
+ .option('--openapi <file>', 'Path to OpenAPI spec file (YAML or JSON)')
29
+ .action(async (identifier, options) => {
30
+ const output = createOutputWriter();
31
+ try {
32
+ const token = await getAuthToken();
33
+ if (!token) {
34
+ output.error('Not authenticated. Please log in first.', 'Run: guild auth login');
35
+ process.exit(1);
36
+ }
37
+ const client = new GuildAPIClient();
38
+ const versionId = await resolveVersionId(client, identifier, options.version);
39
+ if (options.openapi) {
40
+ // OpenAPI mode
41
+ if (!existsSync(options.openapi)) {
42
+ output.error(`Error: File not found: ${options.openapi}`);
43
+ process.exit(1);
44
+ }
45
+ const content = readFileSync(options.openapi, 'utf-8');
46
+ const response = await client.post(`/integration_versions/${versionId}/endpoint_generators`, { type: 'openapi', content });
47
+ if (getOutputMode() === 'json') {
48
+ output.data(response);
49
+ }
50
+ else {
51
+ console.log(chalk.green('OpenAPI operation generation triggered'));
52
+ console.log();
53
+ console.log("Operations will be generated asynchronously. Use 'guild integration operation list' to check results.");
54
+ }
55
+ }
56
+ else {
57
+ // Individual operation mode — prompt for missing fields in TTY
58
+ let operation = options.operation;
59
+ let method = options.method;
60
+ let operationPath = options.path;
61
+ if (isInteractive()) {
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 a = await inquirer.prompt([
114
+ { type: 'input', name: 'val', message: 'Summary (optional):' },
115
+ ]);
116
+ if (a.val)
117
+ summary = a.val;
118
+ }
119
+ if (summary) {
120
+ body.summary = summary;
121
+ }
122
+ if (options.tags) {
123
+ body.tags = options.tags.split(',').map((t) => t.trim());
124
+ }
125
+ if (options.inputBodySchema) {
126
+ if (!existsSync(options.inputBodySchema)) {
127
+ output.error(`Error: File not found: ${options.inputBodySchema}`);
128
+ process.exit(1);
129
+ }
130
+ body.input_body_type = JSON.parse(readFileSync(options.inputBodySchema, 'utf-8'));
131
+ }
132
+ if (options.outputBodySchema) {
133
+ if (!existsSync(options.outputBodySchema)) {
134
+ output.error(`Error: File not found: ${options.outputBodySchema}`);
135
+ process.exit(1);
136
+ }
137
+ body.output_body_type = JSON.parse(readFileSync(options.outputBodySchema, 'utf-8'));
138
+ }
139
+ const response = await client.post(`/integration_versions/${versionId}/endpoints`, body);
140
+ if (getOutputMode() === 'json') {
141
+ output.data(response);
142
+ }
143
+ else {
144
+ console.log(chalk.green('Operation created successfully'));
145
+ console.log();
146
+ console.log(` ${'Operation'.padEnd(12)}${response.operation}`);
147
+ console.log(` ${'Method'.padEnd(12)}${response.method}`);
148
+ console.log(` ${'Path'.padEnd(12)}${response.path}`);
149
+ if (response.summary) {
150
+ console.log(` ${'Summary'.padEnd(12)}${response.summary}`);
151
+ }
152
+ }
153
+ }
154
+ }
155
+ catch (error) {
156
+ const formattedError = handleAxiosError(error);
157
+ output.error(`Failed to create operation: ${formattedError.details}`);
158
+ process.exit(1);
159
+ }
160
+ });
161
+ return cmd;
162
+ }
163
+ //# sourceMappingURL=create.js.map
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function createIntegrationOperationListCommand(): Command;
3
+ //# sourceMappingURL=list.d.ts.map
@@ -0,0 +1,83 @@
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
+ export function createIntegrationOperationListCommand() {
13
+ const cmd = new Command('list');
14
+ cmd
15
+ .description('List operations for an integration version')
16
+ .argument('<id_or_name>', 'Integration ID or name (owner~name)')
17
+ .option('--version <semver>', 'Specific version, e.g. 1.0.0')
18
+ .option('--limit <number>', 'Number of results to return', '100')
19
+ .option('--offset <number>', 'Offset for pagination', '0')
20
+ .action(async (identifier, options) => {
21
+ const output = createOutputWriter();
22
+ try {
23
+ const token = await getAuthToken();
24
+ if (!token) {
25
+ output.error('Not authenticated. Please log in first.', 'Run: guild auth login');
26
+ process.exit(1);
27
+ }
28
+ const client = new GuildAPIClient();
29
+ const versionId = await resolveVersionId(client, identifier, options.version);
30
+ const params = new URLSearchParams();
31
+ params.append('limit', options.limit);
32
+ params.append('offset', options.offset);
33
+ const response = await client.get(`/integration_versions/${versionId}/endpoints?${params.toString()}`);
34
+ if (getOutputMode() === 'json') {
35
+ output.data(response);
36
+ }
37
+ else {
38
+ if (response.items.length === 0) {
39
+ console.log(chalk.dim('No operations found'));
40
+ return;
41
+ }
42
+ console.log(chalk.bold('Operations'));
43
+ console.log();
44
+ const table = new Table({
45
+ columns: [
46
+ { name: 'operation', title: 'OPERATION', alignment: 'left' },
47
+ {
48
+ name: 'method',
49
+ title: 'METHOD',
50
+ alignment: 'left',
51
+ color: 'cyan',
52
+ },
53
+ { name: 'path', title: 'PATH', alignment: 'left' },
54
+ ],
55
+ });
56
+ response.items.forEach((ep) => {
57
+ table.addRow({
58
+ operation: ep.operation,
59
+ method: ep.method,
60
+ path: ep.path,
61
+ });
62
+ });
63
+ table.printTable();
64
+ const showing = Math.min(response.pagination.limit, response.items.length);
65
+ if (response.pagination.has_more) {
66
+ const nextOffset = response.pagination.offset + response.pagination.limit;
67
+ console.log(`\nShowing ${showing} of ${response.pagination.total_count} operations. ` +
68
+ chalk.dim(`Use --offset ${nextOffset} to see more.`));
69
+ }
70
+ else if (response.pagination.total_count > showing) {
71
+ console.log(chalk.dim(`\nShowing ${showing} of ${response.pagination.total_count} operations`));
72
+ }
73
+ }
74
+ }
75
+ catch (error) {
76
+ const formattedError = handleAxiosError(error);
77
+ output.error(`Failed to list operations: ${formattedError.details}`);
78
+ process.exit(1);
79
+ }
80
+ });
81
+ return cmd;
82
+ }
83
+ //# sourceMappingURL=list.js.map
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function createIntegrationUpdateCommand(): Command;
3
+ //# sourceMappingURL=update.d.ts.map
@@ -0,0 +1,139 @@
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 = { 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
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function createIntegrationVersionBuildCommand(): Command;
3
+ //# sourceMappingURL=build.d.ts.map
@@ -0,0 +1,86 @@
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
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function createIntegrationVersionCreateCommand(): Command;
3
+ //# sourceMappingURL=create.d.ts.map
@@ -0,0 +1,45 @@
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
+ export function createIntegrationVersionCreateCommand() {
11
+ const cmd = new Command('create');
12
+ cmd
13
+ .description('Create a new draft version')
14
+ .argument('<id_or_name>', 'Integration ID or name')
15
+ .action(async (identifier) => {
16
+ const output = createOutputWriter();
17
+ try {
18
+ const token = await getAuthToken();
19
+ if (!token) {
20
+ output.error('Not authenticated. Please log in first.', 'Run: guild auth login');
21
+ process.exit(1);
22
+ }
23
+ const client = new GuildAPIClient();
24
+ const response = await client.post(`/integrations/${identifier}/versions`, {});
25
+ if (getOutputMode() === 'json') {
26
+ output.data(response);
27
+ }
28
+ else {
29
+ console.log(chalk.green('Version created successfully'));
30
+ console.log();
31
+ console.log(` ${'Version ID'.padEnd(15)}${response.id}`);
32
+ console.log(` ${'Status'.padEnd(15)}Draft`);
33
+ console.log(` ${'Author'.padEnd(15)}${response.author?.name || chalk.dim('—')}`);
34
+ console.log(` ${'Created'.padEnd(15)}just now`);
35
+ }
36
+ }
37
+ catch (error) {
38
+ const formattedError = handleAxiosError(error);
39
+ output.error(`Failed to create version: ${formattedError.details}`);
40
+ process.exit(1);
41
+ }
42
+ });
43
+ return cmd;
44
+ }
45
+ //# sourceMappingURL=create.js.map
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function createIntegrationVersionGetCommand(): Command;
3
+ //# sourceMappingURL=get.d.ts.map
@@ -0,0 +1,72 @@
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
+ function formatDate(dateStr) {
12
+ return new Date(dateStr).toLocaleString('en-US', {
13
+ month: 'short',
14
+ day: 'numeric',
15
+ year: 'numeric',
16
+ hour: 'numeric',
17
+ minute: '2-digit',
18
+ });
19
+ }
20
+ function formatValidationStatus(status) {
21
+ switch (status) {
22
+ case 'PASSED':
23
+ return 'Valid';
24
+ case 'FAILED':
25
+ return 'Failed';
26
+ case 'RUNNING':
27
+ return 'Building';
28
+ default:
29
+ return '—';
30
+ }
31
+ }
32
+ export function createIntegrationVersionGetCommand() {
33
+ const cmd = new Command('get');
34
+ cmd
35
+ .description('Get version details')
36
+ .argument('<id_or_name>', 'Integration ID or name (owner~name)')
37
+ .option('--version <semver>', 'Specific version, e.g. 1.0.0')
38
+ .action(async (identifier, options) => {
39
+ const output = createOutputWriter();
40
+ try {
41
+ const token = await getAuthToken();
42
+ if (!token) {
43
+ output.error('Not authenticated. Please log in first.', 'Run: guild auth login');
44
+ process.exit(1);
45
+ }
46
+ const client = new GuildAPIClient();
47
+ const versionId = await resolveVersionId(client, identifier, options.version);
48
+ const response = await client.get(`/integration_versions/${versionId}`);
49
+ if (getOutputMode() === 'json') {
50
+ output.data(response);
51
+ }
52
+ else {
53
+ const versionDisplay = response.version_number || 'Draft';
54
+ const integrationName = response.integration?.name || identifier;
55
+ console.log(chalk.bold(`${integrationName} - ${versionDisplay}`));
56
+ console.log();
57
+ console.log(` ${'Status'.padEnd(15)}${formatValidationStatus(response.validation_status)}`);
58
+ console.log(` ${'Author'.padEnd(15)}${response.author?.name || chalk.dim('—')}`);
59
+ console.log(` ${'Published'.padEnd(15)}${response.published_at ? formatDate(response.published_at) : chalk.dim('—')}`);
60
+ console.log(` ${'Created'.padEnd(15)}${formatDate(response.created_at)}`);
61
+ console.log(` ${'Last Updated'.padEnd(15)}${formatDate(response.updated_at)}`);
62
+ }
63
+ }
64
+ catch (error) {
65
+ const formattedError = handleAxiosError(error);
66
+ output.error(`Failed to get version: ${formattedError.details}`);
67
+ process.exit(1);
68
+ }
69
+ });
70
+ return cmd;
71
+ }
72
+ //# sourceMappingURL=get.js.map
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function createIntegrationVersionListCommand(): Command;
3
+ //# sourceMappingURL=list.d.ts.map
@@ -0,0 +1,44 @@
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, formatIntegrationVersionTable, } from '../../../lib/output.js';
9
+ export function createIntegrationVersionListCommand() {
10
+ const cmd = new Command('list');
11
+ cmd
12
+ .description('List integration versions')
13
+ .argument('<id_or_name>', 'Integration ID or name')
14
+ .option('--limit <number>', 'Number of results to return', '20')
15
+ .option('--offset <number>', 'Offset for pagination', '0')
16
+ .action(async (identifier, options) => {
17
+ const output = createOutputWriter();
18
+ try {
19
+ const token = await getAuthToken();
20
+ if (!token) {
21
+ output.error('Not authenticated. Please log in first.', 'Run: guild auth login');
22
+ process.exit(1);
23
+ }
24
+ const client = new GuildAPIClient();
25
+ const params = new URLSearchParams();
26
+ params.append('limit', options.limit);
27
+ params.append('offset', options.offset);
28
+ const response = await client.get(`/integrations/${identifier}/versions?${params.toString()}`);
29
+ if (getOutputMode() === 'json') {
30
+ output.data(response);
31
+ }
32
+ else {
33
+ formatIntegrationVersionTable(response.items, response.pagination, identifier);
34
+ }
35
+ }
36
+ catch (error) {
37
+ const formattedError = handleAxiosError(error);
38
+ output.error(`Failed to list versions: ${formattedError.details}`);
39
+ process.exit(1);
40
+ }
41
+ });
42
+ return cmd;
43
+ }
44
+ //# sourceMappingURL=list.js.map