harness-evolver 3.0.1 → 3.0.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.
Files changed (2) hide show
  1. package/bin/install.js +77 -8
  2. package/package.json +1 -1
package/bin/install.js CHANGED
@@ -72,6 +72,67 @@ function checkCommand(cmd) {
72
72
  }
73
73
  }
74
74
 
75
+ function cleanPreviousInstall(runtimeDir, scope) {
76
+ const baseDir = scope === "local"
77
+ ? path.join(process.cwd(), runtimeDir)
78
+ : path.join(HOME, runtimeDir);
79
+
80
+ const skillsDir = path.join(baseDir, "skills");
81
+ const agentsDir = path.join(baseDir, "agents");
82
+ let cleaned = 0;
83
+
84
+ // Remove ALL evolver/harness-evolver skills (any version)
85
+ if (fs.existsSync(skillsDir)) {
86
+ const ours = ["setup", "evolve", "deploy", "status",
87
+ "init", "architect", "compare", "critic", "diagnose",
88
+ "import-traces", "evolve-v3", "deploy-v3", "status-v3",
89
+ "harness-evolver:init", "harness-evolver:evolve",
90
+ "harness-evolver:status", "harness-evolver:deploy",
91
+ "harness-evolver:compare", "harness-evolver:diagnose",
92
+ "harness-evolver:architect", "harness-evolver:critic",
93
+ "harness-evolver:import-traces"];
94
+ for (const name of ours) {
95
+ const p = path.join(skillsDir, name);
96
+ if (fs.existsSync(p)) {
97
+ fs.rmSync(p, { recursive: true, force: true });
98
+ cleaned++;
99
+ }
100
+ }
101
+ }
102
+
103
+ // Remove ALL evolver/harness-evolver agents
104
+ if (fs.existsSync(agentsDir)) {
105
+ for (const f of fs.readdirSync(agentsDir)) {
106
+ if (f.startsWith("evolver-") || f.startsWith("harness-evolver-")) {
107
+ fs.rmSync(path.join(agentsDir, f), { force: true });
108
+ cleaned++;
109
+ }
110
+ }
111
+ }
112
+
113
+ // Remove old commands/ directory (v1)
114
+ const oldCommandsDir = path.join(baseDir, "commands", "harness-evolver");
115
+ if (fs.existsSync(oldCommandsDir)) {
116
+ fs.rmSync(oldCommandsDir, { recursive: true, force: true });
117
+ cleaned++;
118
+ }
119
+
120
+ // Remove old tools directories
121
+ for (const toolsPath of [
122
+ path.join(HOME, ".evolver", "tools"),
123
+ path.join(HOME, ".harness-evolver"),
124
+ ]) {
125
+ if (fs.existsSync(toolsPath)) {
126
+ fs.rmSync(toolsPath, { recursive: true, force: true });
127
+ cleaned++;
128
+ }
129
+ }
130
+
131
+ if (cleaned > 0) {
132
+ console.log(` ${DIM}Cleaned ${cleaned} items from previous install${RESET}`);
133
+ }
134
+ }
135
+
75
136
  function installSkillsAndAgents(runtimeDir, scope) {
76
137
  const baseDir = scope === "local"
77
138
  ? path.join(process.cwd(), runtimeDir)
@@ -100,13 +161,6 @@ function installSkillsAndAgents(runtimeDir, scope) {
100
161
  }
101
162
  }
102
163
 
103
- // Cleanup old v2 commands/ directory
104
- const oldCommandsDir = path.join(baseDir, "commands", "harness-evolver");
105
- if (fs.existsSync(oldCommandsDir)) {
106
- fs.rmSync(oldCommandsDir, { recursive: true, force: true });
107
- console.log(` ${DIM}Cleaned up old commands/ directory${RESET}`);
108
- }
109
-
110
164
  // Agents
111
165
  const agentsSource = path.join(PLUGIN_ROOT, "agents");
112
166
  if (fs.existsSync(agentsSource)) {
@@ -267,6 +321,15 @@ async function configureOptionalIntegrations(rl) {
267
321
  async function main() {
268
322
  console.log(LOGO);
269
323
 
324
+ // Check if running latest version (npx may cache an old one)
325
+ try {
326
+ const latest = execSync("npm view harness-evolver version", { stdio: "pipe", timeout: 5000 }).toString().trim();
327
+ if (latest && latest !== VERSION) {
328
+ console.log(` ${YELLOW}!${RESET} You're running v${VERSION} but v${latest} is available.`);
329
+ console.log(` Run: ${BOLD}npx harness-evolver@${latest}${RESET} or ${BOLD}npx --yes harness-evolver@latest${RESET}\n`);
330
+ }
331
+ } catch {}
332
+
270
333
  if (!checkPython()) {
271
334
  console.error(` ${RED}ERROR:${RESET} python3 not found. Install Python 3.10+ first.`);
272
335
  process.exit(1);
@@ -317,6 +380,12 @@ async function main() {
317
380
  const scopeAnswer = await ask(rl, `\n ${YELLOW}Choice [1]:${RESET} `);
318
381
  const scope = (scopeAnswer.trim() === "2") ? "local" : "global";
319
382
 
383
+ // Clean previous install (remove ALL old files before installing new ones)
384
+ console.log(`\n ${BOLD}Cleaning previous install${RESET}`);
385
+ for (const runtime of selected) {
386
+ cleanPreviousInstall(runtime.dir, scope);
387
+ }
388
+
320
389
  // Install skills + agents
321
390
  console.log(`\n ${BOLD}Installing skills & agents${RESET}\n`);
322
391
  for (const runtime of selected) {
@@ -325,7 +394,7 @@ async function main() {
325
394
  console.log();
326
395
  }
327
396
 
328
- // Install tools
397
+ // Install tools (fresh — old dir was cleaned above)
329
398
  console.log(` ${BOLD}Installing tools${RESET}`);
330
399
  installTools();
331
400
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "harness-evolver",
3
- "version": "3.0.1",
3
+ "version": "3.0.2",
4
4
  "description": "LangSmith-native autonomous agent optimization for Claude Code",
5
5
  "author": "Raphael Valdetaro",
6
6
  "license": "MIT",