@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,118 +0,0 @@
1
- // Copyright 2026 Guild.ai
2
- // SPDX-License-Identifier: Apache-2.0
3
- import { Command } from 'commander';
4
- import * as readline from 'readline';
5
- import { GuildAPIClient } from '../../lib/api-client.js';
6
- import { getAgentId, resolveAgentRef } from '../../lib/agent-helpers.js';
7
- import { handleAxiosError, ErrorCodes } from '../../lib/errors.js';
8
- import { createOutputWriter } from '../../lib/output.js';
9
- import { isInteractive } from '../../lib/stdin.js';
10
- async function confirmVisibilityChange(agentName, makePublic) {
11
- const rl = readline.createInterface({
12
- input: process.stdin,
13
- output: process.stdout,
14
- });
15
- const action = makePublic ? 'PUBLIC' : 'PRIVATE';
16
- const warning = makePublic
17
- ? 'This will make the agent visible to everyone.\nWarning: Once public, an agent cannot be made private again.'
18
- : 'This will hide the agent from public discovery.';
19
- return new Promise((resolve) => {
20
- rl.question(`\nAre you sure you want to make "${agentName}" ${action}?\n${warning}\n\nContinue? [y/N] `, (answer) => {
21
- rl.close();
22
- resolve(answer.toLowerCase() === 'y' || answer.toLowerCase() === 'yes');
23
- });
24
- });
25
- }
26
- export function createAgentUpdateCommand() {
27
- const cmd = new Command('update');
28
- cmd
29
- .description('Update agent properties (visibility)')
30
- .argument('[identifier]', 'Agent ID or full name (e.g., owner~agent-name)')
31
- .option('--public', 'Make the agent public (visible to everyone)')
32
- .option('--private', 'Make the agent private (only visible to owner)')
33
- .option('--yes', 'Skip confirmation prompt for visibility changes')
34
- .action(async (identifierArg, options) => {
35
- const output = createOutputWriter();
36
- // Validate that at least one option is provided
37
- if (!options.public && !options.private) {
38
- output.error('No update options provided.', 'Usage: guild agent update [identifier] [options]\n\nOptions:\n --public Make the agent public\n --private Make the agent private\n --yes Skip confirmation prompt\n\nExamples:\n guild agent update my-agent --public\n guild agent update my-agent --private --yes\n guild agent update --public (uses guild.json)\n\nNote: Agent descriptions are set from README.md when publishing.');
39
- process.exit(1);
40
- }
41
- // Validate that --public and --private are not both specified
42
- if (options.public && options.private) {
43
- output.error('Cannot specify both --public and --private');
44
- process.exit(1);
45
- }
46
- const { agentId } = await getAgentId(identifierArg);
47
- const client = new GuildAPIClient();
48
- try {
49
- const resolvedId = await resolveAgentRef(client, agentId);
50
- // Fetch current agent info for confirmation prompts
51
- const agent = await client.get(`/agents/${resolvedId}`);
52
- // Handle visibility change confirmation
53
- const changingVisibility = options.public || options.private;
54
- if (changingVisibility) {
55
- const makePublic = Boolean(options.public);
56
- // Check if already in desired state
57
- if (agent.is_public === makePublic) {
58
- output.progress(`Agent "${agent.full_name}" is already ${makePublic ? 'public' : 'private'}.`);
59
- process.exit(0);
60
- }
61
- // Confirm unless --yes is specified
62
- if (!options.yes) {
63
- if (!isInteractive()) {
64
- output.error('Confirmation required for visibility changes.', 'Use --yes to skip confirmation in non-interactive mode:\n guild agent update ' +
65
- (identifierArg ?? '') +
66
- (makePublic ? ' --public' : ' --private') +
67
- ' --yes');
68
- process.exit(1);
69
- }
70
- const confirmed = await confirmVisibilityChange(agent.full_name, makePublic);
71
- if (!confirmed) {
72
- output.progress('Cancelled.');
73
- process.exit(0);
74
- }
75
- }
76
- }
77
- // Build update payload
78
- const updatePayload = {};
79
- if (options.public) {
80
- updatePayload.is_public = true;
81
- }
82
- if (options.private) {
83
- updatePayload.is_public = false;
84
- }
85
- const result = await client.patch(`/agents/${resolvedId}`, updatePayload);
86
- // Build success message
87
- const changes = [];
88
- if (changingVisibility) {
89
- changes.push(`visibility: ${result.is_public ? 'public' : 'private'}`);
90
- }
91
- output.data({
92
- success: 'Agent updated',
93
- id: result.id,
94
- full_name: result.full_name,
95
- is_public: result.is_public,
96
- changes: changes,
97
- });
98
- }
99
- catch (error) {
100
- const formattedError = handleAxiosError(error);
101
- if (formattedError.code === ErrorCodes.AUTH_REQUIRED) {
102
- output.error('Not logged in.', 'Please authenticate first:\n guild auth login');
103
- }
104
- else if (formattedError.code === ErrorCodes.CONN_REFUSED) {
105
- output.error('Cannot connect to Guild servers');
106
- }
107
- else if (formattedError.code === ErrorCodes.NOT_FOUND) {
108
- output.error(`Agent not found: ${agentId}`, 'Check the agent ID:\n guild agent list');
109
- }
110
- else {
111
- output.error(`Failed to update agent: ${formattedError.details}`);
112
- }
113
- process.exit(1);
114
- }
115
- });
116
- return cmd;
117
- }
118
- //# sourceMappingURL=update.js.map
@@ -1,55 +0,0 @@
1
- // Copyright 2026 Guild.ai
2
- // SPDX-License-Identifier: Apache-2.0
3
- import { Command } from 'commander';
4
- import { GuildAPIClient } from '../../lib/api-client.js';
5
- import { getGuildcoreUrl } from '../../lib/config.js';
6
- import { handleAxiosError, ErrorCodes } from '../../lib/errors.js';
7
- import { getAgentId, resolveAgentRef } from '../../lib/agent-helpers.js';
8
- import { isMachineReadable } from '../../lib/output-mode.js';
9
- import { createOutputWriter, formatVersionTable } from '../../lib/output.js';
10
- import { DEFAULT_PAGE_LIMIT } from '../../lib/api-types.js';
11
- export function createAgentVersionsCommand() {
12
- const cmd = new Command('versions');
13
- cmd
14
- .description('List all versions of an agent')
15
- .argument('[identifier]', 'Agent ID or full name (e.g., owner~agent-name)')
16
- .option('--limit <number>', `Maximum number of versions to return (default: ${DEFAULT_PAGE_LIMIT})`, String(DEFAULT_PAGE_LIMIT))
17
- .option('--offset <number>', 'Number of versions to skip (default: 0)', '0')
18
- .action(async (agentIdArg, options) => {
19
- const output = createOutputWriter();
20
- // Get agent ID from argument or guild.json
21
- const { agentId } = await getAgentId(agentIdArg);
22
- const baseUrl = getGuildcoreUrl();
23
- const client = new GuildAPIClient({ baseUrl });
24
- const limit = parseInt(options.limit, 10);
25
- const offset = parseInt(options.offset, 10);
26
- try {
27
- const resolvedId = await resolveAgentRef(client, agentId);
28
- const result = await client.get(`/agents/${resolvedId}/versions?limit=${limit}&offset=${offset}`);
29
- if (isMachineReadable()) {
30
- output.data(result);
31
- }
32
- else {
33
- formatVersionTable(result.items, result.pagination);
34
- }
35
- }
36
- catch (error) {
37
- const formattedError = handleAxiosError(error);
38
- if (formattedError.code === ErrorCodes.AUTH_REQUIRED) {
39
- output.error('Not logged in.', 'Please authenticate first:\n guild auth login');
40
- }
41
- else if (formattedError.code === ErrorCodes.CONN_REFUSED) {
42
- output.error('Cannot connect to Guild servers');
43
- }
44
- else if (formattedError.code === ErrorCodes.NOT_FOUND) {
45
- output.error(`Agent not found: ${agentId}`, 'Check the agent ID:\n guild agent list');
46
- }
47
- else {
48
- output.error(`Failed to list agent versions: ${formattedError.details}`);
49
- }
50
- process.exit(1);
51
- }
52
- });
53
- return cmd;
54
- }
55
- //# sourceMappingURL=versions.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 { getGuildcoreUrl } from '../../lib/config.js';
6
- import { handleAxiosError, ErrorCodes } from '../../lib/errors.js';
7
- import { getAgentId, resolveAgentRef } from '../../lib/agent-helpers.js';
8
- import { createOutputWriter, formatWorkspaceTable } from '../../lib/output.js';
9
- import { isMachineReadable } from '../../lib/output-mode.js';
10
- import { DEFAULT_PAGE_LIMIT } from '../../lib/api-types.js';
11
- export function createAgentWorkspacesCommand() {
12
- const cmd = new Command('workspaces');
13
- cmd
14
- .description('List workspaces that use an agent')
15
- .argument('[identifier]', 'Agent ID or full name (e.g., owner~agent-name)')
16
- .option('--limit <number>', `Maximum number of workspaces to return (default: ${DEFAULT_PAGE_LIMIT})`, String(DEFAULT_PAGE_LIMIT))
17
- .option('--offset <number>', 'Number of workspaces to skip (default: 0)', '0')
18
- .action(async (agentIdArg, options) => {
19
- const output = createOutputWriter();
20
- const { agentId } = await getAgentId(agentIdArg);
21
- const baseUrl = getGuildcoreUrl();
22
- const client = new GuildAPIClient({ baseUrl });
23
- const limit = parseInt(options.limit, 10);
24
- const offset = parseInt(options.offset, 10);
25
- try {
26
- const resolvedId = await resolveAgentRef(client, agentId);
27
- const result = await client.get(`/agents/${resolvedId}/workspaces?limit=${limit}&offset=${offset}`);
28
- if (isMachineReadable()) {
29
- output.data(result);
30
- }
31
- else {
32
- formatWorkspaceTable(result.items, result.pagination);
33
- }
34
- }
35
- catch (error) {
36
- const formattedError = handleAxiosError(error);
37
- if (formattedError.code === ErrorCodes.AUTH_REQUIRED) {
38
- output.error('Not logged in.', 'Please authenticate first:\n guild auth login');
39
- }
40
- else if (formattedError.code === ErrorCodes.CONN_REFUSED) {
41
- output.error('Cannot connect to Guild servers');
42
- }
43
- else if (formattedError.code === ErrorCodes.NOT_FOUND) {
44
- output.error(`Agent not found: ${agentId}`, 'Check the agent ID:\n guild agent list');
45
- }
46
- else {
47
- output.error(`Failed to list workspaces: ${formattedError.details}`);
48
- }
49
- process.exit(1);
50
- }
51
- });
52
- return cmd;
53
- }
54
- //# sourceMappingURL=workspaces.js.map
@@ -1,31 +0,0 @@
1
- // Copyright 2026 Guild.ai
2
- // SPDX-License-Identifier: Apache-2.0
3
- import { Command } from 'commander';
4
- import { login } from '../../lib/auth.js';
5
- import { configureNpmrc } from '../../lib/npmrc.js';
6
- import { debug } from '../../lib/errors.js';
7
- import { createOutputWriter } from '../../lib/output.js';
8
- export function createAuthLoginCommand() {
9
- const cmd = new Command('login');
10
- cmd
11
- .description('Login to Guild.ai')
12
- .option('--return-url <url>', 'Custom URL to redirect to after authentication')
13
- .option('--return-label <text>', 'Friendly label for return button (e.g., "VSCode")')
14
- .action(async (options) => {
15
- const output = createOutputWriter();
16
- const success = await login(options.returnUrl, options.returnLabel);
17
- if (success) {
18
- try {
19
- await configureNpmrc();
20
- output.progress('Configured registry in ~/.npmrc');
21
- }
22
- catch (error) {
23
- debug('npmrc configuration failed:', error);
24
- output.error('Could not configure npm registry in ~/.npmrc');
25
- }
26
- }
27
- process.exit(success ? 0 : 1);
28
- });
29
- return cmd;
30
- }
31
- //# sourceMappingURL=login.js.map
@@ -1,24 +0,0 @@
1
- // Copyright 2026 Guild.ai
2
- // SPDX-License-Identifier: Apache-2.0
3
- import { Command } from 'commander';
4
- import { logout } from '../../lib/auth.js';
5
- import { cleanupNpmrc } from '../../lib/npmrc.js';
6
- import { debug } from '../../lib/errors.js';
7
- import { createOutputWriter } from '../../lib/output.js';
8
- export function createAuthLogoutCommand() {
9
- const cmd = new Command('logout');
10
- cmd.description('Logout from Guild.ai').action(async () => {
11
- const output = createOutputWriter();
12
- await logout();
13
- try {
14
- await cleanupNpmrc();
15
- }
16
- catch (error) {
17
- debug('npmrc cleanup failed:', error);
18
- output.error('Could not clean up npm registry entries from ~/.npmrc');
19
- }
20
- process.exit(0);
21
- });
22
- return cmd;
23
- }
24
- //# sourceMappingURL=logout.js.map
@@ -1,38 +0,0 @@
1
- // Copyright 2026 Guild.ai
2
- // SPDX-License-Identifier: Apache-2.0
3
- import { Command } from 'commander';
4
- import { getAuthStatus } from '../../lib/auth.js';
5
- import { createOutputWriter } from '../../lib/output.js';
6
- import { GuildAPIClient } from '../../lib/api-client.js';
7
- import { GuildCLIError, ErrorCodes } from '../../lib/errors.js';
8
- export function createAuthStatusCommand() {
9
- const cmd = new Command('status');
10
- cmd.description('Check authentication status').action(async () => {
11
- const output = createOutputWriter();
12
- const { authenticated } = await getAuthStatus();
13
- if (!authenticated) {
14
- output.error('Not authenticated');
15
- process.exit(0);
16
- return;
17
- }
18
- // Try to fetch user profile for richer output
19
- try {
20
- const client = new GuildAPIClient();
21
- const me = await client.get('/me');
22
- output.success(`Authenticated as ${me.name} (${me.id})`);
23
- }
24
- catch (error) {
25
- if (error instanceof GuildCLIError &&
26
- error.code === ErrorCodes.AUTH_TOKEN_INVALID) {
27
- output.error('Not authenticated (token expired)', 'Run: guild auth login');
28
- }
29
- else {
30
- // Offline or other network error — fall back to simple message
31
- output.success('Authenticated');
32
- }
33
- }
34
- process.exit(0);
35
- });
36
- return cmd;
37
- }
38
- //# sourceMappingURL=status.js.map
@@ -1,19 +0,0 @@
1
- // Copyright 2026 Guild.ai
2
- // SPDX-License-Identifier: Apache-2.0
3
- import { Command } from 'commander';
4
- import { getAuthToken } from '../../lib/auth.js';
5
- import { createOutputWriter } from '../../lib/output.js';
6
- export function createAuthTokenCommand() {
7
- const cmd = new Command('token');
8
- cmd.description('Print auth token to stdout (for scripting)').action(async () => {
9
- const output = createOutputWriter();
10
- const token = await getAuthToken();
11
- if (!token) {
12
- output.error('Not authenticated. Run: guild auth login');
13
- process.exit(1);
14
- }
15
- console.log(token);
16
- });
17
- return cmd;
18
- }
19
- //# sourceMappingURL=token.js.map