@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.
- package/dist/auth-CRMO5O3N.js +29 -0
- package/dist/auth-CRMO5O3N.js.map +7 -0
- package/dist/chat-5VX2WJH2.js +303 -0
- package/dist/chat-5VX2WJH2.js.map +7 -0
- package/dist/chat-SIKDYZQK.js +31 -0
- package/dist/chat-SIKDYZQK.js.map +7 -0
- package/dist/chunk-56YCMGL3.js +522 -0
- package/dist/chunk-56YCMGL3.js.map +7 -0
- package/dist/chunk-6EX6E7WP.js +7042 -0
- package/dist/chunk-6EX6E7WP.js.map +7 -0
- package/dist/chunk-B7VAF5UG.js +532 -0
- package/dist/chunk-B7VAF5UG.js.map +7 -0
- package/dist/chunk-DOIYVBNY.js +3057 -0
- package/dist/chunk-DOIYVBNY.js.map +7 -0
- package/dist/chunk-ENKEEJ45.js +17 -0
- package/dist/chunk-ENKEEJ45.js.map +7 -0
- package/dist/chunk-IBRKVGMZ.js +97041 -0
- package/dist/chunk-IBRKVGMZ.js.map +7 -0
- package/dist/chunk-LFMQJOKC.js +19778 -0
- package/dist/chunk-LFMQJOKC.js.map +7 -0
- package/dist/chunk-M347HP6M.js +22896 -0
- package/dist/chunk-M347HP6M.js.map +7 -0
- package/dist/chunk-OYQ476FQ.js +44 -0
- package/dist/chunk-OYQ476FQ.js.map +7 -0
- package/dist/chunk-PNCUR4OB.js +257 -0
- package/dist/chunk-PNCUR4OB.js.map +7 -0
- package/dist/chunk-RIG2HZWM.js +317 -0
- package/dist/chunk-RIG2HZWM.js.map +7 -0
- package/dist/chunk-SPZPZXUN.js +826 -0
- package/dist/chunk-SPZPZXUN.js.map +7 -0
- package/dist/chunk-VVSOU6ON.js +53 -0
- package/dist/chunk-VVSOU6ON.js.map +7 -0
- package/dist/chunk-X3ADGWOF.js +3643 -0
- package/dist/chunk-X3ADGWOF.js.map +7 -0
- package/dist/commands/agent/logs.d.ts +3 -0
- package/dist/commands/setup.d.ts +16 -0
- package/dist/commands/skill/create.d.ts +3 -0
- package/dist/commands/skill/get.d.ts +3 -0
- package/dist/commands/skill/list.d.ts +3 -0
- package/dist/commands/skill/update.d.ts +3 -0
- package/dist/commands/skill/version/create.d.ts +3 -0
- package/dist/commands/skill/version/get.d.ts +3 -0
- package/dist/commands/skill/version/list.d.ts +3 -0
- package/dist/devtools-AO7YSDOD.js +67 -0
- package/dist/devtools-AO7YSDOD.js.map +7 -0
- package/dist/dist-4CBK6X5H.js +1566 -0
- package/dist/dist-4CBK6X5H.js.map +7 -0
- package/dist/esm-FRAVZP4J.js +13 -0
- package/dist/esm-FRAVZP4J.js.map +7 -0
- package/dist/execa-XQMWSABC.js +35 -0
- package/dist/execa-XQMWSABC.js.map +7 -0
- package/dist/index.js +8231 -253
- package/dist/index.js.map +7 -0
- package/dist/lib/api-types.d.ts +44 -0
- package/dist/lib/auth.d.ts +1 -1
- package/dist/lib/config.d.ts +9 -0
- package/dist/lib/errors.d.ts +1 -1
- package/dist/lib/output-mode.d.ts +9 -2
- package/dist/lib/output.d.ts +17 -1
- package/dist/lib/session-events.d.ts +14 -3
- package/dist/lib/session-polling.d.ts +24 -1
- package/dist/lib/session-resume.d.ts +15 -1
- package/dist/lib/stdin.d.ts +5 -1
- package/dist/lib/websocket-client.d.ts +46 -0
- package/dist/open-RF4X5MOP.js +13 -0
- package/dist/open-RF4X5MOP.js.map +7 -0
- package/dist/server-JYVH64FD.js +27659 -0
- package/dist/server-JYVH64FD.js.map +7 -0
- package/dist/test-SNIYRJ32.js +692 -0
- package/dist/test-SNIYRJ32.js.map +7 -0
- package/docs/skills/codex-agent-dev.md +2 -2
- package/package.json +8 -12
- package/dist/commands/agent/chat.js +0 -278
- package/dist/commands/agent/clone.js +0 -116
- package/dist/commands/agent/code.js +0 -87
- package/dist/commands/agent/fork.js +0 -218
- package/dist/commands/agent/get.js +0 -37
- package/dist/commands/agent/grep.js +0 -107
- package/dist/commands/agent/init.js +0 -390
- package/dist/commands/agent/list.js +0 -110
- package/dist/commands/agent/owners.js +0 -74
- package/dist/commands/agent/publish.js +0 -91
- package/dist/commands/agent/pull.js +0 -198
- package/dist/commands/agent/revalidate.js +0 -56
- package/dist/commands/agent/save.js +0 -346
- package/dist/commands/agent/search.js +0 -61
- package/dist/commands/agent/tags/add.js +0 -73
- package/dist/commands/agent/tags/list.js +0 -43
- package/dist/commands/agent/tags/remove.js +0 -84
- package/dist/commands/agent/tags/set.js +0 -71
- package/dist/commands/agent/test.js +0 -486
- package/dist/commands/agent/unpublish.js +0 -64
- package/dist/commands/agent/update.js +0 -110
- package/dist/commands/agent/versions.js +0 -55
- package/dist/commands/agent/workspaces.js +0 -54
- package/dist/commands/auth/login.js +0 -33
- package/dist/commands/auth/logout.js +0 -24
- package/dist/commands/auth/status.js +0 -38
- package/dist/commands/auth/token.js +0 -19
- package/dist/commands/chat.js +0 -1345
- package/dist/commands/config/get.js +0 -64
- package/dist/commands/config/list.js +0 -47
- package/dist/commands/config/path.js +0 -38
- package/dist/commands/config/set.js +0 -132
- package/dist/commands/credentials/endpoint-list.js +0 -88
- package/dist/commands/credentials/list.js +0 -50
- package/dist/commands/credentials/policy-create.js +0 -66
- package/dist/commands/credentials/policy-delete.js +0 -33
- package/dist/commands/credentials/policy-list.js +0 -45
- package/dist/commands/credentials/policy-update.js +0 -66
- package/dist/commands/doctor.js +0 -233
- package/dist/commands/integration/connect.js +0 -76
- package/dist/commands/integration/create.js +0 -298
- package/dist/commands/integration/get.js +0 -95
- package/dist/commands/integration/list.js +0 -62
- package/dist/commands/integration/operation/create.js +0 -164
- package/dist/commands/integration/operation/list.js +0 -92
- package/dist/commands/integration/update.js +0 -139
- package/dist/commands/integration/version/build.js +0 -86
- package/dist/commands/integration/version/create.js +0 -45
- package/dist/commands/integration/version/get.js +0 -72
- package/dist/commands/integration/version/list.js +0 -45
- package/dist/commands/integration/version/publish.js +0 -79
- package/dist/commands/integration/version/test.js +0 -104
- package/dist/commands/job/get-step.js +0 -40
- package/dist/commands/job/get.js +0 -44
- package/dist/commands/mcp.js +0 -34
- package/dist/commands/session/create.js +0 -59
- package/dist/commands/session/events.js +0 -56
- package/dist/commands/session/get.js +0 -33
- package/dist/commands/session/interrupt.js +0 -33
- package/dist/commands/session/list.js +0 -59
- package/dist/commands/session/send.js +0 -54
- package/dist/commands/session/tasks.js +0 -45
- package/dist/commands/setup.js +0 -230
- package/dist/commands/trigger/activate.js +0 -41
- package/dist/commands/trigger/create.js +0 -197
- package/dist/commands/trigger/deactivate.js +0 -41
- package/dist/commands/trigger/get.js +0 -33
- package/dist/commands/trigger/list.js +0 -57
- package/dist/commands/trigger/sessions.js +0 -48
- package/dist/commands/trigger/update.js +0 -128
- package/dist/commands/version.js +0 -24
- package/dist/commands/workspace/agent/add.js +0 -114
- package/dist/commands/workspace/agent/list.js +0 -78
- package/dist/commands/workspace/agent/remove.js +0 -78
- package/dist/commands/workspace/clear.js +0 -45
- package/dist/commands/workspace/context/edit.js +0 -107
- package/dist/commands/workspace/context/get.js +0 -47
- package/dist/commands/workspace/context/list.js +0 -51
- package/dist/commands/workspace/context/publish.js +0 -42
- package/dist/commands/workspace/create.js +0 -51
- package/dist/commands/workspace/current.js +0 -63
- package/dist/commands/workspace/get.js +0 -39
- package/dist/commands/workspace/list.js +0 -70
- package/dist/commands/workspace/select.js +0 -184
- package/dist/components/AgentInstallPrompt.js +0 -97
- package/dist/components/SplashAnimation.js +0 -321
- package/dist/components/TaskView.js +0 -268
- package/dist/lib/agent-helpers.js +0 -306
- package/dist/lib/alternate-screen.js +0 -59
- package/dist/lib/api-client.js +0 -154
- package/dist/lib/api-types.js +0 -10
- package/dist/lib/auth.js +0 -284
- package/dist/lib/braille-canvas.js +0 -321
- package/dist/lib/colors.js +0 -46
- package/dist/lib/config-cache.js +0 -45
- package/dist/lib/config.js +0 -153
- package/dist/lib/did-you-mean.js +0 -144
- package/dist/lib/errors.js +0 -375
- package/dist/lib/event-filter.js +0 -91
- package/dist/lib/generated-types.js +0 -56
- package/dist/lib/git.js +0 -176
- package/dist/lib/gk.js +0 -91
- package/dist/lib/guild-config.js +0 -178
- package/dist/lib/iap.js +0 -117
- package/dist/lib/integration-helpers.js +0 -38
- package/dist/lib/loading-messages.js +0 -72
- package/dist/lib/logo.js +0 -141
- package/dist/lib/lottie-serverside.js +0 -181
- package/dist/lib/markdown.js +0 -38
- package/dist/lib/npmrc.js +0 -59
- package/dist/lib/output-mode.js +0 -33
- package/dist/lib/output.js +0 -591
- package/dist/lib/owner-helpers.js +0 -112
- package/dist/lib/polling.js +0 -76
- package/dist/lib/progress.js +0 -324
- package/dist/lib/session-events-fetch.js +0 -25
- package/dist/lib/session-events.js +0 -112
- package/dist/lib/session-polling.js +0 -160
- package/dist/lib/session-resume.js +0 -96
- package/dist/lib/spinners.js +0 -770
- package/dist/lib/splash.js +0 -41
- package/dist/lib/stdin.js +0 -84
- package/dist/lib/svg-to-braille.js +0 -76
- package/dist/lib/table.js +0 -59
- package/dist/lib/update-check.js +0 -65
- package/dist/lib/validate-input-schema.js +0 -208
- package/dist/lib/version-helpers.js +0 -121
- package/dist/lib/workspace-helpers.js +0 -49
- package/dist/mcp/resources.js +0 -67
- package/dist/mcp/server.js +0 -64
- package/dist/mcp/tools.js +0 -753
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
// Copyright 2026 Guild.ai
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import { Command } from 'commander';
|
|
4
|
-
import { spawnSync } from 'child_process';
|
|
5
|
-
import { mkdtempSync, writeFileSync, readFileSync, rmSync } from 'fs';
|
|
6
|
-
import { join } from 'path';
|
|
7
|
-
import { tmpdir } from 'os';
|
|
8
|
-
import { GuildAPIClient } from '../../../lib/api-client.js';
|
|
9
|
-
import { handleAxiosError, ErrorCodes } from '../../../lib/errors.js';
|
|
10
|
-
import { createOutputWriter } from '../../../lib/output.js';
|
|
11
|
-
export function createWorkspaceContextEditCommand() {
|
|
12
|
-
const cmd = new Command('edit');
|
|
13
|
-
cmd
|
|
14
|
-
.description('Edit workspace context (creates a new draft version)')
|
|
15
|
-
.argument('<workspace>', 'Workspace ID or full name (e.g., owner/workspace-name)')
|
|
16
|
-
.option('--from <context-id>', 'Edit from a specific context version')
|
|
17
|
-
.action(async (workspaceId, options) => {
|
|
18
|
-
const output = createOutputWriter();
|
|
19
|
-
let tempDir = null;
|
|
20
|
-
try {
|
|
21
|
-
const client = new GuildAPIClient();
|
|
22
|
-
// Get the context to edit from
|
|
23
|
-
let sourceContext = null;
|
|
24
|
-
// Fetch all contexts (backend doesn't have GET for individual context)
|
|
25
|
-
const response = await client.get(`/workspaces/${workspaceId}/contexts`);
|
|
26
|
-
const contexts = response.items;
|
|
27
|
-
if (options.from) {
|
|
28
|
-
// Edit from specific context version
|
|
29
|
-
sourceContext = contexts.find((ctx) => ctx.id === options.from) || null;
|
|
30
|
-
if (!sourceContext) {
|
|
31
|
-
output.error(`Context not found: ${options.from}`, `Run: guild workspace context list ${workspaceId}`);
|
|
32
|
-
process.exit(1);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
// Find the published context
|
|
37
|
-
sourceContext = contexts.find((ctx) => ctx.status === 'PUBLISHED') || null;
|
|
38
|
-
}
|
|
39
|
-
// Get the editor from environment
|
|
40
|
-
const editor = process.env.EDITOR || process.env.VISUAL || process.env.GIT_EDITOR;
|
|
41
|
-
if (!editor) {
|
|
42
|
-
output.error('No editor configured', 'Set EDITOR environment variable:\n export EDITOR=vim\n # or\n export EDITOR="code --wait"');
|
|
43
|
-
process.exit(1);
|
|
44
|
-
}
|
|
45
|
-
// Create temp file with current context content
|
|
46
|
-
tempDir = mkdtempSync(join(tmpdir(), 'guild-context-'));
|
|
47
|
-
const tempFile = join(tempDir, 'workspace.md');
|
|
48
|
-
const currentContent = sourceContext?.manual_context || '';
|
|
49
|
-
writeFileSync(tempFile, currentContent, 'utf-8');
|
|
50
|
-
output.progress('Opening editor...');
|
|
51
|
-
// Open editor
|
|
52
|
-
const result = spawnSync(editor, [tempFile], {
|
|
53
|
-
stdio: 'inherit',
|
|
54
|
-
shell: true,
|
|
55
|
-
});
|
|
56
|
-
if (result.status !== 0 && result.status !== null) {
|
|
57
|
-
throw new Error(`Editor exited with code ${result.status}`);
|
|
58
|
-
}
|
|
59
|
-
// Read edited content
|
|
60
|
-
const editedContent = readFileSync(tempFile, 'utf-8');
|
|
61
|
-
// Create new draft context
|
|
62
|
-
const newContext = await client.post(`/workspaces/${workspaceId}/contexts`, {
|
|
63
|
-
status: 'DRAFT',
|
|
64
|
-
context: editedContent,
|
|
65
|
-
summary: null,
|
|
66
|
-
});
|
|
67
|
-
output.success(`Draft context created: ${newContext.id}`, {
|
|
68
|
-
publish: `guild workspace context publish ${workspaceId} ${newContext.id}`,
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
catch (error) {
|
|
72
|
-
const formattedError = handleAxiosError(error);
|
|
73
|
-
if (formattedError.code === ErrorCodes.AUTH_REQUIRED) {
|
|
74
|
-
output.error('Not authenticated. Please log in first.', 'Run: guild auth login');
|
|
75
|
-
process.exit(1);
|
|
76
|
-
}
|
|
77
|
-
if (formattedError.code === ErrorCodes.NOT_FOUND) {
|
|
78
|
-
if (options.from) {
|
|
79
|
-
output.error(`Context not found: ${options.from}`, `Run: guild workspace context list ${workspaceId}`);
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
output.error(`Workspace not found: ${workspaceId}`, 'Run: guild workspace list');
|
|
83
|
-
}
|
|
84
|
-
process.exit(1);
|
|
85
|
-
}
|
|
86
|
-
if (formattedError.code === ErrorCodes.CONN_REFUSED) {
|
|
87
|
-
output.error(`Failed to edit context: ${formattedError.details}`, 'Run with --debug for more details');
|
|
88
|
-
process.exit(1);
|
|
89
|
-
}
|
|
90
|
-
output.error(`Failed to edit context: ${formattedError.details}`);
|
|
91
|
-
process.exit(1);
|
|
92
|
-
}
|
|
93
|
-
finally {
|
|
94
|
-
// Cleanup temp directory
|
|
95
|
-
if (tempDir) {
|
|
96
|
-
try {
|
|
97
|
-
rmSync(tempDir, { recursive: true, force: true });
|
|
98
|
-
}
|
|
99
|
-
catch {
|
|
100
|
-
// Ignore cleanup errors
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
return cmd;
|
|
106
|
-
}
|
|
107
|
-
//# sourceMappingURL=edit.js.map
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
// Copyright 2026 Guild.ai
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import { Command } from 'commander';
|
|
4
|
-
import { GuildAPIClient } from '../../../lib/api-client.js';
|
|
5
|
-
import { handleAxiosError, ErrorCodes } from '../../../lib/errors.js';
|
|
6
|
-
import { createOutputWriter } from '../../../lib/output.js';
|
|
7
|
-
export function createWorkspaceContextGetCommand() {
|
|
8
|
-
const cmd = new Command('get');
|
|
9
|
-
cmd
|
|
10
|
-
.description('Get context details')
|
|
11
|
-
.argument('<workspace>', 'Workspace ID or full name (e.g., owner/workspace-name)')
|
|
12
|
-
.argument('<context-id>', 'Context ID')
|
|
13
|
-
.action(async (workspaceId, contextId) => {
|
|
14
|
-
const output = createOutputWriter();
|
|
15
|
-
try {
|
|
16
|
-
const client = new GuildAPIClient();
|
|
17
|
-
// Backend doesn't have GET endpoint for individual context
|
|
18
|
-
// So we fetch all contexts and filter client-side
|
|
19
|
-
const response = await client.get(`/workspaces/${workspaceId}/contexts`);
|
|
20
|
-
const context = response.items.find((ctx) => ctx.id === contextId);
|
|
21
|
-
if (!context) {
|
|
22
|
-
output.error(`Context not found: ${contextId}`, `Run: guild workspace context list ${workspaceId}`);
|
|
23
|
-
process.exit(1);
|
|
24
|
-
}
|
|
25
|
-
output.data(context);
|
|
26
|
-
}
|
|
27
|
-
catch (error) {
|
|
28
|
-
const formattedError = handleAxiosError(error);
|
|
29
|
-
if (formattedError.code === ErrorCodes.AUTH_REQUIRED) {
|
|
30
|
-
output.error('Not authenticated. Please log in first.', 'Run: guild auth login');
|
|
31
|
-
process.exit(1);
|
|
32
|
-
}
|
|
33
|
-
if (formattedError.code === ErrorCodes.NOT_FOUND) {
|
|
34
|
-
output.error(`Context not found: ${contextId}`, `Run: guild workspace context list ${workspaceId}`);
|
|
35
|
-
process.exit(1);
|
|
36
|
-
}
|
|
37
|
-
if (formattedError.code === ErrorCodes.CONN_REFUSED) {
|
|
38
|
-
output.error(`Failed to get context: ${formattedError.details}`, 'Run with --debug for more details');
|
|
39
|
-
process.exit(1);
|
|
40
|
-
}
|
|
41
|
-
output.error(`Failed to get context: ${formattedError.details}`);
|
|
42
|
-
process.exit(1);
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
return cmd;
|
|
46
|
-
}
|
|
47
|
-
//# sourceMappingURL=get.js.map
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
// Copyright 2026 Guild.ai
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import { Command } from 'commander';
|
|
4
|
-
import { GuildAPIClient } from '../../../lib/api-client.js';
|
|
5
|
-
import { handleAxiosError, ErrorCodes } from '../../../lib/errors.js';
|
|
6
|
-
import { getOutputMode } from '../../../lib/output-mode.js';
|
|
7
|
-
import { createOutputWriter, formatContextTable } from '../../../lib/output.js';
|
|
8
|
-
import { DEFAULT_PAGE_LIMIT } from '../../../lib/api-types.js';
|
|
9
|
-
export function createWorkspaceContextListCommand() {
|
|
10
|
-
const cmd = new Command('list');
|
|
11
|
-
cmd
|
|
12
|
-
.description('List context versions for a workspace')
|
|
13
|
-
.argument('<workspace>', 'Workspace ID or full name (e.g., owner/workspace-name)')
|
|
14
|
-
.option('--limit <number>', `Number of results to return (default: ${DEFAULT_PAGE_LIMIT})`, String(DEFAULT_PAGE_LIMIT))
|
|
15
|
-
.option('--offset <number>', 'Offset for pagination (default: 0)', '0')
|
|
16
|
-
.action(async (workspaceId, options) => {
|
|
17
|
-
const output = createOutputWriter();
|
|
18
|
-
try {
|
|
19
|
-
const client = new GuildAPIClient();
|
|
20
|
-
const params = new URLSearchParams();
|
|
21
|
-
params.append('limit', options.limit);
|
|
22
|
-
params.append('offset', options.offset);
|
|
23
|
-
const response = await client.get(`/workspaces/${workspaceId}/contexts?${params.toString()}`);
|
|
24
|
-
if (getOutputMode() === 'json') {
|
|
25
|
-
output.data(response);
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
formatContextTable(response.items, response.pagination);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
catch (error) {
|
|
32
|
-
const formattedError = handleAxiosError(error);
|
|
33
|
-
if (formattedError.code === ErrorCodes.AUTH_REQUIRED) {
|
|
34
|
-
output.error('Not authenticated. Please log in first.', 'Run: guild auth login');
|
|
35
|
-
process.exit(1);
|
|
36
|
-
}
|
|
37
|
-
if (formattedError.code === ErrorCodes.NOT_FOUND) {
|
|
38
|
-
output.error(`Workspace not found: ${workspaceId}`, 'Run: guild workspace list');
|
|
39
|
-
process.exit(1);
|
|
40
|
-
}
|
|
41
|
-
if (formattedError.code === ErrorCodes.CONN_REFUSED) {
|
|
42
|
-
output.error(`Failed to list contexts: ${formattedError.details}`, 'Run with --debug for more details');
|
|
43
|
-
process.exit(1);
|
|
44
|
-
}
|
|
45
|
-
output.error(`Failed to list contexts: ${formattedError.details}`);
|
|
46
|
-
process.exit(1);
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
return cmd;
|
|
50
|
-
}
|
|
51
|
-
//# sourceMappingURL=list.js.map
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
// Copyright 2026 Guild.ai
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import { Command } from 'commander';
|
|
4
|
-
import { GuildAPIClient } from '../../../lib/api-client.js';
|
|
5
|
-
import { handleAxiosError, ErrorCodes } from '../../../lib/errors.js';
|
|
6
|
-
import { createOutputWriter } from '../../../lib/output.js';
|
|
7
|
-
export function createWorkspaceContextPublishCommand() {
|
|
8
|
-
const cmd = new Command('publish');
|
|
9
|
-
cmd
|
|
10
|
-
.description('Publish a draft context version')
|
|
11
|
-
.argument('<workspace>', 'Workspace ID or full name (e.g., owner/workspace-name)')
|
|
12
|
-
.argument('<context-id>', 'Context ID to publish')
|
|
13
|
-
.action(async (workspaceId, contextId) => {
|
|
14
|
-
const output = createOutputWriter();
|
|
15
|
-
try {
|
|
16
|
-
const client = new GuildAPIClient();
|
|
17
|
-
await client.patch(`/contexts/${contextId}`, {
|
|
18
|
-
status: 'PUBLISHED',
|
|
19
|
-
});
|
|
20
|
-
output.success(`Context ${contextId} published successfully`);
|
|
21
|
-
}
|
|
22
|
-
catch (error) {
|
|
23
|
-
const formattedError = handleAxiosError(error);
|
|
24
|
-
if (formattedError.code === ErrorCodes.AUTH_REQUIRED) {
|
|
25
|
-
output.error('Not authenticated. Please log in first.', 'Run: guild auth login');
|
|
26
|
-
process.exit(1);
|
|
27
|
-
}
|
|
28
|
-
if (formattedError.code === ErrorCodes.NOT_FOUND) {
|
|
29
|
-
output.error(`Context not found: ${contextId}`, `Run: guild workspace context list ${workspaceId}`);
|
|
30
|
-
process.exit(1);
|
|
31
|
-
}
|
|
32
|
-
if (formattedError.code === ErrorCodes.CONN_REFUSED) {
|
|
33
|
-
output.error(`Failed to publish context: ${formattedError.details}`, 'Run with --debug for more details');
|
|
34
|
-
process.exit(1);
|
|
35
|
-
}
|
|
36
|
-
output.error(`Failed to publish context: ${formattedError.details}`);
|
|
37
|
-
process.exit(1);
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
return cmd;
|
|
41
|
-
}
|
|
42
|
-
//# sourceMappingURL=publish.js.map
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
// Copyright 2026 Guild.ai
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import { Command } from 'commander';
|
|
4
|
-
import { GuildAPIClient } from '../../lib/api-client.js';
|
|
5
|
-
import { handleAxiosError, ErrorCodes } from '../../lib/errors.js';
|
|
6
|
-
import { createOutputWriter } from '../../lib/output.js';
|
|
7
|
-
import { resolveOwnerId } from '../../lib/owner-helpers.js';
|
|
8
|
-
import { isInteractive } from '../../lib/stdin.js';
|
|
9
|
-
export function createWorkspaceCreateCommand() {
|
|
10
|
-
const cmd = new Command('create');
|
|
11
|
-
cmd
|
|
12
|
-
.description('Create a new workspace')
|
|
13
|
-
.argument('<name>', 'Workspace name')
|
|
14
|
-
.option('--owner <owner>', 'Owner (name or ID)')
|
|
15
|
-
.action(async (name, options) => {
|
|
16
|
-
const output = createOutputWriter();
|
|
17
|
-
try {
|
|
18
|
-
const client = new GuildAPIClient();
|
|
19
|
-
const owner = await resolveOwnerId({
|
|
20
|
-
ownerFlag: options.owner,
|
|
21
|
-
client,
|
|
22
|
-
interactive: isInteractive(),
|
|
23
|
-
});
|
|
24
|
-
// Create workspace
|
|
25
|
-
const workspace = await client.post('/workspaces', {
|
|
26
|
-
name,
|
|
27
|
-
owner_id: owner.id,
|
|
28
|
-
});
|
|
29
|
-
output.data(workspace);
|
|
30
|
-
}
|
|
31
|
-
catch (error) {
|
|
32
|
-
const formattedError = handleAxiosError(error);
|
|
33
|
-
if (formattedError.code === ErrorCodes.AUTH_REQUIRED) {
|
|
34
|
-
output.error('Not authenticated. Please log in first.', 'Run: guild auth login');
|
|
35
|
-
process.exit(1);
|
|
36
|
-
}
|
|
37
|
-
if (formattedError.code === ErrorCodes.CONN_REFUSED) {
|
|
38
|
-
output.error(`Failed to create workspace: ${formattedError.details}`, 'Run with --debug for more details');
|
|
39
|
-
process.exit(1);
|
|
40
|
-
}
|
|
41
|
-
if (formattedError.code === ErrorCodes.BAD_REQUEST) {
|
|
42
|
-
output.error(`Failed to create workspace: ${formattedError.details}`, 'Run with --debug for more details');
|
|
43
|
-
process.exit(1);
|
|
44
|
-
}
|
|
45
|
-
output.error(`Failed to create workspace: ${formattedError.details}`);
|
|
46
|
-
process.exit(1);
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
return cmd;
|
|
50
|
-
}
|
|
51
|
-
//# sourceMappingURL=create.js.map
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
// Copyright 2026 Guild.ai
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import { Command } from 'commander';
|
|
4
|
-
import { GuildAPIClient } from '../../lib/api-client.js';
|
|
5
|
-
import { handleAxiosError, ErrorCodes } from '../../lib/errors.js';
|
|
6
|
-
import { createOutputWriter } from '../../lib/output.js';
|
|
7
|
-
import { getWorkspaceId, loadGlobalConfig } from '../../lib/guild-config.js';
|
|
8
|
-
export function createWorkspaceCurrentCommand() {
|
|
9
|
-
const cmd = new Command('current');
|
|
10
|
-
cmd.description('Show current default workspace').action(async () => {
|
|
11
|
-
const output = createOutputWriter();
|
|
12
|
-
try {
|
|
13
|
-
// Get configured workspace ID
|
|
14
|
-
const resolved = await getWorkspaceId();
|
|
15
|
-
if (!resolved) {
|
|
16
|
-
output.data({ configured: false, message: 'No default workspace configured.' });
|
|
17
|
-
output.progress('Set a default workspace:\n guild workspace select');
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
const { workspaceId, source } = resolved;
|
|
21
|
-
// Fetch workspace details from API
|
|
22
|
-
const client = new GuildAPIClient();
|
|
23
|
-
const workspace = await client.get(`/workspaces/${workspaceId}`);
|
|
24
|
-
output.data({
|
|
25
|
-
name: workspace.name,
|
|
26
|
-
id: workspaceId,
|
|
27
|
-
source: source === 'local' ? 'guild.json (local)' : '~/.guild/config.json (global)',
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
catch (error) {
|
|
31
|
-
const formattedError = handleAxiosError(error);
|
|
32
|
-
if (formattedError.code === ErrorCodes.AUTH_REQUIRED) {
|
|
33
|
-
// Still show configured workspace ID even if not authenticated
|
|
34
|
-
const globalConfig = await loadGlobalConfig();
|
|
35
|
-
if (globalConfig?.default_workspace) {
|
|
36
|
-
output.data({
|
|
37
|
-
id: globalConfig.default_workspace,
|
|
38
|
-
source: '~/.guild/config.json (global)',
|
|
39
|
-
authenticated: false,
|
|
40
|
-
});
|
|
41
|
-
output.progress('Log in to see workspace name:\n guild auth login');
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
output.error('Not authenticated. Please log in first.', 'Run: guild auth login');
|
|
45
|
-
process.exit(1);
|
|
46
|
-
}
|
|
47
|
-
if (formattedError.code === ErrorCodes.NOT_FOUND) {
|
|
48
|
-
// Workspace ID is configured but doesn't exist
|
|
49
|
-
const resolved = await getWorkspaceId();
|
|
50
|
-
output.error('Configured workspace not found', `ID: ${resolved?.workspaceId || 'unknown'}\n\nThe workspace may have been deleted. Select a new one:\n guild workspace select`);
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
if (formattedError.code === ErrorCodes.CONN_REFUSED) {
|
|
54
|
-
output.error(`Failed to fetch workspace: ${formattedError.details}`, 'Run with --debug for more details');
|
|
55
|
-
process.exit(1);
|
|
56
|
-
}
|
|
57
|
-
output.error(`Failed to get workspace: ${formattedError.details}`);
|
|
58
|
-
process.exit(1);
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
return cmd;
|
|
62
|
-
}
|
|
63
|
-
//# sourceMappingURL=current.js.map
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
// Copyright 2026 Guild.ai
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import { Command } from 'commander';
|
|
4
|
-
import { GuildAPIClient } from '../../lib/api-client.js';
|
|
5
|
-
import { handleAxiosError, ErrorCodes } from '../../lib/errors.js';
|
|
6
|
-
import { createOutputWriter } from '../../lib/output.js';
|
|
7
|
-
export function createWorkspaceGetCommand() {
|
|
8
|
-
const cmd = new Command('get');
|
|
9
|
-
cmd
|
|
10
|
-
.description('Get workspace details')
|
|
11
|
-
.argument('<identifier>', 'Workspace ID or full name (e.g., owner~workspace-name)')
|
|
12
|
-
.action(async (id) => {
|
|
13
|
-
const output = createOutputWriter();
|
|
14
|
-
try {
|
|
15
|
-
const client = new GuildAPIClient();
|
|
16
|
-
const workspace = await client.get(`/workspaces/${id}`);
|
|
17
|
-
output.data(workspace);
|
|
18
|
-
}
|
|
19
|
-
catch (error) {
|
|
20
|
-
const formattedError = handleAxiosError(error);
|
|
21
|
-
if (formattedError.code === ErrorCodes.AUTH_REQUIRED) {
|
|
22
|
-
output.error('Not authenticated. Please log in first.', 'Run: guild auth login');
|
|
23
|
-
process.exit(1);
|
|
24
|
-
}
|
|
25
|
-
if (formattedError.code === ErrorCodes.CONN_REFUSED) {
|
|
26
|
-
output.error(`Failed to get workspace: ${formattedError.details}`, 'Run with --debug for more details');
|
|
27
|
-
process.exit(1);
|
|
28
|
-
}
|
|
29
|
-
if (formattedError.code === ErrorCodes.NOT_FOUND) {
|
|
30
|
-
output.error(`Workspace not found: ${id}`, 'Run: guild workspace list');
|
|
31
|
-
process.exit(1);
|
|
32
|
-
}
|
|
33
|
-
output.error(`Failed to get workspace: ${formattedError.details}`);
|
|
34
|
-
process.exit(1);
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
return cmd;
|
|
38
|
-
}
|
|
39
|
-
//# sourceMappingURL=get.js.map
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
// Copyright 2026 Guild.ai
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import { Command } from 'commander';
|
|
4
|
-
import { GuildAPIClient } from '../../lib/api-client.js';
|
|
5
|
-
import { handleAxiosError, ErrorCodes } from '../../lib/errors.js';
|
|
6
|
-
import { getOutputMode } from '../../lib/output-mode.js';
|
|
7
|
-
import { createOutputWriter, formatWorkspaceTable } from '../../lib/output.js';
|
|
8
|
-
import { DEFAULT_PAGE_LIMIT } from '../../lib/api-types.js';
|
|
9
|
-
export function createWorkspaceListCommand() {
|
|
10
|
-
const cmd = new Command('list');
|
|
11
|
-
cmd
|
|
12
|
-
.description('List workspaces')
|
|
13
|
-
.option('--limit <number>', `Number of results to return (default: ${DEFAULT_PAGE_LIMIT})`, String(DEFAULT_PAGE_LIMIT))
|
|
14
|
-
.option('--offset <number>', 'Offset for pagination (default: 0)', '0')
|
|
15
|
-
.option('--owner <name>', 'Filter workspaces by owner name (case-insensitive)')
|
|
16
|
-
.action(async (options) => {
|
|
17
|
-
const output = createOutputWriter();
|
|
18
|
-
try {
|
|
19
|
-
const client = new GuildAPIClient();
|
|
20
|
-
let response;
|
|
21
|
-
if (options.owner) {
|
|
22
|
-
// When filtering by owner, fetch ALL workspaces first so the
|
|
23
|
-
// client-side filter is applied to the complete dataset, not just
|
|
24
|
-
// one page. The backend's `filter` param only recognises "all" vs
|
|
25
|
-
// personal; owner-name filtering is not supported server-side.
|
|
26
|
-
const allWorkspaces = await client.fetchAll('/me/workspaces?filter=all');
|
|
27
|
-
const ownerLower = options.owner.toLowerCase();
|
|
28
|
-
const filtered = allWorkspaces.filter((w) => w.owner?.name?.toLowerCase() === ownerLower);
|
|
29
|
-
response = {
|
|
30
|
-
items: filtered,
|
|
31
|
-
pagination: {
|
|
32
|
-
total_count: filtered.length,
|
|
33
|
-
limit: filtered.length,
|
|
34
|
-
offset: 0,
|
|
35
|
-
has_more: false,
|
|
36
|
-
},
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
const params = new URLSearchParams();
|
|
41
|
-
// Use filter=all to get workspaces from all orgs the user is a member of.
|
|
42
|
-
params.append('filter', 'all');
|
|
43
|
-
params.append('limit', options.limit);
|
|
44
|
-
params.append('offset', options.offset);
|
|
45
|
-
response = await client.get(`/me/workspaces?${params.toString()}`);
|
|
46
|
-
}
|
|
47
|
-
if (getOutputMode() === 'json') {
|
|
48
|
-
console.log(JSON.stringify(response, null, 2));
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
formatWorkspaceTable(response.items, response.pagination);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
catch (error) {
|
|
55
|
-
const formattedError = handleAxiosError(error);
|
|
56
|
-
if (formattedError.code === ErrorCodes.AUTH_REQUIRED) {
|
|
57
|
-
output.error('Not authenticated. Please log in first.', 'Run: guild auth login');
|
|
58
|
-
process.exit(1);
|
|
59
|
-
}
|
|
60
|
-
if (formattedError.code === ErrorCodes.CONN_REFUSED) {
|
|
61
|
-
output.error(`Failed to list workspaces: ${formattedError.details}`, 'Run with --debug for more details');
|
|
62
|
-
process.exit(1);
|
|
63
|
-
}
|
|
64
|
-
output.error(`Failed to list workspaces: ${formattedError.details}`);
|
|
65
|
-
process.exit(1);
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
return cmd;
|
|
69
|
-
}
|
|
70
|
-
//# sourceMappingURL=list.js.map
|
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
// Copyright 2026 Guild.ai
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import { Command } from 'commander';
|
|
4
|
-
import * as fs from 'fs/promises';
|
|
5
|
-
import { GuildAPIClient } from '../../lib/api-client.js';
|
|
6
|
-
import { handleAxiosError, ErrorCodes } from '../../lib/errors.js';
|
|
7
|
-
import { createOutputWriter } from '../../lib/output.js';
|
|
8
|
-
import { isInteractive } from '../../lib/stdin.js';
|
|
9
|
-
import { isAgentDirectory, loadLocalConfig, getLocalConfigPath, getWorkspaceId, saveGlobalConfig, } from '../../lib/guild-config.js';
|
|
10
|
-
/**
|
|
11
|
-
* Format workspace for display with owner name.
|
|
12
|
-
* Shows: "workspace-name (id) [owner-name]" for all workspaces with owner info
|
|
13
|
-
* Shows: "workspace-name (id)" only if owner info is missing
|
|
14
|
-
*/
|
|
15
|
-
function formatWorkspaceDisplay(workspace) {
|
|
16
|
-
const base = `${workspace.name} (${workspace.id})`;
|
|
17
|
-
if (workspace.owner) {
|
|
18
|
-
return `${base} [${workspace.owner.name}]`;
|
|
19
|
-
}
|
|
20
|
-
return base;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Match a workspace against a search argument (case-insensitive name, full_name, or exact ID).
|
|
24
|
-
*/
|
|
25
|
-
function matchesWorkspaceArg(w, arg) {
|
|
26
|
-
return (w.name === arg ||
|
|
27
|
-
w.name.toLowerCase() === arg.toLowerCase() ||
|
|
28
|
-
w.full_name === arg ||
|
|
29
|
-
w.full_name?.toLowerCase() === arg.toLowerCase() ||
|
|
30
|
-
w.id === arg);
|
|
31
|
-
}
|
|
32
|
-
export function createWorkspaceSelectCommand() {
|
|
33
|
-
const cmd = new Command('select');
|
|
34
|
-
cmd
|
|
35
|
-
.description('Select default workspace for agent testing')
|
|
36
|
-
.argument('[workspace]', 'Workspace name or ID to select directly')
|
|
37
|
-
.option('--owner <name>', 'Filter workspaces by owner name (case-insensitive)')
|
|
38
|
-
.action(async (workspaceArg, options = {}) => {
|
|
39
|
-
const output = createOutputWriter();
|
|
40
|
-
const ownerFilter = options.owner;
|
|
41
|
-
try {
|
|
42
|
-
const client = new GuildAPIClient();
|
|
43
|
-
// If a workspace argument was provided, use server-side search to find it
|
|
44
|
-
if (workspaceArg) {
|
|
45
|
-
// Use search param to narrow results server-side, then exact-match client-side.
|
|
46
|
-
// The backend searches only the "name" column via ILIKE, so full_name (owner/name)
|
|
47
|
-
// and ID lookups may not return results. Extract just the name part for search,
|
|
48
|
-
// and if still no match, fall back to fetching the full list.
|
|
49
|
-
// Always use filter=all — the backend's `filter` param only recognises "all"
|
|
50
|
-
// vs personal; owner-name filtering is applied client-side below.
|
|
51
|
-
const searchTerm = workspaceArg.includes('/')
|
|
52
|
-
? (workspaceArg.split('/').pop() ?? workspaceArg)
|
|
53
|
-
: workspaceArg;
|
|
54
|
-
const searchResults = await client.get(`/me/workspaces?filter=all&search=${encodeURIComponent(searchTerm)}&limit=100`);
|
|
55
|
-
let candidates = searchResults.items;
|
|
56
|
-
// Apply client-side owner filter on search results
|
|
57
|
-
if (ownerFilter) {
|
|
58
|
-
candidates = candidates.filter((w) => w.owner?.name?.toLowerCase() === ownerFilter.toLowerCase());
|
|
59
|
-
}
|
|
60
|
-
// Search didn't find it (could be an ID lookup, or search term didn't match).
|
|
61
|
-
// Fall back to fetching all workspaces via pagination.
|
|
62
|
-
const directMatch = candidates.find((w) => matchesWorkspaceArg(w, workspaceArg));
|
|
63
|
-
if (!directMatch) {
|
|
64
|
-
const allWorkspaces = await client.fetchAll('/me/workspaces?filter=all');
|
|
65
|
-
candidates = ownerFilter
|
|
66
|
-
? allWorkspaces.filter((w) => w.owner?.name?.toLowerCase() === ownerFilter.toLowerCase())
|
|
67
|
-
: allWorkspaces;
|
|
68
|
-
}
|
|
69
|
-
const workspace = candidates.find((w) => matchesWorkspaceArg(w, workspaceArg));
|
|
70
|
-
if (!workspace) {
|
|
71
|
-
if (ownerFilter) {
|
|
72
|
-
output.error(`Workspace "${workspaceArg}" not found for owner "${ownerFilter}".`, 'Run: guild workspace list');
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
output.error(`Workspace "${workspaceArg}" not found.`, 'Run: guild workspace list');
|
|
76
|
-
}
|
|
77
|
-
process.exit(1);
|
|
78
|
-
}
|
|
79
|
-
const target = await saveWorkspaceConfig(workspace.id, workspace.name);
|
|
80
|
-
if (target === 'local') {
|
|
81
|
-
output.success(`Workspace set for this agent: ${formatWorkspaceDisplay(workspace)}`);
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
output.success(`Default workspace set to: ${formatWorkspaceDisplay(workspace)}`);
|
|
85
|
-
output.progress('To clear the default, run: guild workspace clear');
|
|
86
|
-
}
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
if (!isInteractive()) {
|
|
90
|
-
output.error('Interactive mode requires a terminal.', 'Provide a workspace argument:\n guild workspace select <name|id>');
|
|
91
|
-
process.exit(1);
|
|
92
|
-
}
|
|
93
|
-
// Interactive mode: fetch all workspaces across all pages.
|
|
94
|
-
// Always use filter=all; owner-name filtering is applied client-side
|
|
95
|
-
// (the backend's `filter` param only recognises "all" vs personal).
|
|
96
|
-
let workspaces = await client.fetchAll('/me/workspaces?filter=all');
|
|
97
|
-
if (ownerFilter) {
|
|
98
|
-
workspaces = workspaces.filter((w) => w.owner?.name?.toLowerCase() === ownerFilter.toLowerCase());
|
|
99
|
-
}
|
|
100
|
-
if (workspaces.length === 0) {
|
|
101
|
-
if (ownerFilter) {
|
|
102
|
-
output.error(`No workspaces found for owner "${ownerFilter}".`, 'Run: guild workspace list');
|
|
103
|
-
}
|
|
104
|
-
else {
|
|
105
|
-
output.error('No workspaces found.', 'Create a workspace first:\n guild workspace create <name>');
|
|
106
|
-
}
|
|
107
|
-
process.exit(1);
|
|
108
|
-
}
|
|
109
|
-
// Resolve the currently selected workspace (if any)
|
|
110
|
-
const current = await getWorkspaceId();
|
|
111
|
-
const currentId = current?.workspaceId;
|
|
112
|
-
// Interactive searchable selection
|
|
113
|
-
const { default: search } = await import('@inquirer/search');
|
|
114
|
-
const selectedId = await search({
|
|
115
|
-
message: 'Select a workspace (type to filter)',
|
|
116
|
-
pageSize: 15,
|
|
117
|
-
source: (input) => {
|
|
118
|
-
const term = input?.toLowerCase() ?? '';
|
|
119
|
-
const filtered = term
|
|
120
|
-
? workspaces.filter((w) => w.name.toLowerCase().includes(term) ||
|
|
121
|
-
w.full_name?.toLowerCase().includes(term) ||
|
|
122
|
-
w.owner?.name.toLowerCase().includes(term))
|
|
123
|
-
: workspaces;
|
|
124
|
-
return filtered.map((w) => ({
|
|
125
|
-
name: formatWorkspaceDisplay(w) + (w.id === currentId ? ' (current)' : ''),
|
|
126
|
-
value: w.id,
|
|
127
|
-
short: w.name,
|
|
128
|
-
}));
|
|
129
|
-
},
|
|
130
|
-
});
|
|
131
|
-
const selectedWorkspace = workspaces.find((w) => w.id === selectedId);
|
|
132
|
-
if (!selectedWorkspace) {
|
|
133
|
-
output.error('Selected workspace not found');
|
|
134
|
-
process.exit(1);
|
|
135
|
-
}
|
|
136
|
-
const target = await saveWorkspaceConfig(selectedWorkspace.id, selectedWorkspace.name);
|
|
137
|
-
if (target === 'local') {
|
|
138
|
-
output.success(`Workspace set for this agent: ${formatWorkspaceDisplay(selectedWorkspace)}`);
|
|
139
|
-
}
|
|
140
|
-
else {
|
|
141
|
-
output.success(`Default workspace set to: ${formatWorkspaceDisplay(selectedWorkspace)}`);
|
|
142
|
-
output.progress('To clear the default, run: guild workspace clear');
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
catch (error) {
|
|
146
|
-
const formattedError = handleAxiosError(error);
|
|
147
|
-
if (formattedError.code === ErrorCodes.AUTH_REQUIRED) {
|
|
148
|
-
output.error('Not authenticated. Please log in first.', 'Run: guild auth login');
|
|
149
|
-
process.exit(1);
|
|
150
|
-
}
|
|
151
|
-
if (formattedError.code === ErrorCodes.CONN_REFUSED) {
|
|
152
|
-
output.error(`Failed to fetch workspaces: ${formattedError.details}`, 'Run with --debug for more details');
|
|
153
|
-
process.exit(1);
|
|
154
|
-
}
|
|
155
|
-
output.error(`Failed to select workspace: ${formattedError.details}`);
|
|
156
|
-
process.exit(1);
|
|
157
|
-
}
|
|
158
|
-
});
|
|
159
|
-
return cmd;
|
|
160
|
-
}
|
|
161
|
-
/**
|
|
162
|
-
* Save workspace config to the appropriate location.
|
|
163
|
-
*
|
|
164
|
-
* - In agent directory (has guild.json): writes workspace_id to guild.json
|
|
165
|
-
* - Not in agent directory: writes default_workspace to ~/.guild/config.json
|
|
166
|
-
*
|
|
167
|
-
* @returns 'local' if written to guild.json, 'global' if written to global config
|
|
168
|
-
*/
|
|
169
|
-
async function saveWorkspaceConfig(workspaceId, workspaceName) {
|
|
170
|
-
if (await isAgentDirectory()) {
|
|
171
|
-
// In agent directory: write workspace_id to guild.json
|
|
172
|
-
const localConfig = (await loadLocalConfig()) || { agent_id: '', name: '' };
|
|
173
|
-
const updated = { ...localConfig, workspace_id: workspaceId };
|
|
174
|
-
await fs.writeFile(getLocalConfigPath(), JSON.stringify(updated, null, 2) + '\n');
|
|
175
|
-
return 'local';
|
|
176
|
-
}
|
|
177
|
-
// Not in agent directory: write to global config
|
|
178
|
-
await saveGlobalConfig({
|
|
179
|
-
default_workspace: workspaceId,
|
|
180
|
-
default_workspace_name: workspaceName,
|
|
181
|
-
});
|
|
182
|
-
return 'global';
|
|
183
|
-
}
|
|
184
|
-
//# sourceMappingURL=select.js.map
|