@permission-slip/cli 0.1.0
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/dist/api/client.d.ts +91 -0
- package/dist/api/client.d.ts.map +1 -0
- package/dist/api/client.js +190 -0
- package/dist/api/client.js.map +1 -0
- package/dist/auth/keys.d.ts +41 -0
- package/dist/auth/keys.d.ts.map +1 -0
- package/dist/auth/keys.js +133 -0
- package/dist/auth/keys.js.map +1 -0
- package/dist/auth/signing.d.ts +27 -0
- package/dist/auth/signing.d.ts.map +1 -0
- package/dist/auth/signing.js +61 -0
- package/dist/auth/signing.js.map +1 -0
- package/dist/commands/capabilities.d.ts +8 -0
- package/dist/commands/capabilities.d.ts.map +1 -0
- package/dist/commands/capabilities.js +30 -0
- package/dist/commands/capabilities.js.map +1 -0
- package/dist/commands/config.d.ts +8 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +38 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/connectors.d.ts +9 -0
- package/dist/commands/connectors.d.ts.map +1 -0
- package/dist/commands/connectors.js +34 -0
- package/dist/commands/connectors.js.map +1 -0
- package/dist/commands/execute.d.ts +17 -0
- package/dist/commands/execute.d.ts.map +1 -0
- package/dist/commands/execute.js +58 -0
- package/dist/commands/execute.js.map +1 -0
- package/dist/commands/register.d.ts +14 -0
- package/dist/commands/register.d.ts.map +1 -0
- package/dist/commands/register.js +65 -0
- package/dist/commands/register.js.map +1 -0
- package/dist/commands/request.d.ts +9 -0
- package/dist/commands/request.d.ts.map +1 -0
- package/dist/commands/request.js +54 -0
- package/dist/commands/request.js.map +1 -0
- package/dist/commands/status.d.ts +9 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +44 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/verify.d.ts +9 -0
- package/dist/commands/verify.d.ts.map +1 -0
- package/dist/commands/verify.js +61 -0
- package/dist/commands/verify.js.map +1 -0
- package/dist/commands/whoami.d.ts +8 -0
- package/dist/commands/whoami.d.ts.map +1 -0
- package/dist/commands/whoami.js +65 -0
- package/dist/commands/whoami.js.map +1 -0
- package/dist/config/store.d.ts +30 -0
- package/dist/config/store.d.ts.map +1 -0
- package/dist/config/store.js +73 -0
- package/dist/config/store.js.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +51 -0
- package/dist/index.js.map +1 -0
- package/dist/output.d.ts +9 -0
- package/dist/output.d.ts.map +1 -0
- package/dist/output.js +16 -0
- package/dist/output.js.map +1 -0
- package/dist/util/shell.d.ts +12 -0
- package/dist/util/shell.d.ts.map +1 -0
- package/dist/util/shell.js +14 -0
- package/dist/util/shell.js.map +1 -0
- package/package.json +54 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Manages ~/.permission-slip/ — config directory and registrations file.
|
|
3
|
+
*
|
|
4
|
+
* Registrations are stored as:
|
|
5
|
+
* ~/.permission-slip/registrations.json
|
|
6
|
+
*
|
|
7
|
+
* Key files are stored as:
|
|
8
|
+
* ~/.ssh/permission_slip_agent (private key, OpenSSH format)
|
|
9
|
+
* ~/.ssh/permission_slip_agent.pub (public key)
|
|
10
|
+
*/
|
|
11
|
+
import fs from "node:fs";
|
|
12
|
+
import os from "node:os";
|
|
13
|
+
import path from "node:path";
|
|
14
|
+
// Paths can be overridden via environment variables for testing.
|
|
15
|
+
export const CONFIG_DIR = process.env["PS_CLI_TEST_CONFIG_DIR"] ??
|
|
16
|
+
path.join(os.homedir(), ".permission-slip");
|
|
17
|
+
export const REGISTRATIONS_FILE = path.join(CONFIG_DIR, "registrations.json");
|
|
18
|
+
export const SSH_DIR = process.env["PS_CLI_TEST_SSH_DIR"] ?? path.join(os.homedir(), ".ssh");
|
|
19
|
+
export const PRIVATE_KEY_FILE = process.env["PS_CLI_TEST_PRIVATE_KEY"] ??
|
|
20
|
+
path.join(SSH_DIR, "permission_slip_agent");
|
|
21
|
+
export const PUBLIC_KEY_FILE = process.env["PS_CLI_TEST_PUBLIC_KEY"] ??
|
|
22
|
+
path.join(SSH_DIR, "permission_slip_agent.pub");
|
|
23
|
+
export function ensureConfigDir() {
|
|
24
|
+
if (!fs.existsSync(CONFIG_DIR)) {
|
|
25
|
+
fs.mkdirSync(CONFIG_DIR, { recursive: true, mode: 0o700 });
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export function loadRegistrations() {
|
|
29
|
+
if (!fs.existsSync(REGISTRATIONS_FILE)) {
|
|
30
|
+
return [];
|
|
31
|
+
}
|
|
32
|
+
try {
|
|
33
|
+
const raw = fs.readFileSync(REGISTRATIONS_FILE, "utf-8");
|
|
34
|
+
const data = JSON.parse(raw);
|
|
35
|
+
return data.registrations ?? [];
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
return [];
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
export function saveRegistration(reg) {
|
|
42
|
+
ensureConfigDir();
|
|
43
|
+
// Normalize: strip trailing slashes so lookups are consistent regardless of
|
|
44
|
+
// whether the caller passed "https://host" or "https://host/".
|
|
45
|
+
const normalized = { ...reg, server: reg.server.replace(/\/+$/, "") };
|
|
46
|
+
const existing = loadRegistrations();
|
|
47
|
+
// Upsert: replace existing entry for same server+agent_id if present
|
|
48
|
+
const idx = existing.findIndex((r) => r.server === normalized.server && r.agent_id === normalized.agent_id);
|
|
49
|
+
if (idx >= 0) {
|
|
50
|
+
existing[idx] = normalized;
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
existing.push(normalized);
|
|
54
|
+
}
|
|
55
|
+
const data = { registrations: existing };
|
|
56
|
+
fs.writeFileSync(REGISTRATIONS_FILE, JSON.stringify(data, null, 2) + "\n", {
|
|
57
|
+
mode: 0o600,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Find a registration for the given server. If multiple registrations exist
|
|
62
|
+
* for the same server (different agent IDs), returns the most recently
|
|
63
|
+
* registered one.
|
|
64
|
+
*/
|
|
65
|
+
export function findRegistration(server) {
|
|
66
|
+
const normalizedServer = server.replace(/\/+$/, "");
|
|
67
|
+
const regs = loadRegistrations();
|
|
68
|
+
const matching = regs.filter((r) => r.server === normalizedServer);
|
|
69
|
+
if (matching.length === 0)
|
|
70
|
+
return undefined;
|
|
71
|
+
return matching.sort((a, b) => new Date(b.registered_at).getTime() - new Date(a.registered_at).getTime())[0];
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../src/config/store.ts"],"names":[],"mappings":"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"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* @permission-slip/cli — agent-facing CLI for Permission Slip
|
|
4
|
+
*
|
|
5
|
+
* Usage:
|
|
6
|
+
* npx @permission-slip/cli <command> [options]
|
|
7
|
+
*
|
|
8
|
+
* Commands:
|
|
9
|
+
* register Generate keys and register with a Permission Slip server
|
|
10
|
+
* verify Complete registration with the confirmation code
|
|
11
|
+
* status Show current registration state
|
|
12
|
+
* capabilities List available action configurations and standing approvals
|
|
13
|
+
* connectors List available connectors
|
|
14
|
+
* request Request approval for an action
|
|
15
|
+
* execute Execute an approved action
|
|
16
|
+
* config Show saved configuration and registrations
|
|
17
|
+
* whoami Show agent identity and registration info
|
|
18
|
+
*
|
|
19
|
+
* All commands output compact JSON by default. Pass --pretty for pretty-printed JSON.
|
|
20
|
+
*/
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;GAkBG"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* @permission-slip/cli — agent-facing CLI for Permission Slip
|
|
4
|
+
*
|
|
5
|
+
* Usage:
|
|
6
|
+
* npx @permission-slip/cli <command> [options]
|
|
7
|
+
*
|
|
8
|
+
* Commands:
|
|
9
|
+
* register Generate keys and register with a Permission Slip server
|
|
10
|
+
* verify Complete registration with the confirmation code
|
|
11
|
+
* status Show current registration state
|
|
12
|
+
* capabilities List available action configurations and standing approvals
|
|
13
|
+
* connectors List available connectors
|
|
14
|
+
* request Request approval for an action
|
|
15
|
+
* execute Execute an approved action
|
|
16
|
+
* config Show saved configuration and registrations
|
|
17
|
+
* whoami Show agent identity and registration info
|
|
18
|
+
*
|
|
19
|
+
* All commands output compact JSON by default. Pass --pretty for pretty-printed JSON.
|
|
20
|
+
*/
|
|
21
|
+
import { Command } from "commander";
|
|
22
|
+
import { registerCommand } from "./commands/register.js";
|
|
23
|
+
import { verifyCommand } from "./commands/verify.js";
|
|
24
|
+
import { statusCommand } from "./commands/status.js";
|
|
25
|
+
import { capabilitiesCommand } from "./commands/capabilities.js";
|
|
26
|
+
import { connectorsCommand } from "./commands/connectors.js";
|
|
27
|
+
import { requestCommand } from "./commands/request.js";
|
|
28
|
+
import { executeCommand } from "./commands/execute.js";
|
|
29
|
+
import { configCommand } from "./commands/config.js";
|
|
30
|
+
import { whoamiCommand } from "./commands/whoami.js";
|
|
31
|
+
const program = new Command();
|
|
32
|
+
program
|
|
33
|
+
.name("permission-slip")
|
|
34
|
+
.description("Agent-facing CLI for Permission Slip — register, verify, and interact with Permission Slip servers.\n\n" +
|
|
35
|
+
"All commands output compact JSON by default. Pass --pretty for pretty-printed JSON.\n\n" +
|
|
36
|
+
"Quick start:\n" +
|
|
37
|
+
" 1. Register: permission-slip register --invite-code <code>\n" +
|
|
38
|
+
" 2. Verify: permission-slip verify --code <confirmation_code>\n" +
|
|
39
|
+
" 3. Discover: permission-slip capabilities")
|
|
40
|
+
.version("0.1.0");
|
|
41
|
+
registerCommand(program);
|
|
42
|
+
verifyCommand(program);
|
|
43
|
+
statusCommand(program);
|
|
44
|
+
capabilitiesCommand(program);
|
|
45
|
+
connectorsCommand(program);
|
|
46
|
+
requestCommand(program);
|
|
47
|
+
executeCommand(program);
|
|
48
|
+
configCommand(program);
|
|
49
|
+
whoamiCommand(program);
|
|
50
|
+
program.parse(process.argv);
|
|
51
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,iBAAiB,CAAC;KACvB,WAAW,CACV,yGAAyG;IACzG,yFAAyF;IACzF,gBAAgB;IAChB,iEAAiE;IACjE,qEAAqE;IACrE,8CAA8C,CAC/C;KACA,OAAO,CAAC,OAAO,CAAC,CAAC;AAEpB,eAAe,CAAC,OAAO,CAAC,CAAC;AACzB,aAAa,CAAC,OAAO,CAAC,CAAC;AACvB,aAAa,CAAC,OAAO,CAAC,CAAC;AACvB,mBAAmB,CAAC,OAAO,CAAC,CAAC;AAC7B,iBAAiB,CAAC,OAAO,CAAC,CAAC;AAC3B,cAAc,CAAC,OAAO,CAAC,CAAC;AACxB,cAAc,CAAC,OAAO,CAAC,CAAC;AACxB,aAAa,CAAC,OAAO,CAAC,CAAC;AACvB,aAAa,CAAC,OAAO,CAAC,CAAC;AAEvB,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
|
package/dist/output.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared output helpers. All commands output JSON by default, or formatted
|
|
3
|
+
* text when --pretty is passed.
|
|
4
|
+
*/
|
|
5
|
+
export interface OutputOptions {
|
|
6
|
+
pretty: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function output(data: unknown, opts: OutputOptions): void;
|
|
9
|
+
//# sourceMappingURL=output.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../src/output.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,wBAAgB,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,aAAa,GAAG,IAAI,CAS/D"}
|
package/dist/output.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared output helpers. All commands output JSON by default, or formatted
|
|
3
|
+
* text when --pretty is passed.
|
|
4
|
+
*/
|
|
5
|
+
export function output(data, opts) {
|
|
6
|
+
// JSON.stringify(undefined) returns undefined (not a string), which would
|
|
7
|
+
// print the literal text "undefined" — not valid JSON. Normalise to null.
|
|
8
|
+
const value = data !== undefined ? data : null;
|
|
9
|
+
if (opts.pretty) {
|
|
10
|
+
console.log(JSON.stringify(value, null, 2));
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
console.log(JSON.stringify(value));
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=output.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output.js","sourceRoot":"","sources":["../src/output.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,MAAM,UAAU,MAAM,CAAC,IAAa,EAAE,IAAmB;IACvD,0EAA0E;IAC1E,0EAA0E;IAC1E,MAAM,KAAK,GAAG,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;IAC/C,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;QAChB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAC9C,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;IACrC,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shell-quoting utilities for generating safe command hints.
|
|
3
|
+
*
|
|
4
|
+
* These are used to produce next_step command strings that agents can safely
|
|
5
|
+
* copy and run in a POSIX shell, even when values contain metacharacters.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Wraps a string in single quotes, escaping any embedded single quotes.
|
|
9
|
+
* Produces output safe for POSIX /bin/sh: `'value'` or `'it'\''s ok'`.
|
|
10
|
+
*/
|
|
11
|
+
export declare function shellQuote(s: string): string;
|
|
12
|
+
//# sourceMappingURL=shell.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../src/util/shell.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAE5C"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shell-quoting utilities for generating safe command hints.
|
|
3
|
+
*
|
|
4
|
+
* These are used to produce next_step command strings that agents can safely
|
|
5
|
+
* copy and run in a POSIX shell, even when values contain metacharacters.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Wraps a string in single quotes, escaping any embedded single quotes.
|
|
9
|
+
* Produces output safe for POSIX /bin/sh: `'value'` or `'it'\''s ok'`.
|
|
10
|
+
*/
|
|
11
|
+
export function shellQuote(s) {
|
|
12
|
+
return `'${s.replace(/'/g, "'\\''")}'`;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=shell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shell.js","sourceRoot":"","sources":["../../src/util/shell.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,CAAS;IAClC,OAAO,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC;AACzC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@permission-slip/cli",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Agent-facing CLI for Permission Slip — register, verify, and interact with Permission Slip servers",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": ">=18"
|
|
9
|
+
},
|
|
10
|
+
"bin": {
|
|
11
|
+
"permission-slip": "dist/index.js"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"dist",
|
|
15
|
+
"README.md"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "tsc",
|
|
19
|
+
"dev": "tsc --watch",
|
|
20
|
+
"test": "node --experimental-vm-modules node_modules/.bin/jest --passWithNoTests",
|
|
21
|
+
"test:watch": "node --experimental-vm-modules node_modules/.bin/jest --watch",
|
|
22
|
+
"prepublishOnly": "npm run build"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"commander": "^12.1.0"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@types/jest": "^29.5.14",
|
|
29
|
+
"@types/node": "^22.0.0",
|
|
30
|
+
"jest": "^29.7.0",
|
|
31
|
+
"ts-jest": "^29.3.0",
|
|
32
|
+
"typescript": "^5.7.2"
|
|
33
|
+
},
|
|
34
|
+
"jest": {
|
|
35
|
+
"preset": "ts-jest/presets/default-esm",
|
|
36
|
+
"testEnvironment": "node",
|
|
37
|
+
"globalSetup": "<rootDir>/tests/setup.ts",
|
|
38
|
+
"globalTeardown": "<rootDir>/tests/teardown.ts",
|
|
39
|
+
"moduleNameMapper": {
|
|
40
|
+
"^(\\.{1,2}/.*)\\.js$": "$1"
|
|
41
|
+
},
|
|
42
|
+
"transform": {
|
|
43
|
+
"^.+\\.tsx?$": [
|
|
44
|
+
"ts-jest",
|
|
45
|
+
{
|
|
46
|
+
"useESM": true,
|
|
47
|
+
"diagnostics": {
|
|
48
|
+
"ignoreCodes": [151002]
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|