git-watchtower 2.1.4 → 2.1.6

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.
@@ -529,8 +529,14 @@ async function getSessionUrl(branchName) {
529
529
 
530
530
  // Check if a CLI tool is available
531
531
  async function hasCommand(cmd) {
532
+ // `which` ships on macOS/Linux; Windows has no `which` by default but
533
+ // does ship `where` (since Windows Server 2003 / Vista). Without this
534
+ // platform branch, `hasCommand('gh')` always rejects on Windows, which
535
+ // makes the entire branch-actions modal (open/approve/merge PR, CI
536
+ // status) silently inert for Windows users.
537
+ const probe = process.platform === 'win32' ? 'where' : 'which';
532
538
  try {
533
- await execCli('which', [cmd]);
539
+ await execCli(probe, [cmd]);
534
540
  return true;
535
541
  } catch (e) {
536
542
  return false;
@@ -2276,7 +2282,18 @@ function createStaticServer() {
2276
2282
  // directory. Without this second realpath+check, a symlinked dir
2277
2283
  // whose target pointed outside would serve its attacker-controlled
2278
2284
  // index.html through our root check.
2279
- if (fs.statSync(initial.path).isDirectory()) {
2285
+ let isDir;
2286
+ try {
2287
+ isDir = fs.statSync(initial.path).isDirectory();
2288
+ } catch (e) {
2289
+ // File vanished (ENOENT), perms changed (EACCES), or symlink loop
2290
+ // (ELOOP) between resolveStaticPath's realpath and this stat.
2291
+ // Without this guard the throw bubbles to uncaughtException and
2292
+ // tears down the entire TUI for what should be a 404.
2293
+ send404();
2294
+ return;
2295
+ }
2296
+ if (isDir) {
2280
2297
  const indexResult = resolveStaticPath(
2281
2298
  path.join(initial.path, 'index.html'),
2282
2299
  realStaticDir,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "git-watchtower",
3
- "version": "2.1.4",
3
+ "version": "2.1.6",
4
4
  "description": "Terminal-based Git branch monitor with activity sparklines and optional dev server with live reload",
5
5
  "main": "bin/git-watchtower.js",
6
6
  "bin": {