@trawlme/cli 1.19.0 → 1.19.1

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
@@ -83,7 +83,7 @@ trawl scraps account session set <id> -c <file>
83
83
 
84
84
  ### Claude Code skills
85
85
 
86
- The CLI bundles a Claude Code skill that teaches Claude how to use `trawl`. Once installed, Claude can manage scraps for you via prompts.
86
+ The CLI bundles 5 Claude Code skills that teach Claude how to use `trawl`. Once installed, Claude can manage scraps for you via prompts.
87
87
 
88
88
  ```
89
89
  trawl skills list List bundled skills and install status
package/dist/index.d.ts CHANGED
@@ -24,7 +24,18 @@ export declare function resolveCommandName(actionCommand: Command | undefined):
24
24
  */
25
25
  export declare function collectCommandNames(root: Command): string[];
26
26
  export declare function createProgram(): Command;
27
- /** True when this module is the process entrypoint (not merely imported by a test). */
27
+ /**
28
+ * True when this module is the process entrypoint (not merely imported by a test).
29
+ *
30
+ * npm installs the global bin as a SYMLINK (`bin/trawl` -> `dist/index.js`). For an
31
+ * ESM entrypoint Node realpaths the module URL (`import.meta.url` = the real
32
+ * `dist/index.js`) but leaves `process.argv[1]` as the symlink path — so a raw
33
+ * `moduleUrl === pathToFileURL(argv1).href` compare is FALSE for the normal global
34
+ * invocation, the guard never fires, and `runCli()` never runs (silent no-op, #103).
35
+ * Canonicalise both sides with `realpathSync` before comparing. A genuine entrypoint
36
+ * was just loaded by Node, so both realpath calls resolve; the catch only trips for a
37
+ * non-file module URL (exotic loaders) — correctly "not the entrypoint".
38
+ */
28
39
  export declare function isEntryPoint(argv1: string | undefined, moduleUrl: string): boolean;
29
40
  /**
30
41
  * True when the invocation is a pure `--help`/`--version` query, a bare
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { Command, CommanderError } from 'commander';
3
- import { readFileSync } from 'node:fs';
4
- import { fileURLToPath, pathToFileURL } from 'node:url';
3
+ import { readFileSync, realpathSync } from 'node:fs';
4
+ import { fileURLToPath } from 'node:url';
5
5
  import { dirname, join } from 'node:path';
6
6
  import { login, logout } from './commands/login.js';
7
7
  import { scraps } from './commands/scraps.js';
@@ -74,9 +74,27 @@ export function createProgram() {
74
74
  program.addCommand(token);
75
75
  return program;
76
76
  }
77
- /** True when this module is the process entrypoint (not merely imported by a test). */
77
+ /**
78
+ * True when this module is the process entrypoint (not merely imported by a test).
79
+ *
80
+ * npm installs the global bin as a SYMLINK (`bin/trawl` -> `dist/index.js`). For an
81
+ * ESM entrypoint Node realpaths the module URL (`import.meta.url` = the real
82
+ * `dist/index.js`) but leaves `process.argv[1]` as the symlink path — so a raw
83
+ * `moduleUrl === pathToFileURL(argv1).href` compare is FALSE for the normal global
84
+ * invocation, the guard never fires, and `runCli()` never runs (silent no-op, #103).
85
+ * Canonicalise both sides with `realpathSync` before comparing. A genuine entrypoint
86
+ * was just loaded by Node, so both realpath calls resolve; the catch only trips for a
87
+ * non-file module URL (exotic loaders) — correctly "not the entrypoint".
88
+ */
78
89
  export function isEntryPoint(argv1, moduleUrl) {
79
- return argv1 !== undefined && moduleUrl === pathToFileURL(argv1).href;
90
+ if (argv1 === undefined)
91
+ return false;
92
+ try {
93
+ return realpathSync(fileURLToPath(moduleUrl)) === realpathSync(argv1);
94
+ }
95
+ catch {
96
+ return false;
97
+ }
80
98
  }
81
99
  /**
82
100
  * True when the invocation is a pure `--help`/`--version` query, a bare
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trawlme/cli",
3
- "version": "1.19.0",
3
+ "version": "1.19.1",
4
4
  "description": "Trawl CLI — manage scraps from the terminal",
5
5
  "type": "module",
6
6
  "bin": {