@guildai/cli 0.5.13 → 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 (99) hide show
  1. package/README.md +17 -0
  2. package/dist/commands/agent/chat.js +31 -31
  3. package/dist/commands/agent/clone.js +3 -1
  4. package/dist/commands/agent/code.js +3 -2
  5. package/dist/commands/agent/fork.js +41 -15
  6. package/dist/commands/agent/get.js +3 -2
  7. package/dist/commands/agent/grep.js +61 -31
  8. package/dist/commands/agent/init.js +1 -1
  9. package/dist/commands/agent/publish.js +3 -2
  10. package/dist/commands/agent/pull.js +36 -21
  11. package/dist/commands/agent/revalidate.js +4 -3
  12. package/dist/commands/agent/save.js +2 -2
  13. package/dist/commands/agent/search.js +3 -3
  14. package/dist/commands/agent/tags/add.js +4 -3
  15. package/dist/commands/agent/tags/list.js +3 -2
  16. package/dist/commands/agent/tags/remove.js +4 -3
  17. package/dist/commands/agent/tags/set.js +3 -2
  18. package/dist/commands/agent/test.js +8 -12
  19. package/dist/commands/agent/unpublish.js +3 -2
  20. package/dist/commands/agent/update.js +9 -8
  21. package/dist/commands/agent/versions.js +3 -2
  22. package/dist/commands/agent/workspaces.js +3 -2
  23. package/dist/commands/auth/login.js +3 -3
  24. package/dist/commands/chat.js +64 -102
  25. package/dist/commands/credentials/endpoint-list.d.ts +3 -0
  26. package/dist/commands/credentials/endpoint-list.js +87 -0
  27. package/dist/commands/credentials/list.d.ts +3 -0
  28. package/dist/commands/{container → credentials}/list.js +11 -10
  29. package/dist/commands/credentials/policy-create.d.ts +3 -0
  30. package/dist/commands/credentials/policy-create.js +66 -0
  31. package/dist/commands/credentials/policy-delete.d.ts +3 -0
  32. package/dist/commands/{container/get.js → credentials/policy-delete.js} +9 -9
  33. package/dist/commands/credentials/policy-list.d.ts +3 -0
  34. package/dist/commands/{container-image/list.js → credentials/policy-list.js} +9 -9
  35. package/dist/commands/credentials/policy-update.d.ts +3 -0
  36. package/dist/commands/credentials/policy-update.js +66 -0
  37. package/dist/commands/integration/connect.d.ts +3 -0
  38. package/dist/commands/integration/connect.js +76 -0
  39. package/dist/commands/integration/create.d.ts +3 -0
  40. package/dist/commands/integration/create.js +298 -0
  41. package/dist/commands/integration/get.d.ts +3 -0
  42. package/dist/commands/integration/get.js +95 -0
  43. package/dist/commands/integration/list.d.ts +3 -0
  44. package/dist/commands/integration/list.js +61 -0
  45. package/dist/commands/integration/operation/create.d.ts +3 -0
  46. package/dist/commands/integration/operation/create.js +163 -0
  47. package/dist/commands/integration/operation/list.d.ts +3 -0
  48. package/dist/commands/integration/operation/list.js +83 -0
  49. package/dist/commands/integration/update.d.ts +3 -0
  50. package/dist/commands/integration/update.js +139 -0
  51. package/dist/commands/integration/version/build.d.ts +3 -0
  52. package/dist/commands/integration/version/build.js +86 -0
  53. package/dist/commands/integration/version/create.d.ts +3 -0
  54. package/dist/commands/integration/version/create.js +45 -0
  55. package/dist/commands/integration/version/get.d.ts +3 -0
  56. package/dist/commands/integration/version/get.js +72 -0
  57. package/dist/commands/integration/version/list.d.ts +3 -0
  58. package/dist/commands/integration/version/list.js +44 -0
  59. package/dist/commands/integration/version/publish.d.ts +3 -0
  60. package/dist/commands/integration/version/publish.js +79 -0
  61. package/dist/commands/integration/version/test.d.ts +3 -0
  62. package/dist/commands/integration/version/test.js +104 -0
  63. package/dist/commands/trigger/create.js +35 -19
  64. package/dist/commands/workspace/create.js +10 -4
  65. package/dist/commands/workspace/select.js +0 -1
  66. package/dist/index.js +60 -27
  67. package/dist/lib/agent-helpers.d.ts +8 -0
  68. package/dist/lib/agent-helpers.js +15 -0
  69. package/dist/lib/api-types.d.ts +109 -78
  70. package/dist/lib/auth.d.ts +1 -1
  71. package/dist/lib/auth.js +10 -6
  72. package/dist/lib/integration-helpers.d.ts +15 -0
  73. package/dist/lib/integration-helpers.js +38 -0
  74. package/dist/lib/output.d.ts +13 -16
  75. package/dist/lib/output.js +137 -109
  76. package/dist/lib/session-events-fetch.d.ts +27 -0
  77. package/dist/lib/session-events-fetch.js +25 -0
  78. package/dist/lib/session-polling.d.ts +7 -2
  79. package/dist/lib/session-polling.js +18 -11
  80. package/dist/lib/session-resume.js +2 -5
  81. package/dist/lib/table.d.ts +0 -1
  82. package/dist/lib/table.js +0 -1
  83. package/dist/mcp/tools.js +6 -12
  84. package/docs/CLI_WORKFLOW.md +19 -2
  85. package/docs/skills/agent-dev.md +17 -2
  86. package/package.json +6 -5
  87. package/dist/commands/container/destroy.d.ts +0 -3
  88. package/dist/commands/container/destroy.js +0 -48
  89. package/dist/commands/container/events.d.ts +0 -3
  90. package/dist/commands/container/events.js +0 -44
  91. package/dist/commands/container/exec.d.ts +0 -3
  92. package/dist/commands/container/exec.js +0 -64
  93. package/dist/commands/container/get.d.ts +0 -3
  94. package/dist/commands/container/list.d.ts +0 -3
  95. package/dist/commands/container-image/create.d.ts +0 -3
  96. package/dist/commands/container-image/create.js +0 -41
  97. package/dist/commands/container-image/get.d.ts +0 -3
  98. package/dist/commands/container-image/get.js +0 -33
  99. package/dist/commands/container-image/list.d.ts +0 -3
