arashi 1.11.0 → 1.11.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.
package/README.md CHANGED
@@ -37,8 +37,9 @@ arashi --version
37
37
  ```
38
38
 
39
39
  By default, the installer places `arashi` in `~/.arashi/bin`, adds that path to your shell config, and in interactive installs offers to enable shell integration for `arashi switch --cd`.
40
+ It also runs a quick `arashi --version` smoke test before declaring success.
40
41
 
41
- If curl installation fails, use npm installation below or the manual release instructions in [`docs/INSTALLATION.md`](./docs/INSTALLATION.md).
42
+ If curl installation fails, or if the smoke test reports a bad release artifact, use npm installation below or the manual release instructions in [`docs/INSTALLATION.md`](./docs/INSTALLATION.md).
42
43
 
43
44
  ### Option 2: Install with npm
44
45
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arashi",
3
- "version": "1.11.0",
3
+ "version": "1.11.1",
4
4
  "description": "Git worktree manager for meta-repositories - The eye of the storm for your development workflow",
5
5
  "keywords": [
6
6
  "cli",
@@ -5,11 +5,12 @@
5
5
  * This keeps the npm package size small while providing pre-compiled binaries
6
6
  */
7
7
 
8
- import { access, constants, mkdir } from "node:fs/promises";
8
+ import { access, constants, mkdir, readFile, rm } from "node:fs/promises";
9
9
  import { chmodSync, createWriteStream } from "node:fs";
10
10
  import { dirname, join } from "node:path";
11
11
  import { fileURLToPath } from "node:url";
12
12
  import { get } from "node:https";
13
+ import { spawnSync } from "node:child_process";
13
14
 
14
15
  const __filename = fileURLToPath(import.meta.url);
15
16
  const __dirname = dirname(__filename);
@@ -81,8 +82,36 @@ function downloadFile(url, dest) {
81
82
  });
82
83
  }
83
84
 
85
+ function verifyBinary(binaryPath) {
86
+ const result = spawnSync(binaryPath, ["--version"], {
87
+ encoding: "utf8",
88
+ stdio: ["ignore", "pipe", "pipe"],
89
+ });
90
+
91
+ if (result.error) {
92
+ throw result.error;
93
+ }
94
+
95
+ if (result.status !== 0) {
96
+ const signalDetail = result.signal ? ` (signal: ${result.signal})` : "";
97
+ const output = `${result.stdout ?? ""}${result.stderr ?? ""}`.trim();
98
+ throw new Error(
99
+ `Downloaded binary failed smoke test with exit code ${result.status ?? "unknown"}${signalDetail}${output ? `: ${output}` : ""}`,
100
+ );
101
+ }
102
+
103
+ const versionOutput = (result.stdout ?? "").trim();
104
+ if (!versionOutput) {
105
+ throw new Error("Downloaded binary returned success but produced no version output");
106
+ }
107
+
108
+ console.log(`✓ Verified ${PACKAGE_NAME} executable (${versionOutput})`);
109
+ }
110
+
84
111
  // Main installation logic
85
112
  async function install() {
113
+ let binaryPath = "";
114
+
86
115
  try {
87
116
  // Skip postinstall in development (when installing from the repo)
88
117
  // Check if we're in development by looking for src/ directory
@@ -98,13 +127,12 @@ async function install() {
98
127
 
99
128
  // Get version from package.json
100
129
  const packageJsonPath = join(__dirname, "..", "package.json");
101
- const { readFile } = await import("node:fs/promises");
102
130
  const packageJson = JSON.parse(await readFile(packageJsonPath, "utf8"));
103
131
  const { version } = packageJson;
104
132
 
105
133
  const { binaryName, isWindows } = getPlatformInfo();
106
134
  const binDir = join(__dirname, "..", "bin");
107
- const binaryPath = join(binDir, binaryName);
135
+ binaryPath = join(binDir, binaryName);
108
136
 
109
137
  // Check if binary already exists
110
138
  try {
@@ -128,9 +156,15 @@ async function install() {
128
156
  chmodSync(binaryPath, 0o755);
129
157
  }
130
158
 
159
+ verifyBinary(binaryPath);
160
+
131
161
  console.log(`✓ Successfully installed ${PACKAGE_NAME} v${version}`);
132
162
  console.log(` Binary location: ${binaryPath}`);
133
163
  } catch (error) {
164
+ if (binaryPath) {
165
+ await rm(binaryPath, { force: true }).catch(() => {});
166
+ }
167
+
134
168
  console.error(`✗ Failed to install ${PACKAGE_NAME}:`, error.message);
135
169
  console.error(
136
170
  `\nYou can manually download binaries from: https://github.com/${GITHUB_REPO}/releases`,