@weave-tools/weave-it 0.1.0 → 0.1.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
@@ -1,5 +1,6 @@
1
1
  import { Command } from 'commander';
2
2
 
3
3
  declare function createProgram(): Command;
4
+ declare function isDirectCliInvocation(scriptPath?: string, moduleUrl?: string): boolean;
4
5
 
5
- export { createProgram };
6
+ export { createProgram, isDirectCliInvocation };
package/dist/cli.js CHANGED
@@ -4513,7 +4513,8 @@ function workspaceCommand() {
4513
4513
  }
4514
4514
 
4515
4515
  // src/cli.ts
4516
- import { pathToFileURL } from "url";
4516
+ import { realpathSync } from "fs";
4517
+ import { fileURLToPath as fileURLToPath4 } from "url";
4517
4518
  function createProgram() {
4518
4519
  const program = new Command10();
4519
4520
  program.name("weave").description("Repo-local LLM wiki and temporary multi-folder AI session tooling.").version("0.1.0");
@@ -4529,10 +4530,21 @@ function createProgram() {
4529
4530
  program.addCommand(taskCommand());
4530
4531
  return program;
4531
4532
  }
4532
- if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
4533
+ function isDirectCliInvocation(scriptPath = process.argv[1], moduleUrl = import.meta.url) {
4534
+ if (!scriptPath) {
4535
+ return false;
4536
+ }
4537
+ try {
4538
+ return realpathSync(scriptPath) === realpathSync(fileURLToPath4(moduleUrl));
4539
+ } catch {
4540
+ return false;
4541
+ }
4542
+ }
4543
+ if (isDirectCliInvocation()) {
4533
4544
  await createProgram().parseAsync(process.argv);
4534
4545
  }
4535
4546
  export {
4536
- createProgram
4547
+ createProgram,
4548
+ isDirectCliInvocation
4537
4549
  };
4538
4550
  //# sourceMappingURL=cli.js.map