arashi 1.11.0 → 1.11.2

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/bin/arashi.bat CHANGED
@@ -1,6 +1,6 @@
1
1
  @echo off
2
- REM Wrapper for arashi.exe to support piping to tools like fzf on Windows
3
- REM This closes stdin before executing the binary
2
+ REM Wrapper for arashi.exe on Windows
3
+ REM Preserve stdin so interactive commands like `arashi switch` can prompt
4
4
 
5
5
  REM Get the directory where this script is located
6
6
  set "SCRIPT_DIR=%~dp0"
@@ -17,6 +17,5 @@ if not exist "%BINARY%" (
17
17
  exit /b 1
18
18
  )
19
19
 
20
- REM Execute the binary with stdin closed
21
- REM In Windows, we use <NUL to close/redirect stdin
22
- "%BINARY%" %* <NUL
20
+ REM Execute the binary with inherited stdio
21
+ "%BINARY%" %*
package/bin/arashi.js CHANGED
@@ -10,6 +10,29 @@ const __dirname = dirname(__filename);
10
10
  const argv = process.argv.slice(2);
11
11
  const isWindows = process.platform === "win32";
12
12
 
13
+ const resolveBinaryPath = () => {
14
+ const defaultBinary = isWindows ? "arashi.bin.exe" : "arashi.bin";
15
+ const defaultBinaryPath = join(__dirname, defaultBinary);
16
+
17
+ if (existsSync(defaultBinaryPath)) {
18
+ return defaultBinaryPath;
19
+ }
20
+
21
+ if (isWindows) {
22
+ return join(__dirname, "arashi-windows-x64.exe");
23
+ }
24
+
25
+ if (process.platform === "darwin" && process.arch === "arm64") {
26
+ return join(__dirname, "arashi-macos-arm64");
27
+ }
28
+
29
+ if (process.platform === "linux" && process.arch === "x64") {
30
+ return join(__dirname, "arashi-linux-x64");
31
+ }
32
+
33
+ return defaultBinaryPath;
34
+ };
35
+
13
36
  const ensureInstalled = () => {
14
37
  const wrapper = isWindows ? "arashi.bat" : "arashi";
15
38
  const wrapperPath = join(__dirname, wrapper);
@@ -62,12 +85,12 @@ const ensureInstalled = () => {
62
85
  };
63
86
 
64
87
  ensureInstalled();
65
-
66
88
  const wrapper = isWindows ? "arashi.bat" : "arashi";
67
89
  const wrapperPath = join(__dirname, wrapper);
90
+ const binaryPath = resolveBinaryPath();
68
91
 
69
92
  const child = isWindows
70
- ? spawn(process.env.ComSpec ?? "cmd.exe", ["/d", "/s", "/c", wrapperPath, ...argv], {
93
+ ? spawn(binaryPath, argv, {
71
94
  stdio: "inherit",
72
95
  windowsHide: false,
73
96
  })
package/bin/arashi.ps1 CHANGED
@@ -1,5 +1,5 @@
1
- # PowerShell wrapper for arashi.exe to support piping to tools like fzf
2
- # This closes stdin before executing the binary
1
+ # PowerShell wrapper for arashi.exe on Windows
2
+ # Preserve stdin so interactive commands like `arashi switch` can prompt
3
3
 
4
4
  $ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
5
5
  $Binary = Join-Path $ScriptDir "arashi.bin.exe"
@@ -15,7 +15,10 @@ if (-not (Test-Path $Binary)) {
15
15
  exit 1
16
16
  }
17
17
 
18
- # PowerShell way to close stdin and execute
19
- # We redirect stdin from $null which effectively closes it
20
- $process = Start-Process -FilePath $Binary -ArgumentList $args -NoNewWindow -Wait -PassThru -RedirectStandardInput $null
21
- exit $process.ExitCode
18
+ # Execute with inherited stdio so prompts remain interactive
19
+ & $Binary @args
20
+ if ($LASTEXITCODE -ne $null) {
21
+ exit $LASTEXITCODE
22
+ }
23
+
24
+ exit 0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arashi",
3
- "version": "1.11.0",
3
+ "version": "1.11.2",
4
4
  "description": "Git worktree manager for meta-repositories - The eye of the storm for your development workflow",
5
5
  "keywords": [
6
6
  "cli",
@@ -54,7 +54,7 @@
54
54
  "build:mac": "bun build src/index.ts --compile --target=bun-darwin-arm64 --outfile bin/arashi-macos-arm64",
55
55
  "build:linux": "bun build src/index.ts --compile --target=bun-linux-x64 --outfile bin/arashi-linux-x64",
56
56
  "build:windows": "bun build src/index.ts --compile --target=bun-windows-x64 --outfile bin/arashi-windows-x64.exe",
57
- "test": "bun test",
57
+ "test": "bun run scripts/test/run-tests.ts",
58
58
  "typecheck": "tsc --noEmit",
59
59
  "lint": "oxlint -D no-explicit-any .",
60
60
  "lint:fix": "oxlint --fix -D no-explicit-any .",
@@ -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`,