@guildai/cli 0.11.0 → 0.12.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.
Files changed (198) hide show
  1. package/dist/auth-CRMO5O3N.js +29 -0
  2. package/dist/auth-CRMO5O3N.js.map +7 -0
  3. package/dist/chat-5VX2WJH2.js +303 -0
  4. package/dist/chat-5VX2WJH2.js.map +7 -0
  5. package/dist/chat-SIKDYZQK.js +31 -0
  6. package/dist/chat-SIKDYZQK.js.map +7 -0
  7. package/dist/chunk-56YCMGL3.js +522 -0
  8. package/dist/chunk-56YCMGL3.js.map +7 -0
  9. package/dist/chunk-6EX6E7WP.js +7042 -0
  10. package/dist/chunk-6EX6E7WP.js.map +7 -0
  11. package/dist/chunk-B7VAF5UG.js +532 -0
  12. package/dist/chunk-B7VAF5UG.js.map +7 -0
  13. package/dist/chunk-DOIYVBNY.js +3057 -0
  14. package/dist/chunk-DOIYVBNY.js.map +7 -0
  15. package/dist/chunk-ENKEEJ45.js +17 -0
  16. package/dist/chunk-ENKEEJ45.js.map +7 -0
  17. package/dist/chunk-IBRKVGMZ.js +97041 -0
  18. package/dist/chunk-IBRKVGMZ.js.map +7 -0
  19. package/dist/chunk-LFMQJOKC.js +19778 -0
  20. package/dist/chunk-LFMQJOKC.js.map +7 -0
  21. package/dist/chunk-M347HP6M.js +22896 -0
  22. package/dist/chunk-M347HP6M.js.map +7 -0
  23. package/dist/chunk-OYQ476FQ.js +44 -0
  24. package/dist/chunk-OYQ476FQ.js.map +7 -0
  25. package/dist/chunk-PNCUR4OB.js +257 -0
  26. package/dist/chunk-PNCUR4OB.js.map +7 -0
  27. package/dist/chunk-RIG2HZWM.js +317 -0
  28. package/dist/chunk-RIG2HZWM.js.map +7 -0
  29. package/dist/chunk-SPZPZXUN.js +826 -0
  30. package/dist/chunk-SPZPZXUN.js.map +7 -0
  31. package/dist/chunk-VVSOU6ON.js +53 -0
  32. package/dist/chunk-VVSOU6ON.js.map +7 -0
  33. package/dist/chunk-X3ADGWOF.js +3643 -0
  34. package/dist/chunk-X3ADGWOF.js.map +7 -0
  35. package/dist/commands/skill/create.d.ts +3 -0
  36. package/dist/commands/skill/get.d.ts +3 -0
  37. package/dist/commands/skill/list.d.ts +3 -0
  38. package/dist/commands/skill/update.d.ts +3 -0
  39. package/dist/commands/skill/version/create.d.ts +3 -0
  40. package/dist/commands/skill/version/get.d.ts +3 -0
  41. package/dist/commands/skill/version/list.d.ts +3 -0
  42. package/dist/devtools-AO7YSDOD.js +67 -0
  43. package/dist/devtools-AO7YSDOD.js.map +7 -0
  44. package/dist/dist-4CBK6X5H.js +1566 -0
  45. package/dist/dist-4CBK6X5H.js.map +7 -0
  46. package/dist/esm-FRAVZP4J.js +13 -0
  47. package/dist/esm-FRAVZP4J.js.map +7 -0
  48. package/dist/execa-XQMWSABC.js +35 -0
  49. package/dist/execa-XQMWSABC.js.map +7 -0
  50. package/dist/index.js +8230 -263
  51. package/dist/index.js.map +7 -0
  52. package/dist/lib/api-types.d.ts +44 -0
  53. package/dist/lib/config.d.ts +9 -0
  54. package/dist/lib/errors.d.ts +1 -1
  55. package/dist/lib/output.d.ts +11 -1
  56. package/dist/lib/session-events.d.ts +1 -1
  57. package/dist/lib/session-polling.d.ts +24 -1
  58. package/dist/lib/websocket-client.d.ts +46 -0
  59. package/dist/open-RF4X5MOP.js +13 -0
  60. package/dist/open-RF4X5MOP.js.map +7 -0
  61. package/dist/server-JYVH64FD.js +27659 -0
  62. package/dist/server-JYVH64FD.js.map +7 -0
  63. package/dist/test-SNIYRJ32.js +692 -0
  64. package/dist/test-SNIYRJ32.js.map +7 -0
  65. package/docs/skills/codex-agent-dev.md +2 -2
  66. package/package.json +8 -12
  67. package/dist/commands/agent/chat.js +0 -281
  68. package/dist/commands/agent/clone.js +0 -118
  69. package/dist/commands/agent/code.js +0 -87
  70. package/dist/commands/agent/fork.js +0 -220
  71. package/dist/commands/agent/get.js +0 -37
  72. package/dist/commands/agent/grep.js +0 -107
  73. package/dist/commands/agent/init.js +0 -403
  74. package/dist/commands/agent/list.js +0 -110
  75. package/dist/commands/agent/logs.js +0 -62
  76. package/dist/commands/agent/owners.js +0 -74
  77. package/dist/commands/agent/publish.js +0 -91
  78. package/dist/commands/agent/pull.js +0 -194
  79. package/dist/commands/agent/revalidate.js +0 -56
  80. package/dist/commands/agent/save.js +0 -345
  81. package/dist/commands/agent/search.js +0 -61
  82. package/dist/commands/agent/tags/add.js +0 -73
  83. package/dist/commands/agent/tags/list.js +0 -43
  84. package/dist/commands/agent/tags/remove.js +0 -84
  85. package/dist/commands/agent/tags/set.js +0 -71
  86. package/dist/commands/agent/test.js +0 -489
  87. package/dist/commands/agent/unpublish.js +0 -64
  88. package/dist/commands/agent/update.js +0 -118
  89. package/dist/commands/agent/versions.js +0 -55
  90. package/dist/commands/agent/workspaces.js +0 -54
  91. package/dist/commands/auth/login.js +0 -31
  92. package/dist/commands/auth/logout.js +0 -24
  93. package/dist/commands/auth/status.js +0 -38
  94. package/dist/commands/auth/token.js +0 -19
  95. package/dist/commands/chat.js +0 -1416
  96. package/dist/commands/config/get.js +0 -64
  97. package/dist/commands/config/list.js +0 -46
  98. package/dist/commands/config/path.js +0 -37
  99. package/dist/commands/config/set.js +0 -132
  100. package/dist/commands/credentials/endpoint-list.js +0 -88
  101. package/dist/commands/credentials/list.js +0 -50
  102. package/dist/commands/credentials/policy-create.js +0 -66
  103. package/dist/commands/credentials/policy-delete.js +0 -33
  104. package/dist/commands/credentials/policy-list.js +0 -45
  105. package/dist/commands/credentials/policy-update.js +0 -66
  106. package/dist/commands/doctor.js +0 -233
  107. package/dist/commands/integration/connect.js +0 -76
  108. package/dist/commands/integration/create.js +0 -298
  109. package/dist/commands/integration/get.js +0 -95
  110. package/dist/commands/integration/list.js +0 -62
  111. package/dist/commands/integration/operation/create.js +0 -164
  112. package/dist/commands/integration/operation/list.js +0 -92
  113. package/dist/commands/integration/update.js +0 -139
  114. package/dist/commands/integration/version/build.js +0 -86
  115. package/dist/commands/integration/version/create.js +0 -45
  116. package/dist/commands/integration/version/get.js +0 -72
  117. package/dist/commands/integration/version/list.js +0 -45
  118. package/dist/commands/integration/version/publish.js +0 -79
  119. package/dist/commands/integration/version/test.js +0 -104
  120. package/dist/commands/job/get-step.js +0 -40
  121. package/dist/commands/job/get.js +0 -44
  122. package/dist/commands/mcp.js +0 -34
  123. package/dist/commands/session/create.js +0 -59
  124. package/dist/commands/session/events.js +0 -56
  125. package/dist/commands/session/get.js +0 -33
  126. package/dist/commands/session/interrupt.js +0 -33
  127. package/dist/commands/session/list.js +0 -59
  128. package/dist/commands/session/send.js +0 -54
  129. package/dist/commands/session/tasks.js +0 -45
  130. package/dist/commands/setup.js +0 -260
  131. package/dist/commands/trigger/activate.js +0 -41
  132. package/dist/commands/trigger/create.js +0 -197
  133. package/dist/commands/trigger/deactivate.js +0 -41
  134. package/dist/commands/trigger/get.js +0 -33
  135. package/dist/commands/trigger/list.js +0 -57
  136. package/dist/commands/trigger/sessions.js +0 -48
  137. package/dist/commands/trigger/update.js +0 -128
  138. package/dist/commands/version.js +0 -24
  139. package/dist/commands/workspace/agent/add.js +0 -114
  140. package/dist/commands/workspace/agent/list.js +0 -78
  141. package/dist/commands/workspace/agent/remove.js +0 -78
  142. package/dist/commands/workspace/clear.js +0 -45
  143. package/dist/commands/workspace/context/edit.js +0 -107
  144. package/dist/commands/workspace/context/get.js +0 -47
  145. package/dist/commands/workspace/context/list.js +0 -51
  146. package/dist/commands/workspace/context/publish.js +0 -42
  147. package/dist/commands/workspace/create.js +0 -51
  148. package/dist/commands/workspace/current.js +0 -63
  149. package/dist/commands/workspace/get.js +0 -39
  150. package/dist/commands/workspace/list.js +0 -70
  151. package/dist/commands/workspace/select.js +0 -184
  152. package/dist/components/AgentInstallPrompt.js +0 -97
  153. package/dist/components/SplashAnimation.js +0 -321
  154. package/dist/components/TaskView.js +0 -268
  155. package/dist/lib/agent-helpers.js +0 -306
  156. package/dist/lib/alternate-screen.js +0 -59
  157. package/dist/lib/api-client.js +0 -154
  158. package/dist/lib/api-types.js +0 -10
  159. package/dist/lib/auth.js +0 -284
  160. package/dist/lib/braille-canvas.js +0 -321
  161. package/dist/lib/colors.js +0 -46
  162. package/dist/lib/config-cache.js +0 -45
  163. package/dist/lib/config.js +0 -153
  164. package/dist/lib/did-you-mean.js +0 -144
  165. package/dist/lib/errors.js +0 -375
  166. package/dist/lib/event-filter.js +0 -91
  167. package/dist/lib/generated-types.js +0 -56
  168. package/dist/lib/git.js +0 -176
  169. package/dist/lib/gk.js +0 -91
  170. package/dist/lib/guild-config.js +0 -178
  171. package/dist/lib/iap.js +0 -117
  172. package/dist/lib/integration-helpers.js +0 -38
  173. package/dist/lib/loading-messages.js +0 -72
  174. package/dist/lib/logo.js +0 -141
  175. package/dist/lib/lottie-serverside.js +0 -181
  176. package/dist/lib/markdown.js +0 -38
  177. package/dist/lib/npmrc.js +0 -59
  178. package/dist/lib/output-mode.js +0 -54
  179. package/dist/lib/output.js +0 -622
  180. package/dist/lib/owner-helpers.js +0 -112
  181. package/dist/lib/polling.js +0 -76
  182. package/dist/lib/progress.js +0 -324
  183. package/dist/lib/session-events-fetch.js +0 -25
  184. package/dist/lib/session-events.js +0 -126
  185. package/dist/lib/session-polling.js +0 -166
  186. package/dist/lib/session-resume.js +0 -229
  187. package/dist/lib/spinners.js +0 -770
  188. package/dist/lib/splash.js +0 -42
  189. package/dist/lib/stdin.js +0 -91
  190. package/dist/lib/svg-to-braille.js +0 -76
  191. package/dist/lib/table.js +0 -59
  192. package/dist/lib/update-check.js +0 -65
  193. package/dist/lib/validate-input-schema.js +0 -208
  194. package/dist/lib/version-helpers.js +0 -137
  195. package/dist/lib/workspace-helpers.js +0 -49
  196. package/dist/mcp/resources.js +0 -67
  197. package/dist/mcp/server.js +0 -64
  198. package/dist/mcp/tools.js +0 -753
