@guildai/cli 0.9.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/dist/commands/agent/chat.d.ts +1 -0
  2. package/dist/commands/agent/chat.js +24 -1
  3. package/dist/commands/agent/fork.js +1 -0
  4. package/dist/commands/agent/init.js +2 -1
  5. package/dist/commands/agent/list.js +3 -2
  6. package/dist/commands/agent/pull.js +1 -1
  7. package/dist/commands/agent/save.js +4 -4
  8. package/dist/commands/agent/search.js +3 -2
  9. package/dist/commands/agent/test.d.ts +1 -0
  10. package/dist/commands/agent/test.js +92 -34
  11. package/dist/commands/agent/versions.js +3 -2
  12. package/dist/commands/agent/workspaces.js +3 -2
  13. package/dist/commands/chat.d.ts +10 -0
  14. package/dist/commands/chat.js +215 -50
  15. package/dist/commands/credentials/endpoint-list.js +3 -2
  16. package/dist/commands/credentials/list.js +3 -2
  17. package/dist/commands/credentials/policy-list.js +3 -2
  18. package/dist/commands/integration/connect.js +1 -1
  19. package/dist/commands/integration/create.js +36 -36
  20. package/dist/commands/integration/list.js +3 -2
  21. package/dist/commands/integration/operation/create.js +2 -1
  22. package/dist/commands/integration/operation/list.js +26 -17
  23. package/dist/commands/integration/version/list.js +3 -2
  24. package/dist/commands/mcp.js +1 -1
  25. package/dist/commands/session/create.js +1 -1
  26. package/dist/commands/session/events.js +19 -9
  27. package/dist/commands/session/list.js +3 -2
  28. package/dist/commands/session/send.js +1 -1
  29. package/dist/commands/session/tasks.js +3 -2
  30. package/dist/commands/trigger/list.js +3 -2
  31. package/dist/commands/trigger/sessions.js +3 -2
  32. package/dist/commands/workspace/agent/add.js +16 -3
  33. package/dist/commands/workspace/agent/list.js +17 -3
  34. package/dist/commands/workspace/agent/remove.js +14 -1
  35. package/dist/commands/workspace/clear.d.ts +3 -0
  36. package/dist/commands/workspace/clear.js +45 -0
  37. package/dist/commands/workspace/context/list.js +3 -2
  38. package/dist/commands/workspace/list.js +3 -2
  39. package/dist/commands/workspace/select.js +3 -1
  40. package/dist/index.js +53 -6
  41. package/dist/lib/api-types.d.ts +5 -0
  42. package/dist/lib/api-types.js +4 -0
  43. package/dist/lib/generated-types.d.ts +1 -1
  44. package/dist/lib/generated-types.js +1 -0
  45. package/dist/lib/guild-config.d.ts +13 -0
  46. package/dist/lib/guild-config.js +19 -0
  47. package/dist/lib/npmrc.js +6 -2
  48. package/dist/lib/output.js +4 -4
  49. package/dist/lib/owner-helpers.d.ts +3 -0
  50. package/dist/lib/owner-helpers.js +17 -10
  51. package/dist/lib/session-events.d.ts +32 -16
  52. package/dist/lib/session-events.js +22 -0
  53. package/dist/lib/session-polling.d.ts +4 -3
  54. package/dist/lib/session-polling.js +75 -17
  55. package/dist/lib/session-resume.js +4 -1
  56. package/dist/lib/stdin.d.ts +4 -0
  57. package/dist/lib/stdin.js +23 -0
  58. package/dist/lib/validate-input-schema.d.ts +19 -0
  59. package/dist/lib/validate-input-schema.js +208 -0
  60. package/dist/lib/workspace-helpers.d.ts +20 -0
  61. package/dist/lib/workspace-helpers.js +49 -0
  62. package/dist/mcp/tools.js +8 -52
  63. package/docs/skills/agent-dev.md +191 -128
  64. package/package.json +2 -1
@@ -9,14 +9,15 @@ import { getOutputMode } from '../../../lib/output-mode.js';
9
9
  import { createOutputWriter } from '../../../lib/output.js';
10
10
  import { resolveVersionId } from '../../../lib/integration-helpers.js';
11
11
  import { Table } from '../../../lib/table.js';
