Monorepo for Aesthetic.Computer aesthetic.computer
4
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat(at): add ssh and env:set commands to ac-at CLI

- `ac-at ssh` — interactive SSH into PDS droplet
- `ac-at ssh <command>` — run remote command on PDS
- `ac-at env:set <KEY> <VALUE>` — set env var in /pds/pds.env

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

+54
+54
at/cli.mjs
··· 490 490 console.log(); 491 491 } 492 492 493 + async function commandSSH(args) { 494 + const { execSync } = await import("child_process"); 495 + const ip = process.env.PDS_SSH_HOST || "138.197.35.160"; 496 + const key = process.env.PDS_SSH_KEY || `${process.env.HOME}/.ssh/aesthetic_pds`; 497 + const remoteCmd = args._.slice(1).join(" "); 498 + 499 + const sshCmd = remoteCmd 500 + ? `ssh -i ${key} root@${ip} ${JSON.stringify(remoteCmd)}` 501 + : `ssh -i ${key} root@${ip}`; 502 + 503 + console.log(`$ ${sshCmd}\n`); 504 + try { 505 + execSync(sshCmd, { stdio: "inherit" }); 506 + } catch (e) { 507 + process.exitCode = e.status || 1; 508 + } 509 + } 510 + 511 + async function commandEnvSet(args) { 512 + const { execSync } = await import("child_process"); 513 + const key = args._[1]; 514 + const value = args._[2]; 515 + 516 + if (!key || !value) { 517 + console.error("Usage: ac-at env:set <KEY> <VALUE>"); 518 + console.error("Example: ac-at env:set PDS_CONTACT_EMAIL_ADDRESS mail@aesthetic.computer"); 519 + process.exit(1); 520 + } 521 + 522 + const ip = process.env.PDS_SSH_HOST || "138.197.35.160"; 523 + const sshKey = process.env.PDS_SSH_KEY || `${process.env.HOME}/.ssh/aesthetic_pds`; 524 + const envFile = "/pds/pds.env"; 525 + 526 + console.log(`Setting ${key}=${value} on PDS (${ip})...\n`); 527 + 528 + // Check if key already exists, update or append 529 + const cmd = `ssh -i ${sshKey} root@${ip} "grep -q '^${key}=' ${envFile} && sed -i 's|^${key}=.*|${key}=${value}|' ${envFile} || echo '${key}=${value}' >> ${envFile}"`; 530 + 531 + try { 532 + execSync(cmd, { stdio: "inherit" }); 533 + console.log(`\nSet ${key}=${value} in ${envFile}`); 534 + console.log(`Restart PDS to apply: ac-at ssh systemctl restart pds`); 535 + } catch (e) { 536 + console.error(`Failed to set env var: ${e.message}`); 537 + process.exitCode = 1; 538 + } 539 + } 540 + 493 541 // --------------------------------------------------------------------------- 494 542 // Help 495 543 // --------------------------------------------------------------------------- ··· 516 564 account:check <handle-or-did> Inspect account & record counts 517 565 sync:status Record counts across collections 518 566 567 + Server: 568 + ssh [command] SSH into PDS droplet (or run command) 569 + env:set <KEY> <VALUE> Set env var in PDS pds.env file 570 + 519 571 Environment: 520 572 PDS_URL PDS endpoint (default: https://at.aesthetic.computer) 521 573 PDS_ADMIN_PASSWORD Admin password for PDS operations ··· 552 604 accounts: commandAccounts, 553 605 "account:check": commandAccountCheck, 554 606 "sync:status": commandSyncStatus, 607 + ssh: commandSSH, 608 + "env:set": commandEnvSet, 555 609 }; 556 610 557 611 async function main() {