@neuro.corp/dash 1.0.5 → 1.0.7

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 (3) hide show
  1. package/bin/dash.js +117 -61
  2. package/package.json +12 -30
  3. package/dist/dash.exe +0 -4
package/bin/dash.js CHANGED
@@ -1,61 +1,117 @@
1
- #!/usr/bin/env node
2
- import { spawn } from "node:child_process";
3
- import { fileURLToPath } from "node:url";
4
- import fs from "node:fs";
5
- import path from "node:path";
6
-
7
- const __dirname = path.dirname(fileURLToPath(import.meta.url));
8
- const pkgPath = path.resolve(__dirname, "..", "package.json");
9
- let version = "0.0.0";
10
- try {
11
- const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
12
- if (pkg.version) version = pkg.version;
13
- } catch {}
14
-
15
- const args = process.argv.slice(2);
16
- const hasVersion = args.includes("--version") || args.includes("-v");
17
- const hasHelp = args.includes("--help") || args.includes("-h");
18
-
19
- if (hasVersion) {
20
- console.log(`dash version ${version}`);
21
- process.exit(0);
22
- }
23
-
24
- if (hasHelp) {
25
- console.log(`dash - AI-powered coding agent for your terminal
26
-
27
- Usage:
28
- dash [options] [prompt]
29
-
30
- Options:
31
- -v, --version Show version number
32
- -h, --help Show help
33
-
34
- Commands:
35
- /new Start new chat
36
- /sessions View past sessions
37
- /models Manage AI models
38
- /providers Manage API providers
39
- /updates Check for updates
40
- /exit Exit terminal
41
- /help Show help
42
- /donate Donate to support development
43
-
44
- Examples:
45
- dash "create a todo app"
46
- dash --version
47
- `);
48
- process.exit(0);
49
- }
50
-
51
- const executable = fileURLToPath(new URL("../dist/dash.exe", import.meta.url));
52
- const child = spawn(executable, args, { stdio: "inherit" });
53
-
54
- child.on("error", (error) => {
55
- console.error(`Could not start Dash: ${error.message}`);
56
- process.exitCode = 1;
57
- });
58
-
59
- child.on("exit", (code) => {
60
- process.exitCode = code ?? 1;
61
- });
1
+ #!/usr/bin/env node
2
+
3
+ import fs from "node:fs";
4
+ import path from "node:path";
5
+
6
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
7
+
8
+ const pkgPath = path.resolve(__dirname, "..", "package.json");
9
+
10
+ let version = "0.0.0";
11
+
12
+ try {
13
+ const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
14
+ version = pkg.version || version;
15
+ } catch {
16
+ // Continue with fallback version.
17
+ }
18
+
19
+ // Detect operating system and architecture
20
+ const platform = process.platform;
21
+ const arch = process.arch;
22
+
23
+ // Map platform and architecture to the correct platform package and executable.
24
+ // Supports all five: win32-x64, darwin-x64, darwin-arm64, linux-x64, linux-arm64
25
+ const platformMap = {
26
+ win32: {
27
+ packageName: "@neuro.corp/dash-win32-x64",
28
+ executable: "dist/dash.exe"
29
+ },
30
+ darwin: {
31
+ packageName: arch === "arm64"
32
+ ? "@neuro.corp/dash-darwin-arm64"
33
+ : "@neuro.corp/dash-darwin-x64",
34
+ executable: "dist/dash"
35
+ },
36
+ linux: {
37
+ packageName: arch === "arm64"
38
+ ? "@neuro.corp/dash-linux-arm64"
39
+ : "@neuro.corp/dash-linux-x64",
40
+ executable: "dist/dash"
41
+ }
42
+ };
43
+
44
+ // Determine the platform info; if platform is not supported, error out
45
+ let platformInfo;
46
+ if (platform in platformMap) {
47
+ platformInfo = platformMap[platform];
48
+ } else {
49
+ console.error(
50
+ `Dash does not currently support ${platform} ${arch}.`
51
+ );
52
+ process.exit(1);
53
+ }
54
+
55
+ // Robust resolution of the platform package.
56
+ // Walk up from the script's directory to find the platform package in node_modules.
57
+ // This works whether Dash is installed globally or as a project dependency.
58
+ const packageName = platformInfo.packageName;
59
+ let packageDir = null;
60
+
61
+ let searchDir = __dirname;
62
+ for (let i = 0; i < 10; i++) {
63
+ const candidate = path.join(searchDir, "node_modules", packageName);
64
+ if (fs.existsSync(candidate)) {
65
+ packageDir = candidate;
66
+ break;
67
+ }
68
+ searchDir = path.dirname(searchDir);
69
+ }
70
+
71
+ if (!packageDir) {
72
+ console.error(
73
+ `Could not find the Dash platform package: ${packageName}\n` +
74
+ `Try reinstalling Dash: npm install -g @neuro.corp/dash`
75
+ );
76
+ process.exit(1);
77
+ }
78
+
79
+ // Resolve the executable path inside the platform package
80
+ const executablePath = path.join(packageDir, platformInfo.executable);
81
+
82
+ // Verify executable exists and is a file
83
+ if (!fs.existsSync(executablePath)) {
84
+ console.error(`Dash executable not found: ${executablePath}`);
85
+ process.exit(1);
86
+ }
87
+
88
+ const stat = fs.statSync(executablePath);
89
+
90
+ if (!stat.isFile()) {
91
+ console.error(`Expected an executable file: ${executablePath}`);
92
+ process.exit(1);
93
+ }
94
+
95
+ // On Unix platforms, verify the executable has execute permissions
96
+ if (platform !== "win32" && (stat.mode & 0o111) === 0) {
97
+ console.error(
98
+ `Dash executable does not have executable permissions: ${executablePath}`
99
+ );
100
+ process.exit(1);
101
+ }
102
+
103
+ // Execute the binary, forwarding all CLI arguments,
104
+ // preserving terminal input/output, and propagating exit code
105
+ const { spawn } = require("node:child_process");
106
+ const child = spawn(executablePath, args, {
107
+ stdio: "inherit"
108
+ });
109
+
110
+ child.on("error", (error) => {
111
+ console.error(`Could not start Dash: ${error.message}`);
112
+ process.exitCode = 1;
113
+ });
114
+
115
+ child.on("exit", (code, signal) => {
116
+ process.exitCode = code ?? (signal ? 1 : 0);
117
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neuro.corp/dash",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "AI-powered terminal coding agent for developers",
5
5
  "license": "PROPRIETARY",
6
6
  "type": "module",
@@ -9,44 +9,26 @@
9
9
  },
10
10
  "files": [
11
11
  "bin/",
12
- "dist/dash.exe",
13
12
  "LICENSE",
14
13
  "README.md"
15
14
  ],
16
- "homepage": "https://github.com/neuro-corp/DASH",
15
+ "homepage": "https://github.com/neuro.corp/DASH",
17
16
  "repository": {
18
17
  "type": "git",
19
- "url": "https://github.com/neuro-corp/DASH"
18
+ "url": "git+https://github.com/neuro.corp/DASH.git"
20
19
  },
21
20
  "bugs": {
22
- "url": "https://github.com/neuro-corp/DASH/issues"
21
+ "url": "https://github.com/neuro.corp/DASH/issues"
23
22
  },
24
- "scripts": {
25
- "dev": "bun run src/index.tsx",
26
- "start": "bun run src/index.tsx",
27
- "build": "bun build --compile ./src/index.tsx --outfile ./dist/dash.exe",
28
- "prepack": "npm run build"
29
- },
30
- "devDependencies": {
31
- "@types/bun": "latest"
32
- },
33
- "dependencies": {
34
- "@opentui/core": "^0.6.8",
35
- "@opentui/react": "^0.6.8",
36
- "@types/react": "^19.3.0",
37
- "chalk": "^6.0.1",
38
- "cli-highlight": "^2.1.11",
39
- "figures": "^6.1.0",
40
- "ink": "^8.0.0",
41
- "ink-spinner": "^5.0.0",
42
- "ink-text-input": "^6.0.0",
43
- "marked": "^15.0.12",
44
- "marked-terminal": "^7.3.0",
45
- "react": "^19.3.1",
46
- "react-dom": "^19.3.1",
47
- "string-width": "^8.3.0",
48
- "wrap-ansi": "^10.0.2"
23
+ "optionalDependencies": {
24
+ "@neuro.corp/dash-win32-x64": "1.0.7",
25
+ "@neuro.corp/dash-darwin-x64": "1.0.7",
26
+ "@neuro.corp/dash-darwin-arm64": "1.0.7",
27
+ "@neuro.corp/dash-linux-x64": "1.0.7",
28
+ "@neuro.corp/dash-linux-arm64": "1.0.7"
49
29
  },
30
+ "os": ["win32", "darwin", "linux"],
31
+ "cpu": ["x64", "arm64"],
50
32
  "engines": {
51
33
  "node": ">=20"
52
34
  }
package/dist/dash.exe DELETED
@@ -1,4 +0,0 @@
1
- [diffend] Oversized file quarantined before diffing.
2
- name: package/dist/dash.exe
3
- size: 104884224 bytes
4
- sha256: 0e4b99d05419fcf623ed567bba0c24c5867c653f6717f4c3b9f4da0f69dd8048