@guildai/cli 0.11.0 → 0.12.1

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-67G3BIAW.js +29 -0
  2. package/dist/auth-67G3BIAW.js.map +7 -0
  3. package/dist/chat-ALOJ22JR.js +303 -0
  4. package/dist/chat-ALOJ22JR.js.map +7 -0
  5. package/dist/chat-SG2I727J.js +33 -0
  6. package/dist/chat-SG2I727J.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-7JJT3RNI.js +97272 -0
  12. package/dist/chunk-7JJT3RNI.js.map +7 -0
  13. package/dist/chunk-ENKEEJ45.js +17 -0
  14. package/dist/chunk-ENKEEJ45.js.map +7 -0
  15. package/dist/chunk-EQUW4M5A.js +532 -0
  16. package/dist/chunk-EQUW4M5A.js.map +7 -0
  17. package/dist/chunk-F3F5CUO3.js +841 -0
  18. package/dist/chunk-F3F5CUO3.js.map +7 -0
  19. package/dist/chunk-JQRJ4A4S.js +19778 -0
  20. package/dist/chunk-JQRJ4A4S.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-RJHD6XTV.js +317 -0
  28. package/dist/chunk-RJHD6XTV.js.map +7 -0
  29. package/dist/chunk-VVSOU6ON.js +53 -0
  30. package/dist/chunk-VVSOU6ON.js.map +7 -0
  31. package/dist/chunk-X3ADGWOF.js +3643 -0
  32. package/dist/chunk-X3ADGWOF.js.map +7 -0
  33. package/dist/chunk-YQWI6SUV.js +3057 -0
  34. package/dist/chunk-YQWI6SUV.js.map +7 -0
  35. package/dist/commands/chat.d.ts +21 -0
  36. package/dist/commands/skill/create.d.ts +3 -0
  37. package/dist/commands/skill/get.d.ts +3 -0
  38. package/dist/commands/skill/list.d.ts +3 -0
  39. package/dist/commands/skill/update.d.ts +3 -0
  40. package/dist/commands/skill/version/create.d.ts +3 -0
  41. package/dist/commands/skill/version/get.d.ts +3 -0
  42. package/dist/commands/skill/version/list.d.ts +3 -0
  43. package/dist/devtools-AO7YSDOD.js +67 -0
  44. package/dist/devtools-AO7YSDOD.js.map +7 -0
  45. package/dist/dist-4CBK6X5H.js +1566 -0
  46. package/dist/dist-4CBK6X5H.js.map +7 -0
  47. package/dist/esm-FRAVZP4J.js +13 -0
  48. package/dist/esm-FRAVZP4J.js.map +7 -0
  49. package/dist/execa-XQMWSABC.js +35 -0
  50. package/dist/execa-XQMWSABC.js.map +7 -0
  51. package/dist/index.js +8230 -263
  52. package/dist/index.js.map +7 -0
  53. package/dist/lib/api-types.d.ts +44 -0
  54. package/dist/lib/config.d.ts +9 -0
  55. package/dist/lib/display-message.d.ts +11 -0
  56. package/dist/lib/errors.d.ts +1 -1
  57. package/dist/lib/markdown.d.ts +2 -9
  58. package/dist/lib/output.d.ts +11 -1
  59. package/dist/lib/response-stream-display-state.d.ts +51 -0
  60. package/dist/lib/session-events.d.ts +5 -1
  61. package/dist/lib/session-polling.d.ts +24 -1
  62. package/dist/lib/session-resume.d.ts +2 -6
  63. package/dist/lib/websocket-client.d.ts +46 -0
  64. package/dist/open-RF4X5MOP.js +13 -0
  65. package/dist/open-RF4X5MOP.js.map +7 -0
  66. package/dist/server-CKXFV2JC.js +27659 -0
  67. package/dist/server-CKXFV2JC.js.map +7 -0
  68. package/dist/test-VEA4ENOR.js +692 -0
  69. package/dist/test-VEA4ENOR.js.map +7 -0
  70. package/docs/skills/codex-agent-dev.md +2 -2
  71. package/package.json +8 -12
  72. package/dist/commands/agent/chat.js +0 -281
  73. package/dist/commands/agent/clone.js +0 -118
  74. package/dist/commands/agent/code.js +0 -87
  75. package/dist/commands/agent/fork.js +0 -220
  76. package/dist/commands/agent/get.js +0 -37
  77. package/dist/commands/agent/grep.js +0 -107
  78. package/dist/commands/agent/init.js +0 -403
  79. package/dist/commands/agent/list.js +0 -110
  80. package/dist/commands/agent/logs.js +0 -62
  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 -194
  84. package/dist/commands/agent/revalidate.js +0 -56
  85. package/dist/commands/agent/save.js +0 -345
  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 -489
  92. package/dist/commands/agent/unpublish.js +0 -64
  93. package/dist/commands/agent/update.js +0 -118
  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 -31
  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 -1416
  101. package/dist/commands/config/get.js +0 -64
  102. package/dist/commands/config/list.js +0 -46
  103. package/dist/commands/config/path.js +0 -37
  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 -260
  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 -54
  184. package/dist/lib/output.js +0 -622
  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 -126
  190. package/dist/lib/session-polling.js +0 -166
  191. package/dist/lib/session-resume.js +0 -229
  192. package/dist/lib/spinners.js +0 -770
  193. package/dist/lib/splash.js +0 -42
  194. package/dist/lib/stdin.js +0 -91
  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 -137
  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,54 +0,0 @@
