@guildai/cli 0.5.1 → 0.5.2

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/README.md CHANGED
@@ -58,17 +58,23 @@ guild auth status # Check authentication status
58
58
 
59
59
  ```bash
60
60
  guild agent init --name my-agent # Initialize a new agent
61
+ guild agent clone <agent-id> # Clone agent locally
61
62
  guild agent save # Push commits and create a version
62
63
  guild agent save -A --message "..." # Stage+commit+push in one step
63
- guild agent versions # List versions
64
- guild agent publish # Publish latest draft version
65
- guild agent unpublish # Unpublish latest published version
66
- guild agent test # Test agent
67
- guild agent chat # Chat with agent in current directory
68
- guild agent get <agent-id> # Get agent details
69
- guild agent code <agent-id> # Fetch latest published code
70
- guild agent clone <agent-id> # Clone agent locally
64
+ guild agent pull # Pull remote changes
65
+ guild agent test # Test agent interactively
66
+ guild agent test --ephemeral # Test unsaved changes
67
+ guild agent chat "message" # Send a single message
68
+ guild agent get [agent-id] # Get agent details
69
+ guild agent versions [agent-id] # List versions
70
+ guild agent code [agent-id] # View latest published source
71
71
  guild agent list # List all agents
72
+ guild agent grep <pattern> # Search agent source code
73
+ guild agent publish # Publish latest draft version
74
+ guild agent unpublish # Remove from catalog
75
+ guild agent revalidate # Re-run validation
76
+ guild agent update # Update agent metadata
77
+ guild agent owners # List accounts that can own agents
72
78
  guild agent tags list # List tags
73
79
  guild agent tags add <tag...> # Add tags
74
80
  guild agent tags remove <tag...> # Remove tags
@@ -258,7 +258,7 @@ export function createAgentSaveCommand() {
258
258
  output.progress('');
259
259
  output.progress('Version details:');
260
260
  output.progress(` ID: ${version.id}`);
261
- output.progress(` SHA: ${version.sha.substring(0, 12)}`);
261
+ output.progress(` SHA: ${version.sha ? version.sha.substring(0, 12) : '-'}`);
262
262
  output.progress(` Status: ${version.status}`);
263
263
  if (version.published_at) {
264
264
  output.progress(` Published at: ${version.published_at}`);
@@ -58,7 +58,7 @@ export function createWorkspaceAgentAddCommand() {
58
58
  // Display success
59
59
  const versionDisplay = response.agent_version.version_number
60
60
  ? `v${response.agent_version.version_number}`
61
- : response.agent_version.sha.slice(0, 7);
61
+ : (response.agent_version.sha?.slice(0, 7) ?? '-');
62
62
  const workspaceName = response.workspace?.name || 'workspace';
63
63
  output.success(`Added ${response.agent.full_name} to workspace "${workspaceName}"`, {
64
64
  Agent: response.agent.full_name,
@@ -18,6 +18,16 @@ function formatWorkspaceDisplay(workspace) {
18
18
  }
19
19
  return base;
20
20
  }
21
+ /**
22
+ * Match a workspace against a search argument (case-insensitive name, full_name, or exact ID).
23
+ */
24
+ function matchesWorkspaceArg(w, arg) {
25
+ return (w.name === arg ||
26
+ w.name.toLowerCase() === arg.toLowerCase() ||
27
+ w.full_name === arg ||
28
+ w.full_name?.toLowerCase() === arg.toLowerCase() ||
29
+ w.id === arg);
30
+ }
21
31
  export function createWorkspaceSelectCommand() {
22
32
  const cmd = new Command('select');
23
33
  cmd
@@ -27,24 +37,25 @@ export function createWorkspaceSelectCommand() {
27
37
  const output = createOutputWriter();
28
38
  try {
29
39
  const client = new GuildAPIClient();
30
- // Use filter=all to get workspaces from all orgs user is a member of
31
- const workspaces = await client.get('/me/workspaces?filter=all');
32
- if (workspaces.items.length === 0) {
33
- output.error('No workspaces found.', 'Create a workspace first:\n guild workspace create <name>');
34
- process.exit(1);
35
- }
36
- // If a workspace argument was provided, find and select it directly
40
+ // If a workspace argument was provided, use server-side search to find it
37
41
  if (workspaceArg) {
38
- const workspace = workspaces.items.find((w) => w.name === workspaceArg ||
39
- w.name.toLowerCase() === workspaceArg.toLowerCase() ||
40
- w.full_name === workspaceArg ||
41
- w.full_name?.toLowerCase() === workspaceArg.toLowerCase() ||
42
- w.id === workspaceArg);
42
+ // Use search param to narrow results server-side, then exact-match client-side.
43
+ // The backend searches only the "name" column via ILIKE, so full_name (owner/name)
44
+ // and ID lookups may not return results. Extract just the name part for search,
45
+ // and if still no match, fall back to fetching the full list.
46
+ const searchTerm = workspaceArg.includes('/')
47
+ ? workspaceArg.split('/').pop()
48
+ : workspaceArg;
49
+ const searchResults = await client.get(`/me/workspaces?filter=all&search=${encodeURIComponent(searchTerm)}&limit=100`);
50
+ let workspace = searchResults.items.find((w) => matchesWorkspaceArg(w, workspaceArg));
51
+ // Search didn't find it (could be an ID lookup, or search term didn't match).
52
+ // Fall back to fetching all workspaces via pagination.
43
53
  if (!workspace) {
44
- const available = workspaces.items
45
- .map((w) => ` - ${formatWorkspaceDisplay(w)}`)
46
- .join('\n');
47
- output.error(`Workspace "${workspaceArg}" not found.`, `Available workspaces:\n${available}`);
54
+ const allWorkspaces = await client.fetchAll('/me/workspaces?filter=all');
55
+ workspace = allWorkspaces.find((w) => matchesWorkspaceArg(w, workspaceArg));
56
+ }
57
+ if (!workspace) {
58
+ output.error(`Workspace "${workspaceArg}" not found.`, 'Run: guild workspace list');
48
59
  process.exit(1);
49
60
  }
50
61
  const target = await saveWorkspaceConfig(workspace.id, workspace.name);
@@ -56,6 +67,12 @@ export function createWorkspaceSelectCommand() {
56
67
  }
57
68
  return;
58
69
  }
70
+ // Interactive mode: fetch workspaces for selection
71
+ const workspaces = await client.get('/me/workspaces?filter=all');
72
+ if (workspaces.items.length === 0) {
73
+ output.error('No workspaces found.', 'Create a workspace first:\n guild workspace create <name>');
74
+ process.exit(1);
75
+ }
59
76
  // Resolve the currently selected workspace (if any)
60
77
  const current = await getWorkspaceId();
61
78
  const currentIndex = current
@@ -63,7 +63,7 @@ export interface WorkspaceAgent {
63
63
  };
64
64
  agent_version: {
65
65
  id: string;
66
- sha: string;
66
+ sha: string | null;
67
67
  version_number: string | null;
68
68
  };
69
69
  workspace?: {
@@ -83,7 +83,7 @@ export interface AgentVersion {
83
83
  id: string;
84
84
  agent_id?: string;
85
85
  author_id?: string;
86
- sha: string;
86
+ sha: string | null;
87
87
  summary: string;
88
88
  status: string;
89
89
  validation_status?: string;
@@ -227,7 +227,7 @@ export interface TriggerWorkspaceAgent {
227
227
  };
228
228
  agent_version: {
229
229
  id: string;
230
- sha: string;
230
+ sha: string | null;
231
231
  version_number: string | null;
232
232
  };
233
233
  }
@@ -102,7 +102,7 @@ export function formatVersionTable(versions, pagination) {
102
102
  ? chalk.red
103
103
  : chalk.dim;
104
104
  table.addRow({
105
- sha: v.sha.slice(0, 7),
105
+ sha: v.sha ? v.sha.slice(0, 7) : '-',
106
106
  version: v.version_number || '-',
107
107
  status: v.status,
108
108
  validation: validationColor(v.validation_status || '-'),
@@ -176,7 +176,8 @@ export function formatWorkspaceAgentTable(agents) {
176
176
  agents.forEach((wa) => {
177
177
  table.addRow({
178
178
  name: wa.agent.full_name || wa.agent.name,
179
- version: wa.agent_version.version_number || wa.agent_version.sha.slice(0, 7),
179
+ version: wa.agent_version.version_number ||
180
+ (wa.agent_version.sha ? wa.agent_version.sha.slice(0, 7) : '-'),
180
181
  auto_update: wa.should_autoupdate ? chalk.green('yes') : chalk.dim('no'),
181
182
  });
182
183
  });
@@ -238,7 +239,7 @@ export function formatSessionTable(sessions, pagination) {
238
239
  });
239
240
  sessions.forEach((session) => {
240
241
  table.addRow({
241
- id: truncate(session.id, 8),
242
+ id: session.id,
242
243
  type: session.session_type,
243
244
  name: session.name ? truncate(session.name, 30) : '-',
244
245
  workspace: session.workspace?.name || '',
@@ -281,7 +282,7 @@ export function formatTriggerTable(triggers, pagination) {
281
282
  ? chalk.dim('inactive')
282
283
  : chalk.green('active');
283
284
  table.addRow({
284
- id: truncate(trigger.id, 8),
285
+ id: trigger.id,
285
286
  type: trigger.type,
286
287
  agent: trigger.agent?.full_name || trigger.agent?.name || '',
287
288
  status,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guildai/cli",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "description": "Guild.ai CLI - Build, test, and deploy AI agents",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",