shin-engine 1.0.4 → 1.0.5

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/ee.js +17 -6
  2. package/package.json +1 -1
package/bin/ee.js CHANGED
@@ -25,16 +25,27 @@ function sleep(ms) { return new Promise(r => setTimeout(r, ms)); }
25
25
 
26
26
  function download(url, dest) {
27
27
  return new Promise((resolve, reject) => {
28
- const file = require("fs").createWriteStream(dest);
28
+ const fs = require("fs");
29
+ const file = fs.createWriteStream(dest);
29
30
  const proto = url.startsWith("https") ? https : http;
30
31
  proto.get(url, res => {
31
32
  if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
33
+ file.close();
34
+ fs.unlink(dest, () => {});
32
35
  download(res.headers.location, dest).then(resolve).catch(reject);
33
36
  return;
34
37
  }
35
38
  res.pipe(file);
36
- file.on("finish", () => { file.close(); resolve(); });
37
- }).on("error", reject);
39
+ file.on("finish", () => {
40
+ file.close();
41
+ // Small delay to ensure OS releases file lock
42
+ setTimeout(resolve, 500);
43
+ });
44
+ }).on("error", err => {
45
+ file.close();
46
+ fs.unlink(dest, () => {});
47
+ reject(err);
48
+ });
38
49
  });
39
50
  }
40
51
 
@@ -78,14 +89,14 @@ async function ensureSetup() {
78
89
  return false;
79
90
  }
80
91
 
81
- // Extract (use PowerShell for Windows zip extraction)
92
+ // Extract
82
93
  step("Extracting...");
83
94
  try {
84
95
  execSync(
85
- `powershell -Command "Expand-Archive -Path '${zipPath}' -DestinationPath '${EE_HOME}' -Force"`,
96
+ `powershell -Command "Start-Sleep 1; Expand-Archive -Path '${zipPath}' -DestinationPath '${EE_HOME}' -Force"`,
86
97
  { encoding: "utf-8", timeout: 30000 }
87
98
  );
88
- require("fs").unlinkSync(zipPath);
99
+ execSync(`del "${zipPath}"`, { encoding: "utf-8", timeout: 5000 });
89
100
  ok("Extracted to " + EE_HOME);
90
101
  } catch (e) {
91
102
  log(" Extraction failed: " + e.message);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shin-engine",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "Engineering Experience Engine — engineering judgment for AI coding agents",
5
5
  "bin": {
6
6
  "shin": "bin/ee.js"