1
- // Copyright 2026 Guild.ai
2
- // SPDX-License-Identifier: Apache-2.0
3
- /**
4
- * Output mode detection for the CLI
5
- *
6
- * Interactive mode (default): Colors, tables, spinners, interactive
7
- * JSON mode (--mode json or --json): Pure JSON, non-interactive, machine-readable
8
- * JSONL mode (--mode jsonl): Line-delimited JSON for streaming
9
- */
10
- import { getConfigFlag } from './config-cache.js';
11
- /**
12
- * Detect output mode from CLI flags or config
13
- *
14
- * Priority: --mode <value> > --json (backward compat) > config
15
- * Does NOT auto-detect pipes (user must request JSON explicitly).
16
- */
17
- export function getOutputMode() {
18
- // Check --mode <value> first (primary flag)
19
- const modeIndex = process.argv.indexOf('--mode');
20
- if (modeIndex !== -1 && modeIndex + 1 < process.argv.length) {
21
- const value = process.argv[modeIndex + 1];
22
- if (value === 'json' || value === 'jsonl') {
23
- return value;
24
- }
25
- // --mode interactive falls through to default
26
- }
27
- // Backward compat: --json is equivalent to --mode json
28
- if (process.argv.includes('--json') || getConfigFlag('json')) {
29
- return 'json';
30
- }
31
- return 'interactive';
32
- }
33
- /**
34
- * Check if the current output mode is machine-readable (json or jsonl).
35
- *
36
- * Use this in list/get commands instead of `getOutputMode() === 'json'`
37
- * so that both --mode json and --mode jsonl trigger non-interactive output.
38
- */
39
- export function isMachineReadable() {
40
- const mode = getOutputMode();
41
- return mode === 'json' || mode === 'jsonl';
42
- }
43
- /**
44
- * Check if quiet mode is enabled (CLI flag or config)
45
- *
46
- * Quiet mode suppresses progress and log messages to stderr.
47
- * Errors are still shown.
48
- */
49
- export function isQuietMode() {
50
- return (process.argv.includes('--quiet') ||
51
- process.argv.includes('-q') ||
52
- getConfigFlag('quiet'));
53
- }
54
- //# sourceMappingURL=output-mode.js.map
@@ -1,622 +0,0 @@
1
- // Copyright 2026 Guild.ai
2
- // SPDX-License-Identifier: Apache-2.0
3
- import chalk from 'chalk';
4
- import { Table } from './table.js';
5
- import { getOutputMode, isQuietMode } from './output-mode.js';
6
- import { createSpinner } from './progress.js';
7
- import { brand, hyperlink } from './colors.js';
8
- import { getDashboardUrl } from './config.js';
9
- /**
10
- * Format a relative timestamp (e.g. "2d ago", "3mo ago")
11
- */
12
- function formatRelativeTime(dateStr) {
13
- const date = new Date(dateStr);
14
- const now = new Date();
15
- const diffMs = now.getTime() - date.getTime();
16
- const diffMins = Math.floor(diffMs / 60000);
17
- const diffHours = Math.floor(diffMins / 60);
18
- const diffDays = Math.floor(diffHours / 24);
19
- const diffWeeks = Math.floor(diffDays / 7);
20
- const diffMonths = Math.floor(diffDays / 30);
21
- if (diffMins < 1)
22
- return 'just now';
23
- if (diffMins < 60)
24
- return `${diffMins}m ago`;
25
- if (diffHours < 24)
26
- return `${diffHours}h ago`;
27
- if (diffDays < 7)
28
- return `${diffDays}d ago`;
29
- if (diffWeeks < 5)
30
- return `${diffWeeks}w ago`;
31
- return `${diffMonths}mo ago`;
32
- }
33
- /**
34
- * Truncate a string to a max length, appending ellipsis if needed
35
- */
36
- function truncate(str, maxLen) {
37
- if (str.length <= maxLen)
38
- return str;
39
- return str.slice(0, maxLen - 1) + '…';
40
- }
41
- /**
42
- * Print the "Showing N of M <entity>" footer after a paginated table.
43
- */
44
- function printPaginationFooter(pagination, count, entityName) {
45
- const showing = Math.min(pagination.limit, count);
46
- if (pagination.has_more) {
47
- const nextOffset = pagination.offset + pagination.limit;
48
- console.log(`\nShowing ${showing} of ${pagination.total_count} ${entityName}. ` +
49
- chalk.dim(`Use --offset ${nextOffset} to see more.`));
50
- }
51
- else if (pagination.total_count > showing) {
52
- console.log(chalk.dim(`\nShowing ${showing} of ${pagination.total_count} ${entityName}`));
53
- }
54
- }
55
- /**
56
- * Format an agent list as a human-readable table.
57
- * Shared by agent list and agent search commands.
58
- */
59
- export function formatAgentTable(agents, pagination, showArchived = false) {
60
- if (agents.length === 0) {
61
- console.log(chalk.dim('No agents found'));
62
- return;
63
- }
64
- const table = new Table({
65
- columns: [
66
- { name: 'name', title: 'NAME', alignment: 'left' },
67
- { name: 'owner', title: 'OWNER', alignment: 'left', color: 'cyan' },
68
- {
69
- name: 'description',
70
- title: 'DESCRIPTION',
71
- alignment: 'left',
72
- },
73
- { name: 'updated', title: 'UPDATED', alignment: 'left' },
74
- ],
75
- });
76
- const base = getDashboardUrl();
77
- agents.forEach((agent) => {
78
- const rawName = agent.full_name || agent.name;
79
- const agentUrl = agent.full_name ? `${base}/agents/${agent.full_name}` : '';
80
- const linkedName = agentUrl ? hyperlink(rawName, agentUrl) : rawName;
81
- const displayName = showArchived && agent.is_archived
82
- ? linkedName + chalk.dim(' [archived]')
83
- : linkedName;
84
- table.addRow({
85
- name: displayName,
86
- owner: agent.owner?.name || '',
87
- description: truncate(agent.description || '', 40),
88
- updated: agent.updated_at ? formatRelativeTime(agent.updated_at) : '',
89
- });
90
- });
91
- table.printTable();
92
- printPaginationFooter(pagination, agents.length, 'agents');
93
- }
94
- /**
95
- * Format an integration list as a human-readable table.
96
- * Used by integration list command.
97
- */
98
- export function formatIntegrationTable(integrations, pagination) {
99
- if (integrations.length === 0) {
100
- console.log(chalk.dim('No integrations found'));
101
- return;
102
- }
103
- const table = new Table({
104
- columns: [
105
- { name: 'name', title: 'NAME', alignment: 'left' },
106
- { name: 'description', title: 'DESCRIPTION', alignment: 'left' },
107
- { name: 'visibility', title: 'VISIBILITY', alignment: 'left' },
108
- { name: 'owner', title: 'OWNER', alignment: 'left', color: 'cyan' },
109
- { name: 'updated', title: 'UPDATED', alignment: 'left' },
110
- ],
111
- });
112
- integrations.forEach((integration) => {
113
- table.addRow({
114
- name: integration.name,
115
- description: truncate(integration.description || '', 40),
116
- visibility: integration.is_public ? 'public' : 'internal',
117
- owner: integration.owner?.name || '',
118
- updated: integration.updated_at ? formatRelativeTime(integration.updated_at) : '',
119
- });
120
- });
121
- table.printTable();
122
- printPaginationFooter(pagination, integrations.length, 'integrations');
123
- }
124
- /**
125
- * Format an integration version list as a human-readable table.
126
- * Used by integration version list command.
127
- */
128
- export function formatIntegrationVersionTable(versions, pagination, integrationName) {
129
- if (versions.length === 0) {
130
- console.log(chalk.dim('No versions found'));
131
- return;
132
- }
133
- console.log(chalk.bold(`Versions for ${integrationName}`));
134
- console.log();
135
- const table = new Table({
136
- columns: [
137
- { name: 'id', title: 'ID', alignment: 'left' },
138
- { name: 'version', title: 'VERSION', alignment: 'left' },
139
- { name: 'author', title: 'AUTHOR', alignment: 'left', color: 'cyan' },
140
- { name: 'status', title: 'STATUS', alignment: 'left' },
141
- { name: 'published', title: 'PUBLISHED', alignment: 'left' },
142
- { name: 'created', title: 'CREATED', alignment: 'left' },
143
- ],
144
- });
145
- versions.forEach((v) => {
146
- let statusLabel;
147
- switch (v.validation_status) {
148
- case 'PASSED':
149
- statusLabel = chalk.green('Valid');
150
- break;
151
- case 'FAILED':
152
- statusLabel = chalk.red('Failed');
153
- break;
154
- case 'RUNNING':
155
- statusLabel = chalk.yellow('Building');
156
- break;
157
- default:
158
- statusLabel = chalk.dim('—');
159
- }
160
- table.addRow({
161
- id: v.id,
162
- version: v.version_number || 'Draft',
163
- author: v.author?.name || '',
164
- status: statusLabel,
165
- published: v.published_at ? formatRelativeTime(v.published_at) : chalk.dim('—'),
166
- created: v.created_at ? formatRelativeTime(v.created_at) : '',
167
- });
168
- });
169
- table.printTable();
170
- printPaginationFooter(pagination, versions.length, 'versions');
171
- }
172
- /**
173
- * Format an agent version list as a human-readable table.
174
- * Used by agent versions command.
175
- */
176
- export function formatVersionTable(versions, pagination) {
177
- if (versions.length === 0) {
178
- console.log(chalk.dim('No versions found'));
179
- return;
180
- }
181
- const table = new Table({
182
- columns: [
183
- { name: 'id', title: 'ID', alignment: 'left' },
184
- { name: 'version', title: 'VERSION', alignment: 'left', color: 'cyan' },
185
- { name: 'status', title: 'STATUS', alignment: 'left' },
186
- { name: 'validation', title: 'VALIDATION', alignment: 'left' },
187
- { name: 'summary', title: 'SUMMARY', alignment: 'left' },
188
- { name: 'created', title: 'CREATED', alignment: 'left' },
189
- ],
190
- });
191
- versions.forEach((v) => {
192
- const validationColor = v.validation_status === 'PASSED'
193
- ? chalk.green
194
- : v.validation_status === 'FAILED'
195
- ? chalk.red
196
- : chalk.dim;
197
- table.addRow({
198
- id: v.id,
199
- version: v.version_number || '-',
200
- status: v.status,
201
- validation: validationColor(v.validation_status || '-'),
202
- summary: truncate(v.summary || '', 30),
203
- created: v.created_at ? formatRelativeTime(v.created_at) : '',
204
- });
205
- });
206
- table.printTable();
207
- printPaginationFooter(pagination, versions.length, 'versions');
208
- }
209
- /**
210
- * Format a context list as a human-readable table.
211
- * Used by workspace context list command.
212
- */
213
- export function formatContextTable(contexts, pagination) {
214
- if (contexts.length === 0) {
215
- console.log(chalk.dim('No contexts found'));
216
- return;
217
- }
218
- const table = new Table({
219
- columns: [
220
- { name: 'id', title: 'ID', alignment: 'left' },
221
- { name: 'status', title: 'STATUS', alignment: 'left', color: 'cyan' },
222
- { name: 'type', title: 'TYPE', alignment: 'left' },
223
- { name: 'created', title: 'CREATED', alignment: 'left' },
224
- ],
225
- });
226
- contexts.forEach((ctx) => {
227
- table.addRow({
228
- id: ctx.id,
229
- status: ctx.status,
230
- type: ctx.type || '-',
231
- created: ctx.created_at ? formatRelativeTime(ctx.created_at) : '',
232
- });
233
- });
234
- table.printTable();
235
- printPaginationFooter(pagination, contexts.length, 'contexts');
236
- }
237
- /**
238
- * Format a workspace agent list as a human-readable table.
239
- * Used by workspace agent list command.
240
- */
241
- export function formatWorkspaceAgentTable(agents) {
242
- if (agents.length === 0) {
243
- console.log(chalk.dim('No agents installed in this workspace'));
244
- return;
245
- }
246
- const table = new Table({
247
- columns: [
248
- { name: 'name', title: 'NAME', alignment: 'left' },
249
- { name: 'version', title: 'VERSION', alignment: 'left', color: 'cyan' },
250
- { name: 'auto_update', title: 'AUTO-UPDATE', alignment: 'left' },
251
- ],
252
- });
253
- const base = getDashboardUrl();
254
- agents.forEach((wa) => {
255
- const name = wa.agent.full_name || wa.agent.name;
256
- const agentUrl = wa.agent.full_name ? `${base}/agents/${wa.agent.full_name}` : '';
257
- table.addRow({
258
- name: agentUrl ? hyperlink(name, agentUrl) : name,
259
- version: wa.agent_version.version_number || wa.agent_version.id,
260
- auto_update: wa.should_autoupdate ? chalk.green('yes') : chalk.dim('no'),
261
- });
262
- });
263
- table.printTable();
264
- }
265
- /**
266
- * Format a workspace list as a human-readable table.
267
- * Used by workspace list command.
268
- */
269
- export function formatWorkspaceTable(workspaces, pagination) {
270
- if (workspaces.length === 0) {
271
- console.log(chalk.dim('No workspaces found'));
272
- return;
273
- }
274
- const table = new Table({
275
- columns: [
276
- { name: 'name', title: 'NAME', alignment: 'left' },
277
- { name: 'full_name', title: 'FULL NAME', alignment: 'left', color: 'cyan' },
278
- { name: 'owner', title: 'OWNER', alignment: 'left' },
279
- { name: 'id', title: 'ID', alignment: 'left' },
280
- ],
281
- });
282
- workspaces.forEach((workspace) => {
283
- table.addRow({
284
- name: workspace.name,
285
- full_name: workspace.full_name || workspace.name,
286
- owner: workspace.owner?.name || '',
287
- id: workspace.id,
288
- });
289
- });
290
- table.printTable();
291
- printPaginationFooter(pagination, workspaces.length, 'workspaces');
292
- }
293
- /**
294
- * Format a session list as a human-readable table.
295
- * Used by session list command.
296
- */
297
- export function formatSessionTable(sessions, pagination) {
298
- if (sessions.length === 0) {
299
- console.log(chalk.dim('No sessions found'));
300
- return;
301
- }
302
- const table = new Table({
303
- columns: [
304
- { name: 'id', title: 'ID', alignment: 'left' },
305
- { name: 'type', title: 'TYPE', alignment: 'left', color: 'cyan' },
306
- { name: 'name', title: 'NAME', alignment: 'left' },
307
- { name: 'workspace', title: 'WORKSPACE', alignment: 'left' },
308
- { name: 'created', title: 'CREATED', alignment: 'left' },
309
- ],
310
- });
311
- const base = getDashboardUrl();
312
- sessions.forEach((session) => {
313
- table.addRow({
314
- id: hyperlink(session.id, `${base}/sessions/${session.id}`),
315
- type: session.session_type,
316
- name: session.name ? truncate(session.name, 30) : '-',
317
- workspace: session.workspace?.name || '',
318
- created: session.created_at ? formatRelativeTime(session.created_at) : '',
319
- });
320
- });
321
- table.printTable();
322
- printPaginationFooter(pagination, sessions.length, 'sessions');
323
- }
324
- /**
325
- * Format a task list as a human-readable table.
326
- * Used by session tasks command.
327
- */
328
- export function formatTaskTable(tasks, pagination) {
329
- if (tasks.length === 0) {
330
- console.log(chalk.dim('No tasks found'));
331
- return;
332
- }
333
- const table = new Table({
334
- columns: [
335
- { name: 'id', title: 'ID', alignment: 'left' },
336
- { name: 'name', title: 'NAME', alignment: 'left' },
337
- { name: 'status', title: 'STATUS', alignment: 'left' },
338
- { name: 'tokens', title: 'TOKENS', alignment: 'left' },
339
- { name: 'created', title: 'CREATED', alignment: 'left' },
340
- ],
341
- });
342
- tasks.forEach((task) => {
343
- const name = task.entity_type === 'EntTaskAgent'
344
- ? task.agent?.full_name || task.agent?.name || '-'
345
- : task.tool_name;
346
- const statusColor = task.status === 'DONE'
347
- ? chalk.green
348
- : task.status === 'ERROR'
349
- ? chalk.red
350
- : task.status === 'RUNNING' ||
351
- task.status === 'STARTED' ||
352
- task.status === 'WAITING'
353
- ? chalk.yellow
354
- : chalk.dim;
355
- table.addRow({
356
- id: task.id,
357
- name,
358
- status: statusColor(task.status),
359
- tokens: task.token_usage ? task.token_usage.total_tokens.toLocaleString() : '-',
360
- created: task.created_at ? formatRelativeTime(task.created_at) : '',
361
- });
362
- });
363
- table.printTable();
364
- printPaginationFooter(pagination, tasks.length, 'tasks');
365
- }
366
- /**
367
- * Format a trigger list as a human-readable table.
368
- * Used by trigger list command.
369
- */
370
- export function formatTriggerTable(triggers, pagination) {
371
- if (triggers.length === 0) {
372
- console.log(chalk.dim('No triggers found'));
373
- return;
374
- }
375
- const table = new Table({
376
- columns: [
377
- { name: 'id', title: 'ID', alignment: 'left' },
378
- { name: 'type', title: 'TYPE', alignment: 'left', color: 'cyan' },
379
- { name: 'agent', title: 'AGENT', alignment: 'left' },
380
- { name: 'status', title: 'STATUS', alignment: 'left' },
381
- { name: 'created', title: 'CREATED', alignment: 'left' },
382
- ],
383
- });
384
- const base = getDashboardUrl();
385
- triggers.forEach((trigger) => {
386
- const status = trigger.disabled_reason
387
- ? chalk.yellow('disabled')
388
- : trigger.deactivated_at
389
- ? chalk.dim('inactive')
390
- : chalk.green('active');
391
- const agentName = trigger.agent?.full_name || trigger.agent?.name || '';
392
- const agentUrl = trigger.agent?.full_name
393
- ? `${base}/agents/${trigger.agent.full_name}`
394
- : '';
395
- const ownerSegment = trigger.workspace.owner.type === 'organization' ? 'organizations' : 'users';
396
- const triggerUrl = `${base}/${ownerSegment}/${trigger.workspace.owner.name}/workspaces/${trigger.workspace.name}/triggers`;
397
- table.addRow({
398
- id: hyperlink(trigger.id, triggerUrl),
399
- type: trigger.type,
400
- agent: agentUrl ? hyperlink(agentName, agentUrl) : agentName,
401
- status,
402
- created: trigger.created_at ? formatRelativeTime(trigger.created_at) : '',
403
- });
404
- });
405
- table.printTable();
406
- printPaginationFooter(pagination, triggers.length, 'triggers');
407
- }
408
- export function formatCredentialsTable(credentials, pagination) {
409
- if (credentials.length === 0) {
410
- console.log(chalk.dim('No credentials found'));
411
- return;
412
- }
413
- const table = new Table({
414
- columns: [
415
- { name: 'id', title: 'ID', alignment: 'left' },
416
- { name: 'integration', title: 'INTEGRATION', alignment: 'left' },
417
- { name: 'creator', title: 'CREATOR', alignment: 'left', color: 'cyan' },
418
- { name: 'created', title: 'CREATED', alignment: 'left' },
419
- ],
420
- });
421
- credentials.forEach((cred) => {
422
- table.addRow({
423
- id: cred.id,
424
- integration: cred.integration.full_name,
425
- creator: cred.creator.name,
426
- created: formatRelativeTime(cred.created_at),
427
- });
428
- });
429
- table.printTable();
430
- printPaginationFooter(pagination, credentials.length, 'credentials');
431
- }
432
- export function formatPoliciesTable(policies, pagination) {
433
- if (policies.length === 0) {
434
- console.log(chalk.dim('No policies found'));
435
- return;
436
- }
437
- const table = new Table({
438
- columns: [
439
- { name: 'id', title: 'ID', alignment: 'left' },
440
- { name: 'decision', title: 'DECISION', alignment: 'left' },
441
- { name: 'operations', title: 'OPERATIONS', alignment: 'left' },
442
- { name: 'workspaces', title: 'WORKSPACES', alignment: 'left' },
443
- { name: 'agents', title: 'AGENTS', alignment: 'left' },
444
- { name: 'resources', title: 'RESOURCES', alignment: 'left' },
445
- { name: 'created', title: 'CREATED', alignment: 'left' },
446
- ],
447
- });
448
- policies.forEach((policy) => {
449
- const decisionColor = policy.decision === 'ALLOW' ? chalk.green : chalk.red;
450
- table.addRow({
451
- id: policy.id,
452
- decision: decisionColor(policy.decision),
453
- operations: policy.operations
454
- ? truncate(policy.operations.join(', '), 30)
455
- : chalk.dim('all'),
456
- workspaces: policy.workspaces.length > 0
457
- ? truncate(policy.workspaces.map((w) => w.full_name || w.name).join(', '), 20)
458
- : chalk.dim('all'),
459
- agents: policy.agents.length > 0
460
- ? truncate(policy.agents.map((a) => a.full_name || a.name).join(', '), 20)
461
- : chalk.dim('all'),
462
- resources: policy.resources
463
- ? truncate(Object.entries(policy.resources)
464
- .map(([k, v]) => `${k}: ${v.join(', ')}`)
465
- .join('; '), 30)
466
- : chalk.dim('none'),
467
- created: formatRelativeTime(policy.created_at),
468
- });
469
- });
470
- table.printTable();
471
- printPaginationFooter(pagination, policies.length, 'policies');
472
- }
473
- /**
474
- * Format job steps as a human-readable table.
475
- * Used by job get command.
476
- */
477
- export function formatJobStepTable(steps) {
478
- if (steps.length === 0) {
479
- console.log(chalk.dim('No steps found'));
480
- return;
481
- }
482
- const table = new Table({
483
- columns: [
484
- { name: 'name', title: 'STEP', alignment: 'left' },
485
- { name: 'status', title: 'STATUS', alignment: 'left' },
486
- { name: 'started', title: 'STARTED', alignment: 'left' },
487
- { name: 'completed', title: 'COMPLETED', alignment: 'left' },
488
- ],
489
- });
490
- steps.forEach((step) => {
491
- const statusColor = step.status === 'SUCCEEDED'
492
- ? chalk.green
493
- : step.status === 'FAILED' || step.status === 'ERRORED'
494
- ? chalk.red
495
- : step.status === 'RUNNING'
496
- ? chalk.yellow
497
- : step.status === 'SKIPPED'
498
- ? chalk.dim
499
- : chalk.white;
500
- table.addRow({
501
- name: step.name,
502
- status: statusColor(step.status),
503
- started: step.started_at ? formatRelativeTime(step.started_at) : '-',
504
- completed: step.completed_at ? formatRelativeTime(step.completed_at) : '-',
505
- });
506
- });
507
- table.printTable();
508
- }
509
- /**
510
- * Format validation step logs as human-readable output.
511
- * Prints each step's name, colored status, and full log content.
512
- * Used by the `guild agent logs` command.
513
- */
514
- export function formatValidationLogs(steps) {
515
- if (steps.length === 0) {
516
- console.log(chalk.dim('No steps found'));
517
- return;
518
- }
519
- const hr = chalk.dim('─'.repeat(60));
520
- steps.forEach((step, index) => {
521
- if (index > 0) {
522
- console.log(hr);
523
- }
524
- const statusColor = step.status === 'SUCCEEDED'
525
- ? chalk.green
526
- : step.status === 'FAILED' || step.status === 'ERRORED'
527
- ? chalk.red
528
- : step.status === 'RUNNING'
529
- ? chalk.yellow
530
- : chalk.dim;
531
- console.log(`${chalk.bold(step.name)} ${statusColor(step.status)}`);
532
- if (step.content) {
533
- console.log();
534
- console.log(step.content);
535
- }
536
- });
537
- }
538
- /**
539
- * Human-friendly output writer
540
- *
541
- * Uses colors, symbols, and formatting for readability.
542
- * Progress goes to stderr.
543
- */
544
- export class InteractiveOutputWriter {
545
- data(value) {
546
- console.log(JSON.stringify(value, null, 2));
547
- }
548
- success(message, details) {
549
- process.stderr.write(chalk.green('✓') + ' ' + message + '\n');
550
- if (details) {
551
- Object.entries(details).forEach(([k, v]) => {
552
- process.stderr.write(` ${k}: ${brand(String(v))}\n`);
553
- });
554
- }
555
- }
556
- error(message, details) {
557
- console.error(chalk.red('✗'), message);
558
- if (details) {
559
- console.error(chalk.dim(details));
560
- }
561
- }
562
- progress(message) {
563
- if (!isQuietMode()) {
564
- process.stderr.write(chalk.dim(message) + '\n');
565
- }
566
- }
567
- spinner(message) {
568
- if (isQuietMode()) {
569
- return createNoopSpinner();
570
- }
571
- return createSpinner(message);
572
- }
573
- }
574
- /**
575
- * JSON output writer
576
- *
577
- * Outputs pure JSON to stdout for machine consumption.
578
- * Progress goes to stderr as JSON (unless --quiet).
579
- */
580
- export class JSONOutputWriter {
581
- data(value) {
582
- console.log(JSON.stringify(value, null, 2));
583
- }
584
- success(message, details) {
585
- process.stderr.write(JSON.stringify({ success: true, message, ...details }) + '\n');
586
- }
587
- error(message, details) {
588
- process.stderr.write(JSON.stringify({ success: false, error: message, details }) + '\n');
589
- }
590
- progress(message) {
591
- if (!isQuietMode()) {
592
- process.stderr.write(JSON.stringify({ progress: message }) + '\n');
593
- }
594
- }
595
- spinner(_message) {
596
- // No-op spinner in JSON mode
597
- return createNoopSpinner();
598
- }
599
- }
600
- /**
601
- * Create output writer based on current mode
602
- */
603
- export function createOutputWriter() {
604
- const mode = getOutputMode();
605
- return mode === 'interactive'
606
- ? new InteractiveOutputWriter()
607
- : new JSONOutputWriter();
608
- }
609
- /**
610
- * Create a no-op spinner (for quiet/JSON modes)
611
- */
612
- function createNoopSpinner() {
613
- return {
614
- start: () => { },
615
- succeed: () => { },
616
- fail: () => { },
617
- warn: () => { },
618
- stop: () => { },
619
- text: '',
620
- };
621
- }
622
- //# sourceMappingURL=output.js.map