@hwip/cli 0.1.12 → 0.1.13
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/dist/worktree.d.ts +9 -3
- package/dist/worktree.js +16 -7
- package/package.json +1 -1
package/dist/worktree.d.ts
CHANGED
|
@@ -136,9 +136,15 @@ export interface WorktreeStatus {
|
|
|
136
136
|
/** What `hwip worktree` shows: every row with its state now. Read-only. */
|
|
137
137
|
export declare const worktreeStatuses: (paneCwds: string[], run?: GitRun) => Promise<WorktreeStatus[]>;
|
|
138
138
|
/**
|
|
139
|
-
*
|
|
140
|
-
* tmux could not be asked. The difference matters: an
|
|
141
|
-
* empty would make every worktree in use look abandoned.
|
|
139
|
+
* Where every live tmux pane started and where it is now, `[]` when there is no
|
|
140
|
+
* tmux server, null when tmux could not be asked. The difference matters: an
|
|
141
|
+
* unreadable list read as empty would make every worktree in use look abandoned.
|
|
142
|
+
*
|
|
143
|
+
* The start path (`new -c`) is read as well as the current one because the
|
|
144
|
+
* current one is not yet the pane's right after it starts: measured on tmux 3.6
|
|
145
|
+
* (ubuntu-26.04 runner), a pane read within ~10 ms of `new-session -c <dir>`
|
|
146
|
+
* reports the tmux server's cwd. The start path is the `-c` text unresolved,
|
|
147
|
+
* unlike the current one, so it is resolved like the worktree paths.
|
|
142
148
|
*/
|
|
143
149
|
export declare const readPaneCwds: (tmux?: GitRun) => Promise<string[] | null>;
|
|
144
150
|
//# sourceMappingURL=worktree.d.ts.map
|
package/dist/worktree.js
CHANGED
|
@@ -297,14 +297,23 @@ exports.worktreeStatuses = worktreeStatuses;
|
|
|
297
297
|
// `error connecting to <socket> (No such file or directory)`; `(Permission denied)` and the rest are not "no panes".
|
|
298
298
|
const NO_TMUX_SERVER = /^(no server running on |error connecting to .+ \(No such file or directory\)$)/;
|
|
299
299
|
/**
|
|
300
|
-
*
|
|
301
|
-
* tmux could not be asked. The difference matters: an
|
|
302
|
-
* empty would make every worktree in use look abandoned.
|
|
300
|
+
* Where every live tmux pane started and where it is now, `[]` when there is no
|
|
301
|
+
* tmux server, null when tmux could not be asked. The difference matters: an
|
|
302
|
+
* unreadable list read as empty would make every worktree in use look abandoned.
|
|
303
|
+
*
|
|
304
|
+
* The start path (`new -c`) is read as well as the current one because the
|
|
305
|
+
* current one is not yet the pane's right after it starts: measured on tmux 3.6
|
|
306
|
+
* (ubuntu-26.04 runner), a pane read within ~10 ms of `new-session -c <dir>`
|
|
307
|
+
* reports the tmux server's cwd. The start path is the `-c` text unresolved,
|
|
308
|
+
* unlike the current one, so it is resolved like the worktree paths.
|
|
303
309
|
*/
|
|
304
310
|
const readPaneCwds = async (tmux = exports.tmuxRun) => {
|
|
305
|
-
const out = await tmux(['list-panes', '-a', '-F', '#{pane_current_path}']);
|
|
306
|
-
if (out.ok)
|
|
307
|
-
return
|
|
308
|
-
return
|
|
311
|
+
const out = await tmux(['list-panes', '-a', '-F', '#{pane_start_path}\t#{pane_current_path}']);
|
|
312
|
+
if (!out.ok)
|
|
313
|
+
return NO_TMUX_SERVER.test(out.error) ? [] : null;
|
|
314
|
+
return out.stdout.split('\n').filter(Boolean).flatMap((line) => {
|
|
315
|
+
const [start = '', current = ''] = line.split('\t');
|
|
316
|
+
return [start && realOrSelf(start), current].filter(Boolean);
|
|
317
|
+
});
|
|
309
318
|
};
|
|
310
319
|
exports.readPaneCwds = readPaneCwds;
|