@ngominhbinh708/spark 0.6.0-windows-arm64 → 0.6.0

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.
package/README.md ADDED
@@ -0,0 +1,157 @@
1
+ # @ngominhbinh708/spark
2
+
3
+ [English](#english) | [中文](#中文)
4
+
5
+ ---
6
+
7
+ <a name="english"></a>
8
+ ## English
9
+
10
+ A unified launcher for AI coding agents with configurable OpenAI-compatible gateways.
11
+
12
+ ### Installation
13
+
14
+ ```bash
15
+ npm i -g @ngominhbinh708/spark
16
+ ```
17
+
18
+ **How it works**: This package uses [npm alias](https://docs.npmjs.com/cli/v9/commands/npm-install#aliases) to automatically install the correct binary for your platform. No additional download scripts needed.
19
+
20
+ ### Platform Support
21
+
22
+ | OS | Architecture | npm alias |
23
+ |----|--------------|-----------|
24
+ | macOS | ARM64 (M1/M2) | `@ngominhbinh708/spark-darwin-arm64` |
25
+ | macOS | x64 (Intel) | `@ngominhbinh708/spark-darwin-x64` |
26
+ | Linux | ARM64 | `@ngominhbinh708/spark-linux-arm64` |
27
+ | Linux | x64 | `@ngominhbinh708/spark-linux-x64` |
28
+ | Windows | ARM64 | `@ngominhbinh708/spark-windows-arm64` |
29
+ | Windows | x64 | `@ngominhbinh708/spark-windows-x64` |
30
+
31
+ ### Usage
32
+
33
+ ```bash
34
+ # Run spark
35
+ spark
36
+
37
+ # Show version
38
+ spark --version
39
+
40
+ # Show help
41
+ spark --help
42
+ ```
43
+
44
+ ### npm Alias Architecture
45
+
46
+ The main package defines `optionalDependencies` using npm alias syntax:
47
+
48
+ ```json
49
+ {
50
+ "optionalDependencies": {
51
+ "@ngominhbinh708/spark-linux-x64": "npm:@ngominhbinh708/spark@0.1.6-linux-x64",
52
+ "@ngominhbinh708/spark-darwin-arm64": "npm:@ngominhbinh708/spark@0.1.6-darwin-arm64",
53
+ ...
54
+ }
55
+ }
56
+ ```
57
+
58
+ npm will:
59
+ 1. Install the main package
60
+ 2. Evaluate each optionalDependency's `os`/`cpu` constraints
61
+ 3. Only install the matching platform variant
62
+
63
+ This is the same approach used by [@openai/codex](https://github.com/openai/codex).
64
+
65
+ ### Troubleshooting
66
+
67
+ #### Platform package not found
68
+
69
+ ```
70
+ Platform package not found: @ngominhbinh708/spark-darwin-arm64
71
+ ```
72
+
73
+ Try reinstalling:
74
+
75
+ ```bash
76
+ npm uninstall -g @ngominhbinh708/spark
77
+ npm install -g @ngominhbinh708/spark@latest
78
+ ```
79
+
80
+ ---
81
+
82
+ <a name="中文"></a>
83
+ ## 中文
84
+
85
+ 一个统一的 AI 编码代理启动器,支持可配置的 OpenAI 兼容网关。
86
+
87
+ ### 安装
88
+
89
+ ```bash
90
+ npm i -g @ngominhbinh708/spark
91
+ ```
92
+
93
+ **工作原理**:此包使用 [npm alias](https://docs.npmjs.com/cli/v9/commands/npm-install#aliases) 自动安装适合你平台的二进制文件,无需额外的下载脚本。
94
+
95
+ ### 支持的平台
96
+
97
+ | 操作系统 | 架构 | npm 别名 |
98
+ |---------|------|---------|
99
+ | macOS | ARM64 (M1/M2) | `@ngominhbinh708/spark-darwin-arm64` |
100
+ | macOS | x64 (Intel) | `@ngominhbinh708/spark-darwin-x64` |
101
+ | Linux | ARM64 | `@ngominhbinh708/spark-linux-arm64` |
102
+ | Linux | x64 | `@ngominhbinh708/spark-linux-x64` |
103
+ | Windows | ARM64 | `@ngominhbinh708/spark-windows-arm64` |
104
+ | Windows | x64 | `@ngominhbinh708/spark-windows-x64` |
105
+
106
+ ### 使用方法
107
+
108
+ ```bash
109
+ # 运行 spark
110
+ spark
111
+
112
+ # 显示版本
113
+ spark --version
114
+
115
+ # 显示帮助
116
+ spark --help
117
+ ```
118
+
119
+ ### 故障排除
120
+
121
+ #### 找不到平台包
122
+
123
+ ```
124
+ Platform package not found: @ngominhbinh708/spark-darwin-arm64
125
+ ```
126
+
127
+ 尝试重新安装:
128
+
129
+ ```bash
130
+ npm uninstall -g @ngominhbinh708/spark
131
+ npm install -g @ngominhbinh708/spark@latest
132
+ ```
133
+
134
+ ---
135
+
136
+ ## Development
137
+
138
+ ### Building Platform Packages
139
+
140
+ ```bash
141
+ cd npm
142
+ node scripts/build-packages.js
143
+ ```
144
+
145
+ This downloads binaries from GitHub Releases and creates platform packages.
146
+
147
+ ### Publishing
148
+
149
+ The release workflow publishes:
150
+ 1. Platform packages: `@ngominhbinh708/spark@VERSION-PLATFORM-ARCH`
151
+ 2. Main package: `@ngominhbinh708/spark@VERSION`
152
+
153
+ ---
154
+
155
+ ## License
156
+
157
+ MIT
package/bin/spark.js ADDED
@@ -0,0 +1,81 @@
1
+ #!/usr/bin/env node
2
+
3
+ const path = require("path");
4
+ const cp = require("child_process");
5
+
6
+ // Platform mapping
7
+ const platformMap = {
8
+ darwin: "darwin",
9
+ linux: "linux",
10
+ win32: "windows"
11
+ };
12
+
13
+ const archMap = {
14
+ x64: "x64",
15
+ arm64: "arm64"
16
+ };
17
+
18
+ const platform = platformMap[process.platform];
19
+ const arch = archMap[process.arch];
20
+
21
+ if (!platform || !arch) {
22
+ console.error(
23
+ `Unsupported platform/arch: ${process.platform}/${process.arch}`
24
+ );
25
+ console.error(
26
+ "Please check https://github.com/zhangsanfeng1094/spark for supported platforms."
27
+ );
28
+ process.exit(1);
29
+ }
30
+
31
+ // Determine package alias (matches optionalDependencies in main package)
32
+ // The alias maps to: npm:@ngominhbinh708/spark@VERSION-PLATFORM-ARCH
33
+ const packageAlias = `@ngominhbinh708/spark-${platform}-${arch}`;
34
+ const binaryName = process.platform === "win32" ? "spark.exe" : "spark";
35
+
36
+ let binaryPath;
37
+ try {
38
+ // Try to resolve the platform-specific package via alias
39
+ // This resolves the npm alias: @ngominhbinh708/spark-linux-x64 -> @ngominhbinh708/spark@VERSION-linux-x64
40
+ const packageJsonPath = require.resolve(`${packageAlias}/package.json`);
41
+ const vendorDir = path.join(path.dirname(packageJsonPath), "vendor");
42
+ binaryPath = path.join(vendorDir, binaryName);
43
+ } catch (e) {
44
+ // Package not installed
45
+ console.error(`Platform package not found: ${packageAlias}`);
46
+ console.error("");
47
+ console.error("This may happen if:");
48
+ console.error(" 1. npm optionalDependencies was skipped due to a platform mismatch");
49
+ console.error(" 2. The package was not installed correctly");
50
+ console.error("");
51
+ console.error("Try reinstalling:");
52
+ console.error(" npm install -g @ngominhbinh708/spark@latest");
53
+ console.error("");
54
+ console.error("Or check if your platform is supported:");
55
+ console.error(" Platform: " + process.platform);
56
+ console.error(" Arch: " + process.arch);
57
+ process.exit(1);
58
+ }
59
+
60
+ // Check if binary exists
61
+ const fs = require("fs");
62
+ if (!fs.existsSync(binaryPath)) {
63
+ console.error(`Binary not found: ${binaryPath}`);
64
+ console.error("The platform package was installed but the binary is missing.");
65
+ console.error("Try reinstalling:");
66
+ console.error(" npm install -g @ngominhbinh708/spark@latest");
67
+ process.exit(1);
68
+ }
69
+
70
+ // Execute the binary with all arguments
71
+ const result = cp.spawnSync(binaryPath, process.argv.slice(2), {
72
+ stdio: "inherit",
73
+ env: process.env
74
+ });
75
+
76
+ if (result.error) {
77
+ console.error(result.error.message);
78
+ process.exit(1);
79
+ }
80
+
81
+ process.exit(result.status === null ? 1 : result.status);
package/package.json CHANGED
@@ -1,19 +1,34 @@
1
1
  {
2
2
  "name": "@ngominhbinh708/spark",
3
- "version": "0.6.0-windows-arm64",
4
- "description": "Spark CLI binary for win32 arm64",
3
+ "version": "0.6.0",
4
+ "description": "A unified launcher for AI coding agents",
5
5
  "license": "MIT",
6
- "os": [
7
- "win32"
8
- ],
9
- "cpu": [
10
- "arm64"
11
- ],
6
+ "bin": {
7
+ "spark": "bin/spark.js"
8
+ },
12
9
  "files": [
13
- "vendor"
10
+ "bin"
14
11
  ],
12
+ "scripts": {},
15
13
  "repository": {
16
14
  "type": "git",
17
15
  "url": "https://github.com/zhangsanfeng1094/spark.git"
16
+ },
17
+ "keywords": [
18
+ "spark",
19
+ "cli",
20
+ "agent",
21
+ "launcher"
22
+ ],
23
+ "engines": {
24
+ "node": ">=18"
25
+ },
26
+ "optionalDependencies": {
27
+ "@ngominhbinh708/spark-linux-x64": "npm:@ngominhbinh708/spark@0.1.6-linux-x64",
28
+ "@ngominhbinh708/spark-linux-arm64": "npm:@ngominhbinh708/spark@0.1.6-linux-arm64",
29
+ "@ngominhbinh708/spark-darwin-x64": "npm:@ngominhbinh708/spark@0.1.6-darwin-x64",
30
+ "@ngominhbinh708/spark-darwin-arm64": "npm:@ngominhbinh708/spark@0.1.6-darwin-arm64",
31
+ "@ngominhbinh708/spark-windows-x64": "npm:@ngominhbinh708/spark@0.1.6-windows-x64",
32
+ "@ngominhbinh708/spark-windows-arm64": "npm:@ngominhbinh708/spark@0.1.6-windows-arm64"
18
33
  }
19
34
  }
package/vendor/spark.exe DELETED
Binary file