@vatio-ai/cli 0.71.0 → 0.72.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/commands/improve.mjs +4 -0
- package/lib/skills-hint.mjs +84 -0
- package/package.json +1 -1
package/lib/commands/improve.mjs
CHANGED
|
@@ -13,6 +13,7 @@ import { dirname, resolve } from "node:path";
|
|
|
13
13
|
import { HttpClient } from "../http.mjs";
|
|
14
14
|
import { clientHeaders } from "../telemetry.mjs";
|
|
15
15
|
import { fail, sleep, takeEnv, takeFlag, takeValue } from "../support.mjs";
|
|
16
|
+
import { printSkillsHint } from "../skills-hint.mjs";
|
|
16
17
|
|
|
17
18
|
const POLL_MS = 3_000;
|
|
18
19
|
const DEFAULT_TIMEOUT_S = 900;
|
|
@@ -56,6 +57,7 @@ export async function flags(config, args) {
|
|
|
56
57
|
const markdown = await fetchMarkdown(config, "/flags.md", "the flags");
|
|
57
58
|
if (!save) {
|
|
58
59
|
process.stdout.write(markdown);
|
|
60
|
+
printSkillsHint();
|
|
59
61
|
return;
|
|
60
62
|
}
|
|
61
63
|
|
|
@@ -63,6 +65,7 @@ export async function flags(config, args) {
|
|
|
63
65
|
mkdirSync(dirname(target), { recursive: true });
|
|
64
66
|
writeFileSync(target, markdown);
|
|
65
67
|
console.log(`Wrote ${target}. Hand it to your coding agent; re-run \`vatio flags --save\` to refresh.`);
|
|
68
|
+
printSkillsHint();
|
|
66
69
|
}
|
|
67
70
|
|
|
68
71
|
// Each tool's calls, error rate, timeouts and p50/p95 latency over a period,
|
|
@@ -111,6 +114,7 @@ export async function evalCommand(config, args) {
|
|
|
111
114
|
|
|
112
115
|
const total = runs.reduce((sum, run) => sum + run.cases, 0);
|
|
113
116
|
console.error(`vatio: replaying ${total} case${total === 1 ? "" : "s"} on ${environment}…`);
|
|
117
|
+
printSkillsHint();
|
|
114
118
|
if (noWait) {
|
|
115
119
|
for (const run of runs) console.log(`Run ${run.id} (${run.agent}): vatio eval --show ${run.id}`);
|
|
116
120
|
return;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// "The Vatio skills are not installed here", after the commands of the
|
|
2
|
+
// improve loop. Without them Claude Code has no /vatio:vatio-improve, and the
|
|
3
|
+
// developer pastes the daily mail's prompt into a session that cannot run it.
|
|
4
|
+
//
|
|
5
|
+
// Installed means either copy: the Claude Code plugin (installed_plugins.json
|
|
6
|
+
// names vatio@<marketplace>), or the files `npx @vatio-ai/skills` puts in a
|
|
7
|
+
// project's .claude/skills or .agents/skills -- in this directory or one above
|
|
8
|
+
// it, or in ~/.claude/skills.
|
|
9
|
+
//
|
|
10
|
+
// Unlike the update notice it prints when stderr is not a terminal too: the
|
|
11
|
+
// reader is as often the coding agent running the command as a person. At
|
|
12
|
+
// most once a day per directory, and never in CI.
|
|
13
|
+
|
|
14
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
15
|
+
import { homedir } from "node:os";
|
|
16
|
+
import { dirname, join, resolve } from "node:path";
|
|
17
|
+
|
|
18
|
+
import { configHome } from "./config.mjs";
|
|
19
|
+
import { paint } from "./support.mjs";
|
|
20
|
+
|
|
21
|
+
const SKILL = "vatio-improve";
|
|
22
|
+
const SHOW_EVERY_MS = 24 * 60 * 60 * 1000;
|
|
23
|
+
|
|
24
|
+
export function printSkillsHint(startDir = process.cwd()) {
|
|
25
|
+
if (process.env.CI || process.env.VATIO_NO_SKILLS_HINT) return;
|
|
26
|
+
if (skillsInstalled(startDir)) return;
|
|
27
|
+
|
|
28
|
+
const path = join(configHome(), "skills-hint.json");
|
|
29
|
+
const key = resolve(startDir);
|
|
30
|
+
const state = readState(path);
|
|
31
|
+
const last = Date.parse(state[key] ?? "");
|
|
32
|
+
if (!Number.isNaN(last) && Date.now() - last < SHOW_EVERY_MS) return;
|
|
33
|
+
|
|
34
|
+
process.stderr.write(
|
|
35
|
+
`\n${paint("yellow", "The Vatio skills are not installed here, so Claude Code has no /vatio:vatio-improve.")}\n` +
|
|
36
|
+
"To install them, run in this project: npx @vatio-ai/skills\n"
|
|
37
|
+
);
|
|
38
|
+
writeState(path, { ...state, [key]: new Date().toISOString() });
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function skillsInstalled(startDir) {
|
|
42
|
+
const claudeHome = String(process.env.CLAUDE_CONFIG_DIR ?? "").trim() || join(homedir(), ".claude");
|
|
43
|
+
if (pluginInstalled(join(claudeHome, "plugins", "installed_plugins.json"))) return true;
|
|
44
|
+
if (hasSkill(claudeHome)) return true;
|
|
45
|
+
|
|
46
|
+
let dir = resolve(startDir);
|
|
47
|
+
for (;;) {
|
|
48
|
+
if (hasSkill(join(dir, ".claude")) || hasSkill(join(dir, ".agents"))) return true;
|
|
49
|
+
const parent = dirname(dir);
|
|
50
|
+
if (parent === dir) return false;
|
|
51
|
+
dir = parent;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function hasSkill(base) {
|
|
56
|
+
return existsSync(join(base, "skills", SKILL, "SKILL.md"));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function pluginInstalled(path) {
|
|
60
|
+
try {
|
|
61
|
+
const plugins = JSON.parse(readFileSync(path, "utf8"))?.plugins ?? {};
|
|
62
|
+
return Object.keys(plugins).some((name) => name.startsWith("vatio@"));
|
|
63
|
+
} catch {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function readState(path) {
|
|
69
|
+
try {
|
|
70
|
+
const state = JSON.parse(readFileSync(path, "utf8"));
|
|
71
|
+
return state && typeof state === "object" ? state : {};
|
|
72
|
+
} catch {
|
|
73
|
+
return {};
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function writeState(path, state) {
|
|
78
|
+
try {
|
|
79
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
80
|
+
writeFileSync(path, JSON.stringify(state, null, 2) + "\n");
|
|
81
|
+
} catch {
|
|
82
|
+
// A hint that cannot remember it was shown shows again tomorrow.
|
|
83
|
+
}
|
|
84
|
+
}
|