@vatio-ai/cli 0.120.0 → 0.122.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/lib/claude-session.mjs +4 -2
- package/lib/commands/deploy.mjs +37 -5
- package/lib/commands/support-commands.mjs +1 -1
- package/lib/suggest.mjs +22 -0
- package/lib/telemetry.mjs +63 -7
- package/package.json +1 -1
package/lib/claude-session.mjs
CHANGED
|
@@ -59,10 +59,12 @@ const SECRET_PATTERNS = [
|
|
|
59
59
|
// The people a session is about rather than the one who sends it: customers
|
|
60
60
|
// that came up in a query or a log. The team never needs who they were. A
|
|
61
61
|
// phone counts only in international form; a bare run of digits is as likely
|
|
62
|
-
// an id.
|
|
62
|
+
// an id. A Chilean RUT has its check digit after a dash, the same pattern the
|
|
63
|
+
// Admin API redacts chats with (AdminApi::ChatTranscriptRedactor).
|
|
63
64
|
const PERSONAL_PATTERNS = [
|
|
64
65
|
[/(?<![\w.%+/-])(?!git@|no-?reply@)[A-Za-z0-9._%+-]+@[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)*\.[A-Za-z]{2,}\b/g, "[EMAIL]"],
|
|
65
|
-
[/(?<![\w+])\+\d(?:[ .-]?\d){7,14}\b/g, "[PHONE]"]
|
|
66
|
+
[/(?<![\w+])\+\d(?:[ .-]?\d){7,14}\b/g, "[PHONE]"],
|
|
67
|
+
[/(?<![\p{L}\p{N}])\d{1,2}\.?\d{3}\.?\d{3}-[\dkK](?![\p{L}\p{N}])/gu, "[RUT]"]
|
|
66
68
|
];
|
|
67
69
|
|
|
68
70
|
export function claudeHome() {
|
package/lib/commands/deploy.mjs
CHANGED
|
@@ -75,9 +75,34 @@ export async function checkWorkspace(config, workspace, { environment = null } =
|
|
|
75
75
|
return deployClient(config, workspace).check({ files, environment });
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
// A block vatio.yml still declares and the platform no longer reads. Among the
|
|
79
|
+
// other warnings it read as one more, and a developer took `allowed_origins:`
|
|
80
|
+
// under `widget:` as applied: said apart, as what it is.
|
|
81
|
+
const IGNORED_BLOCK = /^vatio\.yml: `[^`]+` is ignored/;
|
|
82
|
+
|
|
83
|
+
// Returns the ignored-block lines it held back, for a caller that prints them
|
|
84
|
+
// last (`vatio push`); otherwise they follow the other warnings.
|
|
85
|
+
export function printDiagnostics(payload, { holdIgnored = false } = {}) {
|
|
79
86
|
for (const row of asArray(payload.errors)) console.error(`error: ${diagnosticLine(row)}`);
|
|
80
|
-
|
|
87
|
+
const ignored = [];
|
|
88
|
+
for (const row of asArray(payload.warnings)) {
|
|
89
|
+
const line = diagnosticLine(row);
|
|
90
|
+
if (IGNORED_BLOCK.test(line)) ignored.push(line);
|
|
91
|
+
else console.error(`warning: ${line}`);
|
|
92
|
+
}
|
|
93
|
+
if (!holdIgnored) printIgnored(ignored);
|
|
94
|
+
return ignored;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function printIgnored(lines) {
|
|
98
|
+
if (lines.length === 0) return;
|
|
99
|
+
const one = lines.length === 1;
|
|
100
|
+
console.error("");
|
|
101
|
+
console.error(
|
|
102
|
+
`Not applied: vatio.yml declares ${one ? "a block" : `${lines.length} blocks`} Vatio does not read, ` +
|
|
103
|
+
`and nothing in ${one ? "it" : "them"} takes effect:`
|
|
104
|
+
);
|
|
105
|
+
for (const line of lines) console.error(` ${line}`);
|
|
81
106
|
}
|
|
82
107
|
|
|
83
108
|
// A diagnostic is { message, path } -- `path` is the file it is about, or null
|
|
@@ -118,8 +143,11 @@ export async function push(config, args) {
|
|
|
118
143
|
}
|
|
119
144
|
|
|
120
145
|
const check = await checkWorkspace(config, workspace, { environment });
|
|
121
|
-
printDiagnostics(check);
|
|
122
|
-
if (!check.ok)
|
|
146
|
+
const ignored = printDiagnostics(check, { holdIgnored: true });
|
|
147
|
+
if (!check.ok) {
|
|
148
|
+
printIgnored(ignored);
|
|
149
|
+
fail(`push aborted: check failed (${asArray(check.errors).length} error(s))`);
|
|
150
|
+
}
|
|
123
151
|
|
|
124
152
|
const client = deployClient(config, workspace);
|
|
125
153
|
const baseUrl = config.resolveBaseUrl();
|
|
@@ -156,7 +184,10 @@ export async function push(config, args) {
|
|
|
156
184
|
for (const line of consequenceLines(payload)) console.log(line);
|
|
157
185
|
// Where to try it: the inbox's Try the agent panel for that environment.
|
|
158
186
|
if (payload.share_url) console.log(`Try it: ${payload.share_url}`);
|
|
159
|
-
for (const warning of asArray(payload.warnings))
|
|
187
|
+
for (const warning of asArray(payload.warnings)) {
|
|
188
|
+
if (!IGNORED_BLOCK.test(String(warning))) console.log(` warning: ${warning}`);
|
|
189
|
+
else if (!ignored.includes(String(warning))) ignored.push(String(warning));
|
|
190
|
+
}
|
|
160
191
|
if (payload.preview_url) console.log(`Preview: ${payload.preview_url}`);
|
|
161
192
|
|
|
162
193
|
const hint = payload.first_push_hint;
|
|
@@ -166,6 +197,7 @@ export async function push(config, args) {
|
|
|
166
197
|
console.log(` ${hint.url}`);
|
|
167
198
|
}
|
|
168
199
|
printNotices(payload);
|
|
200
|
+
printIgnored(ignored);
|
|
169
201
|
}
|
|
170
202
|
|
|
171
203
|
// The two or three lines that say who sees this push, read off the platform's
|
|
@@ -100,7 +100,7 @@ export async function shareSession(config, args) {
|
|
|
100
100
|
console.log(
|
|
101
101
|
` Left out: ${transcript.images > 0 ? `${transcript.images} image(s) and ` : ""}${label}'s own bookkeeping.` +
|
|
102
102
|
(transcript.redactions > 0 ? ` ${transcript.redactions} thing(s) that looked like a key, token or password are [REDACTED].` : "") +
|
|
103
|
-
(transcript.personal > 0 ? ` ${transcript.personal} email address(es)
|
|
103
|
+
(transcript.personal > 0 ? ` ${transcript.personal} email address(es), phone number(s) and RUT(s) are [EMAIL], [PHONE] and [RUT].` : "")
|
|
104
104
|
);
|
|
105
105
|
|
|
106
106
|
if (savePath) {
|
package/lib/suggest.mjs
CHANGED
|
@@ -100,6 +100,16 @@ const SUBCOMMAND_OF = {
|
|
|
100
100
|
write: ["kb"]
|
|
101
101
|
};
|
|
102
102
|
|
|
103
|
+
// Commands that were renamed. A token that is one of these is a habit (or an
|
|
104
|
+
// older doc) and the reader needs the new name, not an edit-distance guess:
|
|
105
|
+
// `tokens` is nowhere near `keys`, so it used to get the bare list.
|
|
106
|
+
const RENAMED = {
|
|
107
|
+
// `tokens create` made publishable keys; `keys create` names the kind.
|
|
108
|
+
tokens: (rest) => (rest[0] === "create" && !["publishable", "secret"].includes(rest[1])
|
|
109
|
+
? ["keys", "create", "publishable", ...rest.slice(1)]
|
|
110
|
+
: ["keys", ...rest])
|
|
111
|
+
};
|
|
112
|
+
|
|
103
113
|
// Exported so scripts/check-docs.mjs can check every command named above is
|
|
104
114
|
// one the CLI actually dispatches.
|
|
105
115
|
export const SUBCOMMAND_OWNERS = [...new Set(Object.values(SUBCOMMAND_OF).flat())];
|
|
@@ -215,6 +225,18 @@ export function unknownCommandMessage(command, args = []) {
|
|
|
215
225
|
].join("\n");
|
|
216
226
|
}
|
|
217
227
|
|
|
228
|
+
const rename = RENAMED[token.toLowerCase()];
|
|
229
|
+
if (rename) {
|
|
230
|
+
const [renamed, ...renamedArgs] = rename(rest);
|
|
231
|
+
return [
|
|
232
|
+
`\`vatio ${token}\` is now \`vatio ${renamed}\`.`,
|
|
233
|
+
"",
|
|
234
|
+
`Run: vatio ${[renamed, ...renamedArgs].join(" ")}`,
|
|
235
|
+
"",
|
|
236
|
+
"`vatio help` lists every command."
|
|
237
|
+
].join("\n");
|
|
238
|
+
}
|
|
239
|
+
|
|
218
240
|
const belongsTo = SUBCOMMAND_OF[token.toLowerCase()];
|
|
219
241
|
if (belongsTo) {
|
|
220
242
|
const options = belongsTo.map((owner) => `vatio ${owner} ${token}${trailing}`);
|
package/lib/telemetry.mjs
CHANGED
|
@@ -4,18 +4,22 @@
|
|
|
4
4
|
//
|
|
5
5
|
// Every request says which CLI made it, which coding agent is driving it, the
|
|
6
6
|
// session it belongs to and the command it is part of. When a command ends,
|
|
7
|
-
// one event says how: the exit code
|
|
8
|
-
//
|
|
7
|
+
// one event says how: the exit code, how long it took, which Vatio skills the
|
|
8
|
+
// project has and, on failure, what was printed. Never sent: arguments, file
|
|
9
|
+
// contents, secrets, or what a chat said.
|
|
9
10
|
//
|
|
10
11
|
// VATIO_TELEMETRY=0 (or DO_NOT_TRACK=1) turns all of it off except the
|
|
11
12
|
// User-Agent, which only says which version is calling.
|
|
12
13
|
|
|
14
|
+
import { spawnSync } from "node:child_process";
|
|
13
15
|
import { randomUUID } from "node:crypto";
|
|
14
16
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
15
|
-
import { dirname, join } from "node:path";
|
|
17
|
+
import { basename, dirname, join, sep } from "node:path";
|
|
16
18
|
import { arch, homedir, platform } from "node:os";
|
|
19
|
+
import { fileURLToPath } from "node:url";
|
|
17
20
|
|
|
18
21
|
import { configHome } from "./config.mjs";
|
|
22
|
+
import { findSkills } from "./skills-hint.mjs";
|
|
19
23
|
import { VERSION } from "./version.mjs";
|
|
20
24
|
|
|
21
25
|
const SESSION_IDLE_MS = 30 * 60 * 1000;
|
|
@@ -45,7 +49,7 @@ const SUBCOMMANDS = {
|
|
|
45
49
|
|
|
46
50
|
export const USER_AGENT = `vatio-cli/${VERSION} (node ${process.version}; ${platform()} ${arch()})`;
|
|
47
51
|
|
|
48
|
-
const run = { command: null };
|
|
52
|
+
const run = { command: null, startedAt: null };
|
|
49
53
|
|
|
50
54
|
export function telemetryEnabled() {
|
|
51
55
|
const off = ["0", "false", "off", "no"];
|
|
@@ -65,8 +69,51 @@ export function codingAgent() {
|
|
|
65
69
|
// of Codex's once reported as "unknown".
|
|
66
70
|
if (env.CODEX_THREAD_ID || env.CODEX_SESSION_ID || env.CODEX_SANDBOX || env.CODEX_MANAGED_BY_NPM) return "codex";
|
|
67
71
|
if (env.GEMINI_CLI) return "gemini-cli";
|
|
72
|
+
if (env.REPL_ID) return "replit";
|
|
68
73
|
if (env.CI) return "ci";
|
|
69
|
-
|
|
74
|
+
if (process.stdout.isTTY) return "human";
|
|
75
|
+
const parent = launcher();
|
|
76
|
+
return parent ? `unknown:${parent}` : "unknown";
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// Run from a checkout of the CLI's own source rather than an installed
|
|
80
|
+
// package: the Vatio team working on the CLI, whose runs are not anyone's
|
|
81
|
+
// usage and are left out of what the team reads.
|
|
82
|
+
export function fromCheckout() {
|
|
83
|
+
return !fileURLToPath(import.meta.url).split(sep).includes("node_modules");
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function reportedAgent() {
|
|
87
|
+
return fromCheckout() ? "vatio-dev" : codingAgent();
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// What started this CLI, when no coding agent said so: the first ancestor
|
|
91
|
+
// that is not a shell or Node itself, by its process name ("Windsurf",
|
|
92
|
+
// "opencode"). Nothing else about it is read.
|
|
93
|
+
const NOT_LAUNCHERS = new Set(["sh", "bash", "zsh", "fish", "dash", "ksh", "env", "node", "npm", "npx", "pnpm", "yarn", "bun", "sudo", "xargs", "timeout", "login"]);
|
|
94
|
+
|
|
95
|
+
function launcher() {
|
|
96
|
+
if (platform() === "win32") return null;
|
|
97
|
+
return safely(() => {
|
|
98
|
+
let pid = process.ppid;
|
|
99
|
+
for (let depth = 0; depth < 6 && pid > 1; depth++) {
|
|
100
|
+
const out = spawnSync("ps", ["-o", "ppid=,comm=", "-p", String(pid)], { encoding: "utf8", timeout: 500 });
|
|
101
|
+
const match = /^\s*(\d+)\s+(.+?)\s*$/.exec(out.stdout ?? "");
|
|
102
|
+
if (!match) return null;
|
|
103
|
+
const name = basename(match[2]).replace(/^-/, "");
|
|
104
|
+
if (!NOT_LAUNCHERS.has(name)) return name.replace(/[^\w .-]/g, "").slice(0, 40) || null;
|
|
105
|
+
pid = Number(match[1]);
|
|
106
|
+
}
|
|
107
|
+
return null;
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Which Vatio skills the project has, as `npx @vatio-ai/skills` or the Claude
|
|
112
|
+
// Code plugin left them: "copy 1.28.0", "plugin 1.28.0", or "none".
|
|
113
|
+
function skillsInstalled() {
|
|
114
|
+
const found = safely(() => findSkills(process.cwd())) ?? [];
|
|
115
|
+
const install = found.find((candidate) => candidate.kind === "plugin") ?? found[0];
|
|
116
|
+
return install ? `${install.kind} ${install.version ?? "unknown"}` : "none";
|
|
70
117
|
}
|
|
71
118
|
|
|
72
119
|
export function isCodingAgent() {
|
|
@@ -75,6 +122,7 @@ export function isCodingAgent() {
|
|
|
75
122
|
|
|
76
123
|
export function beginRun(command, args) {
|
|
77
124
|
run.command = commandLabel(command, args);
|
|
125
|
+
run.startedAt = performance.now();
|
|
78
126
|
noticeOnce();
|
|
79
127
|
}
|
|
80
128
|
|
|
@@ -108,7 +156,7 @@ export function clientHeaders() {
|
|
|
108
156
|
if (!telemetryEnabled()) return headers;
|
|
109
157
|
|
|
110
158
|
headers["X-Vatio-Session"] = sessionId();
|
|
111
|
-
headers["X-Vatio-Agent"] =
|
|
159
|
+
headers["X-Vatio-Agent"] = agentHeader();
|
|
112
160
|
if (run.command) headers["X-Vatio-Command"] = run.command;
|
|
113
161
|
return headers;
|
|
114
162
|
}
|
|
@@ -123,6 +171,8 @@ export async function reportRun(config, { exitCode, error = null }) {
|
|
|
123
171
|
kind: "run",
|
|
124
172
|
command: run.command,
|
|
125
173
|
exit_code: exitCode,
|
|
174
|
+
duration_ms: run.startedAt == null ? undefined : Math.round(performance.now() - run.startedAt),
|
|
175
|
+
skills: skillsInstalled(),
|
|
126
176
|
error: error ? describeError(error) : undefined
|
|
127
177
|
}).catch(() => {});
|
|
128
178
|
}
|
|
@@ -136,7 +186,13 @@ export async function sendFeedback(config, message) {
|
|
|
136
186
|
// What the developer chose to send -- `vatio feedback`, `vatio share-session` --
|
|
137
187
|
// says which session and coding agent it came from even with telemetry off.
|
|
138
188
|
export function chosenHeaders() {
|
|
139
|
-
return { ...clientHeaders(), "X-Vatio-Session": sessionId(), "X-Vatio-Agent":
|
|
189
|
+
return { ...clientHeaders(), "X-Vatio-Session": sessionId(), "X-Vatio-Agent": agentHeader() };
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// Worked out once per run: finding the launcher asks `ps`.
|
|
193
|
+
function agentHeader() {
|
|
194
|
+
run.agent ??= reportedAgent();
|
|
195
|
+
return run.agent;
|
|
140
196
|
}
|
|
141
197
|
|
|
142
198
|
async function post(config, body, { strict = false } = {}) {
|