@neuro.corp/dash 1.1.0 → 1.1.1

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/dash.js +33 -3
  2. package/package.json +2 -2
package/bin/dash.js CHANGED
@@ -96,6 +96,32 @@ if (!stat.isFile()) {
96
96
  process.exit(1);
97
97
  }
98
98
 
99
+ if (platform === "win32") {
100
+ let validPe = false;
101
+ let fd;
102
+ try {
103
+ fd = fs.openSync(executablePath, "r");
104
+ const header = Buffer.alloc(64);
105
+ if (fs.readSync(fd, header, 0, header.length, 0) === header.length
106
+ && header.toString("ascii", 0, 2) === "MZ") {
107
+ const signature = Buffer.alloc(4);
108
+ const peOffset = header.readUInt32LE(0x3c);
109
+ validPe = fs.readSync(fd, signature, 0, 4, peOffset) === 4
110
+ && signature.toString("binary") === "PE\0\0";
111
+ }
112
+ } catch {
113
+ validPe = false;
114
+ } finally {
115
+ if (fd !== undefined) fs.closeSync(fd);
116
+ }
117
+
118
+ if (!validPe) {
119
+ console.error(`Invalid Windows executable: ${executablePath}`);
120
+ console.error("The platform package is incomplete or corrupted; reinstall Dash after updating the package.");
121
+ process.exit(1);
122
+ }
123
+ }
124
+
99
125
  // On Unix platforms, verify the executable has execute permissions
100
126
  if (platform !== "win32" && (stat.mode & 0o111) === 0) {
101
127
  console.error(
@@ -107,9 +133,13 @@ if (platform !== "win32" && (stat.mode & 0o111) === 0) {
107
133
  // Execute the binary, forwarding all CLI arguments,
108
134
  // preserving terminal input/output, and propagating exit code
109
135
  import { spawn } from "node:child_process";
110
- const child = spawn(executablePath, args, {
111
- stdio: "inherit"
112
- });
136
+ let child;
137
+ try {
138
+ child = spawn(executablePath, args, { stdio: "inherit" });
139
+ } catch (error) {
140
+ console.error(`Could not start Dash: ${error.message}`);
141
+ process.exit(1);
142
+ }
113
143
 
114
144
  child.on("error", (error) => {
115
145
  console.error(`Could not start Dash: ${error.message}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neuro.corp/dash",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "AI-powered terminal coding agent for developers",
5
5
  "license": "PROPRIETARY",
6
6
  "type": "module",
@@ -21,7 +21,7 @@
21
21
  "url": "https://github.com/neuro.corp/DASH/issues"
22
22
  },
23
23
  "optionalDependencies": {
24
- "@neuro.corp/dash-win32-x64": "1.1.0",
24
+ "@neuro.corp/dash-win32-x64": "1.1.1",
25
25
  "@neuro.corp/dash-darwin-x64": "1.1.0",
26
26
  "@neuro.corp/dash-darwin-arm64": "1.1.0",
27
27
  "@neuro.corp/dash-linux-x64": "1.1.0",