@openape/apes 0.21.2 → 0.22.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/cli.js
CHANGED
|
@@ -63,7 +63,7 @@ import {
|
|
|
63
63
|
} from "./chunk-IDPV5SNB.js";
|
|
64
64
|
|
|
65
65
|
// src/cli.ts
|
|
66
|
-
import
|
|
66
|
+
import consola36 from "consola";
|
|
67
67
|
|
|
68
68
|
// src/ape-shell.ts
|
|
69
69
|
import path from "path";
|
|
@@ -379,7 +379,7 @@ async function loginWithPKCE(idp) {
|
|
|
379
379
|
consola2.success(`Logged in as ${payload.email || payload.sub}`);
|
|
380
380
|
}
|
|
381
381
|
async function loginWithKey(idp, keyPath, agentEmail) {
|
|
382
|
-
const { readFileSync:
|
|
382
|
+
const { readFileSync: readFileSync8 } = await import("fs");
|
|
383
383
|
const { sign: sign3 } = await import("crypto");
|
|
384
384
|
const { loadEd25519PrivateKey: loadEd25519PrivateKey2 } = await import("./ssh-key-YBNNG5K5.js");
|
|
385
385
|
const challengeUrl = await getAgentChallengeEndpoint(idp);
|
|
@@ -392,7 +392,7 @@ async function loginWithKey(idp, keyPath, agentEmail) {
|
|
|
392
392
|
throw new CliError(`Challenge failed: ${await challengeResp.text()}`);
|
|
393
393
|
}
|
|
394
394
|
const { challenge } = await challengeResp.json();
|
|
395
|
-
const keyContent =
|
|
395
|
+
const keyContent = readFileSync8(keyPath, "utf-8");
|
|
396
396
|
const privateKey = loadEd25519PrivateKey2(keyContent);
|
|
397
397
|
const signature = sign3(null, Buffer2.from(challenge), privateKey).toString("base64");
|
|
398
398
|
const authenticateUrl = await getAgentAuthenticateEndpoint(idp);
|
|
@@ -3770,7 +3770,7 @@ var mcpCommand = defineCommand32({
|
|
|
3770
3770
|
if (transport !== "stdio" && transport !== "sse") {
|
|
3771
3771
|
throw new Error('Transport must be "stdio" or "sse"');
|
|
3772
3772
|
}
|
|
3773
|
-
const { startMcpServer } = await import("./server-
|
|
3773
|
+
const { startMcpServer } = await import("./server-GBFP2XSM.js");
|
|
3774
3774
|
await startMcpServer(transport, port);
|
|
3775
3775
|
}
|
|
3776
3776
|
});
|
|
@@ -4408,7 +4408,7 @@ async function bestEffortGrantCount(idp) {
|
|
|
4408
4408
|
}
|
|
4409
4409
|
}
|
|
4410
4410
|
async function runHealth(args) {
|
|
4411
|
-
const version = true ? "0.
|
|
4411
|
+
const version = true ? "0.22.0" : "0.0.0";
|
|
4412
4412
|
const auth = loadAuth();
|
|
4413
4413
|
if (!auth) {
|
|
4414
4414
|
throw new CliError("Not logged in. Run `apes login` first.", 1);
|
|
@@ -4600,6 +4600,77 @@ var workflowsCommand = defineCommand43({
|
|
|
4600
4600
|
}
|
|
4601
4601
|
});
|
|
4602
4602
|
|
|
4603
|
+
// src/version-check.ts
|
|
4604
|
+
import { existsSync as existsSync9, mkdirSync as mkdirSync2, readFileSync as readFileSync7, writeFileSync as writeFileSync6 } from "fs";
|
|
4605
|
+
import { homedir as homedir5 } from "os";
|
|
4606
|
+
import { join as join6 } from "path";
|
|
4607
|
+
import consola35 from "consola";
|
|
4608
|
+
var PACKAGE_NAME = "@openape/apes";
|
|
4609
|
+
var CACHE_TTL_MS = 24 * 60 * 60 * 1e3;
|
|
4610
|
+
var CACHE_FILE = join6(homedir5(), ".config", "apes", ".version-check.json");
|
|
4611
|
+
function readCache() {
|
|
4612
|
+
if (!existsSync9(CACHE_FILE)) return null;
|
|
4613
|
+
try {
|
|
4614
|
+
return JSON.parse(readFileSync7(CACHE_FILE, "utf-8"));
|
|
4615
|
+
} catch {
|
|
4616
|
+
return null;
|
|
4617
|
+
}
|
|
4618
|
+
}
|
|
4619
|
+
function writeCache(entry) {
|
|
4620
|
+
try {
|
|
4621
|
+
const dir = join6(homedir5(), ".config", "apes");
|
|
4622
|
+
if (!existsSync9(dir)) mkdirSync2(dir, { recursive: true, mode: 448 });
|
|
4623
|
+
writeFileSync6(CACHE_FILE, JSON.stringify(entry), { mode: 384 });
|
|
4624
|
+
} catch {
|
|
4625
|
+
}
|
|
4626
|
+
}
|
|
4627
|
+
function compareSemver(a, b) {
|
|
4628
|
+
const pa = a.split(".").map(Number);
|
|
4629
|
+
const pb = b.split(".").map(Number);
|
|
4630
|
+
for (let i = 0; i < Math.max(pa.length, pb.length); i++) {
|
|
4631
|
+
const x = pa[i] ?? 0;
|
|
4632
|
+
const y = pb[i] ?? 0;
|
|
4633
|
+
if (x !== y) return x - y;
|
|
4634
|
+
}
|
|
4635
|
+
return 0;
|
|
4636
|
+
}
|
|
4637
|
+
async function fetchLatestVersion() {
|
|
4638
|
+
try {
|
|
4639
|
+
const res = await fetch(`https://registry.npmjs.org/${encodeURIComponent(PACKAGE_NAME)}/latest`, {
|
|
4640
|
+
headers: { Accept: "application/json" },
|
|
4641
|
+
signal: AbortSignal.timeout(2e3)
|
|
4642
|
+
});
|
|
4643
|
+
if (!res.ok) return null;
|
|
4644
|
+
const body = await res.json();
|
|
4645
|
+
return typeof body.version === "string" ? body.version : null;
|
|
4646
|
+
} catch {
|
|
4647
|
+
return null;
|
|
4648
|
+
}
|
|
4649
|
+
}
|
|
4650
|
+
function warnIfBehind(currentVersion, latest) {
|
|
4651
|
+
if (compareSemver(currentVersion, latest) < 0) {
|
|
4652
|
+
consola35.warn(
|
|
4653
|
+
`apes ${currentVersion} is behind latest @openape/apes@${latest}. Run \`npm i -g @openape/apes@latest\` to update. (Suppress with APES_NO_UPDATE_CHECK=1.)`
|
|
4654
|
+
);
|
|
4655
|
+
}
|
|
4656
|
+
}
|
|
4657
|
+
async function maybeWarnStaleVersion(currentVersion) {
|
|
4658
|
+
if (process.env.APES_NO_UPDATE_CHECK) return;
|
|
4659
|
+
if (!currentVersion || currentVersion === "unknown") return;
|
|
4660
|
+
const cached = readCache();
|
|
4661
|
+
const now = Date.now();
|
|
4662
|
+
if (cached) {
|
|
4663
|
+
warnIfBehind(currentVersion, cached.latest);
|
|
4664
|
+
}
|
|
4665
|
+
if (!cached || now - cached.checkedAt >= CACHE_TTL_MS) {
|
|
4666
|
+
const latest = await fetchLatestVersion();
|
|
4667
|
+
if (latest) {
|
|
4668
|
+
writeCache({ latest, checkedAt: now });
|
|
4669
|
+
if (!cached) warnIfBehind(currentVersion, latest);
|
|
4670
|
+
}
|
|
4671
|
+
}
|
|
4672
|
+
}
|
|
4673
|
+
|
|
4603
4674
|
// src/cli.ts
|
|
4604
4675
|
process.stdout.on("error", (err) => {
|
|
4605
4676
|
if (err.code === "EPIPE") process.exit(0);
|
|
@@ -4610,10 +4681,10 @@ if (shellRewrite) {
|
|
|
4610
4681
|
if (shellRewrite.action === "rewrite") {
|
|
4611
4682
|
process.argv = shellRewrite.argv;
|
|
4612
4683
|
} else if (shellRewrite.action === "version") {
|
|
4613
|
-
console.log(`ape-shell ${"0.
|
|
4684
|
+
console.log(`ape-shell ${"0.22.0"} (OpenApe DDISA shell wrapper)`);
|
|
4614
4685
|
process.exit(0);
|
|
4615
4686
|
} else if (shellRewrite.action === "help") {
|
|
4616
|
-
console.log(`ape-shell ${"0.
|
|
4687
|
+
console.log(`ape-shell ${"0.22.0"} \u2014 OpenApe DDISA shell wrapper`);
|
|
4617
4688
|
console.log("");
|
|
4618
4689
|
console.log("Usage:");
|
|
4619
4690
|
console.log(" ape-shell Start interactive grant-mediated REPL");
|
|
@@ -4671,7 +4742,7 @@ var configCommand = defineCommand44({
|
|
|
4671
4742
|
var main = defineCommand44({
|
|
4672
4743
|
meta: {
|
|
4673
4744
|
name: "apes",
|
|
4674
|
-
version: "0.
|
|
4745
|
+
version: "0.22.0",
|
|
4675
4746
|
description: "Unified CLI for OpenApe"
|
|
4676
4747
|
},
|
|
4677
4748
|
subCommands: {
|
|
@@ -4726,18 +4797,20 @@ async function maybeRefreshAuth() {
|
|
|
4726
4797
|
}
|
|
4727
4798
|
}
|
|
4728
4799
|
await maybeRefreshAuth();
|
|
4800
|
+
await maybeWarnStaleVersion("0.22.0").catch(() => {
|
|
4801
|
+
});
|
|
4729
4802
|
runMain(main).catch((err) => {
|
|
4730
4803
|
if (err instanceof CliExit) {
|
|
4731
4804
|
process.exit(err.exitCode);
|
|
4732
4805
|
}
|
|
4733
4806
|
if (err instanceof CliError) {
|
|
4734
|
-
|
|
4807
|
+
consola36.error(err.message);
|
|
4735
4808
|
process.exit(err.exitCode);
|
|
4736
4809
|
}
|
|
4737
4810
|
if (debug) {
|
|
4738
|
-
|
|
4811
|
+
consola36.error(err);
|
|
4739
4812
|
} else {
|
|
4740
|
-
|
|
4813
|
+
consola36.error(err instanceof ApiError ? err.message : err instanceof Error ? err.message : String(err));
|
|
4741
4814
|
}
|
|
4742
4815
|
process.exit(1);
|
|
4743
4816
|
});
|