@@ -5,13 +5,13 @@ import { GuildAPIClient } from '../../lib/api-client.js';
5
5
  import { getAuthToken } from '../../lib/auth.js';
6
6
  import { handleAxiosError } from '../../lib/errors.js';
7
7
  import { getOutputMode } from '../../lib/output-mode.js';
8
- import { createOutputWriter, formatContainerTable } from '../../lib/output.js';
9
- export function createContainerListCommand() {
8
+ import { createOutputWriter, formatCredentialsTable } from '../../lib/output.js';
9
+ export function createCredentialsListCommand() {
10
10
  const cmd = new Command('list');
11
11
  cmd
12
- .description('List containers for an account')
13
- .requiredOption('--account <id-or-name>', 'Account ID or name')
14
- .option('--status <status>', 'Filter by status: STARTING, RUNNING, ERRORED, DESTROYED')
12
+ .description('List credentials for an account')
13
+ .requiredOption('--owner <account>', 'Account name or ID')
14
+ .option('--search <query>', 'Filter by integration name')
15
15
  .option('--limit <number>', 'Number of results to return', '20')
16
16
  .option('--offset <number>', 'Offset for pagination', '0')
17
17
  .action(async (options) => {
@@ -23,23 +23,24 @@ export function createContainerListCommand() {
23
23
  process.exit(1);
24
24
  }
25
25
  const client = new GuildAPIClient();
26
+ const accountId = options.owner;
26
27
  const params = new URLSearchParams();
27
28
  params.append('limit', options.limit);
28
29
  params.append('offset', options.offset);
29
- if (options.status) {
30
- params.append('statuses', options.status.toUpperCase());
30
+ if (options.search) {
31
+ params.append('search', options.search);
31
32
  }
32
- const response = await client.get(`/accounts/${options.account}/containers?${params.toString()}`);
33
+ const response = await client.get(`/accounts/${accountId}/credentials?${params.toString()}`);
33
34
  if (getOutputMode() === 'json') {
34
35
  console.log(JSON.stringify(response, null, 2));
35
36
  }
36
37
  else {
37
- formatContainerTable(response.items, response.pagination);
38
+ formatCredentialsTable(response.items, response.pagination);
38
39
  }
39
40
  }
40
41
  catch (error) {
41
42
  const formattedError = handleAxiosError(error);
42
- output.error(`Failed to list containers: ${formattedError.details}`);
43
+ output.error(formattedError.details);
43
44
  process.exit(1);
44
45
  }
45
46
  });
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function createCredentialsPolicyCreateCommand(): Command;
3
+ //# sourceMappingURL=policy-create.d.ts.map
@@ -0,0 +1,66 @@
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 { createOutputWriter } from '../../lib/output.js';
8
+ export function createCredentialsPolicyCreateCommand() {
9
+ const cmd = new Command('create');
10
+ cmd
11
+ .description('Create a policy for a credential')
12
+ .argument('<credential-id>', 'Credential ID')
13
+ .requiredOption('--decision <decision>', 'ALLOW or DENY')
14
+ .option('--operations <ops>', 'Comma-separated operation names')
15
+ .option('--workspaces <ids-or-names>', 'Comma-separated workspace IDs or names')
16
+ .option('--agents <ids-or-names>', 'Comma-separated agent IDs or names')
17
+ .option('--resources <json>', 'Resource restrictions as JSON')
18
+ .action(async (credentialId, options) => {
19
+ const output = createOutputWriter();
20
+ try {
21
+ const token = await getAuthToken();
22
+ if (!token) {
23
+ output.error('Not authenticated. Run: guild auth login');
24
+ process.exit(1);
25
+ }
26
+ const decision = options.decision.toUpperCase();
27
+ if (decision !== 'ALLOW' && decision !== 'DENY') {
28
+ output.error('--decision must be ALLOW or DENY');
29
+ process.exit(1);
30
+ }
31
+ const body = {
32
+ decision,
33
+ };
34
+ if (options.operations) {
35
+ body.operations = options.operations.split(',').map((s) => s.trim());
36
+ }
37
+ if (options.workspaces) {
38
+ body.workspace_ids_or_names = options.workspaces
39
+ .split(',')
40
+ .map((s) => s.trim());
41
+ }
42
+ if (options.agents) {
43
+ body.agent_ids_or_names = options.agents.split(',').map((s) => s.trim());
44
+ }
45
+ if (options.resources) {
46
+ try {
47
+ body.resources = JSON.parse(options.resources);
48
+ }
49
+ catch {
50
+ output.error('--resources must be valid JSON');
51
+ process.exit(1);
52
+ }
53
+ }
54
+ const client = new GuildAPIClient();
55
+ const response = await client.post(`/credentials/${credentialId}/policies`, body);
56
+ output.data(response);
57
+ }
58
+ catch (error) {
59
+ const formattedError = handleAxiosError(error);
60
+ output.error(formattedError.details);
61
+ process.exit(1);
62
+ }
63
+ });
64
+ return cmd;
65
+ }
66
+ //# sourceMappingURL=policy-create.js.map
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function createCredentialsPolicyDeleteCommand(): Command;
3
+ //# sourceMappingURL=policy-delete.d.ts.map
@@ -5,12 +5,12 @@ import { GuildAPIClient } from '../../lib/api-client.js';
5
5
  import { getAuthToken } from '../../lib/auth.js';
6
6
  import { handleAxiosError } from '../../lib/errors.js';
7
7
  import { createOutputWriter } from '../../lib/output.js';
8
- export function createContainerGetCommand() {
9
- const cmd = new Command('get');
8
+ export function createCredentialsPolicyDeleteCommand() {
9
+ const cmd = new Command('delete');
10
10
  cmd
11
- .description('Get container details')
12
- .argument('<container-id>', 'Container ID')
13
- .action(async (containerId) => {
11
+ .description('Delete a credential policy')
12
+ .argument('<policy-id>', 'Policy ID')
13
+ .action(async (policyId) => {
14
14
  const output = createOutputWriter();
15
15
  try {
16
16
  const token = await getAuthToken();
@@ -19,15 +19,15 @@ export function createContainerGetCommand() {
19
19
  process.exit(1);
20
20
  }
21
21
  const client = new GuildAPIClient();
22
- const response = await client.get(`/containers/${containerId}`);
23
- output.data(response);
22
+ await client.delete(`/credentials/policies/${policyId}`);
23
+ output.success(`Policy ${policyId} deleted`);
24
24
  }
25
25
  catch (error) {
26
26
  const formattedError = handleAxiosError(error);
27
- output.error(`Failed to get container: ${formattedError.details}`);
27
+ output.error(formattedError.details);
28
28
  process.exit(1);
29
29
  }
30
30
  });
31
31
  return cmd;
32
32
  }
33
- //# sourceMappingURL=get.js.map
33
+ //# sourceMappingURL=policy-delete.js.map
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function createCredentialsPolicyListCommand(): Command;
3
+ //# sourceMappingURL=policy-list.d.ts.map
@@ -5,15 +5,15 @@ import { GuildAPIClient } from '../../lib/api-client.js';
5
5
  import { getAuthToken } from '../../lib/auth.js';
6
6
  import { handleAxiosError } from '../../lib/errors.js';
7
7
  import { getOutputMode } from '../../lib/output-mode.js';
8
- import { createOutputWriter, formatContainerImageTable } from '../../lib/output.js';
9
- export function createContainerImageListCommand() {
8
+ import { createOutputWriter, formatPoliciesTable } from '../../lib/output.js';
9
+ export function createCredentialsPolicyListCommand() {
10
10
  const cmd = new Command('list');
11
11
  cmd
12
- .description('List container images for an account')
13
- .requiredOption('--account <id-or-name>', 'Account ID or name')
12
+ .description('List policies for a credential')
13
+ .argument('<credential-id>', 'Credential ID')
14
14
  .option('--limit <number>', 'Number of results to return', '20')
15
15
  .option('--offset <number>', 'Offset for pagination', '0')
16
- .action(async (options) => {
16
+ .action(async (credentialId, options) => {
17
17
  const output = createOutputWriter();
18
18
  try {
19
19
  const token = await getAuthToken();
@@ -25,20 +25,20 @@ export function createContainerImageListCommand() {
25
25
  const params = new URLSearchParams();
26
26
  params.append('limit', options.limit);
27
27
  params.append('offset', options.offset);
28
- const response = await client.get(`/accounts/${options.account}/container-images?${params.toString()}`);
28
+ const response = await client.get(`/credentials/${credentialId}/policies?${params.toString()}`);
29
29
  if (getOutputMode() === 'json') {
30
30
  console.log(JSON.stringify(response, null, 2));
31
31
  }
32
32
  else {
33
- formatContainerImageTable(response.items, response.pagination);
33
+ formatPoliciesTable(response.items, response.pagination);
34
34
  }
35
35
  }
36
36
  catch (error) {
37
37
  const formattedError = handleAxiosError(error);
38
- output.error(`Failed to list container images: ${formattedError.details}`);
38
+ output.error(formattedError.details);
39
39
  process.exit(1);
40
40
  }
41
41
  });
42
42
  return cmd;
43
43
  }
44
- //# sourceMappingURL=list.js.map
44
+ //# sourceMappingURL=policy-list.js.map
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function createCredentialsPolicyUpdateCommand(): Command;
3
+ //# sourceMappingURL=policy-update.d.ts.map
@@ -0,0 +1,66 @@
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 { createOutputWriter } from '../../lib/output.js';
8
+ export function createCredentialsPolicyUpdateCommand() {
9
+ const cmd = new Command('update');
10
+ cmd
11
+ .description('Update a credential policy')
12
+ .argument('<policy-id>', 'Policy ID')
13
+ .requiredOption('--decision <decision>', 'ALLOW or DENY')
14
+ .option('--operations <ops>', 'Comma-separated operation names')
15
+ .option('--workspaces <ids-or-names>', 'Comma-separated workspace IDs or names')
16
+ .option('--agents <ids-or-names>', 'Comma-separated agent IDs or names')
17
+ .option('--resources <json>', 'Resource restrictions as JSON')
18
+ .action(async (policyId, options) => {
19
+ const output = createOutputWriter();
20
+ try {
21
+ const token = await getAuthToken();
22
+ if (!token) {
23
+ output.error('Not authenticated. Run: guild auth login');
24
+ process.exit(1);
25
+ }
26
+ const decision = options.decision.toUpperCase();
27
+ if (decision !== 'ALLOW' && decision !== 'DENY') {
28
+ output.error('--decision must be ALLOW or DENY');
29
+ process.exit(1);
30
+ }
31
+ const body = {
32
+ decision,
33
+ };
34
+ if (options.operations) {
35
+ body.operations = options.operations.split(',').map((s) => s.trim());
36
+ }
37
+ if (options.workspaces) {
38
+ body.workspace_ids_or_names = options.workspaces
39
+ .split(',')
40
+ .map((s) => s.trim());
41
+ }
42
+ if (options.agents) {
43
+ body.agent_ids_or_names = options.agents.split(',').map((s) => s.trim());
44
+ }
45
+ if (options.resources) {
46
+ try {
47
+ body.resources = JSON.parse(options.resources);
48
+ }
49
+ catch {
50
+ output.error('--resources must be valid JSON');
51
+ process.exit(1);
52
+ }
53
+ }
54
+ const client = new GuildAPIClient();
55
+ const response = await client.put(`/credentials/policies/${policyId}`, body);
56
+ output.data(response);
57
+ }
58
+ catch (error) {
59
+ const formattedError = handleAxiosError(error);
60
+ output.error(formattedError.details);
61
+ process.exit(1);
62
+ }
63
+ });
64
+ return cmd;
65
+ }
66
+ //# sourceMappingURL=policy-update.js.map
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function createIntegrationConnectCommand(): Command;
3
+ //# sourceMappingURL=connect.d.ts.map
@@ -0,0 +1,76 @@
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 { 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 { isInteractive } from '../../lib/stdin.js';
12
+ export function createIntegrationConnectCommand() {
13
+ const cmd = new Command('connect');
14
+ cmd
15
+ .description('Connect credentials to an integration')
16
+ .argument('<id_or_name>', 'Integration ID (UUID) or name in owner~name format (e.g. myorg~my-integration)')
17
+ .option('--token <value>', 'API key value (required in non-interactive mode)')
18
+ .requiredOption('--owner <id_or_name>', 'Account to own the credential — username, org name, or account ID')
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
+ if (!options.token && !isInteractive()) {
28
+ output.error('--token is required in non-interactive mode');
29
+ process.exit(1);
30
+ }
31
+ const client = new GuildAPIClient();
32
+ const integration = await client.get(`/integrations/${identifier}`);
33
+ if (!integration.auth_config) {
34
+ output.error('This integration has no authentication configured.');
35
+ process.exit(1);
36
+ }
37
+ if (integration.auth_config.entity_type !== 'EntIntegrationAuthConfigApiKey') {
38
+ output.error('OAuth integrations must be connected via the dashboard.');
39
+ process.exit(1);
40
+ }
41
+ let apiKey = options.token;
42
+ if (!apiKey) {
43
+ const answer = await inquirer.prompt([
44
+ {
45
+ type: 'password',
46
+ name: 'apiKey',
47
+ message: 'API Key:',
48
+ validate: (input) => input.length > 0 || 'API key cannot be empty',
49
+ },
50
+ ]);
51
+ apiKey = answer.apiKey;
52
+ }
53
+ const params = new URLSearchParams();
54
+ params.append('auth_config_id', integration.auth_config.id);
55
+ params.append('owner_id', options.owner);
56
+ const credential = await client.post(`/credentials/api-key?${params.toString()}`, { tokens: { token: apiKey } });
57
+ if (getOutputMode() === 'json') {
58
+ output.data(credential);
59
+ }
60
+ else {
61
+ console.log(chalk.green('Connected to ') + chalk.bold(integration.name));
62
+ console.log();
63
+ console.log(` ${'Credential ID'.padEnd(15)}${credential.id}`);
64
+ console.log(` ${'Integration'.padEnd(15)}${integration.owner.name}~${integration.name}`);
65
+ console.log(` ${'Owner'.padEnd(15)}${options.owner}`);
66
+ }
67
+ }
68
+ catch (error) {
69
+ const formattedError = handleAxiosError(error);
70
+ output.error(`Failed to connect: ${formattedError.details}`);
71
+ process.exit(1);
72
+ }
73
+ });
74
+ return cmd;
75
+ }
76
+ //# sourceMappingURL=connect.js.map
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function createIntegrationCreateCommand(): Command;
3
+ //# sourceMappingURL=create.d.ts.map