@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
package/dist/mcp/tools.js CHANGED
@@ -24,17 +24,13 @@ async function pollForResponse(apiClient, sessionId, debug) {
24
24
  let lastEventId;
25
25
  while (Date.now() - startTime < POLL_TIMEOUT_MS) {
26
26
  try {
27
- const response = await apiClient.get(`/sessions/${sessionId}/events`);
27
+ let url = `/sessions/${sessionId}/events`;
28
+ if (lastEventId) {
29
+ url += `?from_id=${lastEventId}`;
30
+ }
31
+ const response = await apiClient.get(url);
28
32
  const events = response.events || [];
29
- // Find new events after last seen
30
- let foundLast = !lastEventId;
31
33
  for (const event of events) {
32
- if (!foundLast) {
33
- if (event.id === lastEventId) {
34
- foundLast = true;
35
- }
36
- continue;
37
- }
38
34
  debugLog(debug, `Event: ${event.event_type}`);
39
35
  if (event.event_type === 'agent_notification_message') {
40
36
  const data = extractEventText(event);
@@ -53,9 +49,7 @@ async function pollForResponse(apiClient, sessionId, debug) {
53
49
  debugLog(debug, 'Runtime done');
54
50
  return messages.join('\n\n') || 'Agent completed without output.';
55
51
  }
56
- lastEventId = event.id;
57
52
  }
58
- // Update lastEventId to latest
59
53
  if (events.length > 0) {
60
54
  lastEventId = events[events.length - 1].id;
61
55
  }
@@ -694,7 +688,7 @@ export function registerTools(server, apiClient, defaultWorkspaceId, debug) {
694
688
  const agent = t.agent.full_name || t.agent.name;
695
689
  const disabled = t.deactivated_at ? ' [DISABLED]' : '';
696
690
  if (t.type === 'webhook') {
697
- return `• ${t.id} [webhook] ${t.service}/${t.event_type || '*'} → ${agent}${disabled}`;
691
+ return `• ${t.id} [webhook] ${t.integration.name}/${t.event_type || '*'} → ${agent}${disabled}`;
698
692
  }
699
693
  return `• ${t.id} [time] ${t.frequency} → ${agent}${disabled}`;
700
694
  })
@@ -21,8 +21,9 @@ Use the **CLI** (via Bash) for **local development operations**: `guild agent in
21
21
  # Create a new agent
22
22
  guild agent init --name my-agent --template LLM
23
23
 
24
- # Clone an existing agent
24
+ # Clone an existing agent (full name or short name)
25
25
  guild agent clone guildai/dev-assistant
26
+ guild agent clone dev-assistant # resolves to your-username/dev-assistant
26
27
  cd dev-assistant
27
28
 
28
29
  # Save changes (pushes commits to Guild server)
@@ -75,8 +76,9 @@ guild agent init --name my-agent --template BLANK
75
76
  # Fork an existing agent
76
77
  guild agent init --fork owner/agent-name
77
78
 
78
- # Clone to work on an existing agent
79
+ # Clone to work on an existing agent (full name, short name, or UUID)
79
80
  guild agent clone owner/agent-name
81
+ guild agent clone agent-name # auto-resolves owner
80
82
  ```
81
83
 
82
84
  ### Working with Existing Agents
@@ -143,6 +145,21 @@ guild agent test --ephemeral
143
145
  guild agent chat "Hello, can you help me?"
144
146
  ```
145
147
 
148
+ ### Chatting with Agents
149
+
150
+ ```bash
151
+ # Chat with any published agent by name
152
+ guild chat --agent owner/agent-name
153
+
154
+ # Chat with a specific agent in a specific workspace
155
+ guild chat --agent owner/agent-name --workspace owner/workspace-name
156
+
157
+ # One-shot mode (send prompt, get response, exit)
158
+ guild chat --agent owner/agent-name --once "What can you do?"
159
+ ```
160
+
161
+ To chat with the agent you are developing locally, use `guild agent chat` from within the agent directory.
162
+
146
163
  ## File Structure
147
164
 
148
165
  After `guild agent init`, you get:
@@ -89,6 +89,21 @@ guild agent test --ephemeral
89
89
  guild agent chat "Hello, can you help me?"
90
90
  ```
91
91
 
92
+ ### Chatting with Agents
93
+
94
+ ```bash
95
+ # Chat with any published agent by name
96
+ guild chat --agent owner/agent-name
97
+
98
+ # Chat with a specific agent in a specific workspace
99
+ guild chat --agent owner/agent-name --workspace owner/workspace-name
100
+
101
+ # One-shot mode (send prompt, get response, exit)
102
+ guild chat --agent owner/agent-name --once "What can you do?"
103
+ ```
104
+
105
+ To chat with the agent you are developing locally, use `guild agent chat` from within the agent directory.
106
+
92
107
  ## Guild CLI Is the ONLY Tool for Agent Operations
93
108
 
94
109
  **ALL agent work — creating, saving, testing, debugging, investigating — goes through Guild CLI.**
@@ -1740,10 +1755,10 @@ guild agent list --search "github" --published # Search published agents
1740
1755
  guild agent search <query> # Search published agents
1741
1756
  guild agent versions [agent-id] # Version history
1742
1757
  guild agent clone <agent-id> # Clone existing agent
1743
- guild agent fork <agent-id>:<version-id> # Fork a specific version as a new agent
1758
+ guild agent fork [identifier] # Fork an agent (latest published version, or identifier:version)
1744
1759
  guild agent publish # Publish a version
1745
1760
  guild agent unpublish # Remove from catalog
1746
- guild agent update # Update agent metadata
1761
+ guild agent update [identifier] # Update agent metadata
1747
1762
  guild agent workspaces [agent-id] # List workspaces using an agent
1748
1763
  guild agent tags list|add|remove|set # Manage agent tags
1749
1764
  guild agent revalidate # Re-run validation
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guildai/cli",
3
- "version": "0.5.13",
3
+ "version": "0.6.1",
4
4
  "description": "Guild.ai CLI - Build, test, and deploy AI agents",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -35,12 +35,12 @@
35
35
  "format:fix": "prettier --write .",
36
36
  "format:check": "prettier --check .",
37
37
  "test": "vitest run",
38
- "test:unit": "vitest run test/unit",
38
+ "test:unit": "vitest run test/unit --config vitest.unit.config.ts",
39
39
  "test:e2e": "vitest run test/e2e --exclude='**/**.slow.test.ts'",
40
40
  "test:e2e:slow": "vitest run 'test/e2e/**/*.slow.test.ts'",
41
41
  "test:e2e:all": "vitest run test/e2e",
42
42
  "test:watch": "vitest",
43
- "prepublishOnly": "npm run build && npm run lint && npm run test"
43
+ "prepublishOnly": "npm run build && npm run lint && npm run test:unit"
44
44
  },
45
45
  "keywords": [
46
46
  "guild",
@@ -56,6 +56,7 @@
56
56
  },
57
57
  "dependencies": {
58
58
  "@inquirer/search": "^4.1.7",
59
+ "@modelcontextprotocol/sdk": "^1.12.1",
59
60
  "@napi-rs/canvas": "^0.1.85",
60
61
  "@napi-rs/keyring": "^1.2.0",
61
62
  "axios": "^1.13.2",
@@ -76,11 +77,11 @@
76
77
  "sharp": "^0.34.5",
77
78
  "shell-quote": "^1.8.2",
78
79
  "string-width": "^7.2.0",
80
+ "strip-ansi": "^7.2.0",
79
81
  "svg-pathdata": "^8.0.0",
80
82
  "svgdom": "^0.1.22",
81
83
  "ws": "^8.18.0",
82
- "zod": "^3.24.4",
83
- "@modelcontextprotocol/sdk": "^1.12.1"
84
+ "zod": "^3.24.4"
84
85
  },
85
86
  "devDependencies": {
86
87
  "@types/inquirer": "^8.2.10",
@@ -1,3 +0,0 @@
1
- import { Command } from 'commander';
2
- export declare function createContainerDestroyCommand(): Command;
3
- //# sourceMappingURL=destroy.d.ts.map
@@ -1,48 +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 } from '../../lib/output.js';
9
- export function createContainerDestroyCommand() {
10
- const cmd = new Command('destroy');
11
- cmd
12
- .description('Destroy a running container')
13
- .argument('<container-id>', 'Container ID')
14
- .action(async (containerId) => {
15
- const output = createOutputWriter();
16
- try {
17
- const token = await getAuthToken();
18
- if (!token) {
19
- output.error('Not authenticated. Run: guild auth login');
20
- process.exit(1);
21
- }
22
- const client = new GuildAPIClient();
23
- const response = await client.post(`/containers/${containerId}/destroy`, {});
24
- if (getOutputMode() === 'json') {
25
- console.log(JSON.stringify(response, null, 2));
26
- }
27
- else {
28
- if (response.status === 'SUCCESS') {
29
- output.success(`Container ${containerId} destroyed`);
30
- }
31
- else if (response.status === 'ERROR') {
32
- output.error(`Failed to destroy container: ${response.error || 'unknown error'}`);
33
- process.exit(1);
34
- }
35
- else {
36
- output.progress(`Container destruction ${response.status.toLowerCase()}...`);
37
- }
38
- }
39
- }
40
- catch (error) {
41
- const formattedError = handleAxiosError(error);
42
- output.error(`Failed to destroy container: ${formattedError.details}`);
43
- process.exit(1);
44
- }
45
- });
46
- return cmd;
47
- }
48
- //# sourceMappingURL=destroy.js.map
@@ -1,3 +0,0 @@
1
- import { Command } from 'commander';
2
- export declare function createContainerEventsCommand(): Command;
3
- //# sourceMappingURL=events.d.ts.map
@@ -1,44 +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, formatContainerEventTable } from '../../lib/output.js';
9
- export function createContainerEventsCommand() {
10
- const cmd = new Command('events');
11
- cmd
12
- .description('List events for a container')
13
- .argument('<container-id>', 'Container ID')
14
- .option('--limit <number>', 'Number of results to return', '20')
15
- .option('--offset <number>', 'Offset for pagination', '0')
16
- .action(async (containerId, options) => {
17
- const output = createOutputWriter();
18
- try {
19
- const token = await getAuthToken();
20
- if (!token) {
21
- output.error('Not authenticated. 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(`/containers/${containerId}/events?${params.toString()}`);
29
- if (getOutputMode() === 'json') {
30
- console.log(JSON.stringify(response, null, 2));
31
- }
32
- else {
33
- formatContainerEventTable(response.items, response.pagination);
34
- }
35
- }
36
- catch (error) {
37
- const formattedError = handleAxiosError(error);
38
- output.error(`Failed to list container events: ${formattedError.details}`);
39
- process.exit(1);
40
- }
41
- });
42
- return cmd;
43
- }
44
- //# sourceMappingURL=events.js.map
@@ -1,3 +0,0 @@
1
- import { Command } from 'commander';
2
- export declare function createContainerExecCommand(): Command;
3
- //# sourceMappingURL=exec.d.ts.map
@@ -1,64 +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
- export function createContainerExecCommand() {
11
- const cmd = new Command('exec');
12
- cmd
13
- .description('Execute a command in a running container')
14
- .argument('<container-id>', 'Container ID')
15
- .argument('<command>', 'Command to execute')
16
- .action(async (containerId, command) => {
17
- const output = createOutputWriter();
18
- try {
19
- const token = await getAuthToken();
20
- if (!token) {
21
- output.error('Not authenticated. Run: guild auth login');
22
- process.exit(1);
23
- }
24
- const client = new GuildAPIClient();
25
- const response = await client.post(`/containers/${containerId}/command`, { command });
26
- if (getOutputMode() === 'json') {
27
- console.log(JSON.stringify(response, null, 2));
28
- }
29
- else {
30
- // Display return code
31
- if (response.return_code !== null) {
32
- const codeColor = response.return_code === 0 ? chalk.green : chalk.red;
33
- console.error(chalk.dim('Return code:'), codeColor(String(response.return_code)));
34
- }
35
- // Display stdout
36
- if (response.stdout) {
37
- console.log(response.stdout);
38
- }
39
- // Display stderr
40
- if (response.stderr) {
41
- console.error(chalk.red(response.stderr));
42
- }
43
- // Display error from event
44
- if (response.status === 'ERROR' && response.error) {
45
- console.error(chalk.red(`Error: ${response.error}`));
46
- }
47
- }
48
- // Exit with the command's return code if available
49
- if (response.return_code !== null && response.return_code !== 0) {
50
- process.exit(response.return_code);
51
- }
52
- if (response.status === 'ERROR') {
53
- process.exit(1);
54
- }
55
- }
56
- catch (error) {
57
- const formattedError = handleAxiosError(error);
58
- output.error(`Failed to execute command: ${formattedError.details}`);
59
- process.exit(1);
60
- }
61
- });
62
- return cmd;
63
- }
64
- //# sourceMappingURL=exec.js.map
@@ -1,3 +0,0 @@
1
- import { Command } from 'commander';
2
- export declare function createContainerGetCommand(): Command;
3
- //# sourceMappingURL=get.d.ts.map
@@ -1,3 +0,0 @@
1
- import { Command } from 'commander';
2
- export declare function createContainerListCommand(): Command;
3
- //# sourceMappingURL=list.d.ts.map
@@ -1,3 +0,0 @@
1
- import { Command } from 'commander';
2
- export declare function createContainerImageCreateCommand(): Command;
3
- //# sourceMappingURL=create.d.ts.map
@@ -1,41 +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 { createOutputWriter } from '../../lib/output.js';
8
- export function createContainerImageCreateCommand() {
9
- const cmd = new Command('create');
10
- cmd
11
- .description('Create a container image')
12
- .requiredOption('--account <id-or-name>', 'Account or organization ID or name')
13
- .requiredOption('--name <name>', 'Image name (1-100 characters)')
14
- .requiredOption('--image <image>', 'Container image path (e.g. registry.example.com/org/image)')
15
- .requiredOption('--tag <tag>', 'Image tag (e.g. latest)')
16
- .action(async (opts) => {
17
- const output = createOutputWriter();
18
- try {
19
- const token = await getAuthToken();
20
- if (!token) {
21
- output.error('Not authenticated. Run: guild auth login');
22
- process.exit(1);
23
- }
24
- const client = new GuildAPIClient();
25
- const response = await client.post('/container-images', {
26
- name: opts.name,
27
- image_name: opts.image,
28
- tag: opts.tag,
29
- owner_id_or_name: opts.account,
30
- });
31
- output.data(response);
32
- }
33
- catch (error) {
34
- const formattedError = handleAxiosError(error);
35
- output.error(`Failed to create container image: ${formattedError.details}`);
36
- process.exit(1);
37
- }
38
- });
39
- return cmd;
40
- }
41
- //# sourceMappingURL=create.js.map
@@ -1,3 +0,0 @@
1
- import { Command } from 'commander';
2
- export declare function createContainerImageGetCommand(): Command;
3
- //# sourceMappingURL=get.d.ts.map
@@ -1,33 +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 { createOutputWriter } from '../../lib/output.js';
8
- export function createContainerImageGetCommand() {
9
- const cmd = new Command('get');
10
- cmd
11
- .description('Get container image details')
12
- .argument('<image-id-or-name>', 'Container image ID or name (owner~name)')
13
- .action(async (imageIdOrName) => {
14
- const output = createOutputWriter();
15
- try {
16
- const token = await getAuthToken();
17
- if (!token) {
18
- output.error('Not authenticated. Run: guild auth login');
19
- process.exit(1);
20
- }
21
- const client = new GuildAPIClient();
22
- const response = await client.get(`/container-images/${imageIdOrName}`);
23
- output.data(response);
24
- }
25
- catch (error) {
26
- const formattedError = handleAxiosError(error);
27
- output.error(`Failed to get container image: ${formattedError.details}`);
28
- process.exit(1);
29
- }
30
- });
31
- return cmd;
32
- }
33
- //# sourceMappingURL=get.js.map
@@ -1,3 +0,0 @@
1
- import { Command } from 'commander';
2
- export declare function createContainerImageListCommand(): Command;
3
- //# sourceMappingURL=list.d.ts.map