dsh-lark-bot 0.4.0 → 0.4.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/dist/cli.d.ts CHANGED
@@ -9,5 +9,11 @@ interface StartOptions {
9
9
  }
10
10
  declare function buildProgram(): Command;
11
11
  declare function main(argv?: readonly string[]): Promise<void>;
12
+ /**
13
+ * True when this module is being executed directly (e.g. `node dist/cli.js run`)
14
+ * rather than imported by a bin wrapper. The background service runs
15
+ * `node <package>/dist/cli.js run`, so the bundle must self-execute in that case.
16
+ */
17
+ declare function isDirectInvocation(entry?: string | undefined, metaUrl?: string): boolean;
12
18
 
13
- export { type StartOptions, buildProgram, main };
19
+ export { type StartOptions, buildProgram, isDirectInvocation, main };
package/dist/cli.js CHANGED
@@ -584,7 +584,8 @@ var init_acp_adapter = __esm({
584
584
  });
585
585
 
586
586
  // src/cli.ts
587
- import { readFileSync } from "fs";
587
+ import { readFileSync, realpathSync as realpathSync2 } from "fs";
588
+ import { fileURLToPath as fileURLToPath2 } from "url";
588
589
  import { Command } from "commander";
589
590
 
590
591
  // src/cli/commands/doctor.ts
@@ -4653,8 +4654,20 @@ function buildProgram() {
4653
4654
  async function main(argv = process.argv) {
4654
4655
  await buildProgram().parseAsync([...argv]);
4655
4656
  }
4657
+ function isDirectInvocation(entry = process.argv[1], metaUrl = import.meta.url) {
4658
+ if (!entry) return false;
4659
+ try {
4660
+ return realpathSync2(entry) === fileURLToPath2(metaUrl);
4661
+ } catch {
4662
+ return false;
4663
+ }
4664
+ }
4665
+ if (isDirectInvocation()) {
4666
+ await main();
4667
+ }
4656
4668
  export {
4657
4669
  buildProgram,
4670
+ isDirectInvocation,
4658
4671
  main
4659
4672
  };
4660
4673
  //# sourceMappingURL=cli.js.map