@guildai/cli 0.5.12 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/agent/clone.js +3 -1
- package/dist/commands/agent/code.js +3 -2
- package/dist/commands/agent/fork.js +41 -17
- package/dist/commands/agent/get.js +3 -2
- package/dist/commands/agent/grep.js +61 -31
- package/dist/commands/agent/init.js +1 -3
- package/dist/commands/agent/publish.js +3 -2
- package/dist/commands/agent/revalidate.js +4 -3
- 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/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/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/trigger/create.js +35 -19
- package/dist/commands/workspace/select.js +28 -33
- package/dist/index.js +22 -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 +52 -78
- package/dist/lib/auth.js +7 -4
- package/dist/lib/output.d.ts +3 -16
- package/dist/lib/output.js +43 -109
- package/dist/lib/stdin.d.ts +4 -0
- package/dist/lib/stdin.js +6 -0
- package/dist/mcp/tools.js +1 -1
- package/docs/CLI_WORKFLOW.md +4 -2
- package/docs/skills/agent-dev.md +61 -34
- package/package.json +4 -3
- 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/docs/skills/agent-dev.md
CHANGED
|
@@ -151,16 +151,22 @@ import { ask, output, callTools } from '@guildai/agents-sdk';
|
|
|
151
151
|
import { guildTools, userInterfaceTools } from '@guildai/agents-sdk';
|
|
152
152
|
|
|
153
153
|
// Service tools (from separate packages - NOT from SDK)
|
|
154
|
+
import { azureDevOpsTools } from '@guildai-services/guildai~azure-devops';
|
|
155
|
+
import { bitbucketTools } from '@guildai-services/guildai~bitbucket';
|
|
156
|
+
import { confluenceTools } from '@guildai-services/guildai~confluence';
|
|
157
|
+
import { cypressTools } from '@guildai-services/guildai~cypress';
|
|
158
|
+
import { figmaTools } from '@guildai-services/guildai~figma';
|
|
154
159
|
import { gitHubTools } from '@guildai-services/guildai~github';
|
|
155
|
-
import {
|
|
160
|
+
import { googleComputeTools } from '@guildai-services/guildai~google-compute';
|
|
161
|
+
import { googleLoggingTools } from '@guildai-services/guildai~google-logging';
|
|
156
162
|
import { jiraTools } from '@guildai-services/guildai~jira';
|
|
157
|
-
import { bitbucketTools } from '@guildai-services/guildai~bitbucket';
|
|
158
|
-
import { azureDevOpsTools } from '@guildai-services/guildai~azure-devops';
|
|
159
163
|
import { pipedreamTools } from '@guildai-services/guildai~pipedream';
|
|
160
|
-
import {
|
|
164
|
+
import { slackTools } from '@guildai-services/guildai~slack';
|
|
165
|
+
import { testrailTools } from '@guildai-services/guildai~testrail';
|
|
166
|
+
import { zendeskTools } from '@guildai-services/guildai~zendesk';
|
|
161
167
|
|
|
162
168
|
// Utilities
|
|
163
|
-
import { pick, progressLogNotifyEvent } from '@guildai/agents-sdk';
|
|
169
|
+
import { pick, omit, progressLogNotifyEvent } from '@guildai/agents-sdk';
|
|
164
170
|
|
|
165
171
|
// Advanced (for compiled agents with LLM tool loops)
|
|
166
172
|
import { delegatedCallsOf, asToolResultContent } from '@guildai/agents-sdk';
|
|
@@ -173,19 +179,25 @@ import { z } from 'zod';
|
|
|
173
179
|
|
|
174
180
|
Service tools are in separate `@guildai-services/*` packages. The runtime resolves them automatically.
|
|
175
181
|
|
|
176
|
-
| Service | Package
|
|
177
|
-
| -------------- |
|
|
178
|
-
| Azure DevOps | `@guildai-services/guildai~azure-devops`
|
|
179
|
-
| Bitbucket | `@guildai-services/guildai~bitbucket`
|
|
180
|
-
|
|
|
181
|
-
|
|
|
182
|
-
|
|
|
183
|
-
|
|
|
184
|
-
|
|
|
185
|
-
|
|
|
186
|
-
|
|
|
187
|
-
|
|
|
188
|
-
|
|
|
182
|
+
| Service | Package | Export | Tool Name Prefix |
|
|
183
|
+
| -------------- | ------------------------------------------ | -------------------- | ----------------- |
|
|
184
|
+
| Azure DevOps | `@guildai-services/guildai~azure-devops` | `azureDevOpsTools` | `azure_devops_` |
|
|
185
|
+
| Bitbucket | `@guildai-services/guildai~bitbucket` | `bitbucketTools` | `bitbucket_` |
|
|
186
|
+
| Confluence | `@guildai-services/guildai~confluence` | `confluenceTools` | `confluence_` |
|
|
187
|
+
| Cypress | `@guildai-services/guildai~cypress` | `cypressTools` | `cypress_` |
|
|
188
|
+
| Figma | `@guildai-services/guildai~figma` | `figmaTools` | `figma_` |
|
|
189
|
+
| GitHub | `@guildai-services/guildai~github` | `gitHubTools` | `github_` |
|
|
190
|
+
| Google Compute | `@guildai-services/guildai~google-compute` | `googleComputeTools` | `google_compute_` |
|
|
191
|
+
| Google Logging | `@guildai-services/guildai~google-logging` | `googleLoggingTools` | `google_logging_` |
|
|
192
|
+
| Guild | `@guildai/agents-sdk` | `guildTools` | `guild_` |
|
|
193
|
+
| Jira | `@guildai-services/guildai~jira` | `jiraTools` | `jira_` |
|
|
194
|
+
| Linear | `@guildai-services/guildai~linear` | `linearTools` | `linear_` |
|
|
195
|
+
| NewRelic | `@guildai-services/guildai~newrelic` | `newrelicTools` | `newrelic_` |
|
|
196
|
+
| Pipedream | `@guildai-services/guildai~pipedream` | `pipedreamTools` | `pipedream_` |
|
|
197
|
+
| Slack | `@guildai-services/guildai~slack` | `slackTools` | `slack_` |
|
|
198
|
+
| TestRail | `@guildai-services/guildai~testrail` | `testrailTools` | `testrail_` |
|
|
199
|
+
| User Interface | `@guildai/agents-sdk` | `userInterfaceTools` | `ui_` |
|
|
200
|
+
| Zendesk | `@guildai-services/guildai~zendesk` | `zendeskTools` | `zendesk_` |
|
|
189
201
|
|
|
190
202
|
### Tool Access via `task.tools.*`
|
|
191
203
|
|
|
@@ -220,12 +232,16 @@ await task.tools.guild_credentials_request({ service: 'GITHUB' });
|
|
|
220
232
|
|
|
221
233
|
### Task Properties
|
|
222
234
|
|
|
223
|
-
| Property | Description
|
|
224
|
-
| ---------------- |
|
|
225
|
-
| `task.sessionId` | Session ID for correlating operations
|
|
226
|
-
| `task.
|
|
227
|
-
| `task.
|
|
228
|
-
| `task.
|
|
235
|
+
| Property | Description |
|
|
236
|
+
| ---------------- | ------------------------------------------------------------------------------------------- |
|
|
237
|
+
| `task.sessionId` | Session ID for correlating operations |
|
|
238
|
+
| `task.tools` | Primary API for calling all tools |
|
|
239
|
+
| `task.llm` | LLM service — call `task.llm.generateText({ messages, system, tools })` for AI model access |
|
|
240
|
+
| `task.console` | Debug logging (`task.console.debug(...)`, `.info(...)`, `.warn(...)`, `.error(...)`) |
|
|
241
|
+
| `task.save()` | Persist agent state (self-managed state agents only) |
|
|
242
|
+
| `task.restore()` | Retrieve previously saved state (self-managed state agents only) |
|
|
243
|
+
| `task.guild` | **Deprecated** — use `task.tools.guild_*` instead |
|
|
244
|
+
| `task.ui` | **Deprecated** — use `task.tools.ui_*` instead |
|
|
229
245
|
|
|
230
246
|
---
|
|
231
247
|
|
|
@@ -340,7 +356,7 @@ export default agent({
|
|
|
340
356
|
|
|
341
357
|
- `run()` returns the OUTPUT directly (not wrapped in `{ type: "output", output: ... }`)
|
|
342
358
|
- The runtime handles continuations — you can `await` tool calls inline
|
|
343
|
-
-
|
|
359
|
+
- `"use agent"` directive at top of file is optional (the Babel compiler recognizes it but strips it)
|
|
344
360
|
- No `identifier` field needed
|
|
345
361
|
|
|
346
362
|
### 3. Self-Managed State Agent (`start()`/`onToolResults()`)
|
|
@@ -474,7 +490,7 @@ import {
|
|
|
474
490
|
} from '@guildai/agents-sdk';
|
|
475
491
|
import { gitHubTools } from '@guildai-services/guildai~github';
|
|
476
492
|
import { slackTools } from '@guildai-services/guildai~slack';
|
|
477
|
-
import {
|
|
493
|
+
import type { ModelMessage } from 'ai';
|
|
478
494
|
import { z } from 'zod';
|
|
479
495
|
|
|
480
496
|
const tools = { ...gitHubTools, ...slackTools, ...userInterfaceTools };
|
|
@@ -485,15 +501,12 @@ const llmTools = { ...gitHubTools }; // LLM gets execute access to these
|
|
|
485
501
|
const agentTools = { ...slackTools, ...userInterfaceTools }; // These get delegated
|
|
486
502
|
|
|
487
503
|
async function start(input, task: Task<Tools>) {
|
|
488
|
-
const model = await task.llm.model();
|
|
489
504
|
const messages: ModelMessage[] = [{ role: 'user', content: input.text }];
|
|
490
505
|
|
|
491
|
-
const result = await generateText({
|
|
492
|
-
model,
|
|
506
|
+
const result = await task.llm.generateText({
|
|
493
507
|
system: 'You are a helpful assistant.',
|
|
494
508
|
messages,
|
|
495
509
|
tools: llmTools, // Only give LLM the tools it can execute
|
|
496
|
-
maxSteps: 10,
|
|
497
510
|
});
|
|
498
511
|
|
|
499
512
|
// Check for delegated (unexecuted) tool calls
|
|
@@ -525,6 +538,7 @@ async function onToolResults(
|
|
|
525
538
|
|
|
526
539
|
**Key utilities:**
|
|
527
540
|
|
|
541
|
+
- `task.llm.generateText({ messages, system, tools })` — call the LLM with automatic authentication and provider selection. The runtime handles model selection and credential injection.
|
|
528
542
|
- `delegatedCallsOf<Tools>(content)` — extracts unexecuted tool calls from `generateText` results that need runtime delegation
|
|
529
543
|
- `asToolResultContent(results)` — converts `TypedToolResult[]` into LLM message format for conversation history
|
|
530
544
|
|
|
@@ -572,13 +586,20 @@ await task.tools.slack_chat_post_message({
|
|
|
572
586
|
|
|
573
587
|
**CRITICAL: Only use tool names listed below.** If a tool isn't listed here, it doesn't exist. Do not guess tool names based on API patterns.
|
|
574
588
|
|
|
575
|
-
Use `pick()` to select specific tools:
|
|
589
|
+
Use `pick()` to select specific tools, or `omit()` to exclude specific tools:
|
|
576
590
|
|
|
577
591
|
```typescript
|
|
592
|
+
// Include only specific tools
|
|
578
593
|
const tools = {
|
|
579
594
|
...pick(gitHubTools, ['github_repos_get', 'github_pulls_list']),
|
|
580
595
|
...guildTools,
|
|
581
596
|
};
|
|
597
|
+
|
|
598
|
+
// Include all tools except specific ones
|
|
599
|
+
const tools = {
|
|
600
|
+
...omit(gitHubTools, ['github_repos_delete', 'github_repos_update']),
|
|
601
|
+
...guildTools,
|
|
602
|
+
};
|
|
582
603
|
```
|
|
583
604
|
|
|
584
605
|
#### Azure DevOps (`azure_devops_` prefix, 122 tools)
|
|
@@ -1673,8 +1694,8 @@ export default agent({ run: async (input, task) => { ... } })
|
|
|
1673
1694
|
## Versioning
|
|
1674
1695
|
|
|
1675
1696
|
- Use semver: `1.0.0` → `1.0.1` (patch), `1.1.0` (minor), `2.0.0` (breaking)
|
|
1676
|
-
-
|
|
1677
|
-
-
|
|
1697
|
+
- Use `--bump [patch|minor|major]` with `guild agent save` to auto-bump `package.json` version
|
|
1698
|
+
- Or bump manually in `package.json` before saving
|
|
1678
1699
|
|
|
1679
1700
|
## File Structure
|
|
1680
1701
|
|
|
@@ -1709,15 +1730,21 @@ guild agent pull # Pull remote changes
|
|
|
1709
1730
|
guild agent save # Push commits and create a draft version
|
|
1710
1731
|
guild agent save -A --message "description" # Stage+commit+push in one step
|
|
1711
1732
|
guild agent save --message "v1.0" --wait --publish # Save + validate + publish
|
|
1733
|
+
guild agent save --bump minor --message "v1.1" # Auto-bump version before saving
|
|
1712
1734
|
guild agent test # Interactive test
|
|
1713
1735
|
guild agent test --ephemeral # Ephemeral test
|
|
1714
1736
|
guild agent chat "Hello" # Test with input
|
|
1715
1737
|
guild agent get [agent-id] # View agent info
|
|
1738
|
+
guild agent list # List agents
|
|
1739
|
+
guild agent list --search "github" --published # Search published agents
|
|
1740
|
+
guild agent search <query> # Search published agents
|
|
1716
1741
|
guild agent versions [agent-id] # Version history
|
|
1717
1742
|
guild agent clone <agent-id> # Clone existing agent
|
|
1743
|
+
guild agent fork [identifier] # Fork an agent (latest published version, or identifier:version)
|
|
1718
1744
|
guild agent publish # Publish a version
|
|
1719
1745
|
guild agent unpublish # Remove from catalog
|
|
1720
|
-
guild agent update
|
|
1746
|
+
guild agent update [identifier] # Update agent metadata
|
|
1747
|
+
guild agent workspaces [agent-id] # List workspaces using an agent
|
|
1721
1748
|
guild agent tags list|add|remove|set # Manage agent tags
|
|
1722
1749
|
guild agent revalidate # Re-run validation
|
|
1723
1750
|
guild agent code [agent-id] # View agent source
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@guildai/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
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",
|
|
@@ -55,6 +55,7 @@
|
|
|
55
55
|
"url": "https://docs.guild.ai/support"
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
|
+
"@inquirer/search": "^4.1.7",
|
|
58
59
|
"@napi-rs/canvas": "^0.1.85",
|
|
59
60
|
"@napi-rs/keyring": "^1.2.0",
|
|
60
61
|
"axios": "^1.13.2",
|
|
@@ -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
|