@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,59 +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 { getWorkspaceId } from '../../lib/guild-config.js';
7
- import { handleAxiosError } from '../../lib/errors.js';
8
- import { isMachineReadable } from '../../lib/output-mode.js';
9
- import { createOutputWriter, formatSessionTable } from '../../lib/output.js';
10
- import { DEFAULT_PAGE_LIMIT } from '../../lib/api-types.js';
11
- export function createSessionListCommand() {
12
- const cmd = new Command('list');
13
- cmd
14
- .description('List sessions in a workspace')
15
- .option('--workspace <id>', 'Workspace ID or name (e.g., owner~workspace-name)')
16
- .option('--type <type>', 'Filter by session type: chat, webhook, time, agent_test')
17
- .option('--limit <number>', `Number of results to return (default: ${DEFAULT_PAGE_LIMIT})`, String(DEFAULT_PAGE_LIMIT))
18
- .option('--offset <number>', 'Offset for pagination (default: 0)', '0')
19
- .action(async (options) => {
20
- const output = createOutputWriter();
21
- try {
22
- const token = await getAuthToken();
23
- if (!token) {
24
- output.error('Not authenticated. Run: guild auth login');
25
- process.exit(1);
26
- }
27
- let workspaceId = options.workspace;
28
- if (!workspaceId) {
29
- const resolved = await getWorkspaceId();
30
- if (!resolved) {
31
- output.error('No workspace specified. Run: guild workspace select');
32
- process.exit(1);
33
- }
34
- workspaceId = resolved.workspaceId;
35
- }
36
- const client = new GuildAPIClient();
37
- const params = new URLSearchParams();
38
- params.append('limit', options.limit);
39
- params.append('offset', options.offset);
40
- if (options.type) {
41
- params.append('types', options.type.toLowerCase());
42
- }
43
- const response = await client.get(`/workspaces/${workspaceId}/sessions?${params.toString()}`);
44
- if (isMachineReadable()) {
45
- console.log(JSON.stringify(response, null, 2));
46
- }
47
- else {
48
- formatSessionTable(response.items, response.pagination);
49
- }
50
- }
51
- catch (error) {
52
- const formattedError = handleAxiosError(error);
53
- output.error(`Failed to list sessions: ${formattedError.details}`);
54
- process.exit(1);
55
- }
56
- });
57
- return cmd;
58
- }
59
- //# sourceMappingURL=list.js.map
@@ -1,54 +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 createSessionSendCommand() {
9
- const cmd = new Command('send');
10
- cmd
11
- .description('Send a user message to a session')
12
- .argument('<session-id>', 'Session ID')
13
- .option('--message <text>', 'Text message content')
14
- .option('--json <json>', 'JSON content object (sets mode to json)')
15
- .action(async (sessionId, options) => {
16
- const output = createOutputWriter();
17
- try {
18
- const token = await getAuthToken();
19
- if (!token) {
20
- output.error('Not authenticated. Run: guild auth login');
21
- process.exit(1);
22
- }
23
- if (!options.message && !options.json) {
24
- output.error('Either --message or --json is required');
25
- process.exit(1);
26
- }
27
- const client = new GuildAPIClient();
28
- let body;
29
- if (options.json) {
30
- let parsed;
31
- try {
32
- parsed = JSON.parse(options.json);
33
- }
34
- catch {
35
- output.error('--json value must be valid JSON');
36
- process.exit(1);
37
- }
38
- body = { content: parsed, mode: 'json' };
39
- }
40
- else {
41
- body = { content: options.message, mode: 'text' };
42
- }
43
- const response = await client.post(`/sessions/${sessionId}/events`, body);
44
- output.data(response);
45
- }
46
- catch (error) {
47
- const formattedError = handleAxiosError(error);
48
- output.error(`Failed to send message: ${formattedError.details}`);
49
- process.exit(1);
50
- }
51
- });
52
- return cmd;
53
- }
54
- //# sourceMappingURL=send.js.map
@@ -1,45 +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 { isMachineReadable } from '../../lib/output-mode.js';
8
- import { createOutputWriter, formatTaskTable } from '../../lib/output.js';
9
- import { DEFAULT_PAGE_LIMIT_LARGE } from '../../lib/api-types.js';
10
- export function createSessionTasksCommand() {
11
- const cmd = new Command('tasks');
12
- cmd
13
- .description('List tasks in a session')
14
- .argument('<session-id>', 'Session ID')
15
- .option('--limit <number>', `Number of results to return (default: ${DEFAULT_PAGE_LIMIT_LARGE})`, String(DEFAULT_PAGE_LIMIT_LARGE))
16
- .option('--offset <number>', 'Offset for pagination (default: 0)', '0')
17
- .action(async (sessionId, options) => {
18
- const output = createOutputWriter();
19
- try {
20
- const token = await getAuthToken();
21
- if (!token) {
22
- output.error('Not authenticated. Run: guild auth login');
23
- process.exit(1);
24
- }
25
- const client = new GuildAPIClient();
26
- const params = new URLSearchParams();
27
- params.append('limit', options.limit);
28
- params.append('offset', options.offset);
29
- const response = await client.get(`/sessions/${sessionId}/tasks?${params.toString()}`);
30
- if (isMachineReadable()) {
31
- console.log(JSON.stringify(response, null, 2));
32
- }
33
- else {
34
- formatTaskTable(response.items, response.pagination);
35
- }
36
- }
37
- catch (error) {
38
- const formattedError = handleAxiosError(error);
39
- output.error(`Failed to get session tasks: ${formattedError.details}`);
40
- process.exit(1);
41
- }
42
- });
43
- return cmd;
44
- }
45
- //# sourceMappingURL=tasks.js.map
@@ -1,260 +0,0 @@
1
- // Copyright 2026 Guild.ai
2
- // SPDX-License-Identifier: Apache-2.0
3
- import { Command } from 'commander';
4
- import { fileURLToPath } from 'url';
5
- import path from 'path';
6
- import fs from 'fs/promises';
7
- import { createOutputWriter } from '../lib/output.js';
8
- // Resolve the CLI package root from the compiled JS location
9
- // dist/commands/setup.js -> dist/ -> cli/
10
- const __filename = fileURLToPath(import.meta.url);
11
- const __dirname = path.dirname(__filename);
12
- const packageRoot = path.resolve(__dirname, '..', '..');
13
- const docsDir = path.join(packageRoot, 'docs');
14
- const CLAUDE_SKILL_FILES = [
15
- {
16
- src: path.join(docsDir, 'skills', 'agent-dev.md'),
17
- dest: path.join('.claude', 'skills', 'agent-dev', 'skill.md'),
18
- label: '.claude/skills/agent-dev/skill.md',
19
- },
20
- {
21
- src: path.join(docsDir, 'CLI_WORKFLOW.md'),
22
- dest: path.join('.claude', 'skills', 'guild-cli-workflow', 'skill.md'),
23
- label: '.claude/skills/guild-cli-workflow/skill.md',
24
- },
25
- {
26
- src: path.join(docsDir, 'skills', 'integrations.md'),
27
- dest: path.join('.claude', 'skills', 'integrations', 'skill.md'),
28
- label: '.claude/skills/integrations/skill.md',
29
- },
30
- ];
31
- const CODEX_SKILL_FILES = [
32
- {
33
- src: path.join(docsDir, 'skills', 'codex-agent-dev.md'),
34
- dest: path.join('.agents', 'skills', 'guild-agent-dev', 'SKILL.md'),
35
- label: '.agents/skills/guild-agent-dev/SKILL.md',
36
- },
37
- ];
38
- const CLAUDE_MD_TEMPLATE = `# CLAUDE.md
39
-
40
- ## Agent Development
41
-
42
- This project uses Guild for agent development. Development skills and patterns are installed in \`.claude/skills/\`.
43
-
44
- ### Quick Start
45
-
46
- \`\`\`bash
47
- guild agent init --name my-agent --template LLM
48
- guild agent save --message "Initial version" --wait --publish
49
- \`\`\`
50
-
51
- See \`.claude/skills/agent-dev/skill.md\` for SDK reference, patterns, and anti-hallucination guide.
52
- `;
53
- const AGENTS_MD_TEMPLATE = `# AGENTS.md
54
-
55
- ## Guild Agent Development
56
-
57
- This project uses Guild for agent development. Codex instructions are installed in \`.agents/skills/guild-agent-dev/SKILL.md\`.
58
-
59
- ### Quick Start
60
-
61
- \`\`\`bash
62
- guild agent init --name my-agent --template LLM
63
- guild agent test --ephemeral
64
- guild agent save -A --message "Initial version"
65
- \`\`\`
66
-
67
- Use \`guild doctor\` to check authentication, server connectivity, workspace selection, and git setup.
68
- `;
69
- async function fileExists(filePath) {
70
- try {
71
- await fs.access(filePath);
72
- return true;
73
- }
74
- catch {
75
- return false;
76
- }
77
- }
78
- const MCP_SERVER_CONFIG = {
79
- command: 'guild',
80
- args: ['mcp'],
81
- };
82
- async function setupMcp(targetDir, options) {
83
- const output = createOutputWriter();
84
- const mcpPath = path.join(targetDir, '.mcp.json');
85
- let existing = {};
86
- const exists = await fileExists(mcpPath);
87
- if (exists) {
88
- const content = await fs.readFile(mcpPath, 'utf-8');
89
- existing = JSON.parse(content);
90
- if (existing.mcpServers && 'guild' in existing.mcpServers && !options.force) {
91
- output.progress('.mcp.json already has Guild server (use --force to overwrite)');
92
- return 'skipped';
93
- }
94
- }
95
- const updated = {
96
- ...existing,
97
- mcpServers: {
98
- ...(existing.mcpServers ?? {}),
99
- guild: MCP_SERVER_CONFIG,
100
- },
101
- };
102
- await fs.writeFile(mcpPath, JSON.stringify(updated, null, 2) + '\n', 'utf-8');
103
- if (exists) {
104
- output.success('Added Guild MCP server to .mcp.json');
105
- }
106
- else {
107
- output.success('Created .mcp.json with Guild MCP server');
108
- }
109
- return 'created';
110
- }
111
- /**
112
- * Run setup in a target directory. Exported so init/clone can call it.
113
- * When called with `quiet: true`, suppresses progress output (used as a
114
- * post-init/clone step where the caller handles its own progress UI).
115
- */
116
- export async function runSetup(targetDir, options = {}) {
117
- const output = createOutputWriter();
118
- const force = options.force ?? false;
119
- const claudeMd = options.claudeMd ?? false;
120
- const codex = options.codex ?? false;
121
- const agentsMd = options.agentsMd ?? false;
122
- const mcp = options.mcp ?? true;
123
- const quiet = options.quiet ?? false;
124
- if (agentsMd && !codex) {
125
- output.error('--agents-md requires --codex', 'Create Codex setup files with:\n guild setup --codex --agents-md');
126
- process.exit(1);
127
- }
128
- if (claudeMd && codex) {
129
- output.error('--claude-md cannot be used with --codex', 'Create Claude setup with:\n guild setup --claude-md\n\nCreate Codex setup with:\n guild setup --codex --agents-md');
130
- process.exit(1);
131
- }
132
- const skillFiles = codex ? CODEX_SKILL_FILES : CLAUDE_SKILL_FILES;
133
- // Verify source docs exist
134
- for (const file of skillFiles) {
135
- if (!(await fileExists(file.src))) {
136
- if (!quiet) {
137
- output.error('Could not find Guild CLI docs. Reinstall the CLI: npm install -g @guildai/cli');
138
- }
139
- return { filesCreated: 0, filesSkipped: 0 };
140
- }
141
- }
142
- if (!quiet) {
143
- output.progress('Setting up Guild CLI skills...');
144
- output.progress('');
145
- }
146
- let filesCreated = 0;
147
- let filesSkipped = 0;
148
- let codexProjectFilesChanged = false;
149
- // Copy skill files
150
- for (const file of skillFiles) {
151
- const destPath = path.join(targetDir, file.dest);
152
- const exists = await fileExists(destPath);
153
- if (exists && !force) {
154
- if (!quiet) {
155
- output.progress(`${file.label} already exists (use --force to overwrite)`);
156
- }
157
- filesSkipped++;
158
- }
159
- else {
160
- await fs.mkdir(path.dirname(destPath), { recursive: true });
161
- await fs.copyFile(file.src, destPath);
162
- if (!quiet) {
163
- if (exists) {
164
- output.success(`Updated ${file.label}`);
165
- }
166
- else {
167
- output.success(`Created ${file.label}`);
168
- }
169
- }
170
- filesCreated++;
171
- if (codex) {
172
- codexProjectFilesChanged = true;
173
- }
174
- }
175
- }
176
- // Handle MCP config
177
- if (mcp) {
178
- const result = await setupMcp(targetDir, { force });
179
- if (result === 'created') {
180
- filesCreated++;
181
- }
182
- else {
183
- filesSkipped++;
184
- }
185
- }
186
- // Handle CLAUDE.md template
187
- if (claudeMd) {
188
- const claudeMdPath = path.join(targetDir, 'CLAUDE.md');
189
- const exists = await fileExists(claudeMdPath);
190
- if (exists) {
191
- if (!quiet) {
192
- output.progress('CLAUDE.md already exists (not overwriting)');
193
- }
194
- filesSkipped++;
195
- }
196
- else {
197
- await fs.writeFile(claudeMdPath, CLAUDE_MD_TEMPLATE, 'utf-8');
198
- if (!quiet) {
199
- output.success('Created CLAUDE.md');
200
- }
201
- filesCreated++;
202
- }
203
- }
204
- // Handle AGENTS.md template for Codex setup
205
- if (agentsMd) {
206
- const agentsMdPath = path.join(targetDir, 'AGENTS.md');
207
- const exists = await fileExists(agentsMdPath);
208
- if (exists) {
209
- if (!quiet) {
210
- output.progress('AGENTS.md already exists (not overwriting)');
211
- }
212
- filesSkipped++;
213
- }
214
- else {
215
- await fs.writeFile(agentsMdPath, AGENTS_MD_TEMPLATE, 'utf-8');
216
- if (!quiet) {
217
- output.success('Created AGENTS.md');
218
- }
219
- filesCreated++;
220
- codexProjectFilesChanged = true;
221
- }
222
- }
223
- // Summary (only in standalone mode)
224
- if (!quiet) {
225
- output.progress('');
226
- if (filesCreated > 0 && filesSkipped === 0) {
227
- if (force) {
228
- output.success('Guild CLI skills updated.');
229
- }
230
- else {
231
- output.success('Guild CLI skills installed. Your coding assistant can now drive agent development.');
232
- }
233
- }
234
- else if (filesCreated === 0) {
235
- output.progress('No files were modified. Use --force to overwrite existing files.');
236
- }
237
- else {
238
- output.success('Guild CLI skills installed.');
239
- }
240
- if (codexProjectFilesChanged) {
241
- output.progress('Restart Codex to pick up the new project instructions.');
242
- }
243
- }
244
- return { filesCreated, filesSkipped };
245
- }
246
- export function createSetupCommand() {
247
- const cmd = new Command('setup');
248
- cmd
249
- .description('Set up Guild CLI skills for coding assistants (Claude Code, Codex, etc.)')
250
- .option('--force', 'Overwrite existing skill files and Guild MCP config', false)
251
- .option('--codex', 'Install Codex skill files instead of Claude Code skills', false)
252
- .option('--claude-md', 'Also create a CLAUDE.md template in the project root', false)
253
- .option('--agents-md', 'With --codex, also create an AGENTS.md template in the project root', false)
254
- .option('--no-mcp', 'Skip MCP server configuration')
255
- .action(async (options) => {
256
- await runSetup(process.cwd(), options);
257
- });
258
- return cmd;
259
- }
260
- //# sourceMappingURL=setup.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, ErrorCodes } from '../../lib/errors.js';
7
- import { createOutputWriter } from '../../lib/output.js';
8
- export function createTriggerActivateCommand() {
9
- const cmd = new Command('activate');
10
- cmd
11
- .description('Activate a trigger')
12
- .argument('<trigger-id>', 'Trigger ID')
13
- .action(async (triggerId) => {
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.post(`/triggers/${triggerId}/activate`, {});
23
- output.data(response);
24
- }
25
- catch (error) {
26
- const formattedError = handleAxiosError(error);
27
- if (formattedError.code === ErrorCodes.AUTH_REQUIRED) {
28
- output.error('Not authenticated. Run: guild auth login');
29
- process.exit(1);
30
- }
31
- if (formattedError.code === ErrorCodes.NOT_FOUND) {
32
- output.error('Trigger not found.');
33
- process.exit(1);
34
- }
35
- output.error(formattedError.details);
36
- process.exit(1);
37
- }
38
- });
39
- return cmd;
40
- }
41
- //# sourceMappingURL=activate.js.map
@@ -1,197 +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 { getWorkspaceId } from '../../lib/guild-config.js';
7
- import { handleAxiosError, ErrorCodes } from '../../lib/errors.js';
8
- import { createOutputWriter } from '../../lib/output.js';
9
- import { TIME_TRIGGER_FREQUENCIES, } from '../../lib/api-types.js';
10
- export function createTriggerCreateCommand() {
11
- const cmd = new Command('create');
12
- cmd
13
- .description('Create a new trigger')
14
- .option('--workspace <id>', 'Workspace ID or name')
15
- .requiredOption('--type <type>', 'Trigger type: webhook or time')
16
- .requiredOption('--agent <identifier>', 'Agent identifier (e.g., owner~agent-name)')
17
- // Webhook options
18
- .option('--integration <name>', 'Integration name for webhook triggers (e.g., github, slack, jira)')
19
- .option('--event <event>', 'Event type (e.g., app_mention, issues)')
20
- .option('--action <action>', 'Event action (e.g., opened, created)')
21
- .option('--service-config <json>', 'Service-specific config as JSON')
22
- // Time options
23
- .option('--frequency <freq>', 'Time trigger frequency: HOURLY, DAILY, WEEKLY, MONTHLY, CRON')
24
- .option('--time <time>', 'Time of day in HH:MM format')
25
- .option('--days-of-week <days>', 'Days of week (comma-separated: MONDAY,TUESDAY,...)')
26
- .option('--days-of-month <days>', 'Days of month (comma-separated: 1,15,-1)')
27
- .option('--minutes-of-hour <minutes>', 'Minutes of hour, comma-separated (0-59)')
28
- .option('--cron-expression <expression>', '5-field cron expression (required with --frequency CRON)')
29
- .option('--cron-timezone <timezone>', 'IANA timezone for --cron-expression (default: UTC)')
30
- .option('--input <json>', 'Agent input as JSON object')
31
- .action(async (options) => {
32
- const output = createOutputWriter();
33
- try {
34
- // Validate trigger type before auth (fail fast on bad input)
35
- const triggerType = options.type.toLowerCase();
36
- if (triggerType !== 'webhook' && triggerType !== 'time') {
37
- output.error('--type must be "webhook" or "time"');
38
- process.exit(1);
39
- }
40
- // Validate type-specific required options before auth
41
- if (triggerType === 'webhook' && !options.integration) {
42
- output.error('--integration is required for webhook triggers (e.g., --integration github)');
43
- process.exit(1);
44
- }
45
- if (triggerType === 'time' && !options.frequency) {
46
- output.error(`--frequency is required for time triggers. Valid frequencies: ${TIME_TRIGGER_FREQUENCIES.join(', ')}`);
47
- process.exit(1);
48
- }
49
- if (triggerType === 'time' &&
50
- options.frequency?.toUpperCase() === 'CRON' &&
51
- !options.cronExpression) {
52
- output.error('--cron-expression is required when --frequency is CRON');
53
- process.exit(1);
54
- }
55
- const token = await getAuthToken();
56
- if (!token) {
57
- output.error('Not authenticated. Run: guild auth login');
58
- process.exit(1);
59
- }
60
- // Resolve workspace
61
- let workspaceId = options.workspace;
62
- if (!workspaceId) {
63
- const resolved = await getWorkspaceId();
64
- if (!resolved) {
65
- output.error('No workspace specified. Run: guild workspace select');
66
- process.exit(1);
67
- }
68
- workspaceId = resolved.workspaceId;
69
- }
70
- const client = new GuildAPIClient();
71
- // Find workspace_agent_id from agent identifier
72
- const allWorkspaceAgents = await client.fetchAll(`/workspaces/${workspaceId}/workspace_agents`);
73
- const workspaceAgent = allWorkspaceAgents.find((wa) => wa.agent.full_name === options.agent ||
74
- wa.agent.name === options.agent ||
75
- wa.agent.id === options.agent);
76
- if (!workspaceAgent) {
77
- output.error(`Agent "${options.agent}" not found. Run: guild workspace agent add ${options.agent}`);
78
- process.exit(1);
79
- }
80
- // Build request body based on trigger type
81
- let body;
82
- if (triggerType === 'webhook') {
83
- // Fetch workspace details to get the owner account ID
84
- const workspace = await client.get(`/workspaces/${workspaceId}`);
85
- if (!workspace.owner) {
86
- output.error('Could not resolve workspace owner');
87
- process.exit(1);
88
- }
89
- // Fetch integrations with webhook configs for this account
90
- const integrations = await client.fetchAll(`/accounts/${workspace.owner.id}/integrations?has_webhooks_only=true`);
91
- // Match by integration name (case-insensitive)
92
- const integrationName = options.integration.toLowerCase();
93
- const integration = integrations.find((i) => i.name.toLowerCase() === integrationName ||
94
- i.full_name.toLowerCase() === integrationName);
95
- if (!integration) {
96
- const available = integrations.map((i) => i.name).join(', ');
97
- output.error(`Integration "${options.integration}" not found.${available ? ` Available: ${available}` : ' No webhook integrations configured.'}`);
98
- process.exit(1);
99
- }
100
- if (!integration.webhook_config) {
101
- output.error(`Integration "${integration.name}" does not have webhooks configured`);
102
- process.exit(1);
103
- }
104
- body = {
105
- type: 'webhook',
106
- workspace_agent_id: workspaceAgent.id,
107
- webhook_config_id: integration.webhook_config.id,
108
- };
109
- if (options.event) {
110
- body.event_type = options.event;
111
- }
112
- if (options.action) {
113
- body.action = options.action;
114
- }
115
- if (options.serviceConfig) {
116
- try {
117
- body.service_config = JSON.parse(options.serviceConfig);
118
- }
119
- catch {
120
- output.error('--service-config must be valid JSON');
121
- process.exit(1);
122
- }
123
- }
124
- }
125
- else {
126
- // Time trigger
127
- let agentInput = {};
128
- if (options.input) {
129
- try {
130
- agentInput = JSON.parse(options.input);
131
- }
132
- catch {
133
- output.error('--input must be valid JSON');
134
- process.exit(1);
135
- }
136
- }
137
- const frequency = options.frequency.toUpperCase();
138
- if (!TIME_TRIGGER_FREQUENCIES.includes(frequency)) {
139
- output.error(`Invalid frequency "${options.frequency}". Valid: ${TIME_TRIGGER_FREQUENCIES.join(', ')}`);
140
- process.exit(1);
141
- }
142
- // Validate options match the frequency
143
- const frequencyOptions = {
144
- HOURLY: new Set(['minutesOfHour']),
145
- DAILY: new Set(['time']),
146
- WEEKLY: new Set(['time', 'daysOfWeek']),
147
- MONTHLY: new Set(['time', 'daysOfMonth']),
148
- CRON: new Set(['cronExpression', 'cronTimezone']),
149
- };
150
- const allOptions = new Set(Object.values(frequencyOptions).flatMap((s) => [...s]));
151
- const allowed = frequencyOptions[frequency] ?? new Set();
152
- const invalid = [...allOptions]
153
- .filter((opt) => !allowed.has(opt) && options[opt])
154
- .map((opt) => '--' + opt.replace(/[A-Z]/g, (c) => '-' + c.toLowerCase()));
155
- if (invalid.length > 0) {
156
- output.error(`${invalid.join(', ')} cannot be used with ${frequency} frequency`);
157
- process.exit(1);
158
- }
159
- body = {
160
- type: 'time',
161
- frequency: frequency,
162
- workspace_agent_id: workspaceAgent.id,
163
- agent_input: agentInput,
164
- };
165
- if (options.time)
166
- body.time_of_day = options.time;
167
- if (options.daysOfWeek)
168
- body.days_of_week = options.daysOfWeek;
169
- if (options.daysOfMonth)
170
- body.days_of_month = options.daysOfMonth;
171
- if (options.minutesOfHour)
172
- body.minutes_of_hour = options.minutesOfHour;
173
- if (options.cronExpression)
174
- body.cron_expression = options.cronExpression;
175
- if (options.cronTimezone)
176
- body.cron_timezone = options.cronTimezone;
177
- }
178
- const response = await client.post(`/workspaces/${workspaceId}/triggers`, body);
179
- output.data(response);
180
- }
181
- catch (error) {
182
- const formattedError = handleAxiosError(error);
183
- if (formattedError.code === ErrorCodes.AUTH_REQUIRED) {
184
- output.error('Not authenticated. Run: guild auth login');
185
- process.exit(1);
186
- }
187
- if (formattedError.code === ErrorCodes.NOT_FOUND) {
188
- output.error('Workspace not found. Run: guild workspace select');
189
- process.exit(1);
190
- }
191
- output.error(formattedError.details);
192
- process.exit(1);
193
- }
194
- });
195
- return cmd;
196
- }
197
- //# sourceMappingURL=create.js.map