@t2code/cli 0.1.5 → 0.1.6-nightly.20261111.730

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/t2code.mjs +28 -1
  2. package/package.json +3 -3
package/bin/t2code.mjs CHANGED
@@ -93,6 +93,24 @@ async function install(dir, key) {
93
93
  });
94
94
  if (extract.status !== 0) throw new Error(`could not extract ${archive}`);
95
95
  fs.rmSync(file);
96
+ const validate = spawnSync(
97
+ path.join(staging, process.platform === "win32" ? "t2.exe" : "t2"),
98
+ ["--version"],
99
+ {
100
+ stdio: ["ignore", "ignore", "pipe"],
101
+ encoding: "utf8",
102
+ timeout: 30_000,
103
+ killSignal: "SIGKILL",
104
+ },
105
+ );
106
+ if (validate.status !== 0) {
107
+ throw executableError(
108
+ key,
109
+ validate.error?.message ||
110
+ validate.stderr?.trim() ||
111
+ `--version exited with ${validate.signal || validate.status}`,
112
+ );
113
+ }
96
114
  fs.writeFileSync(path.join(staging, ".install-complete"), `${version}\n`);
97
115
  publish(staging, dir);
98
116
  } finally {
@@ -180,12 +198,21 @@ async function main() {
180
198
  for (const signal of ["SIGINT", "SIGTERM", "SIGHUP"]) {
181
199
  process.on(signal, () => (ipc || signal !== "SIGINT") && child.kill(signal));
182
200
  }
183
- child.on("error", (error) => fail(error));
201
+ child.on("error", (error) => fail(executableError(key, error.message)));
184
202
  child.on("exit", (code, signal) =>
185
203
  process.exit(code ?? 128 + (os.constants.signals[signal] || 1)),
186
204
  );
187
205
  }
188
206
 
207
+ function executableError(key, detail) {
208
+ return new Error(
209
+ `could not run T2 Code ${version} for ${key}: ${detail}` +
210
+ (process.platform === "linux"
211
+ ? "\nThe Linux release requires glibc; musl-based systems such as Alpine are not supported. Use a glibc-based Linux environment."
212
+ : ""),
213
+ );
214
+ }
215
+
189
216
  function fail(error) {
190
217
  process.stderr.write(`t2code: ${error.message}\n`);
191
218
  process.exit(1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@t2code/cli",
3
- "version": "0.1.5",
3
+ "version": "0.1.6-nightly.20261111.730",
4
4
  "description": "T2 Code CLI. Downloads the self-contained executable for this platform from the GitHub Release.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -18,7 +18,7 @@
18
18
  "engines": {
19
19
  "node": ">=20.11"
20
20
  },
21
- "t3code": {
22
- "databaseMigration": 74
21
+ "t2code": {
22
+ "databaseMigration": 80
23
23
  }
24
24
  }