@vatio-ai/cli 0.63.0 → 0.64.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/bin/vatio.mjs +3 -0
- package/lib/api-client.mjs +13 -0
- package/lib/commands/propose.mjs +51 -0
- package/lib/help.mjs +6 -0
- package/package.json +1 -1
package/bin/vatio.mjs
CHANGED
|
@@ -21,6 +21,7 @@ import { business } from "../lib/commands/business.mjs";
|
|
|
21
21
|
import { instagram, whatsapp } from "../lib/commands/channels.mjs";
|
|
22
22
|
import { docs, feedback } from "../lib/commands/support-commands.mjs";
|
|
23
23
|
import { evalCommand, flags } from "../lib/commands/improve.mjs";
|
|
24
|
+
import { propose } from "../lib/commands/propose.mjs";
|
|
24
25
|
import { printUpdateNotice, startUpdateCheck } from "../lib/update-notice.mjs";
|
|
25
26
|
import { beginRun, isCodingAgent, reportRun, telemetryEnabled } from "../lib/telemetry.mjs";
|
|
26
27
|
|
|
@@ -108,6 +109,8 @@ async function run(command, args) {
|
|
|
108
109
|
return await flags(config, args);
|
|
109
110
|
case "eval":
|
|
110
111
|
return await evalCommand(config, args);
|
|
112
|
+
case "propose":
|
|
113
|
+
return await propose(config, args);
|
|
111
114
|
case "docs":
|
|
112
115
|
return await docs(config, args);
|
|
113
116
|
case "feedback":
|
package/lib/api-client.mjs
CHANGED
|
@@ -65,6 +65,19 @@ export class ApiClient extends HttpClient {
|
|
|
65
65
|
return this.delete(`/env/${encode(name)}`);
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
// --- proposals ------------------------------------------------------
|
|
69
|
+
|
|
70
|
+
proposals() {
|
|
71
|
+
return this.get("/proposals");
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
propose({ environment, title, summary }) {
|
|
75
|
+
const body = { environment };
|
|
76
|
+
if (title) body.title = title;
|
|
77
|
+
if (summary != null) body.summary = summary;
|
|
78
|
+
return this.post("/proposals", body);
|
|
79
|
+
}
|
|
80
|
+
|
|
68
81
|
// The project "Connect Supabase" picked in the console, if any.
|
|
69
82
|
supabase() {
|
|
70
83
|
return this.get("/supabase");
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { deployClient } from "./deploy.mjs";
|
|
3
|
+
import { fail, takeEnv, takeFlag, takeValue } from "../support.mjs";
|
|
4
|
+
|
|
5
|
+
// `vatio propose`: put a branch's environment in front of the workspace's
|
|
6
|
+
// owner as a change to accept from the inbox, for a workspace with no
|
|
7
|
+
// repository connected -- there, the pull request is the proposal. Vatio
|
|
8
|
+
// replays every eval case on it and mails the owner once they finish; the
|
|
9
|
+
// owner accepts (which publishes it) or discards it. Proposing the same
|
|
10
|
+
// environment again, after another push, updates it and replays the evals.
|
|
11
|
+
export async function propose(config, args) {
|
|
12
|
+
const workspace = config.resolveWorkspaceRequired();
|
|
13
|
+
const client = deployClient(config, workspace);
|
|
14
|
+
if (takeFlag(args, "--list")) return await list(client, workspace);
|
|
15
|
+
|
|
16
|
+
const title = takeValue(args, "--title");
|
|
17
|
+
const summaryFile = takeValue(args, "--summary-file");
|
|
18
|
+
let summary = takeValue(args, "--summary");
|
|
19
|
+
if (summaryFile) {
|
|
20
|
+
try {
|
|
21
|
+
summary = readFileSync(summaryFile, "utf8");
|
|
22
|
+
} catch (error) {
|
|
23
|
+
fail(`Could not read ${summaryFile}: ${error.message}`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
const environment = takeEnv(args, { fallback: null, cwd: config.workspaceRoot });
|
|
27
|
+
if (!environment) {
|
|
28
|
+
fail('usage: vatio propose --env NAME --title "What it fixes" [--summary TEXT | --summary-file PATH]');
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const payload = await client.propose({ environment, title, summary });
|
|
32
|
+
console.log(`${payload.created ? "Proposed" : "Updated"} ${payload.environment} as ${payload.id}: ${payload.title}`);
|
|
33
|
+
const runs = Array.isArray(payload.runs) ? payload.runs : [];
|
|
34
|
+
const cases = runs.reduce((sum, run) => sum + (run.cases ?? 0), 0);
|
|
35
|
+
if (cases > 0) {
|
|
36
|
+
console.log(`Replaying ${cases} eval case${cases === 1 ? "" : "s"} there; the owner gets a mail when they finish.`);
|
|
37
|
+
} else {
|
|
38
|
+
console.log("No eval cases to replay: the owner decides on the change alone.");
|
|
39
|
+
}
|
|
40
|
+
console.log(`Accept or discard it in the inbox: ${payload.url}`);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
async function list(client, workspace) {
|
|
44
|
+
const payload = await client.proposals();
|
|
45
|
+
const rows = Array.isArray(payload.data) ? payload.data : [];
|
|
46
|
+
console.log(`Proposals on workspace ${workspace} (${rows.length}):`);
|
|
47
|
+
for (const row of rows) {
|
|
48
|
+
console.log(` ${row.id} ${row.status.padEnd(9)} ${row.environment} ${row.title}`);
|
|
49
|
+
console.log(` ${row.url}`);
|
|
50
|
+
}
|
|
51
|
+
}
|
package/lib/help.mjs
CHANGED
|
@@ -60,6 +60,12 @@ and the one its pull request deploys to. Elsewhere commands default as listed.
|
|
|
60
60
|
judge it; exits 1 if one fails. Default: the
|
|
61
61
|
branch's environment, else preview
|
|
62
62
|
eval --show RUN_ID One run's report
|
|
63
|
+
propose [--env NAME] --title TEXT [--summary TEXT|--summary-file PATH]
|
|
64
|
+
Without a GitHub repo: put the branch's
|
|
65
|
+
environment in front of the owner, who accepts
|
|
66
|
+
(publishes) or discards it in the inbox. Replays
|
|
67
|
+
every eval case there first
|
|
68
|
+
propose --list Every proposal and where it stands
|
|
63
69
|
|
|
64
70
|
Knowledge:
|
|
65
71
|
kb [list] Bases, and whether a deployed agent reads each
|