@openape/cli 0.2.0 → 0.2.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/dist/commands/install-sudo.js +10 -6
- package/dist/index.js +3 -3
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { existsSync } from 'node:fs';
|
|
2
2
|
import { execSync } from 'node:child_process';
|
|
3
3
|
import { arch, platform } from 'node:os';
|
|
4
|
-
import { requireRoot, ensureDir, writeSecureFile, run, parseFlags
|
|
4
|
+
import { requireRoot, ensureDir, writeSecureFile, run, parseFlags } from '../utils.js';
|
|
5
5
|
const CONFIG_DIR = '/etc/apes';
|
|
6
6
|
const CONFIG_PATH = `${CONFIG_DIR}/config.toml`;
|
|
7
7
|
const BIN_PATH = '/usr/local/bin/apes';
|
|
@@ -9,7 +9,6 @@ const REPO = 'openape-ai/sudo';
|
|
|
9
9
|
export async function installSudo(args) {
|
|
10
10
|
requireRoot();
|
|
11
11
|
const flags = parseFlags(args);
|
|
12
|
-
const idpUrl = requireFlag(flags, 'idp-url');
|
|
13
12
|
const pollTimeout = flags['poll-timeout'] || '300';
|
|
14
13
|
const pollInterval = flags['poll-interval'] || '2';
|
|
15
14
|
const force = flags['force'] === true;
|
|
@@ -32,14 +31,19 @@ export async function installSudo(args) {
|
|
|
32
31
|
const config = `# OpenApe Sudo (apes) Configuration
|
|
33
32
|
# Generated by: openape install-sudo
|
|
34
33
|
|
|
35
|
-
server_url = "${idpUrl}"
|
|
36
|
-
|
|
37
34
|
# Agent identity is determined by the key passed via --key flag.
|
|
38
|
-
#
|
|
35
|
+
# Agents are registered via: apes enroll --server <idp-url> --agent-email <email> --agent-name <name> --key <path>
|
|
36
|
+
# Each enrolled agent gets a [[agents]] entry below automatically.
|
|
39
37
|
|
|
40
38
|
[poll]
|
|
41
39
|
interval_secs = ${pollInterval}
|
|
42
40
|
timeout_secs = ${pollTimeout}
|
|
41
|
+
|
|
42
|
+
# Agents are added here by 'apes enroll':
|
|
43
|
+
# [[agents]]
|
|
44
|
+
# name = "my-agent"
|
|
45
|
+
# public_key = "ssh-ed25519 AAAA..."
|
|
46
|
+
# server_url = "https://id.example.com"
|
|
43
47
|
`;
|
|
44
48
|
ensureDir(CONFIG_DIR, 0o700);
|
|
45
49
|
writeSecureFile(CONFIG_PATH, config);
|
|
@@ -49,7 +53,7 @@ timeout_secs = ${pollTimeout}
|
|
|
49
53
|
console.log(` Binary: ${BIN_PATH} (setuid root)`);
|
|
50
54
|
console.log(` Config: ${CONFIG_PATH}`);
|
|
51
55
|
console.log('\n Next steps:');
|
|
52
|
-
console.log(
|
|
56
|
+
console.log(' 1. Enroll: apes enroll --server <idp-url> --agent-email <email> --agent-name <name> --key <path>');
|
|
53
57
|
console.log(' 2. Admin approves enrollment');
|
|
54
58
|
console.log(' 3. Use: apes --key ~/.ssh/id_ed25519 --reason "why" -- <command>\n');
|
|
55
59
|
}
|
package/dist/index.js
CHANGED
|
@@ -25,15 +25,15 @@ install-proxy flags:
|
|
|
25
25
|
--force Overwrite existing config
|
|
26
26
|
|
|
27
27
|
install-sudo flags:
|
|
28
|
-
--idp-url <url> IdP URL (required)
|
|
29
28
|
--poll-timeout <secs> Poll timeout in seconds (default: 300)
|
|
30
29
|
--poll-interval <secs> Poll interval in seconds (default: 2)
|
|
31
|
-
--force Overwrite existing config
|
|
30
|
+
--force Overwrite existing binary/config
|
|
32
31
|
|
|
33
32
|
Examples:
|
|
34
33
|
sudo openape install-proxy --idp-url https://id.openape.at --agent-email bot@example.com
|
|
35
34
|
apes -- npx @openape/cli install-proxy --idp-url https://id.openape.at --agent-email bot@example.com
|
|
36
|
-
sudo openape install-sudo
|
|
35
|
+
sudo openape install-sudo
|
|
36
|
+
# Then enroll: apes enroll --server https://id.openape.at --agent-email bot@example.com --agent-name "My Agent" --key ~/.ssh/id_ed25519
|
|
37
37
|
`;
|
|
38
38
|
async function main() {
|
|
39
39
|
switch (command) {
|