@vatio-ai/cli 0.43.0 → 0.44.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.
@@ -22,7 +22,7 @@ export async function kb(config, args) {
22
22
  switch (sub) {
23
23
  case "list": return await list(client, workspace);
24
24
  case "show": return await show(client, workspace, args.shift());
25
- case "create": return await create(client, workspace, args.shift());
25
+ case "create": return await create(client, workspace, args.splice(0));
26
26
  case "rm": return await remove(client, workspace, args.shift());
27
27
  case "write": return await write(client, workspace, args);
28
28
  case "cat": return await cat(client, args.shift(), args.shift());
@@ -38,7 +38,7 @@ function usage() {
38
38
  return `usage:
39
39
  vatio kb List knowledge bases
40
40
  vatio kb show NAME One base: its sites and its entries
41
- vatio kb create NAME Create a base
41
+ vatio kb create NAME [NAME...] Create one base, or several
42
42
  vatio kb rm NAME Delete a base (must be unreferenced)
43
43
  vatio kb write BASE ENTRY [FILE] Write an entry, from FILE or stdin
44
44
  vatio kb cat BASE ENTRY Print an entry's markdown
@@ -110,13 +110,30 @@ async function show(client, workspace, name) {
110
110
  }
111
111
  }
112
112
 
113
- async function create(client, workspace, name) {
114
- if (!name) fail("usage: vatio kb create NAME");
113
+ // Several names, because the moment this command is most often run is a push
114
+ // that just refused for naming bases that do not exist yet -- and that push
115
+ // names all of them at once. One base per invocation turned a first deploy
116
+ // into one round trip per name.
117
+ //
118
+ // Still never implicit: a base is created because someone typed its name here,
119
+ // which is what keeps `knowledge: [defualt]` a failed push instead of an empty
120
+ // base the agent searches forever.
121
+ async function create(client, workspace, names) {
122
+ const wanted = names.filter((name) => name.trim() !== "");
123
+ if (wanted.length === 0) fail("usage: vatio kb create NAME [NAME...]");
124
+
125
+ const created = [];
126
+ for (const name of wanted) {
127
+ const base = await client.createKnowledgeBase(name);
128
+ created.push(base.name);
129
+ console.log(`Created knowledge base ${base.name} on workspace ${workspace}`);
130
+ }
115
131
 
116
- const base = await client.createKnowledgeBase(name);
117
- console.log(`Created knowledge base ${base.name} on workspace ${workspace}`);
118
- console.log("It is empty and nothing reads it yet. Fill it with `vatio kb write` or `vatio kb follow`,");
119
- console.log(`then add \`knowledge: [${base.name}]\` to vatio.yml and push.`);
132
+ console.log(created.length === 1
133
+ ? "It is empty and nothing reads it yet."
134
+ : "They are empty and nothing reads them yet.");
135
+ console.log("Fill with `vatio kb write` or `vatio kb follow`, then add");
136
+ console.log(`\`knowledge: [${created.join(", ")}]\` to the agent in vatio.yml and push.`);
120
137
  }
121
138
 
122
139
  async function remove(client, workspace, name) {
@@ -96,18 +96,42 @@ async function issueTemplate(config) {
96
96
  process.stdout.write(await response.text());
97
97
  }
98
98
 
99
+ // Where a report stands, in the words the developer is actually asking in:
100
+ // has anyone looked at it, and is the ball with them or with us. There is no
101
+ // `status` field to print -- an issue has no states -- so this reads the few
102
+ // facts the platform does publish about the thread.
103
+ function issueStatus(row) {
104
+ if (row.resolved) return "closed";
105
+ // The developer wrote last and nothing has gone back yet.
106
+ if (row.awaiting_us) return "with us";
107
+ if (row.answered) return "answered";
108
+ if (row.answers > 0) return "in progress";
109
+ return "sent";
110
+ }
111
+
99
112
  async function issueList(config) {
113
+ // `data`, the same envelope every other read in this CLI unwraps. Reading
114
+ // `issues` here is how `list` spent its whole life reporting that a
115
+ // developer had sent nothing while `show` returned those same issues by id.
100
116
  const payload = await issuesClient(config).get("/cli/issues");
101
- const issues = Array.isArray(payload.issues) ? payload.issues : [];
117
+ const issues = Array.isArray(payload.data) ? payload.data : [];
102
118
  if (issues.length === 0) {
103
119
  console.log("You have not sent any issues yet.");
104
120
  console.log(' Send one: vatio issue "what should change"');
105
121
  return;
106
122
  }
107
123
  console.log(`Your issues (${issues.length}):`);
124
+ const idWidth = Math.max(...issues.map((row) => String(row.id).length));
125
+ const statusWidth = Math.max(...issues.map((row) => issueStatus(row).length));
126
+ // The pull request goes under the title it belongs to, so the id and status
127
+ // columns stay readable as columns.
128
+ const indent = " ".repeat(2 + idWidth + 3 + statusWidth + 2);
108
129
  for (const row of issues) {
109
- console.log(` [${row.id}] ${row.status ?? ""} ${row.title ?? row.summary ?? ""}`.trimEnd());
130
+ const id = `[${String(row.id).padStart(idWidth)}]`;
131
+ console.log(` ${id} ${issueStatus(row).padEnd(statusWidth)} ${row.title ?? ""}`.trimEnd());
132
+ if (row.pull_request_url) console.log(`${indent}${row.pull_request_url}`);
110
133
  }
134
+ console.log("Read one, conversation included: vatio issue show ID");
111
135
  }
112
136
 
113
137
  // The markdown view, which is the same document Vatio's own triage agent
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vatio-ai/cli",
3
- "version": "0.43.0",
3
+ "version": "0.44.0",
4
4
  "description": "Vatio CLI — deploy and manage Vatio agent workspaces",
5
5
  "keywords": ["vatio", "agent", "ai", "cli", "deploy"],
6
6
  "homepage": "https://vatio.ai",