@link-assistant/agent 0.0.11 → 0.0.13

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@link-assistant/agent",
3
- "version": "0.0.11",
3
+ "version": "0.0.13",
4
4
  "description": "A minimal, public domain AI CLI agent compatible with OpenCode's JSON interface. Bun-only runtime.",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -132,9 +132,10 @@ export const AuthLoginCommand = cmd({
132
132
  vercel: 5,
133
133
  };
134
134
 
135
- let provider = await prompts.autocomplete({
135
+ // Note: Using `select` instead of `autocomplete` because `autocomplete` is only
136
+ // available in @clack/prompts v1.0.0-alpha.1+, while this package uses stable v0.11.0
137
+ let provider = await prompts.select({
136
138
  message: 'Select provider',
137
- maxItems: 8,
138
139
  options: [
139
140
  ...pipe(
140
141
  providers,
package/src/index.js CHANGED
@@ -16,6 +16,8 @@ import {
16
16
  import { McpCommand } from './cli/cmd/mcp.ts';
17
17
  import { AuthCommand } from './cli/cmd/auth.ts';
18
18
  import { Flag } from './flag/flag.ts';
19
+ import { FormatError } from './cli/error.ts';
20
+ import { UI } from './cli/ui.ts';
19
21
 
20
22
  // Track if any errors occurred during execution
21
23
  let hasError = false;
@@ -561,6 +563,33 @@ async function main() {
561
563
  'Use existing Claude OAuth credentials from ~/.claude/.credentials.json (from Claude Code CLI)',
562
564
  default: false,
563
565
  })
566
+ .fail((msg, err, yargs) => {
567
+ // Handle errors from command handlers
568
+ if (err) {
569
+ // Check if it's a CancelledError (user pressed ESC)
570
+ if (UI.CancelledError.isInstance(err)) {
571
+ // Exit silently without showing error or help text
572
+ process.exit(0);
573
+ }
574
+
575
+ // Format other errors using FormatError
576
+ const formatted = FormatError(err);
577
+ if (formatted) {
578
+ console.error(formatted);
579
+ } else {
580
+ // Fallback to default error formatting
581
+ console.error(err.message || err);
582
+ }
583
+ process.exit(1);
584
+ }
585
+
586
+ // Handle validation errors (msg without err)
587
+ if (msg) {
588
+ console.error(msg);
589
+ console.error(`\n${yargs.help()}`);
590
+ process.exit(1);
591
+ }
592
+ })
564
593
  .help().argv;
565
594
 
566
595
  // If a command was executed (like mcp), yargs handles it