@invokehq/cli 0.1.12 → 0.1.14
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/index.js +24 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -4,7 +4,7 @@ const chalk = require('chalk');
|
|
|
4
4
|
const fs = require('fs-extra');
|
|
5
5
|
const path = require('path');
|
|
6
6
|
const pkg = require(path.resolve(__dirname, 'package.json'));
|
|
7
|
-
|
|
7
|
+
const os = require('os');
|
|
8
8
|
const program = new Command();
|
|
9
9
|
const CONTEXT_DIR = path.join(process.cwd(), '.agentgate');
|
|
10
10
|
const CONTEXT_FILE = path.join(CONTEXT_DIR, 'context.json');
|
|
@@ -20,6 +20,29 @@ program
|
|
|
20
20
|
.name('agentgate')
|
|
21
21
|
.version(pkg.version);
|
|
22
22
|
|
|
23
|
+
program
|
|
24
|
+
.command('login')
|
|
25
|
+
.description('Authenticate to your Invoke runtime')
|
|
26
|
+
.option('--api-key <key>', 'Invoke API key for non-interactive login')
|
|
27
|
+
.option('--base-url <url>', 'Invoke runtime URL', 'https://api.invokehq.run')
|
|
28
|
+
.action(async (options) => {
|
|
29
|
+
const apiKey = options.apiKey || process.env.INVOKE_API_KEY;
|
|
30
|
+
|
|
31
|
+
if (!apiKey) {
|
|
32
|
+
console.error('Missing API key. Set INVOKE_API_KEY or run: invoke login --api-key <key>');
|
|
33
|
+
process.exit(1);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
await fs.ensureDir(path.join(os.homedir(), '.invoke'));
|
|
37
|
+
await fs.writeJson(path.join(os.homedir(), '.invoke', 'config.json'), {
|
|
38
|
+
baseUrl: options.baseUrl.replace(/\/+$/, ''),
|
|
39
|
+
apiKey,
|
|
40
|
+
updatedAt: new Date().toISOString()
|
|
41
|
+
}, { spaces: 2 });
|
|
42
|
+
|
|
43
|
+
console.log(`Logged in to Invoke (${options.baseUrl})`);
|
|
44
|
+
});
|
|
45
|
+
|
|
23
46
|
program
|
|
24
47
|
.command('wrap')
|
|
25
48
|
.description('Prepare repository context')
|