@guildai/cli 0.10.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 (203) 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/agent/logs.d.ts +3 -0
  36. package/dist/commands/setup.d.ts +16 -0
  37. package/dist/commands/skill/create.d.ts +3 -0
  38. package/dist/commands/skill/get.d.ts +3 -0
  39. package/dist/commands/skill/list.d.ts +3 -0
  40. package/dist/commands/skill/update.d.ts +3 -0
  41. package/dist/commands/skill/version/create.d.ts +3 -0
  42. package/dist/commands/skill/version/get.d.ts +3 -0
  43. package/dist/commands/skill/version/list.d.ts +3 -0
  44. package/dist/devtools-AO7YSDOD.js +67 -0
  45. package/dist/devtools-AO7YSDOD.js.map +7 -0
  46. package/dist/dist-4CBK6X5H.js +1566 -0
  47. package/dist/dist-4CBK6X5H.js.map +7 -0
  48. package/dist/esm-FRAVZP4J.js +13 -0
  49. package/dist/esm-FRAVZP4J.js.map +7 -0
  50. package/dist/execa-XQMWSABC.js +35 -0
  51. package/dist/execa-XQMWSABC.js.map +7 -0
  52. package/dist/index.js +8231 -253
  53. package/dist/index.js.map +7 -0
  54. package/dist/lib/api-types.d.ts +44 -0
  55. package/dist/lib/auth.d.ts +1 -1
  56. package/dist/lib/config.d.ts +9 -0
  57. package/dist/lib/errors.d.ts +1 -1
  58. package/dist/lib/output-mode.d.ts +9 -2
  59. package/dist/lib/output.d.ts +17 -1
  60. package/dist/lib/session-events.d.ts +14 -3
  61. package/dist/lib/session-polling.d.ts +24 -1
  62. package/dist/lib/session-resume.d.ts +15 -1
  63. package/dist/lib/stdin.d.ts +5 -1
  64. package/dist/lib/websocket-client.d.ts +46 -0
  65. package/dist/open-RF4X5MOP.js +13 -0
  66. package/dist/open-RF4X5MOP.js.map +7 -0
  67. package/dist/server-JYVH64FD.js +27659 -0
  68. package/dist/server-JYVH64FD.js.map +7 -0
  69. package/dist/test-SNIYRJ32.js +692 -0
  70. package/dist/test-SNIYRJ32.js.map +7 -0
  71. package/docs/skills/codex-agent-dev.md +2 -2
  72. package/package.json +8 -12
  73. package/dist/commands/agent/chat.js +0 -278
  74. package/dist/commands/agent/clone.js +0 -116
  75. package/dist/commands/agent/code.js +0 -87
  76. package/dist/commands/agent/fork.js +0 -218
  77. package/dist/commands/agent/get.js +0 -37
  78. package/dist/commands/agent/grep.js +0 -107
  79. package/dist/commands/agent/init.js +0 -390
  80. package/dist/commands/agent/list.js +0 -110
  81. package/dist/commands/agent/owners.js +0 -74
  82. package/dist/commands/agent/publish.js +0 -91
  83. package/dist/commands/agent/pull.js +0 -198
  84. package/dist/commands/agent/revalidate.js +0 -56
  85. package/dist/commands/agent/save.js +0 -346
  86. package/dist/commands/agent/search.js +0 -61
  87. package/dist/commands/agent/tags/add.js +0 -73
  88. package/dist/commands/agent/tags/list.js +0 -43
  89. package/dist/commands/agent/tags/remove.js +0 -84
  90. package/dist/commands/agent/tags/set.js +0 -71
  91. package/dist/commands/agent/test.js +0 -486
  92. package/dist/commands/agent/unpublish.js +0 -64
  93. package/dist/commands/agent/update.js +0 -110
  94. package/dist/commands/agent/versions.js +0 -55
  95. package/dist/commands/agent/workspaces.js +0 -54
  96. package/dist/commands/auth/login.js +0 -33
  97. package/dist/commands/auth/logout.js +0 -24
  98. package/dist/commands/auth/status.js +0 -38
  99. package/dist/commands/auth/token.js +0 -19
  100. package/dist/commands/chat.js +0 -1345
  101. package/dist/commands/config/get.js +0 -64
  102. package/dist/commands/config/list.js +0 -47
  103. package/dist/commands/config/path.js +0 -38
  104. package/dist/commands/config/set.js +0 -132
  105. package/dist/commands/credentials/endpoint-list.js +0 -88
  106. package/dist/commands/credentials/list.js +0 -50
  107. package/dist/commands/credentials/policy-create.js +0 -66
  108. package/dist/commands/credentials/policy-delete.js +0 -33
  109. package/dist/commands/credentials/policy-list.js +0 -45
  110. package/dist/commands/credentials/policy-update.js +0 -66
  111. package/dist/commands/doctor.js +0 -233
  112. package/dist/commands/integration/connect.js +0 -76
  113. package/dist/commands/integration/create.js +0 -298
  114. package/dist/commands/integration/get.js +0 -95
  115. package/dist/commands/integration/list.js +0 -62
  116. package/dist/commands/integration/operation/create.js +0 -164
  117. package/dist/commands/integration/operation/list.js +0 -92
  118. package/dist/commands/integration/update.js +0 -139
  119. package/dist/commands/integration/version/build.js +0 -86
  120. package/dist/commands/integration/version/create.js +0 -45
  121. package/dist/commands/integration/version/get.js +0 -72
  122. package/dist/commands/integration/version/list.js +0 -45
  123. package/dist/commands/integration/version/publish.js +0 -79
  124. package/dist/commands/integration/version/test.js +0 -104
  125. package/dist/commands/job/get-step.js +0 -40
  126. package/dist/commands/job/get.js +0 -44
  127. package/dist/commands/mcp.js +0 -34
  128. package/dist/commands/session/create.js +0 -59
  129. package/dist/commands/session/events.js +0 -56
  130. package/dist/commands/session/get.js +0 -33
  131. package/dist/commands/session/interrupt.js +0 -33
  132. package/dist/commands/session/list.js +0 -59
  133. package/dist/commands/session/send.js +0 -54
  134. package/dist/commands/session/tasks.js +0 -45
  135. package/dist/commands/setup.js +0 -230
  136. package/dist/commands/trigger/activate.js +0 -41
  137. package/dist/commands/trigger/create.js +0 -197
  138. package/dist/commands/trigger/deactivate.js +0 -41
  139. package/dist/commands/trigger/get.js +0 -33
  140. package/dist/commands/trigger/list.js +0 -57
  141. package/dist/commands/trigger/sessions.js +0 -48
  142. package/dist/commands/trigger/update.js +0 -128
  143. package/dist/commands/version.js +0 -24
  144. package/dist/commands/workspace/agent/add.js +0 -114
  145. package/dist/commands/workspace/agent/list.js +0 -78
  146. package/dist/commands/workspace/agent/remove.js +0 -78
  147. package/dist/commands/workspace/clear.js +0 -45
  148. package/dist/commands/workspace/context/edit.js +0 -107
  149. package/dist/commands/workspace/context/get.js +0 -47
  150. package/dist/commands/workspace/context/list.js +0 -51
  151. package/dist/commands/workspace/context/publish.js +0 -42
  152. package/dist/commands/workspace/create.js +0 -51
  153. package/dist/commands/workspace/current.js +0 -63
  154. package/dist/commands/workspace/get.js +0 -39
  155. package/dist/commands/workspace/list.js +0 -70
  156. package/dist/commands/workspace/select.js +0 -184
  157. package/dist/components/AgentInstallPrompt.js +0 -97
  158. package/dist/components/SplashAnimation.js +0 -321
  159. package/dist/components/TaskView.js +0 -268
  160. package/dist/lib/agent-helpers.js +0 -306
  161. package/dist/lib/alternate-screen.js +0 -59
  162. package/dist/lib/api-client.js +0 -154
  163. package/dist/lib/api-types.js +0 -10
  164. package/dist/lib/auth.js +0 -284
  165. package/dist/lib/braille-canvas.js +0 -321
  166. package/dist/lib/colors.js +0 -46
  167. package/dist/lib/config-cache.js +0 -45
  168. package/dist/lib/config.js +0 -153
  169. package/dist/lib/did-you-mean.js +0 -144
  170. package/dist/lib/errors.js +0 -375
  171. package/dist/lib/event-filter.js +0 -91
  172. package/dist/lib/generated-types.js +0 -56
  173. package/dist/lib/git.js +0 -176
  174. package/dist/lib/gk.js +0 -91
  175. package/dist/lib/guild-config.js +0 -178
  176. package/dist/lib/iap.js +0 -117
  177. package/dist/lib/integration-helpers.js +0 -38
  178. package/dist/lib/loading-messages.js +0 -72
  179. package/dist/lib/logo.js +0 -141
  180. package/dist/lib/lottie-serverside.js +0 -181
  181. package/dist/lib/markdown.js +0 -38
  182. package/dist/lib/npmrc.js +0 -59
  183. package/dist/lib/output-mode.js +0 -33
  184. package/dist/lib/output.js +0 -591
  185. package/dist/lib/owner-helpers.js +0 -112
  186. package/dist/lib/polling.js +0 -76
  187. package/dist/lib/progress.js +0 -324
  188. package/dist/lib/session-events-fetch.js +0 -25
  189. package/dist/lib/session-events.js +0 -112
  190. package/dist/lib/session-polling.js +0 -160
  191. package/dist/lib/session-resume.js +0 -96
  192. package/dist/lib/spinners.js +0 -770
  193. package/dist/lib/splash.js +0 -41
  194. package/dist/lib/stdin.js +0 -84
  195. package/dist/lib/svg-to-braille.js +0 -76
  196. package/dist/lib/table.js +0 -59
  197. package/dist/lib/update-check.js +0 -65
  198. package/dist/lib/validate-input-schema.js +0 -208
  199. package/dist/lib/version-helpers.js +0 -121
  200. package/dist/lib/workspace-helpers.js +0 -49
  201. package/dist/mcp/resources.js +0 -67
  202. package/dist/mcp/server.js +0 -64
  203. 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 { getOutputMode } 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 (getOutputMode() === 'json') {
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 { getOutputMode } 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 (getOutputMode() === 'json') {
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,230 +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(options) {
83
- const output = createOutputWriter();
84
- const mcpPath = path.join(process.cwd(), '.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
- async function setup(options) {
112
- const output = createOutputWriter();
113
- if (options.agentsMd && !options.codex) {
114
- output.error('--agents-md requires --codex', 'Create Codex setup files with:\n guild setup --codex --agents-md');
115
- process.exit(1);
116
- }
117
- if (options.claudeMd && options.codex) {
118
- 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');
119
- process.exit(1);
120
- }
121
- const skillFiles = options.codex ? CODEX_SKILL_FILES : CLAUDE_SKILL_FILES;
122
- // Verify source docs exist
123
- for (const file of skillFiles) {
124
- if (!(await fileExists(file.src))) {
125
- output.error('Could not find Guild CLI docs. Reinstall the CLI: npm install -g @guildai/cli');
126
- process.exit(1);
127
- }
128
- }
129
- output.progress('Setting up Guild CLI skills...');
130
- output.progress('');
131
- let filesCreated = 0;
132
- let filesSkipped = 0;
133
- let codexProjectFilesChanged = false;
134
- // Copy skill files
135
- for (const file of skillFiles) {
136
- const destPath = path.join(process.cwd(), file.dest);
137
- const exists = await fileExists(destPath);
138
- if (exists && !options.force) {
139
- output.progress(`${file.label} already exists (use --force to overwrite)`);
140
- filesSkipped++;
141
- }
142
- else {
143
- await fs.mkdir(path.dirname(destPath), { recursive: true });
144
- await fs.copyFile(file.src, destPath);
145
- if (exists) {
146
- output.success(`Updated ${file.label}`);
147
- }
148
- else {
149
- output.success(`Created ${file.label}`);
150
- }
151
- filesCreated++;
152
- if (options.codex) {
153
- codexProjectFilesChanged = true;
154
- }
155
- }
156
- }
157
- // Handle --mcp flag
158
- if (options.mcp) {
159
- const result = await setupMcp({ force: options.force });
160
- if (result === 'created') {
161
- filesCreated++;
162
- }
163
- else {
164
- filesSkipped++;
165
- }
166
- }
167
- // Handle CLAUDE.md template
168
- if (options.claudeMd) {
169
- const claudeMdPath = path.join(process.cwd(), 'CLAUDE.md');
170
- const exists = await fileExists(claudeMdPath);
171
- if (exists) {
172
- output.progress('CLAUDE.md already exists (not overwriting)');
173
- filesSkipped++;
174
- }
175
- else {
176
- await fs.writeFile(claudeMdPath, CLAUDE_MD_TEMPLATE, 'utf-8');
177
- output.success('Created CLAUDE.md');
178
- filesCreated++;
179
- }
180
- }
181
- // Handle AGENTS.md template for Codex setup
182
- if (options.agentsMd) {
183
- const agentsMdPath = path.join(process.cwd(), 'AGENTS.md');
184
- const exists = await fileExists(agentsMdPath);
185
- if (exists) {
186
- output.progress('AGENTS.md already exists (not overwriting)');
187
- filesSkipped++;
188
- }
189
- else {
190
- await fs.writeFile(agentsMdPath, AGENTS_MD_TEMPLATE, 'utf-8');
191
- output.success('Created AGENTS.md');
192
- filesCreated++;
193
- codexProjectFilesChanged = true;
194
- }
195
- }
196
- // Summary
197
- output.progress('');
198
- if (filesCreated > 0 && filesSkipped === 0) {
199
- if (options.force) {
200
- output.success('Guild CLI skills updated.');
201
- }
202
- else {
203
- output.success('Guild CLI skills installed. Your coding assistant can now drive agent development.');
204
- }
205
- }
206
- else if (filesCreated === 0) {
207
- output.progress('No files were modified. Use --force to overwrite existing files.');
208
- }
209
- else {
210
- output.success('Guild CLI skills installed.');
211
- }
212
- if (codexProjectFilesChanged) {
213
- output.progress('Restart Codex to pick up the new project instructions.');
214
- }
215
- }
216
- export function createSetupCommand() {
217
- const cmd = new Command('setup');
218
- cmd
219
- .description('Set up Guild CLI skills for coding assistants (Claude Code, Codex, etc.)')
220
- .option('--force', 'Overwrite existing skill files and Guild MCP config', false)
221
- .option('--codex', 'Install Codex skill files instead of Claude Code skills', false)
222
- .option('--claude-md', 'Also create a CLAUDE.md template in the project root', false)
223
- .option('--agents-md', 'With --codex, also create an AGENTS.md template in the project root', false)
224
- .option('--no-mcp', 'Skip MCP server configuration')
225
- .action(async (options) => {
226
- await setup(options);
227
- });
228
- return cmd;
229
- }
230
- //# 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
@@ -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 createTriggerDeactivateCommand() {
9
- const cmd = new Command('deactivate');
10
- cmd
11
- .description('Deactivate 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}/deactivate`, {});
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=deactivate.js.map