@limetry/cli 1.2.48 → 1.2.52
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 +5 -4
- package/dist/commands/auth/login.d.ts +0 -27
- package/dist/commands/auth/login.d.ts.map +0 -1
- package/dist/commands/auth/login.js +0 -66
- package/dist/commands/auth/login.js.map +0 -1
- package/dist/commands/governance/index.d.ts +0 -97
- package/dist/commands/governance/index.d.ts.map +0 -1
- package/dist/commands/governance/index.js +0 -286
- package/dist/commands/governance/index.js.map +0 -1
- package/dist/commands/setup/index.d.ts +0 -23
- package/dist/commands/setup/index.d.ts.map +0 -1
- package/dist/commands/setup/index.js +0 -114
- package/dist/commands/setup/index.js.map +0 -1
- package/dist/commands/token/create.d.ts +0 -34
- package/dist/commands/token/create.d.ts.map +0 -1
- package/dist/commands/token/create.js +0 -74
- package/dist/commands/token/create.js.map +0 -1
- package/dist/commands/token/list.d.ts +0 -13
- package/dist/commands/token/list.d.ts.map +0 -1
- package/dist/commands/token/list.js +0 -53
- package/dist/commands/token/list.js.map +0 -1
- package/dist/commands/token/revoke.d.ts +0 -14
- package/dist/commands/token/revoke.d.ts.map +0 -1
- package/dist/commands/token/revoke.js +0 -48
- package/dist/commands/token/revoke.js.map +0 -1
- package/dist/commands/token/scope.d.ts +0 -16
- package/dist/commands/token/scope.d.ts.map +0 -1
- package/dist/commands/token/scope.js +0 -35
- package/dist/commands/token/scope.js.map +0 -1
- package/dist/index.d.ts +0 -11
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -114
- package/dist/index.js.map +0 -1
- package/dist/utils/config.d.ts +0 -92
- package/dist/utils/config.d.ts.map +0 -1
- package/dist/utils/config.js +0 -119
- package/dist/utils/config.js.map +0 -1
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Interactive `limetry setup` wizard for self-hosted or cloud API credentials.
|
|
3
|
-
*
|
|
4
|
-
* Side effects: may open a browser, writes `~/.limetry/config.json`, probes `/health`,
|
|
5
|
-
* and may `process.exit(1)` on connectivity failure.
|
|
6
|
-
*/
|
|
7
|
-
import chalk from "chalk";
|
|
8
|
-
import { mkdirSync, writeFileSync } from "fs";
|
|
9
|
-
import inquirer from "inquirer";
|
|
10
|
-
import { homedir } from "os";
|
|
11
|
-
import { dirname, join } from "path";
|
|
12
|
-
import { logError, logInfo, logSuccess } from "../../utils/config.js";
|
|
13
|
-
const CONFIG_PATH = join(homedir(), ".limetry", "config.json");
|
|
14
|
-
/**
|
|
15
|
-
* Probes `{baseUrl}/health` with a Bearer API key.
|
|
16
|
-
*
|
|
17
|
-
* @param baseUrl - API origin to check.
|
|
18
|
-
* @param apiKey - Bearer token sent as `Authorization`.
|
|
19
|
-
* @returns `true` when the health response is HTTP 2xx within 5s.
|
|
20
|
-
*/
|
|
21
|
-
async function checkConnectivity(baseUrl, apiKey) {
|
|
22
|
-
try {
|
|
23
|
-
const response = await fetch(`${baseUrl}/health`, {
|
|
24
|
-
headers: { "Authorization": `Bearer ${apiKey}` },
|
|
25
|
-
signal: AbortSignal.timeout(5000),
|
|
26
|
-
});
|
|
27
|
-
return response.ok;
|
|
28
|
-
}
|
|
29
|
-
catch {
|
|
30
|
-
return false;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Creates `~/.limetry` if needed and writes `{ baseUrl, apiKey }` config.
|
|
35
|
-
*
|
|
36
|
-
* @param baseUrl - API base URL to store.
|
|
37
|
-
* @param apiKey - API key / bearer token to store.
|
|
38
|
-
* @returns Nothing.
|
|
39
|
-
*/
|
|
40
|
-
function writeConfig(baseUrl, apiKey) {
|
|
41
|
-
const dir = dirname(CONFIG_PATH);
|
|
42
|
-
mkdirSync(dir, { recursive: true });
|
|
43
|
-
writeFileSync(CONFIG_PATH, JSON.stringify({ baseUrl, apiKey }, null, 2), "utf-8");
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Runs the interactive setup wizard (`limetry setup`).
|
|
47
|
-
*
|
|
48
|
-
* Prompts for self-hosted URL + `LIMETRY_BEARER_TOKEN`, or cloud API key.
|
|
49
|
-
* Reads no env vars directly for credentials (user input only); cloud mode
|
|
50
|
-
* opens docs at {@link CLOUD_SIGNUP_URL}.
|
|
51
|
-
*
|
|
52
|
-
* Side effects:
|
|
53
|
-
* - May open the system browser to the quick-start docs.
|
|
54
|
-
* - Writes `~/.limetry/config.json` on success.
|
|
55
|
-
* - Calls `GET {baseUrl}/health` with the entered API key.
|
|
56
|
-
* - Exits with code 1 when connectivity fails.
|
|
57
|
-
*
|
|
58
|
-
* @returns Resolves when setup completes successfully.
|
|
59
|
-
*/
|
|
60
|
-
export async function setupCommand() {
|
|
61
|
-
console.log();
|
|
62
|
-
console.log(chalk.bold(" Limetry — Setup Wizard"));
|
|
63
|
-
console.log(chalk.dim(" Govern sensitive agent tool calls in under 5 minutes.\n"));
|
|
64
|
-
const { url } = await inquirer.prompt([
|
|
65
|
-
{
|
|
66
|
-
type: "input",
|
|
67
|
-
name: "url",
|
|
68
|
-
message: "Evaluation server URL:",
|
|
69
|
-
default: "http://localhost:3810",
|
|
70
|
-
validate: (input) => {
|
|
71
|
-
try {
|
|
72
|
-
new URL(input);
|
|
73
|
-
return true;
|
|
74
|
-
}
|
|
75
|
-
catch {
|
|
76
|
-
return "Enter a valid URL (e.g. http://localhost:3810)";
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
},
|
|
80
|
-
]);
|
|
81
|
-
const { key } = await inquirer.prompt([
|
|
82
|
-
{
|
|
83
|
-
type: "password",
|
|
84
|
-
name: "key",
|
|
85
|
-
message: "Bearer token (LIMETRY_BEARER_TOKEN):",
|
|
86
|
-
mask: "*",
|
|
87
|
-
validate: (input) => input.trim().length >= 16 || "Token must be at least 16 characters",
|
|
88
|
-
},
|
|
89
|
-
]);
|
|
90
|
-
const baseUrl = url.trim().replace(/\/$/, "");
|
|
91
|
-
const apiKey = key.trim();
|
|
92
|
-
process.stdout.write("\n");
|
|
93
|
-
process.stdout.write(chalk.dim(" Checking connectivity..."));
|
|
94
|
-
const ok = await checkConnectivity(baseUrl, apiKey);
|
|
95
|
-
if (!ok) {
|
|
96
|
-
process.stdout.write(chalk.red(" ✗\n\n"));
|
|
97
|
-
logError(`Could not connect to ${baseUrl}`);
|
|
98
|
-
logInfo("Check your URL and bearer token, then run `limetry setup` again.");
|
|
99
|
-
process.exit(1);
|
|
100
|
-
}
|
|
101
|
-
process.stdout.write(chalk.green(" ✓\n\n"));
|
|
102
|
-
writeConfig(baseUrl, apiKey);
|
|
103
|
-
logSuccess(`Connected to ${baseUrl}`);
|
|
104
|
-
logSuccess(`Saved to ${CONFIG_PATH}`);
|
|
105
|
-
console.log();
|
|
106
|
-
console.log(chalk.bold(" Next steps (quickstart):\n"));
|
|
107
|
-
console.log(chalk.dim(" 1. limetry policy apply --allow http_get --deny http_post --block-resource https://prod.example.com/*"));
|
|
108
|
-
console.log(chalk.dim(" 2. echo '{...ActionIntent...}' | limetry eval"));
|
|
109
|
-
console.log(chalk.dim(" 3. limetry audit tail"));
|
|
110
|
-
console.log(chalk.dim(" 4. Or add MCP: npx @limetry/mcp with LIMETRY_BASE_URL + LIMETRY_API_KEY\n"));
|
|
111
|
-
console.log(chalk.dim(" Docs: https://limetry.org/docs/quick-start"));
|
|
112
|
-
console.log();
|
|
113
|
-
}
|
|
114
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/setup/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,IAAI,CAAA;AAC7C,OAAO,QAAQ,MAAM,UAAU,CAAA;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAA;AAC5B,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,M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AC,CAAA;QAC3E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC;IAED,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAA;IAC3C,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;IAC5B,UAAU,CAAC,gBAAgB,OAAO,EAAE,CAAC,CAAA;IACrC,UAAU,CAAC,YAAY,WAAW,EAAE,CAAC,CAAA;IAErC,OAAO,CAAC,GAAG,EAAE,CAAA;IACb,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC,CAAA;IACvD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,yGAAyG,CAAC,CAAC,CAAA;IACjI,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,iDAAiD,CAAC,CAAC,CAAA;IACzE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC,CAAA;IACjD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,6EAA6E,CAAC,CAAC,CAAA;IACrG,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,8CAA8C,CAAC,CAAC,CAAA;IACtE,OAAO,CAAC,GAAG,EAAE,CAAA;AACf,CAAC"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `limetry token create` — creates an access token via the Limetry API.
|
|
3
|
-
*
|
|
4
|
-
* Options: `--name`, `--scopes`, `--expires`. Missing name/scopes are prompted interactively.
|
|
5
|
-
*
|
|
6
|
-
* Side effects: `POST {baseUrl}/v1/tokens` with Bearer `apiKey`; prints the one-time token
|
|
7
|
-
* secret; may `process.exit(1)`. Requires prior `limetry login` / config via {@link requireAuth}.
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* Commander options for `limetry token create`.
|
|
11
|
-
*/
|
|
12
|
-
interface CreateTokenOptions {
|
|
13
|
-
/**
|
|
14
|
-
* Token display name; prompted when omitted.
|
|
15
|
-
*/
|
|
16
|
-
name?: string;
|
|
17
|
-
/**
|
|
18
|
-
* Scope strings; checkbox-prompted when empty.
|
|
19
|
-
*/
|
|
20
|
-
scopes?: string[];
|
|
21
|
-
/**
|
|
22
|
-
* Expiration date parseable by `Date`; stored as ISO `expiresAt` or null.
|
|
23
|
-
*/
|
|
24
|
-
expires?: string;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Creates a new access token and prints the secret once.
|
|
28
|
-
*
|
|
29
|
-
* @param options - Name, scopes, and optional expiration from CLI flags.
|
|
30
|
-
* @returns Resolves when the token is created and printed.
|
|
31
|
-
*/
|
|
32
|
-
export declare function tokenCreateCommand(options: CreateTokenOptions): Promise<void>;
|
|
33
|
-
export {};
|
|
34
|
-
//# sourceMappingURL=create.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/commands/token/create.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAOH;;GAEG;AACH,UAAU,kBAAkB;IAC1B;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;IACjB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED;;;;;GAKG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CA8DnF"}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `limetry token create` — creates an access token via the Limetry API.
|
|
3
|
-
*
|
|
4
|
-
* Options: `--name`, `--scopes`, `--expires`. Missing name/scopes are prompted interactively.
|
|
5
|
-
*
|
|
6
|
-
* Side effects: `POST {baseUrl}/v1/tokens` with Bearer `apiKey`; prints the one-time token
|
|
7
|
-
* secret; may `process.exit(1)`. Requires prior `limetry login` / config via {@link requireAuth}.
|
|
8
|
-
*/
|
|
9
|
-
import inquirer from "inquirer";
|
|
10
|
-
import fetch from "node-fetch";
|
|
11
|
-
import { logError, logInfo, logSuccess, requireAuth } from "../../utils/config.js";
|
|
12
|
-
/**
|
|
13
|
-
* Creates a new access token and prints the secret once.
|
|
14
|
-
*
|
|
15
|
-
* @param options - Name, scopes, and optional expiration from CLI flags.
|
|
16
|
-
* @returns Resolves when the token is created and printed.
|
|
17
|
-
*/
|
|
18
|
-
export async function tokenCreateCommand(options) {
|
|
19
|
-
const config = requireAuth();
|
|
20
|
-
let name = options.name;
|
|
21
|
-
let scopes = options.scopes || [];
|
|
22
|
-
if (!name) {
|
|
23
|
-
const answers = await inquirer.prompt([
|
|
24
|
-
{
|
|
25
|
-
type: "input",
|
|
26
|
-
name: "name",
|
|
27
|
-
message: "Token name:",
|
|
28
|
-
},
|
|
29
|
-
]);
|
|
30
|
-
name = answers.name;
|
|
31
|
-
}
|
|
32
|
-
if (scopes.length === 0) {
|
|
33
|
-
const answers = await inquirer.prompt([
|
|
34
|
-
{
|
|
35
|
-
type: "checkbox",
|
|
36
|
-
name: "scopes",
|
|
37
|
-
message: "Select scopes:",
|
|
38
|
-
choices: ["read:rules", "write:rules", "read:tokens", "write:tokens"],
|
|
39
|
-
},
|
|
40
|
-
]);
|
|
41
|
-
scopes = answers.scopes;
|
|
42
|
-
}
|
|
43
|
-
try {
|
|
44
|
-
logInfo("Creating access token...");
|
|
45
|
-
const response = await fetch(`${config.baseUrl}/v1/tokens`, {
|
|
46
|
-
method: "POST",
|
|
47
|
-
headers: {
|
|
48
|
-
"Content-Type": "application/json",
|
|
49
|
-
Authorization: `Bearer ${config.apiKey}`,
|
|
50
|
-
},
|
|
51
|
-
body: JSON.stringify({
|
|
52
|
-
name,
|
|
53
|
-
scopes,
|
|
54
|
-
expiresAt: options.expires ? new Date(options.expires).toISOString() : null,
|
|
55
|
-
}),
|
|
56
|
-
});
|
|
57
|
-
if (!response.ok) {
|
|
58
|
-
const error = (await response.json());
|
|
59
|
-
throw new Error(String(error.message || "Failed to create token"));
|
|
60
|
-
}
|
|
61
|
-
const data = (await response.json());
|
|
62
|
-
console.log("\n" + "=".repeat(60));
|
|
63
|
-
logSuccess("Access token created");
|
|
64
|
-
console.log(`ID: ${data.id}`);
|
|
65
|
-
console.log(`Token: ${data.token}`);
|
|
66
|
-
console.log("=".repeat(60));
|
|
67
|
-
logInfo("Save this token securely. You won't be able to see it again.");
|
|
68
|
-
}
|
|
69
|
-
catch (error) {
|
|
70
|
-
logError(error instanceof Error ? error.message : "Failed to create token");
|
|
71
|
-
process.exit(1);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
//# sourceMappingURL=create.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../../src/commands/token/create.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,QAAQ,MAAM,UAAU,CAAA;AAC/B,OAAO,KAAK,MAAM,YAAY,CAAA;AAE9B,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAoBlF;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,OAA2B;IAClE,MAAM,MAAM,GAAG,WAAW,EAAE,CAAA;IAE5B,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAA;IACvB,IAAI,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,EAAE,CAAA;IAEjC,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC;YACpC;gBACE,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE,aAAa;aACvB;SACF,CAAC,CAAA;QACF,IAAI,GAAG,OAAO,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,EAAE,CAAC,CAAC,CAAA;QAClC,UAAU,CAAC,sBAAsB,CAAC,CAAA;QAClC,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,CAAC,EAAE,EAAE,CAAC,CAAA;QAChC,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,CAAC,KAAK,EAAE,CAAC,CAAA;QACnC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAA;QAC3B,OAAO,CAAC,8DAA8D,CAAC,CAAA;IACzE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,QAAQ,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAA;QAC3E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC;AACH,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `limetry token list` — lists access tokens for the authenticated API key.
|
|
3
|
-
*
|
|
4
|
-
* Side effects: `GET {baseUrl}/v1/tokens`; prints token metadata to stdout;
|
|
5
|
-
* may `process.exit(1)`. Requires config via {@link requireAuth}.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Fetches and prints all access tokens for the current API key.
|
|
9
|
-
*
|
|
10
|
-
* @returns Resolves when listing completes (including empty list).
|
|
11
|
-
*/
|
|
12
|
-
export declare function tokenListCommand(): Promise<void>;
|
|
13
|
-
//# sourceMappingURL=list.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/token/list.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH;;;;GAIG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CAmDtD"}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `limetry token list` — lists access tokens for the authenticated API key.
|
|
3
|
-
*
|
|
4
|
-
* Side effects: `GET {baseUrl}/v1/tokens`; prints token metadata to stdout;
|
|
5
|
-
* may `process.exit(1)`. Requires config via {@link requireAuth}.
|
|
6
|
-
*/
|
|
7
|
-
import chalk from "chalk";
|
|
8
|
-
import fetch from "node-fetch";
|
|
9
|
-
import { logError, logInfo, requireAuth } from "../../utils/config.js";
|
|
10
|
-
/**
|
|
11
|
-
* Fetches and prints all access tokens for the current API key.
|
|
12
|
-
*
|
|
13
|
-
* @returns Resolves when listing completes (including empty list).
|
|
14
|
-
*/
|
|
15
|
-
export async function tokenListCommand() {
|
|
16
|
-
const config = requireAuth();
|
|
17
|
-
try {
|
|
18
|
-
logInfo("Fetching access tokens...");
|
|
19
|
-
const response = await fetch(`${config.baseUrl}/v1/tokens`, {
|
|
20
|
-
method: "GET",
|
|
21
|
-
headers: {
|
|
22
|
-
Authorization: `Bearer ${config.apiKey}`,
|
|
23
|
-
},
|
|
24
|
-
});
|
|
25
|
-
if (!response.ok) {
|
|
26
|
-
throw new Error("Failed to fetch tokens");
|
|
27
|
-
}
|
|
28
|
-
const data = (await response.json());
|
|
29
|
-
if (data.length === 0) {
|
|
30
|
-
logInfo("No access tokens found");
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
console.log("\n" + chalk.bold("Access Tokens:"));
|
|
34
|
-
console.log("=".repeat(80));
|
|
35
|
-
data.forEach((token, idx) => {
|
|
36
|
-
const expires = token.expiresAt
|
|
37
|
-
? new Date(token.expiresAt).toLocaleDateString()
|
|
38
|
-
: "Never";
|
|
39
|
-
console.log(`${idx + 1}. ${chalk.green("●")} ${token.name}`);
|
|
40
|
-
console.log(` ID: ${token.id}`);
|
|
41
|
-
console.log(` Token: ${token.token}`);
|
|
42
|
-
console.log(` Scopes: ${token.scopes.join(", ")}`);
|
|
43
|
-
console.log(` Created: ${new Date(token.createdAt).toLocaleDateString()}`);
|
|
44
|
-
console.log(` Expires: ${expires}`);
|
|
45
|
-
console.log("");
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
catch (error) {
|
|
49
|
-
logError(error instanceof Error ? error.message : "Failed to fetch tokens");
|
|
50
|
-
process.exit(1);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
//# sourceMappingURL=list.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/token/list.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,MAAM,YAAY,CAAA;AAE9B,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAEtE;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB;IACpC,MAAM,MAAM,GAAG,WAAW,EAAE,CAAA;IAE5B,IAAI,CAAC;QACH,OAAO,CAAC,2BAA2B,CAAC,CAAA;QAEpC,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,MAAM,CAAC,OAAO,YAAY,EAAE;YAC1D,MAAM,EAAE,KAAK;YACb,OAAO,EAAE;gBACP,aAAa,EAAE,UAAU,MAAM,CAAC,MAAM,EAAE;aACzC;SACF,CAAC,CAAA;QAEF,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAA;QAC3C,CAAC;QAED,MAAM,IAAI,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAOjC,CAAA;QAEF,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACtB,OAAO,CAAC,wBAAwB,CAAC,CAAA;YACjC,OAAM;QACR,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAA;QAChD,OAAO,CAAC,GAAG,CAAC,GAAG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
|
|
4
|
-
* Side effects: prompts for confirmation; `DELETE {baseUrl}/v1/tokens/{tokenId}`;
|
|
5
|
-
* may `process.exit(1)`. Requires config via {@link requireAuth}.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Revokes the given access token after the user confirms.
|
|
9
|
-
*
|
|
10
|
-
* @param tokenId - Token id argument from `limetry token revoke <tokenId>`.
|
|
11
|
-
* @returns Resolves when revoked or the user cancels.
|
|
12
|
-
*/
|
|
13
|
-
export declare function tokenRevokeCommand(tokenId: string): Promise<void>;
|
|
14
|
-
//# sourceMappingURL=revoke.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"revoke.d.ts","sourceRoot":"","sources":["../../../src/commands/token/revoke.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH;;;;;GAKG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAoCvE"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `limetry token revoke` — deletes an access token after interactive confirmation.
|
|
3
|
-
*
|
|
4
|
-
* Side effects: prompts for confirmation; `DELETE {baseUrl}/v1/tokens/{tokenId}`;
|
|
5
|
-
* may `process.exit(1)`. Requires config via {@link requireAuth}.
|
|
6
|
-
*/
|
|
7
|
-
import inquirer from "inquirer";
|
|
8
|
-
import fetch from "node-fetch";
|
|
9
|
-
import { logError, logInfo, logSuccess, requireAuth } from "../../utils/config.js";
|
|
10
|
-
/**
|
|
11
|
-
* Revokes the given access token after the user confirms.
|
|
12
|
-
*
|
|
13
|
-
* @param tokenId - Token id argument from `limetry token revoke <tokenId>`.
|
|
14
|
-
* @returns Resolves when revoked or the user cancels.
|
|
15
|
-
*/
|
|
16
|
-
export async function tokenRevokeCommand(tokenId) {
|
|
17
|
-
const config = requireAuth();
|
|
18
|
-
const answers = await inquirer.prompt([
|
|
19
|
-
{
|
|
20
|
-
type: "confirm",
|
|
21
|
-
name: "confirm",
|
|
22
|
-
message: `Are you sure you want to revoke token ${tokenId}?`,
|
|
23
|
-
default: false,
|
|
24
|
-
},
|
|
25
|
-
]);
|
|
26
|
-
if (!answers.confirm) {
|
|
27
|
-
logInfo("Cancelled");
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
try {
|
|
31
|
-
logInfo("Revoking token...");
|
|
32
|
-
const response = await fetch(`${config.baseUrl}/v1/tokens/${tokenId}`, {
|
|
33
|
-
method: "DELETE",
|
|
34
|
-
headers: {
|
|
35
|
-
Authorization: `Bearer ${config.apiKey}`,
|
|
36
|
-
},
|
|
37
|
-
});
|
|
38
|
-
if (!response.ok) {
|
|
39
|
-
throw new Error("Failed to revoke token");
|
|
40
|
-
}
|
|
41
|
-
logSuccess("Token revoked");
|
|
42
|
-
}
|
|
43
|
-
catch (error) {
|
|
44
|
-
logError(error instanceof Error ? error.message : "Failed to revoke token");
|
|
45
|
-
process.exit(1);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
//# sourceMappingURL=revoke.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"revoke.js","sourceRoot":"","sources":["../../../src/commands/token/revoke.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,QAAQ,MAAM,UAAU,CAAA;AAC/B,OAAO,KAAK,MAAM,YAAY,CAAA;AAE9B,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAElF;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,OAAe;IACtD,MAAM,MAAM,GAAG,WAAW,EAAE,CAAA;IAE5B,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC;QACpC;YACE,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,yCAAyC,OAAO,GAAG;YAC5D,OAAO,EAAE,KAAK;SACf;KACF,CAAC,CAAA;IAEF,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;QACrB,OAAO,CAAC,WAAW,CAAC,CAAA;QACpB,OAAM;IACR,CAAC;IAED,IAAI,CAAC;QACH,OAAO,CAAC,mBAAmB,CAAC,CAAA;QAE5B,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,MAAM,CAAC,OAAO,cAAc,OAAO,EAAE,EAAE;YACrE,MAAM,EAAE,QAAQ;YAChB,OAAO,EAAE;gBACP,aAAa,EAAE,UAAU,MAAM,CAAC,MAAM,EAAE;aACzC;SACF,CAAC,CAAA;QAEF,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAA;QAC3C,CAAC;QAED,UAAU,CAAC,eAAe,CAAC,CAAA;IAC7B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,QAAQ,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAA;QAC3E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC;AACH,CAAC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `limetry token scope` — placeholder for scope add/remove/view actions.
|
|
3
|
-
*
|
|
4
|
-
* Accepted actions: `add`, `remove`, `view`. Scope mutation is not implemented in-CLI;
|
|
5
|
-
* users are directed to `limetry token list` or the web portal.
|
|
6
|
-
*
|
|
7
|
-
* Side effects: may `process.exit(1)` for unknown actions; no API writes.
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* Handles `limetry token scope <action>` for add/remove/view.
|
|
11
|
-
*
|
|
12
|
-
* @param action - One of `add`, `remove`, or `view`.
|
|
13
|
-
* @returns Resolves after printing guidance (or exits on unknown action).
|
|
14
|
-
*/
|
|
15
|
-
export declare function tokenScopeCommand(action: string): Promise<void>;
|
|
16
|
-
//# sourceMappingURL=scope.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scope.d.ts","sourceRoot":"","sources":["../../../src/commands/token/scope.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH;;;;;GAKG;AACH,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAoBrE"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `limetry token scope` — placeholder for scope add/remove/view actions.
|
|
3
|
-
*
|
|
4
|
-
* Accepted actions: `add`, `remove`, `view`. Scope mutation is not implemented in-CLI;
|
|
5
|
-
* users are directed to `limetry token list` or the web portal.
|
|
6
|
-
*
|
|
7
|
-
* Side effects: may `process.exit(1)` for unknown actions; no API writes.
|
|
8
|
-
*/
|
|
9
|
-
import { logError, logInfo } from "../../utils/config.js";
|
|
10
|
-
/**
|
|
11
|
-
* Handles `limetry token scope <action>` for add/remove/view.
|
|
12
|
-
*
|
|
13
|
-
* @param action - One of `add`, `remove`, or `view`.
|
|
14
|
-
* @returns Resolves after printing guidance (or exits on unknown action).
|
|
15
|
-
*/
|
|
16
|
-
export async function tokenScopeCommand(action) {
|
|
17
|
-
const actions = ["add", "remove", "view"];
|
|
18
|
-
if (!actions.includes(action)) {
|
|
19
|
-
logError(`Unknown action: ${action}. Use add, remove, or view.`);
|
|
20
|
-
process.exit(1);
|
|
21
|
-
}
|
|
22
|
-
try {
|
|
23
|
-
if (action === "view") {
|
|
24
|
-
logInfo("List tokens first: limetry token list");
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
logInfo(`Scope action: ${action}`);
|
|
28
|
-
logInfo("Scope management available via the web portal");
|
|
29
|
-
}
|
|
30
|
-
catch (error) {
|
|
31
|
-
logError(error instanceof Error ? error.message : "Failed to manage scopes");
|
|
32
|
-
process.exit(1);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
//# sourceMappingURL=scope.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scope.js","sourceRoot":"","sources":["../../../src/commands/token/scope.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAEzD;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,MAAc;IACpD,MAAM,OAAO,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAA;IAEzC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAC9B,QAAQ,CAAC,mBAAmB,MAAM,6BAA6B,CAAC,CAAA;QAChE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC;IAED,IAAI,CAAC;QACH,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;YACtB,OAAO,CAAC,uCAAuC,CAAC,CAAA;YAChD,OAAM;QACR,CAAC;QAED,OAAO,CAAC,iBAAiB,MAAM,EAAE,CAAC,CAAA;QAClC,OAAO,CAAC,+CAA+C,CAAC,CAAA;IAC1D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,QAAQ,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAA;QAC5E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Limetry CLI entrypoint (`\@limetry/cli`).
|
|
4
|
-
*
|
|
5
|
-
* Registers Commander commands for setup, auth, policy, eval, approvals, audit,
|
|
6
|
-
* and token management. Parses `process.argv` and exits via Commander.
|
|
7
|
-
*
|
|
8
|
-
* @packageDocumentation
|
|
9
|
-
*/
|
|
10
|
-
export {};
|
|
11
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;GAOG"}
|
package/dist/index.js
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Limetry CLI entrypoint (`\@limetry/cli`).
|
|
4
|
-
*
|
|
5
|
-
* Registers Commander commands for setup, auth, policy, eval, approvals, audit,
|
|
6
|
-
* and token management. Parses `process.argv` and exits via Commander.
|
|
7
|
-
*
|
|
8
|
-
* @packageDocumentation
|
|
9
|
-
*/
|
|
10
|
-
import { APP_VERSION } from "@limetry/sdk";
|
|
11
|
-
import { Command } from "commander";
|
|
12
|
-
import { loginCommand } from "./commands/auth/login.js";
|
|
13
|
-
import { approvalsListCommand, approvalsResolveCommand, auditTailCommand, doctorCommand, evalCommand, policyApplyCommand, } from "./commands/governance/index.js";
|
|
14
|
-
import { setupCommand } from "./commands/setup/index.js";
|
|
15
|
-
import { tokenCreateCommand } from "./commands/token/create.js";
|
|
16
|
-
import { tokenListCommand } from "./commands/token/list.js";
|
|
17
|
-
import { tokenRevokeCommand } from "./commands/token/revoke.js";
|
|
18
|
-
import { tokenScopeCommand } from "./commands/token/scope.js";
|
|
19
|
-
const program = new Command();
|
|
20
|
-
program
|
|
21
|
-
.name("limetry")
|
|
22
|
-
.description("Limetry CLI — agent action governance and telemetry")
|
|
23
|
-
.version(APP_VERSION);
|
|
24
|
-
program
|
|
25
|
-
.command("setup")
|
|
26
|
-
.description("Interactive setup — local server or hosted API key")
|
|
27
|
-
.action(setupCommand);
|
|
28
|
-
program
|
|
29
|
-
.command("doctor")
|
|
30
|
-
.description("Check config, server health, and API auth")
|
|
31
|
-
.action(doctorCommand);
|
|
32
|
-
program
|
|
33
|
-
.command("login")
|
|
34
|
-
.description("Authenticate with Limetry (JWT)")
|
|
35
|
-
.action(loginCommand);
|
|
36
|
-
const policyCmd = program.command("policy");
|
|
37
|
-
policyCmd.description("Manage action policies");
|
|
38
|
-
policyCmd
|
|
39
|
-
.command("apply")
|
|
40
|
-
.description("Upsert an ActionPolicy from flags or a JSON file")
|
|
41
|
-
.option("-f, --file <path>", "Path to ActionPolicy JSON")
|
|
42
|
-
.option("--agent-id <id>", "Agent id for slim policy")
|
|
43
|
-
.option("--allow <types...>", "Allowed action types")
|
|
44
|
-
.option("--deny <types...>", "Denied action types")
|
|
45
|
-
.option("--block-resource <patterns...>", "Blocked resource patterns")
|
|
46
|
-
.option("--max-cost <minor>", "Max cost in minor units")
|
|
47
|
-
.action(policyApplyCommand);
|
|
48
|
-
program
|
|
49
|
-
.command("eval")
|
|
50
|
-
.description("Evaluate an ActionIntent JSON from --file or stdin")
|
|
51
|
-
.option("-f, --file <path>", "Path to ActionIntent JSON")
|
|
52
|
-
.action(evalCommand);
|
|
53
|
-
const approvalsCmd = program.command("approvals");
|
|
54
|
-
approvalsCmd.description("List and resolve pending approvals");
|
|
55
|
-
approvalsCmd
|
|
56
|
-
.command("list")
|
|
57
|
-
.description("List approvals")
|
|
58
|
-
.option("--status <status>", "pending | approved | denied | all", "pending")
|
|
59
|
-
.action(approvalsListCommand);
|
|
60
|
-
approvalsCmd
|
|
61
|
-
.command("approve")
|
|
62
|
-
.description("Approve a pending approval (optionally re-bind intent JSON)")
|
|
63
|
-
.argument("<approvalId>", "Approval id")
|
|
64
|
-
.option("--reviewer <name>", "Reviewer identity")
|
|
65
|
-
.option("-f, --intent-file <path>", "Exact ActionIntent JSON for payload-hash check")
|
|
66
|
-
.action((approvalId, options) => approvalsResolveCommand({
|
|
67
|
-
approvalId,
|
|
68
|
-
decision: "approve",
|
|
69
|
-
reviewer: options.reviewer,
|
|
70
|
-
intentFile: options.intentFile,
|
|
71
|
-
}));
|
|
72
|
-
approvalsCmd
|
|
73
|
-
.command("deny")
|
|
74
|
-
.description("Deny a pending approval")
|
|
75
|
-
.argument("<approvalId>", "Approval id")
|
|
76
|
-
.option("--reviewer <name>", "Reviewer identity")
|
|
77
|
-
.action((approvalId, options) => approvalsResolveCommand({
|
|
78
|
-
approvalId,
|
|
79
|
-
decision: "deny",
|
|
80
|
-
reviewer: options.reviewer,
|
|
81
|
-
}));
|
|
82
|
-
const auditCmd = program.command("audit");
|
|
83
|
-
auditCmd.description("Query audit / telemetry events");
|
|
84
|
-
auditCmd
|
|
85
|
-
.command("tail")
|
|
86
|
-
.description("List recent audit events")
|
|
87
|
-
.option("-n, --limit <count>", "Number of events", "20")
|
|
88
|
-
.option("--event-type <type>", "Filter by event type")
|
|
89
|
-
.option("--agent-id <id>", "Filter by agent id")
|
|
90
|
-
.action(auditTailCommand);
|
|
91
|
-
const tokenCmd = program.command("token");
|
|
92
|
-
tokenCmd.description("Manage access tokens");
|
|
93
|
-
tokenCmd
|
|
94
|
-
.command("create")
|
|
95
|
-
.description("Create a new access token")
|
|
96
|
-
.option("-n, --name <name>", "Token name")
|
|
97
|
-
.option("-s, --scopes <scopes...>", "Token scopes")
|
|
98
|
-
.option("-e, --expires <date>", "Expiration date")
|
|
99
|
-
.action(tokenCreateCommand);
|
|
100
|
-
tokenCmd
|
|
101
|
-
.command("list")
|
|
102
|
-
.description("List your access tokens")
|
|
103
|
-
.action(tokenListCommand);
|
|
104
|
-
tokenCmd
|
|
105
|
-
.command("revoke")
|
|
106
|
-
.description("Revoke an access token")
|
|
107
|
-
.argument("<tokenId>", "Token ID to revoke")
|
|
108
|
-
.action(tokenRevokeCommand);
|
|
109
|
-
tokenCmd
|
|
110
|
-
.command("scope <action>")
|
|
111
|
-
.description("Manage token scopes")
|
|
112
|
-
.action(tokenScopeCommand);
|
|
113
|
-
program.parse();
|
|
114
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 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