shin-engine 1.0.3 → 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 +35 -10
  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);
@@ -112,7 +123,13 @@ async function ensureSetup() {
112
123
  }
113
124
 
114
125
  async function main() {
115
- if (!cmd || cmd === "start") {
126
+ if (!cmd) {
127
+ log("Usage: shin <command>");
128
+ log("Run 'shin --help' for options");
129
+ return;
130
+ }
131
+
132
+ if (cmd === "start") {
116
133
  if (isRunning()) { log("SHIN is already running on port " + PORT); return; }
117
134
  const setup = await ensureSetup();
118
135
  if (!setup) { process.exit(1); }
@@ -157,13 +174,21 @@ async function main() {
157
174
  return;
158
175
  }
159
176
 
177
+ if (cmd === "view") {
178
+ if (!isRunning()) { log("SHIN is not running. Run 'shin start' first."); return; }
179
+ execSync("powershell -Command \"Start-Process 'http://localhost:" + PORT + "'\"", { timeout: 5000 });
180
+ log("Opening SHIN dashboard...");
181
+ return;
182
+ }
183
+
160
184
  if (cmd === "--help" || cmd === "-h") {
161
185
  log("Usage: shin <command>");
162
186
  log("");
163
187
  log("Commands:");
164
- log(" shin start Start the SHIN backend (first run downloads + installs)");
165
- log(" shin stop Stop the SHIN backend");
166
- log(" shin status Check if SHIN is running");
188
+ log(" shin start Start the SHIN backend (first run downloads + installs)");
189
+ log(" shin stop Stop the SHIN backend");
190
+ log(" shin status Check if SHIN is running");
191
+ log(" shin view Open the SHIN dashboard in browser");
167
192
  return;
168
193
  }
169
194
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shin-engine",
3
- "version": "1.0.3",
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"