@ogment-ai/cli 0.3.0 → 0.3.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.
- package/README.md +30 -17
- package/dist/cli.d.ts +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +19 -2
- package/dist/postinstall.d.ts +2 -0
- package/dist/postinstall.d.ts.map +1 -0
- package/dist/postinstall.js +12 -0
- package/package.json +8 -5
package/README.md
CHANGED
|
@@ -2,19 +2,32 @@
|
|
|
2
2
|
|
|
3
3
|
**Secure your AI agents' SaaS credentials.**
|
|
4
4
|
|
|
5
|
+
Package: `@ogment-ai/cli`
|
|
6
|
+
Binary: `ogment`
|
|
7
|
+
|
|
5
8
|
Ogment sits between your AI agent and your SaaS tools. Your agent gets a scoped, revocable API key — your real credentials never leave Ogment.
|
|
6
9
|
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
# Global install (recommended)
|
|
14
|
+
npm install -g @ogment-ai/cli
|
|
15
|
+
|
|
16
|
+
# One-off usage without installing globally
|
|
17
|
+
npx @ogment-ai/cli --help
|
|
18
|
+
```
|
|
19
|
+
|
|
7
20
|
## Quick Start
|
|
8
21
|
|
|
9
22
|
```bash
|
|
10
23
|
# Log in (opens browser for OAuth + agent selection)
|
|
11
|
-
|
|
24
|
+
ogment login
|
|
12
25
|
|
|
13
26
|
# List available servers
|
|
14
|
-
|
|
27
|
+
ogment servers
|
|
15
28
|
|
|
16
29
|
# Call a tool
|
|
17
|
-
|
|
30
|
+
ogment call <server> <tool> '{"param": "value"}'
|
|
18
31
|
```
|
|
19
32
|
|
|
20
33
|
## Development
|
|
@@ -22,12 +35,12 @@ npx ogment call <server> <tool> '{"param": "value"}'
|
|
|
22
35
|
### Run Tests
|
|
23
36
|
|
|
24
37
|
```bash
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
38
|
+
npm run test # Watch mode
|
|
39
|
+
npm run test:run # Single run
|
|
40
|
+
npm run test:coverage # Coverage (text + html + lcov)
|
|
41
|
+
npm run test:ui # Vitest UI
|
|
42
|
+
npm run test:changed # Run tests related to changed files
|
|
43
|
+
npm run test:ci # CI profile (coverage + CI reporters)
|
|
31
44
|
```
|
|
32
45
|
|
|
33
46
|
## Commands
|
|
@@ -37,7 +50,7 @@ pnpm run test:ci # CI profile (coverage + CI reporters)
|
|
|
37
50
|
Authenticate with the Ogment platform. Opens your browser for OAuth sign-in, then shows an agent picker where you create or select an agent. The resulting API key is stored locally.
|
|
38
51
|
|
|
39
52
|
```bash
|
|
40
|
-
|
|
53
|
+
ogment login
|
|
41
54
|
```
|
|
42
55
|
|
|
43
56
|
### `ogment login --device`
|
|
@@ -45,7 +58,7 @@ npx ogment login
|
|
|
45
58
|
For headless or remote environments (VMs, CI servers) where a browser isn't available. Displays a short code that you enter on the Ogment dashboard from any device.
|
|
46
59
|
|
|
47
60
|
```bash
|
|
48
|
-
|
|
61
|
+
ogment login --device
|
|
49
62
|
|
|
50
63
|
# Shows:
|
|
51
64
|
# Enter this code on the Ogment dashboard:
|
|
@@ -58,9 +71,9 @@ npx ogment login --device
|
|
|
58
71
|
List configured servers or inspect a server's tools.
|
|
59
72
|
|
|
60
73
|
```bash
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
74
|
+
ogment servers # List all servers
|
|
75
|
+
ogment servers <path> # Inspect tools
|
|
76
|
+
ogment servers --json # Machine-readable output
|
|
64
77
|
```
|
|
65
78
|
|
|
66
79
|
### `ogment call <server> <tool> [args]`
|
|
@@ -68,8 +81,8 @@ npx ogment servers --json # Machine-readable output
|
|
|
68
81
|
Call a tool on an Ogment server. Always outputs JSON.
|
|
69
82
|
|
|
70
83
|
```bash
|
|
71
|
-
|
|
72
|
-
|
|
84
|
+
ogment call ecommerce-api get__health
|
|
85
|
+
ogment call ecommerce-api get__api_products_ '{"limit":2}'
|
|
73
86
|
```
|
|
74
87
|
|
|
75
88
|
### `ogment logout`
|
|
@@ -77,7 +90,7 @@ npx ogment call ecommerce-api get__api_products_ '{"limit":2}'
|
|
|
77
90
|
Delete local credentials. To revoke the API key (prevent all access), use the Ogment dashboard.
|
|
78
91
|
|
|
79
92
|
```bash
|
|
80
|
-
|
|
93
|
+
ogment logout
|
|
81
94
|
```
|
|
82
95
|
|
|
83
96
|
## Authentication Model
|
package/dist/cli.d.ts
CHANGED
|
@@ -15,5 +15,6 @@ interface Runtime {
|
|
|
15
15
|
}
|
|
16
16
|
export declare const runCli: (argv?: readonly string[], runtime?: Runtime) => Promise<ExitCode>;
|
|
17
17
|
export declare const executeCli: () => Promise<void>;
|
|
18
|
+
export declare const shouldExecuteCli: (importMetaUrl: string, argv1: string | undefined) => boolean;
|
|
18
19
|
export {};
|
|
19
20
|
//# sourceMappingURL=cli.d.ts.map
|
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AASA,OAAO,KAAK,EAAE,cAAc,EAAmB,MAAM,uBAAuB,CAAC;AAO7E,OAAO,EAAE,aAAa,EAA0B,MAAM,qBAAqB,CAAC;AAK5E,OAAO,EAAa,KAAK,QAAQ,EAAoB,MAAM,wBAAwB,CAAC;AAIpF,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,IAAI,EAAE,OAAO,GAAG,SAAS,CAAC;IAC1B,cAAc,EAAE,OAAO,GAAG,SAAS,CAAC;IACpC,KAAK,EAAE,OAAO,GAAG,SAAS,CAAC;IAC3B,GAAG,EAAE,OAAO,GAAG,SAAS,CAAC;CAC1B;AAED,UAAU,OAAO;IACf,OAAO,EAAE,cAAc,CAAC;IACxB,MAAM,EAAE,aAAa,CAAC;CACvB;AA4XD,eAAO,MAAM,MAAM,GACjB,OAAM,SAAS,MAAM,EAA0B,EAC/C,UAAS,OAAyB,KACjC,OAAO,CAAC,QAAQ,CAmBlB,CAAC;AAEF,eAAO,MAAM,UAAU,QAAa,OAAO,CAAC,IAAI,CAG/C,CAAC;AAMF,eAAO,MAAM,gBAAgB,GAAI,eAAe,MAAM,EAAE,OAAO,MAAM,GAAG,SAAS,KAAG,OAanF,CAAC"}
|
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
2
|
+
import { realpathSync } from "node:fs";
|
|
3
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
3
4
|
import { Command, CommanderError } from "commander";
|
|
4
5
|
import { runCallCommand } from "./commands/call.js";
|
|
5
6
|
import { runDescribeCommand } from "./commands/describe.js";
|
|
@@ -332,6 +333,22 @@ export const executeCli = async () => {
|
|
|
332
333
|
const code = await runCli();
|
|
333
334
|
process.exitCode = code;
|
|
334
335
|
};
|
|
335
|
-
|
|
336
|
+
const toCanonicalFileHref = (path) => {
|
|
337
|
+
return pathToFileURL(realpathSync(path)).href;
|
|
338
|
+
};
|
|
339
|
+
export const shouldExecuteCli = (importMetaUrl, argv1) => {
|
|
340
|
+
if (argv1 === undefined) {
|
|
341
|
+
return false;
|
|
342
|
+
}
|
|
343
|
+
try {
|
|
344
|
+
const invokedFileHref = toCanonicalFileHref(argv1);
|
|
345
|
+
const moduleFileHref = toCanonicalFileHref(fileURLToPath(importMetaUrl));
|
|
346
|
+
return invokedFileHref === moduleFileHref;
|
|
347
|
+
}
|
|
348
|
+
catch {
|
|
349
|
+
return false;
|
|
350
|
+
}
|
|
351
|
+
};
|
|
352
|
+
if (shouldExecuteCli(import.meta.url, process.argv[1])) {
|
|
336
353
|
await executeCli();
|
|
337
354
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postinstall.d.ts","sourceRoot":"","sources":["../src/postinstall.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const installGreetingLines = [
|
|
2
|
+
"Thanks for installing @ogment-ai/cli.",
|
|
3
|
+
"",
|
|
4
|
+
"Next steps:",
|
|
5
|
+
" 1. ogment login",
|
|
6
|
+
" 2. ogment servers",
|
|
7
|
+
" 3. ogment --help",
|
|
8
|
+
"",
|
|
9
|
+
"Docs: https://github.com/ogment-ai/ogment-cli/tree/main/packages/ogment#quick-start",
|
|
10
|
+
];
|
|
11
|
+
process.stdout.write(`${installGreetingLines.join("\n")}\n`);
|
|
12
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ogment-ai/cli",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "Ogment Vault CLI — secure your AI agents' SaaS credentials",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -11,14 +11,17 @@
|
|
|
11
11
|
"build": "npm run clean && tsc -p tsconfig.build.json",
|
|
12
12
|
"dev": "tsx src/cli.ts",
|
|
13
13
|
"start": "node dist/cli.js",
|
|
14
|
+
"postinstall": "node -e \"import('./dist/postinstall.js').catch(() => undefined)\"",
|
|
14
15
|
"check-types": "tsc -p tsconfig.json --noEmit",
|
|
15
|
-
"lint": "oxlint -c oxlint.config.ts --type-aware --type-check --tsconfig tsconfig.json src test/src vitest.config.ts",
|
|
16
|
+
"lint": "oxlint -c oxlint.config.ts --type-aware --type-check --tsconfig tsconfig.json src test/src test/e2e vitest.config.ts vitest.e2e.config.ts",
|
|
16
17
|
"lint:fix": "npm run lint -- --fix",
|
|
17
|
-
"format": "oxfmt --write src test/src",
|
|
18
|
-
"format:check": "oxfmt --check src test/src",
|
|
18
|
+
"format": "oxfmt --write src test/src test/e2e",
|
|
19
|
+
"format:check": "oxfmt --check src test/src test/e2e",
|
|
19
20
|
"test": "vitest -c vitest.config.ts",
|
|
20
21
|
"test:run": "vitest run -c vitest.config.ts",
|
|
21
22
|
"test:coverage": "npm run test:run -- --coverage",
|
|
23
|
+
"test:e2e": "npm run build && vitest run -c vitest.e2e.config.ts",
|
|
24
|
+
"test:e2e:live": "npm run build && OGMENT_E2E_LIVE=1 vitest run -c vitest.e2e.config.ts test/e2e/live.local.test.ts",
|
|
22
25
|
"test:ui": "npm run test -- --ui",
|
|
23
26
|
"test:changed": "npm run test:run -- --changed",
|
|
24
27
|
"test:ci": "npm run test:coverage",
|
|
@@ -59,7 +62,7 @@
|
|
|
59
62
|
},
|
|
60
63
|
"dependencies": {
|
|
61
64
|
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
62
|
-
"@ogment-ai/cli-contract": "0.3.
|
|
65
|
+
"@ogment-ai/cli-contract": "0.3.2",
|
|
63
66
|
"better-result": "^2.7.0",
|
|
64
67
|
"commander": "^13.1.0",
|
|
65
68
|
"open": "^10.2.0",
|