@@ -1,91 +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 { getAgentId, resolveAgentRef } from '../../lib/agent-helpers.js';
6
- import { handleAxiosError, ErrorCodes } from '../../lib/errors.js';
7
- import { createOutputWriter } from '../../lib/output.js';
8
- import { waitForValidation, waitForPublish } from '../../lib/version-helpers.js';
9
- export function createAgentPublishCommand() {
10
- const cmd = new Command('publish');
11
- cmd
12
- .description('Publish the latest draft version of an agent')
13
- .argument('[identifier]', 'Agent ID or full name (e.g., owner~agent-name)')
14
- .option('--wait', 'Wait for validation to complete before publishing')
15
- .action(async (agentIdArg, options) => {
16
- const output = createOutputWriter();
17
- try {
18
- const client = new GuildAPIClient();
19
- // Resolve agent ID
20
- const { agentId, config } = await getAgentId(agentIdArg);
21
- const resolvedId = await resolveAgentRef(client, agentId);
22
- // Fetch all versions
23
- const response = await client.get(`/agents/${resolvedId}/versions`);
24
- // Find latest DRAFT version
25
- const draftVersions = response.items
26
- .filter((v) => v.status === 'DRAFT')
27
- .sort((a, b) => new Date(b.created_at).getTime() - new Date(a.created_at).getTime());
28
- if (draftVersions.length === 0) {
29
- const agentName = config?.name || agentId;
30
- output.error(`No draft versions available for agent: ${agentName}`, 'Create a new version:\n guild agent save --message "your changes"');
31
- process.exit(1);
32
- }
33
- const versionToPublish = draftVersions[0];
34
- // Check if already published
35
- if (versionToPublish.status === 'PUBLISHED') {
36
- output.error(`Version ${versionToPublish.id} is already published`, 'To unpublish:\n guild agent unpublish');
37
- process.exit(1);
38
- }
39
- // Check validation status before attempting publish
40
- let currentVersion = versionToPublish;
41
- const validationStatus = currentVersion.validation_status;
42
- if (validationStatus === 'PENDING' || validationStatus === 'RUNNING') {
43
- if (options.wait) {
44
- currentVersion = await waitForValidation(currentVersion.id, output);
45
- }
46
- else {
47
- output.error('Cannot publish: validation is still in progress', `Validation status: ${validationStatus === 'PENDING' ? 'Waiting to start' : 'Running'}\n\nOptions:\n • Wait for validation: guild agent publish --wait\n • Check status: guild agent versions`);
48
- process.exit(1);
49
- }
50
- }
51
- else if (validationStatus === 'FAILED') {
52
- output.error('Cannot publish: validation failed', 'Fix the issues, then save a new version:\n guild agent save --message "Fix validation errors"');
53
- process.exit(1);
54
- }
55
- // Publish version
56
- currentVersion = await client.post(`/versions/${currentVersion.id}/publish`, {});
57
- if (options.wait && currentVersion.status !== 'PUBLISHED') {
58
- currentVersion = await waitForPublish(currentVersion.id, output);
59
- }
60
- const details = {
61
- agent: `${currentVersion.agent?.name || config?.name || agentId}${config ? '' : ` (${agentId})`}`,
62
- status: currentVersion.status === 'PUBLISHED'
63
- ? 'DRAFT → PUBLISHED'
64
- : 'DRAFT → PUBLISHING',
65
- };
66
- if (currentVersion.version_number) {
67
- details.version = currentVersion.version_number;
68
- }
69
- output.success(`Published version ${currentVersion.id}`, details);
70
- }
71
- catch (error) {
72
- const formattedError = handleAxiosError(error);
73
- if (formattedError.code === ErrorCodes.AUTH_REQUIRED) {
74
- output.error('Not authenticated. Run: guild auth login');
75
- process.exit(1);
76
- }
77
- if (formattedError.code === ErrorCodes.NOT_FOUND) {
78
- output.error('Agent not found', 'Run: guild agent list');
79
- process.exit(1);
80
- }
81
- if (formattedError.code === ErrorCodes.CONN_REFUSED) {
82
- output.error('Cannot connect to Guild servers');
83
- process.exit(1);
84
- }
85
- output.error(`Failed to publish: ${formattedError.details}`);
86
- process.exit(1);
87
- }
88
- });
89
- return cmd;
90
- }
91
- //# sourceMappingURL=publish.js.map
@@ -1,194 +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 { handleAxiosError, ErrorCodes } from '../../lib/errors.js';
6
- import { isMachineReadable } from '../../lib/output-mode.js';
7
- import { createOutputWriter } from '../../lib/output.js';
8
- import * as fs from 'fs/promises';
9
- import * as path from 'path';
10
- import { getAuthenticatedUrl } from '../../lib/auth.js';
11
- import { runGit, GitError, formatGitError } from '../../lib/git.js';
12
- export function createAgentPullCommand() {
13
- const cmd = new Command('pull');
14
- cmd.description('Pull remote changes into local agent directory').action(async () => {
15
- const cwd = process.cwd();
16
- const output = createOutputWriter();
17
- try {
18
- // Check for guild.json
19
- const guildJsonPath = path.join(cwd, 'guild.json');
20
- const guildJsonExists = await fs
21
- .access(guildJsonPath)
22
- .then(() => true)
23
- .catch(() => false);
24
- if (!guildJsonExists) {
25
- output.error('Not in an agent directory', 'guild.json not found in current directory.\n\nInitialize an agent directory:\n guild agent init --name my-agent\n\nOr clone an existing agent:\n guild agent clone <agent-id>');
26
- process.exit(1);
27
- }
28
- // Read guild.json
29
- const guildConfig = JSON.parse(await fs.readFile(guildJsonPath, 'utf-8'));
30
- // Fetch agent to get git_url
31
- const client = new GuildAPIClient();
32
- const agent = await client.get(`/agents/${guildConfig.agent_id}`);
33
- if (!agent.git_url) {
34
- output.error('Agent does not have a git repository', 'This agent may not have been initialized with git.');
35
- process.exit(1);
36
- }
37
- // Get authenticated URL
38
- const authenticatedUrl = await getAuthenticatedUrl(agent.git_url);
39
- if (!authenticatedUrl) {
40
- output.error('Not authenticated.', 'Run: guild auth login');
41
- process.exit(1);
42
- }
43
- // Get current branch name
44
- const { stdout: branchName } = await runGit(['rev-parse', '--abbrev-ref', 'HEAD'], { cwd });
45
- const currentBranch = branchName.trim();
46
- // Pull remote changes with rebase
47
- let gitPulledNewCommits = false;
48
- try {
49
- const { stdout: pullOutput } = await runGit(['pull', '--rebase', authenticatedUrl, currentBranch], { cwd });
50
- // Update remote-tracking ref so git status stays consistent
51
- try {
52
- await runGit(['update-ref', `refs/remotes/origin/${currentBranch}`, 'FETCH_HEAD'], { cwd });
53
- }
54
- catch {
55
- // Non-fatal: git status will be stale but pull still succeeded
56
- }
57
- if (pullOutput.includes('Already up to date') ||
58
- pullOutput.includes('Current branch') // "Current branch X is up to date."
59
- ) {
60
- // Don't report yet — version check below may have more to say
61
- }
62
- else {
63
- gitPulledNewCommits = true;
64
- // Count commits pulled
65
- const updateMatch = pullOutput.match(/Updating\s+[a-f0-9]+\.\.[a-f0-9]+/);
66
- const fastForward = pullOutput.includes('Fast-forward');
67
- let message = 'Pulled remote changes';
68
- if (fastForward || updateMatch) {
69
- const filesMatch = pullOutput.match(/(\d+)\s+files?\s+changed/);
70
- if (filesMatch) {
71
- message = `Pulled remote changes (${filesMatch[1]} files changed)`;
72
- }
73
- }
74
- output.progress(`✓ ${message}`);
75
- }
76
- }
77
- catch (pullError) {
78
- const errMessage = pullError instanceof GitError
79
- ? pullError.stderr || pullError.stdout
80
- : String(pullError);
81
- // Check for rebase conflicts
82
- if (errMessage.includes('CONFLICT') || errMessage.includes('could not apply')) {
83
- output.error('Merge conflict detected', 'Your changes conflict with remote changes.\n\nTo resolve:\n 1. Fix conflicts in the listed files\n 2. git add <resolved-files>\n 3. git rebase --continue\n\nOr abort the rebase:\n git rebase --abort');
84
- process.exit(1);
85
- }
86
- // No upstream branch — nothing to pull
87
- if (errMessage.includes('no tracking information') ||
88
- errMessage.includes("couldn't find remote ref")) {
89
- output.progress('✓ Already up to date (no remote branch yet)');
90
- if (isMachineReadable()) {
91
- output.data({
92
- success: true,
93
- message: 'Already up to date (no remote branch yet)',
94
- });
95
- }
96
- return;
97
- }
98
- // Unknown git error
99
- throw pullError;
100
- }
101
- // Version check: compare local state against backend
102
- const versions = await client.get(`/agents/${guildConfig.agent_id}/versions?limit=1`);
103
- if (versions.items.length > 0) {
104
- const latest = versions.items[0];
105
- const { stdout: headSha } = await runGit(['rev-parse', 'HEAD'], { cwd });
106
- const localHead = headSha.trim();
107
- if (latest.sha && latest.sha === localHead) {
108
- // Truly up to date — git pull + version match
109
- if (!gitPulledNewCommits) {
110
- output.progress('✓ Already up to date');
111
- }
112
- if (isMachineReadable()) {
113
- output.data({
114
- success: true,
115
- message: gitPulledNewCommits
116
- ? 'Pulled remote changes'
117
- : 'Already up to date',
118
- });
119
- }
120
- }
121
- else if (latest.sha && latest.sha !== localHead) {
122
- // SHA mismatch — warn user
123
- output.progress(`⚠ Remote has a newer version (${latest.sha.slice(0, 7)}) not on this branch`);
124
- output.progress(' Try: git fetch origin && git log --oneline origin/main');
125
- if (isMachineReadable()) {
126
- output.data({
127
- success: true,
128
- message: 'SHA mismatch with latest version',
129
- latest_sha: latest.sha,
130
- local_sha: localHead,
131
- });
132
- }
133
- }
134
- else {
135
- // Ephemeral version — download from API
136
- output.progress('Remote has unpublished changes from the web editor');
137
- // Check for local uncommitted changes
138
- const { stdout: status } = await runGit(['status', '--porcelain'], { cwd });
139
- if (status.trim()) {
140
- output.error('Cannot download remote changes — you have uncommitted local changes', 'Commit or stash your changes first, then run guild agent pull again.');
141
- process.exit(1);
142
- }
143
- const files = await client.get(`/agents/${guildConfig.agent_id}/code?include_unpublished=1`);
144
- for (const file of files) {
145
- const filePath = path.join(cwd, file.path);
146
- await fs.mkdir(path.dirname(filePath), { recursive: true });
147
- await fs.writeFile(filePath, file.content, 'utf-8');
148
- }
149
- output.progress(`✓ Downloaded ${files.length} files from latest draft version`);
150
- if (isMachineReadable()) {
151
- output.data({
152
- success: true,
153
- message: `Downloaded ${files.length} files from draft version`,
154
- files_updated: files.length,
155
- });
156
- }
157
- }
158
- }
159
- else {
160
- // No versions exist yet — just report git pull result
161
- if (!gitPulledNewCommits) {
162
- output.progress('✓ Already up to date');
163
- }
164
- if (isMachineReadable()) {
165
- output.data({
166
- success: true,
167
- message: gitPulledNewCommits
168
- ? 'Pulled remote changes'
169
- : 'Already up to date',
170
- });
171
- }
172
- }
173
- }
174
- catch (error) {
175
- if (error instanceof GitError) {
176
- output.error('Git operation failed', formatGitError(error));
177
- process.exit(1);
178
- }
179
- const formattedError = handleAxiosError(error);
180
- if (formattedError.code === ErrorCodes.AUTH_REQUIRED) {
181
- output.error('Not authenticated. Please log in first.', 'Run: guild auth login');
182
- process.exit(1);
183
- }
184
- if (formattedError.code === ErrorCodes.NOT_FOUND) {
185
- output.error('Agent not found', 'The agent may have been deleted.\nCheck your guild.json agent_id.');
186
- process.exit(1);
187
- }
188
- output.error(`Failed to pull: ${formattedError.details}`);
189
- process.exit(1);
190
- }
191
- });
192
- return cmd;
193
- }
194
- //# sourceMappingURL=pull.js.map
@@ -1,56 +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 { getGuildcoreUrl } from '../../lib/config.js';
6
- import { handleAxiosError, ErrorCodes } from '../../lib/errors.js';
7
- import { getAgentId, resolveAgentRef } from '../../lib/agent-helpers.js';
8
- import { createOutputWriter } from '../../lib/output.js';
9
- export function createAgentRevalidateCommand() {
10
- const cmd = new Command('revalidate');
11
- cmd
12
- .description('Revalidate an agent version')
13
- .argument('[identifier]', 'Agent ID or full name (e.g., owner~agent-name)')
14
- .argument('[version-id]', 'ID of the version to revalidate (uses latest if omitted)')
15
- .action(async (agentIdArg, versionIdArg) => {
16
- const output = createOutputWriter();
17
- // Get agent ID from argument or guild.json
18
- const { agentId } = await getAgentId(agentIdArg);
19
- const baseUrl = getGuildcoreUrl();
20
- const client = new GuildAPIClient({ baseUrl });
21
- try {
22
- const resolvedId = await resolveAgentRef(client, agentId);
23
- let versionId = versionIdArg;
24
- // If no version ID provided, get the latest version
25
- if (!versionId) {
26
- const versions = await client.get(`/agents/${resolvedId}/versions?limit=1&offset=0`);
27
- if (!versions.items || versions.items.length === 0) {
28
- output.error('No versions found for this agent.', `The agent may still be initializing. Check status:\n guild agent get ${agentId}`);
29
- process.exit(1);
30
- }
31
- versionId = versions.items[0].id;
32
- }
33
- // Revalidate the version
34
- const result = await client.post(`/agents/${resolvedId}/versions/${versionId}/revalidate`);
35
- output.data(result);
36
- }
37
- catch (error) {
38
- const formattedError = handleAxiosError(error);
39
- if (formattedError.code === ErrorCodes.AUTH_REQUIRED) {
40
- output.error('Not authenticated.', 'Please authenticate first:\n guild auth login');
41
- }
42
- else if (formattedError.code === ErrorCodes.CONN_REFUSED) {
43
- output.error('Cannot connect to Guild servers');
44
- }
45
- else if (formattedError.code === ErrorCodes.NOT_FOUND) {
46
- output.error('Agent or version not found', `Check the agent and version IDs:\n guild agent list\n guild agent versions ${agentId}`);
47
- }
48
- else {
49
- output.error(`Failed to revalidate version: ${formattedError.details}`);
50
- }
51
- process.exit(1);
52
- }
53
- });
54
- return cmd;
55
- }
56
- //# sourceMappingURL=revalidate.js.map