arashi 1.5.1 → 1.7.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.
Files changed (3) hide show
  1. package/README.md +17 -1
  2. package/bin/arashi.js +59 -4
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -94,10 +94,12 @@ Arashi currently provides these commands:
94
94
 
95
95
  - `arashi init`
96
96
  - `arashi add <git-url>`
97
+ - `arashi clone [--all]`
97
98
  - `arashi create <branch>`
98
99
  - `arashi list`
99
100
  - `arashi status`
100
101
  - `arashi remove <branch|path>`
102
+ - `arashi switch [filter] [--repos|--all] [--sesh]`
101
103
  - `arashi pull`
102
104
  - `arashi sync`
103
105
  - `arashi setup [--only <repo>] [--verbose]`
@@ -110,19 +112,27 @@ arashi add git@github.com:your-org/frontend.git
110
112
  arashi add git@github.com:your-org/backend.git
111
113
  arashi create feature-auth-refresh
112
114
  arashi status
115
+ arashi switch feature-auth-refresh # parent repo worktrees
116
+ arashi switch --repos feature-auth-refresh # child repo worktrees in current workspace
117
+ arashi switch --all feature-auth-refresh # all repos
118
+ arashi switch --repos docs # repo-name matching in child repos
113
119
  ```
114
120
 
115
121
  ## Hooks
116
122
 
117
- Arashi can run lifecycle hooks during `arashi create` to automate setup steps.
123
+ Arashi can run lifecycle hooks during `arashi create` and `arashi remove`.
118
124
 
119
125
  - Global hooks in `.arashi/hooks/`:
120
126
  - `pre-create.sh`
121
127
  - `post-create.sh`
128
+ - `pre-remove.sh`
129
+ - `post-remove.sh`
122
130
  - Repository-specific hooks:
123
131
  - `pre-create.<repo>.sh`
124
132
  - `post-create.<repo>.sh`
125
133
 
134
+ `pre-remove.sh` is useful for teardown before deletion (for example, stopping tmux sessions), and `post-remove.sh` can run final cleanup after remove operations complete.
135
+
126
136
  See [`docs/hooks.md`](./docs/hooks.md) for hook behavior, environment variables, and examples.
127
137
 
128
138
  ## Workflow Shortcuts
@@ -163,6 +173,10 @@ bind '"\C-s":"sesh connect \$(arashi list | fzf)\n"'
163
173
  bindkey -s '^s' 'sesh connect $(arashi list | fzf)\n'
164
174
  ```
165
175
 
176
+ You can also use `arashi switch --sesh` directly inside tmux to open the selected worktree in a new tmux window.
177
+
178
+ `arashi switch` also detects tmux, Kitty, Ghostty, WezTerm, and iTerm2 contexts and prefers terminal-native launch behavior when available.
179
+
166
180
  ### Fast remove selection
167
181
 
168
182
  ```bash
@@ -188,8 +202,10 @@ Arashi also ships a dedicated `skills.sh` integration package for guided install
188
202
  ## Documentation
189
203
 
190
204
  - Installation details: [`docs/INSTALLATION.md`](./docs/INSTALLATION.md)
205
+ - Clone command details: [`docs/commands/clone.md`](./docs/commands/clone.md)
191
206
  - Hook behavior: [`docs/hooks.md`](./docs/hooks.md)
192
207
  - Setup command details: [`docs/commands/setup.md`](./docs/commands/setup.md)
208
+ - Switch command details: [`docs/commands/switch.md`](./docs/commands/switch.md)
193
209
  - Remove command details: [`docs/commands/remove.md`](./docs/commands/remove.md)
194
210
  - FZF integration: [`docs/FZF_COMPATIBILITY.md`](./docs/FZF_COMPATIBILITY.md)
195
211
 
package/bin/arashi.js CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { spawn } from "node:child_process";
2
+ import { spawn, spawnSync } from "node:child_process";
3
+ import { existsSync } from "node:fs";
3
4
  import { dirname, join } from "node:path";
4
5
  import { fileURLToPath } from "node:url";
5
6
 
@@ -8,14 +9,68 @@ const __dirname = dirname(__filename);
8
9
 
9
10
  const argv = process.argv.slice(2);
10
11
  const isWindows = process.platform === "win32";
12
+
13
+ const ensureInstalled = () => {
14
+ const wrapper = isWindows ? "arashi.bat" : "arashi";
15
+ const wrapperPath = join(__dirname, wrapper);
16
+ const postinstallPath = join(__dirname, "..", "scripts", "postinstall.js");
17
+ const defaultBinary = isWindows ? "arashi.bin.exe" : "arashi.bin";
18
+ const defaultBinaryPath = join(__dirname, defaultBinary);
19
+ const platformBinary = (() => {
20
+ if (isWindows) {
21
+ return "arashi-windows-x64.exe";
22
+ }
23
+
24
+ if (process.platform === "darwin" && process.arch === "arm64") {
25
+ return "arashi-macos-arm64";
26
+ }
27
+
28
+ if (process.platform === "linux" && process.arch === "x64") {
29
+ return "arashi-linux-x64";
30
+ }
31
+
32
+ return null;
33
+ })();
34
+ const platformBinaryPath = platformBinary ? join(__dirname, platformBinary) : null;
35
+ const binaryExists = () => {
36
+ if (existsSync(defaultBinaryPath)) {
37
+ return true;
38
+ }
39
+
40
+ if (platformBinaryPath && existsSync(platformBinaryPath)) {
41
+ return true;
42
+ }
43
+
44
+ return false;
45
+ };
46
+
47
+ if (existsSync(wrapperPath) && binaryExists()) {
48
+ return;
49
+ }
50
+
51
+ console.log("arashi binary missing; running postinstall to download.");
52
+ const result = spawnSync(process.execPath, [postinstallPath], { stdio: "inherit" });
53
+
54
+ if (result.error) {
55
+ console.error(`Failed to run postinstall. ${result.error.message}.`);
56
+ process.exit(1);
57
+ }
58
+
59
+ if (typeof result.status === "number" && result.status !== 0) {
60
+ process.exit(result.status);
61
+ }
62
+ };
63
+
64
+ ensureInstalled();
65
+
11
66
  const wrapper = isWindows ? "arashi.bat" : "arashi";
12
67
  const wrapperPath = join(__dirname, wrapper);
13
68
 
14
69
  const child = isWindows
15
70
  ? spawn(process.env.ComSpec ?? "cmd.exe", ["/d", "/s", "/c", wrapperPath, ...argv], {
16
- stdio: "inherit",
17
- windowsHide: false,
18
- })
71
+ stdio: "inherit",
72
+ windowsHide: false,
73
+ })
19
74
  : spawn(wrapperPath, argv, { stdio: "inherit" });
20
75
 
21
76
  child.on("exit", (code, signal) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arashi",
3
- "version": "1.5.1",
3
+ "version": "1.7.0",
4
4
  "description": "Git worktree manager for meta-repositories - The eye of the storm for your development workflow",
5
5
  "keywords": [
6
6
  "cli",