edgar-cli 0.1.1 → 0.1.2

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 (2) hide show
  1. package/dist/cli.js +15 -2
  2. package/package.json +2 -1
package/dist/cli.js CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
+ import { realpathSync } from 'node:fs';
2
3
  import { Command, CommanderError } from 'commander';
3
- import { pathToFileURL } from 'node:url';
4
+ import { fileURLToPath } from 'node:url';
4
5
  import { runFactsGet } from './commands/facts.js';
5
6
  import { runFilingsGet, runFilingsList } from './commands/filings.js';
6
7
  import { runResolve } from './commands/resolve.js';
@@ -229,7 +230,19 @@ export async function runCli(argv, io = defaultIo()) {
229
230
  return EXIT_CODE_MAP[cliError.code] ?? 10;
230
231
  }
231
232
  }
232
- if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
233
+ function isDirectExecution() {
234
+ const argvPath = process.argv[1];
235
+ if (!argvPath) {
236
+ return false;
237
+ }
238
+ try {
239
+ return realpathSync(argvPath) === realpathSync(fileURLToPath(import.meta.url));
240
+ }
241
+ catch {
242
+ return false;
243
+ }
244
+ }
245
+ if (isDirectExecution()) {
233
246
  runCli(process.argv.slice(2)).then((exitCode) => {
234
247
  process.exit(exitCode);
235
248
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "edgar-cli",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Agent-friendly SEC EDGAR CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -8,6 +8,7 @@
8
8
  "access": "public"
9
9
  },
10
10
  "bin": {
11
+ "edgar-cli": "dist/cli.js",
11
12
  "edgar": "dist/cli.js"
12
13
  },
13
14
  "files": [