@ogment-ai/cli 0.3.0 → 0.3.1

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 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
- npx ogment login
24
+ ogment login
12
25
 
13
26
  # List available servers
14
- npx ogment servers
27
+ ogment servers
15
28
 
16
29
  # Call a tool
17
- npx ogment call <server> <tool> '{"param": "value"}'
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
- pnpm run test # Watch mode
26
- pnpm run test:run # Single run
27
- pnpm run test:coverage # Coverage (text + html + lcov)
28
- pnpm run test:ui # Vitest UI
29
- pnpm run test:changed # Run tests related to changed files
30
- pnpm run test:ci # CI profile (coverage + CI reporters)
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
- npx ogment login
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
- npx ogment login --device
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
- npx ogment servers # List all servers
62
- npx ogment servers <path> # Inspect tools
63
- npx ogment servers --json # Machine-readable output
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
- npx ogment call ecommerce-api get__health
72
- npx ogment call ecommerce-api get__api_products_ '{"limit":2}'
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
- npx ogment logout
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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,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 { pathToFileURL } from "node:url";
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
- if (process.argv[1] !== undefined && import.meta.url === pathToFileURL(process.argv[1]).href) {
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ogment-ai/cli",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Ogment Vault CLI — secure your AI agents' SaaS credentials",
5
5
  "type": "module",
6
6
  "bin": {
@@ -12,13 +12,15 @@
12
12
  "dev": "tsx src/cli.ts",
13
13
  "start": "node dist/cli.js",
14
14
  "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",
15
+ "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
16
  "lint:fix": "npm run lint -- --fix",
17
- "format": "oxfmt --write src test/src",
18
- "format:check": "oxfmt --check src test/src",
17
+ "format": "oxfmt --write src test/src test/e2e",
18
+ "format:check": "oxfmt --check src test/src test/e2e",
19
19
  "test": "vitest -c vitest.config.ts",
20
20
  "test:run": "vitest run -c vitest.config.ts",
21
21
  "test:coverage": "npm run test:run -- --coverage",
22
+ "test:e2e": "npm run build && vitest run -c vitest.e2e.config.ts",
23
+ "test:e2e:live": "npm run build && OGMENT_E2E_LIVE=1 vitest run -c vitest.e2e.config.ts test/e2e/live.local.test.ts",
22
24
  "test:ui": "npm run test -- --ui",
23
25
  "test:changed": "npm run test:run -- --changed",
24
26
  "test:ci": "npm run test:coverage",
@@ -59,7 +61,7 @@
59
61
  },
60
62
  "dependencies": {
61
63
  "@modelcontextprotocol/sdk": "^1.26.0",
62
- "@ogment-ai/cli-contract": "0.3.0",
64
+ "@ogment-ai/cli-contract": "0.3.1",
63
65
  "better-result": "^2.7.0",
64
66
  "commander": "^13.1.0",
65
67
  "open": "^10.2.0",