12
+ import { DEFAULT_PAGE_LIMIT_LARGE } from '../../../lib/api-types.js';
12
13
  export function createIntegrationOperationListCommand() {
13
14
  const cmd = new Command('list');
14
15
  cmd
15
16
  .description('List operations for an integration version')
16
17
  .argument('<id_or_name>', 'Integration ID or name (owner~name)')
17
18
  .option('--version-number <semver>', 'Specific version, e.g. 1.0.0')
18
- .option('--limit <number>', 'Number of results to return', '100')
19
- .option('--offset <number>', 'Offset for pagination', '0')
19
+ .option('--limit <number>', `Number of results to return (default: ${DEFAULT_PAGE_LIMIT_LARGE})`, String(DEFAULT_PAGE_LIMIT_LARGE))
20
+ .option('--offset <number>', 'Offset for pagination (default: 0)', '0')
20
21
  .action(async (identifier, options) => {
21
22
  const output = createOutputWriter();
22
23
  try {
@@ -41,24 +42,32 @@ export function createIntegrationOperationListCommand() {
41
42
  }
42
43
  console.log(chalk.bold('Operations'));
43
44
  console.log();
45
+ const isMcp = response.items.some((ep) => !ep.method);
44
46
  const table = new Table({
45
- columns: [
46
- { name: 'operation', title: 'OPERATION', alignment: 'left' },
47
- {
48
- name: 'method',
49
- title: 'METHOD',
50
- alignment: 'left',
51
- color: 'cyan',
52
- },
53
- { name: 'path', title: 'PATH', alignment: 'left' },
54
- ],
47
+ columns: isMcp
48
+ ? [
49
+ { name: 'operation', title: 'OPERATION', alignment: 'left' },
50
+ { name: 'description', title: 'DESCRIPTION', alignment: 'left' },
51
+ ]
52
+ : [
53
+ { name: 'operation', title: 'OPERATION', alignment: 'left' },
54
+ {
55
+ name: 'method',
56
+ title: 'METHOD',
57
+ alignment: 'left',
58
+ color: 'cyan',
59
+ },
60
+ { name: 'path', title: 'PATH', alignment: 'left' },
61
+ ],
55
62
  });
56
63
  response.items.forEach((ep) => {
57
- table.addRow({
58
- operation: ep.operation,
59
- method: ep.method,
60
- path: ep.path,
61
- });
64
+ table.addRow(isMcp
65
+ ? { operation: ep.operation, description: ep.description ?? '' }
66
+ : {
67
+ operation: ep.operation,
68
+ method: ep.method ?? '',
69
+ path: ep.path ?? '',
70
+ });
62
71
  });
63
72
  table.printTable();
64
73
  const showing = Math.min(response.pagination.limit, response.items.length);
@@ -6,13 +6,14 @@ import { getAuthToken } from '../../../lib/auth.js';
6
6
  import { handleAxiosError } from '../../../lib/errors.js';
7
7
  import { getOutputMode } from '../../../lib/output-mode.js';
8
8
  import { createOutputWriter, formatIntegrationVersionTable, } from '../../../lib/output.js';
9
+ import { DEFAULT_PAGE_LIMIT } from '../../../lib/api-types.js';
9
10
  export function createIntegrationVersionListCommand() {
10
11
  const cmd = new Command('list');
11
12
  cmd
12
13
  .description('List integration versions')
13
14
  .argument('<id_or_name>', 'Integration ID or name')
14
- .option('--limit <number>', 'Number of results to return', '20')
15
- .option('--offset <number>', 'Offset for pagination', '0')
15
+ .option('--limit <number>', `Number of results to return (default: ${DEFAULT_PAGE_LIMIT})`, String(DEFAULT_PAGE_LIMIT))
16
+ .option('--offset <number>', 'Offset for pagination (default: 0)', '0')
16
17
  .action(async (identifier, options) => {
17
18
  const output = createOutputWriter();
18
19
  try {
@@ -1,7 +1,6 @@
1
1
  // Copyright 2026 Guild.ai
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  import { Command } from 'commander';
4
- import { startMcpServer } from '../mcp/server.js';
5
4
  export function createMcpCommand() {
6
5
  const cmd = new Command('mcp');
7
6
  cmd
@@ -24,6 +23,7 @@ Configuration:
24
23
  Or run: guild setup --mcp
25
24
  `)
26
25
  .action(async (options) => {
26
+ const { startMcpServer } = await import('../mcp/server.js');
27
27
  await startMcpServer({
28
28
  workspace: options.workspace,
29
29
  debug: options.debug,
@@ -11,7 +11,7 @@ export function createSessionCreateCommand() {
11
11
  cmd
12
12
  .description('Create a new session')
13
13
  .option('--workspace <id>', 'Workspace ID or name (e.g., owner~workspace-name)')
14
- .option('--type <type>', 'Session type: chat or agent_test', 'chat')
14
+ .option('--type <type>', 'Session type: chat or agent_test (default: chat)', 'chat')
15
15
  .option('--prompt <text>', 'Initial prompt (required for chat sessions)')
16
16
  .option('--agent <identifier>', 'Agent identifier, e.g., owner~agent-name')
17
17
  .action(async (options) => {
@@ -3,7 +3,8 @@
3
3
  import { Command } from 'commander';
4
4
  import { GuildAPIClient } from '../../lib/api-client.js';
5
5
  import { getAuthToken } from '../../lib/auth.js';
6
- import { parseEventFilter } from '../../lib/event-filter.js';
6
+ import { parseEventFilter, DEFAULT_EVENT_TYPES, USER_EVENT_TYPES, SYSTEM_EVENT_TYPES, } from '../../lib/event-filter.js';
7
+ import { DEFAULT_PAGE_LIMIT_LARGE } from '../../lib/api-types.js';
7
8
  import { handleAxiosError } from '../../lib/errors.js';
8
9
  import { createOutputWriter } from '../../lib/output.js';
9
10
  export function createSessionEventsCommand() {
@@ -11,9 +12,18 @@ export function createSessionEventsCommand() {
11
12
  cmd
12
13
  .description('List events in a session')
13
14
  .argument('<session-id>', 'Session ID')
14
- .option('--events <types>', 'Event types to show. Shorthands: none, user, system, all, or comma-separated type names')
15
- .option('--limit <number>', 'Number of results to return', '100')
16
- .option('--offset <number>', 'Offset for pagination', '0')
15
+ .option('--events <types>', 'Event types to show (default: user). Shorthands: none, user, system, all, or comma-separated type names')
16
+ .option('--limit <number>', `Number of results to return (default: ${DEFAULT_PAGE_LIMIT_LARGE})`, String(DEFAULT_PAGE_LIMIT_LARGE))
17
+ .option('--offset <number>', 'Offset for pagination (default: 0)', '0')
18
+ .addHelpText('after', [
19
+ '',
20
+ 'Available event types:',
21
+ ' User events (shown by default):',
22
+ ` ${USER_EVENT_TYPES.join(', ')}`,
23
+ '',
24
+ ' System / debug events:',
25
+ ` ${SYSTEM_EVENT_TYPES.join(', ')}`,
26
+ ].join('\n'))
17
27
  .action(async (sessionId, options) => {
18
28
  const output = createOutputWriter();
19
29
  try {
@@ -26,11 +36,11 @@ export function createSessionEventsCommand() {
26
36
  const params = new URLSearchParams();
27
37
  params.append('limit', options.limit);
28
38
  params.append('offset', options.offset);
29
- if (options.events) {
30
- const filter = parseEventFilter(options.events);
31
- if (filter.size > 0) {
32
- params.append('types', [...filter].join(','));
33
- }
39
+ const rawFilter = options.events
40
+ ? parseEventFilter(options.events)
41
+ : DEFAULT_EVENT_TYPES;
42
+ if (rawFilter.size > 0) {
43
+ params.append('types', [...rawFilter].join(','));
34
44
  }
35
45
  const response = await client.get(`/sessions/${sessionId}/events?${params.toString()}`);
36
46
  output.data(response);
@@ -7,14 +7,15 @@ import { getWorkspaceId } from '../../lib/guild-config.js';
7
7
  import { handleAxiosError } from '../../lib/errors.js';
8
8
  import { getOutputMode } from '../../lib/output-mode.js';
9
9
  import { createOutputWriter, formatSessionTable } from '../../lib/output.js';
10
+ import { DEFAULT_PAGE_LIMIT } from '../../lib/api-types.js';
10
11
  export function createSessionListCommand() {
11
12
  const cmd = new Command('list');
12
13
  cmd
13
14
  .description('List sessions in a workspace')
14
15
  .option('--workspace <id>', 'Workspace ID or name (e.g., owner~workspace-name)')
15
16
  .option('--type <type>', 'Filter by session type: chat, webhook, time, agent_test')
16
- .option('--limit <number>', 'Number of results to return', '20')
17
- .option('--offset <number>', 'Offset for pagination', '0')
17
+ .option('--limit <number>', `Number of results to return (default: ${DEFAULT_PAGE_LIMIT})`, String(DEFAULT_PAGE_LIMIT))
18
+ .option('--offset <number>', 'Offset for pagination (default: 0)', '0')
18
19
  .action(async (options) => {
19
20
  const output = createOutputWriter();
20
21
  try {
@@ -8,7 +8,7 @@ import { createOutputWriter } from '../../lib/output.js';
8
8
  export function createSessionSendCommand() {
9
9
  const cmd = new Command('send');
10
10
  cmd
11
- .description('Send a message or event to a session')
11
+ .description('Send a user message to a session')
12
12
  .argument('<session-id>', 'Session ID')
13
13
  .option('--message <text>', 'Text message content')
14
14
  .option('--json <json>', 'JSON content object (sets mode to json)')
@@ -6,13 +6,14 @@ import { getAuthToken } from '../../lib/auth.js';
6
6
  import { handleAxiosError } from '../../lib/errors.js';
7
7
  import { getOutputMode } from '../../lib/output-mode.js';
8
8
  import { createOutputWriter, formatTaskTable } from '../../lib/output.js';
9
+ import { DEFAULT_PAGE_LIMIT_LARGE } from '../../lib/api-types.js';
9
10
  export function createSessionTasksCommand() {
10
11
  const cmd = new Command('tasks');
11
12
  cmd
12
13
  .description('List tasks in a session')
13
14
  .argument('<session-id>', 'Session ID')
14
- .option('--limit <number>', 'Number of results to return', '100')
15
- .option('--offset <number>', 'Offset for pagination', '0')
15
+ .option('--limit <number>', `Number of results to return (default: ${DEFAULT_PAGE_LIMIT_LARGE})`, String(DEFAULT_PAGE_LIMIT_LARGE))
16
+ .option('--offset <number>', 'Offset for pagination (default: 0)', '0')
16
17
  .action(async (sessionId, options) => {
17
18
  const output = createOutputWriter();
18
19
  try {
@@ -7,13 +7,14 @@ import { getWorkspaceId } from '../../lib/guild-config.js';
7
7
  import { handleAxiosError } from '../../lib/errors.js';
8
8
  import { getOutputMode } from '../../lib/output-mode.js';
9
9
  import { createOutputWriter, formatTriggerTable } from '../../lib/output.js';
10
+ import { DEFAULT_PAGE_LIMIT } from '../../lib/api-types.js';
10
11
  export function createTriggerListCommand() {
11
12
  const cmd = new Command('list');
12
13
  cmd
13
14
  .description('List all triggers in a workspace')
14
15
  .option('--workspace <id>', 'Workspace ID or name')
15
- .option('--limit <number>', 'Number of results to return', '20')
16
- .option('--offset <number>', 'Offset for pagination', '0')
16
+ .option('--limit <number>', `Number of results to return (default: ${DEFAULT_PAGE_LIMIT})`, String(DEFAULT_PAGE_LIMIT))
17
+ .option('--offset <number>', 'Offset for pagination (default: 0)', '0')
17
18
  .action(async (options) => {
18
19
  const output = createOutputWriter();
19
20
  try {
@@ -5,13 +5,14 @@ import { GuildAPIClient } from '../../lib/api-client.js';
5
5
  import { getAuthToken } from '../../lib/auth.js';
6
6
  import { handleAxiosError, ErrorCodes } from '../../lib/errors.js';
7
7
  import { createOutputWriter } from '../../lib/output.js';
8
+ import { DEFAULT_PAGE_LIMIT } from '../../lib/api-types.js';
8
9
  export function createTriggerSessionsCommand() {
9
10
  const cmd = new Command('sessions');
10
11
  cmd
11
12
  .description('List sessions spawned by a trigger')
12
13
  .argument('<trigger-id>', 'Trigger ID')
13
- .option('--limit <number>', 'Number of results to return', '20')
14
- .option('--offset <number>', 'Offset for pagination', '0')
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')
15
16
  .action(async (triggerId, options) => {
16
17
  const output = createOutputWriter();
17
18
  try {
@@ -6,13 +6,14 @@ import { getAuthToken } from '../../../lib/auth.js';
6
6
  import { getWorkspaceId } from '../../../lib/guild-config.js';
7
7
  import { handleAxiosError, ErrorCodes } from '../../../lib/errors.js';
8
8
  import { createOutputWriter } from '../../../lib/output.js';
9
+ import { resolveWorkspaceId } from '../../../lib/workspace-helpers.js';
9
10
  export function createWorkspaceAgentAddCommand() {
10
11
  const cmd = new Command('add');
11
12
  cmd
12
13
  .description('Add an agent to a workspace')
13
14
  .argument('<agent>', 'Agent identifier (e.g., owner~agent-name or UUID)')
14
- .option('--workspace <id>', 'Target workspace ID or name')
15
- .option('--no-autoupdate', 'Disable automatic updates for this agent')
15
+ .option('--workspace <id>', 'Workspace ID or name')
16
+ .option('--no-autoupdate', 'Disable automatic updates for this agent (default: autoupdate enabled)')
16
17
  .action(async (agentIdentifier, options) => {
17
18
  const output = createOutputWriter();
18
19
  try {
@@ -24,7 +25,19 @@ export function createWorkspaceAgentAddCommand() {
24
25
  const client = new GuildAPIClient();
25
26
  // Resolve workspace
26
27
  let workspaceId = options.workspace;
27
- if (!workspaceId) {
28
+ if (workspaceId) {
29
+ try {
30
+ workspaceId = await resolveWorkspaceId(client, workspaceId);
31
+ }
32
+ catch (err) {
33
+ if (err instanceof Error && err.message.startsWith('Workspace "')) {
34
+ output.error('Workspace not found');
35
+ process.exit(1);
36
+ }
37
+ throw err; // let the outer catch handle network/auth errors via handleAxiosError
38
+ }
39
+ }
40
+ else {
28
41
  const resolved = await getWorkspaceId();
29
42
  if (!resolved) {
30
43
  output.error('No workspace specified.', 'Either use --workspace flag:\n guild workspace agent add <agent> --workspace <workspace-id>\n\nOr select a default workspace:\n guild workspace select');
@@ -7,13 +7,15 @@ import { getWorkspaceId } from '../../../lib/guild-config.js';
7
7
  import { handleAxiosError, ErrorCodes } from '../../../lib/errors.js';
8
8
  import { createOutputWriter, formatWorkspaceAgentTable } from '../../../lib/output.js';
9
9
  import { getOutputMode } from '../../../lib/output-mode.js';
10
+ import { resolveWorkspaceId } from '../../../lib/workspace-helpers.js';
11
+ import { DEFAULT_PAGE_LIMIT } from '../../../lib/api-types.js';
10
12
  export function createWorkspaceAgentListCommand() {
11
13
  const cmd = new Command('list');
12
14
  cmd
13
15
  .description('List agents in a workspace')
14
16
  .option('--workspace <id>', 'Workspace ID or name')
15
- .option('--limit <number>', 'Number of results to return', '20')
16
- .option('--offset <number>', 'Offset for pagination', '0')
17
+ .option('--limit <number>', `Number of results to return (default: ${DEFAULT_PAGE_LIMIT})`, String(DEFAULT_PAGE_LIMIT))
18
+ .option('--offset <number>', 'Offset for pagination (default: 0)', '0')
17
19
  .action(async (options) => {
18
20
  const output = createOutputWriter();
19
21
  try {
@@ -25,7 +27,19 @@ export function createWorkspaceAgentListCommand() {
25
27
  const client = new GuildAPIClient();
26
28
  // Resolve workspace
27
29
  let workspaceId = options.workspace;
28
- if (!workspaceId) {
30
+ if (workspaceId) {
31
+ try {
32
+ workspaceId = await resolveWorkspaceId(client, workspaceId);
33
+ }
34
+ catch (err) {
35
+ if (err instanceof Error && err.message.startsWith('Workspace "')) {
36
+ output.error('Workspace not found');
37
+ process.exit(1);
38
+ }
39
+ throw err; // let the outer catch handle network/auth errors via handleAxiosError
40
+ }
41
+ }
42
+ else {
29
43
  const resolved = await getWorkspaceId();
30
44
  if (!resolved) {
31
45
  output.error('No workspace specified.', 'Either use --workspace flag:\n guild workspace agent list --workspace <workspace-id>\n\nOr select a default workspace:\n guild workspace select');
@@ -6,6 +6,7 @@ import { getAuthToken } from '../../../lib/auth.js';
6
6
  import { getWorkspaceId } from '../../../lib/guild-config.js';
7
7
  import { handleAxiosError, ErrorCodes } from '../../../lib/errors.js';
8
8
  import { createOutputWriter } from '../../../lib/output.js';
9
+ import { resolveWorkspaceId } from '../../../lib/workspace-helpers.js';
9
10
  export function createWorkspaceAgentRemoveCommand() {
10
11
  const cmd = new Command('remove');
11
12
  cmd
@@ -23,7 +24,19 @@ export function createWorkspaceAgentRemoveCommand() {
23
24
  const client = new GuildAPIClient();
24
25
  // Resolve workspace
25
26
  let workspaceId = options.workspace;
26
- if (!workspaceId) {
27
+ if (workspaceId) {
28
+ try {
29
+ workspaceId = await resolveWorkspaceId(client, workspaceId);
30
+ }
31
+ catch (err) {
32
+ if (err instanceof Error && err.message.startsWith('Workspace "')) {
33
+ output.error('Workspace not found');
34
+ process.exit(1);
35
+ }
36
+ throw err; // let the outer catch handle network/auth errors via handleAxiosError
37
+ }
38
+ }
39
+ else {
27
40
  const resolved = await getWorkspaceId();
28
41
  if (!resolved) {
29
42
  output.error('No workspace specified.', 'Either use --workspace flag:\n guild workspace agent remove <agent> --workspace <workspace-id>\n\nOr select a default workspace:\n guild workspace select');
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function createWorkspaceClearCommand(): Command;
3
+ //# sourceMappingURL=clear.d.ts.map
@@ -0,0 +1,45 @@
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 { createOutputWriter } from '../../lib/output.js';
6
+ import { isAgentDirectory, loadLocalConfig, getLocalConfigPath, loadGlobalConfig, getGlobalConfigDir, getGlobalConfigPath, } from '../../lib/guild-config.js';
7
+ export function createWorkspaceClearCommand() {
8
+ const cmd = new Command('clear');
9
+ cmd.description('Clear the default workspace setting').action(async () => {
10
+ const output = createOutputWriter();
11
+ try {
12
+ if (await isAgentDirectory()) {
13
+ // In agent directory: remove workspace_id from guild.json
14
+ const localConfig = await loadLocalConfig();
15
+ if (!localConfig || !('workspace_id' in localConfig)) {
16
+ output.progress('No default workspace was set.');
17
+ return;
18
+ }
19
+ const { workspace_id: _removed, ...updated } = localConfig;
20
+ await fs.writeFile(getLocalConfigPath(), JSON.stringify(updated, null, 2) + '\n');
21
+ output.success('Cleared workspace setting for this agent');
22
+ return;
23
+ }
24
+ // Not in agent directory: remove default_workspace from global config
25
+ const globalConfig = await loadGlobalConfig();
26
+ if (!globalConfig ||
27
+ (!('default_workspace' in globalConfig) &&
28
+ !('default_workspace_name' in globalConfig))) {
29
+ output.progress('No default workspace was set.');
30
+ return;
31
+ }
32
+ const { default_workspace: _ws, default_workspace_name: _wsName, ...rest } = globalConfig;
33
+ await fs.mkdir(getGlobalConfigDir(), { recursive: true });
34
+ await fs.writeFile(getGlobalConfigPath(), JSON.stringify(rest, null, 2) + '\n');
35
+ output.success('Default workspace cleared');
36
+ }
37
+ catch (error) {
38
+ const message = error instanceof Error ? error.message : String(error);
39
+ output.error(`Failed to clear workspace: ${message}`);
40
+ process.exit(1);
41
+ }
42
+ });
43
+ return cmd;
44
+ }
45
+ //# sourceMappingURL=clear.js.map
@@ -5,13 +5,14 @@ import { GuildAPIClient } from '../../../lib/api-client.js';
5
5
  import { handleAxiosError, ErrorCodes } from '../../../lib/errors.js';
6
6
  import { getOutputMode } from '../../../lib/output-mode.js';
7
7
  import { createOutputWriter, formatContextTable } from '../../../lib/output.js';
8
+ import { DEFAULT_PAGE_LIMIT } from '../../../lib/api-types.js';
8
9
  export function createWorkspaceContextListCommand() {
9
10
  const cmd = new Command('list');
10
11
  cmd
11
12
  .description('List context versions for a workspace')
12
13
  .argument('<workspace>', 'Workspace ID or full name (e.g., owner/workspace-name)')
13
- .option('--limit <number>', 'Number of results to return', '20')
14
- .option('--offset <number>', 'Offset for pagination', '0')
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')
15
16
  .action(async (workspaceId, options) => {
16
17
  const output = createOutputWriter();
17
18
  try {
@@ -5,12 +5,13 @@ import { GuildAPIClient } from '../../lib/api-client.js';
5
5
  import { handleAxiosError, ErrorCodes } from '../../lib/errors.js';
6
6
  import { getOutputMode } from '../../lib/output-mode.js';
7
7
  import { createOutputWriter, formatWorkspaceTable } from '../../lib/output.js';
8
+ import { DEFAULT_PAGE_LIMIT } from '../../lib/api-types.js';
8
9
  export function createWorkspaceListCommand() {
9
10
  const cmd = new Command('list');
10
11
  cmd
11
12
  .description('List workspaces')
12
- .option('--limit <number>', 'Number of results to return', '20')
13
- .option('--offset <number>', 'Offset for pagination', '0')
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')
14
15
  .option('--owner <name>', 'Filter workspaces by owner name (case-insensitive)')
15
16
  .action(async (options) => {
16
17
  const output = createOutputWriter();
@@ -2,7 +2,6 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  import { Command } from 'commander';
4
4
  import * as fs from 'fs/promises';
5
- import search from '@inquirer/search';
6
5
  import { GuildAPIClient } from '../../lib/api-client.js';
7
6
  import { handleAxiosError, ErrorCodes } from '../../lib/errors.js';
8
7
  import { createOutputWriter } from '../../lib/output.js';
@@ -83,6 +82,7 @@ export function createWorkspaceSelectCommand() {
83
82
  }
84
83
  else {
85
84
  output.success(`Default workspace set to: ${formatWorkspaceDisplay(workspace)}`);
85
+ output.progress('To clear the default, run: guild workspace clear');
86
86
  }
87
87
  return;
88
88
  }
@@ -110,6 +110,7 @@ export function createWorkspaceSelectCommand() {
110
110
  const current = await getWorkspaceId();
111
111
  const currentId = current?.workspaceId;
112
112
  // Interactive searchable selection
113
+ const { default: search } = await import('@inquirer/search');
113
114
  const selectedId = await search({
114
115
  message: 'Select a workspace (type to filter)',
115
116
  pageSize: 15,
@@ -138,6 +139,7 @@ export function createWorkspaceSelectCommand() {
138
139
  }
139
140
  else {
140
141
  output.success(`Default workspace set to: ${formatWorkspaceDisplay(selectedWorkspace)}`);
142
+ output.progress('To clear the default, run: guild workspace clear');
141
143
  }
142
144
  }
143
145
  catch (error) {
package/dist/index.js CHANGED
@@ -17,12 +17,10 @@ import { createAgentVersionsCommand } from './commands/agent/versions.js';
17
17
  import { createAgentSaveCommand } from './commands/agent/save.js';
18
18
  import { createAgentPullCommand } from './commands/agent/pull.js';
19
19
  import { createAgentCodeCommand } from './commands/agent/code.js';
20
- import { createAgentChatCommand } from './commands/agent/chat.js';
21
20
  import { createAgentInitCommand } from './commands/agent/init.js';
22
21
  import { createAgentGrepCommand } from './commands/agent/grep.js';
23
22
  import { createAgentCloneCommand } from './commands/agent/clone.js';
24
23
  import { createAgentForkCommand } from './commands/agent/fork.js';
25
- import { createAgentTestCommand } from './commands/agent/test.js';
26
24
  import { createAgentPublishCommand } from './commands/agent/publish.js';
27
25
  import { createAgentUnpublishCommand } from './commands/agent/unpublish.js';
28
26
  import { createAgentRevalidateCommand } from './commands/agent/revalidate.js';
@@ -33,12 +31,12 @@ import { createAgentTagsListCommand } from './commands/agent/tags/list.js';
33
31
  import { createAgentTagsAddCommand } from './commands/agent/tags/add.js';
34
32
  import { createAgentTagsRemoveCommand } from './commands/agent/tags/remove.js';
35
33
  import { createAgentTagsSetCommand } from './commands/agent/tags/set.js';
36
- import { createChatCommand } from './commands/chat.js';
37
34
  import { createWorkspaceListCommand } from './commands/workspace/list.js';
38
35
  import { createWorkspaceCreateCommand } from './commands/workspace/create.js';
39
36
  import { createWorkspaceGetCommand } from './commands/workspace/get.js';
40
37
  import { createWorkspaceSelectCommand } from './commands/workspace/select.js';
41
38
  import { createWorkspaceCurrentCommand } from './commands/workspace/current.js';
39
+ import { createWorkspaceClearCommand } from './commands/workspace/clear.js';
42
40
  import { createWorkspaceAgentAddCommand } from './commands/workspace/agent/add.js';
43
41
  import { createWorkspaceAgentListCommand } from './commands/workspace/agent/list.js';
44
42
  import { createWorkspaceAgentRemoveCommand } from './commands/workspace/agent/remove.js';
@@ -130,7 +128,23 @@ program
130
128
  });
131
129
  // Register commands
132
130
  program.addCommand(createVersionCommand());
133
- program.addCommand(createChatCommand());
131
+ // chat — lazy-loaded to avoid importing React, Ink, marked at startup
132
+ program
133
+ .command('chat')
134
+ .description('Chat with an agent (default: Guild assistant)')
135
+ .argument('[prompt...]', 'Optional initial prompt (multiple words)')
136
+ .option('--agent <identifier>', 'Agent ID or full name, e.g., foo~bar (default: assistant)')
137
+ .option('--once', 'One-shot mode: send message, wait for response, exit (non-interactive)')
138
+ .option('--mode <format>', 'Machine-readable output format: json or jsonl')
139
+ .option('--workspace <identifier>', 'Workspace ID or full name (e.g., owner/workspace-name)')
140
+ .option('--no-splash', 'Skip the splash screen animation')
141
+ .option('--resume <session-id>', 'Resume an existing session')
142
+ .option('--events <types>', 'Event types to show (default: user). Shorthands: none, user, system, all, or comma-separated type names (e.g. agent_console,llm_start)')
143
+ .addHelpText('after', '\nTo chat with a local agent under development: guild agent chat')
144
+ .action(async (promptArgs, options) => {
145
+ const { handleChatAction } = await import('./commands/chat.js');
146
+ await handleChatAction(promptArgs, options);
147
+ });
134
148
  program.addCommand(createMcpCommand());
135
149
  program.addCommand(createDoctorCommand());
136
150
  program.addCommand(createSetupCommand());
@@ -149,12 +163,44 @@ agentCmd.addCommand(createAgentVersionsCommand());
149
163
  agentCmd.addCommand(createAgentSaveCommand());
150
164
  agentCmd.addCommand(createAgentPullCommand());
151
165
  agentCmd.addCommand(createAgentCodeCommand());
152
- agentCmd.addCommand(createAgentChatCommand());
166
+ // agent chat — lazy-loaded to avoid importing React, Ink, open at startup
167
+ agentCmd
168
+ .command('chat')
169
+ .description('Chat with the agent in current directory')
170
+ .argument('[prompt...]', 'Optional initial prompt for the agent')
171
+ .option('--path <dir>', 'Path to agent directory (defaults to current directory)')
172
+ .option('--workspace <identifier>', 'Workspace ID or full name (e.g., owner~workspace-name)')
173
+ .option('--mode <format>', 'Input mode: json (one-shot) or jsonl (line-by-line)')
174
+ .option('--agent-version <id>', 'Chat with a specific version (UUID or version number)')
175
+ .option('--no-splash', 'Skip the splash screen animation')
176
+ .option('--resume <session-id>', 'Resume an existing session')
177
+ .option('--open', 'Open session in web dashboard')
178
+ .option('--no-cache', 'Skip ephemeral build cache (force a fresh build)')
179
+ .addHelpText('after', '\nTo chat with a published agent by name: guild chat --agent owner~agent-name')
180
+ .action(async (promptArgs, options) => {
181
+ const { handleAgentChatAction } = await import('./commands/agent/chat.js');
182
+ await handleAgentChatAction(promptArgs, options);
183
+ });
153
184
  agentCmd.addCommand(createAgentInitCommand());
154
185
  agentCmd.addCommand(createAgentGrepCommand());
155
186
  agentCmd.addCommand(createAgentCloneCommand());
156
187
  agentCmd.addCommand(createAgentForkCommand());
157
- agentCmd.addCommand(createAgentTestCommand());
188
+ // agent test — lazy-loaded to avoid importing React, Ink, open at startup
189
+ agentCmd
190
+ .command('test')
191
+ .description('Test agent in interactive REPL session')
192
+ .option('--workspace <identifier>', 'Workspace ID or full name (e.g., owner/workspace-name)')
193
+ .option('--mode <format>', 'Input mode: json (one-shot) or jsonl (line-by-line)')
194
+ .option('--agent-version <id>', 'Test a specific version (UUID or version number)')
195
+ .option('--resume <session-id>', 'Resume an existing test session')
196
+ .option('--open', 'Open session in web dashboard')
197
+ .option('--events <types>', 'Event types to stream (default: all). Shorthands: none, user, system, all, or comma-separated type names')
198
+ .option('--bundle <file>', 'Path to a pre-built gzip+base64 bundle file')
199
+ .option('--no-cache', 'Skip ephemeral build cache (force a fresh build)')
200
+ .action(async (options) => {
201
+ const { handleAgentTestAction } = await import('./commands/agent/test.js');
202
+ await handleAgentTestAction(options);
203
+ });
158
204
  agentCmd.addCommand(createAgentPublishCommand());
159
205
  agentCmd.addCommand(createAgentUnpublishCommand());
160
206
  agentCmd.addCommand(createAgentRevalidateCommand());
@@ -199,6 +245,7 @@ workspaceCmd.addCommand(createWorkspaceCreateCommand());
199
245
  workspaceCmd.addCommand(createWorkspaceGetCommand());
200
246
  workspaceCmd.addCommand(createWorkspaceSelectCommand());
201
247
  workspaceCmd.addCommand(createWorkspaceCurrentCommand());
248
+ workspaceCmd.addCommand(createWorkspaceClearCommand());
202
249
  // Workspace agent subcommand group
203
250
  const workspaceAgentCmd = workspaceCmd
204
251
  .command('agent')
@@ -71,6 +71,7 @@ export interface WorkspaceAgent {
71
71
  id: string;
72
72
  name: string;
73
73
  };
74
+ is_default_chat_agent: boolean;
74
75
  should_autoupdate: boolean;
75
76
  }
76
77
  /**
@@ -158,6 +159,10 @@ export interface Pagination {
158
159
  offset: number;
159
160
  has_more: boolean;
160
161
  }
162
+ /** Default page size for standard list endpoints (matches backend). */
163
+ export declare const DEFAULT_PAGE_LIMIT = 20;
164
+ /** Default page size for high-volume endpoints (events, tasks, operations). */
165
+ export declare const DEFAULT_PAGE_LIMIT_LARGE = 100;
161
166
  /**
162
167
  * Generic paginated response wrapper.
163
168
  * All list endpoints return { items: T[], pagination: Pagination }
@@ -1,5 +1,9 @@
1
1
  // Copyright 2026 Guild.ai
2
2
  // SPDX-License-Identifier: Apache-2.0
3
+ /** Default page size for standard list endpoints (matches backend). */
4
+ export const DEFAULT_PAGE_LIMIT = 20;
5
+ /** Default page size for high-volume endpoints (events, tasks, operations). */
6
+ export const DEFAULT_PAGE_LIMIT_LARGE = 100;
3
7
  // Import and re-export generated types (from cli/scripts/sync-types-from-python.py)
4
8
  import { WEBHOOK_SERVICES, TIME_TRIGGER_FREQUENCIES, } from './generated-types.js';
5
9
  export { WEBHOOK_SERVICES, TIME_TRIGGER_FREQUENCIES, };
@@ -2,6 +2,6 @@ export declare const WEBHOOK_SERVICES: readonly ["AZURE_DEVOPS", "BITBUCKET", "C
2
2
  export type WebhookService = (typeof WEBHOOK_SERVICES)[number];
3
3
  export declare const TIME_TRIGGER_FREQUENCIES: readonly ["HOURLY", "DAILY", "WEEKLY", "MONTHLY", "CRON"];
4
4
  export type TimeTriggerFrequency = (typeof TIME_TRIGGER_FREQUENCIES)[number];
5
- export declare const EVENT_TYPES: readonly ["user_message", "agent_console", "runtime_start", "runtime_running", "runtime_waiting", "runtime_error", "runtime_done", "credentials_request", "agent_install_request", "agent_notification_message", "agent_notification_progress", "agent_notification_error", "system_error", "trigger_message", "interrupted", "llm_start", "llm_done"];
5
+ export declare const EVENT_TYPES: readonly ["user_message", "agent_console", "runtime_start", "runtime_running", "runtime_waiting", "runtime_error", "runtime_done", "credentials_request", "agent_install_request", "agent_notification_message", "agent_notification_progress", "agent_notification_error", "system_error", "system_message", "trigger_message", "interrupted", "llm_start", "llm_done"];
6
6
  export type EventType = (typeof EVENT_TYPES)[number];
7
7
  //# sourceMappingURL=generated-types.d.ts.map
@@ -47,6 +47,7 @@ export const EVENT_TYPES = [
47
47
  'agent_notification_progress',
48
48
  'agent_notification_error',
49
49
  'system_error',
50
+ 'system_message',
50
51
  'trigger_message',
51
52
  'interrupted',
52
53
  'llm_start',