@link-assistant/agent 0.1.2 → 0.1.3

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 +2 -1
  2. package/src/index.js +25 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@link-assistant/agent",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
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",
@@ -43,6 +43,7 @@
43
43
  },
44
44
  "files": [
45
45
  "src/",
46
+ "package.json",
46
47
  "README.md",
47
48
  "MODELS.md",
48
49
  "TOOLS.md",
package/src/index.js CHANGED
@@ -18,6 +18,22 @@ import { AuthCommand } from './cli/cmd/auth.ts';
18
18
  import { Flag } from './flag/flag.ts';
19
19
  import { FormatError } from './cli/error.ts';
20
20
  import { UI } from './cli/ui.ts';
21
+ import { createRequire } from 'module';
22
+ import { readFileSync } from 'fs';
23
+ import { dirname, join } from 'path';
24
+ import { fileURLToPath } from 'url';
25
+
26
+ const require = createRequire(import.meta.url);
27
+ let pkg;
28
+ try {
29
+ pkg = require('../package.json');
30
+ } catch (_e) {
31
+ // Fallback: read package.json directly
32
+ const __dirname = dirname(fileURLToPath(import.meta.url));
33
+ const pkgPath = join(__dirname, '../package.json');
34
+ const pkgContent = readFileSync(pkgPath, 'utf8');
35
+ pkg = JSON.parse(pkgContent);
36
+ }
21
37
 
22
38
  // Track if any errors occurred during execution
23
39
  let hasError = false;
@@ -86,6 +102,14 @@ async function runAgentMode(argv) {
86
102
  // Note: verbose flag and logging are now initialized in middleware
87
103
  // See main() function for the middleware that sets up Flag and Log.init()
88
104
 
105
+ // Log version and command info in verbose mode
106
+ if (Flag.OPENCODE_VERBOSE) {
107
+ console.error(`Agent version: ${pkg.version}`);
108
+ console.error(`Command: ${process.argv.join(' ')}`);
109
+ console.error(`Working directory: ${process.cwd()}`);
110
+ console.error(`Script path: ${import.meta.path}`);
111
+ }
112
+
89
113
  // Parse model argument (handle model IDs with slashes like groq/qwen/qwen3-32b)
90
114
  const modelParts = argv.model.split('/');
91
115
  let providerID = modelParts[0] || 'opencode';
@@ -505,6 +529,7 @@ async function main() {
505
529
  const argv = await yargs(hideBin(process.argv))
506
530
  .scriptName('agent')
507
531
  .usage('$0 [command] [options]')
532
+ .version(pkg.version)
508
533
  // MCP subcommand
509
534
  .command(McpCommand)
510
535
  // Auth subcommand