botholomew 0.22.1 → 0.22.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/package.json +1 -1
  2. package/src/cli.ts +24 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "botholomew",
3
- "version": "0.22.1",
3
+ "version": "0.22.2",
4
4
  "description": "An autonomous AI agent for knowledge work — works your task queue while you sleep.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/cli.ts CHANGED
@@ -74,9 +74,30 @@ registerPrepareCommand(program);
74
74
  registerCheckUpdateCommand(program);
75
75
  registerUpgradeCommand(program);
76
76
 
77
- program.action(() => {
78
- program.help();
79
- });
77
+ // Bare `botholomew` (only the global -d/--dir, or nothing) prints help on
78
+ // stdout and exits 0. We do this explicitly instead of via a root .action()
79
+ // handler, because that handler made Commander treat a mistyped command as an
80
+ // excess positional argument ("too many arguments. Expected 0 arguments but
81
+ // got 1: foo.") instead of reporting an unknown command. With no root action, a
82
+ // real typo now reaches Commander's unknownCommand() → "error: unknown command
83
+ // 'foo'" (plus a did-you-mean suggestion).
84
+ function isBareInvocation(argv: string[]): boolean {
85
+ for (let i = 0; i < argv.length; i++) {
86
+ const a = argv[i];
87
+ if (a === undefined) continue;
88
+ if (a === "-d" || a === "--dir") {
89
+ i++; // skip the option's value
90
+ continue;
91
+ }
92
+ if (a.startsWith("--dir=")) continue;
93
+ return false; // any operand OR other flag (--help, --version, foo, …)
94
+ }
95
+ return true;
96
+ }
97
+
98
+ if (isBareInvocation(process.argv.slice(2))) {
99
+ program.help(); // outputs to stdout and exits 0
100
+ }
80
101
 
81
102
  // Start background update check before parsing (non-blocking)
82
103
  const updateNotice = maybeCheckForUpdate();