@openape/apes 0.15.0 → 0.15.2
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/cli.js
CHANGED
|
@@ -1820,7 +1820,7 @@ function buildDestroyTeardownScript(input) {
|
|
|
1820
1820
|
return `#!/bin/bash
|
|
1821
1821
|
# Best-effort teardown. set -u catches typos; we deliberately do NOT use -e
|
|
1822
1822
|
# because pkill / launchctl are allowed to fail when the user has no live
|
|
1823
|
-
# sessions
|
|
1823
|
+
# sessions.
|
|
1824
1824
|
set -u
|
|
1825
1825
|
|
|
1826
1826
|
NAME=${shQuote(name)}
|
|
@@ -1837,7 +1837,32 @@ if [ -d "$HOME_DIR" ] && [ "$HOME_DIR" != "/" ] && [ "$HOME_DIR" != "" ]; then
|
|
|
1837
1837
|
rm -rf "$HOME_DIR"
|
|
1838
1838
|
fi
|
|
1839
1839
|
|
|
1840
|
-
|
|
1840
|
+
# Delete the user record. \`sysadminctl -deleteUser\` is the canonical macOS
|
|
1841
|
+
# API and removes Open Directory metadata that \`dscl . -delete\` leaves
|
|
1842
|
+
# behind. Fall back to dscl if sysadminctl isn't available or rejects the
|
|
1843
|
+
# user. Surface a clear error if both fail \u2014 silent failure here is what
|
|
1844
|
+
# left orphaned dscl records on previous spawn/destroy round-trips.
|
|
1845
|
+
if command -v sysadminctl >/dev/null 2>&1; then
|
|
1846
|
+
if sysadminctl -deleteUser "$NAME" 2>/dev/null; then
|
|
1847
|
+
:
|
|
1848
|
+
elif dscl . -read "/Users/$NAME" >/dev/null 2>&1; then
|
|
1849
|
+
dscl . -delete "/Users/$NAME" || {
|
|
1850
|
+
echo "ERROR: failed to delete user record /Users/$NAME" >&2
|
|
1851
|
+
exit 1
|
|
1852
|
+
}
|
|
1853
|
+
fi
|
|
1854
|
+
elif dscl . -read "/Users/$NAME" >/dev/null 2>&1; then
|
|
1855
|
+
dscl . -delete "/Users/$NAME" || {
|
|
1856
|
+
echo "ERROR: failed to delete user record /Users/$NAME" >&2
|
|
1857
|
+
exit 1
|
|
1858
|
+
}
|
|
1859
|
+
fi
|
|
1860
|
+
|
|
1861
|
+
# Verify the record is actually gone.
|
|
1862
|
+
if dscl . -read "/Users/$NAME" >/dev/null 2>&1; then
|
|
1863
|
+
echo "ERROR: user record /Users/$NAME still exists after teardown" >&2
|
|
1864
|
+
exit 1
|
|
1865
|
+
fi
|
|
1841
1866
|
|
|
1842
1867
|
echo "OK destroyed $NAME"
|
|
1843
1868
|
`;
|
|
@@ -1998,6 +2023,18 @@ ${consequences.join("\n")}`);
|
|
|
1998
2023
|
throw new CliExit(0);
|
|
1999
2024
|
}
|
|
2000
2025
|
}
|
|
2026
|
+
if (idpExists) {
|
|
2027
|
+
const id = encodeURIComponent(idpAgent.email);
|
|
2028
|
+
if (args.soft) {
|
|
2029
|
+
await apiFetch(`/api/my-agents/${id}`, { method: "PATCH", body: { isActive: false }, idp });
|
|
2030
|
+
consola18.success(`Deactivated IdP agent ${idpAgent.email}`);
|
|
2031
|
+
} else {
|
|
2032
|
+
await apiFetch(`/api/my-agents/${id}`, { method: "DELETE", idp });
|
|
2033
|
+
consola18.success(`Deleted IdP agent ${idpAgent.email}`);
|
|
2034
|
+
}
|
|
2035
|
+
} else {
|
|
2036
|
+
consola18.info("No IdP agent to remove (skipped).");
|
|
2037
|
+
}
|
|
2001
2038
|
if (osUserExists) {
|
|
2002
2039
|
const apes = whichBinary("apes");
|
|
2003
2040
|
if (!apes) {
|
|
@@ -2012,27 +2049,15 @@ ${consequences.join("\n")}`);
|
|
|
2012
2049
|
try {
|
|
2013
2050
|
const script = buildDestroyTeardownScript({ name, homeDir: `/Users/${name}` });
|
|
2014
2051
|
writeFileSync(scriptPath, script, { mode: 448 });
|
|
2015
|
-
consola18.start("Running teardown as root via `apes run --as root`\u2026");
|
|
2016
|
-
consola18.info("You will be asked to approve the as=root grant in your DDISA inbox.");
|
|
2017
|
-
execFileSync3(apes, ["run", "--as", "root", "--", "bash", scriptPath], { stdio: "inherit" });
|
|
2052
|
+
consola18.start("Running teardown as root via `apes run --as root --wait`\u2026");
|
|
2053
|
+
consola18.info("You will be asked to approve the as=root grant in your DDISA inbox; this command blocks until you do.");
|
|
2054
|
+
execFileSync3(apes, ["run", "--as", "root", "--wait", "--", "bash", scriptPath], { stdio: "inherit" });
|
|
2018
2055
|
} finally {
|
|
2019
2056
|
rmSync(scratch, { recursive: true, force: true });
|
|
2020
2057
|
}
|
|
2021
2058
|
} else if (!args["keep-os-user"] && isDarwin()) {
|
|
2022
2059
|
consola18.info("No macOS user to remove (skipped).");
|
|
2023
2060
|
}
|
|
2024
|
-
if (idpExists) {
|
|
2025
|
-
const id = encodeURIComponent(idpAgent.email);
|
|
2026
|
-
if (args.soft) {
|
|
2027
|
-
await apiFetch(`/api/my-agents/${id}`, { method: "PATCH", body: { isActive: false }, idp });
|
|
2028
|
-
consola18.success(`Deactivated IdP agent ${idpAgent.email}`);
|
|
2029
|
-
} else {
|
|
2030
|
-
await apiFetch(`/api/my-agents/${id}`, { method: "DELETE", idp });
|
|
2031
|
-
consola18.success(`Deleted IdP agent ${idpAgent.email}`);
|
|
2032
|
-
}
|
|
2033
|
-
} else {
|
|
2034
|
-
consola18.info("No IdP agent to remove (skipped).");
|
|
2035
|
-
}
|
|
2036
2061
|
consola18.success(`Destroyed ${name}.`);
|
|
2037
2062
|
}
|
|
2038
2063
|
});
|
|
@@ -2347,9 +2372,9 @@ and try again.`
|
|
|
2347
2372
|
hookScriptSource: includeClaudeHook ? BASH_VIA_APE_SHELL_HOOK_SOURCE : null
|
|
2348
2373
|
});
|
|
2349
2374
|
writeFileSync3(scriptPath, script, { mode: 448 });
|
|
2350
|
-
consola21.start("Running privileged setup as root via `apes run --as root`\u2026");
|
|
2351
|
-
consola21.info("You will be asked to approve the as=root grant in your DDISA inbox.");
|
|
2352
|
-
execFileSync4(apes, ["run", "--as", "root", "--", "bash", scriptPath], { stdio: "inherit" });
|
|
2375
|
+
consola21.start("Running privileged setup as root via `apes run --as root --wait`\u2026");
|
|
2376
|
+
consola21.info("You will be asked to approve the as=root grant in your DDISA inbox; this command blocks until you do.");
|
|
2377
|
+
execFileSync4(apes, ["run", "--as", "root", "--wait", "--", "bash", scriptPath], { stdio: "inherit" });
|
|
2353
2378
|
consola21.success(`Agent ${name} spawned.`);
|
|
2354
2379
|
console.log("");
|
|
2355
2380
|
console.log("Run as the agent with:");
|
|
@@ -3626,7 +3651,7 @@ var mcpCommand = defineCommand32({
|
|
|
3626
3651
|
if (transport !== "stdio" && transport !== "sse") {
|
|
3627
3652
|
throw new Error('Transport must be "stdio" or "sse"');
|
|
3628
3653
|
}
|
|
3629
|
-
const { startMcpServer } = await import("./server-
|
|
3654
|
+
const { startMcpServer } = await import("./server-25QMTVUR.js");
|
|
3630
3655
|
await startMcpServer(transport, port);
|
|
3631
3656
|
}
|
|
3632
3657
|
});
|
|
@@ -4074,7 +4099,7 @@ async function bestEffortGrantCount(idp) {
|
|
|
4074
4099
|
}
|
|
4075
4100
|
}
|
|
4076
4101
|
async function runHealth(args) {
|
|
4077
|
-
const version = true ? "0.15.
|
|
4102
|
+
const version = true ? "0.15.2" : "0.0.0";
|
|
4078
4103
|
const auth = loadAuth();
|
|
4079
4104
|
if (!auth) {
|
|
4080
4105
|
throw new CliError("Not logged in. Run `apes login` first.", 1);
|
|
@@ -4276,10 +4301,10 @@ if (shellRewrite) {
|
|
|
4276
4301
|
if (shellRewrite.action === "rewrite") {
|
|
4277
4302
|
process.argv = shellRewrite.argv;
|
|
4278
4303
|
} else if (shellRewrite.action === "version") {
|
|
4279
|
-
console.log(`ape-shell ${"0.15.
|
|
4304
|
+
console.log(`ape-shell ${"0.15.2"} (OpenApe DDISA shell wrapper)`);
|
|
4280
4305
|
process.exit(0);
|
|
4281
4306
|
} else if (shellRewrite.action === "help") {
|
|
4282
|
-
console.log(`ape-shell ${"0.15.
|
|
4307
|
+
console.log(`ape-shell ${"0.15.2"} \u2014 OpenApe DDISA shell wrapper`);
|
|
4283
4308
|
console.log("");
|
|
4284
4309
|
console.log("Usage:");
|
|
4285
4310
|
console.log(" ape-shell Start interactive grant-mediated REPL");
|
|
@@ -4337,7 +4362,7 @@ var configCommand = defineCommand39({
|
|
|
4337
4362
|
var main = defineCommand39({
|
|
4338
4363
|
meta: {
|
|
4339
4364
|
name: "apes",
|
|
4340
|
-
version: "0.15.
|
|
4365
|
+
version: "0.15.2",
|
|
4341
4366
|
description: "Unified CLI for OpenApe"
|
|
4342
4367
|
},
|
|
4343
4368
|
subCommands: {
|