@ree-auz/nook 0.1.2 → 0.1.3

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.
@@ -6,7 +6,7 @@
6
6
  // node open-issue.mjs [--agent a] [--terminal wt|warp|orca] started by Linear
7
7
  // node open-issue.mjs --run <file> ... inside the new tab
8
8
  import { spawn, spawnSync } from "node:child_process";
9
- import { mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
9
+ import { mkdirSync, readFileSync, realpathSync, rmSync, writeFileSync } from "node:fs";
10
10
  import { homedir, tmpdir } from "node:os";
11
11
  import { delimiter, dirname, join, resolve } from "node:path";
12
12
  import { fileURLToPath } from "node:url";
@@ -186,7 +186,20 @@ function fromLinear(argv) {
186
186
  closeLinearWindow();
187
187
  }
188
188
 
189
- if (process.argv[1] && resolve(process.argv[1]) === self) {
189
+ /**
190
+ * Run directly, not imported. Node gives this file its real path, so a path
191
+ * through a link (fnm's aliases\default, for one) is resolved before comparing.
192
+ */
193
+ function runDirectly() {
194
+ if (!process.argv[1]) return false;
195
+ try {
196
+ return realpathSync(resolve(process.argv[1])) === realpathSync(self);
197
+ } catch {
198
+ return resolve(process.argv[1]) === self;
199
+ }
200
+ }
201
+
202
+ if (runDirectly()) {
190
203
  const [first, ...rest] = process.argv.slice(2);
191
204
  if (first === "--run") insideTab(rest);
192
205
  else fromLinear(process.argv.slice(2));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ree-auz/nook",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "One home folder for your git worktrees: create, open and remove workspaces with shared files, ports and hooks.",
5
5
  "license": "MIT",
6
6
  "type": "module",