@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,87 +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 { getAgentId, resolveAgentRef } from '../../lib/agent-helpers.js';
7
- import { createOutputWriter } from '../../lib/output.js';
8
- import * as fs from 'fs/promises';
9
- import * as path from 'path';
10
- export function createAgentCodeCommand() {
11
- const cmd = new Command('code');
12
- cmd
13
- .description('Fetch the latest code for an agent')
14
- .argument('[identifier]', 'Agent ID or full name (e.g., owner~agent-name)')
15
- .option('--draft', 'Include draft versions (default: only published)', false)
16
- .option('--output <directory>', 'Write files to directory instead of printing JSON')
17
- .action(async (agentIdArg, options) => {
18
- const output = createOutputWriter();
19
- // Get agent ID from argument or guild.json
20
- const { agentId } = await getAgentId(agentIdArg);
21
- const client = new GuildAPIClient();
22
- const includeDraft = options.draft ? '1' : '0';
23
- let files;
24
- try {
25
- const resolvedId = await resolveAgentRef(client, agentId);
26
- files = await client.get(`/agents/${resolvedId}/code?include_unpublished=${includeDraft}`);
27
- }
28
- catch (error) {
29
- const formattedError = handleAxiosError(error);
30
- if (formattedError.code === ErrorCodes.AUTH_REQUIRED) {
31
- output.error('Not logged in.', 'Please authenticate first:\n guild auth login');
32
- }
33
- else if (formattedError.code === ErrorCodes.CONN_REFUSED) {
34
- output.error('Cannot connect to Guild servers');
35
- }
36
- else if (formattedError.code === ErrorCodes.NOT_FOUND) {
37
- output.error(`Agent not found: ${agentId}`, 'Check the agent ID:\n guild agent list');
38
- }
39
- else {
40
- output.error(`Failed to fetch agent code: ${formattedError.details}`);
41
- }
42
- process.exit(1);
43
- }
44
- if (files.length === 0) {
45
- if (options.draft) {
46
- output.error('No code found for this agent.', 'This agent has no versions saved yet.\n\nTo save code: cd <agent-directory> && guild agent save --message "..."');
47
- }
48
- else {
49
- output.error('No code found for this agent.', 'This agent has no published versions.\n\nTo see draft versions: guild agent code <agent-id> --draft\nTo publish a version: cd <agent-directory> && guild agent save --message "..." --publish');
50
- }
51
- process.exit(1);
52
- }
53
- // If output directory specified, write files
54
- if (options.output) {
55
- try {
56
- await fs.mkdir(options.output, { recursive: true });
57
- for (const file of files) {
58
- const filePath = path.join(options.output, file.path);
59
- const fileDir = path.dirname(filePath);
60
- // Create subdirectories if needed
61
- await fs.mkdir(fileDir, { recursive: true });
62
- // Write file
63
- await fs.writeFile(filePath, file.content, 'utf-8');
64
- }
65
- output.data({
66
- success: 'Code written to directory',
67
- directory: options.output,
68
- files_written: files.length,
69
- files: files.map((f) => f.path),
70
- });
71
- process.exit(0);
72
- }
73
- catch (error) {
74
- const err = error;
75
- output.error(`Could not write files to directory: ${options.output}`, `Error: ${err.message || 'Unknown error'}\n\nCheck that:\n • Directory is writable\n • You have permission to create files\n • Disk space is available`);
76
- process.exit(1);
77
- }
78
- }
79
- else {
80
- // Just print JSON
81
- output.data({ files });
82
- process.exit(0);
83
- }
84
- });
85
- return cmd;
86
- }
87
- //# sourceMappingURL=code.js.map
@@ -1,220 +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, debug } from '../../lib/errors.js';
7
- import * as fs from 'fs/promises';
8
- import * as readline from 'readline';
9
- import { runGit, GitError, formatGitError } from '../../lib/git.js';
10
- import { createOutputWriter } from '../../lib/output.js';
11
- import { resolveOwnerId } from '../../lib/owner-helpers.js';
12
- import { isInteractive } from '../../lib/stdin.js';
13
- async function promptForName() {
14
- const rl = readline.createInterface({
15
- input: process.stdin,
16
- output: process.stdout,
17
- });
18
- return new Promise((resolve) => {
19
- rl.question('Name for forked agent: ', (answer) => {
20
- rl.close();
21
- resolve(answer.trim());
22
- });
23
- });
24
- }
25
- async function promptForDescription(defaultDescription) {
26
- const rl = readline.createInterface({
27
- input: process.stdin,
28
- output: process.stdout,
29
- });
30
- return new Promise((resolve) => {
31
- rl.question(`Description (default: "${defaultDescription}"): `, (answer) => {
32
- rl.close();
33
- resolve(answer.trim() || defaultDescription);
34
- });
35
- });
36
- }
37
- async function isDirectoryEmpty(dirPath) {
38
- try {
39
- const files = await fs.readdir(dirPath);
40
- return files.length === 0;
41
- }
42
- catch {
43
- // Directory doesn't exist, that's fine
44
- return true;
45
- }
46
- }
47
- export function createAgentForkCommand() {
48
- const cmd = new Command('fork');
49
- cmd
50
- .description('Fork an existing agent version to create a new agent')
51
- .argument('[identifier]', 'Agent ID, full name, or agent:version (e.g., owner~agent-name:version_xyz)')
52
- .option('--name <name>', 'Name for the forked agent')
53
- .option('--description <desc>', 'Description for the forked agent')
54
- .option('--directory <path>', 'Target directory for clone')
55
- .option('--owner <owner>', 'Owner (name or ID)')
56
- .action(async (identifierArg, options) => {
57
- const output = createOutputWriter();
58
- try {
59
- // Resolve agent ID and optional version ID
60
- let sourceAgentId;
61
- let sourceVersionId;
62
- if (identifierArg && identifierArg.includes(':')) {
63
- // Explicit agent:version format
64
- const colonIndex = identifierArg.lastIndexOf(':');
65
- const agentPart = identifierArg.substring(0, colonIndex);
66
- sourceVersionId = identifierArg.substring(colonIndex + 1);
67
- if (!agentPart || !sourceVersionId) {
68
- output.error('Error: Invalid argument format', 'Expected: [identifier] or [identifier]:[version-id]\nExample: guild agent fork owner~agent-name:version_xyz\n\nTo find versions:\n guild agent versions <agent-id>');
69
- process.exit(1);
70
- }
71
- const resolved = await getAgentId(agentPart);
72
- sourceAgentId = resolved.agentId;
73
- }
74
- else {
75
- // No version specified — resolve agent, then find latest published
76
- const resolved = await getAgentId(identifierArg);
77
- sourceAgentId = resolved.agentId;
78
- }
79
- // Auto-resolve version if not specified
80
- const client = new GuildAPIClient();
81
- sourceAgentId = await resolveAgentRef(client, sourceAgentId);
82
- if (!sourceVersionId) {
83
- const versions = await client.get(`/agents/${sourceAgentId}/versions`);
84
- const published = versions.items
85
- .filter((v) => v.status === 'PUBLISHED')
86
- .sort((a, b) => new Date(b.created_at).getTime() - new Date(a.created_at).getTime());
87
- if (published.length === 0) {
88
- output.error('No published versions found', `Agent ${sourceAgentId} has no published versions to fork.\n\nTo see all versions:\n guild agent versions ${sourceAgentId}`);
89
- process.exit(1);
90
- }
91
- sourceVersionId = published[0].id;
92
- }
93
- // Determine name (validate before API call for better UX)
94
- let agentName = options.name;
95
- if (!agentName) {
96
- if (isInteractive()) {
97
- agentName = await promptForName();
98
- if (!agentName) {
99
- output.error('Error: Agent name is required');
100
- process.exit(1);
101
- }
102
- }
103
- else {
104
- output.error('Error: Agent name required in non-interactive mode', `Provide a name:\n guild agent fork ${identifierArg || '<identifier>'} --name my-forked-agent\n\nOr run interactively to be prompted.`);
105
- process.exit(1);
106
- }
107
- }
108
- // Validate name format (before API call)
109
- if (!/^[a-z0-9_-]{5,100}$/.test(agentName)) {
110
- output.error('Error: Invalid agent name', 'Name must:\n • Be between 5 and 100 characters\n • Only contain lowercase letters, numbers, hyphens, and underscores\n\nExamples: my-agent, weather_bot, agent-007');
111
- process.exit(1);
112
- }
113
- // Determine directory (default to agent name)
114
- const targetDir = options.directory || `./${agentName}`;
115
- // Check if directory exists and is empty (before API call)
116
- const dirExists = await fs
117
- .access(targetDir)
118
- .then(() => true)
119
- .catch(() => false);
120
- if (dirExists) {
121
- const isEmpty = await isDirectoryEmpty(targetDir);
122
- if (!isEmpty) {
123
- output.error(`Error: Directory '${targetDir}' already exists and is not empty`, `Choose a different directory:\n guild agent fork ${identifierArg || '<identifier>'} --directory ./different-path\n\nOr remove the existing directory first.`);
124
- process.exit(1);
125
- }
126
- }
127
- // Fetch source version from API (after local validations)
128
- const sourceVersion = await client.get(`/agents/${sourceAgentId}/versions/${sourceVersionId}`);
129
- output.progress(`✓ Fetched source version from '${sourceVersion.agent.name}' (${sourceVersionId.substring(0, 12)})`);
130
- // Determine description
131
- let description = options.description;
132
- if (!description) {
133
- if (isInteractive()) {
134
- description = await promptForDescription(sourceVersion.agent.description);
135
- }
136
- else {
137
- // Use source description in non-interactive mode
138
- description = sourceVersion.agent.description;
139
- }
140
- }
141
- // Resolve owner
142
- const owner = await resolveOwnerId({
143
- ownerFlag: options.owner,
144
- client,
145
- interactive: isInteractive(),
146
- requireExplicitOwner: true,
147
- });
148
- // Create forked agent
149
- output.progress(`✓ Forking agent '${agentName}'...`);
150
- const newAgent = await client.post('/agents', {
151
- name: agentName,
152
- description,
153
- forked_from_version: sourceVersionId,
154
- owner_id: owner.id,
155
- });
156
- output.progress(`✓ Agent created: ${newAgent.name} (${newAgent.id})`);
157
- // Poll until repository is ready
158
- output.progress('✓ Waiting for repository initialization...');
159
- let attempts = 0;
160
- const maxAttempts = 60; // 2 minutes
161
- let agent = newAgent;
162
- while (agent.status !== 'READY' &&
163
- agent.status !== 'FAILED' &&
164
- attempts < maxAttempts) {
165
- await new Promise((resolve) => setTimeout(resolve, 2000));
166
- agent = await client.get(`/agents/${newAgent.id}`);
167
- attempts++;
168
- debug(`Agent status: ${agent.status} (attempt ${attempts}/${maxAttempts})`);
169
- }
170
- if (agent.status === 'FAILED') {
171
- output.error('Error: Repository initialization failed', `The agent was created but the repository could not be initialized.\nCheck the agent status:\n guild agent get ${newAgent.id}`);
172
- process.exit(1);
173
- }
174
- if (agent.status !== 'READY') {
175
- output.error('Error: Timed out waiting for repository initialization', `The agent was created but the repository is not ready yet.\nCheck the status with:\n guild agent get ${newAgent.id}\n\nOnce ready, clone manually:\n guild agent clone ${newAgent.id} --directory ${targetDir}`);
176
- process.exit(1);
177
- }
178
- output.progress('✓ Repository ready!');
179
- if (!agent.git_url) {
180
- output.error('Error: Agent repository URL not available', `The agent was created but git_url is missing.\nCheck the agent details:\n guild agent get ${newAgent.id}`);
181
- process.exit(1);
182
- }
183
- // Clone the new repository
184
- await runGit(['clone', agent.git_url, targetDir]);
185
- output.progress(`✓ Cloned repository to ${targetDir}`);
186
- // Display next steps
187
- output.progress('');
188
- output.progress('Next steps:');
189
- output.progress(` 1. cd ${targetDir}`);
190
- output.progress(' 2. Make your changes to the code');
191
- output.progress(` 3. Run 'guild agent save --message "your changes"'`);
192
- output.progress(` 4. Run 'guild agent test' to test your changes`);
193
- output.progress('');
194
- output.progress(`Tip: Using a coding agent? Run 'guild setup' to install skills for Claude Code, Codex, etc.`);
195
- }
196
- catch (error) {
197
- if (error instanceof GitError) {
198
- output.error('Error: Failed to clone repository', `${formatGitError(error)}\n\nThe agent was created successfully, but cloning failed.\nTry cloning manually:\n guild agent clone <agent-id>`);
199
- process.exit(1);
200
- }
201
- const formattedError = handleAxiosError(error);
202
- if (formattedError.code === ErrorCodes.AUTH_REQUIRED) {
203
- output.error('Not authenticated. Please log in first.', 'Run: guild auth login');
204
- process.exit(1);
205
- }
206
- if (formattedError.code === ErrorCodes.NOT_FOUND) {
207
- output.error(`Error: Agent or version not found: ${identifierArg || '<identifier>'}`, `Check available versions:\n guild agent versions <agent-id>`);
208
- process.exit(1);
209
- }
210
- if (formattedError.code === ErrorCodes.CONN_REFUSED) {
211
- output.error('Cannot connect to Guild servers');
212
- process.exit(1);
213
- }
214
- output.error(`Failed to fork agent: ${formattedError.details}`);
215
- process.exit(1);
216
- }
217
- });
218
- return cmd;
219
- }
220
- //# sourceMappingURL=fork.js.map
@@ -1,37 +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 { getAgentId, resolveAgentRef } from '../../lib/agent-helpers.js';
7
- import { handleAxiosError } from '../../lib/errors.js';
8
- import { createOutputWriter } from '../../lib/output.js';
9
- export function createAgentGetCommand() {
10
- const cmd = new Command('get');
11
- cmd
12
- .description('Get agent details')
13
- .argument('[identifier]', 'Agent ID or full name (e.g., owner~agent-name)')
14
- .action(async (idArg) => {
15
- const output = createOutputWriter();
16
- try {
17
- const token = await getAuthToken();
18
- if (!token) {
19
- output.error('Not authenticated. Please log in first.', 'Run: guild auth login');
20
- process.exit(1);
21
- }
22
- // Get agent ID from argument or guild.json
23
- const { agentId } = await getAgentId(idArg);
24
- const client = new GuildAPIClient();
25
- const resolvedId = await resolveAgentRef(client, agentId);
26
- const response = await client.get(`/agents/${resolvedId}`);
27
- output.data(response);
28
- }
29
- catch (error) {
30
- const formattedError = handleAxiosError(error);
31
- output.error(`Failed to get agent: ${formattedError.details}`);
32
- process.exit(1);
33
- }
34
- });
35
- return cmd;
36
- }
37
- //# sourceMappingURL=get.js.map
@@ -1,107 +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 { createOutputWriter } from '../../lib/output.js';
7
- import { handleAxiosError } from '../../lib/errors.js';
8
- import { loadLocalConfig } from '../../lib/guild-config.js';
9
- export function createAgentGrepCommand() {
10
- const cmd = new Command('grep');
11
- cmd
12
- .description('Search agent files for a matching pattern')
13
- .argument('[pattern]', 'JavaScript regex for which to search: all lines matching this pattern will be printed')
14
- .option('--all', 'Search all agents (default: current agent only)')
15
- .option('--published', 'Only search published agents (requires --all)')
16
- .action(grep);
17
- return cmd;
18
- }
19
- const BATCH_SIZE = 20;
20
- async function grep(patternArg, options) {
21
- const output = createOutputWriter();
22
- try {
23
- const token = await getAuthToken();
24
- if (!token) {
25
- output.error('Not authenticated. Please log in first.', 'Run: guild auth login');
26
- process.exit(1);
27
- }
28
- if (patternArg === undefined) {
29
- output.error('Please specify a pattern to match');
30
- process.exit(1);
31
- }
32
- let patternRE;
33
- try {
34
- patternRE = new RegExp(patternArg);
35
- }
36
- catch {
37
- output.error(`Invalid regex pattern: ${patternArg}`);
38
- process.exit(1);
39
- }
40
- const client = new GuildAPIClient();
41
- if (options.all) {
42
- await grepAllAgents(client, patternRE, options.published, output);
43
- }
44
- else {
45
- await grepCurrentAgent(client, patternRE, output);
46
- }
47
- }
48
- catch (error) {
49
- const formattedError = handleAxiosError(error);
50
- output.error(`Failed to search agents: ${formattedError.details}`);
51
- process.exit(1);
52
- }
53
- }
54
- function searchFiles(files, patternRE, prefix, output) {
55
- for (const { path, content } of files) {
56
- content.split('\n').forEach((line, lineNumber) => {
57
- if (patternRE.test(line)) {
58
- output.progress(`${prefix}${path}:${lineNumber + 1}:${line}`);
59
- }
60
- });
61
- }
62
- }
63
- async function grepCurrentAgent(client, patternRE, output) {
64
- const config = await loadLocalConfig();
65
- if (!config?.agent_id) {
66
- output.error('Not in an agent directory.', 'Either run from an agent directory with guild.json:\n cd <agent-directory>\n guild agent grep <pattern>\n\nOr search all agents:\n guild agent grep <pattern> --all');
67
- process.exit(1);
68
- }
69
- let files = [];
70
- try {
71
- files = await client.get(`/agents/${config.agent_id}/code`);
72
- }
73
- catch (ex) {
74
- const formattedError = handleAxiosError(ex);
75
- output.error(`Failed to fetch agent code: ${formattedError.details}`);
76
- process.exit(1);
77
- }
78
- searchFiles(files, patternRE, '', output);
79
- }
80
- async function grepAllAgents(client, patternRE, publishedOnly, output) {
81
- let offset = 0;
82
- while (true) {
83
- const params = new URLSearchParams();
84
- params.append('offset', `${offset}`);
85
- params.append('limit', `${BATCH_SIZE}`);
86
- if (publishedOnly) {
87
- params.append('published_only', 'true');
88
- }
89
- const response = await client.get(`/agents?${params.toString()}`);
90
- await Promise.all(response.items.map(async (agent) => {
91
- let files = [];
92
- try {
93
- files = await client.get(`/agents/${agent.id}/code`);
94
- }
95
- catch (ex) {
96
- const formattedError = handleAxiosError(ex);
97
- output.error(`${agent.owner?.name}~${agent.name}: ${formattedError.details}`);
98
- return;
99
- }
100
- searchFiles(files, patternRE, `${agent.owner?.name}~${agent.name}/`, output);
101
- }));
102
- offset += response.pagination.limit;
103
- if (!response.pagination.has_more)
104
- break;
105
- }
106
- }
107
- //# sourceMappingURL=grep.js.map