@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.
- package/README.md +17 -0
- package/dist/commands/agent/chat.js +31 -31
- package/dist/commands/agent/clone.js +3 -1
- package/dist/commands/agent/code.js +3 -2
- package/dist/commands/agent/fork.js +41 -15
- package/dist/commands/agent/get.js +3 -2
- package/dist/commands/agent/grep.js +61 -31
- package/dist/commands/agent/init.js +1 -1
- package/dist/commands/agent/publish.js +3 -2
- package/dist/commands/agent/pull.js +36 -21
- package/dist/commands/agent/revalidate.js +4 -3
- package/dist/commands/agent/save.js +2 -2
- package/dist/commands/agent/search.js +3 -3
- package/dist/commands/agent/tags/add.js +4 -3
- package/dist/commands/agent/tags/list.js +3 -2
- package/dist/commands/agent/tags/remove.js +4 -3
- package/dist/commands/agent/tags/set.js +3 -2
- package/dist/commands/agent/test.js +8 -12
- package/dist/commands/agent/unpublish.js +3 -2
- package/dist/commands/agent/update.js +9 -8
- package/dist/commands/agent/versions.js +3 -2
- package/dist/commands/agent/workspaces.js +3 -2
- package/dist/commands/auth/login.js +3 -3
- package/dist/commands/chat.js +64 -102
- package/dist/commands/credentials/endpoint-list.d.ts +3 -0
- package/dist/commands/credentials/endpoint-list.js +87 -0
- package/dist/commands/credentials/list.d.ts +3 -0
- package/dist/commands/{container → credentials}/list.js +11 -10
- package/dist/commands/credentials/policy-create.d.ts +3 -0
- package/dist/commands/credentials/policy-create.js +66 -0
- package/dist/commands/credentials/policy-delete.d.ts +3 -0
- package/dist/commands/{container/get.js → credentials/policy-delete.js} +9 -9
- package/dist/commands/credentials/policy-list.d.ts +3 -0
- package/dist/commands/{container-image/list.js → credentials/policy-list.js} +9 -9
- package/dist/commands/credentials/policy-update.d.ts +3 -0
- package/dist/commands/credentials/policy-update.js +66 -0
- package/dist/commands/integration/connect.d.ts +3 -0
- package/dist/commands/integration/connect.js +76 -0
- package/dist/commands/integration/create.d.ts +3 -0
- package/dist/commands/integration/create.js +298 -0
- package/dist/commands/integration/get.d.ts +3 -0
- package/dist/commands/integration/get.js +95 -0
- package/dist/commands/integration/list.d.ts +3 -0
- package/dist/commands/integration/list.js +61 -0
- package/dist/commands/integration/operation/create.d.ts +3 -0
- package/dist/commands/integration/operation/create.js +163 -0
- package/dist/commands/integration/operation/list.d.ts +3 -0
- package/dist/commands/integration/operation/list.js +83 -0
- package/dist/commands/integration/update.d.ts +3 -0
- package/dist/commands/integration/update.js +139 -0
- package/dist/commands/integration/version/build.d.ts +3 -0
- package/dist/commands/integration/version/build.js +86 -0
- package/dist/commands/integration/version/create.d.ts +3 -0
- package/dist/commands/integration/version/create.js +45 -0
- package/dist/commands/integration/version/get.d.ts +3 -0
- package/dist/commands/integration/version/get.js +72 -0
- package/dist/commands/integration/version/list.d.ts +3 -0
- package/dist/commands/integration/version/list.js +44 -0
- package/dist/commands/integration/version/publish.d.ts +3 -0
- package/dist/commands/integration/version/publish.js +79 -0
- package/dist/commands/integration/version/test.d.ts +3 -0
- package/dist/commands/integration/version/test.js +104 -0
- package/dist/commands/trigger/create.js +35 -19
- package/dist/commands/workspace/create.js +10 -4
- package/dist/commands/workspace/select.js +0 -1
- package/dist/index.js +60 -27
- package/dist/lib/agent-helpers.d.ts +8 -0
- package/dist/lib/agent-helpers.js +15 -0
- package/dist/lib/api-types.d.ts +109 -78
- package/dist/lib/auth.d.ts +1 -1
- package/dist/lib/auth.js +10 -6
- package/dist/lib/integration-helpers.d.ts +15 -0
- package/dist/lib/integration-helpers.js +38 -0
- package/dist/lib/output.d.ts +13 -16
- package/dist/lib/output.js +137 -109
- package/dist/lib/session-events-fetch.d.ts +27 -0
- package/dist/lib/session-events-fetch.js +25 -0
- package/dist/lib/session-polling.d.ts +7 -2
- package/dist/lib/session-polling.js +18 -11
- package/dist/lib/session-resume.js +2 -5
- package/dist/lib/table.d.ts +0 -1
- package/dist/lib/table.js +0 -1
- package/dist/mcp/tools.js +6 -12
- package/docs/CLI_WORKFLOW.md +19 -2
- package/docs/skills/agent-dev.md +17 -2
- package/package.json +6 -5
- package/dist/commands/container/destroy.d.ts +0 -3
- package/dist/commands/container/destroy.js +0 -48
- package/dist/commands/container/events.d.ts +0 -3
- package/dist/commands/container/events.js +0 -44
- package/dist/commands/container/exec.d.ts +0 -3
- package/dist/commands/container/exec.js +0 -64
- package/dist/commands/container/get.d.ts +0 -3
- package/dist/commands/container/list.d.ts +0 -3
- package/dist/commands/container-image/create.d.ts +0 -3
- package/dist/commands/container-image/create.js +0 -41
- package/dist/commands/container-image/get.d.ts +0 -3
- package/dist/commands/container-image/get.js +0 -33
- 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
|
-
|
|
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.
|
|
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
|
})
|
package/docs/CLI_WORKFLOW.md
CHANGED
|
@@ -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:
|
package/docs/skills/agent-dev.md
CHANGED
|
@@ -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
|
|
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
|
|
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.
|
|
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,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,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,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,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,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
|